You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
abstract class Power[G <: Global](intp: IMain) {
val global: G
}
object Power {
def apply[G <: Global](intp: IMain { val global: G }) =
new Power[G](intp) { val global: G = intp.global }
}
This variation, differing only by "val intp: Main" instead of "intp: Main", fails:
abstract class Power2[G <: Global](val intp: IMain) {
val global: G
}
object Power2 {
def apply[G <: Global](intp: IMain { val global: G }) =
new Power2[G](intp) { val global: G = intp.global }
}
// error: type mismatch;
// found : this.intp.global.type (with underlying type Global)
// required: G
// new Power2[G](intp) { val global: G = intp.global }
// ^
// one error found
As evidence, should any be needed, that there is no fundamental reason for it, this compiles:
abstract class Power3[G <: Global](intp: IMain) {
val global: G
val intp2 = intp
}
object Power3 {
def apply[G <: Global](intp: IMain { val global: G }) =
new Power3[G](intp) { val global: G = intp.global }
}
The text was updated successfully, but these errors were encountered:
The following code compiles:
This variation, differing only by "val intp: Main" instead of "intp: Main", fails:
As evidence, should any be needed, that there is no fundamental reason for it, this compiles:
The text was updated successfully, but these errors were encountered: