aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
AgeCommit message (Collapse)Author
2022-09-12Sema: introduce Type.ptrAlignmentAdvancedAndrew Kelley
I'm not sure why the other commits in this branch caused this fix to be necessary. Also, there seems to be more fixes necessary before tests will pass.
2022-09-10type: print comptime on fn type paramsJacob Young
This avoids the following confusing error message: error: expected type 'fn(i32, i32) void', found 'fn(i32, i32) void'
2022-09-02Sema: remove unused src param from typeRequiresComptimeVeikka Tuominen
2022-09-02Sema: fix noalias coercion error messageVeikka Tuominen
Closes #11769
2022-08-29Merge pull request #12641 from Luukdegram/wasm-c-typesAndrew Kelley
stage2: fix size of c_longdouble for Wasm target
2022-08-28Sema: correct one possible value for tuplesVeikka Tuominen
Closes #12376
2022-08-26wasm: fix abi size of c_longdoubleLuuk de Gram
According to https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md the size of c's long double is 16 bytes for Wasm, rather than 8 bytes which was the value previously in the compiler. This ensures we not only pass the correct value, but also creates the correct function signature needed to pass the Wasm validator. This also adds an additional test case in c_abi tests.
2022-08-24stage2: explicitly tagged enums no longer have one possible valueAndrew Kelley
Previously, Zig had inconsistent semantics for an enum like this: `enum(u8){zero = 0}` Although in theory this can only hold one possible value, the tag `zero`, Zig no longer will treat the type this way. It will do loads and stores, as if the type has runtime bits. Closes #12619 Tests passed locally: * test-behavior * test-cases
2022-08-22Sema: fix parameter of type 'T' must be comptime errorVeikka Tuominen
Closes #12519 Closes #12505
2022-08-21Sema: handle union and enum field order being differentVeikka Tuominen
Closes #12543
2022-08-18stage2: pointers to comptime-only types are comptime-onlyAndrew Kelley
This is a partial revert of c5ba941b77fbdb06841f28142420c6786f2a4d0c.
2022-08-18improved ABI alignment/size for >= 128-bit integersAndrew Kelley
* riscv64: adjust alignment and size of 128-bit integers. * take ofmt=c into account for ABI alignment of 128-bit integers and structs. * Type: make packed struct support intInfo * fix f80 alignment for i386-windows-msvc
2022-08-18stage2: make `@Vector` ABI size agree with LLVMAndrew Kelley
2022-08-18stage2: agree with LLVM that `@alignOf(u128)` is 8Andrew Kelley
on x86_64 and similar targets.
2022-08-18stage2: all pointers have runtime bitsAndrew Kelley
2022-08-17Sema: allow empty enums and unionsVeikka Tuominen
2022-08-12stage2: check for zero in `@intToError` safetyVeikka Tuominen
2022-08-10stage2: Implement explicit backing integers for packed structsIsaac Freund
Now the backing integer of a packed struct type may be explicitly specified with e.g. `packed struct(u32) { ... }`.
2022-08-09stage2: correct node offset of nested declarationsVeikka Tuominen
2022-08-06Type: adjust C type sizesVeikka Tuominen
2022-07-29Sema: fix runtime safety for integer overflow with vectorsAndrew Kelley
2022-07-23Sema: add default value here note to invalid comptime field store errorVeikka Tuominen
2022-07-23Sema: bad union field access safetyVeikka Tuominen
2022-07-21Sema: validate function parameter types and return typeVeikka Tuominen
2022-07-14LLVM: fix ABI size of optional and error union typesAndrew Kelley
Previously, the Zig ABI size and LLVM ABI size of these types disagreed sometimes. This code also corrects the logging messages to not trigger LLVM assertions.
2022-07-13stage2: fix comptime bitcast involving f80Andrew Kelley
* Sema: implement comptime bitcast of f80 with integer-like types bitwise rather than taking a round trip through memory layout. * Type: introduce `isAbiInt`. * Value: comptime memory write of f80 writes 0 bytes for padding instead of leaving the memory uninitialized. * Value: floatReadFromMemory has a more general implementation, checking the endianness rather than checking for specific architectures. This fixes behavior test failures occurring on MIPS.
2022-07-11Sema: validate extern typesVeikka Tuominen
2022-07-10Merge pull request #12001 from ziglang/llvm14Andrew Kelley
Upgrade to LLVM 14
2022-07-08stage2: Support initializing anonymous struct typeCody Tapscott
This commit adds support for initializing `.anon_struct` types. There is also some follow-up work to do for both tuples and structs regarding comptime fields, so this also adds some tests to keep track of that work.
2022-07-08stage2: Fix panic when printing AIR for tuple/anon struct typesCody Tapscott
2022-07-03stage2: update vector alignment logicAndrew Kelley
This follows LLVM14's lead on vector alignment, which computes byte count based on the length premultiplied by bits. This commit also disables behavior tests regressed by LLVM 14, only for stage1. stage2 fortunately does not trip the regression.
2022-07-01Merge pull request #11974 from ziglang/fixfixfixAndrew Kelley
stage2 fixes
2022-07-01AstGen: use elem_{ptr,val}_node for array access syntaxVeikka Tuominen
2022-06-30stage2: implement alignment calculation of vectorsAndrew Kelley
closes #11856
2022-06-11stage2: make `error{}` the same size as `anyerror`Veikka Tuominen
Having `error{}` be a zero bit type causes issues when it interracts with empty inferred error sets which are the same size as `anyerror`.
2022-06-10Sema: introduce bitSizeAdvanced to recursively resolve typesAndrew Kelley
Same pattern as abiSizeAdvanced. Fixes compiler crash for nested packed structs.
2022-06-09stage2: fix handling of aggregates with mixed comptime-only fieldsAndrew Kelley
2022-06-08stage2: fix type printing of sub-byte pointersAndrew Kelley
2022-06-07stage2: packed struct fixes for big-endian targetsAndrew Kelley
2022-06-07stage2: better codegen for byte-aligned packed struct fieldsAndrew Kelley
* Sema: handle overaligned packed struct field pointers * LLVM: handle byte-aligned packed struct field pointers
2022-06-06stage2: use correct type (u29) for alignmentVeikka Tuominen
2022-06-03Sema: `@sizeOf` function should give an errorVeikka Tuominen
2022-06-03Type: implement elemType2 for anyframeVeikka Tuominen
2022-06-01Sema: fix alignment of element ptr result typeAndrew Kelley
2022-05-31stage2: introduce support for noaliasAndrew Kelley
Not implemented yet is enhancements to coerceInMemory to account for noalias parameters. Related to #11498.
2022-05-31stage2: fix hash/eql on function typesAndrew Kelley
to account for generic callconv and generic alignment.
2022-05-31stage2: ignore generic return type when hashing function typeVeikka Tuominen
Generic parameter types are already ignored.
2022-05-30Sema: implement functions generic across callconv() or align()Andrew Kelley
2022-05-24stage2: treat `error{}!void` as a zero-bit typeAndrew Kelley
2022-05-24stage2: fixes for error unions, optionals, errorsAndrew Kelley
* `?E` where E is an error set with only one field now lowers the same as `bool`. * Fix implementation of errUnionErrOffset and errUnionPayloadOffset to properly compute the offset of each field. Also name them the same as the corresponding LLVM functions and have the same function signature, to avoid confusion. This fixes a bug where wasm was passing the error union type instead of the payload type. * Fix C backend handling of optionals with zero-bit payload types. * C backend: separate out airOptionalPayload and airOptionalPayloadPtr which reduces branching and cleans up control flow. * Make Type.isNoReturn return true for error sets with no fields. * Make `?error{}` have only one possible value (null).