- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.7k
          Make haskey(::@Kwargs{item::Bool}, :item) constant-fold
          #59320
        
          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
Conversation
| Yes I think this is ok. Note  We may have thought of extending Pairs to allow e.g. subsetting keys, but obviously we are not going to implement that now. I think it really is out of scope and better suited to a different view-like type. | 
| Idea to consider: we could make this "safer" by making  | 
76430fb    to
    7a38428      
    Compare
  
    | 
 I tried this approach, and I think I like it better.  That puts us in a better position to resolve #59292 ( | 
Rather than assume the value of `.itr` for `Pairs{..., <:NamedTuple}`
this introduces `nothing` as a sentinel to iterate `.data` directly,
which is sufficient for this to const-prop.
    This restricts this optimization to apply only to "fully-iterated" NamedTuple Pairs, which are the only kind generated by lowering and `Base.pairs`. Resolves JuliaLang#59292.
eff4126    to
    3f20eec      
    Compare
  
    
Resolves #59269.
Makes #59292 somewhat worse by doubling-down on the same assumptions.We should straighten out that issue properly, but I don't see any reason not to get better inference in the mean time for the very commonWe are already relying on those assumptions in Base (as that issue demonstrates), and @JeffBezanson says that this functionality wasn't intended to be supported:@Kwargscase.edit: now also resolves #59292.