Commit adc618c3 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2002-10-30 03:12:08 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-30 03:12:08+00:00
parent 42d62b7e
......@@ -430,17 +430,17 @@ and type_check' loc env e constr precise = match e with
| Some f -> Env.add f a.fun_typ env in
List.iter
(fun (t1,t2) ->
ignore (type_check_branches loc env true t1 a.fun_body t2 false)
ignore (type_check_branches loc env t1 a.fun_body t2 false)
) a.fun_iface;
t
| Match (e,b) ->
let t = type_check env e b.br_accept true in
type_check_branches loc env true t b constr precise
type_check_branches loc env t b constr precise
| Try (e,b) ->
let te = type_check env e constr precise in
let tb = type_check_branches loc env false Types.any b constr precise in
let tb = type_check_branches loc env Types.any b constr precise in
Types.cup te tb
| Pair (e1,e2) ->
......@@ -503,7 +503,7 @@ and type_check' loc env e constr precise = match e with
let res =
Sequence.map
(fun t ->
type_check_branches loc env true t b constr' (precise || (not exact)))
type_check_branches loc env t b constr' (precise || (not exact)))
t in
if not exact then check loc res constr "";
if precise then res else constr
......@@ -570,7 +570,7 @@ and compute_type' loc env = function
type_op loc op args
| Map (e,b) ->
let t = compute_type env e in
Sequence.map (fun t -> type_check_branches loc env true t b Types.any true) t
Sequence.map (fun t -> type_check_branches loc env t b Types.any true) t
(* We keep these cases here to allow comparison and benchmarking ...
Just comment the corresponding cases in type_check' to
......@@ -591,24 +591,24 @@ and compute_type' loc env = function
| _ -> assert false
and type_check_branches loc env exh targ brs constr precise =
and type_check_branches loc env targ brs constr precise =
if Types.is_empty targ then Types.empty
else (
brs.br_typ <- Types.cup brs.br_typ targ;
branches_aux loc env exh targ
branches_aux loc env targ
(if precise then Types.empty else constr)
constr precise brs.br_branches
)
and branches_aux loc env exh targ tres constr precise = function
| [] -> if exh then raise_loc loc (NonExhaustive targ) else tres
and branches_aux loc env targ tres constr precise = function
| [] -> raise_loc loc (NonExhaustive targ)
| b :: rem ->
let p = b.br_pat in
let acc = Types.descr (Patterns.accept p) in
let targ' = Types.cap targ acc in
if Types.is_empty targ'
then branches_aux loc env exh targ tres constr precise rem
then branches_aux loc env targ tres constr precise rem
else
( b.br_used <- true;
let res = Patterns.filter targ' p in
......@@ -619,7 +619,7 @@ and branches_aux loc env exh targ tres constr precise = function
let tres = if precise then Types.cup t tres else tres in
let targ'' = Types.diff targ acc in
if (Types.non_empty targ'') then
branches_aux loc env exh targ'' tres constr precise rem
branches_aux loc env targ'' tres constr precise rem
else
tres
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment