Skip to content
Browse files

[enhance] libbsl: more permissive bsl type checking.

When registering a bypass, if we find a previous definition whose type
differs only in OpaValue declarations (e.g. "int -> option(string)"
and "int -> opa[option(string)]"), we consider them to be the same
type, since this only affects projections.
  • Loading branch information...
1 parent 9fd40e8 commit 8b58cb90b4f8bfe9b9f399f17e3214a142a412d7 @arthuraa arthuraa committed Aug 21, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 compiler/libbsl/bslRegisterLib.ml
View
5 compiler/libbsl/bslRegisterLib.ml
@@ -572,7 +572,10 @@ let register_primitive session ~ks ~ty ~ips ?obj:_ () =
if equal_ks ks c_rp_ks then (
(* checking the type *)
- if (BslTypes.compare ~normalize:true ty c_rp_ty) <> 0
+ (* We do not take opa value declarations into account *)
+ let purged_ty = BslTypes.purge_opavalue ty in
+ let purged_c_rp_ty = BslTypes.purge_opavalue c_rp_ty in
+ if (BslTypes.compare ~normalize:true purged_ty purged_c_rp_ty) <> 0
then (
OManager.printf "%a" FilePos.pp_citation pos ;
OManager.error "##register: @{<bright>conflicting primitive definitions@} for key '@{<brigth>%a@}'@\n" BslKey.pp key

0 comments on commit 8b58cb9

Please sign in to comment.
Something went wrong with that request. Please try again.