Skip to content
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

Exp of Church numerals causes "wildApprox failed to remove uninstantiated X while typechecking" #16146

Closed
Medowhill opened this issue Oct 6, 2022 · 0 comments · Fixed by #16159

Comments

@Medowhill
Copy link
Contributor

Compiler version

3.2.2-RC1-bin-SNAPSHOT-nonbootstrapped-git-a6a3385

Minimized code

type N = [X] => (X => X) => X => X
val exp = (a: N) => (b: N) => b(a)

Output (click arrow to expand)

java.lang.AssertionError: assertion failed: `wildApprox` failed to remove uninstantiated X while typechecking ../Ch.scala
exception occurred while typechecking ../Ch.scala
exception occurred while compiling ../Ch.scala
java.lang.AssertionError: assertion failed: `wildApprox` failed to remove uninstantiated X while compiling ../Ch.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: `wildApprox` failed to remove uninstantiated X
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:626)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeAccumulator.op$proxy22$1(Types.scala:6077)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldArgs$3(Types.scala:6077)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6081)
        at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6167)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:631)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6159)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6089)
        at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6167)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:631)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6091)
        at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6167)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:631)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6132)
        at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6167)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:631)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:619)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6159)
        at dotty.tools.dotc.typer.ProtoTypes$FunProto.fold(ProtoTypes.scala:540)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6129)
        at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6167)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:631)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.fold(ProtoTypes.scala:234)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6129)
        at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6167)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:631)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:6166)
        at dotty.tools.dotc.typer.ProtoTypes$ViewProto.fold(ProtoTypes.scala:597)
        at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:6129)
        at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:6167)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.traverse(Implicits.scala:631)
        at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$2$.apply(Implicits.scala:636)
        at dotty.tools.dotc.typer.ImplicitRunInfo.recur$1(Implicits.scala:712)
        at dotty.tools.dotc.typer.ImplicitRunInfo.computeIScope(Implicits.scala:723)
        at dotty.tools.dotc.typer.ImplicitRunInfo.$anonfun$1(Implicits.scala:797)
        at dotty.tools.dotc.util.ReadOnlyMap.getOrElse(ReadOnlyMap.scala:23)
        at dotty.tools.dotc.typer.ImplicitRunInfo.implicitScope(Implicits.scala:797)
        at dotty.tools.dotc.typer.ImplicitRunInfo.implicitScope$(Implicits.scala:580)
        at dotty.tools.dotc.Run.implicitScope(Run.scala:36)
        at dotty.tools.dotc.typer.Implicits$ImplicitSearch.implicitScope(Implicits.scala:1536)
        at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1499)
        at dotty.tools.dotc.typer.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1508)
        at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1533)
        at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1025)
        at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:808)
        at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:121)
        at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:846)
        at dotty.tools.dotc.typer.Implicits.inferView$(Implicits.scala:808)
        at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:121)
        at dotty.tools.dotc.typer.Typer.tryExtensionOrConversion(Typer.scala:3343)
        at dotty.tools.dotc.typer.Typer.tryInsertImplicitOnQualifier$$anonfun$1(Typer.scala:3289)
        at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3166)
        at dotty.tools.dotc.typer.Typer.tryInsertImplicitOnQualifier(Typer.scala:3295)
        at dotty.tools.dotc.typer.Typer.tryInsertImplicitOnQualifier(Typer.scala:3297)
        at dotty.tools.dotc.typer.Applications.tryWithImplicitOnQualifier$1(Applications.scala:941)
        at dotty.tools.dotc.typer.Applications.realApply$1$$anonfun$4(Applications.scala:1011)
        at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3169)
        at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1014)
        at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1052)
        at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:327)
        at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:121)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2892)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2955)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3142)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1619)
        at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1609)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1619)
        at dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1871)
        at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:249)
        at dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:1871)
        at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1879)
        at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1897)
        at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1898)
        at dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1909)
        at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1658)
        at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1665)
        at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1754)
        at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:787)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:922)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:810)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
        at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
        at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:380)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2833)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2858)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2954)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3048)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3098)
        at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1063)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1067)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2900)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2955)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.typedFunctionValue(Typer.scala:1503)
        at dotty.tools.dotc.typer.Typer.typedFunction(Typer.scala:1276)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2902)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2955)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3142)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1619)
        at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1609)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1619)
        at dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1871)
        at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:249)
        at dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:1871)
        at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1879)
        at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1897)
        at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1898)
        at dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1909)
        at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1658)
        at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1665)
        at dotty.tools.dotc.typer.Namer.defDefSig(Namer.scala:1754)
        at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:787)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:922)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:810)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
        at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
        at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:380)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2833)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2858)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2954)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3048)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3098)
        at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1063)
        at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1067)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2900)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2955)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.typedFunctionValue(Typer.scala:1503)
        at dotty.tools.dotc.typer.Typer.typedFunction(Typer.scala:1276)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2902)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2955)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3142)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr$$anonfun$1(Namer.scala:1619)
        at dotty.tools.dotc.typer.Namer.typedAhead(Namer.scala:1609)
        at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:1619)
        at dotty.tools.dotc.typer.Namer.typedAheadRhs$1$$anonfun$1(Namer.scala:1871)
        at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:249)
        at dotty.tools.dotc.typer.Namer.typedAheadRhs$1(Namer.scala:1871)
        at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:1879)
        at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:1897)
        at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:1898)
        at dotty.tools.dotc.typer.Namer.inferredResultType(Namer.scala:1909)
        at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:1658)
        at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:1665)
        at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:783)
        at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:922)
        at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:810)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
        at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
        at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:380)
        at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2833)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2858)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2954)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3048)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3098)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2532)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2880)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2884)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2954)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3048)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3098)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2659)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2925)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2955)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3022)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3026)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3142)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:44)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:54)
        at scala.Function0.apply$mcV$sp(Function0.scala:39)
        at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:429)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54)
        at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:233)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1328)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:244)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:252)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:261)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:261)
        at dotty.tools.dotc.Run.compileSources(Run.scala:185)
        at dotty.tools.dotc.Run.compile(Run.scala:169)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
        at dotty.tools.dotc.Driver.process(Driver.scala:195)
        at dotty.tools.dotc.Driver.process(Driver.scala:163)
        at dotty.tools.dotc.Driver.process(Driver.scala:175)
        at dotty.tools.dotc.Driver.main(Driver.scala:205)
        at dotty.tools.dotc.Main.main(Main.scala)
@Medowhill Medowhill added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 6, 2022
odersky added a commit to dotty-staging/dotty that referenced this issue Oct 9, 2022
@anatoliykmetyuk anatoliykmetyuk added area:typer and removed itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Oct 10, 2022
mpollmeier pushed a commit to mpollmeier/dotty that referenced this issue Oct 16, 2022
@Kordyjan Kordyjan added this to the 3.2.2 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants