concept Bla { new Ref ref; } svoid test_cset_with_Ref() { // unlisted concepts do not have backRefs Bla a = unlisted Bla(); Bla b = unlisted Bla(); cset(a, ref := b); assertSame(a.ref!, b); assertEqualsVerbose(ll(), findBackRefs Bla(b)); new Concepts cc; // test with registered concepts a = cnew(cc, Bla); b = cnew(cc, Bla); cset(a, ref := b); assertSame(a.ref!, b); assertEqualsVerbose(ll(a), findBackRefs Bla(b)); cset(a, ref := null); assertNull(a.ref!); // make sure the Ref object itself is not deleted assertEqualsVerbose(ll(), findBackRefs Bla(b)); // test that back ref is gone // Now test a "dynamic" (undeclared) field cset(a, ref2 := b); assertSame(cget ref2(a), b); assertEqualsVerbose(ll(a), findBackRefs Bla(b)); cset(a, ref2 := null); assertNull(cget ref2(a)); assertEqualsVerbose(ll(), findBackRefs Bla(b)); // test that back ref is gone }