issue-0028: ?Protocol = null sentinel-shaped optional protocols
Protocol structs registered via registerProtocolDecl carry a new is_protocol flag; the ?T paths in sizeOf/typeSizeBytes/toLLVMType recognise it and lay out ?Protocol as the protocol struct itself (ctx == null IS the "none" state), matching how ?Closure / ?*T are sentinel-shaped — no extra storage. Method dispatch on ?Protocol auto-unwraps in lowerCall's field-access path; the unwrap is structurally a no-op so we just rebind obj_ty to the payload type. resolveCallParamTypes extended for optional-protocol receivers so enum-literal args (gpu.create_texture(.r8, ...)) get the right target_type and don't silently collapse to tag=0 : s32 — same issue-0031-class bug closed in Session 66, one type-system layer deeper. Library: UIRenderer / UIPipeline / GlyphCache migrated from the verbose gpu: GPU = ---; has_gpu: bool pattern to gpu: ?GPU = null. set_gpu no longer maintains a parallel bool flag. Bundled: dock.sx threads delta_time as a struct field rather than via a global pointer (cleanup unrelated to issue-0028, committed alongside). Verified: 85/85 regression tests pass; iOS-sim chess + macOS chess both render correctly post-migration.
This commit is contained in:
1
tests/expected/98-optional-protocol.exit
Normal file
1
tests/expected/98-optional-protocol.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
2
tests/expected/98-optional-protocol.txt
Normal file
2
tests/expected/98-optional-protocol.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
g initially null
|
||||
after assign: g.ping() = 42
|
||||
Reference in New Issue
Block a user