-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Syntax error messages involving unclosed parens are sometimes incorrect #5770
Description
Original bug ID: 5770
Reporter: @mauny
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:20:03Z)
Resolution: fixed
Priority: low
Severity: minor
Platform: all
OS: all
OS Version: all
Version: 4.00.0
Target version: later
Fixed in version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Child of: #5068
Monitored by: @hcarty
Bug description
Parsing invalid patterns inside well-balanced parentheses produces an error message saying that parens don't match.
I provide a patch that fixes the problem by adding a few more error rules in the parser and relevant error messages.
Steps to reproduce
$ echo 'match x with (1 as ) -> 0;;' > /tmp/a.ml
$ ocamlc /tmp/a.ml -o /tmp/a
File "/tmp/a.ml", line 1, characters 19-20:
Error: Syntax error: ')' expected
File "/tmp/a.ml", line 1, characters 13-14:
Error: This '(' might be unmatched
Additional information
After applying the patch, the new error message is
File "/tmp/a.ml", line 1, characters 19-20:
Error: Syntax error: identifier expected.