Commit Graph

940 Commits (b946982e90c88d0c23cfb2e819f58ce8ff9af617)

Author SHA1 Message Date
Andrew Kelley e48e707c32 allow integer and float literals to be passed to var params
closes #623
2018-04-11 14:47:37 -04:00
Andrew Kelley ee1a4f4c1d error return traces work with async return case 2018-04-08 17:44:29 -04:00
Andrew Kelley 9e98ea552d fix calling convention at callsite of zig-generated fns 2018-04-08 16:40:59 -04:00
Andrew Kelley 032fccf615 fix compile time array concatenation for slices
closes #866
2018-03-28 23:25:12 -04:00
Andrew Kelley 6cb99fdac3 fix crash when compile error in analyzing @panic call 2018-03-27 15:07:45 -04:00
Andrew Kelley aa2995ee39 fix invalid codegen for error return traces across suspend points
See #821

Now the code works correctly, but error return traces are missing
the frames from coroutines.
2018-03-24 22:07:12 -04:00
Andrew Kelley a43c7af3d1 add comptime test for the type of suspend promise 2018-03-24 19:31:00 -04:00
Andrew Kelley 897e783763 add promise->T syntax parsing
closes #857
2018-03-24 19:25:53 -04:00
Andrew Kelley 18af2f9a27 fix async fns with inferred error sets
closes #856
2018-03-24 18:28:32 -04:00
Marc Tiehuis 3d1732ef6c Fix OpqaueType usage in exported c functions
We prefer `struct typename`. If a typedef is required, this must be done
manually after generation.
2018-03-23 20:27:11 +13:00
Andrew Kelley 7a99d63c76 ability to use async function pointers
closes #817
2018-03-22 16:56:03 -04:00
Andrew Kelley f885a1ab61 change async function call syntax
* instead of `async(allocator) call()`, now it is
   `async<allocator> call()`.
 * Fixes syntax ambiguity when leaving off the allocator
 * Fixes parse failure when call is a field access

