Skip to content

crash with function accepting polymorphic function type with singleton result #9996

@bishabosha

Description

@bishabosha

Minimized code

Here the reference to t.type causes the crash

def takesId(f: [T] => (t: T) => t.type): Int = f(1)

Output (click arrow to expand)

Exception in thread "main" java.lang.AssertionError: NoDenotation.owner	at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2325)	at dotty.tools.dotc.ast.TypedTreeInfo.isKnownPureOp$1(TreeInfo.scala:401)	at dotty.tools.dotc.ast.TypedTreeInfo.exprPurity(TreeInfo.scala:404)	at dotty.tools.dotc.ast.TypedTreeInfo.exprPurity$(TreeInfo.scala:353)	at dotty.tools.dotc.ast.tpd$.exprPurity(tpd.scala:22)	at dotty.tools.dotc.ast.TypedTreeInfo.isIdempotentExpr(TreeInfo.scala:440)	at dotty.tools.dotc.ast.TypedTreeInfo.isIdempotentExpr$(TreeInfo.scala:353)	at dotty.tools.dotc.ast.tpd$.isIdempotentExpr(tpd.scala:22)	at dotty.tools.dotc.ast.TypedTreeInfo.constToLiteral(TreeInfo.scala:529)	at dotty.tools.dotc.ast.TypedTreeInfo.constToLiteral$(TreeInfo.scala:353)	at dotty.tools.dotc.ast.tpd$.constToLiteral(tpd.scala:22)	at dotty.tools.dotc.transform.FirstTransform.transformApply(FirstTransform.scala:179)	at dotty.tools.dotc.transform.MegaPhase.goApply(MegaPhase.scala:643)	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:280)	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:428)	at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:248)	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:426)	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:436)	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:441)	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:1060)	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:441)	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:361)	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:428)	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:255)	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:426)	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:436)	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:441)	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:1060)	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:441)	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:381)	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:384)	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:428)	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:447)	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:459)	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:296)	at scala.collection.immutable.List.map(List.scala:246)	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:297)	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:180)	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)	at dotty.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:190)	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:198)	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)	at dotty.tools.dotc.Run.compileUnits(Run.scala:205)	at dotty.tools.dotc.Run.compileUnits(Run.scala:147)	at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:151)	at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:161)	at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:233)	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:196)	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:129)	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:132)	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:151)	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:132)	at dotty.tools.repl.Main$.main(Main.scala:6)	at dotty.tools.repl.Main.main(Main.scala)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions