phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
38
local_tests/test_weak_detection.hako
Normal file
38
local_tests/test_weak_detection.hako
Normal file
@ -0,0 +1,38 @@
|
||||
// Simplified weak reference detection test
|
||||
|
||||
box Parent {
|
||||
init { child }
|
||||
|
||||
pack() {
|
||||
me.child = new Child()
|
||||
me.child.setParent(me) // This should detect weak assignment
|
||||
}
|
||||
|
||||
getChild() {
|
||||
return me.child
|
||||
}
|
||||
}
|
||||
|
||||
box Child {
|
||||
init { weak parent } // weak modifier on parent field
|
||||
|
||||
setParent(p) {
|
||||
me.parent = p // Should detect weak field assignment
|
||||
}
|
||||
|
||||
checkParent() {
|
||||
return me.parent // Should detect weak field access
|
||||
}
|
||||
}
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local p = new Parent()
|
||||
local child = p.getChild()
|
||||
|
||||
print("Testing weak field access...")
|
||||
local parent_ref = child.checkParent()
|
||||
|
||||
return "weak reference detection test completed"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user