688 Commits

Author SHA1 Message Date
Veikka Tuominen
57f9405a8f Sema: validate bitcast operand type 2022-08-01 23:37:01 +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
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
Veikka Tuominen
9e0a930ce3 stage2: add error for comptime control flow in runtime block 2022-07-29 10:08:35 +03:00
Andrew Kelley
bdaa915a02 test-cases: remove failing test
This causes a stack overflow in a debug build of stage3 unfortunately. I
will open an issue to track this test coverage, which we absolutely
should get working - users of the compiler should get a compile error,
not a segfault if they hit the default branch quota from abusing
recursive inline functions.

Note that the problem does not occur in a release build of stage3
which has significantly reduced stack usage.

On Linux, I tried bumping up the stack size from 32 MiB to 64 MiB and it
did not solve the problem. I'm not sure why not. It seems like it should
be fine.

Note that we also have a problem of running test-cases in multi-threaded
mode which is currently the default. Currently Zig threads are spawned
with 16 MiB stack space.
2022-07-26 20:12:40 -07:00
Andrew Kelley
c8c798685f
Merge pull request #12244 from Vexu/stage2
Minor stage2 fixes
2022-07-26 17:41:26 -07:00
Veikka Tuominen
d6e3988fe8 Sema: better error when coercing error sets 2022-07-26 23:29:54 +03:00
Veikka Tuominen
5d99e5ecd4 Sema: improve expression value ignored error
Closes #4483
2022-07-26 16:40:24 +03:00
Veikka Tuominen
3d18c8c130 Sema: resolve lazy values for compile log
Close #12204
2022-07-26 16:40:24 +03:00
Veikka Tuominen
d78532f462 Sema: give comptime_field_ptr priority over field_ptr in tuples
Closes #11983
2022-07-26 16:40:24 +03:00
Veikka Tuominen
a463dc7d6c AstGen: disable null bytes and empty stings in some places
Namely:
 * test names
 * identifiers
 * library names
 * import strings
2022-07-26 12:14:59 +03:00
Veikka Tuominen
825fc654b6 Sema: better source location for builtin options 2022-07-26 12:14:59 +03:00
Veikka Tuominen
28478a4bac Module: improve handling of errors in @call arguments 2022-07-26 12:14:59 +03:00
Meghan
dea437edfb
stage2: implement noinline fn 2022-07-24 11:56:33 +03:00
Andreas Reischuck
903bed931d report better error for package not found in stage2 2022-07-24 11:55:37 +03:00
Veikka Tuominen
2436dd2c1b Sema: validate duplicate fields in anon structs 2022-07-23 15:40:12 +03:00
Veikka Tuominen
5b29275240 Sema: add some more 'declared here' notes 2022-07-23 15:40:12 +03:00
Veikka Tuominen
15dddfd84d AstGen: make comptime fields in packed and extern structs compile errors 2022-07-23 15:40:12 +03:00
Veikka Tuominen
585c160c20 Sema: handle store to comptime field when ResultLoc == .none 2022-07-23 15:40:12 +03:00
Veikka Tuominen
9465906775 Sema: return .comptime_field_ptrs for tuples 2022-07-23 15:40:12 +03:00
Veikka Tuominen
cf87026e52 Sema: @alignCast safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
ff7ec4efb5 Sema: bad union field access safety 2022-07-23 15:40:11 +03:00
Veikka Tuominen
423a19fa60 Sema: add error for dereferencing invalid payload ptr at comptime 2022-07-22 21:10:50 +03:00
Veikka Tuominen
8a488fcdb8 Sema: validate empty array init 2022-07-22 17:03:42 +03:00
Andrew Kelley
25f3be32db Sema: fix fn pointer align disagrees with fn align error
Check the specified function alignment rather than the effective
function alignment.
2022-07-21 15:19:56 -07:00
Andrew Kelley
fc6e111b76 Sema: improve compile error for bad function alignment
* Integrate more declaratively with src/target.zig
 * Only trigger the check when a function body is found, do not trigger
   for function types.
2022-07-21 13:55:29 -07:00
Andrew Kelley
b946934576 build.zig: 32 MiB stack size
This gives more headroom for comptime recursion, especially for debug
builds of Zig.
2022-07-21 12:23:33 -07:00
Andrew Kelley
644baa0f5b constrain target/backend of new test cases
avoids testing stuff that doesn't work yet.
2022-07-21 12:21:30 -07:00
Veikka Tuominen
794beafb9c Sema: validate extern struct field types earlier
`validateExternType` does not require the type to be resolved so we can
check it earlier. Only doing it in `resolveTypeFully` lead to worse or
missing compile errors.
2022-07-21 12:21:30 -07:00
Veikka Tuominen
821e4063f9 Sema: better source location for function call args 2022-07-21 12:21:30 -07:00
Veikka Tuominen
79ef0cdf30 Sema: better function parameter source location 2022-07-21 12:21:30 -07:00
Veikka Tuominen
83b2d2cd3e Sema: better source location for incompatible capture group 2022-07-21 12:21:30 -07:00
Veikka Tuominen
9fb8d21a01 AstGen: add error for fields in opaque types 2022-07-21 12:21:30 -07:00
Veikka Tuominen
1705a21f80 Sema: more union and enum tag type validation 2022-07-21 12:21:30 -07:00
Veikka Tuominen
8feb398760 Sema: validate function parameter types and return type 2022-07-21 12:21:30 -07:00
Veikka Tuominen
d851b24180 Sema: validate function pointer alignment 2022-07-21 12:21:30 -07:00
Veikka Tuominen
76e7959a90 Sema: explain why comptime is needed 2022-07-21 12:21:30 -07:00
Veikka Tuominen
195c3cd89f fix errors in tests not tested locally or on CI 2022-07-21 12:21:30 -07:00
Veikka Tuominen
d729173204 stage2: better pointer source location 2022-07-21 12:21:30 -07:00
Veikka Tuominen
29815fe9de Sema: disallow 'align' on functions on wasm 2022-07-21 12:21:30 -07:00
Veikka Tuominen
62120e3d0e Sema: fix non-exhaustive union switch checks 2022-07-21 12:21:30 -07:00
Andrew Kelley
7d2e142679
Merge pull request #12044 from Vexu/stage2-compile-errors
Sema: add detailed error notes to `coerceInMemoryAllowed`
2022-07-11 20:45:27 -04:00
Veikka Tuominen
d00da05ecb Sema: validate extern types 2022-07-11 18:47:29 +03:00
Veikka Tuominen
3ceb27c840 Sema: better explanation why opaque types require comptime 2022-07-11 18:47:29 +03:00
Veikka Tuominen
20d4f7213d Sema: add notes about function return type 2022-07-11 17:55:19 +03:00
Veikka Tuominen
c9e1360cdb Sema: add "cannot convert to payload type" error notes 2022-07-11 14:17:22 +03:00
Veikka Tuominen
0370006c1f Sema: only add note about int mismatch if not coercible
`unsigned 64-bit int cannot represent all possible unsigned 63-bit values`
is nonsensical.
2022-07-11 11:59:26 +03:00