You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7055 Reporter: @sliquister Assigned to:@garrigue Status: closed (set by @xavierleroy on 2017-02-16T14:16:27Z) Resolution: fixed Priority: normal Severity: minor Version: 4.02.3 Fixed in version: 4.03.0+dev / +beta1 Category: typing
Bug description
The following program:
module M : sig
type +'rw t constraint 'rw = [> A ] end = struct type 'rw t = unit constraint 'rw = [> A ]
end
triggers a type error:
File "/tmp/a.ml", line 3, characters 6-61:
Error: Signature mismatch:
Modules do not match:
sig type 'a t = unit constraint 'a = [> A ] end is not included in sig type +'a t constraint 'a = [> A ] end
Type declarations do not match:
type 'a t = unit constraint 'a = [> A ] is not included in type +'a t constraint 'a = [> A ]
File "/tmp/a.ml", line 2, characters 2-38: Expected declaration
File "/tmp/a.ml", line 4, characters 2-44: Actual declaration
Their variances do not agree.
Notice that the t in the structure doesn't have a variance
annotation. If I put the variance annotation on the structure too, the
code types. If I remove the constraint, the code types.
I don't know if that's a known limitation or a bug. Of course it's not
a big problem, although the error in my original program was rather
confusing. It looked like a more complicated version of this:
module M : sig
type +'rw t constraint 'rw = [> A ] type +'rw t2 = 'rw t end = struct type +'rw t = unit constraint 'rw = [> A ]
type 'rw t2 = 'rw t
end
I had the same error as above but on t2, despite t2 being obviously covariant
in 'rw in both the interface and the implementation.
The text was updated successfully, but these errors were encountered:
This is an intentional limitation: it is already hard to check that the variance is correct in presence of constraints (cf. injectivity problems), inferring it is not really an option.
However, I checked the manual for 4.02, and it doesn't mention that fact, so this should be added.
Original bug ID: 7055
Reporter: @sliquister
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-02-16T14:16:27Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.3
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Bug description
The following program:
module M : sig
type +'rw t constraint 'rw = [>
A ] end = struct type 'rw t = unit constraint 'rw = [>
A ]end
triggers a type error:
File "/tmp/a.ml", line 3, characters 6-61:
Error: Signature mismatch:
Modules do not match:
sig type 'a t = unit constraint 'a = [>
A ] end is not included in sig type +'a t constraint 'a = [>
A ] endType declarations do not match:
type 'a t = unit constraint 'a = [>
A ] is not included in type +'a t constraint 'a = [>
A ]File "/tmp/a.ml", line 2, characters 2-38: Expected declaration
File "/tmp/a.ml", line 4, characters 2-44: Actual declaration
Their variances do not agree.
Notice that the t in the structure doesn't have a variance
annotation. If I put the variance annotation on the structure too, the
code types. If I remove the constraint, the code types.
I don't know if that's a known limitation or a bug. Of course it's not
a big problem, although the error in my original program was rather
confusing. It looked like a more complicated version of this:
module M : sig
type +'rw t constraint 'rw = [>
A ] type +'rw t2 = 'rw t end = struct type +'rw t = unit constraint 'rw = [>
A ]type 'rw t2 = 'rw t
end
I had the same error as above but on t2, despite t2 being obviously covariant
in 'rw in both the interface and the implementation.
The text was updated successfully, but these errors were encountered: