5874 Commits

Author SHA1 Message Date
Jacob Young
a257e33fff Type: remove arbitrary restrictions on param and return types
Opaque and `noreturn` makes sense since they don't represent real
values, but `null` and `undefined` are perfectly normal
comptime-only values.

Closes #16088
2023-06-20 21:51:01 -07:00
Jacob Young
8875efe548 Sema: fix auto-numbered enums with signed tag types
Closes #16095
2023-06-20 20:09:28 -07:00
IntegratedQuantum
3267eb3a28 Fix @enumToInt and @tagName for auto-numbered enums with signed tag type. 2023-06-20 20:09:28 -07:00
Andrew Kelley
b77679039f
Merge pull request #15415 from ehaas/c-char-signedness
Set `c_char` signedness based on the target
2023-06-20 16:41:58 -07:00
Jakub Konka
7b5bd3a93f
Merge pull request #16097 from ziglang/macho-faster-uuid
macho: parallelize UUID hash calculation at the expense of full compatibility with ld64
2023-06-21 00:03:52 +02:00
Evan Haas
fb9d6b8bd9
codegen: Set c_char signedness based on the target 2023-06-20 00:26:42 -07:00
Andrew Kelley
a72d634b73
Merge pull request #16046 from BratishkaErik/issue-6128
Renaming `@xtoy` to `@YfromX`
2023-06-19 22:36:24 -07:00
Jacob Young
8fcc28d302 Module: add support for multiple global asm blocks per decl
Closes #16076
2023-06-19 13:12:04 -07:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
Jakub Konka
c2554cf0f1 link-test: remove now obsolete UUID test for MachO 2023-06-19 11:33:06 +02:00
Manlio Perillo
423d7b848b test/src/Cases: fix incorrect code to find zig_lib_directory
The runCases function incorrectly called the introspect.findZigLibDir
function, causing a possible error, depending on the location of the
local cache directory, since the current executable is check-case.

Use findZigLibDirFromSelfExe, passing the zig_exe_path argument.

The current CI scripts work correctly because ZIG_LOCAL_CACHE_DIR is set
to "$(pwd)/zig-local-cache".

Fixes #15044
2023-06-18 18:20:42 -07:00
Mizuochi Keita
729a051e9e std.http: Fix segfault while redirecting
Make to avoid releasing request's connection twice.
Change the `Request.connection` field optional. This field is null while the connection is released.

Fixes #15965
2023-06-17 21:58:33 -07:00
r00ster91
6e84f46990 std: replace builtin.Version with SemanticVersion 2023-06-17 13:17:34 -07:00
Andrew Kelley
a10ddba921
Merge pull request #16064 from Luukdegram/wasm-linker
wasm/linker: symbol resolution improvements
2023-06-16 22:03:35 -07:00
mlugg
c4cc796695 Sema: consider type bounds when refining result type of @min/@max
I achieved this through a major refactor of the logic of analyzeMinMax.
This change should be compatible with vectors of comptime_int, which
Andrew said are supposed to work (but which currently do not).
2023-06-16 13:33:31 -07:00
Luuk de Gram
44b322ce64
wasm-linker: correctly resolve undefined functions
We now resolve undefined symbols during incremental-compilation
where we discard the current symbol if we detect we found
an existing symbol which is not the one currently being updated.
The symbol will always be discarded in favor of the existing symbol
in such a case.
2023-06-16 17:16:56 +02:00
Luuk de Gram
e3db210cf1
wasm: support calling alias'd function pointers
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-06-16 17:16:56 +02:00
Luuk de Gram
1cfad29f10
codegen: fix union padding
This regressed during the internpool merges. This commit
reinstates the padding logic for unions.
2023-06-16 17:16:56 +02:00
Andrew Kelley
f5043ad6a3
Merge pull request #16042 from mlugg/fix/slice-len-comptime-mutation
Fix comptime mutation of slice len
2023-06-15 09:49:59 -07:00
mlugg
11d0dfb882 Sema: fix @intToPtr of zero value to optional pointer
Calling into coercion logic here is a little opaque, and more to the
point wholly unnecessary. Instead, the (very short) logic is now
implemented directly in Sema.

Resolves: #16033
2023-06-15 02:43:06 -07:00
mlugg
ce88c43a4e Sema: allow indexing tuple and vector pointers
Resolves: #13852
Resolves: #14705
2023-06-14 22:07:25 -07:00
mlugg
57f6e6729f
Sema: allow empty end index in zirSliceSentinel
This fixes a regression, and enables some related behavior tests which
were accidentally disabled.
2023-06-15 01:23:58 +01:00
mlugg
45e9617720
Sema: don't assume slice value is interned when loading from comptime pointer
Resolves: #16030
2023-06-15 01:23:52 +01:00
zooster
b975701a4d test/behavior/generics.zig: remove outdated TODO 2023-06-14 16:41:58 -07:00
Andrew Kelley
496320d935
Merge pull request #15726 from mlugg/feat/peer-type-resolution-but-better
Sema: rewrite peer type resolution
2023-06-14 07:18:28 -07:00
Andrew Kelley
38fc826a5a
Merge pull request #15957 from BratishkaErik/deprecated-
std.*: remove stuff that was deprecated in older versions
2023-06-13 14:53:41 -07:00
mlugg
c9531eb833
Sema: rewrite peer type resolution
The existing logic for peer type resolution was quite convoluted and
buggy. This rewrite makes it much more resilient, readable, and
extensible. The algorithm works by first iterating over the types to
select a "strategy", then applying that strategy, possibly applying peer
resolution recursively.

Several new tests have been added to cover cases which the old logic did
not correctly handle.

Resolves: #15138
Resolves: #15644
Resolves: #15693
Resolves: #15709
Resolves: #15752
2023-06-13 21:48:18 +01:00
Zapolsky Anton
c76ce25a61
Remove CheckObjectStep.runAndCompare (#15973)
Closes #14969
2023-06-13 14:09:24 -04:00
Eric Joldasov
d884d7050e
all: replace comptime try with try comptime
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13 23:46:58 +06:00
Eric Joldasov
4936453d56
std.builtin: remove TypeInfo and Type.FnArg (deprecated in 0.10)
Followup to d3d24874c91054a70c706fed47278c81c9ce890a.
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13 23:46:58 +06:00
IntegratedQuantum
02df9aa976 Add a compiler error for @mulAdd with int vectors. 2023-06-13 10:45:57 -07:00
Eric Joldasov
d04a262a3d
std.math: hard deprecate obsolete constants (soft deprecated in 0.10)
Followup to 5b8ac9821dd25c3e5282130b4d93d6c5b7debb08.
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13 23:45:12 +06:00
Eric Joldasov
eb4439f1e4
std.meta: remove Vector (deprecated in 0.10)
Followup to d42d31f72f38165f70c2850e9cc63da44b3b470c.
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13 23:45:08 +06:00
mlugg
42dc7539c5
Fix bad source locations in switch capture errors
To do this, I expanded SwitchProngSrc a bit. Several of the tags there
aren't actually used by any current errors, but they're there for
consistency and if we ever need them.

Also delete a now-redundant test and fix another.
2023-06-13 12:55:27 +01:00
mlugg
bcb673d94a
Sema: resolve union payload switch captures with peer type resolution
This is a bit harder than it seems at first glance. Actually resolving
the type is the easy part: the interesting thing is actually getting the
capture value. We split this into three cases:

* If all payload types are the same (as is required in status quo), we
  can just do what we already do: get the first field value.
* If all payloads are in-memory coercible to the resolved type, we still
  fetch the first field, but we also emit a `bitcast` to convert to the
  resolved type.
* Otherwise, we need to handle each case separately. We emit a nested
  `switch_br` which, for each possible case, gets the corresponding
  union field, and coerces it to the resolved type. As an optimization,
  the inner switch's 'else' prong is used for any peer which is
  in-memory coercible to the target type, and the bitcast approach
  described above is used.

Pointer captures have the additional constraint that all payload types
must be in-memory coercible to the resolved type.

Resolves: #2812
2023-06-13 12:55:22 +01:00
Jacob Young
44d8cf9331 wasm: address behavior test regressions 2023-06-10 20:51:10 -07:00
mlugg
2a6b91874a stage2: pass most test cases under InternPool
All but 2 test cases now pass (tested on x86_64 Linux, native only). The
remaining two signify an issue requiring a larger refactor, which I will
do in a separate commit.

Notable changes:
* Fix uninitialized memory when allocating objects from free lists
* Implement TypedValue printing for pointers
* Fix some TypedValue printing logic
* Work around non-existence of InternPool.remove implementation
2023-06-10 20:51:10 -07:00
Jacob Young
494d4f9b8e behavior: update for different inferred error set order
Error sets are no longer alphabetically sorted.
2023-06-10 20:47:57 -07:00
Jacob Young
d40b83de45 behavior: pass more tests on llvm again 2023-06-10 20:47:56 -07:00
mlugg
1e7dcaa3ae Sema: resolve peer vector types before comparison
Resolves: #15732
2023-06-10 21:41:49 +03:00
mlugg
34d44e0c1c Sema: emit error on @intToPtr with slice dest type
Resolves: #15967
2023-06-10 11:12:35 +03:00
mlugg
bf4b43a2f7 AstGen: handle ref_table for params
This is kind of similar to 1a4b0d9. In this case, we need to handle
ref_table when appending the body of param instructions.

Resolves: #15952
2023-06-10 07:18:05 +03:00
Andrew Kelley
629f0d23b5
Merge pull request #15579 from squeek502/mem-delimiters
Split `std.mem.split` and `tokenize` into `sequence`, `any`, and `scalar` versions
2023-06-03 13:51:02 -07:00
mlugg
1a4b0d9790 AstGen: handle ref_table for errdefer captures
Resolves: #15861
2023-06-03 13:36:44 -07:00
Andrew Kelley
77b40d6ecb
Merge pull request #15927 from truemedian/http-bugs
std.http: fix infinite read loop, deduplicate connection code, add TlsAlert errors
2023-06-03 13:36:07 -07:00
Nameless
23ccff9cce
std.http.Server: collapse BufferedConnection into Connection 2023-06-01 13:44:00 -05:00
Luuk de Gram
3faf376b08
Merge pull request #15919 from Luukdegram/wasm-behavior-tests 2023-06-01 19:42:04 +02:00
Evin Yulo
3085e2af41 add missing note "operation is runtime due to this operand" 2023-05-31 19:18:36 +03:00
Luuk de Gram
1042deb86f
enable passing behavior tests 2023-05-31 18:04:33 +02:00
yujiri8
cd1417dbdf
don't crash when can't evaluate comptime expression with inferred type
Closes #15911.
2023-05-31 11:15:52 +00:00