LemonBoy
22b5e47839
stage1: Implement @reduce builtin for vector types
...
The builtin folds a Vector(N,T) into a scalar T using a specified
operator.
Closes #2698
2020-10-05 04:51:45 -04:00
Alexandros Naskos
e31cc80130
Merge pull request #6427 from tadeokondrak/enums-explicit-tag-type-extern-allowed
...
Allow enums with explicit extern-allowed tag types in extern types
2020-10-03 12:51:39 +03:00
Tadeo Kondrak
cae49b1b9d
Add tests for enums with explicit extern-allowed tag types in extern types
2020-10-01 18:09:47 -06:00
Tadeo Kondrak
96a151d4b8
Skip @Type/@typeInfo Fn/BoundFn tests on wasm32/wasm64
2020-10-01 18:01:40 -06:00
Tadeo Kondrak
e18fdc12b0
stage1: Implement @Type for Fn and BoundFn
2020-10-01 18:01:38 -06:00
Tadeo Kondrak
97ab720d84
stage1: Add alignment to TypeInfo.Fn
2020-10-01 17:59:42 -06:00
Tadeo Kondrak
70c507911a
Update @Type tests for alignment field in UnionField and StructFIeld
2020-10-01 15:01:27 -06:00
Tadeo Kondrak
c2ee66108c
Add tests for alignment field in UnionField and StructFIeld
2020-10-01 15:01:26 -06:00
LemonBoy
cbbcf60968
stage1: Allow comparison with comptime-known vectors
...
Since comptime_{int,float} vectors are not allowed (thanks $DEITY) we
can use the element type infos to determine the minimum operand size.
2020-09-28 17:16:57 +02:00
LemonBoy
f92d01c8a8
stage1: Fix edge case in casting between optional types
...
Closes #6370
2020-09-18 22:12:22 -04:00
Tadeo Kondrak
2962be8135
stage1: fix @Type(.Union) not resolving its tag type
...
Fixes https://github.com/ziglang/zig/issues/6339
2020-09-16 20:34:01 +03:00
Veikka Tuominen
d073836894
Merge pull request #6172 from tadeokondrak/@Type(.Union)
...
Implement @Type for Union
2020-09-14 16:43:49 +03:00
Vexu
0833c8d06b
translate-c: support sizeof and _Alignof in macros
...
Closes #6301
2020-09-10 13:04:03 +03:00
Tadeo Kondrak
ff2ed966bb
Implement @Type for Union
...
This removes TypeInfo.UnionField.enum_field, which is redundant with
TypeInfo.Union.tag_type.
2020-09-07 06:23:24 -06:00
Vexu
1df0f3ac24
update uses of deprecated type field access
2020-09-03 18:10:40 +03:00
Tadeo Kondrak
1b2154dfe2
builtin: Add TypeInfo.StructField.is_comptime
2020-09-02 00:17:59 -04:00
Tadeo Kondrak
a2c47d2b0b
Remove @OpaqueType
2020-08-30 19:02:23 -06:00
Andrew Kelley
55d7c399c1
Merge pull request #6119 from tadeokondrak/@Type(.Enum)
...
Implement @Type for Enum
2020-08-22 03:21:46 -04:00
Tadeo Kondrak
a049c31f21
Remove TypeInfo.Error.value
2020-08-22 03:20:12 -04:00
Tadeo Kondrak
5a5956bd20
Implement @Type for Enum
2020-08-21 14:31:24 -06:00
Tadeo Kondrak
b46d764fd9
Implement @Type for structs without decls support
2020-08-19 14:55:42 -06:00
Tadeo Kondrak
0f677810ea
Remove offset field from TypeInfo.StructField
...
This isn't needed with @bitOffsetOf/@byteoffsetOf and complicates
@Type handling.
2020-08-19 14:55:40 -06:00
Vexu
1e835e0fcc
disallow '_' prong when switching on non-exhaustive tagged union
...
A tagged union cannot legally be initiated to an invalid enumeration
2020-08-17 20:47:31 +03:00
xackus
65185016f1
stage1: fix non-exhaustive enums with one field
2020-08-17 20:45:34 +03:00
Andrew Kelley
a36772ee64
Merge pull request #5693 from antlilja/switch-unreachable-else
...
Add error message for unreachable else prong in switch
2020-07-26 05:46:18 +00:00
Vexu
fd2f034e31
fix comptime comparisons of different sized floats
2020-07-21 22:29:15 +03:00
Vexu
596ca6cf70
allow non-pointer extern opaque variables
2020-07-18 16:45:07 +03:00
Vexu
a1e78d0b06
add is_tuple field to struct typeinfo
...
part of #4335
2020-07-17 00:15:34 +03:00
Vexu
5e88a7a427
add behavior tests fro macro translations
2020-07-16 17:10:52 +03:00
Andrew Kelley
a7c3cec65f
follow up from previous commit for generic methods
2020-07-14 15:29:07 -07:00
Andrew Kelley
4696cd3e09
fix ability to call methods on enums with pointer-to-self
...
closes #3218
2020-07-14 14:38:40 -07:00
Vexu
e1a5e061ca
revert accidental format of tests
...
these test the tokenizers handling of EOF and formatting makes them useless
2020-07-12 11:27:50 +03:00
Vexu
bfe9d4184f
fix alignment parsing in stage1
2020-07-12 07:35:34 +00:00
Andrew Kelley
fe08a4d065
Merge pull request #5846 from Vexu/anytype
...
Rename 'var' type to 'anytype'
2020-07-12 07:35:01 +00:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted
2020-07-11 20:41:19 +03:00
Vexu
2e6688ae27
Add test for @typeInfo declarations showing up in declaration order
...
Both the stage1 and std lib HashMap implementations now preserve insertion order
2020-07-11 19:51:20 +03:00
Vexu
2e037fd827
use correct cast function when doing @floatCast at comptime
2020-07-11 11:36:28 +03:00
Andrew Kelley
02619edf41
Revert "use correct cast function when doing @floatCast at comptime"
...
This reverts commit 2e1bdd0d14f490a80bbed3ee0e0479a908715d33.
Test failures
2020-07-09 23:24:21 -07:00
Vexu
2e1bdd0d14
use correct cast function when doing @floatCast at comptime
...
Closes #5832
2020-07-09 21:25:55 +03:00
Andrew Kelley
8b82c40104
stage1: reimplement HashMap
...
The indexes are stored separately using an array of
uint8_t, uint16_t, uint32_t, or size_t, depending on the number of
entries in the map.
Entries only contain a key and a value, no longer have
distance_from_start_index or is_used.
In theory this should be both faster and use less memory.
In practice it seems to have little to no effect. For the standard
library tests, vs master branch, the time had no discernable
difference, and it shaved off only 13 MiB of peak rss usage.
2020-07-02 04:53:26 +00:00
Andrew Kelley
581d16154b
Merge pull request #5696 from alexnask/async_call_tuple
...
@asyncCall now takes arguments as a tuple instead of varargs
2020-06-28 01:00:58 -04:00
Alexandros Naskos
2fde8249b7
Fixed crash when resolving peer types of *[N:s]const T and [*:s]const T
2020-06-24 23:58:02 -04:00
Alexandros Naskos
129a4fb251
Copy union const values correctly
2020-06-24 15:21:58 -04:00
antlilja
e60be30824
Remove unreachable else prongs
2020-06-24 19:03:32 +02:00
Alexandros Naskos
eefcd04462
Small fixes, fixed tests, added test for argument tuple type
2020-06-24 16:56:24 +03:00
xackus
d907f574e0
stage1: fix concat of sliced str literals
2020-06-21 14:57:12 -04:00
Andrew Kelley
c70633eacd
Merge pull request #5203 from tadeokondrak/@type-for-even-more-types
...
implement @typeInfo for Frame and implement @Type for Frame, EnumLiteral, and ErrorSet
2020-06-18 21:25:03 -04:00
Andrew Kelley
5ea0f589c9
Merge pull request #5625 from antlilja/master
...
Improve support for f128 and comptime_float operations
2020-06-18 20:32:43 -04:00
Andrew Kelley
4a38799631
make file and fn_name fields of SourceLocation also null-terminated
...
One of the main motivating use cases for this language feature is
tracing/profiling tools, which expect null-terminated strings for these
values. Since the data is statically allocated, making them
additionally null-terminated comes at no cost.
This prevents the requirement of compile-time code to convert to
null-termination, which could increase the compilation time of
code with tracing enabled.
See #2029
2020-06-18 17:09:10 -04:00
Vexu
14acc65675
add tests for @src
2020-06-18 21:11:34 +03:00