blaise/tests
Graeme Geldenhuys b6736d3925 fix(semantic): clone method bodies per generic instance
Generic instance method bodies were shared via OwnBody=False, so a
single TBlock AST was annotated by the semantic analyser once for each
instance in turn.  The Resolved* annotations on the shared body ended
up reflecting whichever instance was analysed last, causing call
targets in earlier instances to point at later instances' helpers —
e.g. TList<String>.Add would emit `call $TList_TObject_Grow` and skip
$_StringAddRef on the value parameter.

Add CloneBlock/CloneStmt/CloneExpr in uAST.pas covering all node types
that can appear inside a method body (~26 expr/stmt forms plus block-
level Var/Const/Type/Proc decls).  Annotations are deliberately not
copied — each instance re-runs semantic analysis on its own AST.
Wire the clone into InstantiateGeneric and InstantiateGenericFunction
so each instance owns its body.

Adds TestCodegen_Generic_TwoInstances_MethodCallsResolveToOwnInstance
to lock in: with TBox<Integer> and TBox<String> in one program, the
emitted TBox_Integer_Init body must contain
`call \$TBox_Integer_SetValue` and the TBox_String_Init body must
contain `call \$TBox_String_SetValue`.  Previously both bodies called
the String instance's helper.

Verified: 2107 tests pass; fixpoint clean; the two-instance benchmark
scenario (TList<String> + TList<TObject> in one program) now compiles
and runs correctly.
2026-05-21 14:30:24 +01:00
..
integration chore(license): relicense from BSD-3-Clause to Apache 2.0 + Runtime Library Exception 2026-05-03 19:45:29 +01:00
bench_lists_results.txt fix(semantic): clone method bodies per generic instance 2026-05-21 14:30:24 +01:00
bench_objects.pas test(bench): TStringList vs TList<String>, TObjectList vs TList<TObject> 2026-05-21 10:53:13 +01:00
bench_strings.pas test(bench): TStringList vs TList<String>, TObjectList vs TList<TObject> 2026-05-21 10:53:13 +01:00
phase2_milestone.pas chore(license): relicense from BSD-3-Clause to Apache 2.0 + Runtime Library Exception 2026-05-03 19:45:29 +01:00
phase3_milestone.pas chore(license): relicense from BSD-3-Clause to Apache 2.0 + Runtime Library Exception 2026-05-03 19:45:29 +01:00