Andrew Kelley
07e47c058c
ptrCast builtin now gives an error for removing const qualifier
...
closes #384
2018-03-06 16:37:03 -05:00
Andrew Kelley
de5c0c9f40
Merge remote-tracking branch 'origin/master' into async
2018-03-01 20:47:35 -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
8429d4ceac
implement coroutine resume
2018-02-28 22:18:48 -05:00
Andrew Kelley
c622766156
async function fulfills promise atomically
2018-02-28 21:48:20 -05:00
Andrew Kelley
807a5e94e9
add atomicrmw builtin function
2018-02-28 21:19:51 -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
ad2a29ccf2
break the data dependencies that llvm coro transforms cant handle
...
my simple coro test program builds now
see #727
2018-02-28 16:47:13 -05:00
Andrew Kelley
026aebf2ea
another workaround for llvm coroutines
...
this one doesn't work either
2018-02-28 04:01:22 -05:00
Andrew Kelley
138d6f9093
revert workaround for alloc and free as coro params
...
reverts 4ac6c4d6bfb8f7ada2799ddb5ce3a9797be0518d
the workaround didn't work
2018-02-27 17:46:13 -05:00
Andrew Kelley
4e43bde924
workaround for llvm: delete coroutine allocation elision
...
maybe this can be reverted, but it seems to be related
to llvm's coro transformations crashing.
See #727
2018-02-26 21:31:00 -05:00
Andrew Kelley
4ac6c4d6bf
workaround llvm coro transformations
...
by making alloc and free functions be parameters to async
functions instead of using getelementptr in the DynAlloc block
See #727
2018-02-26 21:14:15 -05: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
Andrew Kelley
3e86fb500d
implement coroutine suspend
...
see #727
2018-02-26 02:46:21 -05:00
Andrew Kelley
c60496a297
parse await and suspend syntax
...
See #727
2018-02-26 00:04:11 -05:00
Andrew Kelley
6fef7406c8
move coroutine init code to after coro.begin
2018-02-25 20:29:14 -05:00
Andrew Kelley
6b436146a8
fix invalid memory write in coroutines implementation
2018-02-25 20:28:44 -05:00
Andrew Kelley
fe354ebb5c
coroutines: fix llvm error of instruction not dominating uses
...
See #727
2018-02-25 17:57:05 -05:00
Andrew Kelley
83f8906449
codegen for coro_resume instruction
...
See #727
2018-02-25 17:34:05 -05:00
Andrew Kelley
9f6c5a20de
codegen for coro_id instruction
...
See #727
2018-02-25 15:10:29 -05:00
Andrew Kelley
05bf666eb6
codegen for calling an async function
...
See #727
2018-02-25 02:47:31 -05:00
Andrew Kelley
40dbcd09da
fix type_is_codegen_pointer being used incorrectly
...
The names of these functions should probably change, but at least
the semantics are correct now:
* type_is_codegen_pointer - the type is either a fn, ptr, or promise
* get_codegen_ptr_type -
- ?&T and &T returns &T
- ?promise and promise returns promise
- ?fn()void and fn()void returns fn()void
- otherwise returns nullptr
2018-02-23 12:49:21 -05:00
Ben Noordhuis
f11b948019
allow implicit cast from S to ?&const S
...
Allow implicit casts from container types to nullable const pointers to
said container type. That is:
fn f() void {
const s = S {};
g(s); // Works.
g(&s); // So does this.
}
fn g(_: ?&const S) void { // Nullable const pointer.
}
Fixes #731 .
2018-02-23 15:55:57 +01:00
Andrew Kelley
99985ad6fc
implement Zig IR for async functions
...
See #727
2018-02-23 03:03:06 -05:00
Ben Noordhuis
0845cbe277
name types inside functions after variable
...
Before this commit:
fn f() []const u8 {
const S = struct {};
return @typeName(S); // "f()", unexpected.
}
And now:
fn f() []const u8 {
const S = struct {};
return @typeName(S); // "S", expected.
}
Fixes #675 .
2018-02-22 19:54:02 +01:00
Andrew Kelley
ca1b77b2d5
IR analysis for coro.begin
...
See #727
2018-02-22 11:54:27 -05:00
Andrew Kelley
88e7b9bf80
ir analysis for coro_id and coro_alloc
...
See #727
2018-02-22 09:36:58 -05:00
Andrew Kelley
37c07d4f3f
coroutines: analyze get_implicit_allocator instruction
...
see #727
2018-02-22 09:30:55 -05:00
Andrew Kelley
b261da0672
add coroutine startup IR to async functions
...
See #727
2018-02-21 23:28:35 -05:00
Andrew Kelley
236bbe1183
implement IR analysis for async function calls
...
See #727
2018-02-21 00:52:20 -05:00
Andrew Kelley
65a51b401c
add promise type
...
See #727
2018-02-20 16:42:14 -05:00
Andrew Kelley
a06f3c74fd
parse async fn definitions
...
See #727
2018-02-20 00:31:52 -05:00
Andrew Kelley
3d58d7232a
parse async fn calls and cancel expressions
2018-02-20 00:05:38 -05:00
Andrew Kelley
72ca2b214d
ability to slice an undefined pointer at compile time if the len is 0
2018-02-16 15:22:29 -05:00
Andrew Kelley
1c1c0691cc
fix crash when doing comptime float rem comptime int
...
closes #776
2018-02-14 23:12:51 -05:00
Andrew Kelley
9fa35adbd4
fix sometimes not type checking function parameters
...
closes #774
regression introduced in cfb2c676925d77887e46631dcafa783e6c65e61d
2018-02-14 16:24:43 -05:00
Andrew Kelley
e7bf8f3f04
fix compiler crash switching on global error with no else
2018-02-09 13:49:58 -05:00
Andrew Kelley
3919afcad2
fix crash with error peer type resolution
...
closes #765
2018-02-09 11:16:04 -05:00
Andrew Kelley
0efe441dfd
if statements support comptime known test error, runtime payload
2018-02-08 22:18:13 -05:00
Andrew Kelley
54c06bf715
error sets: runtime safety for int-to-err and err set cast
2018-02-08 21:54:44 -05:00
Andrew Kelley
f9be970375
Merge remote-tracking branch 'origin/master' into error-sets
2018-02-08 20:45:26 -05:00
Andrew Kelley
57edd4dcb3
error sets - fix bad value for constant error literal
2018-02-08 18:13:07 -05:00
Andrew Kelley
fee875770c
error set casting building
2018-02-08 11:09:18 -05:00
Andrew Kelley
0d5ff6f462
error sets - most tests passing
2018-02-08 02:08:45 -05:00
Andrew Kelley
68238d5678
fix comptime fn execution not returning error unions properly
2018-02-07 22:33:05 -05:00
Ben Noordhuis
0090c2d70b
DRY 'is slice?' conditionals in parser ( #750 )
2018-02-07 14:38:49 -05:00
Andrew Kelley
f99b8b006f
error sets - fix most std lib compile errors
2018-02-05 18:09:13 -05:00
Andrew Kelley
6940212ecb
error sets: fix peer resolution of error unions
2018-02-05 17:42:13 -05:00
Andrew Kelley
44d8d654a0
fix test failure, organize code, add new compile error
2018-02-05 09:26:39 -05:00