Skip to content

Awesome explanation receives a null tree #9168

Closed
@som-snytt

Description

@som-snytt

Minimized code

$ dotc -explain baddot.scala
-- [E018] Syntax Error: baddot.scala:7:30 --------------------------------------
7 |  def g: Int = try 42 finally ;
  |                              ^
  |                              expression expected but ';' found

Explanation
===========
An expression cannot start with ';'.

-- [E129] Potential Issue Warning: baddot.scala:7:21 ---------------------------
7 |  def g: Int = try 42 finally ;
  |                     ^
  |A pure expression does nothing in statement position; you may be omitting necessary parentheses

Explanation
===========
The pure expression null doesn't have any side effect and its result is not assigned elsewhere.
It can be removed without changing the semantics of the program. This may indicate an error.

1 warning found
1 error found

Output

The pure expression null doesn't have any side effect

Expectation

Awesome error messages should be robust about inputs without any ceremony by the message writer.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions