Skip to content

REPL gives stack overflow during too eager syntax highlighting, e.g. when multiplying string #16904

Closed
@bjornregnell

Description

@bjornregnell

Compiler version

3.3.0-RC2

Minimized code

$ scala-cli repl -S 3.3.0-RC2
Welcome to Scala 3.3.0-RC2 (17.0.4.1, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                                                       
scala> "works fine" * 100
val res0: String = works fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks fineworks ...
                                                                                                                                                                       
scala> "works not fine"* 1000
Exception in thread "main" java.lang.StackOverflowError
    at dotty.tools.dotc.ast.untpd$UntypedTreeAccumulator.foldMoreCases(untpd.scala:799)
    at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1641)
    at dotty.tools.dotc.ast.untpd$UntypedTreeTraverser.traverseChildren(untpd.scala:809)
    at dotty.tools.dotc.printing.SyntaxHighlighting$TreeHighlighter$2$.traverse(SyntaxHighlighting.scala:123)
    at dotty.tools.dotc.ast.untpd$UntypedTreeTraverser.apply(untpd.scala:808)
    at dotty.tools.dotc.ast.untpd$UntypedTreeTraverser.apply(untpd.scala:808)
 

Expectation

Should work and not give stack overflow (as in e.g. 2.13)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions