Commit Graph

1106 Commits

Author SHA1 Message Date
Andrew Kelley
d105769926 fix regressions regarding writing through const pointers 2019-08-02 16:09:40 -04:00
Andrew Kelley
9069ee957c fix discarding function call results 2019-08-02 15:17:02 -04:00
Andrew Kelley
a5cb0f77d1 assignment participates in result location
fix one regression with optionals but there are more
2019-08-02 13:54:58 -04:00
Andrew Kelley
38b5812c48 allow 128 bit cmpxchg on x86_64 2019-08-01 02:46:37 -04:00
Andrew Kelley
af8661405b fix usingnamespace
It used to be that usingnamespace was only allowed at top level. This
made it OK to put the state inside the AST node data structure. However,
now usingnamespace can occur inside any aggregate data structure, and
therefore the state must be in the TopLevelDeclaration rather than in
the AST node.

There were two other problems with the usingnamespace implementation:

 * It was passing the wrong destination ScopeDecl, so it could cause an
   incorrect error such as "import of file outside package path".
 * When doing `usingnamespace` on a file that already had
   `pub usingnamespace` in it would "steal" the usingnamespace, causing
   incorrect "use of undeclared identifier" errors in the target file.

closes #2632
closes #2580
2019-07-19 16:56:44 -04:00
Michael Dusan
e5d032982e closes #2916 2019-07-18 16:42:56 -04:00
Andrew Kelley
9c39d5720f ir: add an assertion in phi analysis 2019-07-13 18:38:52 -04:00
Andrew Kelley
67f3bc9101 mingw: building and linking msvcrt-os.lib 2019-07-10 16:19:51 -04:00
Andrew Kelley
fc9e28ea37 std.os.getrandom does a libc version check
closes #397
2019-07-08 14:42:28 -04:00
SamTebbs33
b118806c69 Add implicit cast for *[N]T to [*c]T 2019-07-06 17:02:17 -04:00
Andrew Kelley
96fd103073 improve the error message and test coverage 2019-07-04 00:35:28 -04:00
Andrew Kelley
bfe0bf695b Merge branch 'impl-1107' of https://github.com/emekoi/zig into emekoi-impl-1107 2019-07-03 23:40:47 -04:00
emekoi
a1b952f4b0 added tests for #1107 and a note in the reference 2019-07-03 13:12:14 -05:00
Andrew Kelley
4bae87764f update @unionInit to integrate with result location semantics 2019-07-03 13:40:40 -04:00
Andrew Kelley
9da054095c Merge branch 'comptime-union-init' of https://github.com/rbscott/zig into rbscott-comptime-union-init 2019-07-03 11:26:55 -04:00
Andrew Kelley
9daf0140e5 add missing compile error for comptime continue inside runtime catch
See #2604
2019-07-02 21:14:42 -04:00
Andrew Kelley
df11512f85 fixups 2019-07-02 16:52:55 -04:00
Andrew Kelley
140335b99f Merge branch 'has-field' of https://github.com/shawnl/zig into shawnl-has-field 2019-07-02 16:21:40 -04:00
emekoi
2d85ff9465 added invalid switch prong error
added error for switch prong with different payloads and support for capturing payload on switch prongs with payloads of the same type
2019-07-01 00:27:55 -05:00
Andrew Kelley
0a0c11685f fix for with null and T peer types and inferred result location type
See #2762
2019-06-27 17:22:35 -04:00
Andrew Kelley
1b23c46138 fix switch with null and T peer types and inferred result location type
closes #2762
2019-06-27 16:54:19 -04:00
Andrew Kelley
1ccf6a2c9e compile error for using slice as array init expr type
when there are more than 0 elements.

