Skip to content

TreeHighlighter crash while generating an xml string at the console #18596

Closed
@AlexITC

Description

@AlexITC

I have tried sbt console as well as scala-cli console, in both cases, generating some valid xml strings crashes with a StackOverflowError. Running the same code without the console works as expected.

Also, generating a non-xml string just works ((1 to 200).foldRight("x") { case (_, n) => s"< $n >" }).

Previously, I was able to generate a different error which I can't reproduce again because I can't find which Scala version I used in that session:

error

Compiler version

3.3.0

Minimized example

(1 to 200).foldRight("x") { case (_, n) => s"<x>$n</x>" }

Output

Exception in thread "main" java.lang.StackOverflowError
	at dotty.tools.dotc.ast.untpd$UntypedTreeTraverser.apply(untpd.scala:808)
	at dotty.tools.dotc.ast.untpd$UntypedTreeTraverser.apply(untpd.scala:808)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1545)
	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)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1545)
	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)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1545)
	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)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1557)
	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)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1545)
	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)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1551)
	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)
	at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1565)
	at dotty.tools.dotc.ast.untpd$UntypedTreeTraverser.traverseChildren(untpd.scala:809)
	at dotty.tools.dotc.printing.SyntaxHighlighting$TreeHighlighter$2$.traverse(SyntaxHighlighting.scala:123)

Expectation

The console mustn't crash.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions