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

Regression with -principal type inference #6922

Closed
vicuna opened this issue Jul 2, 2015 · 10 comments
Closed

Regression with -principal type inference #6922

vicuna opened this issue Jul 2, 2015 · 10 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Jul 2, 2015

Original bug ID: 6922
Reporter: jhw
Assigned to: @garrigue
Status: assigned (set by jhw on 2017-04-06T19:54:52Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.03.0+dev / +beta1
Category: typing

Bug description

Regression with -principal type inference.

Steps to reproduce

Compile the debug configuration of v1.0.11 of the Oni package, which uses -principal and -warn-error A. With OCaml 4.02, this succeeds. With current 4.03+trunk, this fails because of "type not principal" warnings (errors) in Cf_journal and Cf_gadget.

Additional information

The source code for the Oni package is on Bitbucket at https://bitbucket.org/jhw/oni.

File attachments

@vicuna
Copy link
Author

vicuna commented Jul 4, 2015

Comment author: @garrigue

You should probably report this first to the authors of Oni: a released package should never use -warn-error A, as this may break when warnings become stricter.
Then the authors of this package should check whether the warnings make sense or not.

@vicuna
Copy link
Author

vicuna commented Jul 6, 2015

Comment author: jhw

Jacques, I am the author of the Oni package. The release configuration of the package doesn't use -warn-error A or -principle. Only the debug configuration does. I have a patch that works around the problem I'm reporting at the cost of losing the generality afforded by polymorphic methods, I'm hoping to discover that I won't need it because this problem turns out indeed to be a regression in 4.03. On the other hand, it may turn out that 4.03 actually has an improved type checker and my previously logic should never have been accepted when -principle is used. I'm interested to know which it will be.

@vicuna
Copy link
Author

vicuna commented Jul 7, 2015

Comment author: @garrigue

Can you provide a shorter repro case?
I'm still trying to have omake working here...

@vicuna
Copy link
Author

vicuna commented Aug 16, 2015

Comment author: jhw

I haven't forgotten about this. Just gotten busy with mundane seasonal distractions.

@vicuna
Copy link
Author

vicuna commented May 12, 2016

Comment author: jhw

I was able to work around this problem in the release of Oni 1.0.12 with the following commit. I'm not sure if the workaround should be necessary.

https://bitbucket.org/jhw/oni/commits/ac4738c26d52228db1c69382d5ef1842db9d0b3b

@vicuna
Copy link
Author

vicuna commented Mar 14, 2017

Comment author: @garrigue

Still waiting to see whether this is really a regression or not.

@vicuna
Copy link
Author

vicuna commented Apr 6, 2017

Comment author: jhw

Uploaded a test file. Work around is commented out.

$ ocamlc -principal -warn-error A -i -c type_error.ml
File "type_error.ml", line 184, characters 12-20:
Warning 18: this use of a polymorphic method is not principal.
File "type_error.ml", line 188, characters 12-20:
Warning 18: this use of a polymorphic method is not principal.
File "type_error.ml", line 192, characters 12-20:
Warning 18: this use of a polymorphic method is not principal.
File "type_error.ml", line 196, characters 12-20:
Warning 18: this use of a polymorphic method is not principal.
File "type_error.ml", line 200, characters 12-20:
Warning 18: this use of a polymorphic method is not principal.
File "type_error.ml", line 204, characters 12-20:
Warning 18: this use of a polymorphic method is not principal.
File "type_error.ml", line 208, characters 12-20:
Warning 18: this use of a polymorphic method is not principal.

@vicuna
Copy link
Author

vicuna commented Aug 2, 2017

Comment author: @garrigue

Apparently, inherited methods are not properly marked as known.

Here is a lighter workaround for now : in basic_agent, add

    method private virtual put:
        'a 'b. 'level -> ('event -> 'b) ->
        ('a, unit, string, 'b) format4 -> 'a

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 11, 2020
@trefis
Copy link
Contributor

trefis commented May 11, 2020

Apparently this was solved by #8955.

@trefis trefis closed this as completed May 11, 2020
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

3 participants