Giter Site home page Giter Site logo

Comments (8)

CyrusNajmabadi avatar CyrusNajmabadi commented on June 22, 2024

Oh that's interesting. And something we didn't consider when we had the intuition of "calling the span version is always better" :) This is def worth bringing to LDM to discuss.

from roslyn.

jaredpar avatar jaredpar commented on June 22, 2024

@AlekseyTs this seems a potentially problematic case. Expression trees can't work with the new overloads but it's also quite logical for them to bind to them. Not sure that we have any precedence for this in the language. Definitely have cases where we say an expression tree can't use a feature but this is more we need it to change binding within expression trees. Don't have any good intuition on how to solve this.

from roslyn.

AndriySvyryd avatar AndriySvyryd commented on June 22, 2024

If the behavior won't be changed, consider adding an analyzer that could fix all of these instances.

from roslyn.

333fred avatar 333fred commented on June 22, 2024

Discussed in LDM on the 12th and 17th.

from roslyn.

AlekseyTs avatar AlekseyTs commented on June 22, 2024

From https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-06-17.md#conclusion:

Do not change the compiler. Improve the error reporting experience.

From https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-06-17.md#params-span-breaks:

We do think we should invest a bit more in the error experience; having the compiler detect when such an overload is used in an expression tree and issue a specific diagnostic, and having the IDE offer to add an explicit array creation will go a long way to making the experience understandable.

from roslyn.

AlekseyTs avatar AlekseyTs commented on June 22, 2024

It looks to me that we already produce a unique enough error message for the scenario. Specifically, I am referring to

error CS9226: An expression tree may not contain an expanded form of non-array params collection parameter.

It is true that the error is not limited to span scenarios, but I think that the suggested IDE fix will be helpful for users in non-span scenarios as well.

from roslyn.

AlekseyTs avatar AlekseyTs commented on June 22, 2024

Moving to IDE to offer the suggested fix.

from roslyn.

AlekseyTs avatar AlekseyTs commented on June 22, 2024

@CyrusNajmabadi Could you please route this issue accordingly? Add the right labels, etc.

from roslyn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.