Skip to content

Dependent function type with a wildcard argument crashes the compiler #18058

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
clavigne opened this issue Jun 25, 2023 · 0 comments · Fixed by #18061
Closed

Dependent function type with a wildcard argument crashes the compiler #18058

clavigne opened this issue Jun 25, 2023 · 0 comments · Fixed by #18061

Comments

@clavigne
Copy link
Contributor

Compiler version

3.3.0

Minimized code

trait F:
  type A

type G = (f: _ <: F) => f.A

Output

Throws a MatchError in the compiler.

Stack trace:

Crashes with stack trace,

scala.MatchError: dotty.tools.dotc.core.Types$UnspecifiedErrorType$@3db432c2 (of class dotty.tools.dotc.core.Types$UnspecifiedErrorType$) while running pickler on rs$line$1
Exception in thread "main" scala.MatchError: dotty.tools.dotc.core.Types$UnspecifiedErrorType$@3db432c2 (of class dotty.tools.dotc.core.Types$UnspecifiedErrorType$)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleNewType(TreePickler.scala:295)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleType(TreePickler.scala:162)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:626)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree$$anonfun$20(TreePickler.scala:642)
        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.core.tasty.TreePickler.pickleTree(TreePickler.scala:642)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:638)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTpt(TreePickler.scala:320)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:339)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:584)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:374)
        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.core.tasty.TreePickler.pickleStats(TreePickler.scala:374)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:608)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:338)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:584)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleStats$$anonfun$2(TreePickler.scala:374)
        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.core.tasty.TreePickler.pickleStats(TreePickler.scala:374)
        at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:624)
        at dotty.tools.dotc.core.tasty.TreePickler.pickle$$anonfun$1(TreePickler.scala:798)
        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.core.tasty.TreePickler.pickle(TreePickler.scala:805)
        at dotty.tools.dotc.transform.Pickler.run$$anonfun$1$$anonfun$1(Pickler.scala:90)
        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.transform.Pickler.run$$anonfun$1(Pickler.scala:142)
        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.transform.Pickler.run(Pickler.scala:142)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:324)
        at scala.collection.immutable.List.map(List.scala:246)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:328)
        at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:150)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:247)
        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:1321)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:263)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:271)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:280)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:280)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:201)
        at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:87)
        at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:307)
        at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:269)
        at dotty.tools.repl.ReplDriver.run$$anonfun$1(ReplDriver.scala:177)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:211)
        at dotty.tools.repl.ReplDriver.runBody$$anonfun$1(ReplDriver.scala:185)
        at dotty.tools.runner.ScalaClassLoader$.asContext(ScalaClassLoader.scala:80)
        at dotty.tools.repl.ReplDriver.runBody(ReplDriver.scala:185)
        at dotty.tools.repl.ReplDriver.run(ReplDriver.scala:178)
        at dotty.tools.repl.ReplDriver.interpretCommand(ReplDriver.scala:479)
        at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:276)
        at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:169)
        at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:172)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:211)
        at dotty.tools.repl.ReplDriver.runBody$$anonfun$1(ReplDriver.scala:185)
        at dotty.tools.runner.ScalaClassLoader$.asContext(ScalaClassLoader.scala:80)
        at dotty.tools.repl.ReplDriver.runBody(ReplDriver.scala:185)
        at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:172)
        at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:134)
        at dotty.tools.repl.Main$.main(Main.scala:7)
        at dotty.tools.repl.Main.main(Main.scala)
@clavigne clavigne added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Jun 25, 2023
@odersky odersky removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Jun 26, 2023
odersky added a commit that referenced this issue Jun 26, 2023
Previously, the type was set to UnspecifiedErrorType. But that violates
the rule that every ErrorType has to be reported. If that does not
happen, crashes in pickler will result.

Fixes #18058
@Kordyjan Kordyjan added this to the 3.4.0 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