0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/test
mlugg d11bbde5f9
compiler: remove anonymous struct types, unify all tuples
This commit reworks how anonymous struct literals and tuples work.

Previously, an untyped anonymous struct literal
(e.g. `const x = .{ .a = 123 }`) was given an "anonymous struct type",
which is a special kind of struct which coerces using structural
equivalence. This mechanism was a holdover from before we used
RLS / result types as the primary mechanism of type inference. This
commit changes the language so that the type assigned here is a "normal"
struct type. It uses a form of equivalence based on the AST node and the
type's structure, much like a reified (`@Type`) type.

Additionally, tuples have been simplified. The distinction between
"simple" and "complex" tuple types is eliminated. All tuples, even those
explicitly declared using `struct { ... }` syntax, use structural
equivalence, and do not undergo staged type resolution. Tuples are very
restricted: they cannot have non-`auto` layouts, cannot have aligned
fields, and cannot have default values with the exception of `comptime`
fields. Tuples currently do not have optimized layout, but this can be
changed in the future.

This change simplifies the language, and fixes some problematic
coercions through pointers which led to unintuitive behavior.

Resolves: #16865
History 2024-10-31 20:42:53 +00:00
..
behavior compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
c_abi mips: fix C ABI compatibility 2024-09-07 23:46:30 -07:00
c_import std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
cases compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
incremental incremental: disable flaky test 2024-10-18 09:46:03 +01:00
link link/Elf: ensure we always sort all relocations by r_offset in -r mode 2024-10-29 17:27:42 -07:00
src compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
standalone compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
assemble_and_link.zig migrate from std.Target.current to @import("builtin").target 2021-10-04 23:48:55 -07:00
behavior.zig compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
c_import.zig c_import: extract behavior tests that use @cImport 2024-02-20 18:44:43 +01:00
cases.zig remove test/cbe.zig 2024-03-28 15:24:01 +02:00
compare_output.zig compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
compile_errors.zig cases: update for new error wording, add coverage for field/decl name conflict 2024-08-29 23:43:52 +01:00
gen_h.zig all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
llvm_targets.zig test: Remove some loongarch32 triples that were erroneously added to llvm_targets. 2024-10-16 01:10:35 +02:00
nvptx.zig zig build system: change target, compilation, and module APIs 2024-01-01 17:51:18 -07:00
run_translated_c.zig remove hard tabs from source code 2024-07-31 16:57:42 -07:00
stack_traces.zig test/stack_traces.zig: add err union switch case 2024-01-18 15:10:32 +11:00
tests.zig test: Add riscv(32,64)-linux-(none,musl) with soft float to module tests. 2024-10-15 20:25:26 +02:00
translate_c.zig test: update for CallingConvention changes 2024-10-19 19:15:23 +01:00