Skip to content

Fix empty seq literal typing#1214

Open
PROgram52bc wants to merge 2 commits into
main2from
htd/fix-empty-seq-literal-typing-2
Open

Fix empty seq literal typing#1214
PROgram52bc wants to merge 2 commits into
main2from
htd/fix-empty-seq-literal-typing-2

Conversation

@PROgram52bc
Copy link
Copy Markdown
Contributor

supersedes #1213 by cherry-picking relevant commits and reducing diff size.

David Deng 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant