| 424 |
| Match (e,b) -> |
| Match (e,b) -> |
| 425 |
let t = type_check env e b.br_accept true in |
let t = type_check env e b.br_accept true in |
| 426 |
type_check_branches loc env t b constr precise |
type_check_branches loc env t b constr precise |
| 427 |
|
|
| 428 |
| Pair (e1,e2) -> |
| Pair (e1,e2) -> |
| 429 |
let rects = Types.Product.get constr in |
let rects = Types.Product.get constr in |
| 430 |
if Types.Product.is_empty rects then |
if Types.Product.is_empty rects then |
| 439 |
Types.times (Types.cons t1) (Types.cons t2) |
Types.times (Types.cons t1) (Types.cons t2) |
| 440 |
else |
else |
| 441 |
constr |
constr |
| 442 |
|
|
| 443 |
| RecordLitt r -> |
| RecordLitt r -> |
| 444 |
let rconstr = Types.Record.get constr in |
let rconstr = Types.Record.get constr in |
| 445 |
if Types.Record.is_empty rconstr then |
if Types.Record.is_empty rconstr then |
| 500 |
| Map (e,b) -> |
| Map (e,b) -> |
| 501 |
let t = compute_type env e in |
let t = compute_type env e in |
| 502 |
Sequence.map (fun t -> type_check_branches loc env t b Types.any true) t |
Sequence.map (fun t -> type_check_branches loc env t b Types.any true) t |
| 503 |
|
|
| 504 |
|
(* We keep these cases here to allow comparison and benchmarking ... |
| 505 |
|
Just comment the corresponding cases in type_check' to |
| 506 |
|
activate these ones. |
| 507 |
|
*) |
| 508 |
|
| Pair (e1,e2) -> |
| 509 |
|
let t1 = compute_type env e1 |
| 510 |
|
and t2 = compute_type env e2 in |
| 511 |
|
Types.times (Types.cons t1) (Types.cons t2) |
| 512 |
|
| RecordLitt r -> |
| 513 |
|
List.fold_left |
| 514 |
|
(fun accu (l,e) -> |
| 515 |
|
let t = compute_type env e in |
| 516 |
|
let t = Types.record l false (Types.cons t) in |
| 517 |
|
Types.cap accu t |
| 518 |
|
) Types.Record.any r |
| 519 |
|
|
| 520 |
|
|
| 521 |
| _ -> assert false |
| _ -> assert false |
| 522 |
|
|
| 523 |
and type_check_branches loc env targ brs constr precise = |
and type_check_branches loc env targ brs constr precise = |