Skip to content
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

scala.MatchError during parsing #21635

Closed
theosotr opened this issue Sep 24, 2024 · 1 comment · Fixed by #21924
Closed

scala.MatchError during parsing #21635

theosotr opened this issue Sep 24, 2024 · 1 comment · Fixed by #21924
Labels
Milestone

Comments

@theosotr
Copy link

Compiler version

3.5.1

Minimized code

class A(val into: Boolean) {
  def m1(): Any =
    into

  def m2(): Int = 1
}

Output (click arrow to expand)

[31m[31m-- [E040] Syntax Error: program.scala:5:0 -----------------------------------------------------�[0m[0m
[31m5 |�[0m  [33mdef[0m [36mm2[0m(): [35mInt[0m = [31m1[0m
[31m[31m  |�[0m^^^�[0m
[31m  |�[0m'}' expected, but 'end of statement' found
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:3223)
	at dotty.tools.dotc.parsing.Parsers$Parser.addModifier(Parsers.scala:3241)
	at dotty.tools.dotc.parsing.Parsers$Parser.loop$1(Parsers.scala:3302)
	at dotty.tools.dotc.parsing.Parsers$Parser.modifiers(Parsers.scala:3310)
	at dotty.tools.dotc.parsing.Parsers$Parser.defAnnotsMods(Parsers.scala:3345)
	at dotty.tools.dotc.parsing.Parsers$Parser.localDef(Parsers.scala:4559)
	at dotty.tools.dotc.parsing.Parsers$Parser.blockStatSeq$$anonfun$1(Parsers.scala:4595)
	at dotty.tools.dotc.parsing.Parsers$Parser.checkNoEscapingPlaceholders(Parsers.scala:528)
	at dotty.tools.dotc.parsing.Parsers$Parser.blockStatSeq(Parsers.scala:4601)
	at dotty.tools.dotc.parsing.Parsers$Parser.block(Parsers.scala:2865)
	at dotty.tools.dotc.parsing.Parsers$Parser.blockExpr$$anonfun$1(Parsers.scala:2857)
	at dotty.tools.dotc.parsing.Parsers$Parser.enclosed(Parsers.scala:592)
	at dotty.tools.dotc.parsing.Parsers$Parser.inBracesOrIndented(Parsers.scala:622)
	at dotty.tools.dotc.parsing.Parsers$Parser.inDefScopeBraces(Parsers.scala:628)
	at dotty.tools.dotc.parsing.Parsers$Parser.blockExpr(Parsers.scala:2855)
	at dotty.tools.dotc.parsing.Parsers$Parser.simpleExpr(Parsers.scala:2692)
	at dotty.tools.dotc.parsing.Parsers$Parser.$init$$$anonfun$9(Parsers.scala:2645)
	at dotty.tools.dotc.parsing.Parsers$Parser.postfixExpr(Parsers.scala:2621)
	at dotty.tools.dotc.parsing.Parsers$Parser.expr1(Parsers.scala:2463)
	at dotty.tools.dotc.parsing.Parsers$Parser.expr(Parsers.scala:2353)
	at dotty.tools.dotc.parsing.Parsers$Parser.$init$$$anonfun$8(Parsers.scala:2322)
	at dotty.tools.dotc.parsing.Parsers$Parser.subPart(Parsers.scala:692)
	at dotty.tools.dotc.parsing.Parsers$Parser.subExpr(Parsers.scala:2324)
	at dotty.tools.dotc.parsing.Parsers$Parser.defDefOrDcl(Parsers.scala:3896)
	at dotty.tools.dotc.parsing.Parsers$Parser.defOrDcl(Parsers.scala:3772)
	at dotty.tools.dotc.parsing.Parsers$Parser.templateStatSeq$$anonfun$1(Parsers.scala:4509)
	at dotty.tools.dotc.parsing.Parsers$Parser.checkNoEscapingPlaceholders(Parsers.scala:528)
	at dotty.tools.dotc.parsing.Parsers$Parser.templateStatSeq(Parsers.scala:4517)
	at dotty.tools.dotc.parsing.Parsers$Parser.$anonfun$39(Parsers.scala:4392)
	at dotty.tools.dotc.parsing.Parsers$Parser.enclosed(Parsers.scala:592)
	at dotty.tools.dotc.parsing.Parsers$Parser.inBraces(Parsers.scala:611)
	at dotty.tools.dotc.parsing.Parsers$Parser.inBracesOrIndented(Parsers.scala:625)
	at dotty.tools.dotc.parsing.Parsers$Parser.inDefScopeBraces(Parsers.scala:628)
	at dotty.tools.dotc.parsing.Parsers$Parser.templateBody(Parsers.scala:4392)
	at dotty.tools.dotc.parsing.Parsers$Parser.templateBodyOpt(Parsers.scala:4385)
	at dotty.tools.dotc.parsing.Parsers$Parser.template(Parsers.scala:4362)
	at dotty.tools.dotc.parsing.Parsers$Parser.templateOpt(Parsers.scala:4374)
	at dotty.tools.dotc.parsing.Parsers$Parser.classDefRest(Parsers.scala:4031)
	at dotty.tools.dotc.parsing.Parsers$Parser.classDef(Parsers.scala:4026)
	at dotty.tools.dotc.parsing.Parsers$Parser.tmplDef(Parsers.scala:4002)
	at dotty.tools.dotc.parsing.Parsers$Parser.defOrDcl(Parsers.scala:3778)
	at dotty.tools.dotc.parsing.Parsers$Parser.topStatSeq(Parsers.scala:4449)
	at dotty.tools.dotc.parsing.Parsers$Parser.topstats$1(Parsers.scala:4637)
	at dotty.tools.dotc.parsing.Parsers$Parser.compilationUnit$$anonfun$1(Parsers.scala:4642)
	at dotty.tools.dotc.parsing.Parsers$Parser.checkNoEscapingPlaceholders(Parsers.scala:528)
	at dotty.tools.dotc.parsing.Parsers$Parser.compilationUnit(Parsers.scala:4647)
	at dotty.tools.dotc.parsing.Parsers$Parser.parse(Parsers.scala:201)
	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:503)
	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.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
	at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
	at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)
@theosotr theosotr added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 24, 2024
@dwijnand
Copy link
Member

Thalia strikes again (I assume)! 😄

@dwijnand dwijnand added area:parser Spree Suitable for a future Spree and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 24, 2024
@WojciechMazur WojciechMazur added this to the 3.6.3 milestone Nov 25, 2024
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