-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
A singleton type is not a subtype of its refined type #10980
Comments
@LPTK Do you think you can give this a go? |
Ok I'll try to have a look when I have some time (in the coming weeks). Also, I seem to remember that this used to work in a previous version of Dotty. |
Ok, so I had a look and apparently I misremembered – this never worked in Dotty, even as far back as the first RC versions. I believe the problem is that and that returns the denotation's What could be done would be to return a refinement/intersection of this type However, this goes well beyond the type of changes I'm comfortable doing in Dotty, and I predict that a naive approach would break lots of things and potentially degrade performance, so it'd have to be done very carefully and with better knowledge of Dotty's inner workings than I have. |
Minimized code
https://scastie.scala-lang.org/0PCX1TY0TxCO1Voo5NohLQ
Output
Expectation
Should type check. This is crucially needed for more advanced dependent-typing use cases.
The text was updated successfully, but these errors were encountered: