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
Recursive modules do not correctly handle variance #6492
Comments
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. |
These issues still exist. I think that at some point we will need to change how variance is handled to fix other issues with it -- fundamentally that the annotations do not remain precise after substitution. When that happens it should be possible to fix this issue. |
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. |
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. |
Original bug ID: 6492
Reporter: @lpw25
Status: acknowledged (set by @damiendoligez on 2014-07-30T20:39:06Z)
Resolution: open
Priority: normal
Severity: feature
Target version: later
Category: typing
Tags: recmod
Related to: #5984
Bug description
Variance calculation is done by looking up the variance of any used type constructors in the environment. When types in recursive modules depend on each other, the variance information only travels through one level of indirection.
For example,
Bar.t
is covariant butBaz.t
is invariant in the following example:whereas if the types had been defined recursively then
baz
would be covariant:Variance calculation is also overly conservative when using approximate type definitions from
approx_type_decl
, which means that variance annotations can lead to spurious errors. For example:If the covariance annotation is removed from
Bar.t
then there is no error, andBar.t
is considered covariant:The text was updated successfully, but these errors were encountered: