zig/test/behavior
mlugg bcb673d94a
Sema: resolve union payload switch captures with peer type resolution
This is a bit harder than it seems at first glance. Actually resolving
the type is the easy part: the interesting thing is actually getting the
capture value. We split this into three cases:

* If all payload types are the same (as is required in status quo), we
  can just do what we already do: get the first field value.
* If all payloads are in-memory coercible to the resolved type, we still
  fetch the first field, but we also emit a `bitcast` to convert to the
  resolved type.
* Otherwise, we need to handle each case separately. We emit a nested
  `switch_br` which, for each possible case, gets the corresponding
  union field, and coerces it to the resolved type. As an optimization,
  the inner switch's 'else' prong is used for any peer which is
  in-memory coercible to the target type, and the bitcast approach
  described above is used.

Pointer captures have the additional constraint that all payload types
must be in-memory coercible to the resolved type.

Resolves: #2812
2023-06-13 12:55:22 +01:00
..
2023-05-31 18:04:33 +02:00
2023-05-20 17:30:22 +02:00
2023-05-20 17:30:22 +02:00
2023-05-31 18:04:33 +02:00
2023-05-31 18:04:33 +02:00
2023-05-20 17:30:22 +02:00
2023-05-20 17:30:22 +02:00
2023-05-24 00:01:48 +00:00
2023-06-10 07:18:05 +03:00
2023-05-31 18:04:33 +02:00
2023-05-20 17:30:22 +02:00
2023-05-31 18:04:33 +02:00
2023-05-31 18:04:33 +02:00
2023-05-31 18:04:33 +02:00
2023-05-31 18:04:33 +02:00
2023-05-20 17:30:23 +02:00
2023-05-20 17:30:22 +02:00
2023-05-20 17:30:23 +02:00
2023-05-20 17:30:23 +02:00
2023-05-20 17:30:23 +02:00
2023-05-20 17:30:22 +02:00
2022-01-07 00:06:06 -05:00
2023-04-02 04:49:53 -04:00
2023-05-20 17:30:22 +02:00
2023-05-11 20:31:52 +02:00
2023-05-31 18:04:33 +02:00
2023-05-20 17:30:23 +02:00
2023-05-20 17:30:23 +02:00
2023-05-31 18:04:33 +02:00
2023-05-20 18:43:26 +03:30
2023-05-20 17:30:22 +02:00
2023-05-11 20:31:52 +02:00
2023-05-20 17:30:23 +02:00
2023-05-20 17:30:22 +02:00
2023-05-20 17:30:23 +02:00
2023-05-11 20:31:52 +02:00
2023-05-15 03:07:51 -04:00
2023-05-31 18:04:33 +02:00
2023-05-20 17:30:22 +02:00
2023-05-31 18:04:33 +02:00
2023-05-20 17:30:23 +02:00
2023-05-11 20:31:52 +02:00
2023-05-20 17:30:23 +02:00
2023-05-18 20:42:38 -04:00