Commit Graph

1644 Commits

Author SHA1 Message Date
Andrew Kelley
0d8c9fcb18
support async functions with inferred error sets 2019-08-05 00:41:49 -04:00
Andrew Kelley
fa30ebfbe5
suspension points inside branching control flow 2019-08-04 18:24:10 -04:00
Andrew Kelley
87710a1cc2
implement @asyncCall which supports async function pointers 2019-08-03 16:17:42 -04:00
Andrew Kelley
c879209661
add compile error for calling async function pointer 2019-08-03 02:40:38 -04:00
Andrew Kelley
e444e737b7
add runtime safety for resuming an awaiting function 2019-08-03 02:11:52 -04:00
Andrew Kelley
24d78177ee
add compile error for async call of function pointer 2019-08-03 01:06:14 -04:00
Andrew Kelley
0920bb0872
implement async functions returning structs 2019-08-02 19:27:27 -04:00
Andrew Kelley
5bd330e76c
add heap allocated async function frame test 2019-08-02 16:32:24 -04:00
Andrew Kelley
b3b6a98451
Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-02 16:31:43 -04:00
Andrew Kelley
f07f09a373
Merge branch 'master' into rewrite-coroutines 2019-08-02 16:13:36 -04:00
Andrew Kelley
d105769926
fix regressions regarding writing through const pointers 2019-08-02 16:09:40 -04:00
Andrew Kelley
9069ee957c
fix discarding function call results 2019-08-02 15:17:02 -04:00
Andrew Kelley
90e64bc620
fix cmpxchg with discarded result 2019-08-02 14:47:26 -04:00
Andrew Kelley
a5cb0f77d1
assignment participates in result location
fix one regression with optionals but there are more
2019-08-02 13:54:58 -04:00
Andrew Kelley
056c4e2c98
implement async await and return 2019-08-02 01:06:00 -04:00
Andrew Kelley
0f879d02a4
more passing coroutine tests 2019-08-01 19:14:48 -04:00
Andrew Kelley
1dd0c3d49f
fix calling an inferred async function 2019-08-01 16:41:30 -04:00
Andrew Kelley
e7ae4e4645
reimplement async with function splitting instead of switch 2019-08-01 16:08:52 -04:00
Andrew Kelley
6cb4cac5cd
disable behavior test for 128-bit cmpxchg
once #2883 is done this can be revisited
2019-08-01 03:36:03 -04:00
Andrew Kelley
38b5812c48
allow 128 bit cmpxchg on x86_64 2019-08-01 02:46:37 -04:00
Andrew Kelley
dbdc4d62d0
improve support for anyframe and anyframe->T
* add implicit cast from `*@Frame(func)` to `anyframe->T` or `anyframe`.
 * add implicit cast from `anyframe->T` to `anyframe`.
 * `resume` works on `anyframe->T` and `anyframe` types.
2019-07-29 19:32:49 -04:00
Andrew Kelley
ee64a22045
add the anyframe and anyframe->T types 2019-07-26 19:52:35 -04:00
Andrew Kelley
538c0cd225
implement @frameSize 2019-07-25 15:05:55 -04:00
Andrew Kelley
70bced5dcf
implement @frame and @Frame 2019-07-25 01:47:56 -04:00
Andrew Kelley
ead2d32be8
calling an inferred async function 2019-07-25 00:03:06 -04:00
Andrew Kelley
9e11f67f0d
add test for previous commit 2019-07-24 15:05:39 -04:00
Andrew Kelley
e220812f2f
implement local variables in async functions 2019-07-24 02:59:51 -04:00
Andrew Kelley
19ee495750
add error for function with ccc indirectly calling async function 2019-07-23 19:35:41 -04:00
Vexu
57aa8997bd fix escape sequence rendering 2019-07-23 14:49:19 -04:00
Andrew Kelley
317d1ecb2c
Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-07-22 14:37:08 -04:00
Andrew Kelley
fcadeb50c0
fix multiple coroutines existing clobbering each other 2019-07-22 14:36:14 -04:00
Andrew Kelley
16be70cbbf
compiler-rt: add __muldi3 2019-07-22 12:49:26 -04:00
Andrew Kelley
59bf9ca58c
implement async function parameters 2019-07-21 23:27:47 -04:00
Andrew Kelley
11bd50f2b2
implement coroutine resume 2019-07-21 20:54:08 -04:00
Andrew Kelley
78e03c466c
simple async function passing test 2019-07-21 19:56:37 -04:00
Andrew Kelley
54e716afdc
remove coroutines implementation and promise type 2019-07-19 18:18:44 -04:00
Andrew Kelley
af8661405b
fix usingnamespace
It used to be that usingnamespace was only allowed at top level. This
made it OK to put the state inside the AST node data structure. However,
now usingnamespace can occur inside any aggregate data structure, and
therefore the state must be in the TopLevelDeclaration rather than in
the AST node.

There were two other problems with the usingnamespace implementation:

 * It was passing the wrong destination ScopeDecl, so it could cause an
   incorrect error such as "import of file outside package path".
 * When doing `usingnamespace` on a file that already had
   `pub usingnamespace` in it would "steal" the usingnamespace, causing
   incorrect "use of undeclared identifier" errors in the target file.

closes #2632
closes #2580
2019-07-19 16:56:44 -04:00
Andrew Kelley
9dcddc2249
retire the example/ folder, rename test-build-examples to "standalone"
closes #2759
2019-07-16 12:15:46 -04:00
Andrew Kelley
741c74e427
cleanups 2019-07-16 11:50:00 -04:00
Andrew Kelley
45cc488cef
Merge branch 'main-return-!u8' of https://github.com/SamTebbs33/zig into SamTebbs33-main-return 2019-07-16 11:27:11 -04:00
Andrew Kelley
6fe3b20962
Merge branch 'translate-c-userland' of https://github.com/hryx/zig into hryx-translate-c-userland 2019-07-15 22:19:54 -04:00
Andrew Kelley
c0489abcdb
translate-c: fix incorrectly translated double function pointer
closes #2887
2019-07-13 12:38:10 -04:00
Andrew Kelley
4e58855a4a
translate-c: better detection of pointer to struct demoted to opaque 2019-07-12 12:11:26 -04:00
SamTebbs33
b118806c69 Add implicit cast for *[N]T to [*c]T 2019-07-06 17:02:17 -04:00
hryx
6bfa8546bb
Unicode escapes: stage1 tokenizer and behavior tests 2019-07-04 22:40:19 -07:00
SamTebbs33
f24b8f2a4a Support returning !u8 from main 2019-07-04 14:26:05 +01:00
Andrew Kelley
96fd103073
improve the error message and test coverage 2019-07-04 00:35:28 -04:00
Andrew Kelley
bfe0bf695b
Merge branch 'impl-1107' of https://github.com/emekoi/zig into emekoi-impl-1107 2019-07-03 23:40:47 -04:00
emekoi
a1b952f4b0 added tests for #1107 and a note in the reference 2019-07-03 13:12:14 -05:00
Andrew Kelley
9da054095c
Merge branch 'comptime-union-init' of https://github.com/rbscott/zig into rbscott-comptime-union-init 2019-07-03 11:26:55 -04:00
Andrew Kelley
9daf0140e5
add missing compile error for comptime continue inside runtime catch
See #2604
2019-07-02 21:14:42 -04:00
Andrew Kelley
df11512f85
fixups 2019-07-02 16:52:55 -04:00
Andrew Kelley
140335b99f
Merge branch 'has-field' of https://github.com/shawnl/zig into shawnl-has-field 2019-07-02 16:21:40 -04:00
hryx
cc74bf5136
Translate IntegralCast; add stage2 test coverage 2019-06-27 23:12:33 -07:00
hryx
2060c7c39b
Merge branch 'master' into translate-c-userland 2019-06-27 22:12:34 -07:00
Andrew Kelley
0a0c11685f
fix for with null and T peer types and inferred result location type
See #2762
2019-06-27 17:22:35 -04:00
Andrew Kelley
1b23c46138
fix switch with null and T peer types and inferred result location type
closes #2762
2019-06-27 16:54:19 -04:00
Andrew Kelley
1ccf6a2c9e
compile error for using slice as array init expr type
when there are more than 0 elements.

closes #2764
2019-06-27 12:24:13 -04:00
Andrew Kelley
6c195ede54
add test case for defer modifying return value before returned
See #961
2019-06-26 23:25:53 -04:00
Andrew Kelley
3085d29af8
Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-26 14:44:01 -04:00
Andrew Kelley
ff737cc648
fix peer type resolution: unreachable, error set, unreachable 2019-06-26 12:31:51 -04:00
Andrew Kelley
b4e40cb59a
fix peer type resolution with null 2019-06-26 00:36:24 -04:00
Andrew Kelley
fd4c5f54f0
all compile error tests passing 2019-06-25 19:03:56 -04:00
Andrew Kelley
0a77325916
fix several compile error test regressions 2019-06-25 18:06:03 -04:00
Andrew Kelley
cb55803a59
fix implicit cast vector to array 2019-06-25 13:57:45 -04:00
Andrew Kelley
c61e0a078c
fix union init with void payload
all std lib tests passing now
2019-06-25 11:31:38 -04:00
Marc Tiehuis
f5af349bd6
Merge pull request #2714 from ziglang/fmt-overhaul
Add positional, precision and width support to std.fmt
2019-06-25 20:15:33 +12:00
hryx
b2e06c3bf4
Observe translate mode in stage2 2019-06-23 14:32:45 -07:00
Andrew Kelley
b2cbc59e4c
Merge branch 'simd2' of https://github.com/shawnl/zig into shawnl-simd2 2019-06-23 17:10:33 -04:00
hryx
226a23d977
stage1: always render space after fn like stage2 2019-06-23 12:46:17 -07:00
Andrew Kelley
020d5b529e
compile error tests only for debug mode 2019-06-23 02:06:57 -04:00
Andrew Kelley
036cc48a82
Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-23 01:29:48 -04:00
Shawn Landden
71e014caec stage1: add @sin @cos @exp @exp2 @ln @log2 @log10 @fabs @floor @ceil @trunc @round
and expand @sqrt

