-
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
Compiler crash using partial function that returns F[_] inside value class #18769
Comments
grzegorz-bielski
added
itype:bug
itype:crash
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Oct 26, 2023
2 tasks
Very slightly minimized (no trait Arb[Fx[_]]:
def pure[A](x: A): Fx[A]
class PfOps(self: Int) extends AnyVal {
def pf[Fy[_]](m: Arb[Fy]): PartialFunction[Int, Fy[Int]] = {
case x => m.pure(x)
}
} This happens during the back-end, when generating Java generic signatures. I suspect it's trying to compute the type of a synthetic method that lacks proper erasure, for some reason. |
nicolasstucki
added
area:erasure
and removed
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Oct 30, 2023
sjrd
added a commit
to dotty-staging/dotty
that referenced
this issue
Nov 9, 2023
Contrary to what an earlier comment said, we do emit HK type parameters in Java signatures. They are always unbounded and never the type of values. However, they can appear as type arguments to other higher-kinded types. Previously, an assertion error would trigger in that situation. We relax the assertion to allow this situation and emit a correct Java signature. I manually verified that the generated Java signatures are consistent with what Scala 2 emits for the same code snippet.
sjrd
added a commit
that referenced
this issue
Nov 9, 2023
Contrary to what an earlier comment said, we do emit HK type parameters in Java signatures. They are always unbounded and never the type of values. However, they can appear as type arguments to other higher-kinded types. Previously, an assertion error would trigger in that situation. We relax the assertion to allow this situation and emit a correct Java signature. I manually verified that the generated Java signatures are consistent with what Scala 2 emits for the same code snippet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.3.1
Minimized code
The example starts working again if either
AnyVal
orF[_]
is removed, orPartialFunction
is changed toFunction1
orimplicit class
is converted to Scala 3 extension method, but it also fails withoutimplicit
keyword.Output (click arrow to expand)
Full stack trace:
The text was updated successfully, but these errors were encountered: