-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Whitespace-sensitive AssertionError somewhere in the typer (parser stability) #5004
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
This is less whitespace-sensitive: object i0 {
1 match {
case null =>
def this(): Int
def this()
}
} package <empty> {
module object i0 {
1 match
{
case null =>
def <init>(): Unit =
{
<init>(null)
()
}
def <init>() =
{
<init>(null)
()
}
<empty>
}
}
} and when naming the second diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala
index f8d83964e..5281f7a0d 100644
--- a/compiler/src/dotty/tools/dotc/typer/Namer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala
@@ -1158,8 +1158,8 @@ class Namer { typer: Typer =>
/** The type signature of a DefDef with given symbol */
def defDefSig(ddef: DefDef, sym: Symbol)(implicit ctx: Context) = {
- val DefDef(name, tparams, vparamss, _, _) = ddef
- val isConstructor = name == nme.CONSTRUCTOR
+ val DefDef(_, tparams, vparamss, _, _) = ddef
+ val isConstructor = sym.name == nme.CONSTRUCTOR
// The following 3 lines replace what was previously just completeParams(tparams).
// But that can cause bad bounds being computed, as witnessed by new crash:
|
But this isn't a full fix and might be a bad idea.
But this isn't a full fix and might be a bad idea.
This might be the same bug: object i0 {
{
def this
def this
}
} Exception in thread "main" java.lang.AssertionError: assertion failed
at dotty.DottyPredef$.assertFail(DottyPredef.scala:37)
at dotty.tools.dotc.core.Types$MethodType.<init>(Types.scala:2941)
at dotty.tools.dotc.core.Types$CachedMethodType.<init>(Types.scala:2958)
at dotty.tools.dotc.core.Types$MethodTypeCompanion.apply(Types.scala:3026)
at dotty.tools.dotc.core.Types$MethodTypeCompanion.fromSymbols(Types.scala:3022)
at dotty.tools.dotc.typer.NamerContextOps.$anonfun$1(Namer.scala:144)
at scala.collection.immutable.List.$anonfun$foldRight$1(List.scala:405)
at scala.collection.immutable.List.foldRight(List.scala:86)
at scala.collection.TraversableOnce.$colon$bslash(TraversableOnce.scala:153)
at scala.collection.TraversableOnce.$colon$bslash$(TraversableOnce.scala:153)
at scala.collection.AbstractTraversable.$colon$bslash(Traversable.scala:104)
at dotty.tools.dotc.typer.NamerContextOps.methodType(Namer.scala:144)
at dotty.tools.dotc.typer.Namer.wrapMethType$1(Namer.scala:1196)
at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1210)
at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:721)
at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:801)
at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:746)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:237)
at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:184)
at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:186)
at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:343)
at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1771)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1796) AE-4f7e66f7ee706c59e8d8ba100db9d2bf0152b119 |
Yep, seems very likely the same from my analysis! |
@odersky Can you take a look at this? This is the bug with object i0 {
{
def this
def this
}
} |
Improve robustness of Namer for #5004
AE-4f7e66f7ee706c59e8d8ba100db9d2bf0152b119
The text was updated successfully, but these errors were encountered: