aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/error.zig
AgeCommit message (Collapse)Author
2023-06-13all: replace `comptime try` with `try comptime`Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-05-31enable passing behavior testsLuuk de Gram
2023-05-20spirv: ptr_elem_valRobin Voetter
Implements the ptr_elem_val air tag. Implementation is unified with ptr_elem_ptr.
2023-05-20spirv: more passing testsRobin Voetter
2023-05-18Revert "Sema: handle recursive inferred errors better in ↵Andrew Kelley
analyzeIsNonErrComptimeOnly" This reverts commit 5aa9628de3c6637f45b9d8cf8cbd19c422a74f6f. This is a breaking language change and I do not agree with it. Please go through the proposal process on this one.
2023-05-15spirv: lower float_to_int and int_to_floatAli Chraghi
2023-05-13Merge pull request #15643 from Vexu/fixesVeikka Tuominen
make `@call` compile errors match regular calls
2023-05-12Sema: handle recursive inferred errors better in analyzeIsNonErrComptimeOnlyVeikka Tuominen
Closes #15669
2023-05-11setup spirv backend in behavior testsAli Chraghi
2023-05-08Dwarf: workaround crashJacob Young
2023-04-03x86_64: fix typosJacob Young
2023-04-02x86_64: implement large cmpJacob Young
2023-04-02x86_64: implement error nameJacob Young
2023-03-21codegen: fix backend breakage due to optional layout changeJacob Young
2023-03-21x86_64: (re)implement optional opsJacob Young
Note that this commit also changes the layout of optional for all other backends using `src/codegen.zig` without updating them!
2023-03-21x86_64: implement some error union opsJacob Young
2023-03-15behavior: enable passing behavior tests on stage2_x86_64Jacob Young
2023-02-03Add test for optional error set return typesRyan Liptak
Closes #5820
2023-01-03stage2 AArch64: bump up alignment of stack items fitting in regsjoachimschmidt557
This enables us to use more efficient loading and storing for these small stack items
2022-12-29stage2 AArch64: implement errUnion{Err,Payload} for registersjoachimschmidt557
2022-12-27add behavior test for optional error union return typeAndrew Kelley
closes #1814
2022-12-27stage2 AArch64: unify callee-preserved regs on all targetsjoachimschmidt557
also enables many passing behavior tests
2022-12-18add behavior test for empty error set inferenceAndrew Kelley
closes #1386 closes #7541
2022-12-10stage2: sparc64: Skip unimplemented testsKoakuma
2022-12-06remove references to stage1 in behavior testsAndrew Kelley
Good riddance.
2022-11-05Sema: adjust result type of anyerror field accessVeikka Tuominen
Closes #13448
2022-10-25cbe: fix typedef declaration orderJacob Young
2022-10-25behavior: enable stage2_c tests that are currently passingJacob Young
Also fix C warnings triggered by these tests.
2022-10-25c: implement @errorNameJacob Young
2022-10-25c: fix mangling of error namesJacob Young
Closes #12751
2022-10-21stage2: Keep error return traces alive when storing to `const`Cody Tapscott
This change extends the "lifetime" of the error return trace associated with an error to continue throughout the block of a `const` variable that it is assigned to. This is necessary to support patterns like this one in test_runner.zig: ```zig const result = foo(); if (result) |_| { // ... success logic } else |err| { // `foo()` should be included in the error trace here return error.TestFailed; } ``` To make this happen, the majority of the error return trace popping logic needed to move into Sema, since `const x = foo();` cannot be examined syntactically to determine whether it modifies the error return trace. We also have to make sure not to delete pertinent block information before it makes it to Sema, so that Sema can pop/restore around blocks correctly. * Why do this only for `const` and not `var`? * There is room to relax things for `var`, but only a little bit. We could do the same thing we do for const and keep the error trace alive for the remainder of the block where the *assignment* happens. Any wider scope would violate the stack discipline for traces, so it's not viable. In the end, I decided the most consistent behavior for the user is just to kill all error return traces assigned to a mutable `var`.
2022-10-10Merge pull request #13075 from Vexu/stage2-fixesVeikka Tuominen
Stage2 misc fixes
2022-10-07Sema: allow equality comparisons between error unions and error setsVeikka Tuominen
Closes #1302
2022-10-06stage2: add error for non-void error union payload being ignoredVeikka Tuominen
See https://github.com/ziglang/zig/pull/6060#discussion_r471032912
2022-09-14stage2: sparc64: Skip Sema-failing tests for nowKoakuma
2022-09-09stage2 ARM: amend implementation of various AIR instructionsjoachimschmidt557
- unwrap_errunion_err for registers - unwrap_errunion_payload for registers - ptr_slice_len_ptr for all MCValues - ptr_slice_ptr_ptr for all MCValues
2022-08-25LLVM: fix missing alignment on wrapping instructionsAndrew Kelley
Previously, when lowering AIR instructions `wrap_errunion_payload`, `wrap_errunion_err`, and `wrap_optional`, the LLVM backend would create an alloca instruction to store the result, but did not set the alignment on it. This caused UB which went undetected for a long time until we started enabling the stack protector. Closes #12594 Unblocks #12508 Inspires #12634 Tests passed locally: * test-behavior * test-cases
2022-08-22Sema: fix parameter of type 'T' must be comptime errorVeikka Tuominen
Closes #12519 Closes #12505
2022-08-17Sema: make noreturn error union behave correctlyVeikka Tuominen
2022-07-22stage2: fix airIsErr when `is_ptr == true`Veikka Tuominen
2022-06-28Revert "AstGen: preserve inferred ptr result loc for breaks"Andrew Kelley
This reverts commit 8bf3e1f8d0902abd4133e2729b3625c25011c3ff, which introduced miscompilations for peer expressions any time they needed coercions to runtime types. I opened #11957 as a proposal to accomplish the goal of the reverted commit. Closes #11898
2022-06-25stage2 ARM: implement basic intCast and error union wrappingjoachimschmidt557
2022-06-11stage2: make `error{}` the same size as `anyerror`Veikka Tuominen
Having `error{}` be a zero bit type causes issues when it interracts with empty inferred error sets which are the same size as `anyerror`.
2022-06-07Sema: allow simple else body even when all errors handledVeikka Tuominen
2022-06-07Sema: make `analyzeIsNonErr` even lazier for inferred error setsVeikka Tuominen
2022-05-27stage2 AArch64: complete genTypedValuejoachimschmidt557
2022-05-24stage2: treat `error{}!void` as a zero-bit typeAndrew Kelley
2022-05-24stage2: fixes for error unions, optionals, errorsAndrew Kelley
* `?E` where E is an error set with only one field now lowers the same as `bool`. * Fix implementation of errUnionErrOffset and errUnionPayloadOffset to properly compute the offset of each field. Also name them the same as the corresponding LLVM functions and have the same function signature, to avoid confusion. This fixes a bug where wasm was passing the error union type instead of the payload type. * Fix C backend handling of optionals with zero-bit payload types. * C backend: separate out airOptionalPayload and airOptionalPayloadPtr which reduces branching and cleans up control flow. * Make Type.isNoReturn return true for error sets with no fields. * Make `?error{}` have only one possible value (null).
2022-05-24stage2 ARM: update to new union layoutjoachimschmidt557
2022-05-24aarch64: update for new error union layoutJakub Konka