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
StackOverflowError calculating LUBs #7612
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7612?orig=1 |
@retronym said: - val ts1 = ts0 mapConserve (t => elimAnonymousClass(t.underlying))
+ val ts1 = ts0 mapConserve (t => elimAnonymousClass(t.dealiasWiden)) |
@retronym said: trait BaseMapper {
type M
def primaryKeyField: MappedField[M]
}
trait Mapper[A] extends BaseMapper {
type M = A
}
trait IdPK {
self: BaseMapper =>
object id extends MappedField[M]
}
trait KeyedMapper[A]
extends Mapper[A] with BaseMapper
trait MappedField[A]
abstract class A extends KeyedMapper[A] {
def primaryKeyField: MappedField[A]
}
abstract class B extends Mapper[B] with BaseMapper with IdPK {
// okay
// def primaryKeyField: MappedField[M]
// SOE
def primaryKeyField: id.type
}
object Test {
def foo(a: A, b: B) = if (true) a else b // LUB triggers StackOverflowError
} |
@retronym said: |
@retronym said: |
@adriaanm said: |
@gkossakowski said: |
@retronym said: |
Playing with the example, I have reduced it (and renamed it) to the following test case, which has neither abstract classes, nor type members, nor self-annotations, but still throws a similar Stack Overflow error: trait Fili[A]
trait Kili[M] {
def fili: Fili[M]
}
trait A extends Kili[A] {
def fili: Fili[A]
}
trait Ori[M] extends Kili[M] {
val ori: Fili[M]
def fili: ori.type
}
trait B extends Ori[B]
object Test {
def foo(a: A, b: B) = if (true) a else b // LUB triggers StackOverflowError
} Applying the following changes make this code to compile:
The |
Making |
The comment about higher-order type parameters shoud not apply anymore. Fixes scala/bug#7612
Originally Reported: https://groups.google.com/d/msg/scala-internals/itLkThK-yOY/fcTP1ePkNkgJ
Regressed in scala/scala@a06d31f
The text was updated successfully, but these errors were encountered: