| 1134 |
let combine_record l present absent = |
let combine_record l present absent = |
| 1135 |
match (present,absent) with |
match (present,absent) with |
| 1136 |
| (`Ignore r1, Some r2) when r1 = r2 -> r1 |
| (`Ignore r1, Some r2) when r1 = r2 -> r1 |
| 1137 |
| (`Ignore r, None) -> r |
(* | (`Ignore r, None) -> r *) |
| 1138 |
|
(* Could allow this when r has no `Result_other ... *) |
| 1139 |
|
(* Otherwise: |
| 1140 |
|
debug compile {| x = Int; y =? Int |} {| x = Any |};; |
| 1141 |
|
[DEBUG:compile] |
| 1142 |
|
let disp_0 = function |
| 1143 |
|
| Record -> |
| 1144 |
|
[x ]SomeField:$0;NoField:$1 |
| 1145 |
|
*) |
| 1146 |
| (`None, Some r) -> r |
| (`None, Some r) -> r |
| 1147 |
| _ -> `Label (l, present, absent) |
| _ -> `Label (l, present, absent) |
| 1148 |
|
|
| 1486 |
| None, Some r2 -> `Result r2 |
| None, Some r2 -> `Result r2 |
| 1487 |
| _ -> assert false) |
| _ -> assert false) |
| 1488 |
| Some l -> |
| Some l -> |
|
let labs = l :: labs in |
|
| 1489 |
let (plabs,absent) = |
let (plabs,absent) = |
| 1490 |
let pl = label_not_found l pl in |
let pl = label_not_found l pl in |
| 1491 |
let t = Types.Record.restrict_label_absent t l in |
let t = Types.Record.restrict_label_absent t l in |
| 1492 |
pl, dispatch_record_opt disp t pl labs |
pl, dispatch_record_opt disp t pl labs |
| 1493 |
in |
in |
| 1494 |
let present = |
let present = |
| 1495 |
|
let labs = l :: labs in |
| 1496 |
let pl = label_found l pl in |
let pl = label_found l pl in |
| 1497 |
let t = Types.Record.restrict_label_present t l in |
let t = Types.Record.restrict_label_present t l in |
| 1498 |
if Types.Record.is_empty t then `None else |
if Types.Record.is_empty t then `None else |
| 1636 |
Format.fprintf ppf " @[%a@]@\n" print_record r |
Format.fprintf ppf " @[%a@]@\n" print_record r |
| 1637 |
and print_record ppf = function |
and print_record ppf = function |
| 1638 |
| `Result r -> Format.fprintf ppf "%a" print_ret r |
| `Result r -> Format.fprintf ppf "%a" print_ret r |
| 1639 |
| `Result_other (_,r1,r2) -> Format.fprintf ppf "SomeField:%a;NoField:%a" |
| `Result_other (fields,r1,r2) -> |
| 1640 |
|
Format.fprintf ppf "["; |
| 1641 |
|
List.iter |
| 1642 |
|
(fun l -> Format.fprintf ppf "%s " (Types.LabelPool.value l)) |
| 1643 |
|
fields; |
| 1644 |
|
Format.fprintf ppf "]"; |
| 1645 |
|
Format.fprintf ppf "SomeField:%a;NoField:%a" |
| 1646 |
print_ret r1 print_ret r2 |
print_ret r1 print_ret r2 |
| 1647 |
| `Label (l, present, absent) -> |
| `Label (l, present, absent) -> |
| 1648 |
let l = Types.LabelPool.value l in |
let l = Types.LabelPool.value l in |