Andrew Kelley
8503eff8c1
add compile error for invalid deref on switch target
...
closes #945
2018-04-22 23:46:55 -04:00
Andrew Kelley
c4840d78fb
add test case for #936
2018-04-21 02:10:22 -04: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
f1f998e071
improve cmpxchg
...
* remove @cmpxchg, add @cmpxchgWeak and @cmpxchgStrong
- See explanations in the langref.
* add operand type as first parameter
* return type is ?T where T is the operand type
closes #461
2018-04-18 12:16:42 -04:00
Andrew Kelley
373b3586a1
inline functions must be stored in const or comptime var
...
closes #913
2018-04-12 16:26:23 -04:00
Andrew Kelley
e48e707c32
allow integer and float literals to be passed to var params
...
closes #623
2018-04-11 14:47:37 -04:00
Andrew Kelley
6cb99fdac3
fix crash when compile error in analyzing @panic call
2018-03-27 15:07:45 -04:00
Andrew Kelley
f885a1ab61
change async function call syntax
...
* instead of `async(allocator) call()`, now it is
`async<allocator> call()`.
* Fixes syntax ambiguity when leaving off the allocator
* Fixes parse failure when call is a field access
This sets a precedent for using `<` to pass arguments
to a keyword. This will affect `enum`, `union`, and
`fn` (see #661 )
2018-03-21 19:56:41 -04:00
Andrew Kelley
efebb6d341
fix tests broken by previous commit
2018-03-14 03:37:54 -04:00
Andrea Orru
c828c23f71
Tests for zero-bit field compiler error
2018-03-13 22:07:40 -07:00
Andrew Kelley
790aaeacae
add compile error for using @tagName on extern union
...
closes #742
2018-03-07 14:35:48 -05:00
Andrew Kelley
d96dd5bc32
fix missing compile error for returning error from void async function
...
closes #799
2018-03-06 21:44:27 -05:00
Andrew Kelley
eff3530dfa
var is no longer a pseudo-type, it is syntax
...
closes #779
2018-03-06 18:31:31 -05:00
Andrew Kelley
5d5820029d
fix broken tests from previous commit
2018-03-06 16:46:45 -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
Ben Noordhuis
90598b4631
fix assert on self-referencing function ptr field
...
The construct `struct S { f: fn(S) void }` is not legal because structs
are not copyable but it should not result in an ICE.
Fixes #795 .
2018-02-28 00:56:00 +01:00
Andrew Kelley
72ca2b214d
ability to slice an undefined pointer at compile time if the len is 0
2018-02-16 15:22:29 -05:00
Andrew Kelley
9fa35adbd4
fix sometimes not type checking function parameters
...
closes #774
regression introduced in cfb2c67692
2018-02-14 16:24:43 -05:00
Andrew Kelley
e7bf8f3f04
fix compiler crash switching on global error with no else
2018-02-09 13:49:58 -05:00
Andrew Kelley
916d24cd21
add compile error tests for error sets
2018-02-08 23:44:21 -05:00
Andrew Kelley
54c06bf715
error sets: runtime safety for int-to-err and err set cast
2018-02-08 21:54:44 -05:00
Andrew Kelley
f9be970375
Merge remote-tracking branch 'origin/master' into error-sets
2018-02-08 20:45:26 -05:00
Andrew Kelley
0d5ff6f462
error sets - most tests passing
2018-02-08 02:08:45 -05:00
Andrew Kelley
44d8d654a0
fix test failure, organize code, add new compile error
2018-02-05 09:26:39 -05:00
Andrew Kelley
5f518dbeb9
*WIP* error sets converting std lib
2018-01-31 22:48:40 -05:00
Andrew Kelley
44f38b04b0
fix assertion fail when using global var number literal
...
closes #697
2018-01-31 11:13:39 -05:00
Andrew Kelley
40ca39d3d5
fix error message mentioning unreachable instead of noreturn
2018-01-31 01:44:52 -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
1c60f31450
add compile error for calling naked function
2018-01-29 14:01:12 -05:00
Andrew Kelley
abe6c2d585
allow packed containers in extern functions
2018-01-29 10:57:09 -05:00
Andrew Kelley
ad3e2a5da0
fix compiler crash on function with invalid return type
...
closes #722
2018-01-26 10:37:18 -05:00
Andrew Kelley
3671582c15
syntax: functions require return type. remove ->
...
The purpose of this is:
* Only one way to do things
* Changing a function with void return type to return a possible
error becomes a 1 character change, subtly encouraging
people to use errors.
See #632
Here are some imperfect sed commands for performing this update:
remove arrow:
```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```
add void:
```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```
Some cleanup may be necessary, but this should do the bulk of the work.
2018-01-25 04:10:11 -05:00
Andrew Kelley
e5bc5873d7
rename "debug safety" to "runtime safety"
...
closes #437
2018-01-25 01:46:12 -05:00
Andrew Kelley
cf39819478
add new kind of test: generating .h files. and more
...
* docgen supports obj_err code kind for demonstrating
errors without explicit test cases
* add documentation for `extern enum`. See #367
* remove coldcc keyword and add @setIsCold. See #661
* add compile errors for non-extern struct, enum, unions
in function signatures
* add .h file generation for extern struct, enum, unions
2018-01-22 22:24:07 -05:00
Andrew Kelley
5b7ae86af4
fix crash when switching on enum with 1 field and no switch prongs
...
closes #712
2018-01-21 14:44:24 -05:00
Andrew Kelley
ea623f2d39
all doc code examples are now tested
...
improve color scheme of docs
make docs depend on no external files
fix broken example code in docs
closes #465
2018-01-19 03:21:47 -05:00
Andrew Kelley
4b64c777ee
add compile error for shifting by negative comptime integer
...
closes #698
2018-01-18 17:47:21 -05:00
Andrew Kelley
0fc645ab70
emit a compile error for @panic called at compile time
...
closes #706
2018-01-18 17:15:36 -05:00
Andrew Kelley
7b57454cc1
clean up error return tracing
...
* error return tracing is disabled in release-fast mode
* add @errorReturnTrace
* zig build API changes build return type from `void` to `%void`
* allow `void`, `noreturn`, and `u8` from main. closes #535
2018-01-15 00:01:02 -05:00
Andrew Kelley
3c094116aa
remove %% prefix operator
...
See #632
closes #545
closes #510
this makes #651 higher priority
2018-01-09 00:51:51 -05:00
Andrew Kelley
632d143bff
replace a %% b
with a catch b
...
See #632
better fits the convention of using keywords for control flow
2018-01-07 17:28:20 -05:00
Andrew Kelley
66717db735
replace %return
with try
...
See #632
better fits the convention of using keywords for control flow
2018-01-07 16:53:13 -05:00
Andrew Kelley
bb39e503c0
fix struct inside function referencing local const
...
closes #672
the crash and compile errors are fixed but structs
inside functions still get named after the functions
they're in. this will be fixed later.
2018-01-07 00:28:37 -05:00
Andrew Kelley
d917815d81
explicitly return from blocks
...
instead of last statement being expression value
closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley
8bc523219c
add labeled loops, labeled break, labeled continue. remove goto
...
closes #346
closes #630
regression: translate-c can no longer translate switch statements.
after #629 we can ressurect and modify the code to utilize arbitrarily
returning from blocks.
2017-12-20 23:00:19 -05:00
Andrew Kelley
1cc450e6e7
fix assert when wrapping zero bit type in nullable
...
closes #659
2017-12-19 18:21:42 -05:00
Andrew Kelley
9d9201c3b4
bring back code that uses export and fix tests
...
partial revert of 1fdebc1dc4
2017-12-19 02:39:43 -05:00
Andrew Kelley
1fdebc1dc4
wip export rewrite
2017-12-18 09:59:57 -05:00
Andrew Kelley
960914a073
add implicit cast from enum to union
...
when the enum is the tag type of the union and is comptime known
to be of a void field of the union
See #642
2017-12-05 20:46:58 -05:00
Andrew Kelley
63a2f9a8b2
fix casting integer literal to enum
2017-12-05 18:09:22 -05:00