Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006672OCaml~DO NOT USE (was: OCaml general)public2014-11-24 13:322016-12-07 11:47
Reporterlpw25 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version4.03.0+dev / +beta1 
Target Version4.02.3+devFixed in Version4.03.0+dev / +beta1 
Summary0006672: Unused variance specification allowed on destructive type substitution
DescriptionDestructive type substitutions can give a variance specification to their parameters, but it is completely ignored and not even checked for correctness:

    # module type S = sig type 'a t val x : int t end;;
    module type S = sig type 'a t val x : int t end

    # module type T = S with type +'a t := 'a list;;
    module type T = sig val x : int list end

    # module type T = S with type -'a t := 'a list;;
    module type T = sig val x : int list end
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0012573)
lpw25 (developer)
2014-11-24 19:15

It seems the same is true for non-destructive type substitution:

    # module type S = sig type 'a t end;;
    module type S = sig type 'a t end

    # module type T = S with type +'a t = 'a list;;
    module type T = sig type 'a t = 'a list end

    # module type T = S with type -'a t = 'a list;;
    module type T = sig type 'a t = 'a list end

I suggest that the variance annotations are either checked (by setting the `check` parameter of `compute_variance_decl` to true in `transl_with_constraint`) or banned by the parser.
(0013690)
garrigue (manager)
2015-04-20 09:59

Fixed in trunk at revision 16024.
Now the specification is checked.
Only commit this in trunk, as this could in theory break some working programs.

- Issue History
Date Modified Username Field Change
2014-11-24 13:32 lpw25 New Issue
2014-11-24 19:15 lpw25 Note Added: 0012573
2015-01-07 20:01 doligez Status new => acknowledged
2015-01-07 20:01 doligez Product Version => 4.03.0+dev / +beta1
2015-01-13 22:13 doligez Target Version => 4.02.3+dev
2015-04-07 04:12 garrigue Assigned To => garrigue
2015-04-07 04:12 garrigue Status acknowledged => assigned
2015-04-20 09:59 garrigue Note Added: 0013690
2015-04-20 09:59 garrigue Status assigned => resolved
2015-04-20 09:59 garrigue Fixed in Version => 4.03.0+dev / +beta1
2015-04-20 09:59 garrigue Resolution open => fixed
2016-12-07 11:47 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker