We were using the array type, not the element type. Also, we should do
the sentinel comparison after we verify that the element types of both
are compatible.
Now we handle -o /dev/null equivalent to -fno-emit-bin because
otherwise our atomic rename into place will fail. This also
makes Zig do less work, avoiding pointless file system operations.
Do the fallible logic in Sema where we have access to error reporting
mechanisms, rather than in Type/Value.
We can't just do the best guess when resolving queries of "is this type
comptime only?" or "what is the ABI alignment of this field?". The
result needs to be accurate. So we need to keep the assertions that the
data is available active, and instead compute the necessary information
before such functions get called.
Unfortunately we are stuck with two versions of such functions because
the various backends need to be able to ask such queries of Types and
Values while assuming the result has already been computed and validated
by Sema.
This also includes two other small fixes:
- Instantiate void TypeInfo fields as void
- Return error in `type.comptimeOnly` on unresolved comptime requirements
This adds a comptime result when comparing a comptime value to an
unsigned integer. For example:
( 0 <= (unsigned runtime value)) => true
(-1 < (unsigned runtime value)) => true
((unsigned runtime value) < -15) => false
This bug only causes a failure on my machine when running
test/behavior/eval.zig directly. If running the full behavior test
suite, std.builtin.TypeInfo will have already resolved its layout,
causing the test to pass.
I'd love to add a test that can reliably reproduce this problem,
but I'm afraid I'm not sure how to reliably create a union with
un-resolved layout.
The ZIR instruction `union_init_ptr` is renamed to `union_init`.
I made it always use by-value semantics for now, not taking the time to
invest in result location semantics, in case we decide to change the
rules for unions. This way is much simpler.
There is a new AIR instruction: union_init. This is for a comptime known
tag, runtime-known field value.
vector_init is renamed to aggregate_init, which solves a TODO comment.