Commit Graph

617 Commits

Author SHA1 Message Date
Jonathan Marler
0134cb0214 nice error for unsupported async sockets on Windows 2021-06-23 12:54:20 +03:00
Jarred Sumner
540b52931a Improve error message when std.fmt.format is missing arguments
Use fmt in fmt so the number in the error message is fmt'd
2021-06-13 10:33:49 +03:00
Exonorid
f63338195d Renamed @byteOffsetOf to @offsetOf 2021-06-12 19:16:01 +03:00
Matthew Borkowski
9ac6d28614 stage1: make @truncate to an integer type of different sign an error at comptime too 2021-06-08 20:58:30 +03:00
Andrew Kelley
52b3daa90e stage1: get test-compile-errors passing again 2021-05-28 14:19:08 -07:00
Andrew Kelley
8cfa231104 update langref, compile-error tests, safety tests
for the std.builtin re-arranging
2021-05-17 15:25:27 -07:00
Veikka Tuominen
0a38f61d58 update usage of std.testing in behavior and standalone tests 2021-05-08 15:15:30 +03:00
LemonBoy
82f1d592fa stage1: Use correct alignment for asyncCall frame 2021-04-25 20:41:49 +02:00
LemonBoy
0aede1a8fc stage1: Require a block after suspend
Closes #8603
2021-04-24 10:25:43 +02:00
Mathieu Guay-Paquet
93f8110e5d Allow async in nosuspend scope
Starting an async function call is actually a synchronous operation,
since the caller is not awaiting on the callee for a return value.

This commit removes the compiler code which generates the error and
updates the relevant test case.

In the presence of CallModifierAsync, the callee is expected to
suspend, so it should not be changed to CallModifierNoSuspend.
2021-02-16 23:43:36 -05:00
Mathieu Guay-Paquet
c0cfbe98f3 Allow resume in nosuspend scope
Resuming a suspended async function call is actually a synchronous
operation.

This commit removes the compiler code which generates the error and
updates the relevant test case.
2021-02-16 21:51:19 -05: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
Michael Dusan
f9b85c6e50 stage1: add error for slice.len incr beyond bounds
comptime direct slice.len increment dodges bounds checking but
we can emit an error for it, at least in the simple case.

- promote original assert to compile-error
- add test case

closes #7810
2021-01-30 11:19:25 +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
LemonBoy
fffb0904f8 stage1: Prevent crash with some lazy pointer types
Make sure the child element is not undefined, let's catch this problem
early on.

Closes #7568
2020-12-28 15:27:31 +02:00
Vexu
0bc82a9070
stage1: validate pointer attributes when coercing anon literals 2020-12-25 14:58:13 +02:00
Vexu
286077fec8 stage1: add missing error check on inferred struct field ptr 2020-12-21 12:40:51 +02:00
LemonBoy
8ac711596d stage1: Validate the specified cc for lazy fn types
Closes #7337
2020-12-08 19:09:25 -05:00
Andrew Kelley
afaef36194 stage1: compile error for pointer arithmetic on ptr-to-array
See #2018
2020-12-03 17:07:13 -07: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
Vexu
3a28b659bd
add compile-error tests for unsupported calling convention 2020-11-19 14:25:46 +02:00
pfg
cf7de64f1a stage1: improve error for missing a number type on a runtime var 2020-11-18 21:45:51 +02:00
frmdstryr
a39d3155b4 Change error when runtime value passed to comptime arg 2020-11-18 13:33:45 +02:00
LemonBoy
129ccad434 stage1: Reject undefined values when taking union ptr
The code rightfully assumes the union_val object to be fully initialized.

Closes #7019
2020-11-18 13:21:36 +02:00
Vexu
08270d72b4 ensure TypeInfo payload is not undefined 2020-11-11 16:04:46 +02:00
LemonBoy
78840c4ab2 stage1: Make sure union(enum(T)) is valid
The T type should be wide enough to fit values in the  0...num field
range.

Closes #6988
2020-11-05 17:24:04 -05:00
Travis
bb6e39e274 remove extra space in .** error message 2020-10-30 21:26:05 +02:00
Veikka Tuominen
80dd432137
Merge pull request #6858 from travv0/no-star-after-dot-star
don't allow a token starting with an asterisk directly following .*
2020-10-30 16:08:04 +02:00
LemonBoy
490cafe2c5 stage1: Error out when trying to execute unreachable
Closes #6802
2020-10-29 20:06:52 -04:00
Travis
960b5b518f updated zig tokenizer to handle .*** and added tests 2020-10-29 12:03:45 -05:00
Andrew Kelley
e6ac082437
Merge pull request #6744 from LemonBoy/intcast-vec
stage1: Implement `@intCast` between vectors
2020-10-22 17:36:18 -04:00
LemonBoy
2f465761bb stage1: Implement @intCast between vectors
Explicit and implicit integer casts on vector types are now supported
and follow the same rules as their scalar counterparts.

Implicit float casts are accidentally supported, `@floatCast` is still
not vector-aware.
2020-10-19 20:05:09 +02:00
LemonBoy
2a256d5ea0 stage1: Fix type-checking of unary neg for vector types
Validate the vector element type as done for the scalar case.

Fixes #6708
2020-10-17 21:08:39 -04:00
LemonBoy
2a62d4b20b stage1: Expand undefined struct/arrays when indexed
Fixes #6693
2020-10-16 17:13:38 +03:00
Tadeo Kondrak
0e57f220fb stage1: Disallow arrays in function parameters or return types
Closes #6535.
2020-10-08 04:17:32 -04:00
Andrew Kelley
95a37373e9
Merge pull request #6421 from tadeokondrak/opaque-syntax
Add opaque syntax that allows declarations
2020-10-07 16:58:50 -04:00
pfg
ae161863db stage1: improve error messages for missing try statements 2020-10-07 03:50:11 -04:00
Tadeo Kondrak
bf4bfe54ac
Update compile error test for field access of opaque type 2020-10-06 22:08:30 -06:00
Tadeo Kondrak
d71f339395
stage1: disallow fields in opaque types 2020-10-06 22:08:27 -06:00
Tadeo Kondrak
2b4b03d301
Update zig files for opaque type syntax 2020-10-06 22:08:25 -06: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
65016dff32
Add test for implicit extern-allowed enum tag type in extern struct 2020-10-01 18:10:20 -06: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
e18fdc12b0
stage1: Implement @Type for Fn and BoundFn 2020-10-01 18:01:38 -06:00
Tadeo Kondrak
e187ac09cb
Update compile error tests for alignment in StructField/UnionField 2020-10-01 15:06:21 -06:00
Tadeo Kondrak
e903b00eec
stage1: Fix @Type(.Enum) with invalid tag_type
Fixes https://github.com/ziglang/zig/issues/6459
2020-09-30 07:02:38 -06:00
Andrew Kelley
b811a99af9 Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-29 14:53:48 -07:00
LemonBoy
56b52dd0a3 stage1: Detect OOB access of vector value
Fixes #5710
2020-09-28 17:16:12 +02:00