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
Failure to report escaping type variable. #7741
Comments
Comment author: @lpw25 Here is a simplified version: type 'a s = S
class type ['x] c = object
method x : 'x list
end
let x : 'a c = object
method x : 'b . 'b s list = [S]
end |
Comment author: @lpw25 I think this comes from the following lines in List.iter2
(fun t v ->
if Variance.(mem May_pos v || mem May_neg v)
then occur_rec bound t) which originate from a commit labelled "allow for phantom univars". So it would appear this bug is deliberate. However, I really think that those lines should be replaced by something that expands the alias in the null variance case rather than just letting the universal variable escape. This is basically a variant on the issue being discussed in this GPR: #1588 |
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. |
Despite #9040 this issue still exists. Univars are allowed to escape their scope through "bivariant" type parameters in |
I'm not sure I understand your analysis. |
Original bug ID: 7741
Reporter: @Drup
Status: new
Resolution: open
Priority: normal
Severity: minor
Category: typing
Related to: #6744
Monitored by: @Drup @gasche
Bug description
The attached file fails with
The implementation blurb.ml
does not match the interface (inferred signature):
Values do not match:
val x : 'a bla t
is not included in
val x : 'a bla t
Regardless of how confusing that error message is, I'm pretty sure this code should fail with an error of the type "The universal variable 'a would escape its scope".
I'm not sure you can break soudness like that, but it seems very sketchy.
Similar to #6744
File attachments
The text was updated successfully, but these errors were encountered: