- Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:parseritype:bugitype:crashregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore
Milestone
Description
Compiler version
3.2.0, 3.3.0, 3.3.2-RC1-bin-20230720-98b452d-NIGHTLY
Used not to crash in 3.1.0
Minimized code
trait Foo val foo = new Foo: extension (s: String) def twice
(Note the empty line at the end)
Output (click arrow to expand)
-- [E019] Syntax Error: /Users/mpalka/Projects/besom/Crash.scala:5:13 ---------- 5 | def twice | ^ | Missing return type | | longer explanation available when compiling with `-explain` error while checking extends Foo { extension (s: String) def twice = null } error while checking new Foo { extension (s: String) def twice = null } error while checking val foo = new Foo { extension (s: String) def twice = null } error while checking package <empty> { trait Foo {} val foo = new Foo { extension (s: String) def twice = null } } exception occurred while parser /Users/mpalka/Projects/besom/Crash.scala exception occurred while compiling /Users/mpalka/Projects/besom/Crash.scala java.lang.AssertionError: assertion failed: position error, parent span does not contain child span parent = extends Foo { extension (s: String) def twice = null } # -1, parent span = <21..67>, child = extension (s: String) def twice = null # -1, child span = [32..68] while compiling /Users/mpalka/Projects/besom/Crash.scala Exception in thread "main" java.lang.AssertionError: assertion failed: position error, parent span does not contain child span parent = extends Foo { extension (s: String) def twice = null } # -1, parent span = <21..67>, child = extension (s: String) def twice = null # -1, child span = [32..68] at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8) at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:175) at dotty.tools.dotc.ast.Positioned.check$1$$anonfun$3(Positioned.scala:205) 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.ast.Positioned.check$1(Positioned.scala:205) at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226) at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:200) at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226) at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:200) at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226) at dotty.tools.dotc.ast.Positioned.check$1(Positioned.scala:200) at dotty.tools.dotc.ast.Positioned.check$1$$anonfun$3(Positioned.scala:205) 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.ast.Positioned.check$1(Positioned.scala:205) at dotty.tools.dotc.ast.Positioned.checkPos(Positioned.scala:226) at dotty.tools.dotc.parsing.Parser.parse$$anonfun$1(ParserPhase.scala:38) at dotty.tools.dotc.parsing.Parser.parse$$anonfun$adapted$1(ParserPhase.scala:39) at scala.Function0.apply$mcV$sp(Function0.scala:42) at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:437) at dotty.tools.dotc.parsing.Parser.parse(ParserPhase.scala:39) at dotty.tools.dotc.parsing.Parser.runOn$$anonfun$1(ParserPhase.scala:48) 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.parsing.Parser.runOn(ParserPhase.scala:48) 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.compileSources(Run.scala:195) at dotty.tools.dotc.Run.compile(Run.scala:179) 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)
Expectations
The compilation should fail but without a crash. Note that there's no crash if the empty line gets removed from the end of the file.
Metadata
Metadata
Assignees
Labels
area:parseritype:bugitype:crashregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore