Skip to content

NullPointerException in Types$HKTypeLambda.iso #12460

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
aborg0 opened this issue Sep 12, 2021 · 1 comment
Closed

NullPointerException in Types$HKTypeLambda.iso #12460

aborg0 opened this issue Sep 12, 2021 · 1 comment

Comments

@aborg0
Copy link

aborg0 commented Sep 12, 2021

reproduction steps

using Scala 3.0.2,

final case class TwoTypes[F, A](value: A)
class Minimal {
  def x[C[_]]: C[Int] = ???
  x[TwoTypes].value
}

problem

I would expect a compilation error, but got:

/tmp/scala3-3.0.2$ bin/scalac Minimal.scala
exception occurred while typechecking Minimal.scala
exception occurred while compiling Minimal.scala
java.lang.NullPointerException while compiling Minimal.scala
Exception in thread "main" java.lang.NullPointerException
        at dotty.tools.dotc.core.Types$HKTypeLambda.iso(Types.scala:3883)
        at dotty.tools.dotc.core.Types$Type.equals(Types.scala:1874)
        at dotty.tools.dotc.core.Types$HKLambda.equals(Types.scala:3465)
        at dotty.tools.dotc.core.Substituters$.substParams(Substituters.scala:151)
        at dotty.tools.dotc.core.Substituters$.mapArgs$2(Substituters.scala:158)
        at dotty.tools.dotc.core.Substituters$.substParams(Substituters.scala:158)
        at dotty.tools.dotc.core.Types$Type.substParams(Types.scala:1765)
        at dotty.tools.dotc.core.Types$LambdaType.instantiate(Types.scala:3428)
        at dotty.tools.dotc.core.Types$LambdaType.instantiate$(Types.scala:3389)
        at dotty.tools.dotc.core.Types$HKLambda.instantiate(Types.scala:3462)
        at dotty.tools.dotc.core.TypeApplications$.tryReduce$1(TypeApplications.scala:335)
        at dotty.tools.dotc.core.TypeApplications$.appliedTo$extension(TypeApplications.scala:354)
        at dotty.tools.dotc.core.Types$AppliedType.derivedAppliedType(Types.scala:4288)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:20)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:16)
        at dotty.tools.dotc.core.Types$Type.subst(Types.scala:1745)
        at dotty.tools.dotc.core.Types$HKTypeLambda.newLikeThis$$anonfun$2(Types.scala:3895)
        at dotty.tools.dotc.core.Types$HKTypeLambda.<init>(Types.scala:3851)
        at dotty.tools.dotc.core.Types$HKTypeLambda$.apply(Types.scala:3956)
        at dotty.tools.dotc.core.Types$HKTypeLambda.newLikeThis(Types.scala:3895)
        at dotty.tools.dotc.core.Types$HKTypeLambda.newLikeThis(Types.scala:3890)
        at dotty.tools.dotc.core.Types$HKTypeLambda.newLikeThis(Types.scala:3889)
        at dotty.tools.dotc.core.Types$LambdaType.derivedLambdaType(Types.scala:3446)
        at dotty.tools.dotc.core.Types$LambdaType.derivedLambdaType$(Types.scala:3389)
        at dotty.tools.dotc.core.Types$HKLambda.derivedLambdaType(Types.scala:3462)
        at dotty.tools.dotc.core.Types$TypeLambda.derivedLambdaAbstraction(Types.scala:3826)
        at dotty.tools.dotc.core.Types$TypeLambda.derivedLambdaAbstraction$(Types.scala:3803)
        at dotty.tools.dotc.core.Types$HKTypeLambda.derivedLambdaAbstraction(Types.scala:3844)
        at dotty.tools.dotc.core.Types$Type.goApplied$2$$anonfun$1(Types.scala:803)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.mapInfo(Denotations.scala:626)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.mapInfo(Denotations.scala:625)
        at dotty.tools.dotc.core.Types$Type.goApplied$1(Types.scala:803)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:695)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:870)
        at dotty.tools.dotc.core.Types$Type.memberBasedOnFlags(Types.scala:666)
        at dotty.tools.dotc.core.Types$Type.member(Types.scala:650)
        at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.isMatchedBy(ProtoTypes.scala:187)
        at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:1874)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:315)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:1296)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:195)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:205)
        at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:128)
        at dotty.tools.dotc.core.TypeComparer.testSubType(TypeComparer.scala:154)
        at dotty.tools.dotc.core.TypeComparer$.testSubType(TypeComparer.scala:2715)
        at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:3523)
        at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3619)
        at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3810)
        at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3162)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2941)
        at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:611)
        at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:661)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2663)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2755)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2874)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2897)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2352)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2681)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2685)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2755)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2847)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2897)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2475)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2726)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2756)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2821)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2825)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2941)
        at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
        at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
        at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:43)
        at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:85)
        at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:120)
        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.FrontEnd.runOn(FrontEnd.scala:120)
        at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:205)
        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:1323)
        at dotty.tools.dotc.Run.runPhases$5(Run.scala:216)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:224)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:231)
        at dotty.tools.dotc.Run.compileSources(Run.scala:166)
        at dotty.tools.dotc.Run.compile(Run.scala:150)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
        at dotty.tools.dotc.Driver.process(Driver.scala:199)
        at dotty.tools.dotc.Driver.process(Driver.scala:167)
        at dotty.tools.dotc.Driver.process(Driver.scala:179)
        at dotty.tools.dotc.Driver.main(Driver.scala:209)
        at dotty.tools.dotc.Main.main(Main.scala)
@aborg0 aborg0 closed this as completed Sep 12, 2021
@SethTisue
Copy link
Member

scala/scala3#13513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants