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 stupdate for Conditional after slot re-assignment #25602

Merged
merged 1 commit into from
Jan 18, 2018

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jan 17, 2018

We were neglecting to clear Conditional objects upon assignment to their attached slot
(which invalidates their knowledge of the contents of that slot)

fixes #25579

@vtjnash vtjnash requested a review from Keno January 17, 2018 05:58
@JeffBezanson JeffBezanson added bugfix This change fixes an existing bug compiler:inference Type inference labels Jan 17, 2018
@@ -28,11 +28,11 @@ end
# end
# ```
mutable struct Conditional
var::Union{Slot,SSAValue}
var::Slot
Copy link
Member

Choose a reason for hiding this comment

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

Why can't this apply to SSAValues?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not worth the compile-time performance cost, since it'll never generate better results (on our current syntax).

if isa(newtype, VarState)
newtypetyp = newtype.typ
if isa(newtypetyp, Conditional) && slot_id(newtypetyp.var) == changeid
newst[i] = VarState(Bool, newtype.undef)
Copy link
Member

Choose a reason for hiding this comment

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

Update to Const(...) if it's a conditional of the matching form?

end
@test Base.return_types(h25579, (Base.RefValue{Union{Nothing, Int}},)) ==
Any[Union{Type{Float64}, Type{Int64}, Type{Nothing}}]
Copy link
Member

Choose a reason for hiding this comment

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

Needs to be adjusted for 32-bit platforms. If I had a dime for every time I've done that...

We were neglecting to clear Conditional objects upon assignment to their attached slot
(which invalidates their knowledge of the contents of that slot)

fixes #25579
@vtjnash vtjnash merged commit 4f57e0a into master Jan 18, 2018
@vtjnash vtjnash deleted the jn/25579 branch January 18, 2018 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug compiler:inference Type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug in Conditional inference design
3 participants