aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
AgeCommit message (Collapse)Author
2022-12-15std: make builtin.Type.{Int,Float}.bits a u16 instead of comptime_intMeghan
2022-12-14Sema: implement missing stage1 errorsVeikka Tuominen
2022-12-13remove `stack` option from `@call`Veikka Tuominen
2022-12-09Eliminate `BoundFn` type from the languageVeikka Tuominen
Closes #9484
2022-12-08TypedValue: fix handling of tuples represented as empty_struct_valueVeikka Tuominen
2022-12-06remove most conditional compilation based on stage1Andrew Kelley
There are still a few occurrences of "stage1" in the standard library and self-hosted compiler source, however, these instances need a bit more careful inspection to ensure no breakage.
2022-12-03Sema: improve error for mismatched type in implicit returnVeikka Tuominen
Closes #2653
2022-12-03Sema: do not forcibly canonicalize unresolved pointer element typeVeikka Tuominen
Closes #13308
2022-12-02Sema: add error for failed assumption about struct having runtime bitsVeikka Tuominen
2022-11-23add tests for tuple declarationsVeikka Tuominen
2022-11-23Sema: implement tuple declarationsVeikka Tuominen
2022-11-20Type: make `hasRuntimeBitsAdvanced` take `AbiAlignmentAdvancedStrat`Veikka Tuominen
I wasn't able to create a reduced test case for this but the reasoning can be seen in `abiAlignmentAdvancedUnion` where if `strat` was lazy `hasRuntimeBitsAdvanced` would be given `null` instead of `sema` which would cause eager evaluation when it is not valid or desired.
2022-11-18run zig fmt on everything checked by CIStevie Hryciw
2022-11-13Sema: remove `block` and `src` parameters from `getBuiltin`Veikka Tuominen
These parameters are only ever needed when `std.builtin` is out of sync with the compiler in which case panicking is the only valid operation anyways. Removing them causes a domino effect of functions no longer needing a `src` and/or a `block` parameter resulting in handling compilation errors where they are actually meaningful becoming simpler.
2022-11-12llvm: check that tuple fields have runtime bitsVeikka Tuominen
Just checking that they aren't comptime isn't enough for `@Type` constructed tuples. Closes #13531
2022-11-11Type: check return_type for generic poison before comparingVeikka Tuominen
Closes #13423
2022-11-10stage2: Rename `Value.compare` to `compareAll`, etc.Cody Tapscott
These functions have a very error-prone API. They are essentially `all(cmp(op, ...))` but that's not reflected in the name. This renames these functions to `compareAllAgainstZero...` etc. for clarity and fixes >20 locations where the predicate was incorrect. In the future, the scalar `compare` should probably be split off from the vector comparison. Rank-polymorphic programming is great, but a proper implementation in Zig would decouple comparison and reduction, which then needs a way to fuse ops at comptime.
2022-11-07Merge pull request #13446 from Vexu/stage2-fixesVeikka Tuominen
Stage2 bug fixes
2022-11-05stage2: bitsize of packed struct should trigger backing int ty checkVeikka Tuominen
Closes #13398
2022-11-05Merge pull request #13101 from alichraghi/o4Andrew Kelley
2022-11-04stage2: fix onePossibleValue of empty unions and enumsVeikka Tuominen
Closes #13402
2022-11-04Merge pull request #13338 from Vexu/stage2-compile-errorsVeikka Tuominen
Improve some error messages
2022-11-04all: rename i386 to x86Ali Chraghi
2022-11-02stage2: Ensure f128 alignment matches c_longdouble alignmentCody Tapscott
On platforms where c_longdouble is 128-bits, interop with C code is simplified by making f128 match the alignment of c_longdouble. I intended to make this change as part of #13257, but I missed this part.
2022-10-29Sema: improve compile error for casting double pointer to anyopaque pointerVeikka Tuominen
Closes #12042
2022-10-29cbe: implement optional slice representation changeJacob Young
2022-10-27Merge pull request #13288 from Vexu/opt-sliceAndrew Kelley
Optimize size of optional slices (+ some fixes)
2022-10-27stage2: optimize size of optional slicesVeikka Tuominen
2022-10-25cbe: cleanup code and fix cases test breakageJacob Young
2022-10-23Fix long double on x86_64-windowsCody Tapscott
The larger alignment on this platform means that long double reports a sizeof 16 bytes, but it's underlying size is really just the 10 bytes of `f80` C doesn't give us a way to see the "underlying" size of a type, so this has to be caught by hand or by monitoring runtime memory. Luckily, x86 and x86-64 are the only platforms that seem to use a non-power-of-two type like this.
2022-10-22CType: Add `preferredAlignment`Cody Tapscott
This value corresponds to clang/gcc's `__alignof` (rather than `_Alignof` which reports the minimum alignment). We don't use this information yet, but it might be useful for implementing ABIs so it is included here.
2022-10-21Type.zig: Add `nvcl`/`cuda` CType definitionsCody Tapscott
2022-10-21stage 2: Update C types' size/alignmentCody Tapscott
These updates were made by testing against the `sizeof/_Alignof` reported by Clang for all supported arch-OS-ABI combinations and correcting any discrepancies. This is bound to have a few errors (the recent long double fix for i386 Android is one example), but Clang is certainly not a bad place to start, especially for our most popular targets.
2022-10-21Merge pull request #13219 from Vexu/stage2-fixesVeikka Tuominen
Stage2 bug fixes
2022-10-20Type: bitSizeOf non-packed structs should include paddingVeikka Tuominen
Closes #13214
2022-10-18all: rename `@maximum` to `@max` and `@minimum` to `@min`Ali Chraghi
2022-10-17tools: add lldb stage2 pretty printersJacob Young
* Fix untagged struct names in debug info for llvm. * Factor out common stage2 pretty printer data. * Add lldb version of stage2 pretty printers.
2022-10-15Merge branch 'amdgpu-improvements' of https://github.com/Snektron/zig into ↵Andrew Kelley
Snektron-amdgpu-improvements
2022-10-14i386 ABI: Fix some sizes and alignmentsEvan Haas
This makes the following changes for i386: long long and unsigned long long have 4 byte alignment on non-Windows f64 (double) has 4-byte alignment on non-Windows long double is 80 bits and has 4 byte alignment on mingw long double on android is 64 bits, not 80: https://www.uclibc.org/docs/psABI-i386.pdf Fixes #12453 Fixes #12987
2022-10-12make addrSpaceCast work with optionals; forbid ptrCast'ing address spacesRobin Voetter
2022-10-12amdgpu: add amdhsa/amdpal ctype abi sizesRobin Voetter
2022-10-12Merge pull request #13081 from r00ster91/docsAndrew Kelley
fix(text): hyphenation and other fixes
2022-10-06Sema: disallow fieldParentPtr and offsetOf on comptime fieldsVeikka Tuominen
Comptime fields are tied to the type and behave more like declarations so these operations cannot return anything useful for them.
2022-10-05fix(text): hyphenation and other fixesr00ster91
2022-09-30Type: correctly handle ABI align strat for optionals and error unionsVeikka Tuominen
Closes #12984
2022-09-13Merge remote-tracking branch 'origin/master' into llvm15Andrew Kelley
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-11Merge remote-tracking branch 'origin/master' into llvm15Andrew Kelley
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-06Merge remote-tracking branch 'origin/master' into llvm15Andrew Kelley