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
Andrew Kelley
2cd19c05d0
stage1: remove buggy "unable to inline function" compile error
...
We still want this compile error but I'm giving up on implementing it
correctly in stage1. It's been buggy and has false positives sometimes.
I left the test cases there, but commented out, so that when we go
through the stage1 compile error cases and get coverage for them in
stage2 we can reactivate the test cases.
closes #2154
2020-08-15 09:53:39 -07:00
Vexu
3734881577
add error for unused/duplicate block labels
2020-08-13 01:13:17 +03:00
Vexu
6bba7c702b
add compile error for alignCasting zero sized types
2020-08-02 17:49:16 +00:00
Vexu
5f0bde6358
add helpful error note for when function cannot return an error
...
This has caused frequent confusion since it looks like you are handling
errors correctly with a try but you forgot to change your return type.
2020-07-28 04:24:52 +00: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
Andrew Kelley
995fd7314c
Revert "Support taking extern pointers at comptime"
...
This reverts commit d3ebd428650748e60db70dd2171cc044855814b1.
This caused a build failure on multiple targets.
2020-07-24 14:06:44 -07:00
yvt
d3ebd42865
Support taking extern pointers at comptime
...
This commit makes it possible to obtain pointers to `extern` variables
at comptime.
- `ir_get_var_ptr` employs several checks to determine if the given
variable is eligible for obtaining its pointer at comptime. This
commit alters these checks to consider `extern` variables, which have
runtime values, as eligible.
- After this change, it's now possible for `render_const_val` to be
called for `extern` variables. This commit modifies
`render_const_val` to suppress the value generation for `extern`
variables.
- `do_code_gen` now creates `ZigValue::llvm_global` of `extern`
variables before iterating through module-level variables so that
other module-level variables can refer to them.
This solution is incomplete since there are several cases still
failing:
- `global_var.array[n..m]`
- `&global_var.array[i]`
- `&global_var.inner_struct.value`
- `&global_array[i]`
Closes #5349
2020-07-24 13:33:17 -07:00
Vexu
78962eeeda
fix floatCast type check regression
...
Closes #5900
2020-07-18 10:22:15 +03:00
Vexu
dff1ac1089
check for invalid sentinel when creating pointer with @Type
2020-07-13 00:29:53 +00:00
Vexu
be1507a7af
update compile error tests and some doc comments
2020-07-12 00:54:07 +03:00
Vexu
2e037fd827
use correct cast function when doing @floatCast
at comptime
2020-07-11 11:36:28 +03:00
Vexu
5667a21b1e
fix missing check on extern variables with no type
2020-07-08 03:09:41 +00:00
antlilja
dcc406deff
Add new error message for unreachable else prongs
...
* Adds error message for types: enum, int and bool
* Adds compile error tests
2020-07-01 16:09:36 +02: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
arbrk1
78d8931647
Fix issue #5618 ( #5685 )
...
* fix issue #5618
* A test for the issue #5618 added.
Also inserted a comma in the neighboring test to make it more zigfmt-friendly.
2020-06-24 23:58:50 -04:00
Alexandros Naskos
eefcd04462
Small fixes, fixed tests, added test for argument tuple type
2020-06-24 16:56:24 +03:00
antlilja
0de35af98b
Add duplicate checking for switch on types
...
* Add compile error tests
2020-06-23 15:17:04 -04:00
Robin Voetter
8696e52a3d
Make unary minus for unsigned types a compile error ( #5654 )
...
* Make unary minus for unsigned types a compile error
* Add unreachable when generating unsigned negate
2020-06-21 14:55:44 -04:00
Vexu
14acc65675
add tests for @src
2020-06-18 21:11:34 +03:00
Jakub Konka
8ffa8ed9a8
Expose full llvm intrinsic
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
xackus
0d40cb6255
stage1: fix crash on slice byte reinterpretation
2020-06-08 17:19:06 -04: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
Jakub Konka
08b0cae777
Add matching compile error test
2020-05-26 18:00:08 +02:00
Andrew Kelley
9a22c8b6ca
Merge pull request #5057 from xackus/opaque-param
...
stage1: fix assert fail on opaque fn ptr param
2020-05-17 12:48:56 -04:00
xackus
204f8daeed
stage1: detect underflow in bigint_fits_in_bits
2020-05-11 14:06:37 +02:00
Vexu
f2d3266075
Merge pull request #4932 from Qix-/fix-private-access
...
Fix private access
2020-05-08 18:21:15 +03:00
Josh Junon
fbf081a306
add failing test for #4909
2020-05-08 14:26:13 +03:00
xackus
2c9effc101
stage1: handle all cases of invalid struct field default value
2020-05-07 16:39:16 -04:00
Tadeo Kondrak
84a0a9688c
update docs/tests for async/extern fn removal
2020-05-05 10:31:32 -06:00
Andrew Kelley
e6955688ac
Merge pull request #5272 from tadeokondrak/noasync-to-nosuspend
...
Noasync to nosuspend
2020-05-05 11:21:02 -04:00
Tadeo Kondrak
2c9204032d
update tests for nosuspend
2020-05-05 05:55:26 -06:00
Vexu
adc444ceeb
fix missing compile error on call assigned to const
2020-05-04 14:28:58 +03:00
xackus
0db9e90e8f
stage1: fix assert fail on opaque fn ptr param
2020-05-04 06:51:37 +02: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
Tadeo Kondrak
f977155fdb
@Vector -> std.meta.Vector
2020-04-28 00:47:13 -06:00
Tadeo Kondrak
17e41f6cd3
@OpaqueType -> @Type(.Opaque)
2020-04-28 00:02:13 -06:00
LemonBoy
a7a8c433d0
stage1: Prevent the creation of illegal ptr types
...
Closes #5140
2020-04-24 15:55:32 -04:00
xackus
a9eb4a6740
stage1: fix crash on accessing an array of size zero with runtime index
2020-04-23 12:45:32 -04:00
Vexu
b6fe839248
update std lib to decls being disallowed between fields
2020-04-18 23:56:05 +03:00
Vexu
fff00c3bbb
disallow declarations between container fields
2020-04-18 23:56:03 +03:00
Vexu
4f02cf32b4
fix typeInfo tests
2020-04-18 11:39:52 +03:00
Vexu
1afaf42525
add error for non-exter variadic functions
2020-04-17 22:02:49 +03:00
Vexu
c026a9f6d2
fix missing compile errors on builtin cast functions
2020-04-17 14:22:20 -04:00
foobles
022a71ca7d
Shift error message now says "fixed-width integer type" instead of just "integer type" ( #5028 )
...
* error message of ir_analyze_bit_shift now more accurate/specific
* fixed compile error test to match bit shift error message
2020-04-14 16:19:45 -04:00
Vexu
f60e7348d5
add error message for invalid assignment
2020-04-09 11:50:32 +03:00
Vexu
b1e44adcba
move array and struct const checks to more appropriate places
2020-04-08 14:32:02 +03:00
Vexu
ff0f97a1bc
fix missing compile error on assign to slice and array parameters
2020-04-08 00:27:14 +03:00
Vexu
95fefcd4c9
fix broken tests
2020-04-07 16:56:48 +03:00