summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKathy Gray2014-04-03 14:56:46 +0100
committerKathy Gray2014-04-03 14:56:46 +0100
commite635e7677f56ee7bba4e0aeb2c307938a78045f7 (patch)
tree5caaf109055172bcfb5d73d49be200d2ce9fc345 /src
parent57bcb4a081daa781ad16d3e9b0df7250a9c4bef2 (diff)
Do implicit coercions on expliciit casts
Diffstat (limited to 'src')
-rw-r--r--src/type_check.ml7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/type_check.ml b/src/type_check.ml
index 9d9b64fd..0d86d365 100644
--- a/src/type_check.ml
+++ b/src/type_check.ml
@@ -457,9 +457,10 @@ let rec check_exp envs expect_t (E_aux(e,(l,annot)) : tannot exp) : (tannot exp
(e',t',t_env,cs',effect)
| E_cast(typ,e) ->
let t = typ_to_t typ in
- let t',cs = type_consistent (Expr l) d_env t expect_t in
- let (e',u,t_env,cs',ef) = check_exp envs t' e in
- (e',t',t_env,cs@cs',ef)
+ let (e',u,t_env,cs,ef) = check_exp envs (new_t ()) e in
+ let t',cs2,e' = type_coerce (Expr l) d_env u e' t in
+ let t',cs3,e'' = type_coerce (Expr l) d_env t e' expect_t in
+ (e'',t',t_env,cs@cs2@cs3,ef)
| E_app(id,parms) ->
let i = id_to_string id in
(match Envmap.apply t_env i with