@@ -93,10 +93,10 @@ struct
9393 include Base
9494 let leq = equal
9595 let join x y =
96- if equal x y then x else raise (Unsupported " fake join" )
96+ if equal x y then x else raise (Unsupported " fake join" ) (* TODO: TopValue? *)
9797 let widen = join
9898 let meet x y =
99- if equal x y then x else raise (Unsupported " fake meet" )
99+ if equal x y then x else raise (Unsupported " fake meet" ) (* TODO: BotValue? *)
100100 let narrow = meet
101101 include NoBotTop
102102
@@ -259,24 +259,36 @@ struct
259259 | (_ , `Top) -> `Top
260260 | (`Bot, x ) -> x
261261 | (x , `Bot) -> x
262- | (`Lifted x , `Lifted y ) -> `Lifted (Base. join x y)
262+ | (`Lifted x , `Lifted y ) ->
263+ try `Lifted (Base. join x y)
264+ with TopValue -> `Top
263265
264266 let meet x y =
265267 match (x,y) with
266268 | (`Bot, _ ) -> `Bot
267269 | (_ , `Bot) -> `Bot
268270 | (`Top, x ) -> x
269271 | (x , `Top) -> x
270- | (`Lifted x , `Lifted y ) -> `Lifted (Base. meet x y)
272+ | (`Lifted x , `Lifted y ) ->
273+ try `Lifted (Base. meet x y)
274+ with BotValue -> `Bot
271275
272276 let widen x y =
273277 match (x,y) with
274- | (`Lifted x , `Lifted y ) -> `Lifted (Base. widen x y)
278+ | (`Lifted x , `Lifted y ) ->
279+ begin
280+ try `Lifted (Base. widen x y)
281+ with TopValue -> `Top
282+ end
275283 | _ -> y
276284
277285 let narrow x y =
278286 match (x,y) with
279- | (`Lifted x , `Lifted y ) -> `Lifted (Base. narrow x y)
287+ | (`Lifted x , `Lifted y ) ->
288+ begin
289+ try `Lifted (Base. narrow x y)
290+ with BotValue -> `Bot
291+ end
280292 | (_ , `Bot) -> `Bot
281293 | (`Top, y ) -> y
282294 | _ -> x
@@ -315,7 +327,7 @@ struct
315327 | (x , `Bot) -> x
316328 | (`Lifted x , `Lifted y ) ->
317329 try `Lifted (Base. join x y)
318- with Uncomparable -> `Top
330+ with Uncomparable | TopValue -> `Top
319331
320332 let meet x y =
321333 match (x,y) with
@@ -325,20 +337,24 @@ struct
325337 | (x , `Top) -> x
326338 | (`Lifted x , `Lifted y ) ->
327339 try `Lifted (Base. meet x y)
328- with Uncomparable -> `Bot
340+ with Uncomparable | BotValue -> `Bot
329341
330342 let widen x y =
331343 match (x,y) with
332344 | (`Lifted x , `Lifted y ) ->
333- (try `Lifted (Base. widen x y)
334- with Uncomparable -> `Top )
345+ begin
346+ try `Lifted (Base. widen x y)
347+ with Uncomparable | TopValue -> `Top
348+ end
335349 | _ -> y
336350
337351 let narrow x y =
338352 match (x,y) with
339353 | (`Lifted x , `Lifted y ) ->
340- (try `Lifted (Base. narrow x y)
341- with Uncomparable -> `Bot )
354+ begin
355+ try `Lifted (Base. narrow x y)
356+ with Uncomparable | BotValue -> `Bot
357+ end
342358 | (_ , `Bot) -> `Bot
343359 | (`Top, y ) -> y
344360 | _ -> x
@@ -378,11 +394,11 @@ struct
378394 | (x , `Bot) -> x
379395 | (`Lifted1 x , `Lifted1 y ) -> begin
380396 try `Lifted1 (Base1. join x y)
381- with Unsupported _ -> `Top
397+ with Unsupported _ | TopValue -> `Top
382398 end
383399 | (`Lifted2 x , `Lifted2 y ) -> begin
384400 try `Lifted2 (Base2. join x y)
385- with Unsupported _ -> `Top
401+ with Unsupported _ | TopValue -> `Top
386402 end
387403 | _ -> `Top
388404
@@ -394,11 +410,11 @@ struct
394410 | (x , `Top) -> x
395411 | (`Lifted1 x , `Lifted1 y ) -> begin
396412 try `Lifted1 (Base1. meet x y)
397- with Unsupported _ -> `Bot
413+ with Unsupported _ | BotValue -> `Bot
398414 end
399415 | (`Lifted2 x , `Lifted2 y ) -> begin
400416 try `Lifted2 (Base2. meet x y)
401- with Unsupported _ -> `Bot
417+ with Unsupported _ | BotValue -> `Bot
402418 end
403419 | _ -> `Bot
404420
@@ -489,7 +505,9 @@ struct
489505 match (x,y) with
490506 | (`Bot, _ ) -> `Bot
491507 | (_ , `Bot) -> `Bot
492- | (`Lifted x , `Lifted y ) -> `Lifted (Base. meet x y)
508+ | (`Lifted x , `Lifted y ) ->
509+ try `Lifted (Base. meet x y)
510+ with BotValue -> `Bot
493511
494512 let widen x y =
495513 match (x,y) with
@@ -498,7 +516,11 @@ struct
498516
499517 let narrow x y =
500518 match (x,y) with
501- | (`Lifted x , `Lifted y ) -> `Lifted (Base. narrow x y)
519+ | (`Lifted x , `Lifted y ) ->
520+ begin
521+ try `Lifted (Base. narrow x y)
522+ with BotValue -> `Bot
523+ end
502524 | (_ , `Bot) -> `Bot
503525 | _ -> x
504526end
@@ -525,7 +547,9 @@ struct
525547 match (x,y) with
526548 | (`Top, x ) -> `Top
527549 | (x , `Top) -> `Top
528- | (`Lifted x , `Lifted y ) -> `Lifted (Base. join x y)
550+ | (`Lifted x , `Lifted y ) ->
551+ try `Lifted (Base. join x y)
552+ with TopValue -> `Top
529553
530554 let meet x y =
531555 match (x,y) with
@@ -535,7 +559,11 @@ struct
535559
536560 let widen x y =
537561 match (x,y) with
538- | (`Lifted x , `Lifted y ) -> `Lifted (Base. widen x y)
562+ | (`Lifted x , `Lifted y ) ->
563+ begin
564+ try `Lifted (Base. widen x y)
565+ with TopValue -> `Top
566+ end
539567 | _ -> y
540568
541569 let narrow x y =
0 commit comments