This revealed that the accuracy of ln is not as good as the current algorithm in
musl and glibc, and should be ported again.

v2: actually include tests
v3: fix reversal of in and out arguments on f128M_sqrt()
    add test for @sqrt on comptime_float
    do not include @nearbyInt() until it works on all targets.
2019-06-22 14:34:34 -05:00
Sahnvour
987c209b40 heap: make one global instance of DirectAllocator
it is now stateless, so the de/init are not necessary anymore
2019-06-22 14:10:53 -04:00
Andrew Kelley
3c4b255a3c
fix implicit cast fn call result to optional in field result 2019-06-22 13:37:13 -04:00
Andrew Kelley
727af307c6
fix return result loc and then switch with range...
...implicit casted to error union
2019-06-21 18:21:12 -04:00
Andrew Kelley
ff6d563b04
fix implicit cast to optional to error union to return result loc 2019-06-21 17:49:54 -04:00
Andrew Kelley
5441f77672
fix implicit cast bitcast result to error union by returning 2019-06-21 16:54:46 -04:00
Andrew Kelley
142e77abbb
fix extern functions returning byval structs 2019-06-21 14:44:49 -04:00
Andrew Kelley
48ccf427af
fix nested orelse and nested catch 2019-06-21 14:06:01 -04:00
Marc Tiehuis
11526b6e9d breaking: Add positional, precision and width support to std.fmt
This removes the odd width and precision specifiers found and replacing
them with the more consistent api described in #1358.

Take the following example:

    {1:5.9}

This refers to the first argument (0-indexed) in the argument list. It
will be printed with a minimum width of 5 and will have a precision of 9
(if applicable).

Not all types correctly use these parameters just yet. There are still
some missing gaps to fill in. Fill characters and alignment have yet to
be implemented.
2019-06-21 20:11:15 +12:00
Andrew Kelley
4f21dc8a80
fix regression with zero sized array
thanks mikdusan!
2019-06-21 00:58:18 -04:00
Andrew Kelley
0498bd40d9
fix loops with multiple break statements 2019-06-20 22:38:40 -04:00
Andrew Kelley
237233b04b
fix coroutines 2019-06-20 18:27:04 -04:00
Andrew Kelley
057b105fad
one more test passing 2019-06-20 18:03:55 -04:00
Andrew Kelley
3c541d7be3
fix peer result loc fn call with comptime condition 2019-06-19 23:52:51 -04:00
Andrew Kelley
6217b401f9
fix labeled break inside comptime if inside runtime if 2019-06-19 23:39:49 -04:00
Andrew Kelley
78eeb6e9ae
fix double getelementptr of runtime global 2019-06-19 22:29:39 -04:00
Andrew Kelley
04c25efe11
Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-19 19:01:28 -04:00
Andrew Kelley
4ffab5b85f
fix optional pointer to size zero struct 2019-06-19 18:47:02 -04:00
Andrew Kelley
c7dc03fcb1
fix try not setting error code on result location 2019-06-19 17:07:05 -04:00
Andrew Kelley
96931228af
fix comptime test error for empty error set 2019-06-19 16:29:46 -04:00
Andrew Kelley
974db231a0
fix extraneous nested union field instruction 2019-06-19 16:16:47 -04:00
Andrew Kelley
e36680d3bd
fix detection of unable to evaluate constant expression 2019-06-19 15:18:51 -04:00
Andrew Kelley
b588a803bf
fix comptime modification of const struct field 2019-06-19 14:35:59 -04:00
Shawn Landden
39ad072a84 test: include muladd.zig in behavior tests 2019-06-19 12:07:02 -05:00
Shawn Landden
fce2d2d18b stage1: add support for @mulAdd fused-multiply-add for floats and vectors of floats
Not all of the softfloat library is being built....

Vector support is very buggy at the moment, but should work when the bugs are fixed.
(as I had the same code working with another vector function, that hasn't been merged yet).
2019-06-19 12:07:02 -05:00
Andrew Kelley
79671efd3a
fix inline loop behavior with variable result loc 2019-06-18 17:43:05 -04:00
Andrew Kelley
e27da17ff2
back to many behavioral tests passing 2019-06-18 17:07:27 -04:00
Andrew Kelley
9050a07540
when resolving slice types, might need to...
...resolve alignment if custom alignment is provided

fixes #2689
2019-06-18 11:31:05 -04:00