-
Notifications
You must be signed in to change notification settings - Fork 21
Upper Bound not unified #4043
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
Imported From: https://issues.scala-lang.org/browse/SI-4043?orig=1 |
@retronym said: https://gist.github.com/719247 https://gist.github.com/719352 The workaround is to express the abstract types as members, rather than parameters. this is a bit more verbose. |
@retronym said: Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :power
** Power User mode enabled - BEEP WHIR GYVE **
** :phase has been set to 'typer'. **
** scala.tools.nsc._ has been imported **
** global._, definitions._ also imported **
** Try :help, :vals, power.<tab> **
scala> :paste -raw
// Entering paste mode (ctrl-D to finish)
object TypeParam {
trait GC[K[_ <: H0], H0]
trait PA[H1] {
type Apply[A <: H1] = Any
}
}
// Exiting paste mode, now interpreting.
warning: there was one feature warning; re-run with -feature for details
scala> val pInt = typeOf[TypeParam.PA[Int]]
pInt: $r.intp.global.Type = TypeParam.PA[Int]
scala> val Apply = pInt member TypeName("Apply")
Apply: $r.intp.global.Symbol = type Apply
scala> pInt memberType Apply
res0: $r.intp.global.Type = [A <: H1]Any |
@retronym said: |
@retronym said: Related discussion: https://groups.google.com/d/msg/scala-internals/45XNa6WqvlU/hSWHFF66CQAJ |
This still fails in Scala 2.12.8 (using REPL), but works in the current Scala 2.13.x branch. |
In the following code,
H1
andH0
are bothInt
, but the types are not unified.Substituting
H1
toInt
manually allows compilation:What versions of the following are you using?
Scala: 2.8.1, 2.9.0-SNAPSHOT
See also r23383
The text was updated successfully, but these errors were encountered: