diff options
| author | Alasdair Armstrong | 2019-02-14 15:10:29 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2019-02-14 15:15:28 +0000 |
| commit | cf7eb8b83ecf7278c84f6e22b5659261ee1eddbc (patch) | |
| tree | c7c9c714b0206665299a865bc9460dc339c01a0a /src/rewrites.ml | |
| parent | b8fa1b62c114e030f2dcdc58d7df01ae2308b6d4 (diff) | |
Don't do any rewrites when checking files for Emacs
This makes sure we don't do any kind of re-writing or de-scatter any
definitions when loading files into emacs. The difference here is that
normally all files are processed together, but the emacs mode loads
each file one by one. This is probably what we want to be doing
anyway, so location information stays accurate for scattered
functions for things like type-at-cursor commands and similar.
Also fix some warnings.
Fixes #32
Diffstat (limited to 'src/rewrites.ml')
| -rw-r--r-- | src/rewrites.ml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/rewrites.ml b/src/rewrites.ml index 5a70a721..31117f33 100644 --- a/src/rewrites.ml +++ b/src/rewrites.ml @@ -3525,7 +3525,11 @@ let rewrite_defs_mapping_patterns env = let mapping_in_typ = typ_of_annot p_annot in let x = Env.get_val_spec mapping_id env in - let (_, Typ_aux(Typ_bidir(typ1, typ2), _)) = x in + + let typ1, typ2 = match x with + | (_, Typ_aux(Typ_bidir(typ1, typ2), _)) -> typ1, typ2 + | (_, typ) -> raise (Reporting.err_unreachable (fst p_annot) __POS__ ("Must be bi-directional mapping: " ^ string_of_typ typ)) + in let mapping_direction = if mapping_in_typ = typ1 then @@ -4642,8 +4646,11 @@ let rec remove_clause_from_pattern ctx (P_aux (rm_pat,ann)) res_pat = rp' @ List.map (function [rp1;rp2] -> RP_cons (rp1,rp2) | _ -> assert false) res_pats end | P_record _ -> - raise (Reporting.err_unreachable (fst ann) __POS__ - "Record pattern not supported") + raise (Reporting.err_unreachable (fst ann) __POS__ "Record pattern not supported") + | P_or _ -> + raise (Reporting.err_unreachable (fst ann) __POS__ "Or pattern not supported") + | P_not _ -> + raise (Reporting.err_unreachable (fst ann) __POS__ "Negated pattern not supported") | P_vector _ | P_vector_concat _ | P_string_append _ -> |
