Veikka Tuominen
9f055e2eb0
Sema: improve compile error for tuple coercion mismatch
2022-11-23 22:16:31 +02:00
Veikka Tuominen
8eea73fb92
add tests for tuple declarations
2022-11-23 22:16:31 +02:00
Veikka Tuominen
9e276d32f3
Sema: fix memory management of missing field error
...
Closes #13590
2022-11-20 20:25:12 +02:00
Veikka Tuominen
835a1f7f0c
Sema: fix missing error on mismatched array init count
...
Closes #13582
2022-11-20 20:25:12 +02:00
Veikka Tuominen
034507ef7c
Module: fix compile error for non-comptime-known global initializer
2022-11-20 20:25:12 +02:00
Veikka Tuominen
bc76873827
Sema: fix type check in zirIntToPtr
...
Simple fix: don't assume a ptr type before it has been checked.
Closes #13567
2022-11-20 20:25:11 +02:00
mparadinha
c4f7663c92
Fix error reporting the wrong line for struct field inits ( #13502 )
...
* point to init part of field delc when that's where the error occurs
* update test to reflect fixed error message
* only lookup source location in case of error
2022-11-15 15:17:23 +02:00
Veikka Tuominen
0a188190b3
AstGen: make pointless discard error more strict
...
The error should only happen as a result of `_ = <expr>` not
for an operand of a break expression that is discarded.
Closes #13212
2022-11-11 17:59:53 +02:00
Veikka Tuominen
89e8bb409a
AstGen: use condbr_inline if force_comptime is set
...
The `finishThenElseBlock` would correctly use `break_inline`
which would cause Sema to use `addRuntimeBreak` instead of
doing the branch at comptime.
2022-11-11 17:59:53 +02:00
Veikka Tuominen
dc128f403b
Merge pull request #13446 from Vexu/stage2-fixes
...
Stage2 bug fixes
2022-11-07 14:17:26 +02:00
Veikka Tuominen
ea48f06fc2
stage2: address of threadlocal variable is not comptime known
...
Closes #13215
2022-11-05 13:22:21 +02:00
Veikka Tuominen
f92e7bed7b
stage2: bitsize of packed struct should trigger backing int ty check
...
Closes #13398
2022-11-05 12:54:38 +02:00
Andrew Kelley
1d68045919
Merge pull request #13101 from alichraghi/o4
2022-11-05 02:34:24 -04:00
Veikka Tuominen
e6b3cb5043
Sema: detect division overflow
...
Closes #13434
2022-11-04 23:13:29 +02:00
Ali Chraghi
f5f1f8c666
all: rename i386 to x86
2022-11-04 00:09:27 +03:30
Veikka Tuominen
d7314555f2
Sema: improve compile error for casting double pointer to anyopaque pointer
...
Closes #12042
2022-10-29 14:55:43 +03:00
Veikka Tuominen
61f5ea4c9a
Sema: add error note for wrong pointer dereference syntax
...
Closes #1897
2022-10-29 14:55:43 +03:00
Veikka Tuominen
c3b85e4e2f
Sema: further enhance explanation of why expr is evaluated at comptime
2022-10-28 13:31:16 +03:00
Andrew Kelley
c389f8800b
Merge pull request #13290 from Vexu/generic-deletion-mitigation
...
Mitigate generic deletion bug
2022-10-28 01:04:00 -04:00
Andrew Kelley
2991e4a454
Merge pull request #13288 from Vexu/opt-slice
...
Optimize size of optional slices (+ some fixes)
2022-10-27 22:09:17 -04:00
InKryption
bc72ae5e4e
Sema: Prevent coercion from tuple pointer to mutable slice.
...
Also fix some stdlib code affected by this.
Co-authored by: topolarity <topolarity@tapscott.me>
2022-10-27 22:00:47 -04:00
Veikka Tuominen
648d34d8ea
Sema: coerce zero-bit generic args are coerced properly
...
Closes #13307
2022-10-27 13:40:20 +03:00
Veikka Tuominen
d9fe5ba7f8
Sema: add error for too big packed struct
2022-10-27 01:31:18 +03:00
Veikka Tuominen
b12a5cea75
remove test case triggering generic deletion bug
...
This test should be restored once the underlying issue is resolved (with the typo fixed).
2022-10-27 01:31:05 +03:00
Veikka Tuominen
c95a34b68f
stage2: improve source location of assignment
2022-10-20 20:11:00 +03:00
Veikka Tuominen
34e4b07d0c
Sema: allow runtime only instructions to be emitted in outside functions
...
It is possible to get comptime-known values from runtime-known values
for example the length of array. Allowing runtime only instructions to
be emitted outside function bodies allows these operations to happen.
In places where comptime-known values are required we have other methods
to ensure that and they usually result in more specific compile errors too.
Closes #12240
2022-10-20 20:11:00 +03:00
Veikka Tuominen
3a8777a8bb
fix hyphenation in test case
...
Follow up to 51d9db856978610c24b3fed50a9550455a2eb64b
2022-10-12 16:10:57 +03:00
Andrew Kelley
7ce1ee1bce
Merge pull request #13081 from r00ster91/docs
...
fix(text): hyphenation and other fixes
2022-10-12 05:26:11 -04:00
Veikka Tuominen
b316c25cc6
Merge pull request #13075 from Vexu/stage2-fixes
...
Stage2 misc fixes
2022-10-10 23:27:17 +02:00
Veikka Tuominen
3ccd4907fb
Sema: add error for capturing a runtime value outside of function scope
...
Closes #13104
2022-10-08 16:58:54 +03:00
Veikka Tuominen
1500b9ddc3
Sema: restore sema.src after inline call
...
Closes #13099
2022-10-08 16:58:26 +03:00
Veikka Tuominen
4a6cc1c602
Sema: allow equality comparisons between error unions and error sets
...
Closes #1302
2022-10-07 11:04:02 +03:00
Veikka Tuominen
29ae6515f3
AstGen: use 'shadows' instead of 'redeclaration' when names are in different scopes
...
Closes #8532
2022-10-07 11:04:02 +03:00
Ali Chraghi
6672921e32
Sema: fix error location when casting pointer to slice
...
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-10-06 21:18:01 +03:00
Veikka Tuominen
dffce98045
Sema: disallow using stage1 fn ptrs in extern contexts
...
Closes #13022
2022-10-06 20:09:45 +03:00
Veikka Tuominen
775e055b59
Sema: generic function instantiation inherits parent's branch quota
...
Closes #12624
2022-10-06 20:09:45 +03:00
Veikka Tuominen
94039d66ed
Sema: disallow fieldParentPtr and offsetOf on comptime fields
...
Comptime fields are tied to the type and behave more like declarations
so these operations cannot return anything useful for them.
2022-10-06 20:09:45 +03:00
Veikka Tuominen
0b1dd845d9
stage2: add error for non-void error union payload being ignored
...
See https://github.com/ziglang/zig/pull/6060#discussion_r471032912
2022-10-06 15:39:06 +03:00
r00ster91
8e2aaf6aed
fix(text): hyphenate "runtime" adjectives
2022-10-05 21:33:42 +02:00
r00ster91
51d9db8569
fix(text): hyphenate "comptime" adjectives
2022-10-05 21:19:30 +02:00
r00ster91
654e0b6679
fix(text): hyphenation and other fixes
2022-10-05 21:19:10 +02:00
Veikka Tuominen
c0350cf87e
Sema: avoid passing undefined as reason to failWithNeededComptime
...
Closes #13046
2022-10-05 17:26:29 +03:00
Andrew Kelley
ff534d2267
Merge pull request #12979 from Vexu/inline-switch
...
Implement inline switch cases
2022-10-03 23:43:09 -04:00
Jacob Young
9d8cdb855b
Sema: fix function paramater count mismatch note
...
expected type 'fn() void', found 'fn(i32) void'
function with 0 parameters cannot cast into a function with 0 parameters
=>
expected type 'fn() void', found 'fn(i32) void'
function with 1 parameters cannot cast into a function with 0 parameters
2022-10-03 13:06:49 +03:00
Julian
32d755beb8
Sema: require reified packed struct fields to have zero alignment
2022-10-03 13:05:12 +03:00
Veikka Tuominen
b3c6d774d2
stage2: improve error message for missing member in file root struct
...
* the root struct decl name is fully qualified
this prevents error messages containing 'main.main'
* avoid declared here note when file struct is missing a member
It always points at the start of the file which might contain another
container misleading the user.
2022-09-30 00:09:24 +03:00
Igor Anić
9f6f460124
Sema: improve source location in errors
...
resolves #12793
2022-09-29 14:45:08 +03:00
Jacob G-W
0a064eae99
stage2: detect duplicate enum values
...
Closes #12805
2022-09-28 12:48:54 +03:00
InKryption
c75e8f3616
Sema: check that reified enum field values fits tag type.
2022-09-27 18:38:37 +03:00
Veikka Tuominen
950a0e2405
Sema: implement inline else for errors enums and bools
2022-09-27 18:33:23 +03:00