aboutsummaryrefslogtreecommitdiff
path: root/test/behavior.zig
AgeCommit message (Collapse)Author
2025-08-31delete behavior test that depends on std.fmtAndrew Kelley
behavior tests should have minimal dependency on std
2025-08-30test: re-enable a bunch of vector behavior tests on hexagonAlex Rønne Petersen
2025-07-22aarch64: add new from scratch self-hosted backendJacob Young
2025-07-07remove `usingnamespace` from the languageAndrew Kelley
closes #20663
2025-07-07remove `async` and `await` keywordsAndrew Kelley
Also remove `@frameSize`, closing #3654. While the other machinery might remain depending on #23446, it is settled that there will not be `async`/ `await` keywords in the language.
2025-06-16rename spirv backend nameAli Cheraghi
`stage2_spirv64` -> `stage2_spirv`
2025-06-03Legalize: handle packed semanticsJacob Young
Closes #22915
2025-04-26test: add tests for @memmovedweiller
2025-04-11test: Disable a bunch of vector behavior tests for hexagon.Alex Rønne Petersen
Most of the failures are: * https://github.com/llvm/llvm-project/issues/118879 * https://github.com/llvm/llvm-project/issues/134659 But some are also miscompilations leading to wrong results. I'm not going to investigate the latter further until all the backend crashes have been resolved.
2025-03-17spirv: don't hardcode test error type alignmentAli Cheraghi
2025-02-24test: skip failing tests with spirv-vulkanAli Cheraghi
2025-01-16x86_64: testingJacob Young
2025-01-15wasm linker: don't pretend it's possible to export data symbolsAndrew Kelley
2025-01-13Sema: allow tail calls of function pointersmlugg
Resolves: #22474
2024-12-28AstGen: lower function addrspace expression correctlymlugg
Also, add some basic behavior tests for addrspace and linksection which would have caught this bug in CI.
2024-10-31compiler: remove anonymous struct types, unify all tuplesmlugg
This commit reworks how anonymous struct literals and tuples work. Previously, an untyped anonymous struct literal (e.g. `const x = .{ .a = 123 }`) was given an "anonymous struct type", which is a special kind of struct which coerces using structural equivalence. This mechanism was a holdover from before we used RLS / result types as the primary mechanism of type inference. This commit changes the language so that the type assigned here is a "normal" struct type. It uses a form of equivalence based on the AST node and the type's structure, much like a reified (`@Type`) type. Additionally, tuples have been simplified. The distinction between "simple" and "complex" tuple types is eliminated. All tuples, even those explicitly declared using `struct { ... }` syntax, use structural equivalence, and do not undergo staged type resolution. Tuples are very restricted: they cannot have non-`auto` layouts, cannot have aligned fields, and cannot have default values with the exception of `comptime` fields. Tuples currently do not have optimized layout, but this can be changed in the future. This change simplifies the language, and fixes some problematic coercions through pointers which led to unintuitive behavior. Resolves: #16865
2024-09-04Merge pull request #21257 from mlugg/computed-goto-3Andrew Kelley
compiler: implement labeled switch/continue
2024-09-01compiler: implement labeled switch/continuemlugg
2024-09-01compiler: implement decl literalsmlugg
Resolves: #9938
2024-08-27behavior: import unintentionally excluded file from behavior.zigmlugg
And remove the now-invalid test for the return value of `@branchHint`.
2024-05-11astgen: fix result info for catch switch_block_err_unionDominic
2024-04-06Sema: fix non-`pub` `usingnamespace` in `@typeInfo`Jacob Young
2024-02-22Module: fix `@embedFile` of files containing zero bytesJacob Young
If an adapted string key with embedded nulls was put in a hash map with `std.hash_map.StringIndexAdapter`, then an incorrect hash would be entered for that entry such that it is possible that when looking for the exact key that matches the prefix of the original key up to the first null would sometimes match this entry due to hash collisions and sometimes not if performed later after a grow + rehash, causing the same key to exist with two different indices breaking every string equality comparison ever, for example claiming that a container type doesn't contain a field because the field name string in the struct and the string representing the identifier to lookup might be equal strings but have different string indices. This could maybe be fixed by changing `std.hash_map.StringIndexAdapter.hash` to only hash up to the first null, therefore ensuring that the entry's hash is correct and that all future lookups will be consistent, but I don't trust anything so instead I assert that there are no embedded nulls.
2024-02-20c_import: extract behavior tests that use `@cImport`Jacob Young
This introduces the new test step `test-c-import`, and removes the ability of the behavior tests to `@cImport` paths relative to `test`. This allows the behavior tests to be run without translate c.
2024-01-11LLVM: fix lowering of extern anyopaqueAndrew Kelley
closes #18461
2024-01-06categorize `behavior/bugs/<issueno>.zig` testsVeikka Tuominen
2024-01-03cbe: fix non-msvc externs and exportsJacob Young
Closes #17817
2023-11-25Zir: add missing extra index for linksection_or_addspaceTw
Closes #18052 Closes #18104 Signed-off-by: Tw <tw19881113@gmail.com>
2023-10-27split export behavior test into export_keyword and export_builtinAndrew Kelley
2023-10-27categorize nan behavior testAndrew Kelley
move it from bugs/xxx.zig to its own category
2023-10-27categorize fn ptr behavior testAndrew Kelley
move a function pointer test from bugs/xxx.zig to fn.zig
2023-10-27categorize globals behavior testsAndrew Kelley
moves some tests that store to global variables to their own category instead of being named after a GitHub issue.
2023-10-23rename behavior test to better describe what it doesAndrew Kelley
In general, let's not lean on GitHub issue numbers as having meaning. The goal of behavior tests is to produce a minimum set of tests that test 100% of the language.
2023-10-21migrate make_ptr_const to new anonymous decl mechanismAndrew Kelley
Instead of creating Module.Decl objects, directly create InternPool pointer values using the anon_decl Addr encoding. The LLVM backend needed code to notice the alignment of the pointer and lower accordingly. The other backends likely need a similar change.
2023-09-27Add behavior tests for `@abs` builtinantlilja
2023-09-15compiler: implement destructuring syntaxmlugg
This change implements the following syntax into the compiler: ```zig const x: u32, var y, foo.bar = .{ 1, 2, 3 }; ``` A destructure expression may only appear within a block (i.e. not at comtainer scope). The LHS consists of a sequence of comma-separated var decls and/or lvalue expressions. The RHS is a normal expression. A new result location type, `destructure`, is used, which contains result pointers for each component of the destructure. This means that when the RHS is a more complicated expression, peer type resolution is not used: each result value is individually destructured and written to the result pointers. RLS is always used for destructure expressions, meaning every `const` on the LHS of such an expression creates a true stack allocation. Aside from anonymous array literals, Sema is capable of destructuring the following types: * Tuples * Arrays * Vectors A destructure may be prefixed with the `comptime` keyword, in which case the entire destructure is evaluated at comptime: this means all `var`s in the LHS are `comptime var`s, every lvalue expression is evaluated at comptime, and the RHS is evaluated at comptime. If every LHS is a `const`, this is not allowed: as with single declarations, the user should instead mark the RHS as `comptime`. There are a few subtleties in the grammar changes here. For one thing, if every LHS is an lvalue expression (rather than a var decl), a destructure is considered an expression. This makes, for instance, `if (cond) x, y = .{ 1, 2 };` valid Zig code. A destructure is allowed in almost every context where a standard assignment expression is permitted. The exception is `switch` prongs, which cannot be destructures as the comma is ambiguous with the end of the prong. A follow-up commit will begin utilizing this syntax in the Zig compiler. Resolves: #498
2023-07-29behavior: add coverage for no longer reproducing issueJacob Young
Closes #14305
2023-07-26add behavior test for tail callsAndrew Kelley
closes #9703
2023-07-25make `@typeInfo` not return private declsJacob G-W
fixes #10731 Thanks @nektro for previous work in #14878 This change creates a small breaking change: It removes the `is_pub` field of a decl in `@typeInfo`
2023-07-24add comment to discourage using GitHub issue numbersAndrew Kelley
in behavior tests. closes #16506
2023-06-20codegen: Set c_char signedness based on the targetEvan Haas
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-16wasm: support calling alias'd function pointersLuuk de Gram
When lowering a decl value we verify whether its owner decl index equals to the decl index of the decl being lowered. When this is not the case, we are lowering an alias. So instead, we will now lower the owner decl instead and call its symbol to ensure its type is being correctly generated.
2023-05-29fix #15778: Binary operations on empty vectors crashEvin Yulo
2023-05-11setup spirv backend in behavior testsAli Chraghi
2023-05-08Disallow named test decls with duplicate namesDominic
2023-04-28C backend: fix ptr comparison of array ptrs when one is null-terminatedAndrew Kelley
2023-04-28llvm backend: fix lowering of memsetAndrew Kelley
The bitcast of ABI size 1 elements was problematic for some types.
2023-03-17Sema: make @returnAddress return 0 at comptimemlugg
See also #14938. Resolves: #14931
2023-03-13Sema: avoid panic on callconv(.C) generic return typeIan Johnson
Fixes #14854