7b32cad3e9
The old findGenericCalls second-pass only looked in non-generic functions and generated unresolved instances like Array_Get_T when generic funcs called other generic funcs. Removed it entirely. lowerExpr for ekCall now invokes generateMethodInstance directly for both explicit (ekGenericCall) and inferred generic calls. This ensures concrete instantiations are generated on-demand with correct typeSubst. Also added guard in resolveTypeExpr/substituteType to skip emitting C struct definitions for unresolved type parameters (e.g. Array<T> inside a generic function body before monomorphization). feat(std): add Std::Iter module - Array_Iter, Iter_Next, Iter_HasNext, Iter_Peek, Iter_Reset - Iter_Pos, Iter_Len, Iter_Count, Iter_Skip, Iter_Take docs: document Std::Iter in Stdlib.md examples: add iter.bux example tests: add _test_array regression test
20 lines
437 B
Plaintext
20 lines
437 B
Plaintext
import Std::Io::{PrintLine, PrintInt};
|
|
import Std::Array::*;
|
|
import Std::Iter::*;
|
|
|
|
func Main() -> int {
|
|
let arr: Array<int> = Array_New<int>(8);
|
|
Array_Push<int>(&arr, 10);
|
|
Array_Push<int>(&arr, 20);
|
|
Array_Push<int>(&arr, 30);
|
|
|
|
let it: Iter<int> = Array_Iter<int>(&arr);
|
|
while Iter_HasNext<int>(&it) {
|
|
PrintInt(Iter_Next<int>(&it));
|
|
PrintLine("");
|
|
}
|
|
|
|
Array_Free<int>(&arr);
|
|
return 0;
|
|
}
|