Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006264OCamlOCaml typingpublic2013-12-07 23:012013-12-07 23:20
Reporteryann.regis-gianas 
Assigned Togasche 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionduplicate 
PlatformOSOS Version
Product Version4.01.0 
Target VersionFixed in Version 
Summary0006264: Strange restriction on unification between rigid and flexible variables
DescriptionThe following program is rejected by the type-checker with a strange error message. Replacing 'a by _ make the type-checker happy. Is it a bug or a hard-to-explain restriction of the inference algorithm?

? src git:(master) ? ocaml
        OCaml version 4.01.0

# let f : type a. a -> int = fun x -> let y : 'a = x in 0;;
Characters 49-50:
  let f : type a. a -> int = fun x -> let y : 'a = x in 0;;
                                                   ^
Error: This expression has type a but an expression was expected of type a
       The type constructor a would escape its scope
Steps To ReproduceRun ocaml 4.01.0 on the following phrase:

let f : type a. a -> int = fun x -> let y : 'a = x in 0;;
TagsNo tags attached.
Attached Files

- Relationships
duplicate of 0006150resolvedgarrigue Wrong error: "The type constructor X.t would escape its scope" 

-  Notes
(0010698)
gasche (developer)
2013-12-07 23:20

I believe this is a duplicate of PR#6150; this is related to the fragile scoping of type variables.

- Issue History
Date Modified Username Field Change
2013-12-07 23:01 yann.regis-gianas New Issue
2013-12-07 23:20 gasche Note Added: 0010698
2013-12-07 23:20 gasche Relationship added duplicate of 0006150
2013-12-07 23:20 gasche Status new => resolved
2013-12-07 23:20 gasche Resolution open => duplicate
2013-12-07 23:20 gasche Assigned To => gasche


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker