-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Compile shows weird message: assertion failed: asTerm called on not-a-Term val <none>
#17556
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
Further minimized: // must be sealed
// must be trait (not class)
sealed trait A {
// must be `object` or `case class`
case class X() extends A
}
// companion object must exist
object A Note that the above should not throw an error, as the following does not: sealed trait A {
case class X() extends A
}
val a = new A {}
a.X()
a.X().X()
a.X().X().X() |
stack trace:
|
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
May 24, 2023
The "ordinal" method generated non-sensical patterns if the cases of a sealed trait were found in the trait itself. In that case the ordinal method would be placed in the companion object, but still tried to access the cases via the `this` of the companion class. We are now more careful and fall back to type projections in comparisons. Fixes scala#17556
bishabosha
added a commit
that referenced
this issue
May 24, 2023
The "ordinal" method generated non-sensical patterns if the cases of a sealed trait were found in the trait itself. In that case the ordinal method would be placed in the companion object, but still tried to access the cases via the `this` of the companion class. We are now more careful and fall back to type projections in comparisons. Fixes #17556
Kordyjan
pushed a commit
that referenced
this issue
Nov 16, 2023
The "ordinal" method generated non-sensical patterns if the cases of a sealed trait were found in the trait itself. In that case the ordinal method would be placed in the companion object, but still tried to access the cases via the `this` of the companion class. We are now more careful and fall back to type projections in comparisons. Fixes #17556 [Cherry-picked a0be3d6]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
I tested on
3.2.2
,3.3.0-RC6
and3.nightly
Minimized code
or in scastie
Output (click arrow to expand)
Expect
I expect a better error message.
The text was updated successfully, but these errors were encountered: