Fix empty seq literal typing#1214
Open
PROgram52bc wants to merge 2 commits into
Open
Conversation
added 2 commits
May 22, 2026 15:53
Boole's Sequence.of_<ty>[v0, ..., vn] literals lowered to a left-fold of seq_build over an untyped seq_empty seed. For empty literals the seed is the only place the element type lives, and even for non-empty ones the surrounding seq_build calls do not propagate the element type onto the seed op's ty annotation. The bounds-precondition pass therefore emitted polymorphic obligations like `0 < Sequence.length (Sequence.empty)`, mirroring the bug that the prior commit fixed for Sequence.empty_<ty>. Split the merged seq_of_* arms in toCoreExpr and route each through a seqLitToCore helper that threads the concrete element type onto the seed. Add a regression test that lowers each form and inspects the resulting Sequence.empty op's element-type annotation directly, so the check does not depend on SMT solver behavior.
The previous commit on this branch made Seq_len, Seq_lib_insert, Seq_new, Seq_lib_map, Seq_lib_map_values, Seq_lib_filter, Seq_lib_sort_by, Seq_lib_to_set, and Set_finite specialized at Sequence bv32 (because the SMT backend does not support polymorphism). Their names still read like generic library helpers, which is misleading. Suffix each with _bv32 so the constraint is visible at every call site, and update the obligation IDs in the expected #guard_msgs block whose source-line offsets shifted as a result. The Set type itself remains polymorphic; only the functions specialized at Set bv32 / Sequence bv32 are renamed.
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.
supersedes #1213 by cherry-picking relevant commits and reducing diff size.