Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006416OCamltypingpublic2014-05-13 00:442018-06-26 22:19
Reporterdwang 
Assigned Tooctachron 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Platformx86 64-bitOSLinux CentOS 6OS Version2.6.32-358.23.2.
Product Version4.01.0 
Target VersionFixed in Version4.08.0+dev 
Summary0006416: The same string can mean different types in the same error message
DescriptionCompile this code:

module M = struct
  type t = A
  module M : sig
    val f : t -> unit
  end = struct
    type t = B
    let f B = ()
  end
end

The error is

Values do not match: val f : t -> unit is not included in val f : t -> unit
Line 4, characters 4-21: Expected declaration
Line 7, characters 8-9: Actual declaration

I would prefer the error to be more explicit that there are two
different types here both named 't'.
Steps To ReproduceCompile this code:

module M = struct
  type t = A
  module M : sig
    val f : t -> unit
  end = struct
    type t = B
    let f B = ()
  end
end
TagsNo tags attached.
Attached Files

- Relationships
related to 0004791acknowledged ocamlc -i produces incorrect result 

-  Notes
(0011589)
shinwell (developer)
2014-05-30 12:42

I think this is a fairly long-standing problem, which we should look at after 4.02.
(0011612)
garrigue (manager)
2014-05-31 16:06

As a side note, this problem is already solved for unification errors: in that case, the internal id for each type is printed. This is not done yet for module coercion errors, but shouldn't be more difficult.
(0017693)
octachron (developer)
2017-03-23 18:12
edited on: 2017-03-23 18:12

I have a proposition to extend the mechanism used for unification errors to print unambiguous identifier names in various error and warning messages in the PR https://github.com/ocaml/ocaml/pull/1120 [^] .

(0019214)
octachron (developer)
2018-06-26 22:19

After the merge of the PR above in 4.08, the error message identifies now the different types t and print if possible the location of their definition:

       Values do not match:
         val f : t/1 -> unit
       is not included in
         val f : t/2 -> unit
       File "...", line 5, characters 4-21: Expected declaration
       File "...", line 8, characters 8-9: Actual declaration
       File "...", line 7, characters 4-14:
         Definition of type t/1
       File "...", line 3, characters 2-12:
         Definition of type t/2

- Issue History
Date Modified Username Field Change
2014-05-13 00:44 dwang New Issue
2014-05-16 17:47 doligez Target Version => 4.03.0+dev / +beta1
2014-05-30 12:42 shinwell Note Added: 0011589
2014-05-30 12:42 shinwell Status new => acknowledged
2014-05-30 14:14 shinwell Relationship added related to 0006323
2014-05-31 16:06 garrigue Note Added: 0011612
2016-04-05 14:52 doligez Status acknowledged => confirmed
2016-04-05 14:52 doligez Target Version 4.03.0+dev / +beta1 => 4.03.1+dev
2017-02-16 14:01 doligez Target Version 4.03.1+dev => undecided
2017-02-23 16:45 doligez Category OCaml typing => typing
2017-03-14 09:06 garrigue Relationship added related to 0004791
2017-03-14 09:06 garrigue Relationship deleted related to 0006323
2017-03-15 11:34 doligez Target Version undecided =>
2017-03-23 18:12 octachron Note Added: 0017693
2017-03-23 18:12 octachron Note Edited: 0017693 View Revisions
2018-06-26 22:19 octachron Note Added: 0019214
2018-06-26 22:19 octachron Status confirmed => resolved
2018-06-26 22:19 octachron Fixed in Version => 4.08.0+dev
2018-06-26 22:19 octachron Resolution open => fixed
2018-06-26 22:19 octachron Assigned To => octachron


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker