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

inference: fix vararg normalization in rewrap #39134

Merged
merged 1 commit into from
Jan 10, 2021
Merged

inference: fix vararg normalization in rewrap #39134

merged 1 commit into from
Jan 10, 2021

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jan 6, 2021

Fixes #39082

@vtjnash vtjnash requested a review from Keno January 6, 2021 22:58
@@ -122,6 +122,8 @@ function ⊑(@nospecialize(a), @nospecialize(b))
(a === Any || b === NOT_FOUND) && return false
a === Union{} && return true
b === Union{} && return false
@assert !isa(a, TypeVar) "invalid lattice item"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is somewhat hot. Move this check all the way down to the === check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a pointer comparison will affect this, relative to the many other egal and subtyping test it does

@@ -5,7 +5,7 @@
#####################

function rewrap(@nospecialize(t), @nospecialize(u))
if isa(t, TypeVar) || isa(t, Type)
if isa(t, TypeVar) || isa(t, Type) || isa(t, Core.TypeofVararg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did add a specialization of rewrap_unionall that handles this case (since anything else would be breaking), but I'm not all that convinced that rewrap_unionall should actually work on Vararg. In many cases it's the wrong thing to do. Maybe just make the Vararg case explicit here, since this is an internal function? Alternatively, I think there's only one or two callsites of this that allow a Vararg, so maybe they should use a different entrypoint.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the || already makes it pretty explicit. We can consider other designs later as continued clean up, but this seems to fix CI regression for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright

@Keno Keno merged commit c487dd0 into master Jan 10, 2021
@Keno Keno deleted the jn/39082 branch January 10, 2021 19:28
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
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.

Internal error: encountered unexpected error in runtime: TypeError...
3 participants