aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pretyping/classops.ml4
-rw-r--r--test-suite/success/coercions.v8
2 files changed, 10 insertions, 2 deletions
diff --git a/pretyping/classops.ml b/pretyping/classops.ml
index fe4d0f300..62d774bd7 100644
--- a/pretyping/classops.ml
+++ b/pretyping/classops.ml
@@ -375,8 +375,8 @@ let load_coercion _ o =
then
cache_coercion o
-let open_coercion _ o =
- if not
+let open_coercion i o =
+ if i = 1 && not
(!automatically_import_coercions || Flags.version_less_or_equal Flags.V8_2)
then
cache_coercion o
diff --git a/test-suite/success/coercions.v b/test-suite/success/coercions.v
index 908b5f77d..001beae7e 100644
--- a/test-suite/success/coercions.v
+++ b/test-suite/success/coercions.v
@@ -81,3 +81,11 @@ Coercion irrelevent := (fun _ => I) : True -> car (Build_Setoid True).
Definition ClaimB := forall (X Y:Setoid) (f: extSetoid X Y) (x:X), f x= f x.
+(* Check that coercions are made visible only when modules are imported *)
+
+Module A.
+ Module B. Coercion b2n (b:bool) := if b then 0 else 1. End B.
+ Fail Check S true.
+End A.
+Import A.
+Fail Check S true.