Skip to content

Parser crash with an illegal use of into modifier #21786

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
KacperFKorban opened this issue Oct 16, 2024 · 2 comments · Fixed by #21924
Closed

Parser crash with an illegal use of into modifier #21786

KacperFKorban opened this issue Oct 16, 2024 · 2 comments · Fixed by #21924
Assignees
Labels
Milestone

Comments

@KacperFKorban
Copy link
Member

Compiler version

3.6.1-RC1-bin-20241014-69ac5fb-NIGHTLY

Minimized code

//> using scala 3.nightly
  
into class X

With the language import (import scala.language.experimental.into) also crashes.

Output (click arrow to expand)

  exception occurred while parser /home/kpi/bugs/weirdmods.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Xno-enrich-error-messages.

     while compiling: /home/kpi/bugs/weirdmods.scala
        during phase: parser
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.14
    compiler version: version 3.6.1-RC1-bin-20241014-69ac5fb-NIGHTLY-git-69ac5fb
            settings: -classpath /home/kpi/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.6.1-RC1-bin-20241014-69ac5fb-NIGHTLY/scala3-library_3-3.6.1-RC1-bin-20241014-69ac5fb-NIGHTLY.jar:/home/kpi/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar -d /home/kpi/bugs/.scala-build/bugs_cef53d4a2d-b5801f736d/classes/main -sourceroot /home/kpi/bugs

Exception in thread "main" scala.MatchError: into (of class dotty.tools.dotc.core.Names$SimpleName)
	at dotty.tools.dotc.parsing.Parsers$Parser.modOfToken(Parsers.scala:3266)
	at dotty.tools.dotc.parsing.Parsers$Parser.addModifier(Parsers.scala:3284)
	at dotty.tools.dotc.parsing.Parsers$Parser.loop$1(Parsers.scala:3345)
	at dotty.tools.dotc.parsing.Parsers$Parser.modifiers(Parsers.scala:3353)
	at dotty.tools.dotc.parsing.Parsers$Parser.defAnnotsMods(Parsers.scala:3388)
	at dotty.tools.dotc.parsing.Parsers$Parser.topStatSeq(Parsers.scala:4554)
	at dotty.tools.dotc.parsing.Parsers$Parser.topstats$1(Parsers.scala:4742)
	at dotty.tools.dotc.parsing.Parsers$Parser.compilationUnit$$anonfun$1(Parsers.scala:4747)
	at dotty.tools.dotc.parsing.Parsers$Parser.checkNoEscapingPlaceholders(Parsers.scala:532)
	at dotty.tools.dotc.parsing.Parsers$Parser.compilationUnit(Parsers.scala:4752)
	at dotty.tools.dotc.parsing.Parsers$Parser.parse(Parsers.scala:205)
	at dotty.tools.dotc.parsing.Parser.parse$$anonfun$1(ParserPhase.scala:32)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:507)
	at dotty.tools.dotc.parsing.Parser.parse(ParserPhase.scala:40)
	at dotty.tools.dotc.parsing.Parser.$anonfun$2(ParserPhase.scala:52)
	at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
	at scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
	at scala.collection.immutable.List.prependedAll(List.scala:152)
	at scala.collection.immutable.List$.from(List.scala:685)
	at scala.collection.immutable.List$.from(List.scala:682)
	at scala.collection.IterableOps$WithFilter.map(Iterable.scala:900)
	at dotty.tools.dotc.parsing.Parser.runOn(ParserPhase.scala:51)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
	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$1(Run.scala:336)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:396)
	at dotty.tools.dotc.Run.compileSources(Run.scala:282)
	at dotty.tools.dotc.Run.compile(Run.scala:267)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
	at dotty.tools.dotc.Driver.process(Driver.scala:201)
	at dotty.tools.dotc.Driver.process(Driver.scala:169)
	at dotty.tools.dotc.Driver.process(Driver.scala:181)
	at dotty.tools.dotc.Driver.main(Driver.scala:211)
	at dotty.tools.dotc.Main.main(Main.scala)
Compilation failed
@KacperFKorban
Copy link
Member Author

might be a duplicate/related to #21635

@KacperFKorban KacperFKorban self-assigned this Nov 6, 2024
@mbovel
Copy link
Member

mbovel commented Nov 9, 2024

This issue was picked for the Scala Issue Spree of Monday, November 11th. @KacperFKorban, @hamzaremmal and @kasiaMarek will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

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

Successfully merging a pull request may close this issue.

3 participants