closes #2764
2019-06-27 12:24:13 -04:00
Andrew Kelley
3085d29af8 Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-26 14:44:01 -04:00
Andrew Kelley
33f996bb16 all tests passing on linux 2019-06-26 14:00:44 -04:00
Andrew Kelley
ff737cc648 fix peer type resolution: unreachable, error set, unreachable 2019-06-26 12:31:51 -04:00
Andrew Kelley
b4e40cb59a fix peer type resolution with null 2019-06-26 00:36:24 -04:00
Andrew Kelley
fd4c5f54f0 all compile error tests passing 2019-06-25 19:03:56 -04:00
Andrew Kelley
0a77325916 fix several compile error test regressions 2019-06-25 18:06:03 -04:00
Andrew Kelley
da68aec339 fix infinite loop when error in peer resolution 2019-06-25 16:04:01 -04:00
Andrew Kelley
cb55803a59 fix implicit cast vector to array 2019-06-25 13:57:45 -04:00
Andrew Kelley
c61e0a078c fix union init with void payload
all std lib tests passing now
2019-06-25 11:31:38 -04:00
Michael Dusan
de2b0cd722 fix compile error when building zig w/ clang
errors as reported on macOS w/ Xcode 10.1, 10.2 and 11.0:

src/ir.cpp:23285:16: error: variable 'bits' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
    } else if (float_type->id == ZigTypeIdFloat)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ir.cpp:23288:13: note: uninitialized use occurs here
    switch (bits) {
            ^~~~
src/ir.cpp:23285:12: note: remove the 'if' if its condition is always true
    } else if (float_type->id == ZigTypeIdFloat)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ir.cpp:23281:18: note: initialize the variable 'bits' to silence this warning
    unsigned bits;
2019-06-24 16:25:18 -04:00
Andrew Kelley
b2cbc59e4c Merge branch 'simd2' of https://github.com/shawnl/zig into shawnl-simd2 2019-06-23 17:10:33 -04:00
Andrew Kelley
38568318a0 fix some legacy coroutine stuff 2019-06-23 00:41:11 -04:00
Andrew Kelley
7e303fa28f fix another crash 2019-06-22 19:02:59 -04:00
Andrew Kelley
86f362ce8e elide redundant safety check when switching on tagged unions 2019-06-22 16:18:42 -04:00
Shawn Landden
71e014caec stage1: add @sin @cos @exp @exp2 @ln @log2 @log10 @fabs @floor @ceil @trunc @round
and expand @sqrt

This revealed that the accuracy of ln is not as good as the current algorithm in
musl and glibc, and should be ported again.

v2: actually include tests
v3: fix reversal of in and out arguments on f128M_sqrt()
    add test for @sqrt on comptime_float
    do not include @nearbyInt() until it works on all targets.
2019-06-22 14:34:34 -05:00
Andrew Kelley
3c4b255a3c fix implicit cast fn call result to optional in field result 2019-06-22 13:37:13 -04:00
Andrew Kelley
727af307c6 fix return result loc and then switch with range...
...implicit casted to error union
2019-06-21 18:21:12 -04:00
Andrew Kelley
ff6d563b04 fix implicit cast to optional to error union to return result loc 2019-06-21 17:49:54 -04:00
Andrew Kelley
5441f77672 fix implicit cast bitcast result to error union by returning 2019-06-21 16:54:46 -04:00
Andrew Kelley
48ccf427af fix nested orelse and nested catch 2019-06-21 14:06:01 -04:00
Andrew Kelley
4299cd4446 blocks have result location semantics 2019-06-21 13:16:55 -04:00
Andrew Kelley
4f21dc8a80 fix regression with zero sized array
thanks mikdusan!
2019-06-21 00:58:18 -04:00
Andrew Kelley
0498bd40d9 fix loops with multiple break statements 2019-06-20 22:38:40 -04:00
Andrew Kelley
237233b04b fix coroutines 2019-06-20 18:27:04 -04:00
Andrew Kelley
057b105fad one more test passing 2019-06-20 18:03:55 -04:00
Andrew Kelley
3c541d7be3 fix peer result loc fn call with comptime condition 2019-06-19 23:52:51 -04:00
Andrew Kelley
6217b401f9 fix labeled break inside comptime if inside runtime if 2019-06-19 23:39:49 -04:00
Andrew Kelley
78eeb6e9ae fix double getelementptr of runtime global 2019-06-19 22:29:39 -04:00