Commit Graph

3376 Commits

Author SHA1 Message Date
Andrew Kelley
cf2fe2536e better error message when null termination does not match 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
daurnimator
ed956b5812 translate-c: add support for MacroQualified definitions 2019-11-19 01:05:17 +00:00
Andrew Kelley
57b8614a5a Merge pull request #3697 from Vexu/container-docs
Implement container level doc comments
2019-11-17 22:31:12 +00:00
daurnimator
4e28d7a5f7 fix bug on empty error union 2019-11-17 22:29:49 +00:00
LemonBoy
924dd674e2 Catch invalid type from peer resolution
Fixes #3703
2019-11-17 22:25:14 +00:00
Vexu
6cddf9d723 properly parse anon literal in array 2019-11-17 22:24:21 +00:00
Vexu
977b613881 add container doc comments to generated docs 2019-11-15 15:17:59 +02:00
Vexu
e509d21f39 implemented container doc comments in stage 1 2019-11-15 15:02:51 +02:00
LemonBoy
a11da37734 Update discriminant value also for zero-sized unions
Fixes #3681
2019-11-14 17:07:20 +00:00
Andrew Kelley
d89f39d719 rework layout of struct type fields
This removes the remaining hack in the implementation of anonymous
struct literals, and they can now therefore now have greater than 16
fields/elements.
2019-11-14 03:52:39 -05:00
Andrew Kelley
f2f698a888 rework comptime struct value layout, removing 1/2 hacks
in the implementation of anonymous struct literals
2019-11-14 03:52:36 -05:00
Vexu
b83ce08a3b add compile error for @atomicRmw on enum not being an .Xchg 2019-11-13 18:48:31 +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
110ef2e528 add @atomicStore builtin 2019-11-13 00:25:44 +02:00
Andrew Kelley
e32b4829f4 Merge pull request #3670 from Vexu/atomics-enum
Support atomic operations with enums
2019-11-12 17:45:29 +00:00
Andrew Kelley
710ccacfa3 fix assertion failure in ptrToInt
found by building pluto
2019-11-12 12:21:20 -05:00
Vexu
7e5b234b8b support atomic operations with enums 2019-11-12 17:13:33 +02:00
Andrew Kelley
45d2fd9b9d fix assertion failure in init_const_undefined
found this from building my tetris game
2019-11-11 22:11:28 -05:00
Andrew Kelley
bf8870a60b fix unresolved type making it to codegen
found this trying to build oxid
2019-11-11 22:11:22 -05: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
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
Andrew Kelley
de30438ed2 stage1 parser code for anon container lit 2019-11-11 13:11:58 -05:00
Andrew Kelley
ae0a219d1f stop accepting deprecated use keyword
closes #2591
2019-11-11 13:02:39 -05:00
LemonBoy
d18b5f8b53 Fix initialization of union references
Fixes #3532
2019-11-09 12:20:34 -05:00
Andrew Kelley
3cf5c2c62b fix regressed tests and update docs to use "type coercion" 2019-11-08 15:57:25 -05:00
Andrew Kelley
3834d3dac0 passing std lib tests 2019-11-08 15:57:25 -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
2a6fbbd8fb introduce @as builtin for type coercion
This commit also hooks up type coercion (previously called implicit
casting) into the result location mechanism, and additionally hooks up
variable declarations, maintaining the property that:

    var a: T = b;

is semantically equivalent to:

    var a = @as(T, b);

See #1757
2019-11-08 15:57:24 -05:00
Shawn Landden
2e52fafac5 correctly use llvm undef in release modes 2019-11-07 02:51:04 -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
Vexu
ac6f0d245d fix NodeErrorSetDecl rendering 2019-11-06 18:15:39 -05:00
Brendan Hansknecht
c1e8fdf812 add token for parsing pointer dereference 2019-11-06 14:03:21 -05:00
Vexu
6b61fcddfa fix translate-c arrow deref 2019-11-06 13:58:55 -05:00
Andrew Kelley
9a08de93b6 fix incorrect type name on bit field pointers 2019-11-05 13:37:43 -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
Andrew Kelley
76d188551e implement store of vector element with comptime index 2019-11-05 12:11:18 -05:00
Andrew Kelley
ece8d6c2fa comptime load of vector element 2019-11-05 12:11:18 -05:00