Skip to content

Confusing error message when parentheses enclose an invalid expression #6061

@vicuna

Description

@vicuna

Original bug ID: 6061
Reporter: @gasche
Status: acknowledged (set by @gasche on 2013-07-02T14:29:00Z)
Resolution: open
Priority: normal
Severity: feature
Version: 4.01.0+dev
Target version: later
Category: lexing and parsing
Child of: #5068

Bug description

When a correctly-parenthesized expression is syntactically incorrect (inside the parens), the error message sometimes only mention the parentheses, which can be very confusing.

The original report comes from user BlankVerse which spelled "fn" instead of "fun", and got the following error:

List.map (fn x -> x) [1;2;3];;
^
Syntax error: ')' expected, the highlighted '(' might be unmatched

Some other wrong-expressions trigger the same behavior, such as "x let x", but some other do not, such as the following better message (pointing at the last parens):

List.map (let x) [1;2;3];;
^
Error: Syntax error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions