Repository navigation
fix(cgen): array literals as values and null for every span spelling (#1050, #1048) - #1090
Merged
Merged
Conversation
…1050, #1048) Ported from #1081, the parts #1082 did not cover: - An array literal indexed, cast or measured gets a compound literal's type, (int32_t[]){ ... }, since a bare initializer list is not a C expression. let a = [1, 2, 3] takes its element type and dimensions from the literal, and a statement-level literal evaluates nested rows (#1050). - A module static of type &[T] or &mut [T] initialised from null is the empty span, as span<T> already was (#1048). Tests from #1081: tests/lang/test_array_literal_value.flow, tests/lang/test_static_span_null_forms.flow and the tests/cgen/array_literal_value golden.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the two fixes in #1081 that #1082 did not cover, with their tests.
(int32_t[]){ ... }, because a bare initializer list is not a C expression.let a = [1, 2, 3]takes its element type and dimensions from the literal, and a statement-level literal evaluates nested rows for their effects.span<T> = nullemits= NULLfor a struct #1048: a module static of type&[T]or&mut [T]initialised fromnullis the empty span, asspan<T>already was.Tests, from #1081:
tests/lang/test_array_literal_value.flow,tests/lang/test_static_span_null_forms.flowand thetests/cgen/array_literal_valuegolden. Both lang tests failed on main before this change.Local gates: bootstrap fixed point, self_host_full, roundtrip, cgen 107/0, test-lang 230, every parity gate (parity_shader_dsl only at its Metal step, as always on this Mac), parity_typecheck, typecheck_rules, conformance, mlir_commands 72/72, fuzz, corpus parity and the ratchet.