zig/lib/compiler
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
2024-10-31 20:42:53 +00:00
..
aro compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
aro_translate_c cbe,translate-c: support more callconvs 2024-10-19 19:15:24 +01:00
reduce reduce: fix compile errors 2024-03-24 17:29:39 +01:00
resinator Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
aro_translate_c.zig compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00
build_runner.zig implement --watch for kqueue 2024-10-24 16:24:56 -07:00
fmt.zig std.posix: Added error message 'ProcessNotFound' for reading and writing in a Linux process (#21430) 2024-10-03 01:54:30 +00:00
libc.zig zig libc: allow non-native targets 2024-03-13 02:17:28 -04:00
objcopy.zig objcopy: check both global and local when remapping 2024-10-12 10:44:17 -07:00
reduce.zig Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
std-docs.zig Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
test_runner.zig compiler: remove anonymous struct types, unify all tuples 2024-10-31 20:42:53 +00:00