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

Warning 42: a case where a type constraint does not help a disambiguation #7239

Closed
vicuna opened this issue Apr 22, 2016 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@vicuna
Copy link

vicuna commented Apr 22, 2016

Original bug ID: 7239
Reporter: furuse
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-09-24T15:32:51Z)
Resolution: fixed
Priority: low
Severity: text
Version: 4.02.3
Target version: 4.03.1+dev
Fixed in version: 4.03.1+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @gasche @hcarty

Bug description

The following (pretty artificial) code produces Warning 42, even with disambiguation by a type constraint:

type a = C
type b = C
let a = (C : a) (* Warning 42: this use of C required disambiguation. *)
let b = (C : b)

@vicuna
Copy link
Author

vicuna commented Apr 23, 2016

Comment author: @garrigue

Maybe the problem is with the text of the warning.
I think that the intended meaning is: C was chosen based on its type information, in absence of type information, a different choice would have been done.
And this is the case here: the default would be b's C.
The goal of this warning is to check compatibility with previous versions of ocaml (and also know whether your code depends on type information).

@vicuna
Copy link
Author

vicuna commented Apr 23, 2016

Comment author: @gasche

Note to self: the various disambiguation warnings would be excellent targets for the new documentation section on compiler Warnings.

I agree that changing the text to make it less confusing would be a good idea. What about:

Warning 42: this use of C relies on type-directed disambiguation,
it will not compile on OCaml 4.00 or earlier.

@vicuna
Copy link
Author

vicuna commented Apr 25, 2016

Comment author: furuse

@gasche, it is great now I understand what Warning 42 is.

@vicuna
Copy link
Author

vicuna commented Apr 25, 2016

Comment author: @gasche

I propose the change in wording in
#561

@vicuna
Copy link
Author

vicuna commented Apr 26, 2016

Comment author: @gasche

The clarified wording has been merged in 4.04. Thanks for the report!

@vicuna vicuna closed this as completed Sep 24, 2017
@vicuna vicuna added this to the 4.03.1 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants