aboutsummaryrefslogtreecommitdiff
path: root/test/cases/union.zig
AgeCommit message (Collapse)Author
2019-01-29backport copy elision changesAndrew Kelley
This commit contains everything from the copy-elision-2 branch that does not have to do with copy elision directly, but is generally useful for master branch. * All const values know their parents, when applicable, not just structs and unions. * Null pointers in const values are represented explicitly, rather than as a HardCodedAddr value of 0. * Rename "maybe" to "optional" in various code locations. * Separate DeclVarSrc and DeclVarGen * Separate PtrCastSrc and PtrCastGen * Separate CmpxchgSrc and CmpxchgGen * Represent optional error set as an integer, using the 0 value. In a const value, it uses nullptr. * Introduce type_has_one_possible_value and use it where applicable. * Fix debug builds not setting memory to 0xaa when storing undefined. * Separate the type of a variable from the const value of a variable. * Use copy_const_val where appropriate. * Rearrange structs to pack data more efficiently. * Move test/cases/* to test/behavior/* * Use `std.debug.assertOrPanic` in behavior tests instead of `std.debug.assert`. * Fix outdated slice syntax in docs.
2018-11-13New Zig formal grammar (#1685)Jimmi Holst Christensen
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-10-15remove implicit cast from T to *const TAndrew Kelley
closes #1465
2018-10-15Solve the return type ambiguity (#1628)Jimmi Holst Christensen
Changed container and initializer syntax * <container> { ... } -> <container> . { ... } * <exrp> { ... } -> <expr> . { ...}
2018-09-13fix tagged union with only 1 field tripping assertionAndrew Kelley
closes #1495 now the tag type of an enum with only 1 item is comptime_int.
2018-09-05stage1: fix tagged union with no payloadsAndrew Kelley
closes #1478
2018-08-03fix tagged union initialization with a runtime voidAndrew Kelley
closes #1328
2018-06-19remove enum to/from int casting syntax; add `@enumToInt`/`@intToEnum`Andrew Kelley
see #1061
2018-05-31use * for pointer type instead of &Andrew Kelley
See #770 To help automatically translate code, see the zig-fmt-pointer-reform-2 branch. This will convert all & into *. Due to the syntax ambiguity (which is why we are making this change), even address-of & will turn into *, so you'll have to manually fix thes instances. You will be guaranteed to get compile errors for them - expected 'type', found 'foo'
2018-05-29run zig fmt on the codebaseAndrew Kelley
See #1003
2018-05-09Merge branch 'master' into pointer-reformAndrew Kelley
2018-05-07tagged union field access prioritizes members over enum tagsAndrew Kelley
closes #959
2018-05-01Added tests.Alexandros Naskos
2018-04-30[breaking] delete ptr deref prefix opAndrew Kelley
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-02-02*WI* error sets - basic support workingAndrew Kelley
2018-01-25syntax: functions require return type. remove `->`Andrew Kelley
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-22fix crash on union-enums with only 1 fieldAndrew Kelley
closes #713
2018-01-09remove %% prefix operatorAndrew Kelley
See #632 closes #545 closes #510 this makes #651 higher priority
2017-12-24fix segfault when passing union enum with sub byte...Andrew Kelley
...field to const slice parameter we use a packed struct internally to represent a const array of disparate union values, and needed to update the internal getelementptr instruction to recognize that. closes #664
2017-12-08add implicit cast from enum tag type of union to const ptr to the unionAndrew Kelley
closes #654
2017-12-05allow union and its tag type to peer resolve to the tag typeAndrew Kelley
2017-12-05allow implicit cast from union to its enum tag typeAndrew Kelley
closes #642
2017-12-05add implicit cast from enum to unionAndrew Kelley
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-04add test for casting union to tag type of unionAndrew Kelley
2017-12-04add test for union with 1 void field being 0 bitsAndrew Kelley
2017-12-04add test for @sizeOf on extern and packed unionsAndrew Kelley
2017-12-04fix abi alignment of union-enums not counting tag typeAndrew Kelley
add more tests for unions See #618
2017-12-03rename @EnumTagType to @TagType. add tests for union-enumsAndrew Kelley
See #618
2017-12-03rework enums and unions and their relationship to each otherAndrew Kelley
* @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-11-16fix codegen for union init with runtime valueAndrew Kelley
see #144
2017-11-16debug safety for unionsAndrew Kelley
2017-11-15unions have a secret field for the typeAndrew Kelley
See #144
2017-11-15basic union supportAndrew Kelley
See #144
2017-10-27add test case for previous commitAndrew Kelley