Merged
Conversation
Fix name collisions in symbol generation
move contract desugaring into mir, effect type cleanup
Update check_for to resolve element types via Seq<T> trait lookup rather than the placeholder Iterator reference. Arrays remain special cased since const generics in array type positions aren't fully supported yet.
Range expressions (a..b) now type check to DynRange. Both operands are verified to be usize, and the result is resolved from core::range::DynRange.
Desugar range expressions `start..end` in MIR lowering to allocate and initialize a DynRange struct with start and end fields, rather than leaving them as Range binops that panic at codegen.
Desugar for-loops into while loops: - For ranges (DynRange): initialize loop var to start, loop while < end - For arrays: create hidden index, bind element each iteration Both cases increment by 1 and use standard loop control flow with proper continue/break targets registered.
Remove the bifurcated Const<N>/Dyn type system in favor of a simple approach that matches issue argotorg#1207: - Remove Const<N> and Dyn marker types from seq.fe - Remove Range<N> (const-length), keep only Range with start/end - Simplify Seq trait to return usize directly (no Len associated type) - Update type checker and MIR comments from DynRange to Range This defers const-vs-dynamic optimization to the backend rather than encoding it in the type system, reducing complexity significantly.
Previously, `impl<const N: usize> Trait for [T; N]` failed because the target type was lowered before entering the impl scope, so const generic params weren't available for array length expressions. Fix by entering the impl scope with a preliminary ID first, lowering generic params, then lowering the target type. The final ID is swapped in before lowering nested items like methods. This enables the array Seq implementation in core library.
Resolve Seq::len and Seq::get at type-check time and store in ForLoopSeq for MIR lowering. Desugars `for x in seq` to an index-based while loop calling the resolved trait methods. - snapshot/rollback when probing Seq impls to prevent inference pollution - route `continue` to increment block to avoid infinite loops - preserve effect args on synthesized Seq method calls
- Prevent unification-table panics when resolving associated types via impls - Constrain record init generics from expected type without inference pollution - Add uitests for assoc-type struct fields and for-loop over array literal
Replace the simple Range struct with a generic Range<S: Bound, E: Bound> that encodes bound constness in the type system: - Range<Known<0>, Known<10>> for fully const ranges (0 words) - Range<Known<0>, Unknown> for const start, runtime end (1 word) - Range<Unknown, Unknown> for fully dynamic ranges (2 words) The type checker now detects integer literals in range expressions and constructs the appropriate Range type, enabling zero-cost abstractions when bounds are compile-time known.
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.
No description provided.