Commit Graph

31 Commits (717ac85a5acb5e6ae063c4d0eb3b8f1bd260776a)

Author SHA1 Message Date
Andrew Kelley 0c16cd2d0e run zig fmt on the codebase
See #1003
2018-05-29 04:23:38 -04:00
Andrew Kelley 6928badd85 Merge branch 'master' into pointer-reform 2018-05-09 23:43:07 -04:00
Jimmi Holst Christensen aa2586de18 Fixed extern enums having the wrong size (#970)
Fixed extern enums having the wrong size

See #977
2018-05-03 22:27:04 -04:00
Andrew Kelley a35b366eb6 [breaking] delete ptr deref prefix op
start using zig-fmt-pointer-reform branch build of zig fmt
to fix code to use the new syntax

all of test/cases/* are processed, but there are more left
to be done - all the std lib used by the behavior tests
2018-04-30 20:35:54 -04:00
Andrew Kelley 028ec0f2c3 enums with 1 field and explicit tag type still get the tag type
closes #820
2018-03-08 15:22:42 -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 5b156031e9 enum tag values are expressions so no parentheses needed 2018-01-03 16:05: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 f464fe14f4 switch on enum which only has 1 field is comptime known
closes #593
2017-12-05 22:26:17 -05:00
Andrew Kelley bb6b4f8db2 fix enum with 1 member causing segfault
closes #647
2017-12-05 22:15:33 -05:00
Andrew Kelley 63a2f9a8b2 fix casting integer literal to enum 2017-12-05 18:09:22 -05:00
Andrew Kelley 5a8367e892 rename @EnumTagType to @TagType. add tests for union-enums
See #618
2017-12-03 22:36:01 -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 98237f7c0b casting between integer and enum only works via tag type
See #305
2017-12-02 17:12:37 -05:00
Andrew Kelley 264c86853b packed structs can have enums with explicit tag types
See #305
2017-12-01 00:34:29 -05:00
Andrew Kelley b62e2fd870 ability to specify tag type of enums
see #305
2017-11-30 22:08:11 -05:00
Andrew Kelley 4f8c26d2c6 fix enum sizes too large
closes #598
2017-11-08 21:44:10 -05:00
Andrew Kelley 6f250f568a workaround llvm bug for windows alignment
See #302
2017-09-30 23:42:44 -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 40feecb3e4 fixups from previous commit
See #396
2017-08-26 13:51:51 -04:00
scurest 5bc877017e use most_aligned_member+padding to represent enum unions 2017-08-26 13:48:16 -04:00
Andrew Kelley 68add5d828 clean up behavior test names 2017-05-23 21:38:31 -04:00
Andrew Kelley 095591f0b0 add enumTagName builtin function
closes #299
2017-04-08 17:45:22 -04:00
Andrew Kelley 451ce09067 new unreachable syntax
* `noreturn` is the primitive type.
 * `unreachable` is a control flow keyword.
 * `@unreachable()` builtin function is deleted.

closes #214
2017-03-26 04:58:48 -04:00
Andrew Kelley 7c53230a61 introduce copyable concept
closes #103
2017-03-26 03:39:18 -04:00
Andrew Kelley af536ac343 introduce new test syntax
* remove setFnTest builtin
 * add test "name" { ... } syntax
 * remove --check-unused argument. functions are always lazy now.
2017-03-16 16:02:35 -04:00
Andrew Kelley 3b5e26b7f7 self hosted tests import std library 2017-01-05 03:57:48 -05:00
Andrew Kelley 66a83d8738 IR: pass intToEnum test 2016-12-26 16:34:18 -05:00
Andrew Kelley aee7ad3de2 IR: port all passing tests over 2016-12-26 03:44:59 -05:00
Andrew Kelley 6c9ec3688e IR testing: rename cases3 dir to cases 2016-12-26 02:49:30 -05:00