Commit Graph

4 Commits

Author SHA1 Message Date
Andrew Kelley
5479c0f9ac C backend: fix @boolToInt 2021-10-28 17:33:05 -07:00
Andrew Kelley
6ae0825e7f Sema: implement comptime variables
Sema now properly handles alloc_inferred and alloc_inferred_mut ZIR
instructions inside a comptime execution context. In this case it
creates Decl objects and points to them with the new `decl_ref_mut`
Value Tag. `storePtr` is updated to mutate such Decl types and values.
In this case it destroys the old arena and makes a new one, preventing
memory growth during comptime code execution.

Additionally:

 * Fix `storePtr` to emit a compile error for a pointer comptime-known
   to be undefined.
 * Fix `storePtr` to emit runtime instructions for all the cases that a
   pointer is comptime-known but does not support comptime
   dereferencing, such as `@intToPtr` on a hard-coded address, or an
   extern function.
 * Fix `ret_coerce` not coercing inside inline function call context.
2021-08-01 12:36:04 -07:00
Andrew Kelley
5619ce2406 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * doc/langref.html.in
 * lib/std/enums.zig
 * lib/std/fmt.zig
 * lib/std/hash/auto_hash.zig
 * lib/std/math.zig
 * lib/std/mem.zig
 * lib/std/meta.zig
 * test/behavior/alignof.zig
 * test/behavior/bitcast.zig
 * test/behavior/bugs/1421.zig
 * test/behavior/cast.zig
 * test/behavior/ptrcast.zig
 * test/behavior/type_info.zig
 * test/behavior/vector.zig

Master branch added `try` to a bunch of testing function calls, and some
lines also had changed how to refer to the native architecture and other
`@import("builtin")` stuff.
2021-05-08 14:45:21 -07:00
Andrew Kelley
4307436b99 move behavior tests from test/stage1/ to test/
And fix test cases to make them pass. This is in preparation for
starting to pass behavior tests with self-hosted.
2021-04-29 15:54:04 -07:00