0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/test/behavior
Andrew Kelley 2a00df9c09 Sema: fix generic instantiation false negatives
The problem was that types of non-anytype parameters were being included
as part of the check to see if generic function instantiations were
equal. Now, Module.Fn additionally stores the information for whether each
parameter is anytype or not. `generic_poison` cannot be used to signal
this because the type is still needed for comptime arguments; in such
case the type will not be present in the newly generated function
prototype.

This presented one additional challenge: we need to compare equality of
two values where one of them is post-coercion and the other is not. So
we make some minor adjustments to `Type.eql` to support this. I think
this small complexity tradeoff is worth it because it means the compiler
does much less work on the hot path that a generic function is called
and there is already an existing matching instantiation.

closes #11146
History 2022-04-14 06:08:28 -07:00
..
bugs wasm: Enable passing tests 2022-03-26 21:20:29 +01:00
hasdecl move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
import move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
namespace_depends_on_compile_var move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
pub_enum move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
usingnamespace std: fix regressions from this branch 2021-09-01 17:54:07 -07:00
align.zig stage2: Correctly align decls for comptime allocs 2022-03-19 19:41:23 -04:00
alignof.zig x64: pass more behavior tests 2022-02-28 23:20:05 +01:00
array.zig pass more behaviour tests 2022-03-24 17:04:50 +01:00
asm.zig CBE: improve support for asm inputs 2022-03-30 12:10:02 +03:00
async_fn.zig behavior tests: disable failing stage1 test 2022-03-23 14:06:07 -07:00
atomics.zig AstGen: fix referencing unreferencable instructions 2022-03-30 23:19:10 -07:00
await_struct.zig behavior tests: disable failing stage1 test 2022-03-23 14:06:07 -07:00
basic.zig AstGen: coerce break operands of labeled blocks 2022-03-28 18:28:08 -07:00
bit_shifting.zig stage2 AArch64: Enable behavior testing 2022-02-14 22:33:01 +01:00
bitcast.zig wasm: Enable passing tests 2022-03-26 21:20:29 +01:00
bitreverse.zig stage2: implement @bitReverse for vectors 2022-03-18 16:28:38 +01:00
bool.zig C backend: fix @boolToInt 2021-10-28 17:33:05 -07:00
byteswap.zig Avoid index out of bounds for one-valued types in zirValidateArrayInit 2022-03-17 18:00:48 -07:00
byval_arg_var.zig stage2 ARM: implement ret_load 2022-03-08 21:10:04 +01:00
call.zig Liveness: modify encoding to support over 32 operands 2022-04-12 11:22:12 -07:00
cast.zig Sema: in-memory coercion of differently named int types 2022-04-06 02:39:55 -07:00
cast_int.zig organize behavior tests 2022-03-18 15:02:52 -07:00
comptime_memory.zig stage2: add test for fixed issue 2022-03-21 15:05:21 +02:00
const_slice_child.zig Sema: implement @truncate for SIMD vectors 2022-03-15 15:09:48 -07:00
decltest.zig stage2: add decltests 2022-02-13 14:42:20 +02:00
defer.zig stage2 ARM: implement ret_load 2022-03-08 21:10:04 +01:00
enum.zig wasm: Enable passing behavior tests 2022-03-09 13:53:20 -07:00
error.zig stage2 llvm: properly align error union payload 2022-04-02 19:31:32 -04:00
eval.zig behavior tests: disable failing stage1 test 2022-04-02 19:02:29 -07:00
export.zig Sema: implement zirStructInit is_ref=true union 2022-03-10 20:00:07 +02:00
export_self_referential_type_info.zig stage2: fix mem{set,cpy} for non comptime mutable pointers 2022-03-08 11:23:38 +02:00
field_parent_ptr.zig wasm: Enable passing behavior tests 2022-03-09 13:53:20 -07:00
floatop.zig wasm: Enable passing behavior tests 2022-04-02 21:54:01 +02:00
fn.zig CBE: fix C output after PR #11302, reenable tests 2022-03-29 02:28:20 -04:00
fn_delegation.zig stage2 AArch64: Enable behavior testing 2022-02-14 22:33:01 +01:00
fn_in_struct_in_comptime.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
for.zig CBE: fix C output after PR #11302, reenable tests 2022-03-29 02:28:20 -04:00
generics.zig Sema: fix generic instantiation false negatives 2022-04-14 06:08:28 -07:00
hasdecl.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
hasfield.zig Sema: make @hasField support tuples too 2022-03-11 12:59:20 -07:00
if.zig stage2 AArch64: add more slice support 2022-03-05 11:31:51 +01:00
import.zig lint: duplicate import (#10519) 2022-01-07 00:06:06 -05:00
incomplete_struct_param_tld.zig stage2 ARM: implement ret_load 2022-03-08 21:10:04 +01:00
int128.zig CBE: fix C output after PR #11302, reenable tests 2022-03-29 02:28:20 -04:00
int_div.zig CBE: implement mod, divFloor, divTrunc 2022-03-19 21:01:36 -04:00
inttoptr.zig stage2 AArch64: add more slice support 2022-03-05 11:31:51 +01:00
ir_block_deps.zig x64: pass more behavior tests 2022-02-28 23:20:05 +01:00
math.zig Skip @rem/@mod tests on stage2, due to missing fmodl implementation 2022-04-12 10:25:29 -07:00
maximum_minimum.zig wasm: Enable passing behavior tests 2022-04-02 21:54:01 +02:00
member_func.zig Port more behavior tests 2022-02-22 21:57:42 +01:00
merge_error_sets.zig CBE: enable more tests that are currently passing 2022-03-17 11:39:56 -07:00
muladd.zig wasm: Enable passing behavior tests 2022-04-02 21:54:01 +02:00
namespace_depends_on_compile_var.zig CBE: enable more tests that are currently passing 2022-03-17 11:39:56 -07:00
null.zig CBE: enable more tests that are currently passing 2022-03-17 11:39:56 -07:00
optional.zig stage2 AArch64: lower cmp to binOp 2022-03-25 19:21:34 +01:00
pointers.zig Sema: fix comptime elem_ptr compare fixed address 2022-03-23 19:58:13 -07:00
popcount.zig wasm: Implement @popCount 2022-03-21 22:01:34 -04:00
prefetch.zig stage1: implement @prefetch() builtin 2021-12-11 00:29:31 +01:00
ptrcast.zig wasm: Enable passing tests 2022-03-26 21:20:29 +01:00
pub_enum.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
ref_var_in_if_after_if_2nd_switch_prong.zig Port more behavior tests 2022-02-22 21:57:42 +01:00
reflection.zig LLVM: add extra padding to structs and tuples sometimes 2022-03-01 18:24:00 -07:00
saturating_arithmetic.zig organize behavior tests 2022-03-18 15:02:52 -07:00
select.zig sema: coerce inputs to vectors in zirSelect 2022-03-25 19:14:11 +01:00
shuffle.zig organize behavior tests 2022-03-18 15:02:52 -07:00
sizeof_and_typeof.zig stage2 ARM: genSetStack for stack_argument_offset 2022-03-16 20:19:58 +01:00
slice.zig CBE: fix C output after PR #11302, reenable tests 2022-03-29 02:28:20 -04:00
slice_sentinel_comptime.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
src.zig stage2: introduce anonymous struct literals 2022-03-01 23:46:57 -07:00
struct.zig stage1: disable failing test 2022-03-27 14:40:24 -07:00
struct_contains_null_ptr_itself.zig stage2 ARM: genSetStack for stack_argument_offset 2022-03-16 20:19:58 +01:00
struct_contains_slice_of_itself.zig Sema: introduce a mechanism in Value to resolve types 2022-03-22 15:45:59 -07:00
switch.zig Sema: forward switch condition to captures 2022-04-04 22:46:05 -07:00
switch_prong_err_enum.zig wasm: Enable passing behavior tests 2022-03-09 13:53:20 -07:00
switch_prong_implicit_cast.zig wasm: Enable passing behavior tests 2022-03-09 13:53:20 -07:00
this.zig stage2 AArch64: add more slice support 2022-03-05 11:31:51 +01:00
translate_c_macros.h translate-c: use nested scope for comma operator in macros 2022-03-08 20:38:51 +02:00
translate_c_macros.zig organize behavior tests 2022-03-18 15:02:52 -07:00
truncate.zig Sema: implement @truncate for SIMD vectors 2022-03-15 15:09:48 -07:00
try.zig stage2 AArch64: add more slice support 2022-03-05 11:31:51 +01:00
tuple.zig pass more behaviour tests 2022-03-24 17:04:50 +01:00
type.zig replace other uses of std.meta.Vector with @Vector (#11346) 2022-03-30 14:12:14 -04:00
type_info.zig replace other uses of std.meta.Vector with @Vector (#11346) 2022-03-30 14:12:14 -04:00
typename.zig wasm: Enable all passing tests 2022-03-23 21:40:33 +01:00
undefined.zig stage2: improve @typeName 2022-03-18 00:12:22 -07:00
underscore.zig x64: pass more behavior tests 2022-02-28 23:20:05 +01:00
union.zig Sema: fix comptime equality of extern unions with same tag 2022-04-12 11:36:26 -07:00
union_with_members.zig organize behavior tests 2022-03-18 15:02:52 -07:00
usingnamespace.zig Sema: fix usingnamespace decl Value in wrong arena 2022-03-30 17:24:01 -07:00
var_args.zig CBE: enable more tests that are currently passing 2022-03-17 11:39:56 -07:00
vector.zig use math/float.zig everywhere 2022-04-07 05:04:38 -06:00
void.zig stage2 ARM: implement addwrap, subwrap, mulwrap 2022-03-16 20:20:07 +01:00
wasm.zig stage2: cleanups to wasm memory intrinsics 2022-03-03 18:31:55 -07:00
while.zig AstGen: emit break_inline from inline while loop 2022-03-24 22:45:10 -07:00
widening.zig stage1: implement casting from u0 2022-03-27 11:49:54 +03:00
wrapping_arithmetic.zig stage1: fix saturating arithmetic producing incorrect results on type comptime_int, allow saturating left shift on type comptime int 2022-01-29 18:12:28 +02:00