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

Subtyping backports for 1.9 #49032

Merged
merged 5 commits into from
Mar 24, 2023

Conversation

N5N3
Copy link
Member

@N5N3 N5N3 commented Mar 17, 2023

This PR backports #48479, #48410, #48441, and #48603 to 1.9.
CC @KristofferC.

skip checked `equal_union` by set `state[i] = 1`
…uliaLang#48441)

* Avoid earsing `Runion` within nested `forall_exists_subtype`

If `Runion.more != 0` we‘d better not erase the local `Runion` as we need it if the subtyping fails after.

This commit replaces `forall_exists_subtype` with a local version.
It first tries `forall_exists_subtype` and estimates the "problem scale".
If subtyping fails and the scale looks small then it switches to the slow path.

TODO: At present, the "problem scale" only counts the number of checked `Lunion`s.
But perhaps we need a more accurate result (e.g. sum of `Runion.depth`)

* Change the reversed subtyping into a local check.

Make sure we don't forget the bound in `env`.
(And we can fuse `local_forall_exists_subtype`)

* Optimization for non-union invariant parameter.
If `y` has no free typevar. Then `x <:  y` wont cause any env change. Thus there's no need to split `y`.
@KristofferC KristofferC merged commit 38f0e29 into JuliaLang:backports-release-1.9 Mar 24, 2023
@N5N3 N5N3 deleted the subtyping-backports branch March 24, 2023 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants