Skip to content

gen: fix comptime zero/new type expression resolution#27048

Merged
medvednikov merged 1 commit intovlang:masterfrom
GGRei:fix/comptime-zero-new-typeexpr
May 1, 2026
Merged

gen: fix comptime zero/new type expression resolution#27048
medvednikov merged 1 commit intovlang:masterfrom
GGRei:fix/comptime-zero-new-typeexpr

Conversation

@GGRei
Copy link
Copy Markdown
Contributor

@GGRei GGRei commented May 1, 2026

fix #26995
fix #26996
fix #26997

Resolving $zero(TypeExpr) and $new(TypeExpr) in the current C generation context instead of relying on a stale type stored on the shared AST node. The patch covers generic specializations like T.pointee_type, per-field comptime metadata like field.typ.payload_type / field.typ.pointee_type, and adds a C-output regression for the case where runtime could hide the wrong allocation. During tests, I also found and covered a related generic typeof(x).payload_type case for both $zero(...) and $new(...).

@GGRei
Copy link
Copy Markdown
Contributor Author

GGRei commented May 1, 2026

Looks like the GitCodex review is happy. Ready for final review!

@medvednikov medvednikov merged commit acb859e into vlang:master May 1, 2026
63 of 91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment