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 2e1bdd0d14
.
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
antlilja
1157ee1307
Improve builtin op support for f128/comptime_float
...
* Add support for fabs, floor, ceil, trunc and round
* Add behavior tests
2020-06-17 17:35:45 +02:00
Andrew Kelley
2bb3e1aff4
stage1: implement type coercion of anon struct literal to struct
...
closes #3672
2020-06-15 16:52:18 -04:00
Jakub Konka
057d97c093
Return should be i32 due to error signaling in memory.grow
...
Also, fix tests.
2020-06-09 00:22:34 -04:00
Jakub Konka
73a3bfd1dd
Add basic tests for the new builtins
2020-06-09 00:22:34 -04:00
Michael Dusan
c0c9d11d8c
stage1: fix constness in some corner cases
...
- for one-possible-value types, ir_analyze_struct_field_ptr()
no longer hardcodes const/volatile
- when slicing arrays, ir_analyze_instruction_slice()
no longer consults ConstValSpecialStatic
closes #5474
2020-06-05 00:49:57 -04:00
xackus
250dd9ac21
stage1: fix unresolved inferred error sets
2020-05-31 15:04:34 +02:00
foobles
51682717d7
Support equality comparison for optional to non-optional (?T ==/!= T)
...
extracted function ir_try_evaluate_bin_op_const
extracted type_is_self_comparable function
renamed ir_try_evaluate_bin_op_const to ir_try_evaluate_bin_op_cmp_const
implemented analysis of ?T == T
added ir_set_cursor_at_end_and_append_basic_block_gen
use build_br_gen and ir_set_cursor_at_end_and_append_block_gen
added ir_append_basic_block_gen
removed include of all_types in ir.cpp
extracted compile-time and runtime evaluation of cmp_optional_non_optional to separate functions
closes #5390
closes #1332
2020-05-29 18:46:09 -04:00
Veikka Tuominen
4c8b937fb0
Merge pull request #5184 from alexnask/typeof_extern_call
...
Extern functions are now evaluated to undefined values at comptime in TypeOf calls.
2020-05-30 01:11:22 +03:00
Timon Kruiper
6e89692d81
C ABI: Add C support for passing structs of floats to an extern function
...
Currently this does not handle returning these structs yet.
Related: #1481
2020-05-28 22:56:33 -04:00
Jakub Konka
015c899297
Make align expr on fns a compile error in Wasm
...
In Wasm, specifying alignment of function pointers makes little sense
since function pointers are in fact indices to a Wasm table, therefore
any alignment check on those is invalid. This can cause unexpected
behaviour when checking expected alignment with `@ptrToInt(fn_ptr)`
or similar. This commit proposes to make `align` expressions a
compile error when compiled to Wasm architecture.
Some references:
[1] [Mozilla: WebAssembly Tables](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format#WebAssembly_tables )
[2] [Sunfishcode's Wasm Ref Manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#indirect-call )
2020-05-26 17:17:32 +02:00
Alexandros Naskos
d88db4d34b
Changed test name to reflect it only fixes #4328
2020-05-26 12:36:02 +03:00
Alexandros Naskos
75a4c02880
Updated test
2020-05-18 19:28:26 +03:00
Alexandros Naskos
400a91e1c6
Add TypeOf resolution of dereferences and struct fields of undefined values
2020-05-18 19:15:44 +03:00
Jakub Konka
34f84c3608
Narrow down behaviour test cases; this removes wasmtime-enabled check in tests
2020-05-18 17:56:17 +02:00
Vexu
0847b47bf8
fix `@intToFloat` on comptime_floats
2020-05-12 00:24:09 +03:00
Tadeo Kondrak
6745a6f6f6
zig fmt
2020-05-05 09:38:02 -06:00
Tadeo Kondrak
2c9204032d
update tests for nosuspend
2020-05-05 05:55:26 -06:00
Tadeo Kondrak
af00afed98
zig fmt
2020-05-05 05:55:25 -06:00
Tadeo Kondrak
a62e9bc8e5
Implement @Type for ErrorSet
2020-05-02 14:39:32 -06:00
Tadeo Kondrak
ca6db2d008
Implement @Type() for EnumLiteral and FnFrame
2020-05-02 14:39:28 -06:00
Tadeo Kondrak
1696e943ac
Implement @typeInfo for @Frame()
...
Closes https://github.com/ziglang/zig/issues/3066
2020-05-02 14:39:27 -06:00
Andrew Kelley
b7914d901c
add test coverage for top level fields
...
closes #2022
2020-05-02 14:53:20 -04:00
Tadeo Kondrak
350b2adacd
std.meta.IntType -> std.meta.Int
2020-04-28 19:11:31 -06:00
Andrew Kelley
5929e5ca0e
Merge pull request #5196 from tadeokondrak/@vector-to-@type-vector
...
`@Vector` -> `@Type(.Vector)`
2020-04-28 16:25:40 -04:00