Skip to content

named pattern needs a better error message #207

@lutzhamel

Description

@lutzhamel

Named patterns are special conditional patterns where the main pattern is always a variable and the definition is, the pattern x:p is identical to the pattern x if x is p where x is some variable and p is some pattern. However, syntactically the parser allows arbitrary patterns to appear where only a variable should appear, e.g.

lutz$ asteroid
Asteroid Version 1.1.3
(c) University of Rhode Island
Type "asteroid -h" for help
Press CTRL-D to exit
ast> let (a,b):(%integer,%integer) = (1,2).
error: unknown unifier type 'tuple'                 <<< better error message needed here
ast> 

The parser allows the pattern but during pattern matching an error occurs precisely due to the fact that (a,b) is not a variable but a tuple. We need a better error message here such as variable expected or some such thing.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions