From 4861ebb08ccd3e13af19b9c12f2164b66a5d2bb0 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Thu, 26 Jul 2018 16:30:59 +0100 Subject: 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. --- src/rewriter.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rewriter.ml') diff --git a/src/rewriter.ml b/src/rewriter.ml index 1fa3bc67..f072f91f 100644 --- a/src/rewriter.ml +++ b/src/rewriter.ml @@ -292,7 +292,7 @@ let rewrite_pat rewriters (P_aux (pat,(l,annot)) as orig_pat) = rewrap (P_vector ps) | P_lit _ | P_wild | P_id _ | P_var _ -> rewrap pat | P_or(pat1, pat2) -> rewrap (P_or(rewrite pat1, rewrite pat2)) - | P_not(pat) -> rewrap (P_not(rewrite pat)) + | P_not(pat) -> rewrap (P_not(rewrite pat)) | P_as(pat,id) -> rewrap (P_as(rewrite pat, id)) | P_typ(typ,pat) -> rewrap (P_typ(typ, rewrite pat)) | P_app(id ,pats) -> rewrap (P_app(id, List.map rewrite pats)) -- cgit v1.2.3