diff options
| author | Kathy Gray | 2016-09-19 22:20:20 +0900 |
|---|---|---|
| committer | Kathy Gray | 2016-09-19 22:20:34 +0900 |
| commit | 034f5baee23523f6bbf451bc0e4a5fe05cfd0e2a (patch) | |
| tree | 444d7f5b12d743be79078e166ce8ad7ab0820b5d /src | |
| parent | 62c2f45fbb34703ebc6c43819f4450da5601dff4 (diff) | |
Fix type check bug
Diffstat (limited to 'src')
| -rw-r--r-- | src/type_check.ml | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/type_check.ml b/src/type_check.ml index 452971ae..fa3bcbaa 100644 --- a/src/type_check.ml +++ b/src/type_check.ml @@ -1706,7 +1706,7 @@ and check_lexp envs imp_param ret_t is_top (LEXP_aux(lexp,(l,annot))) | _ -> typ_error l ("Cannot assign to " ^ i ^" with type " ^ t_to_string t ^ ". Assignment must be to registers or non-parameter, non-let-bound local variables.")) - | _,_ -> + | _,_ -> if is_top then typ_error l ("Cannot assign to " ^ i ^" with type " ^ t_to_string t ^ @@ -1813,9 +1813,10 @@ and check_lexp envs imp_param ret_t is_top (LEXP_aux(lexp,(l,annot))) ty,false,Envmap.empty,Emp_set,[],bs,ef,ef) | (Tfn _ ,_) -> (match tag with - | External _ | Spec | Emp_global -> - let tannot = (Base(([],ty),Emp_intro,[],pure_e,pure_e,new_bounds)) in - (LEXP_aux(lexp,(l,tannot)),ty, + | External _ | Spec | Emp_global -> + let u' = {t=Tapp("reg",[TA_typ ty])} in + let tannot = (Base(([],u'),Emp_intro,[],pure_e,pure_e,new_bounds)) in + (LEXP_aux(lexp,(l,tannot)),u', false,Envmap.from_list [i,tannot],Emp_intro,[],new_bounds,pure_e,pure_e) | _ -> typ_error l ("Cannot assign to " ^ i ^ " with type " ^ t_to_string t)) |
