Skip to content

Better Errors - misaligned end marker Due To Missing : #26789

Description

@irfanstract

Better Errors - misaligned end marker due to missing : (Parser)

Compiler version

3.9.0-RC4
3.3.8

Minimized example

trait StrItrStatesM ()

  type StrItrState

  type StrLineStartLzy
  <: StrItrState

end StrItrStatesM

Output

misaligned end marker at end StrItrStatesM

misaligned end marker

the compiler is technically correct here.
all that's missing is just a bit more work to find out and tell the 'why', here, a missing : after trait StrItrStatesM ().

such a small snippet might not be hard to tackle for users. the problem comes in when users had to do the "turn braces into idents" on a large file (200+ LOC or more) and encountered that without any hint of what they've been missing.

Expectation:

  end StrItrStatesM
  ^^^^^^
  misaligned end marker

+ Note: the line `trait StrItrStatesM ()` with the same name doesn't mark a start of a block.
+ adding colon (`:`) will turn it into one (see Optional Braces):
+
+   - trait StrItrStatesM ()
+   + trait StrItrStatesM ():

the compiler should also warn on type StrItrState; it's aligned too far to the right.
like:

+   type StrItrState
+   ^^^^^
+   line is indented too far to the right.
+
+   Note: the line `trait StrItrStatesM ()` preceding it doesn't mark a start of a block.

.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:reportingError reporting including formatting, implicit suggestions, etcarea:uxIssues tied to user experience.better-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions