aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/error.zig
AgeCommit message (Collapse)Author
2023-09-23spirv: enable passing testsRobin Voetter
2023-09-23spirv: air wrap_errunion_payloadRobin Voetter
2023-09-23spirv: disable failing testsRobin Voetter
2023-07-27frontend: make fn calls byval; fix false positive isNonErrAndrew Kelley
This commit does two things which seem unrelated at first, but, together, solve a miscompilation, and potentially slightly speed up compiler perf, at the expense of making #2765 trickier to implement in the future. Sema: avoid returning a false positive for whether an inferred error set is comptime-known to be empty. AstGen: mark function calls as not being interested in a result location. This prevents the test case "ret_ptr doesn't cause own inferred error set to be resolved" from being regressed. If we want to accept and implement #2765 in the future, it will require solving this problem a different way, but the principle of YAGNI tells us to go ahead with this change. Old ZIR looks like this: %97 = ret_ptr() %101 = store_node(%97, %100) %102 = load(%97) %103 = ret_is_non_err(%102) New ZIR looks like this: %97 = ret_type() %101 = as_node(%97, %100) %102 = ret_is_non_err(%101) closes #15669
2023-06-24Merge pull request #16188 from kcbanner/fix_cbe_airErrUnionPayloadPtrSetAndrew Kelley
cbe: fix crash caused by calling `mod.intValue` on `type_inferred_error_set`
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-24cbe: fix crash caused by calling `mod.intValue` on `type_inferred_error_set`kcbanner
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-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