feat(t27b): array literals typed by their use - #6370
Merged
Merged
Conversation
An array literal with no result type was step 1 of the t27b corpus greedy order. Four shapes are now lowered as t27c's Zig backend writes them: an argument where `[]const u8` is declared, an untyped const local only ever passed where one array type `[N]T` is declared, an empty literal for a slice field of a named struct literal, and an untyped local of plain literals that nothing reads. A non-empty slice-field literal and a slice field of an anonymous struct literal are refused by name. Corpus (master 0757c2f): counted 653 -> 658 of 720, checked pass 373 -> 377, mismatch 0, t27b-only passes 0. Closes #6369 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
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.
Closes #6369
Refs #6063
ExprArrayLiteral("array literal with no result type") was step 1 of the greedy order on master 0757c2f. Four shapes now lower as t27c's Zig backend writes them:[]const u8is declared (@constCast(&[_]u8{ ... })), and an untyped local passed there (slice_locals, now also for[]const u8);constlocal whose every mention is an argument to one array type[N]T(const p = .{ ... }, coerced at each call): built once as that array;@constCast(&[_]T{ })): an empty slice;_ = x; // dead after const-inlining): dropped.Refused by name: a non-empty literal for a slice field (
ExprArrayLiteral(to slice field); the reference points into a constant), and a slice field of an anonymous struct literal (ExprArrayLiteral(to slice); Zig refuses the reference's.{ ... }).Corpus (my runs,
t27b corpus specs --timeout-ms 60000 --jobs 8 --blockers --reference t27c --reference-cache)Newly passing:
benchmarks/ternary_vs_binary,fpga/ternary_isa,port/trinity/src/tri/gen_cursor,port/trinity/src/tri/gen_kmeans,sandbox/orphan_detection.automation/wrapup-autonow stops atStmtAssign(thenExprArrayLiteral(to slice field)).Next in the greedy order:
type f32+3,type undefined+3,ExprCall(std.*)+3,ExprArrayLiteral(remaining shapes) +2.Tests
array_literals_typed_by_their_useandarray_literals_typed_by_their_use_rejectionsincli/t27b/tests/source.rs; the passing source gives the same 4 pass / 1 fail undert27c test-report, and each rejected shape was run there too: the wrong-length tuple and the anonymous-literal slice field are BLOCKED in the reference; the non-empty slice field and the tuple local also indexed pass there and stay refused here (named blocker, and the unchanged "no result type").cargo test -p t27b: all pass, none ignored.Reference bugs still in play: #6329, #6358, #6295, #6102.
🤖 Generated with Claude Code