-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot instantiate T
, even when matching overload that doesn't require T exists
#24688
Comments
Shouldn't give this error with just the first overload either, it should fail to match Edit: Indeed the overload wrongly matches Should be noted this is in opposition to #5632 |
maybe can have both using a better-match resolution? |
also, in this example, |
The existing mechanism is that the compiler thinks a better match is one with a more specific type, which in this case is the first overload. Not sure how to work backwards on this. |
sure, I meant among the "working" overloads, so it would pick the 5632 resolution in case both "could work" (indeed for being more specific) |
Applies #24144 to the equivalent matches of generic types, and adds the behavior to matches of generic invocations to generic invocations. Not encountered in many cases so it's hard to come up with tests but an example is the test code in #24688, the match to the generic body never sets the inheritance penalty leaving it at -1, but the match to the generic invocation sets it to 0 which matches worse, when it should set it to -1 because the object does not participate in inheritance.
Description
Nim Version
2.0, 2.2
Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: