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: make getfield_tfunc more robust for abstract PartialStruct #34541

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jan 27, 2020

We're currently careful never to make these. But good to be careful?

refs #34513

elseif isa(s, PartialStruct)
elseif isa(s00, PartialStruct)
s01 = widenconst(s00)
s = unwrap_unionall(s01)::DataType
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
s = unwrap_unionall(s01)::DataType
s = s01::DataType

currently this simplification would hold, but do we want to assume that?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think this simplification just makes sense to anyone who knows the fact that we don't form PartialStruct for UnionAll ?

@vtjnash vtjnash closed this Jul 10, 2020
@vtjnash vtjnash reopened this Jan 26, 2021
@vtjnash
Copy link
Member Author

vtjnash commented Jan 26, 2021

It turns out we might make abstract PartialStruct for Tuple (refs #39402), so reopening to add vararg handling to this also

@martinholters
Copy link
Member

So is it possible to construct a case that fails with the current code?

@vtjnash vtjnash requested a review from aviatesk August 23, 2021 20:36
Copy link
Member

@aviatesk aviatesk left a comment

Choose a reason for hiding this comment

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

LGTM. AFAIU, Vararg handling was already added #37769.
Still needs rebase though.

@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Aug 31, 2021
We're currently careful never to make these. But good to be careful?

refs #34513
elseif isa(s, PartialStruct)
elseif isa(s00, PartialStruct)
s = widenconst(s00)
sty = unwrap_unionall(s)::DataType
Copy link
Member

Choose a reason for hiding this comment

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

Just to make sure: is there any possibility where s::DataType doesn't hold ?
This check is good to have though, we may want to form PartialStruct for abstract types other than tuples in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

Currently, no. That is why this PR has sat for so long untouched. But turns out to be fairly straightforward here to add (though I think the necessary type lattice changes may currently be difficult).

@aviatesk aviatesk merged commit 457764f into master Aug 31, 2021
@aviatesk aviatesk deleted the jn/34513 branch August 31, 2021 17:15
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Sep 6, 2021
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
…JuliaLang#34541)

We're currently careful never to make these. But good to be careful?

refs JuliaLang#34513
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
…JuliaLang#34541)

We're currently careful never to make these. But good to be careful?

refs JuliaLang#34513
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.

4 participants