-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Stack overflow error on compile #8357
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
Timing is everything--just found the change that crashes the compiler.
Then it compiles fine. |
More learnings... code for context: object UnionKind:
def unapply(f: FieldInfo): Boolean =
f.fieldType match {
case _: StaticUnionInfo => true
case t: AliasInfo if t.isUnion => true
case t: UnionContainer if t.hasUnion => true // this line here causes crash
case _ => false
} I discovered that if I move the problematic UnionContainer line to the first position, it compiles fine: object UnionKind:
def unapply(f: FieldInfo): Boolean =
f.fieldType match {
case t: UnionContainer if t.hasUnion => true // same line moved here works
case _: StaticUnionInfo => true
case t: AliasInfo if t.isUnion => true
case _ => false
} |
It would be helpful to minimize this further. The fact that the stack overflow happens in provablyDisjoint means it's related to pattern matching exhaustivity checking. Also, did you try to increase the JVM stack size with -Xss? Just to make sure it's a true overflow and not just a very deep recursion. |
I bumped -Xss to 5M and can confirm I still got the overflow error. |
@gzoller I tried to minimize from your repo, it's almost done. However, I couldn't find the definition for trait FieldInfo {
val fieldType: ALL_TYPE
}
opaque type TypeSymbol = String
trait ConcreteType {
val name: String
val typeParameters: List[TypeSymbol]
}
type ALL_TYPE = ConcreteType | TypeSymbol
case class StaticUnionInfo(name: String, typeParameters: List[TypeSymbol]) extends ConcreteType
case class AliasInfo(name: String, typeParameters: List[TypeSymbol]) extends ConcreteType
object UnionKind {
def unapply(f: FieldInfo): Boolean =
f.fieldType match {
case _: StaticUnionInfo => true
case t: AliasInfo if t.isUnion => true
case t: UnionContainer if t.hasUnion => true // this line here causes crash
case _ => false
}
} |
It's in ReflectedThing.scala: trait UnionContainer:
val hasUnion: Boolean |
Uh oh!
There was an error while loading. Please reload this page.
Issue description
Something I changed in my code now causes a StackOverflowError on compile.
Dotty: 0.23.0-bin-20200220-228e593-NIGHTLY
Code: https://github.com/gzoller/dotty_reflection/tree/broken
Should be noted that I'm not using any macro/metaprogramming in the code (that I'm aware of)
I'm using a custom build of scalameta munit, but you don't need test code to reproduce this issue--you can safely comment out this dependency in build.sbt.
I've been trying to narrow down what I changed to cause it to do this, but thus far haven't found a culprit. Will continue narrowing and post any learnings on this bug report.
Steps
Crash output (click arrow to expand)
The text was updated successfully, but these errors were encountered: