Fix conditional assignment of arrays of structs - #12845
Conversation
ogoffart
left a comment
There was a problem hiding this comment.
we should limit the scope to only check for array type because otherwise we get duplicate error message.
and i think we also need more than just condition, for example we'd have the same problem with struct literal, don't we?
Reason: otherwise we get duplicate errors
Thanks for the hint. This was probably the unittest issue I got. Do you mean struct Data {
text: string,
}
export component TestCase inherits Window {
in-out property <bool> test: true;
out property <string> data_text: data.text;
out property<Data> data: test ? {
text: "Test true",
} : {
text: "Test false"
};
}This case is covered because |
ogoffart
left a comment
There was a problem hiding this comment.
Can you add a syntax test like
in property <[int]> error;
out property <[Data]> data: test ? error : error;
And we should ideally only have one error, not 2.
| } | ||
| } | ||
| if constexpr (HasFromSlintValue<ModelData>) { | ||
| if (auto array = value.to_array(); array && array->size() > 0) { |
There was a problem hiding this comment.
I forgot why i added a size > 0 test in 0700b83. But yeah, that seems correct.
If the change modifies a visible behavior, it changes the documentation accordinglyIf the changes fixes or close an existing issue, the commit message reference the issue withFixes #xxxorCloses #xxxIf the change is noteworthy, the commit message should containChangeLog: ...