-
Notifications
You must be signed in to change notification settings - Fork 1.1k
StackOverflow probably during implicit resolution #5712
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
Thx for reporting! This code snippet is a bit convoluted. It would be great to minimize it and update it when you have time. BTW I get this: java.lang.StackOverflowError while compiling /Users/bibou/Projects/dotty/tests/pos/test.scala
Exception in thread "main" java.lang.StackOverflowError
at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:703)
at dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:533)
at dotty.tools.dotc.core.Types$Type.$anonfun$member$1(Types.scala:518)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
at dotty.tools.dotc.core.Types$Type.member(Types.scala:518)
at dotty.tools.dotc.core.Denotations$DenotationsBase.select$1(Denotations.scala:1309)
at dotty.tools.dotc.core.Denotations$DenotationsBase.recurSimple$1(Denotations.scala:1339)
at dotty.tools.dotc.core.Denotations$DenotationsBase.recurSimple$1(Denotations.scala:1336)
at dotty.tools.dotc.core.Denotations$DenotationsBase.recur$1(Denotations.scala:1341)
at dotty.tools.dotc.core.Denotations$DenotationsBase.staticRef(Denotations.scala:1343)
at dotty.tools.dotc.core.Denotations$DenotationsBase.staticRef$(Denotations.scala:1298)
at dotty.tools.dotc.core.Contexts$ContextBase.staticRef(Contexts.scala:576)
at dotty.tools.dotc.core.Symbols.requiredClass(Symbols.scala:375)
at dotty.tools.dotc.core.Symbols.requiredClass$(Symbols.scala:373)
at dotty.tools.dotc.core.Contexts$Context.requiredClass(Contexts.scala:69)
at dotty.tools.dotc.core.Definitions.FunctionClass(Definitions.scala:936)
at dotty.tools.dotc.core.Definitions.FunctionType(Definitions.scala:949)
at dotty.tools.dotc.core.Definitions.isNonDepFunctionType(Definitions.scala:1107)
at dotty.tools.dotc.core.Definitions.isFunctionType(Definitions.scala:1112)
at dotty.tools.dotc.core.Definitions.asImplicitFunctionType(Definitions.scala:1165)
at dotty.tools.dotc.core.Definitions.asImplicitFunctionType(Definitions.scala:1163)
at dotty.tools.dotc.typer.ProtoTypes$.$anonfun$normalize$1(ProtoTypes.scala:566)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37)
at dotty.tools.dotc.typer.ProtoTypes$.normalize(ProtoTypes.scala:544)
at dotty.tools.dotc.typer.ProtoTypes$.$anonfun$normalize$1(ProtoTypes.scala:567)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:37) |
Weird, for me it just never finishes. Maybe we compiled Dotty differently and it does a tail call for me and not for you. |
On the different crashes: I think I’ve seen such differences between Scalac and Dotty. For instance, Dotty recognizes and implements Dotty’s inline (unlike Scalac), and then some calls (IIRC like track, seen in the stack-trace) don’t consume stack frames (and some recursive calls can become recursive tail calls and then recursive loops). |
Can be minimized to class Scope {
type Code
}
object Main {
def code[T](expr: (given DummyImplicit) => T): Any = ???
def $[T](expr: Scope => Any): T = ???
def main(args: Array[String]): Unit = {
code {
${ (scope1: Scope) => (??? : scope1.Code) }
}
}
} |
Renaming the method Note that
|
The code below never seems to finish type checking. It just hangs forever.
But when the line marked "
Dotty never finishes compiling
" is commented, compilation finishes.Sorry, haven't had time to minimize this further. It seems related to #864
The text was updated successfully, but these errors were encountered: