Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type a is not compatible with type 'a #7103

Closed
vicuna opened this issue Dec 20, 2015 · 3 comments
Closed

Type a is not compatible with type 'a #7103

vicuna opened this issue Dec 20, 2015 · 3 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Dec 20, 2015

Original bug ID: 7103
Reporter: @hhugo
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-02-16T14:18:06Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.3
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Monitored by: @hhugo @gasche

Bug description

the 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 =

let g : [< `b] t -> unit = fun _ -> ();;

val g : [< `b ] t -> unit =

let h : [> `b] t -> unit = fun _ -> ();;

val h : [> `b ] t -> unit =

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

@vicuna
Copy link
Author

vicuna commented Dec 21, 2015

Comment author: @hhugo

see #365

@vicuna
Copy link
Author

vicuna commented Dec 21, 2015

Comment author: @garrigue

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.

@vicuna
Copy link
Author

vicuna commented Dec 22, 2015

Comment author: @garrigue

Merged GPR 365.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants