Skip to content

Incorrect code causes the parser to crash when trying to rewrite #22906

Closed
@guofengzh

Description

@guofengzh

Compiler version

Scala 3.6.4/3.7.0-RC1

Minimized code

//> using options -rewrite -indent

def program: Int => Int =
    {`1`: Int  =>  5}

Output (click arrow to expand)

[error] java.lang.ArrayIndexOutOfBoundsException: Index -3 out of bounds for length 22
[error] dotty.tools.dotc.parsing.Parsers$Parser.testChar(Parsers.scala:740)
[error] dotty.tools.dotc.parsing.Parsers$Parser.testChars(Parsers.scala:745)
[error] dotty.tools.dotc.parsing.Parsers$Parser.bracesToIndented(Parsers.scala:863)
[error] dotty.tools.dotc.parsing.Parsers$Parser.inBracesOrIndented(Parsers.scala:648)
[error] dotty.tools.dotc.parsing.Parsers$Parser.inDefScopeBraces(Parsers.scala:652)
......

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions