You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sema to receive type information to identify this array_init as a vector_type so the negation operator can be performed (as arrays cannot be negated, but vectors can).
Actual Behavior
Sema receives an array_init ZIR instruction pointing to each member of the initializer, but the instruction does not point to the explicitly provided vector_type, making Sema unable to determine if this list is allowed to negated. Instead, Sema will always infer that array_init returns an array, which cannot be negated.
The current workaround is to move these initializers into intermediate variables to force them to get coerced into vectors before being used.
The text was updated successfully, but these errors were encountered:
sengir
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Mar 21, 2022
Zig Version
0.10.0-dev.1463+5d943f621
Steps to Reproduce
An explicitly typed array initializer within an expression:
Note that this still occurs with aliased types:
Expected Behavior
Sema to receive type information to identify this
array_init
as avector_type
so the negation operator can be performed (as arrays cannot be negated, but vectors can).Actual Behavior
Sema receives an
array_init
ZIR instruction pointing to each member of the initializer, but the instruction does not point to the explicitly providedvector_type
, making Sema unable to determine if this list is allowed to negated. Instead, Sema will always infer thatarray_init
returns an array, which cannot be negated.The current workaround is to move these initializers into intermediate variables to force them to get coerced into vectors before being used.
The text was updated successfully, but these errors were encountered: