Commit Graph

185 Commits

Author SHA1 Message Date
Andrew Kelley
1d8b8ad687
add compile error for using outer scoped runtime variables
from a fn defined inside it. closes #876
2018-09-05 20:32:06 -04:00
Andrew Kelley
1f5c7ff4d7
stage1: rename VariableTableEntry to ZigVar 2018-09-05 18:35:57 -04:00
Andrew Kelley
3500d32db5
stage1: rename FnTableEntry to ZigFn 2018-09-05 18:34:33 -04:00
Andrew Kelley
db882e5d63
stage1: rename TypeTableEntry to ZigType 2018-09-05 18:33:07 -04:00
Andrew Kelley
68db9d5074
add compile error for comptime control flow inside runtime block
closes #834
2018-09-04 15:28:35 -04:00
Andrew Kelley
ac36f98e72 fix stack traces on linux 2018-08-25 03:07:37 -04:00
Andrew Kelley
e9a03cccf3 all integer sizes are available as primitives
* fix wrong implicit cast for `@IntType` bit_count parameter.
 * fix incorrect docs for `@IntType` bit_count parameter.

closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
1cf7511dc9 add compile error notes for where struct definitions are
closes #1202
2018-07-06 16:20:46 -04:00
Andrew Kelley
af95e15572 rename get_maybe_type to get_optional_type 2018-06-26 15:11:05 -04:00
Jimmi HC
bf3d1c1aab Allow access of array.len through a pointer 2018-06-08 09:21:31 +02:00
Andrew Kelley
e53b683bd3
Pointer Reform: proper slicing and indexing (#1053)
* enable slicing for single-item ptr to arrays
 * disable slicing for other single-item pointers
 * enable indexing for single-item ptr to arrays
 * disable indexing for other single-item pointers

see #770
closes #386
2018-06-04 22:11:14 -04:00
Andrew Kelley
96164ce613 disallow single-item pointer indexing
add pointer arithmetic for unknown length pointer
2018-06-04 01:39:57 -04:00
Jimmi HC
1b3aaacba2 Removed copy-pasted resolve_inferred_error_set
both ir.cpp and analyze.cpp have a function resolve_inferred_error_set,
which is a nearly exact copy-paste. This commit removes the one in ir.cpp
and exposes then one in analyze.cpp. This also allows us to make
analyze_fn_body local to analyze.cpp, as it is not used anywhere in
ir.cpp after this change
2018-05-30 10:34:20 +02:00
Jimmi HC
9b29c872ce Added Slice as it's own type info in userland 2018-05-09 09:34:04 +02:00
Andrew Kelley
06909ceaab support break in suspend blocks
* you can label suspend blocks
 * labeled break supports suspend blocks

See #803
2018-04-18 22:21:54 -04:00
Andrew Kelley
aa2995ee39 fix invalid codegen for error return traces across suspend points
See #821

Now the code works correctly, but error return traces are missing
the frames from coroutines.
2018-03-24 22:07:12 -04:00
Andrew Kelley
bcce77700f some return types disqualify comptime fn call caching
closes #828
2018-03-12 12:56:25 -04:00
Andrew Kelley
84e952c230 fix await multithreaded data race
coro return was reading from a value that coro await was
writing to. that wasn't how it was designed to work, it
was an implementation mistake.

this commit also has some work-in-progress code for fixing
error return traces across suspend points.
2018-03-10 01:38:40 -05:00
Andrew Kelley
6db9be8900 don't memoize comptime functions if they can mutate state via parameters
closes #639
2018-03-09 14:20:44 -05:00
Andrew Kelley
07e47c058c ptrCast builtin now gives an error for removing const qualifier
closes #384
2018-03-06 16:37:03 -05:00
Andrew Kelley
253d988e7c implementation of await
but it has bugs
2018-03-01 03:28:13 -05:00
Andrew Kelley
026aebf2ea another workaround for llvm coroutines
this one doesn't work either
2018-02-28 04:01:22 -05:00
Andrew Kelley
9f6c5a20de codegen for coro_id instruction
See #727
2018-02-25 15:10:29 -05:00
Andrew Kelley
99985ad6fc implement Zig IR for async functions
See #727
2018-02-23 03:03:06 -05:00
Andrew Kelley
236bbe1183 implement IR analysis for async function calls
See #727
2018-02-21 00:52:20 -05:00
Andrew Kelley
65a51b401c add promise type
See #727
2018-02-20 16:42:14 -05:00
Andrew Kelley
21ce559c9c add --forbid-library
to help track down accidentally linking against a library
2018-02-04 22:06:03 -05:00
Andrew Kelley
ef5e7bb469 *WIP* error sets - an inferred error set can end up being the global one 2018-02-03 14:06:37 -05:00
Andrew Kelley
39d5f44863 *WI* error sets - basic support working 2018-02-02 14:26:14 -05:00
Andrew Kelley
cfb2c67692 *WIP* error sets - rewrite "const cast only" function 2018-02-02 11:50:19 -05:00
Andrew Kelley
13b36d458f *WIP* error sets - fix implicit cast 2018-02-01 10:23:25 -05:00
Andrew Kelley
5161d70620 *WIP* error sets 2018-01-31 01:51:31 -05:00
Andrew Kelley
3ef6a00bb8 add compile error for duplicate struct, enum, union fields
closes #730
2018-01-30 11:52:03 -05:00
Andrew Kelley
32ea6f54e5 *WIP* proof of concept error return traces 2018-01-12 02:12:11 -05:00
Andrew Kelley
7ec783876a functions which can return errors have secret stack trace param
See #651
2018-01-11 23:04:08 -05:00
Andrew Kelley
27ba4f0baf export keyword works again 2017-12-19 01:49:42 -05:00
Andrew Kelley
1fdebc1dc4 wip export rewrite 2017-12-18 09:59:57 -05:00
Andrew Kelley
3577a80bb6 translate-c: more complex logic for translating a C cast in a macro 2017-12-08 12:28:21 -05:00
Andrew Kelley
0ad1239522 rework enums and unions and their relationship to each other
* @enumTagName renamed to @tagName and it works on enums and
   union-enums
 * Remove the EnumTag type. Now there is only enum and union,
   and the tag type of a union is always an enum.
 * unions support specifying the tag enum type, and they support
   inferring an enum tag type.
 * Enums no longer support field types but they do support
   setting the tag values. Likewise union-enums when inferring
   an enum tag type support setting the tag values.
 * It is now an error for enums and unions to have 0 fields.
 * switch statements support union-enums

closes #618
2017-12-03 20:43:56 -05:00
Andrew Kelley
137c8f5e8a ability to set tag values of enums
also remove support for enums with 0 values

closes #305
2017-12-02 22:32:39 -05:00
Andrew Kelley
f276fd0f37 basic union support
See #144
2017-11-15 13:04:18 -05:00
Andrew Kelley
c6295fe9ab remove zigrt
adds test case for #394

partially reverts a32b5929cc
2017-09-30 20:21:57 -04:00
Andrew Kelley
816689a3b1 ptrCast gives compile error for increasing alignment
See #37
2017-08-29 16:52:31 -04:00
Andrew Kelley
c5c9d98065 introduce align keyword
* remove `@setGlobalAlign`
 * add align keyword for setting alignment on functions and
   variables.
 * loads and stores use alignment from pointer
 * memcpy, memset use alignment from pointer
 * add syntax for pointer alignment
 * slices can have volatile
 * add u2, i2 primitives
 * ignore preferred align and use abi align everywhere
 * back to only having alignOf builtin.
   preferredAlignOf is too tricky to be useful.
   See #432. Partial revert of
   e726925e80.

See #37
2017-08-29 07:51:34 -04:00
Andrew Kelley
d1e68c3ca8 better bigint/bigfloat implementation 2017-07-08 17:59:10 -04:00
Andrew Kelley
6a93dda3e1 progress toward windows hello world working 2017-06-14 00:04:34 -04:00
Andrew Kelley
e5b90651ba compileError builtin includes "referenced by" notes
to help track down the cause

closes #278
2017-06-03 15:09:40 -04:00
Andrew Kelley
2dfb1ebee2 const global values can reference each other
Before, if you did something like:

```
const hi1 = "hi";
const hi2 = hi1;
```

This would create the "hi" data twice in the built object.
But since the value is const we don't have to duplicate the
data, now we take advantage of this fact.

closes #336
2017-05-27 00:54:14 -04:00
Andrew Kelley
d6b01931ef implicitly cast by value var args parameters to const references
See #336
2017-05-26 16:44:13 -04:00
Andrew Kelley
fcdd808c5c fix segfault with array of variadic functions
closes #377
2017-05-25 13:48:10 -04:00