Skip to content

toolboxes don't reset reporters after parser errors #5942

@scabug

Description

@scabug

ToolBox potentially has a bug in the implementation of parseExpr. A call with a string containing a syntax error, produces a ToolBoxError. A subsequent call with a string containing correct code results in the same error:

scala> val tb = m.mkToolBox() 
tb: scala.tools.reflect.ToolBox[reflect.runtime.universe.type] = scala.tools.reflect.ToolBoxFactory$ToolBoxImpl@1f521f12 

scala> tb.parseExpr("def x = {}") // works fine 
res34: tb.u.Tree = def x = () 

scala> tb.parseExpr("def x = {") 
scala.tools.reflect.ToolBoxError: reflective compilation has failed: 

'}' expected but eof found. 
<strack-trace> 

scala> tb.parseExpr("def x = {}") // doesn't work any more 
scala.tools.reflect.ToolBoxError: reflective compilation has failed: 

'}' expected but eof found. 
<strack-trace> 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions