- Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:parserbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancementprio:low
Description
Compiler version
3.6.4
Minimized code
def f(i: Int) = i match case 42 => i + 1 case 27 => //^^^^ //unindent expected, but 'case' found i - 1 case _ => iOutput
-- [E040] Syntax Error: /home/amarki/snips/bad-case-align.scala:6:2 ------------ 6 | case 27 => | ^^^^ | unindent expected, but 'case' found -- [E103] Syntax Error: /home/amarki/snips/bad-case-align.scala:8:2 ------------ 8 | case _ => | ^^^^ | Illegal start of toplevel definition | | longer explanation available when compiling with `-explain` 2 errors found Compilation failedExpectation
This is one of those little parse error behaviors that could be improved:
unindent expected means indent expected but previously missing.
This is } expected but for indents.
As usual, the deficiency is that I have to scan backward to figure out my typo. That is a bit harder with braceless syntax. (I might be unaware of when an indent is required.) Another well known use case is that while cut/pasting code, I often lose formatting and get it wrong.
Metadata
Metadata
Assignees
Labels
area:parserbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancementprio:low