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

improve inferrability of peek(::Stateful, sentinel) #38625

Merged
merged 1 commit into from
Nov 30, 2020

Conversation

aviatesk
Copy link
Sponsor Member

the current inference can't propagate constant values or isa
condition of object fields, and this helps inference eliminate the
possibility of getindex(s.nextvalstate::Nothing, 1) call

the current inference can't propagate constant values or `isa` 
condition of  object fields, and this helps inference eliminate the 
possibility of `getindex(s.nextvalstate::Nothing, 1)` call
@vtjnash
Copy link
Sponsor Member

vtjnash commented Nov 30, 2020

current inference can't propagate constant values

Don't blame inference—this value is literally mutable

@vtjnash vtjnash changed the title improve inferrability of seek(::Stateful, sentinel) improve inferrability of peek(::Stateful, sentinel) Nov 30, 2020
@timholy
Copy link
Sponsor Member

timholy commented Nov 30, 2020

There's a sense in which inference "seems like it should know," though I guess if it's not an atomic operation and might be modified externally, maybe inference is indeed doing what it should be doing. In any event, this is an effective way to address it.

Thanks @aviatesk, Stateful has been a bit of a problem child. I'd always thought it was due just to #36454, but I'll be curious to see if this helps more broadly.

@stevengj stevengj merged commit 8ea6365 into JuliaLang:master Nov 30, 2020
@aviatesk aviatesk deleted the rmunionnothing branch December 1, 2020 00:52
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