Commit Graph

1189 Commits

Author SHA1 Message Date
Andrew Kelley db50cf7049 fix more compile error regressions 2019-08-26 22:38:45 -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 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 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 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 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
Jonathan Marler 9322eee80a Encapsulate bigint representation, assert on cast data loss 2019-08-23 11:14:08 -04:00
Andrew Kelley 79a4b7a236 fix regressions 2019-08-22 18:24:15 -04:00
Andrew Kelley 26b79ac90e simple self-referential struct is working now 2019-08-22 14:46:26 -04:00
Andrew Kelley 0d6a6c76ea add missing "referenced here" notes for lazy values 2019-08-22 12:56:35 -04:00
Andrew Kelley 8460d5617c introduce lazy values
see #2174
2019-08-22 12:08:04 -04:00
Andrew Kelley efdbede7ab breaking: remove field alignment kludge
This breaks behavior tests as well as compile error notes for generic
function calls. However it introduces better circular dependency compile
errors.

The next step is to add Lazy Values to fix the regressions.
2019-08-21 19:27:51 -04:00
Timon Kruiper 2addec8ea1 compiler error when variable in asm template cannot be found 2019-08-20 14:11:03 -04:00
Andrew Kelley 3dbed54294 fix @bitCast of packed struct literal
closes #3042
2019-08-19 17:50:37 -04:00
Andrew Kelley 6bc520ab95 solve it a slightly different way
the error handling of result locations is a bit awkward but it should
basically be the same everywhere
2019-08-19 17:35:19 -04:00
Michael Dusan 24deb1a7fe fix @bitCast segfault with literal array param
closes #3010
2019-08-19 17:24:14 -04:00
Andrew Kelley d067a037cc fix void array as a local variable initializer
Related: #1767
2019-08-19 15:58:31 -04:00
Andrew Kelley 44fb5275c1 fix array multiplication not setting parent value info
closes #3095
2019-08-19 14:46:12 -04:00
Nick Erdmann 5a0275c247 fix error message when dependency requires position independent code 2019-08-18 19:33:25 -04:00
Andrew Kelley 57b90d2d98 allow implicit cast of fn to async fn
it forces the fn to be async. closes #3079
2019-08-17 17:22:20 -04:00
Andrew Kelley 66a490c27c detect non-async function pointer of inferred async function
closes #3075
2019-08-17 16:49:23 -04:00
Vexu 0ff396c34f add compile error for incorrect atomic ordering in fence #3082 2019-08-17 16:05:41 -04:00
Andrew Kelley 4d8a6f6fea fix compiler not checking alignment of function frames
closes #3086
2019-08-17 13:04:50 -04:00
Andrew Kelley bf7b6fbbdb add missing compile error for fn call bad implicit cast
when the function's return type handle is a pointer but the result
location's result value type handle is not a pointer

closes #3055
2019-08-16 16:30:24 -04:00
Andrew Kelley 5a2cbe239f fix and test case for returning from suspend block
See #3063
2019-08-16 13:07:07 -04:00
Andrew Kelley 13c584d325 add compile error for casting const frame to anyframe
See #3063
2019-08-16 11:38:41 -04:00
Andrew Kelley 1254a453b9 add compile error for @Frame() of generic function
See #3063
2019-08-16 10:44:51 -04:00
Andrew Kelley 55f5cee86b fix error return traces for async calls of blocking functions 2019-08-15 15:06:05 -04:00
Andrew Kelley 13b5a4bf8c remove cancel 2019-08-15 14:05:12 -04:00
Andrew Kelley 5092634103 avoid the word "coroutine", they're "async functions" 2019-08-13 14:14:19 -04:00
Andrew Kelley 8a9289996a Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-13 11:39:32 -04:00
Andrew Kelley 4d8d513e16 all tests passing 2019-08-11 19:53:10 -04:00
Andrew Kelley af8c6ccb4b fix canceling async functions which have error return tracing 2019-08-11 14:26:34 -04:00
Andrew Kelley b87686dfa0 fix enum with one member and custom tag type 2019-08-11 13:43:44 -04:00
Andrew Kelley 1b83ee78a4 allow comptime_int to implicit cast to comptime_float 2019-08-11 12:01:02 -04:00
Andrew Kelley 22428a7546 fix try in an async function with error union and non-zero-bit payload 2019-08-10 15:20:08 -04:00
Andrew Kelley b9d1d45dfd fix combining try with errdefer cancel 2019-08-09 21:49:40 -04:00
Andrew Kelley 2e7f53f1f0 fix cancel inside an errdefer 2019-08-09 17:34:06 -04:00