This sets a precedent for using `<` to pass arguments
to a keyword. This will affect `enum`, `union`, and
`fn` (see #661)
2018-03-21 19:56:41 -04:00
Andrew Kelley d959faa4c7 add test for addIncludeDir for test step 2018-03-17 18:19:23 -04:00
Andrew Kelley efebb6d341 fix tests broken by previous commit 2018-03-14 03:37:54 -04:00
Andrea Orru c828c23f71 Tests for zero-bit field compiler error 2018-03-13 22:07:40 -07:00
Andrew Kelley 7f7823e23c fix casting a function to a pointer causing compiler crash
closes #777
2018-03-13 19:15:20 -04:00
Andrew Kelley bcce77700f some return types disqualify comptime fn call caching
closes #828
2018-03-12 12:56:25 -04:00
Andrew Kelley 5834ff0cc5 don't memoize comptime fn calls that access comptime mutable state
closes #827
2018-03-12 08:35:41 -04:00
Andrew Kelley 1bf2810f33 fix comptime slicing not preserving comptime mutability
* fix comptime slice of slice not preserving mutatibility
   of the comptime data
 * fix comptime slice of pointer not preserving mutability
   of the comptime data

closes #826
2018-03-12 01:21:10 -04:00
Andrew Kelley 49c3922037 fix incorrect setEvalBranchQuota compile error
closes #688
2018-03-12 00:08:52 -04:00
Andrew Kelley 20011a7a1c add behavior test for coroutine frame allocation failure 2018-03-10 01:38:40 -05:00
Andrew Kelley 6db9be8900 don't memoize comptime functions if they can mutate state via parameters
closes #639
2018-03-09 14:20:44 -05:00
Andrew Kelley aaf2230ae8 fix partial inlining of binary math operator using old value
the code was abusing the internal IR API. fixed now.

closes #699
2018-03-08 17:15:55 -05:00
Andrew Kelley 028ec0f2c3 enums with 1 field and explicit tag type still get the tag type
closes #820
2018-03-08 15:22:42 -05:00
Jimmi Holst Christensen 2e010c60ae Translate C now correctly converts ints, floats, ptrs and enums to bools
* Boolean "and" and "or" should also work with these types.
* This new method also simplifies to output code.
2018-03-08 15:34:00 +01:00
Jimmi Holst Christensen b2887620f3 Translate C will now handle ignored return values 2018-03-08 13:15:30 +01:00
Jimmi Holst Christensen 689e241ff8 Merge branch 'master' of github.com:zig-lang/zig 2018-03-08 10:29:43 +01:00
Jimmi Holst Christensen 51b2f1b80b Translate C can now translate switch statements again 2018-03-08 10:29:29 +01:00
Andrew Kelley 790aaeacae add compile error for using @tagName on extern union
closes #742
2018-03-07 14:35:48 -05:00
Jimmi Holst Christensen bb80daf509 Ast Render no longer outputs erroneous semicolon
closes #813
2018-03-07 10:39:32 +01:00
Andrew Kelley d96dd5bc32 fix missing compile error for returning error from void async function
closes #799
2018-03-06 21:44:27 -05:00
Andrew Kelley eff3530dfa var is no longer a pseudo-type, it is syntax
closes #779
2018-03-06 18:31:31 -05:00
Andrew Kelley 44ae891bd7 fix assertion when taking slice of zero-length array
closes #788
2018-03-06 17:19:45 -05:00
Andrew Kelley 5d5820029d fix broken tests from previous commit 2018-03-06 16:46:45 -05:00
Andrew Kelley 07e47c058c ptrCast builtin now gives an error for removing const qualifier
closes #384
2018-03-06 16:37:03 -05:00
Jimmi Holst Christensen 5ab25798e3 We now also use trans_to_bool_expr on bool not 2018-03-06 12:04:14 +01:00
Jimmi Holst Christensen bf47cf418a expr to bool is now it's own function.
* Now while and for loops work on ints and floats, like if statements
* This fixes the loop problem in #813
2018-03-06 11:57:51 +01:00
Andrew Kelley 101b7745c4 add optnone noinline to async functions
this works around LLVM optimization assertion failures.
https://bugs.llvm.org/show_bug.cgi?id=36578

closes #800
2018-03-02 13:40:03 -05:00
Andrew Kelley de5c0c9f40 Merge remote-tracking branch 'origin/master' into async 2018-03-01 20:47:35 -05:00
Andrew Kelley 6bade0b825 coroutines: add await early test case 2018-03-01 16:17:38 -05:00
Andrew Kelley 8a0e1d4c02 await keyword works 2018-03-01 15:46:35 -05:00
Andrew Kelley 253d988e7c implementation of await
but it has bugs
2018-03-01 03:28:13 -05:00
Andrew Kelley 834e992a7c add test for coroutine suspend with block 2018-02-28 22:26:26 -05:00
Andrew Kelley 8429d4ceac implement coroutine resume 2018-02-28 22:18:48 -05:00
Andrew Kelley 807a5e94e9 add atomicrmw builtin function 2018-02-28 21:19:51 -05:00
Andrew Kelley 36eadb569a run coroutine tests only in Debug mode
LLVM 5.0.1, 6.0.0, and trunk crash when attempting to optimize coroutine code.
So, Zig does not support ReleaseFast or ReleaseSafe for coroutines yet.
Luckily, Clang users are running into the same crashes, so folks from the LLVM
community are working on fixes. If we're really lucky they'll be fixed in 6.0.1.
Otherwise we can hope for 7.0.0.
2018-02-28 18:56:26 -05:00
Andrew Kelley 58dc2b719c better coroutine codegen, now passing first coro test
we have to use the Suspend block with llvm.coro.end to
return from the coro
2018-02-28 18:22:43 -05:00
Andrew Kelley 1b8a241f6f Merge branch 'fix795' of https://github.com/bnoordhuis/zig into bnoordhuis-fix795 2018-02-28 00:22:53 -05:00
Ben Noordhuis 90598b4631 fix assert on self-referencing function ptr field
The construct `struct S { f: fn(S) void }` is not legal because structs
are not copyable but it should not result in an ICE.

Fixes #795.
2018-02-28 00:56:00 +01:00
Ben Noordhuis 9aa65c0e8e allow implicit cast from &const to ?&const &const
Allow implicit casts from n-th degree const pointers to nullable const
pointers of degree n+1.  That is:

    fn f() void {
        const s = S {};
        const p = &s;
        g(p);   // Works.
        g(&p);  // So does this.
    }

    fn g(_: ?&const &const S) void {  // Nullable 2nd degree const ptr.
    }

Fixes #731 some more.
2018-02-26 19:56:26 +01:00