4680 Commits

Author SHA1 Message Date
Veikka Tuominen
74673b7f69 stage2 llvm: implement more C ABI 2022-08-10 20:52:36 -04:00
Andrew Kelley
4d7f5a1917 stage2: fix crash with comptime vector reduce 2022-08-10 16:45:29 -07:00
Andrew Kelley
3c4e9b5983 disable failing behavior test
See #12360
2022-08-10 16:43:47 -07:00
Andrew Kelley
173952f4b8 disable failing behavior test
see tracking issue #12396
2022-08-10 16:13:59 -07:00
Andrew Kelley
e0178890ba
Merge pull request #12379 from ifreund/packed-struct-explicit-backing-int
stage2: Implement explicit backing integers for packed structs
2022-08-10 19:13:29 -04:00
InKryption
e218b7ea0c stage2: add compile error for invalid null/undefined pointer cast 2022-08-10 16:39:46 -04:00
LeRoyce Pearson
0e118ed0ac stage2: add compile error for shlExact overflow
- moves a stage1 test case and makes it target `llvm` backend instead
  of `stage1` backend
2022-08-10 16:14:30 -04:00
Veikka Tuominen
40447b25e8 Sema: fix expansion of repeated value
Closes #12386
2022-08-10 15:18:09 -04:00
Isaac Freund
0d32b73078
stage2: Implement explicit backing integers for packed structs
Now the backing integer of a packed struct type may be explicitly
specified with e.g. `packed struct(u32) { ... }`.
2022-08-10 19:54:45 +02:00
Isaac Freund
bb1c3e8b7e
stage2: Handle lazy values for the % operator 2022-08-10 14:48:27 +02:00
Veikka Tuominen
b757a96d5c Sema: add declared here note to function call errors 2022-08-09 23:37:26 +03:00
Veikka Tuominen
0fd90749d1 stage2: generate call arguments in separate blocks 2022-08-09 16:19:55 +03:00
Andrew Kelley
85a3f9b054
Merge pull request #12383 from ziglang/stage2-stack-traces
several improvements to error return tracing in the self-hosted compiler
2022-08-09 02:11:58 -07:00
Veikka Tuominen
c76b5c1a31 stage2: correct node offset of nested declarations 2022-08-09 11:59:10 +03:00
Andrew Kelley
feb90f6ed4 AstGen: emit debug stmt for try
This improves the following test case:

```zig
pub fn main() !void {
    try foo();
}

fn foo() !void {
    return error.Bad;
}
```

The error return trace now points to the `try` token instead of pointing
to the foo() function call, matching stage1.

Closes #12308.
2022-08-08 21:12:04 -07:00
Veikka Tuominen
d769fd0102 stage2: pass anon name strategy to reify 2022-08-08 18:28:39 -07:00
Andrew Kelley
ec7f713147 delete failing RISC-V test
this backend needs to get further along before it deserves test
coverage.
2022-08-07 16:07:25 -07:00
Andrew Kelley
11c715cd5a remove brittle test case
see #12358
2022-08-07 16:07:21 -07:00
Meghan Denny
0879cbeed2 remove 'builtin.stage2_arch', Sema is smart enough now 2022-08-07 16:07:08 -07:00
Andrew Kelley
b3d463c9e6
Merge pull request #12337 from Vexu/stage2-safety
Stage2: implement remaining runtime safety checks
2022-08-06 14:59:10 -07:00
Anton Lilja
86d9c3de2b
Sema: fix infinite recursion in explainWhyTypeIsComptime
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-08-06 14:17:09 +03:00
Andrew Kelley
5c9826630d Sema: elide safety of modulus and remainder division sometimes
Piggybacking on 40f8f0134f5da9baaefd0fdab529d5585fa46199, remainder
division, modulus, and `%` syntax no longer emit safety checks for a
comptime-known denominator.
2022-08-05 21:13:18 -07:00
Veikka Tuominen
f46d7304b1 stage2: add runtime safety for invalid enum values 2022-08-05 22:13:58 +03:00
Veikka Tuominen
19d5ffc710 Sema: add safety check for non-power-of-two shift amounts 2022-08-05 22:13:58 +03:00
Veikka Tuominen
9116e26c1f Sema: add null check for implicit casts 2022-08-05 22:13:58 +03:00
Veikka Tuominen
5605f6e0e3 Sema: account for sentinel in bounds check 2022-08-05 22:13:57 +03:00
Veikka Tuominen
6aa438f065 Sema: add null pointer slice safety check when len is comptime known 2022-08-05 22:13:57 +03:00
Veikka Tuominen
eec2978fac Sema: better safety check on switch on corrupt value 2022-08-05 22:13:57 +03:00
Meredith Oleander
fd3415ad5e
translate-c: fix alignment in pointer casts 2022-08-05 15:38:48 +03:00
Loris Cro
259f407160 init-exe template: align cli tests to new template 2022-08-05 00:42:53 +02:00
Veikka Tuominen
4ab60dc18b Sema: add error for dependency loops 2022-08-03 17:10:39 +03:00
Veikka Tuominen
b79929b2ea AstGen: better source location for if/while condition unwrapping 2022-08-03 16:45:33 +03:00
Veikka Tuominen
d1d24b426d AstGen: check loop bodies and else branches for unused result 2022-08-03 16:45:33 +03:00
Veikka Tuominen
aa78ebaf95 Sema: improve circular dependency errors 2022-08-03 16:45:33 +03:00
Veikka Tuominen
02112f8836 AstGen: add error for break/continue out of defer expression 2022-08-03 16:45:33 +03:00
Veikka Tuominen
6547c3887e Sema: add error for closure capture at runtime 2022-08-03 16:45:33 +03:00
Veikka Tuominen
14f0b70570 Sema: add safety for sentinel slice 2022-08-02 18:34:30 +03:00
Veikka Tuominen
292906fb23 Sema: fix reify Fn alignment and args 2022-08-02 18:33:03 +03:00
Veikka Tuominen
e47706f344 Sema: validate packed struct field types 2022-08-01 23:59:40 +03:00
Veikka Tuominen
f1768b40b2 stage2: better source location for var decls 2022-08-01 23:37:01 +03:00
Veikka Tuominen
57f9405a8f Sema: validate bitcast operand type 2022-08-01 23:37:01 +03:00
Andrew Kelley
1ab15b6c9c
Merge pull request #12289 from Vexu/stage2
Stage2: reify functions + fixes
2022-07-31 12:57:53 -07:00
Evan Haas
8632e4fc7b translate-c: use correct number of initializers for vectors
Fixes #12264
2022-07-30 13:24:03 +03:00
Veikka Tuominen
02dc073260 Sema: check comptime slice sentinel 2022-07-30 11:07:37 +03:00
Veikka Tuominen
4758752e5d Sema: implement coercion from tuples to tuples
Closes #12242
2022-07-30 00:18:08 +03:00
Veikka Tuominen
17622b9db1 Sema: implement @Type for functions
Closes #12280
2022-07-30 00:18:08 +03:00
Veikka Tuominen
f43ea43ac9 stage2: fix hashing of struct values
Closes #12279
2022-07-30 00:17:49 +03:00
Andrew Kelley
1b1c70ce38 disable failing incremental compilation test case
see #12288

now `zig build test-cases -Denable-llvm` passes locally for me.
2022-07-29 02:35:06 -07:00
Andrew Kelley
daac39364a fix compile error test case note column number 2022-07-29 02:35:06 -07:00
Veikka Tuominen
fdaf9c40d6 stage2: handle tuple init edge cases 2022-07-29 10:12:36 +03:00