Repository navigation
is_empty() via len: ask Sema for len's type; bare sm.insert in the #1010 test - #2069
Merged
ehartford merged 1 commit intoOct 5, 2026
Merged
Conversation
…thlang-dev#1010 test Review notes on withlang-dev#1947. lower_is_empty_via_len spelled len()'s return type as ty_i64 by hand, a third copy of a fact Sema owns; it now asks Sema (collection_len_method_return_type) for the type of the len call and of the 0 it compares with. The MIR is unchanged (binop(eq, copy _2, const 0ty4) for str.is_empty()). The test discards SlotMap.insert's handle with a bare call, the house style.
Contributor
|
Battery GREEN on the stack tip 73f0b39bf, which holds this change ( |
ehartford
marked this pull request as ready for review
October 5, 2026 04:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1947, for Eric's two non-blocking review notes:
lower_is_empty_via_lenspelledlen()'s return type asty_i64by hand, a third copy of a fact Sema owns. It now asks Sema (collection_len_method_return_type("len")) for the type of the len call and of the 0 it compares with. MIR's own older copy (MirBuilder.collection_len_method_return_type, which says usize) is unchanged: it also feedsintrinsic_return_type, so it is a separate change.test/behavior/behav_1010_is_empty_len_family.w:let _h = sm.insert(1)is now a baresm.insert(1).No behaviour change: the MIR for
s.is_empty()on astris the same as before (binop(eq, copy _2, const 0ty4)on the len call's result).Checked on Linux x86_64 (WSL2) with the pinned seed and linux SDK, on
0c09d9f9plus the one-line fix from #2068 (without it main does not build from the linux seed)::devgreen; the test passes on stage1;:deep-debug-tool-tests --no-depsand:drop-auditgreen;:gategreen except the four corpus drift checks of #2060, which fail the same way without this commit. Main has since moved to1e1b1cd6; neither new commit touches these files or Sema'scollection_len_method_return_type. The battery has not been run.