Possible using static
bug? Compiler resolution to type when a type couldn't possibly be an acceptable value
#3328
Replies: 3 comments
-
I think this is by-design per current name resolution rules. Whether the type |
Beta Was this translation helpful? Give feedback.
-
I guess my follow-up would be: why stick with a broken design? A type can never be an argument to a method (as far as I am aware). Is there scope here to look at the name resolution rules? The existing rules appear to allow contextual decision making. It seems this could be modified without breaking any existing code. |
Beta Was this translation helpful? Give feedback.
-
I don't have a good idea for an alternative design, but the discussion is certainly open :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Version Used:
8.0
Steps to Reproduce:
Expected Behavior:
In the example above there's no way a method (in this case
Select
) should accept a type as an argument and so it should prefer thestatic
methodRight
when resolving (which has been brought into scope byusing static ConsoleApp28.Prelude
at the top of the file).Actual Behavior:
Conclusion
This has been causing me problems ever since the
using static
feature was brought in. The amount of times I've tripped over this is large (becauselanguage-ext
has a largePrelude
class that is used to bring type-constructing methods into the namespace - likeSome(x)
,Left(x)
, etc.).Beta Was this translation helpful? Give feedback.
All reactions