aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/array.zig
AgeCommit message (Collapse)Author
2023-09-23spirv: enable passing testsRobin Voetter
2023-09-23spirv: generate module initializerRobin Voetter
2023-09-23spirv: air array_elem_val using hackRobin Voetter
SPIR-V doesn't support true element indexing, so we probably need to switch over to isByRef like in llvm for this to work properly. Currently a temporary is used, which at least seems to work.
2023-09-23spirv: disable failing testsRobin Voetter
2023-08-11Sema: avoid deleting runtime side-effects in comptime initializersJacob Young
Closes #16744
2023-08-09AstGen: handle `ty` result location for struct and array init correctlymlugg
Well, this was a journey! The original issue I was trying to fix is covered by the new behavior test in array.zig: in essence, `ty` and `coerced_ty` result locations were not correctly propagated. While fixing this, I noticed a similar bug in struct inits: the type was propagated to *fields* fine, but the actual struct init was unnecessarily anonymous, which could lead to unnecessary copies. Note that the behavior test added in struct.zig was already passing - the bug here didn't change any easy-to-test behavior - but I figured I'd add it anyway. This is a little harder than it seems, because the result type may not itself be an array/struct type: it could be an optional / error union wrapper. A new ZIR instruction is introduced to unwrap these. This is also made a little tricky by the fact that it's possible for result types to be unknown at the time of semantic analysis (due to `anytype` parameters), leading to generic poison. In these cases, we must essentially downgrade to an anonymous initialization. Fixing these issues exposed *another* bug, related to type resolution in Sema. That issue is now tracked by #16603. As a temporary workaround for this bug, a few result locations for builtin function operands have been disabled in AstGen. This is technically a breaking change, but it's very minor: I doubt it'll cause any breakage in the wild.
2023-06-28behavior: test slicing array of zero-sized valueszooster
Closes #15343
2023-06-26AstGen: fix result locations for elements of typed array initmlugg
Resolves: #16226
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13all: replace `comptime try` with `try comptime`Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-05-20spirv: more passing testsRobin Voetter
2023-05-13Merge pull request #15643 from Vexu/fixesVeikka Tuominen
make `@call` compile errors match regular calls
2023-05-11setup spirv backend in behavior testsAli Chraghi
2023-05-11fix incorrect use of mutable pointers to temporary valuesVeikka Tuominen
2023-04-28stage2: sparc64: Skip unimplemented testsKoakuma
2023-04-20Sema: allow ptr field access on pointer-to-arraymlugg
Also remove an incorrect piece of logic which allowed fetching the 'len' property on non-single-ptrs (e.g. many-ptrs) and add a corresponding compile error test case. Resolves: #4765
2023-04-13x86_64: fix some of the mass confusion about the meaning of `MCValue`Jacob Young
2023-03-25x86_64: implement atomic loopsJacob Young
2023-03-24x86_64: fix value tracking bugsJacob Young
2023-03-21CBE: implement aggregateInit() for array of array case.Xavier Bouchoux
fixes `error(compilation): clang failed with stderr: error: array type 'uint32_t[10]' (aka 'unsigned int[10]') is not assignable`
2023-03-15disable failing aarch64 backend behavior testsAndrew Kelley
2023-03-15behavior: enable passing behavior tests on stage2_x86_64Jacob Young
2023-03-14Sema: allow comptime mutation of multiple array elementsmlugg
Previously, if you had a pointer to multiple array elements and tried to write to it at comptime, it was incorrectly treated as a pointer to one specific array value, leading to an assertion down the line. If we try to mutate a value at an elem_ptr larger than the element type, we need to perform a modification to multiple array elements. This solution isn't ideal, since it will result in storePtrVal serializing the whole array, modifying the relevant parts, and storing it back. Ideally, it would only take the required elements. However, this change would have been more complex, and this is a fairly rare operation (nobody ever ran into the bug before after all), so it doesn't matter all that much.
2023-02-18update existing behavior tests and std lib to new for loop semanticsAndrew Kelley
2022-12-31add tests for fixed stage1 bugsVeikka Tuominen
Closes #4144 Closes #4255 Closes #4372 Closes #4375 Closes #4380 Closes #4417 Closes #4423 Closes #4476 Closes #4528 Closes #4562 Closes #4572 Closes #4597 Closes #4639 Closes #4672 Closes #4782 Closes #4955 Closes #4984 Closes #4997 Closes #5010 Closes #5114 Closes #5166 Closes #5173 Closes #5276
2022-12-27add behavior test for comptime pointer castingAndrew Kelley
comptime `@ptrCast` a subset of an array, then write through it closes #2444
2022-12-24behavior: disable tests on failing backendsJacob Young
2022-12-24Sema: relax undefined checks for concatJacob Young
Closes #14037
2022-12-24Sema: support concat of tuple and arrayJacob Young
Closes #14041
2022-12-10stage2: sparc64: Skip unimplemented testsKoakuma
2022-12-06remove references to stage1 in behavior testsAndrew Kelley
Good riddance.
2022-11-04Sema: correct condition in validateArrayInitVeikka Tuominen
Closes #13425
2022-10-25cbe: implement global assemblyJacob Young
2022-10-25behavior: enable stage2_c tests that are currently passingJacob Young
Also fix C warnings triggered by these tests.
2022-10-05fix(text): hyphenation and other fixesr00ster91
2022-09-09stage2 ARM: implement basic array_elem_valjoachimschmidt557
2022-09-09stage2 ARM: implement struct_field_val for registersjoachimschmidt557
2022-07-14Sema: fix coerceResultPtrAndrew Kelley
It did not handle properly when the dummy operand was a comptime_int; it was crashing in coerce because comptime_int is supposed to be comptime-known. So when calling coerceResultPtr, we pass the actual operand, not a dummy operand, which means it will have the proper comptime value when necessary.
2022-06-25stage2 ARM: implement basic intCast and error union wrappingjoachimschmidt557
2022-06-24stage2: sparc64: Skip Sema-failing tests for nowKoakuma
2022-06-17Sema: handle sentinels in tupleToArrayVeikka Tuominen
2022-06-03Sema: fix initialization of array with comptime only elem typeVeikka Tuominen
2022-05-27stage2 AArch64: complete genTypedValuejoachimschmidt557
2022-04-22clean up behavior testsAndrew Kelley
Split big test into the two separate things it is testing. Add missing checks to the test which revealed the test is not actually passing yet for the C backend.
2022-04-22C backend: Fix array declarationsAnnika L
2022-03-24pass more behaviour testsJakub Konka
2022-03-23stage2: enable some passing array & vector testsWilliam Sengir
2022-03-23stage2: make zero-sized array not cause recursive type definitionWilliam Sengir
2022-03-19wasm: Enable passing testsLuuk de Gram
This enables the tests that now pass due to the changes to lower parent pointers are lowered, as well as the additional features to unions.