Commit Graph

367 Commits

Author SHA1 Message Date
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
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
Andrew Kelley
55e54d98c4 runtime load vector element with comptime index 2019-11-05 12:11:16 -05:00
LemonBoy
71e209521a Mark type fields as CT
Fixes #3276
2019-11-05 12:05:01 -05:00
LemonBoy
2f740fa19f Fix cmpxchg trying to execute at CT
Fixes #3582
2019-11-04 09:54:13 +01:00
Andrew Kelley
6a15e8a7a7 add comments to disabled tests linking to the tracking issue 2019-10-30 21:29:45 -04:00
Tse
33cc204481 DragonFlyBSD support 2019-10-30 21:21:58 -04:00
LemonBoy
6f7939a452 Prevent too eager constant-folding of switch expression
A pointer was wrongly assumed to be comptime-available causing the
analysis pass to assume its initial value was constant.

Fixes #3481
2019-10-19 13:48:26 -04:00
LemonBoy
bab93e7561 Fix crash when generating constant unions with single field 2019-10-19 13:47:49 -04:00
Andrew Kelley
9050cd847a fix non-byte-aligned packed struct field...
...passed as generic fn parameter causing invalid LLVM IR.

closes #3460
2019-10-15 18:00:16 -04:00
LemonBoy
22e60df680 Propagate user-defined function alignment to LLVM IR 2019-10-13 14:19:36 +02:00
LemonBoy
6cbb732b59 Extern unions should not trigger active field check
Fixes #3378
2019-10-10 13:57:48 -04:00
Michael Dusan
3464351d1e stage1: fix ir_resolve_str() to return slice
`ir_resolve_str()` bug returns array expression even when when sliced
to a lesser length. Fix is to return array if slice.len == array.len,
otherwise return slice.

Bug report use-case is based on one builtin function. However, at least
the following builtins were exposed to the bug:

    `@byteOffsetOf`
    `@cDefine`
    `@cImport`
    `@cInclude`
    `@cUndef`
    `@compileError`
    `@embedFile`
    `@export`
    `@fieldParentPtr`
    `@hasDecl`
    `@hasField`
    `@import`
    `@unionInit`

closes #3384
2019-10-10 10:20:04 -04:00
Michael Dusan
fd94d78ffc cleanup: unused imports in test 2019-10-10 10:16:35 -04:00
Nick Erdmann
ae7392e504 unicode character literals 2019-10-07 08:18:16 +02:00
Michael Dusan
a23a022820 fix container member access for fn/struct-fn
- decls brought in via `usingnamespace` were not always found
  because lookup was performed directly against decl_table and
  use_decls was never consulted
- fix to use find_container_decl() path instead
- closes #3367
2019-10-05 14:09:09 -04:00
Andrew Kelley
bd46c1c328 RISC-V: get to the linking phase of behavior tests
See #3338 and #3339
2019-09-29 12:21:22 -04:00
LemonBoy
67bd0267db Correct calculation of padding length in struct
Make sure the resulting type is in-sync with the one produced and used
by LLVM.

Fixes #3138
2019-09-27 15:39:19 -04:00
Andrew Kelley
805f9b309b add regression test for alignment of constants
closes #1741
2019-09-27 10:58:39 -04:00
Andrew Kelley
4d65373a3d Merge pull request #3311 from LemonBoy/mips
Initial support for mipsel architecture
2019-09-26 13:44:36 -04:00
LemonBoy
2c8864f634 Don't warn about redeclaration for the same var node
Closes #3316
2019-09-26 13:39:09 -04:00
LemonBoy
dfb4446d09 Add comments about the test cases that have been disabled 2019-09-26 17:42:58 +02:00
LemonBoy
4ebcf64864 Initial support for mipsel architecture¬ 2019-09-26 09:31:55 +02:00
Michael Dusan
9983501ff2 add VarDecl support for struct-method call syntax
implements #3306
2019-09-24 19:24:48 -04:00
LemonBoy
5fb7af26ab Fix result loc unwrapping with optional in error union
Fixes #2899
2019-09-24 01:09:26 -04:00
LemonBoy
93367adaa7 Fix assignment to optional payload
Closes #3081
2019-09-24 00:31:35 -04:00