Commit Graph

3094 Commits

Author SHA1 Message Date
Andrew Kelley
ab4cba14c8 fix recursive call of await @asyncCall with struct return type 2019-09-02 14:35:41 -04:00
Andrew Kelley
d291d3c8c0 fix using @typeOf on a generic function call 2019-09-02 13:07:44 -04:00
Andrew Kelley
0fe28855c5 add ability to specify darwin framework search dirs 2019-09-02 11:48:06 -04:00
Andrew Kelley
8b1900e5df Revert "Merge pull request #2991 from emekoi/mingw-ci"
This reverts commit ec7d7a5b14, reversing
changes made to 81c441f885.

It looks like this broke colors in Windows Command Prompt (#3147)
and this method of detecting native C ABI isn't working well (#3121).
2019-09-01 00:33:02 -04:00
Andrew Kelley
ec6f15b0f5 fix @typeOf an async function call of generic fn with error union type 2019-09-01 00:27:22 -04:00
Michael Dusan
1f99899408 stage1 enhance IR print
- pass2 now prints missing instructions in a trailing fashion
- instruction struct name added to print as column 2
2019-08-31 22:42:58 -04:00
Andrew Kelley
5c3a9a1a3e improvements to @asyncCall
* `await @asyncCall` generates better code. See #3065
 * `@asyncCall` works with a real `@Frame(func)` in addition to
   a byte slice. Closes #3072
 * `@asyncCall` allows passing `{}` (a void value) as the result
   pointer, which uses the result location inside the frame.
   Closes #3068
 * support `await @asyncCall` on a non-async function. This is in
   preparation for safe recursion (#1006).
2019-08-31 18:50:16 -04:00
Andrew Kelley
a223063923 @typeOf now guarantees no runtime side effects
related: #1627
2019-08-31 11:00:31 -04:00
Andrew Kelley
6ab8b2aab4 support recursive async and non-async functions
which heap allocate their own frames

related: #1006
2019-08-30 20:06:02 -04:00
Andrew Kelley
d9fed5cdfd align(@alignOf(T)) T does not force resolution of T 2019-08-30 14:53:44 -04:00
Michael Dusan
966670645a fix stage1 to build on macOS + xcode/clang 2019-08-30 09:01:29 -04:00
Andrew Kelley
e9a4bcbcc6 fix regressions 2019-08-29 22:44:07 -04:00
Andrew Kelley
03910925f0 await does not force async if callee is blocking
closes #3067
2019-08-29 21:51:37 -04:00
Andrew Kelley
8e93991634 avoid unnecessarily requiring alignment for array elem pointers 2019-08-29 16:25:58 -04:00
Andrew Kelley
0512beca9d comparing against zero participates in lazy values 2019-08-29 14:46:22 -04:00
Andrew Kelley
d9f0446b1f make @sizeOf lazy 2019-08-29 12:43:56 -04:00
Andrew Kelley
94bbb46ca6 fix not fully resolving debug info for structs causing llvm error 2019-08-29 10:29:48 -04:00
Andrew Kelley
af90da1531 fix implicit cast from zero sized array ptr to slice
closes #1850
2019-08-28 12:16:52 -04:00
Andrew Kelley
7139eef4cf implement lazy values for error union types
closes #3129
2019-08-28 11:17:20 -04:00
Andrew Kelley
f4519c520a support self-referential struct through a slice of optional
by making optionals even more lazy

closes #1805
2019-08-27 16:55:58 -04:00
Andrew Kelley
428a2fdedd better handle struct depends on itself via optional field
closes #1995
2019-08-27 13:59:18 -04:00
Andrew Kelley
35a374efe0 Merge pull request #3115 from ziglang/fix-field-alignment-kludge
fix field alignment kludge by implementing lazy values
2019-08-27 13:02:31 -04:00
Andrew Kelley
d9ed55f017 fix not properly casting align values
and add check for alignment specified on enum fields
2019-08-27 12:54:50 -04:00
Andrew Kelley
7d34e55a71 add a TODO compile error for union field alignment syntax
See #3125
2019-08-27 10:45:28 -04:00
Andrew Kelley
ffac0b02e7 implement and test struct field explicit alignment 2019-08-27 10:14:11 -04:00
Andrew Kelley
a2e8ef77e2 fix regression in one of the doc examples 2019-08-26 22:50:12 -04:00
Andrew Kelley
db50cf7049 fix more compile error regressions 2019-08-26 22:38:45 -04:00
Andrew Kelley
1df75da918 remove no longer needed gcc8 workaround. add gcc9 workaround
Occasionally LLVM headers generate warnings with newer gcc versions and
since we use -Werror this has to be worked around.
2019-08-26 21:40:44 -04:00
Andrew Kelley
bad4b040cc miscellaneous fixes regarding compile errors 2019-08-26 18:35:36 -04:00
Andrew Kelley
ca145a6d5a fix regression in ir_get_ref 2019-08-26 15:43:39 -04:00
Andrew Kelley
ae65c236c5 fix regression with global variable assignment...
...with optional unwrapping with var initialized to undefined
2019-08-26 15:24:24 -04:00
Andrew Kelley
d316f70450 fix regression on struct field with undefined type 2019-08-26 14:01:59 -04:00
Andrew Kelley
73a7747a9c fix some compile error regressions 2019-08-26 12:43:36 -04:00
Andrew Kelley
6569bfc85e fix some std lib dependency loops 2019-08-26 11:23:25 -04:00
Andrew Kelley
e1a4bcbdfd fix dependency loop errors with zig build 2019-08-26 10:43:07 -04:00
Andrew Kelley
ede0c22a67 make @alignOf lazily evaluate the target type
this case works now:

```zig
const Foo = struct {
    field: Bar(@alignOf(*Foo)),
};
fn Bar(comptime alignment: u29) type {
    return struct {
        field: *align(alignment) Foo,
    };
}
```
2019-08-26 10:03:30 -04:00
Andrew Kelley
b13af0750f fix assertion tripped instead of reporting compile error 2019-08-25 21:45:11 -04:00
Andrew Kelley
720302a640 fix resolution detection of pointer types 2019-08-25 21:28:16 -04:00
Andrew Kelley
a7f3158185 behavior tests passing 2019-08-25 21:16:03 -04:00
Andrew Kelley
64e9b0ee46 make the zero-bit-ness of pointers lazy
this case works now:

```zig
const Foo = struct {
    field: @typeOf(func).ReturnType,
};
fn func(self: *Foo) void {}
```
2019-08-25 20:27:56 -04:00
Andrew Kelley
8f41da2216 fix behavior test regressions with unions 2019-08-25 11:42:19 -04:00
Andrew Kelley
fa6c20a02d hook up unions with lazy values
this case works now:

```zig
const Expr = union(enum) {
    Literal: u8,
    Question: *Expr,
};
```
2019-08-25 11:34:07 -04:00
Andrew Kelley
e8bad1e12a fix regression on @ptrCast
this case regressed and now fixed:

```zig
const a: ?*i32 = undefined;
const b: ?*f32 = @ptrCast(?*f32, a);
```
2019-08-23 17:39:56 -04:00
Andrew Kelley
101440c199 add lazy value support for optional types
this case works now:

```zig
const Node = struct {
    node: ?*Node,
};
```
2019-08-23 17:14:51 -04:00
Andrew Kelley
f0034495fa fix regression with simple pointer to self 2019-08-23 15:59:37 -04:00
Andrew Kelley
ac4dd9d665 better handling of lazy structs
this case works now:

```zig
const A = struct {
    b_list_pointer: *const []B,
};
const B = struct {
    a_pointer: *const A,
};

const b_list: []B = [_]B{};
const a = A{ .b_list_pointer = &b_list };
const obj = B{ .a_pointer = &a };
```
2019-08-23 15:54:51 -04:00
Andrew Kelley
be0a9a7277 pointer types lazily evaluate their element type 2019-08-23 15:05:15 -04:00
Andrew Kelley
1dd658d1d0 allow top level declarations to be lazy
this case now works:

```zig
const A = struct {
    b: B,
};
const B = fn (A) void;
```
2019-08-23 14:07:34 -04:00
Andrew Kelley
20049caaba add lazy value for fn prototypes
this case now works:

```zig
const Node = struct {
    field: fn (*Node) *Node,
};
```
2019-08-23 13:28:26 -04:00
Andrew Kelley
3865b6ad8f Merge remote-tracking branch 'origin/master' into fix-field-alignment-kludge 2019-08-23 11:43:37 -04:00