Skip to content

AssertionError in LazyRef#ref when a value of type scala.tools.nsc.Global exists #859

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

Closed
smarter opened this issue Oct 23, 2015 · 0 comments
Assignees

Comments

@smarter
Copy link
Member

smarter commented Oct 23, 2015

class Analyzer {
  def foo: scala.tools.nsc.Global = ???
}
% dotc try/Analyzer.scala
cannot take signature of [cannot display due to java.lang.AssertionError: assertion failed, raw string = MethodType(List(foo), List(TypeRef(ThisType(TypeRef(NoPrefix,nsc)),Global)), TypeRef(ThisType(TypeRef(NoPrefix,<empty>)),Analyzer))]
exception while typing [cannot display due to java.lang.AssertionError: assertion failed, raw string = DefDef(<init>,List(),List(List(ValDef(foo,TypeTree[TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,<root>)),scala),tools),nsc),Global)],EmptyTree))),TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,scala)),Unit)],EmptyTree)] of class class dotty.tools.dotc.ast.Trees$DefDef # 50
exception while typing [cannot display due to java.lang.AssertionError: assertion failed, raw string = TypeDef(Analyzer,Template(DefDef(<init>,List(),List(List(ValDef(foo,TypeTree[TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,<root>)),scala),tools),nsc),Global)],EmptyTree))),TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,scala)),Unit)],EmptyTree),List(Apply(Select(New(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,lang)),Object)]),<init>),List())),ValDef(_,EmptyTree,EmptyTree),List(ValDef(foo,TypeTree[TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,<root>)),scala),tools),nsc),Global)],EmptyTree))))] of class class dotty.tools.dotc.ast.Trees$TypeDef # 79
exception while typing [cannot display due to java.lang.AssertionError: assertion failed, raw string = PackageDef(Ident(<empty>),List(TypeDef(Analyzer,Template(DefDef(<init>,List(),List(List(ValDef(foo,TypeTree[TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,<root>)),scala),tools),nsc),Global)],EmptyTree))),TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,scala)),Unit)],EmptyTree),List(Apply(Select(New(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,lang)),Object)]),<init>),List())),ValDef(_,EmptyTree,EmptyTree),List(ValDef(foo,TypeTree[TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,<root>)),scala),tools),nsc),Global)],EmptyTree)))), ValDef(Analyzer,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,<empty>)),Analyzer$)],Apply(Select(New(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,<empty>)),Analyzer$)]),<init>),List())), TypeDef(Analyzer$,Template(DefDef(<init>,List(),List(List()),TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,<empty>)),Analyzer$)],EmptyTree),List(Apply(Select(New(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,lang)),Object)]),<init>),List())),ValDef(_,TypeTree[TermRef(ThisType(TypeRef(NoPrefix,<empty>)),Analyzer)],EmptyTree),List()))))] of class class dotty.tools.dotc.ast.Trees$PackageDef # 85
exception occurred while compiling Analyzer.scala
Exception in thread "main" java.lang.AssertionError: assertion failed
        at scala.Predef$.assert(Predef.scala:151)
        at dotty.tools.dotc.core.Types$LazyRef.ref$lzycompute(Types.scala:1838)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:1837)
        at dotty.tools.dotc.core.Types$LazyRef.toString(Types.scala:1846)
        at java.lang.String.valueOf(String.java:2982)
        at java.lang.StringBuilder.append(StringBuilder.java:131)
        at scala.StringContext.standardInterpolator(StringContext.scala:125)
        at scala.StringContext.s(StringContext.scala:95)
        at dotty.tools.dotc.core.Types$TypeBounds.toString(Types.scala:2694)
        at java.lang.String.valueOf(String.java:2982)
        at java.lang.StringBuilder.append(StringBuilder.java:131)
        at scala.StringContext.standardInterpolator(StringContext.scala:125)
        at scala.StringContext.s(StringContext.scala:95)
        at dotty.tools.dotc.core.Types$RefinedType.toString(Types.scala:1910)
        at java.lang.String.valueOf(String.java:2982)
        at java.lang.StringBuilder.append(StringBuilder.java:131)
        at scala.StringContext.standardInterpolator(StringContext.scala:125)
        at scala.StringContext.s(StringContext.scala:95)
        at dotty.tools.dotc.core.Types$TypeBounds.toString(Types.scala:2694)
        at dotty.tools.dotc.printing.Showable$class.show(Showable.scala:27)
        at dotty.tools.dotc.core.Types$Type.show(Types.scala:73)
        at dotty.tools.dotc.core.TypeComparer$$anonfun$showGoal$1$$anonfun$apply$2.apply(TypeComparer.scala:1116)
        at dotty.tools.dotc.core.TypeComparer$$anonfun$showGoal$1$$anonfun$apply$2.apply(TypeComparer.scala:1116)
        at dotty.tools.dotc.printing.Disambiguation$.disambiguated(Disambiguation.scala:80)
        at dotty.tools.dotc.core.TypeComparer$$anonfun$showGoal$1.apply(TypeComparer.scala:1116)
        at dotty.tools.dotc.core.TypeComparer$$anonfun$showGoal$1.apply(TypeComparer.scala:1116)
        at dotty.tools.dotc.reporting.Reporter$Diagnostic.msg(Reporter.scala:31)
        at dotty.tools.dotc.reporting.Reporter$Diagnostic.isNonSensical(Reporter.scala:44)
        at dotty.tools.dotc.reporting.Reporter$Diagnostic.isSuppressed(Reporter.scala:45)
        at dotty.tools.dotc.reporting.ConsoleReporter.doReport(ConsoleReporter.scala:44)
        at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:221)
        at dotty.tools.dotc.reporting.Reporting$class.println(Reporter.scala:80)
        at dotty.tools.dotc.core.Contexts$Context.println(Contexts.scala:53)
        at dotty.tools.dotc.core.TypeComparer.showGoal(TypeComparer.scala:1116)
        at dotty.tools.dotc.core.TypeComparer$$anonfun$isSubType$1.apply$mcZ$sp(TypeComparer.scala:112)
        at dotty.tools.dotc.core.TypeComparer$$anonfun$isSubType$1.apply(TypeComparer.scala:92)
        at dotty.tools.dotc.core.TypeComparer$$anonfun$isSubType$1.apply(TypeComparer.scala:92)
        at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
        at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:91)
        at dotty.tools.dotc.core.ConstraintHandling$class.isSubTypeWhenFrozen(ConstraintHandling.scala:111)
        at dotty.tools.dotc.core.TypeComparer.isSubTypeWhenFrozen(TypeComparer.scala:19)
        at dotty.tools.dotc.core.Types$Type$$anonfun$frozen_$less$colon$less$1.apply$mcZ$sp(Types.scala:598)
        at dotty.tools.dotc.core.Types$Type$$anonfun$frozen_$less$colon$less$1.apply(Types.scala:598)
        at dotty.tools.dotc.core.Types$Type$$anonfun$frozen_$less$colon$less$1.apply(Types.scala:598)
        at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
        at dotty.tools.dotc.core.Types$Type.frozen_$less$colon$less(Types.scala:597)
        at dotty.tools.dotc.core.Types$Type.overrides(Types.scala:631)
        at dotty.tools.dotc.core.Denotations$Denotation.prefer$1(Denotations.scala:299)
        at dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:304)
        at dotty.tools.dotc.core.Denotations$Denotation.$amp(Denotations.scala:334)
        at dotty.tools.dotc.core.Denotations$DenotUnion.toDenot(Denotations.scala:952)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:1521)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:416)
        at dotty.tools.dotc.core.Types$Type.goThis$1(Types.scala:456)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:414)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:493)
        at dotty.tools.dotc.core.Types$Type$$anonfun$member$1.apply(Types.scala:396)
        at dotty.tools.dotc.core.Types$Type$$anonfun$member$1.apply(Types.scala:396)
        at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
        at dotty.tools.dotc.core.Types$Type.member(Types.scala:395)
        at dotty.tools.dotc.core.Types$NamedType.asMemberOf(Types.scala:1432)
        at dotty.tools.dotc.core.Types$NamedType.loadDenot(Types.scala:1420)
        at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:1308)
        at dotty.tools.dotc.core.Types$NamedType.denotAt(Types.scala:1297)
        at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:1285)
        at dotty.tools.dotc.core.Types$NamedType.symbol(Types.scala:1450)
        at dotty.tools.dotc.core.Types$Type.typeSymbol(Types.scala:267)
        at dotty.tools.dotc.core.Types$Type.isRepeatedParam(Types.scala:188)
        at dotty.tools.dotc.transform.ElimRepeated.elimRepeated(ElimRepeated.scala:41)
        at dotty.tools.dotc.transform.ElimRepeated.transformInfo(ElimRepeated.scala:33)
        at dotty.tools.dotc.transform.TreeTransforms$AnnotationTransformer$class.transform(TreeTransform.scala:184)
        at dotty.tools.dotc.transform.ElimRepeated.transform(ElimRepeated.scala:27)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.currentIfExists(Denotations.scala:635)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:671)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.currentIfExists(Denotations.scala:653)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:671)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.currentIfExists(Denotations.scala:653)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:671)
        at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:381)
        at dotty.tools.dotc.core.Symbols$Symbol.isType(Symbols.scala:400)
        at dotty.tools.dotc.core.TypeErasure$$anonfun$6.apply(TypeErasure.scala:367)
        at dotty.tools.dotc.core.TypeErasure$$anonfun$6.apply(TypeErasure.scala:367)
        at dotty.tools.dotc.core.Scopes$Scope$$anonfun$filteredScope$1.apply(Scopes.scala:133)
        at dotty.tools.dotc.core.Scopes$Scope$$anonfun$filteredScope$1.apply(Scopes.scala:132)
        at scala.collection.Iterator$class.foreach(Iterator.scala:750)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
        at dotty.tools.dotc.core.Scopes$Scope.filteredScope(Scopes.scala:132)
        at dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$apply(TypeErasure.scala:367)
        at dotty.tools.dotc.core.TypeErasure.eraseInfo(TypeErasure.scala:398)
        at dotty.tools.dotc.core.TypeErasure$.transformInfo(TypeErasure.scala:177)
        at dotty.tools.dotc.transform.Erasure.transform(Erasure.scala:54)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.currentIfExists(Denotations.scala:635)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:671)
        at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:1312)
        at dotty.tools.dotc.core.Types$NamedType.denotAt(Types.scala:1297)
        at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:1285)
        at dotty.tools.dotc.core.Types$NamedType.symbol(Types.scala:1450)
        at dotty.tools.dotc.core.Types$Type.typeSymbol(Types.scala:267)
        at dotty.tools.dotc.core.Types$Type.isRepeatedParam(Types.scala:188)
        at dotty.tools.dotc.core.TypeErasure$.sigName(TypeErasure.scala:131)
        at dotty.tools.dotc.core.Signature$$anonfun$prepend$1.apply(Signature.scala:53)
        at dotty.tools.dotc.core.Signature$$anonfun$prepend$1.apply(Signature.scala:53)
        at scala.collection.immutable.List.map(List.scala:273)
        at dotty.tools.dotc.core.Signature.prepend(Signature.scala:53)
        at dotty.tools.dotc.core.Types$MethodType.computeSignature(Types.scala:2113)
        at dotty.tools.dotc.core.Types$MethodicType$class.signature(Types.scala:2032)
        at dotty.tools.dotc.core.Types$MethodType.signature(Types.scala:2041)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:454)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.termRefWithSig(SymDenotations.scala:1048)
        at dotty.tools.dotc.typer.TypeAssigner$class.assignType(TypeAssigner.scala:400)
        at dotty.tools.dotc.typer.Typer.assignType(Typer.scala:57)
        at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:940)
        at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:932)
        at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
        at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:932)
        at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:487)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1113)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1163)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:91)
        at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1175)
        at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1173)
        at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
        at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1173)
        at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:963)
        at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:951)
        at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:951)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1116)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1163)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:91)
        at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1175)
        at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1173)
        at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
        at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1173)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1197)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1208)
        at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:546)
        at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1056)
        at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1047)
        at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1047)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1153)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1165)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:91)
        at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1175)
        at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1173)
        at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
        at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:53)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1173)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1212)
        at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:72)
        at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:271)
        at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:269)
        at scala.collection.immutable.List.map(List.scala:273)
        at dotty.tools.dotc.core.Phases$Phase$class.runOn(Phases.scala:269)
        at dotty.tools.dotc.transform.Erasure.runOn(Erasure.scala:30)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:59)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:56)
        at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:56)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)
        at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)
        at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:52)
        at dotty.tools.dotc.Run.compileSources(Run.scala:49)
        at dotty.tools.dotc.Run.compile(Run.scala:33)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:21)
        at dotty.tools.dotc.Driver.process(Driver.scala:44)
        at dotty.tools.dotc.Driver.main(Driver.scala:48)
        at dotty.tools.dotc.Main.main(Main.scala)
odersky added a commit to dotty-staging/dotty that referenced this issue Feb 5, 2016
Instead of forcing again, and causing an assertion error, back out
assuming that the result is false. Fixes first problem with scala#859.
@odersky odersky closed this as completed in 12a02c7 Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants