1643 Commits

Author SHA1 Message Date
Andrew Kelley
581d16154b
Merge pull request #5696 from alexnask/async_call_tuple
@asyncCall now takes arguments as a tuple instead of varargs
2020-06-28 01:00:58 -04:00
arbrk1
78d8931647
Fix issue #5618 (#5685)
* fix issue #5618

* A test for the issue #5618 added.
Also inserted a comma in the neighboring test to make it more zigfmt-friendly.
2020-06-24 23:58:50 -04:00
Alexandros Naskos
2fde8249b7 Fixed crash when resolving peer types of *[N:s]const T and [*:s]const T 2020-06-24 23:58:02 -04:00
Alexandros Naskos
eefcd04462 Small fixes, fixed tests, added test for argument tuple type 2020-06-24 16:56:24 +03:00
Alexandros Naskos
50b70bd77f @asyncCall now requires an argument tuple 2020-06-24 14:07:39 +03:00
antlilja
0de35af98b Add duplicate checking for switch on types
* Add compile error tests
2020-06-23 15:17:04 -04:00
xackus
d907f574e0 stage1: fix concat of sliced str literals 2020-06-21 14:57:12 -04:00
Robin Voetter
8696e52a3d
Make unary minus for unsigned types a compile error (#5654)
* Make unary minus for unsigned types a compile error

* Add unreachable when generating unsigned negate
2020-06-21 14:55:44 -04:00
Andrew Kelley
c70633eacd
Merge pull request #5203 from tadeokondrak/@type-for-even-more-types
implement @typeInfo for Frame and implement @Type for Frame, EnumLiteral, and ErrorSet
2020-06-18 21:25:03 -04:00
Andrew Kelley
5ea0f589c9
Merge pull request #5625 from antlilja/master
Improve support for f128 and comptime_float operations
2020-06-18 20:32:43 -04:00
Andrew Kelley
4a38799631 make file and fn_name fields of SourceLocation also null-terminated
One of the main motivating use cases for this language feature is
tracing/profiling tools, which expect null-terminated strings for these
values. Since the data is statically allocated, making them
additionally null-terminated comes at no cost.

This prevents the requirement of compile-time code to convert to
null-termination, which could increase the compilation time of
code with tracing enabled.

See #2029
2020-06-18 17:09:10 -04:00
Vexu
a5379aa3ee
implement @src 2020-06-18 21:11:09 +03:00
antlilja
1157ee1307 Improve builtin op support for f128/comptime_float
* Add support for fabs, floor, ceil, trunc and round
* Add behavior tests
2020-06-17 17:35:45 +02:00
Jakub Konka
04c3fae720 Remove obsolete branch in ir_analyze_cast
Branch handling `*[N]T` to `E![]T` is already handled in a more complete
branch handling `*[N]T` to `[]T` *and* `*[N]T` to `E![]T` so it seems
safe to remove this one.
2020-06-16 18:24:45 -04:00
Andrew Kelley
2bb3e1aff4 stage1: implement type coercion of anon struct literal to struct
closes #3672
2020-06-15 16:52:18 -04:00
Jakub Konka
52b97eeef1 Return u32 in @wasmMemorySize instead of i32 2020-06-09 00:22:34 -04:00
Jakub Konka
057d97c093 Return should be i32 due to error signaling in memory.grow
Also, fix tests.
2020-06-09 00:22:34 -04:00
Jakub Konka
3f0a3cea6e Fix builtins to return and accept u32 instead of i32 2020-06-09 00:22:34 -04:00
Jakub Konka
8ffa8ed9a8 Expose full llvm intrinsic 2020-06-09 00:22:34 -04:00
Jakub Konka
601e831f1d Add builtin for llvm.wasm.memory.grow.i32 intrinsic
This will allow the developer to request additional memory pages
from the runtime to be allocated for the Wasm app. Typical usage:

```zig
var wasm_pages = @wasmMemorySize();
@wasmMemoryGrow(1);
@import("std").debug.assert((wasm_pages + 1) == @wasmMemorySize());
```
2020-06-09 00:22:17 -04:00
Jakub Konka
ce3f0077cf Add builtin for llvm.wasm.memory.size.i32 instrinsic
This will allow the developer to poll the runtime for currently
allocated memory in the number of Wasm pages. Typical usage:

```zig
var wasm_pages = @wasmMemorySize();
@import("std").debug.assert(wasm_pages > 0);
```
2020-06-09 00:22:17 -04:00
Andrew Kelley
9ee98f103b
Merge pull request #5539 from mikdusan/issue5474
stage1: fix constness in some corner cases
2020-06-09 00:12:57 -04:00
xackus
0d40cb6255 stage1: fix crash on slice byte reinterpretation 2020-06-08 17:19:06 -04:00
Michael Dusan
c0c9d11d8c
stage1: fix constness in some corner cases
- for one-possible-value types, ir_analyze_struct_field_ptr()
  no longer hardcodes const/volatile

- when slicing arrays, ir_analyze_instruction_slice()
  no longer consults ConstValSpecialStatic

closes #5474
2020-06-05 00:49:57 -04:00
xackus
250dd9ac21 stage1: fix unresolved inferred error sets 2020-05-31 15:04:34 +02:00
foobles
51682717d7 Support equality comparison for optional to non-optional (?T ==/!= T)
extracted function ir_try_evaluate_bin_op_const
extracted type_is_self_comparable function
renamed ir_try_evaluate_bin_op_const to ir_try_evaluate_bin_op_cmp_const
implemented analysis of ?T == T
added ir_set_cursor_at_end_and_append_basic_block_gen
use build_br_gen and ir_set_cursor_at_end_and_append_block_gen
added ir_append_basic_block_gen
removed include of all_types in ir.cpp
extracted compile-time and runtime evaluation of cmp_optional_non_optional to separate functions

closes #5390
closes #1332
2020-05-29 18:46:09 -04:00
Veikka Tuominen
4c8b937fb0
Merge pull request #5184 from alexnask/typeof_extern_call
Extern functions are now evaluated to undefined values at comptime in TypeOf calls.
2020-05-30 01:11:22 +03:00
foobles
cb6bc5bdb5
Add caller location tracking for asserts (ir_assert, src_assert, ir_assert_gen) (#5393) 2020-05-26 12:55:31 -04:00
Andrew Kelley
c432811d96 fix regression in compile errors 2020-05-23 20:27:09 -04:00
Andrew Kelley
140dc2f43e stage1: fix false positive redeclared variable compile error 2020-05-20 23:13:02 -04:00
Alexandros Naskos
400a91e1c6 Add TypeOf resolution of dereferences and struct fields of undefined values 2020-05-18 19:15:44 +03:00
Andrew Kelley
9a22c8b6ca
Merge pull request #5057 from xackus/opaque-param
stage1: fix assert fail on opaque fn ptr param
2020-05-17 12:48:56 -04:00
Vexu
0847b47bf8
fix @intToFloat on comptime_floats 2020-05-12 00:24:09 +03:00
Vexu
f2d3266075
Merge pull request #4932 from Qix-/fix-private-access
Fix private access
2020-05-08 18:21:15 +03:00
Josh Junon
4a5c58dd35
fix private member checking for non-canonical invocations (fixes #4909) 2020-05-08 14:26:13 +03:00
xackus
2c9effc101 stage1: handle all cases of invalid struct field default value 2020-05-07 16:39:16 -04:00
Andrew Kelley
e6955688ac
Merge pull request #5272 from tadeokondrak/noasync-to-nosuspend
Noasync to nosuspend
2020-05-05 11:21:02 -04:00
Tadeo Kondrak
b957dc29a4
Rename noasync to nosuspend in C++ compiler 2020-05-05 05:17:34 -06:00
Vexu
f127dee474
Merge pull request #5267 from Vexu/const-call
Fix missing compile error on call assigned to const
2020-05-04 21:45:15 +03:00
Vexu
adc444ceeb
fix missing compile error on call assigned to const 2020-05-04 14:28:58 +03:00
xackus
0db9e90e8f stage1: fix assert fail on opaque fn ptr param 2020-05-04 06:51:37 +02:00
Tadeo Kondrak
a62e9bc8e5
Implement @Type for ErrorSet 2020-05-02 14:39:32 -06:00
Tadeo Kondrak
ca6db2d008
Implement @Type() for EnumLiteral and FnFrame 2020-05-02 14:39:28 -06:00
Tadeo Kondrak
1696e943ac
Implement @typeInfo for @Frame()
Closes https://github.com/ziglang/zig/issues/3066
2020-05-02 14:39:27 -06:00
Michael Dusan
09d6dc1ce6
stage1: cleanup
- remove unused IrInstSrcOptionalUnwrapPtr.initializing
2020-05-01 18:01:21 -04:00
Tadeo Kondrak
249938dde0
Validate vector types for @Vector 2020-04-28 00:24:45 -06:00
Tadeo Kondrak
45f4a1124f implement @Type() for more types 2020-04-27 14:37:18 -04:00
Alexandros Naskos
37fa418a94 Cleaned up code, added a testcase for an extern member function call 2020-04-27 18:07:18 +03:00
Alexandros Naskos
908b908481 Added tests. 2020-04-27 15:22:15 +03:00
Alexandros Naskos
179423ec27 Extern functions can now be evaluated to undefined values in TypeOfs 2020-04-27 02:33:21 +03:00