Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004791OCamlOCaml generalpublic2009-05-15 12:212017-02-16 14:00
Assigned To 
PlatformOSOS Version
Product Version3.10.2 
Target VersionundecidedFixed in Version 
Summary0004791: ocamlc -i produces incorrect result
Description> cat

(* begin of *)
type t = A
module B =
  type t = B
  let f A = B
(* end of *)

> ocamlc -i

type t = A
module B : sig type t = B val f : t -> t end

The type of f is incorrect, it should be something like "val f : A.t -> B.t" except that there seems to be no way of actually writing a correct signature for module B (both A.t and B.t are unbound at this stage).

On the other hand, other definitions using f seem to be typed correctly.

I may admit that there is no way to solve this problem, but ocamlc -i should report an error instead of producing an incorrect result.

TagsNo tags attached.
Attached Files? file icon [^] (106 bytes) 2009-05-15 12:21 [Show Content]

- Relationships
related to 0007458confirmedgarrigue Printing of type aliases in signatures could be improved (with nonrec) 

-  Notes
garrigue (manager)
2012-06-01 09:42

Scoping of types in signatures is unfortunately a problem with no easy solution.
This is just one of its instances.

Note that unification errors involving several types with the same name result in printing internal ids to distinguish them.
doligez (administrator)
2014-07-31 16:16

FTR, there is one radical solution to this problem: refuse any value whose type cannot be expressed in the current scope. In this example, ocamlc would refuse to compile, with or without option -i.

- Issue History
Date Modified Username Field Change
2009-05-15 12:21 jerhoud New Issue
2009-05-15 12:21 jerhoud File Added:
2009-05-15 17:09 doligez Status new => acknowledged
2012-06-01 09:42 garrigue Note Added: 0007496
2012-07-11 14:51 doligez Target Version => 4.01.0+dev
2012-07-31 13:36 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-17 14:05 doligez Target Version 4.00.1+dev => 4.01.0+dev
2013-07-24 22:33 doligez Target Version 4.01.0+dev => 4.01.1+dev
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-07-31 16:16 doligez Note Added: 0011956
2014-07-31 16:16 doligez Target Version 4.02.0+dev => 4.03.0+dev / +beta1
2016-03-21 17:16 doligez Target Version 4.03.0+dev / +beta1 => 4.03.1+dev
2017-01-17 08:42 garrigue Relationship added related to 0007458
2017-02-16 14:00 doligez Target Version 4.03.1+dev => undecided

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker