-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checker, cgen: fix comptime issues with generic type #22751
Conversation
@@ -53,6 +53,7 @@ fn (mut g Gen) struct_init(node ast.StructInit) { | |||
if mut sym.info is ast.Struct { | |||
is_anon = sym.info.is_anon | |||
} | |||
is_generic_default := sym.kind !in [.struct, .array_fixed] && node.typ.has_flag(.generic) // T{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand, how is not being a struct or fixed array related to a property named is_generic_default
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a small comment here, mentioning var := X{}
, for X
being map[K]T
or []T
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work.
Fix #22710
Fix #22642
This PR fixes issues like:
With default type codegen:
where
T
is a non-struct type (e.g.map[K]T
or[]T
).mut variables assignment from generic fn return
selector expr with
.str
on generic typeAnd possible regeneration of already generated closure.
rename
g.comptime.get_comptime_var_type
tog.comptime.get_type
.Huly®: V_0.6-21197