diff options
| author | Alasdair Armstrong | 2018-07-26 16:30:59 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-07-26 16:53:07 +0100 |
| commit | 4861ebb08ccd3e13af19b9c12f2164b66a5d2bb0 (patch) | |
| tree | bdd294f3d0efc80ab7833c192c72ed7f345169e5 /src/parser.mly | |
| parent | 92373cfb9dd6a9a3d450a315d462378b7de20a71 (diff) | |
Some tweaks to not and or patterns
- Fix ambiguities in parser.mly
- Ensure that no new identifiers are bound in or-patterns and
not-patterns, by adding a no_bindings switch to the
environment. These patterns shouldn't generate any bogus flow typing
constraints because we just pass through the original environment
without adding any possible constraints (although this does mean we
don't get any flow typing from negated numeric literals right now,
which is a TODO).
- Reformat some code to match surrounding code.
- Add a typechecking test case for not patterns
- Add a typechecking test case for or patterns
At least at the front end everything should work now, but we need to
do a little bit more to rewrite these patterns away for lem etc.
Diffstat (limited to 'src/parser.mly')
| -rw-r--r-- | src/parser.mly | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/parser.mly b/src/parser.mly index 2a05c013..694a4669 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -676,6 +676,8 @@ pat_string_append: pat1: | atomic_pat { $1 } + | atomic_pat Bar pat1 + { mk_pat (P_or ($1, $3)) $startpos $endpos } | atomic_pat At pat_concat { mk_pat (P_vector_concat ($1 :: $3)) $startpos $endpos } | atomic_pat ColonColon pat1 @@ -710,8 +712,6 @@ atomic_pat: { mk_pat (P_lit $1) $startpos $endpos } | id { mk_pat (P_id $1) $startpos $endpos } - | pat Bar pat - { mk_pat (P_or ($1, $3)) $startpos $endpos } | kid { mk_pat (P_var (mk_pat (P_id (id_of_kid $1)) $startpos $endpos, mk_typ (ATyp_var $1) $startpos $endpos)) $startpos $endpos } |
