-
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
Regression: Opaque types aliasing context functions are crashing the compiler #16035
Labels
area:opaque-types
itype:bug
itype:crash
regression
This worked in a previous version but doesn't anymore
Milestone
Comments
Kordyjan
added
itype:bug
itype:crash
regression
This worked in a previous version but doesn't anymore
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Sep 13, 2022
Workaround: object Scope:
opaque type Uses[A, B] = A => B
object Uses:
def apply[A, B](fn: A ?=> B): Uses[A, B] = a => fn(using a)
import Scope.*
val uses = Uses[Int, String](i ?=> s"*$i*") I will try to bisect and investigate it tomorrow if nobody gets to it earlier. |
Kordyjan
added
area:opaque-types
and removed
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Sep 13, 2022
Even more interesting is that this works: object Scope:
opaque type Uses[A, B] = A ?=> B
object Uses:
inline def apply[A, B](fn: A ?=> B): Uses[A, B] = fn
import Scope.*
val uses = Uses[Int, String](i ?=> s"*$i*") The only difference being |
Bisect points to f50b55c as first bad commit. |
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Sep 14, 2022
We could allow them but they would not do what one probably expects (i.e. create context closures). This is because abstract types upper-bounded by context functions don't do that either (see neg/i16035a.scala), and we have to keep semantic equivalence between the two. Therefore, it's better to disallow them. Fixes scala#16035
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Sep 14, 2022
We could allow them but they would not do what one probably expects (i.e. create context closures). This is because abstract types upper-bounded by context functions don't do that either (see neg/i16035a.scala), and we have to keep semantic equivalence between the two. Therefore, it's better to disallow them. Fixes scala#16035
Kordyjan
added a commit
that referenced
this issue
Sep 15, 2022
We could allow them but they would not do what one probably expects (i.e. create context closures). This is because abstract types upper-bounded by context functions don't do that either (see neg/i16035a.scala), and we have to keep semantic equivalence between the two. Therefore, it's better to disallow them. Fixes #16035
mpollmeier
pushed a commit
to mpollmeier/dotty
that referenced
this issue
Oct 16, 2022
We could allow them but they would not do what one probably expects (i.e. create context closures). This is because abstract types upper-bounded by context functions don't do that either (see neg/i16035a.scala), and we have to keep semantic equivalence between the two. Therefore, it's better to disallow them. Fixes scala#16035
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:opaque-types
itype:bug
itype:crash
regression
This worked in a previous version but doesn't anymore
Compiler version
3.1.2-RC1 up to 3.2.2-RC1-bin-20220910-ac6cd1c-NIGHTLY
The code was working in the range 3.0.0 - 3.1.1
Minimized code
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: