Andrew Kelley
fc9c1b4e4a
Merge pull request #8028 from mguaypaq/nosuspend-allow
...
stage1: allow async and resume inside nosuspend blocks
2021-04-02 11:59:34 -07:00
LemonBoy
27d07c6c4d
std: Replace testing fns for floating-point values
...
Beside handling NaNs and other non-numeric values better we finally
offer the same pair of testing predicates in math and testing.
2021-03-14 17:23:47 -04:00
LemonBoy
36c4037144
stage1: Add tests for C ABI integer return types
2021-03-12 11:50:56 +01:00
Veikka Tuominen
2d286100ef
stage1: add tests for nosuspend async/resume
2021-03-07 15:30:59 +02:00
Andrew Kelley
84f3b3dff2
re-enable behavior tests: translate-c macros
...
These were temporarily disabled in
dd973fb365
and we forgot re-enable
them until now.
2021-03-02 16:32:52 -07:00
Tadeo Kondrak
5dfe0e7e8f
Convert inline fn to callconv(.Inline) everywhere
2021-02-10 20:06:12 -07:00
Tadeo Kondrak
0b5f3c2ef9
Replace @TagType uses, mostly with std.meta.Tag
2021-01-30 22:26:44 +02:00
Andrew Kelley
025f1559a0
Merge pull request #7200 from Vexu/arr
...
Type coercion for pointers to anon literals
2021-01-11 16:09:28 -08:00
Jay Petacat
a9b505fa77
Reduce use of deprecated IO types
...
Related: #4917
2021-01-07 23:48:58 -08:00
Andrew Kelley
66e5e92a3e
Merge pull request #7592 from LemonBoy/fix-7188
...
Allow variable captures on multi-prong switch arms
2021-01-04 14:23:01 -08:00
LemonBoy
d2f6fa1608
Fix more stray uses of {} for formatting strings
2021-01-02 17:12:57 -07:00
LemonBoy
dd973fb365
std: Use {s} instead of {} when printing strings
2021-01-02 17:12:57 -07:00
LemonBoy
2561168adb
std: Clean up some tests
...
No functional changes, remove some dead code.
2020-12-30 09:42:21 +01:00
LemonBoy
88634f0481
stage1: Allow variable capture for multi-prong switch arms
...
Handle the multi-prong case as we do with range cases.
Closes #7188
2020-12-30 09:42:20 +01:00
Veikka Tuominen
795770bcb4
stage1: const_values_equal error union, improve remaining "TODO" panics
2020-12-26 13:29:48 +02:00
Vexu
1780132d7c
fix tests
2020-12-25 14:58:14 +02:00
Vexu
990eccf282
stage1: implement type coercion of pointer to anon list to array/struct/union/slice
2020-12-25 14:57:46 +02:00
Vexu
ed028fd660
stage1: implement type coercion of anon list to array
2020-12-25 14:57:46 +02:00
LemonBoy
e18abab55a
stage1: Create a new declaration scope for union enum types
...
Making the enum type share the scope with the parent union means every
declaration "bleeds" into the enum scope.
Let's mint a fresh empty scope for the enum type.
Thanks to @Vexu for the test case.
Closes #7532
2020-12-24 15:57:12 +02:00
g-w1
ea18f894f5
Peer type resolution with unsigned ints and larger signed ints
2020-12-23 00:05:42 +02:00
LemonBoy
84549b4267
stage1: Fix for generic fn monomorphization
...
Don't use the instantiation argument types to build the function
parameter array.
f416535768
worked around the problem, this
commit solves it.
2020-12-19 19:45:48 -05:00
Andrew Kelley
b3c1ced2c3
Merge pull request #7431 from LemonBoy/fix-7426
...
stage1: Fix crash in can_mutate_comptime_var_state
2020-12-15 15:07:49 -05:00
LemonBoy
8a2ab60fca
stage1: Don't skip steps when analyzing union types
...
Don't cut any corner and properly run the type trough every single step
even though it has no fields (or, better, the sum of the size of all its
fields is zero).
Fix the logic to consider an explicit non-zero-sized tag enough to treat
the type as sized.
Closes #7451
2020-12-15 14:40:21 -05:00
LemonBoy
bbfa3550a0
Add a test case
...
Co-authored-with: Vexu <git@vexu.eu>
2020-12-14 17:39:35 +01:00
Vexu
73016212a3
translate-c: support referencing c containers in macros
2020-12-10 14:45:48 +02:00
Vexu
7e30e83900
small fixes and zig fmt
2020-12-09 13:54:26 +02:00
LemonBoy
df99cfdf1e
stage1: Fix typeInfo generation for arrays w/o sentinel
...
ZigTypeIdOptional types have a different way of specifying their payload
value depending on whether the child type is a pointer or not (plus some
other special cases).
Fixes #7251
2020-11-29 10:39:10 -08:00
LemonBoy
c80d196094
stage1: Add missing bitcast when rendering var ptr
...
Some types require this extra bitcast, eg. structs or unions with extra
padding fields inserted by the compiler.
Fixes #7250
2020-11-29 10:37:06 -08:00
LemonBoy
f91df39ad2
stage1: Fix crash in *[N]T to []T conversion with zst
...
Prevent the crash by not making the codegen try to access the
non-existing ptr field in the slice.
Closes #6951
2020-11-27 14:33:26 -08:00
LemonBoy
58c2bec589
stage1: Fix ICE when generating struct fields with padding
...
Make gen_const_ptr_struct_recursive aware of the possible presence of
some trailing padding by always bitcasting the pointer to its expected
type.
Not an elegant solution but makes LLVM happy and is consistent with how
the other callsites are handling this case.
Fixes #5398
2020-11-25 15:36:33 -08:00
Andrew Kelley
bf0cc32aa6
Merge pull request #7165 from LemonBoy/ppc64final
...
Make the PPC64 port usable
2020-11-20 17:40:17 -08:00
LemonBoy
6029114f84
stage1: Resolve usingnamespace decls when calling @typeInfo
...
Closes #7176
2020-11-20 17:01:23 -08:00
LemonBoy
2193bbfd93
Skip f16 to f128 conversion test for ppc64
...
As for aarch64 we're waiting for LLVM to emit calls to the specific
builtins that implement this conversion.
2020-11-20 08:38:11 +01:00
LemonBoy
f2b4e6b2e7
Better coverage in @splat tests
...
Cover more common and uncommon cases.
2020-11-20 08:38:10 +01:00
Andrew Kelley
73be59433f
Merge pull request #6928 from data-man/reduce_tests
...
Add more tests for reduce
2020-11-19 17:48:18 -08:00
Veikka Tuominen
cf819b95fe
Merge pull request #6829 from tadeokondrak/error-unsupported-callconv
...
stage1: Compile error instead of falling back to C for unsupported cc
2020-11-19 19:03:08 +02:00
Tadeo Kondrak
25ec2dbc1e
Add builtin.Signedness, use it instead of is_signed
2020-11-19 18:59:21 +02:00
Tadeo Kondrak
c002a5026a
Update code to not use unsupported calling conventions for target
2020-11-19 14:01:07 +02:00
LemonBoy
2b7781d82a
stage1: Fix undefined assignment for bitfields
...
Prevents silent memory corruption.
Closes #7055
2020-11-18 21:49:39 -08:00
LemonBoy
fa27420b72
stage1: Fix asyncCall with non-abi-aligned arguments
...
Make the code used to calculate the variable slot index into the frame
match what's done during the structure layout calculation.
Prevents a few nasty LLVM errors when such types are passed around.
2020-11-17 15:55:12 -08:00
data-man
86b86bef23
Added links to the relevant issue
2020-11-17 14:41:05 +05:00
Andrew Kelley
d9c36cb250
Merge pull request #6878 from frmdstryr/multiline-string-comments
...
Support comments in multiline string literals
2020-11-16 14:05:15 -08:00
Alexandros Naskos
6e2e747b0b
Merge pull request #7112 from LemonBoy/fix-7104
...
stage1: Fix generation of pass-by-value args in async fns
2020-11-16 09:12:42 +02:00
LemonBoy
7ebbc717c0
stage1: Fix generation of pass-by-value args in async fns
...
The mismatch between the argument slot type in the frame structure and
the one used in the store operation made the generated code write
garbage over the nearby fields.
Fixes #7104
2020-11-14 15:30:06 +01:00
LemonBoy
c4fd3fc270
stage1: Resolve ErrorUnion children types
...
Since the code is accessing the abi_size field compute the full type
size for both err_set_type and payload_type, not only for the latter.
2020-11-13 14:28:40 -07:00
LemonBoy
5872ae5111
stage1: Fix crash in comptime struct generation
...
Using the gen_index rather than the src_index is needed to handle
structures containing zero-sized or comptime only types.
Closes #7027
2020-11-11 15:35:19 +02:00
LemonBoy
f0b1b74d21
stage1: Avoid resolving type entry in [0]T
...
The logic was already there but this rule was only applied in some
places, apply it in the remaining code paths.
Closes #7058
2020-11-11 13:53:24 +02:00
LemonBoy
4d4ab1e69a
stage1: Fix comparison of unions containing zero-sized types
...
The code tried to be too smart and skipped the equality (returning true)
if the payload type was zero-sized.
This optimization is completely wrong when the union payload is a
metatype!
Fixes #7047
2020-11-10 17:21:49 -05:00
xackus
5c8f7f81cd
change debug.assert to testing.expect in tests
2020-11-06 22:48:54 +01:00
LemonBoy
ff14451b4a
std: Implement more useful approxEq semantics
...
Comparisons with absolute epsilons are usually useful when comparing
numbers to zero, for non-zero numbers it's advised to switch to relative
epsilons instead to obtain meaningful results (check [1] for more
details).
The new API introduces approxEqAbs and approxEqRel, where the former
aliases and deprecated the old `approxEq`, allowing the user to pick the
right tool for the job.
The documentation is meant to guide the user in the choice of the
correct alternative.
[1] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
2020-11-05 16:08:49 +01:00