-
Notifications
You must be signed in to change notification settings - Fork 1.1k
issue unifying match types when using an opaque type. #8667
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
Comments
There's no working subtyping for match types, I think you're running into that: #8666 (comment)
In your second example, your |
yes, indeed, if I change the extension method to I don't see why subtyping is the question. It seems to typecheck
So it isn't clear to me why Note, another smaller example seems to work:
So, I'm not sure why check can typecheck, but fetch can't. |
interestingly, in the above check example, if I remove the declaration of the type, it does fail:
and it does so with the same kind of error as |
That's not the issue. The issue is that as far as the type system is concerned,
Yep, if you pass in the type parameter there is no problem, because the compiler doesn't have to solve |
@smarter do you think this is a duplicate issue? |
Yes I think it's a dupe of #8666 since the root cause is the same. |
The issues are linked now anyway |
Uh oh!
There was an error while loading. Please reload this page.
My goal was to make an
Lt[N <: Int]
type and use it to make a safe get operation from a list. I found I could implement the code, but it wouldn't compile when the List type was itself an opaque type, but would when the List type was the standard library (class based type).Minimized code
I used 0.23.0-RC1
see: https://gist.github.com/johnynek/de9816f26f2c54c4f33a5890ed0bfab9
Output
Expectation
Strangely, when I use a standard (class-based) List, the code compiles (see second linked example). But when the List is itself an opaque type, it fails.
If feels like somehow the features don't compose. It is unclear why using match types with an opaque type should change unification.
The text was updated successfully, but these errors were encountered: