4860 Commits

Author SHA1 Message Date
John Schmidt
b6bda5183e sema: load the correct AST in failWithInvalidComptimeFieldStore
The container we want to get the fields from might not be declared in the
same file as the block we are analyzing, so we should get the AST from
the decl's file instead.
2022-09-26 08:56:34 +02:00
John Schmidt
6cc2b26163 sema: load the correct AST in addFieldErrNote
The enum we want to get the fields from might not be declared in the
same file as the block we are analyzing, so we should get the AST from
the decl's file instead.

Closes #12950.
2022-09-25 10:28:48 +02:00
Veikka Tuominen
c4400e8aa5 AstGen: reset anon_name_strategy for sub expressions
Closes  #12910
2022-09-24 16:30:37 +03:00
Veikka Tuominen
8e4d0ae4f5 Sema: avoid generic parameter error in nested function type
Related to cd1833044ab7505bc101c85f59889bd3ea3fac80
Closes #12945
2022-09-24 15:15:36 +03:00
Veikka Tuominen
3a5148112d Sema: avoid using pointerDecl when dealing with slices
Closes #12885
2022-09-24 14:43:03 +03:00
Veikka Tuominen
3525b8778e Sema: properly handle generic struct as parameter type
Closes #12907
2022-09-24 14:43:03 +03:00
Veikka Tuominen
ede3798485 Sema: resolve struct layout in zirStructInit
Closes #12911
2022-09-23 17:39:21 +03:00
Veikka Tuominen
581df942e1 Sema: correct sentinel check on implicit cast from array ptr
Closes #12938
2022-09-23 17:39:06 +03:00
Veikka Tuominen
3de5c3b503 Sema: check for slices in packed and extern type validation
Closes #12930
2022-09-23 17:39:06 +03:00
Veikka Tuominen
8d1fdfc8ed Sema: preserve volatileness when constructing field pointers
Closes #12928
2022-09-23 17:39:06 +03:00
kkHAIKE
4961044ce8 AstGen: store void to ptr result loc when there is no else branch 2022-09-21 20:21:02 +03:00
kkHAIKE
183127733c AstGen: make loop body's ResultLoc .none
Fixes #12555
Fixes #12551
Fixes #12455
2022-09-21 20:20:05 +03:00
Jacob Young
14f4c73191 sema: fix typo 2022-09-21 11:29:20 +02:00
Veikka Tuominen
694fab4848 std: add return address parameter to panic fn 2022-09-20 19:05:00 -07:00
Veikka Tuominen
8f2e82dbf6 safety: show error return trace when unwrapping error in switch 2022-09-20 19:05:00 -07:00
Veikka Tuominen
3e80aa9079 Sema: validate @alignOf type 2022-09-20 00:50:13 +03:00
Veikka Tuominen
540130650f Sema: pass calculated offset to elemPtrType in elemPtrSlice 2022-09-20 00:50:13 +03:00
Veikka Tuominen
541b3e3a31 Sema: check pointer qualifiers before implicit cast
Closes #12881
2022-09-20 00:50:13 +03:00
Veikka Tuominen
fb91483e48 Sema: do not use coerceCompatiblePtr for ptrCast 2022-09-19 18:34:53 +03:00
Veikka Tuominen
e584558bd8 Sema: do not use coerceCompatiblePtr for alignCast
Closes  #12902
2022-09-19 18:34:52 +03:00
Jakub Konka
54854e2ab8 add removed expected stdout comparison in link test 2022-09-18 09:28:46 +02:00
Jakub Konka
0030e72d53 use EmulatableRunStep for newly added macho link test
Reverts 75e9a8c7fabb1f32753960b9114dcee875256351
2022-09-18 09:22:49 +02:00
Andrew Kelley
75e9a8c7fa skip macho link test execution on non-macOS
2c3d87b168bf522f538e78325fdae71c320e6e20 introduced a new test that
passes on macOS but fails on other operating systems. This commit makes
it only run on macOS.
2022-09-17 21:33:19 -07:00
Jakub Konka
437ddcce7a test-cases: remove removed "note: referenced here" note from the error 2022-09-17 23:38:40 +02:00
Jakub Konka
2c3d87b168 macho: test empty translation units 2022-09-17 18:43:24 +02:00
Veikka Tuominen
b2aedb0709
Merge pull request #12796 from Vexu/referenced-by-v2
stage2: add referenced by trace to compile errors attempt #2 (+ some fixes)
2022-09-16 23:49:00 +03:00
Andrew Kelley
8edd7219c0 Sema: improve source location after as_node is used
+2 more passing compile error tests
2022-09-16 14:47:17 -04:00
Andrew Kelley
9f4408d68b organize some compile error tests
Many of these tests check for the incorrect behavior of stage1 whereas
self-hosted correctly does not emit an error, so they are simply
deleted.

The remaining number of test cases within the stage1/ subdirectory is
reduced from 143 to 103.
2022-09-15 14:40:45 -04:00
Koakuma
0910cb6fcb stage2: sparc64: Skip compile-failing tests for now 2022-09-14 16:58:12 -07:00
Koakuma
2263bba6cd stage2: sparc64: Skip Sema-failing tests for now 2022-09-14 16:57:31 -07:00
Andrew Kelley
d7a0fe67b3 disable spuriously failing test on Windows
See tracking issue #12844
2022-09-14 16:12:55 -07:00
Veikka Tuominen
31daea74d2 stage2: implement referenced by trace for error messages
Closes #7668
Closes #12141
2022-09-15 00:50:18 +03:00
Veikka Tuominen
5e4483fff8 Sema: handle comptime fields in field call bind
Closes #12801
2022-09-15 00:50:18 +03:00
Veikka Tuominen
5e37da6ade Sema: check_comptime_control_flow needs to check runtime_index 2022-09-15 00:50:18 +03:00
Veikka Tuominen
bf4a3df9a9 Sema: allow runtime break from inline loop
Closes #12787
2022-09-15 00:48:47 +03:00
Veikka Tuominen
002260c274 Sema: copy runtime_index & friends when making child blocks 2022-09-15 00:48:47 +03:00
Veikka Tuominen
6f6b14621d value: hash extern functions
Closes #12766
2022-09-15 00:48:47 +03:00
Veikka Tuominen
930f904aaa Sema: resolve lazy align in reifyStruct
Closes #12786
2022-09-15 00:48:47 +03:00
Veikka Tuominen
de24cea2cf Sema: handle empty_struct_value in beginComptimePtrMutation
Closes #12794
2022-09-15 00:48:47 +03:00
Veikka Tuominen
349d78a443 validate number literals in AstGen 2022-09-13 20:26:04 -04:00
Andrew Kelley
0a4cfb81bc Merge remote-tracking branch 'origin/master' into llvm15 2022-09-13 13:50:25 -07:00
Andrew Kelley
f9859c102d fix libc++ exceptions for musl targets
This reverts commit d31be31267523cadd6d59b52633f2d4a9758a3b4.

The problem was happening due to an LLVM bug exposed by having LTO
enabled for libunwind. The simple workaround is to disable LTO for
libunwind. It can be re-enabled in the future when the upstream bug
is fixed.

See #12828
2022-09-13 11:38:14 -07:00
Andrew Kelley
b2e94de358 add compile error test for pointless discards 2022-09-13 10:01:17 -07:00
Andrew Kelley
ebd082d3f6 remove pointless discards in test cases 2022-09-13 02:04:20 -07:00
Andrew Kelley
f8a9bc57ce translate-c: lower discards differently
This makes translate-c lower discards as `_ = @TypeOf(foo);` to avoid
tripping the "pointless discard" error.

Ideally, translate-c would avoid emitting pointless discards, in which
case this commit can be reverted, however, that is a separate
enhancement.
2022-09-13 02:04:20 -07:00
Andrew Kelley
d31be31267 disable failing c++ test
See tracking issue #12828
2022-09-12 23:16:57 -07:00
Andrew Kelley
f16855b9d7 remove pointless discards 2022-09-12 18:13:24 -07:00
Andrew Kelley
011663eea5 Merge remote-tracking branch 'origin/master' into llvm15 2022-09-12 16:11:18 -07:00
Andrew Kelley
01e89fec71 disable LLVM 15 regressed behavior test: "vector @splat"
See #12827
2022-09-12 16:02:31 -07:00
Veikka Tuominen
e323cf1264 stage2: change how defers are stored in Zir
Storing defers this way has the benefits that the defer doesn't get
analyzed multiple times in AstGen, it takes up less space, and it
makes Sema aware of defers allowing for 'unreachable else prong'
error on error sets in generic code.

The disadvantage is that it is a bit more complex and errdefers with
payloads now emit a placeholder instruction (but those are rare).

Sema.zig before:
  Total ZIR bytes:    3.7794370651245117MiB
  Instructions:       238996 (2.051319122314453MiB)
  String Table Bytes: 89.2802734375KiB
  Extra Data Items:   430144 (1.640869140625MiB)
Sema.zig after:
  Total ZIR bytes:    3.3344192504882812MiB
  Instructions:       211829 (1.8181428909301758MiB)
  String Table Bytes: 89.2802734375KiB
  Extra Data Items:   374611 (1.4290275573730469MiB)
2022-09-12 01:52:44 -04:00