Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007103OCamltypingpublic2015-12-20 16:172017-02-16 15:18
Reporterhhugo 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version4.02.3 
Target VersionFixed in Version4.03.0+dev / +beta1 
Summary0007103: Type a is not compatible with type 'a
Descriptionthe following type error

"Type a is not compatible with type 'a"

should contain the constraint on 'a.

"Type a is not compatible with type 'a = < .. >"
"Type a is not compatible with type 'a = [> `b]"

and eventually not talk about 'a is it's not needed.
Steps To Reproduce        OCaml version 4.02.3

type 'a t
type a

# let f : < .. > t -> unit = fun _ -> ();;
val f : < .. > t -> unit = <fun>
# let g : [< `b] t -> unit = fun _ -> ();;
val g : [< `b ] t -> unit = <fun>
# let h : [> `b] t -> unit = fun _ -> ();;
val h : [> `b ] t -> unit = <fun>

# let _ = fun (x : a t) -> f x;;
Characters 27-28:
  let _ = fun (x : a t) -> f x;;
                             ^
Error: This expression has type a t but an expression was expected of type
         (< .. > as 'a) t
       Type a is not compatible with type 'a

# let _ = fun (x : a t) -> g x;;
Characters 27-28:
  let _ = fun (x : a t) -> g x;;
                             ^
Error: This expression has type a t but an expression was expected of type
         ([< `b ] as 'a) t
       Type a is not compatible with type 'a

# let _ = fun (x : a t) -> h x;;
Characters 27-28:
  let _ = fun (x : a t) -> h x;;
                             ^
Error: This expression has type a t but an expression was expected of type
         ([> `b ] as 'a) t
       Type a is not compatible with type 'a
#
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0015183)
hhugo (reporter)
2015-12-21 11:49

see https://github.com/ocaml/ocaml/pull/365 [^]
(0015184)
garrigue (manager)
2015-12-21 11:52

I'm not sure I understand the problem here.
'a is to be understood in the context of the type printed above, which indicates explicitly what 'a refers to.
It could be possible to print the type once more, but this can be heavy.
(0015185)
garrigue (manager)
2015-12-22 02:28

Merged GPR 365.

- Issue History
Date Modified Username Field Change
2015-12-20 16:17 hhugo New Issue
2015-12-21 11:49 hhugo Note Added: 0015183
2015-12-21 11:52 garrigue Note Added: 0015184
2015-12-22 02:28 garrigue Note Added: 0015185
2015-12-22 02:28 garrigue Status new => resolved
2015-12-22 02:28 garrigue Fixed in Version => 4.03.0+dev / +beta1
2015-12-22 02:28 garrigue Resolution open => fixed
2015-12-22 02:28 garrigue Assigned To => garrigue
2017-02-16 15:18 xleroy Status resolved => closed
2017-02-23 16:45 doligez Category OCaml typing => typing


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker