Conversation
- Type casting: string conversions with `as` operator (int↔string, float↔string, bytes↔string)
- Range expressions: `0..10` (exclusive) and `0..=10` (inclusive) in for loops
- String methods: `s.len()` and `s.char_at(index)` for character iteration
- Printf format strings: `{}` placeholder support in print/println
- Bytes type: heap-allocated byte arrays with string conversion
- Fix simple.naml: remove async/await (unsupported), comment out advanced FP utilities
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Support method receivers like `(self: LinkedList<T>)` in codegen - Add type parameter substitution in method call inference - Generic method return types now correctly resolve (e.g., `Box<string>.get_value()` returns string) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements monomorphization strategy for generic functions with trait bounds, enabling trait method dispatch on type parameters. Also fixes several related issues discovered during testing. Key changes: - Add monomorphization tracking in TypeAnnotations (typed_ast.rs) - Implement type mangling for generating specialized function names (infer.rs) - Add monomorphized function compilation in Cranelift codegen - Fix field assignment for generic struct types (Type::Generic case) - Fix while loop context for break/continue statements - Add var statement else block handling for option unwrap pattern - Fix unsafe block warnings in runtime tests (array, bytes, channel, value) Closes #17 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code reviewThis PR has CLAUDE.md violations that should be addressed: Inline Comments ViolationFile: Issue: This PR adds numerous inline comments throughout the file (e.g., CLAUDE.md Rule: Line 15 of
Recommendation: Remove all inline comments from the Rust source files. The code should be self-documenting through clear naming and structure. Note: The files |
Summary
Type::Generichandling)Changes
Type System (typechecker/)
MonomorphizationInfostruct and tracking methods for recording specialized function instantiationsmangle_generic_functionandmangle_typefor generating unique names for monomorphized functionsCode Generation (codegen/cranelift/)
generic_functionsHashMap to store uncompiled generic function ASTsprocess_monomorphizations()to declare and compile specialized versionscompile_monomorphized_function()with type substitution supportType::Genericcaseloop_exit_blockandloop_header_blockfor break/continueRuntime (runtime/)
Test plan
cargo buildcargo test --lib -- runtime::Closes #17
🤖 Generated with Claude Code