Commit Graph

393 Commits

Author SHA1 Message Date
Andrew Kelley
6d8550a7df
fix crash assigning optional struct with anon literal
closes #3827
2019-12-02 01:09:06 -05:00
Andrew Kelley
080316cd4f
fix assigning to an unwrapped optional field in an inline loop 2019-12-01 18:55:35 -05:00
Andrew Kelley
8524404f71
this test isn't passing in master branch either 2019-12-01 16:39:30 -05:00
Andrew Kelley
b220be7a33
more test regression fixes 2019-11-29 23:04:19 -05:00
Andrew Kelley
815b4cfd9d
fix return result loc as peer result loc in inferred error set function 2019-11-29 18:21:21 -05:00
Andrew Kelley
bcdb3a9006
more progress 2019-11-28 00:02:53 -05:00
Andrew Kelley
bf3ac66150
remove type coercion from array values to references
* Implements #3768. This is a sweeping breaking change that requires
   many (trivial) edits to Zig source code. Array values no longer
   coerced to slices; however one may use `&` to obtain a reference to
   an array value, which may then be coerced to a slice.

 * Adds `IrInstruction::dump`, for debugging purposes. It's useful to
   call to inspect the instruction when debugging Zig IR.

 * Fixes bugs with result location semantics. See the new behavior test
   cases, and compile error test cases.

 * Fixes bugs with `@typeInfo` not properly resolving const values.

 * Behavior tests are passing but std lib tests are not yet. There
   is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
Andrew Kelley
4261fa3c49
move logic to the appropriate layers; add new compile error 2019-11-25 18:46:17 -05:00
Andrew Kelley
cb38bd0a14
rename std.heap.direct_allocator to std.heap.page_allocator
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
Andrew Kelley
15d415e10b
make std.mem.toSlice use null terminated pointers
and fix the fallout
2019-11-24 21:21:05 -05:00
Andrew Kelley
4018034708
add test cases for arbitrary pointer sentinels 2019-11-24 16:52:32 -05:00
Andrew Kelley
09ec720dab
fix comptime @ptrCast of pointers to arrays 2019-11-24 16:25:26 -05:00
Andrew Kelley
f7574f44c1
add test for struct with var field 2019-11-24 15:20:15 -05:00
Andrew Kelley
44b1dc6db8
add type coercion: [:x]T to [*:x]T 2019-11-24 15:17:55 -05:00
Andrew Kelley
4c7b52503b
all tests passing 2019-11-24 02:14:21 -05:00
Andrew Kelley
f25182f46d
structs can have fields with type var
behavior tests passing now
2019-11-23 17:51:37 -05:00
Andrew Kelley
7597735bad
update the stage1 implementation to the new proposal
See #3731
2019-11-23 04:45:35 -05:00
Andrew Kelley
fd6020c4e2
update tests, better error messages, update self-hosted tokenizer 2019-11-21 20:43:41 -05:00
Andrew Kelley
47f06be369
string literals are now null terminated
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
Andrew Kelley
21f344b3b9
add null terminated pointers and arrays to self-hosted
as well as `@typeInfo` and `@Type`
2019-11-21 20:43:41 -05:00
Andrew Kelley
1aa978f32e
implement null terminated pointers 2019-11-21 20:43:41 -05:00
Andrew Kelley
9eed0d3603
add regression test case. closes #2889 2019-11-18 19:54:37 -05:00
Andrew Kelley
828abe046f
add regression test case. closes #3007 2019-11-18 19:51:49 -05:00
daurnimator
4e28d7a5f7 fix bug on empty error union 2019-11-17 22:29:49 +00:00
Vexu
6cddf9d723 properly parse anon literal in array 2019-11-17 22:24:21 +00:00
LemonBoy
a11da37734 Update discriminant value also for zero-sized unions
Fixes #3681
2019-11-14 17:07:20 +00:00
Andrew Kelley
8bae70454d
Merge pull request #3675 from Vexu/atomic-store
Add @atomicStore builtin
2019-11-13 03:06:55 +00:00
Andrew Kelley
32b37e695a
fix anonymous struct literal assigned to variable
closes #3667
2019-11-12 21:57:25 -05:00
Andrew Kelley
37318bf151
fn parameters participate in result location semantics
See #3665
2019-11-12 18:55:17 -05:00
Vexu
41914321b4
fix comptime atomicStore and add tests 2019-11-13 01:32:16 +02:00
Vexu
f0c94d95dd
use @atomicStore in std lib 2019-11-13 00:52:15 +02:00
Vexu
110ef2e528
add @atomicStore builtin 2019-11-13 00:25:44 +02:00
Vexu
7e5b234b8b
support atomic operations with enums 2019-11-12 17:13:33 +02:00
Andrew Kelley
b9482fc32d
implement fully anonymous list literals 2019-11-11 19:00:39 -05:00
Andrew Kelley
ca2a788a24
fully anonymous struct literals 2019-11-11 17:50:41 -05:00
Andrew Kelley
1bca8e693d
fix anon literal used with return result loc 2019-11-11 13:18:16 -05:00
Andrew Kelley
725b6ee634
add behavior test case for anonymous list literal syntax 2019-11-11 13:12:21 -05:00
Andrew Kelley
b4ad3e71af
add behavior test case for anon union literal 2019-11-11 13:12:21 -05:00
Andrew Kelley
5b27943498
implement anon struct literal syntax
This implements stage1 parser support for anonymous struct literal
syntax (see #685), as well as semantic analysis support for anonymous
struct literals and anonymous list literals (see #208). The semantic
analysis works when there is a type coercion in the result location;
inferring the struct type based on the values in the literal is not
implemented yet. Also remaining to do is zig fmt support for this new
syntax and documentation updates.
2019-11-11 13:11:58 -05:00
LemonBoy
d18b5f8b53 Fix initialization of union references
Fixes #3532
2019-11-09 12:20:34 -05:00
Andrew Kelley
a2acc27872
behavior tests passing 2019-11-08 15:57:25 -05:00
Andrew Kelley
8954a1bae5
more regressions fixed 2019-11-08 15:57:25 -05:00
Andrew Kelley
fa34dfcce7
fix result loc of cast not finding parent 2019-11-08 15:57:24 -05:00
Andrew Kelley
e0db54e89d
update the codebase to use @as 2019-11-08 15:57:24 -05:00
LemonBoy
528908a06e
Fix ptrCast of array references to fn
Closes #3607
2019-11-07 02:46:10 -05:00
Andrew Kelley
6ee3cabe5c
allow type coercion from *[0]T to E![]const T
This is an unambiguous, safe cast.
2019-11-06 20:44:15 -05:00
Brendan Hansknecht
c1e8fdf812 add token for parsing pointer dereference 2019-11-06 14:03:21 -05:00
Andrew Kelley
9b4a529164
fix initialization of vector in a struct field 2019-11-05 12:36:39 -05:00
Andrew Kelley
cbaa10fc3b
implement storing vector elements via runtime index 2019-11-05 12:11:57 -05:00
Andrew Kelley
70be308c43
implement loading vector elements via runtime index 2019-11-05 12:11:40 -05:00