Commit Graph

9 Commits

Author SHA1 Message Date
Andrew Kelley
af536ac343 introduce new test syntax
* remove setFnTest builtin
 * add test "name" { ... } syntax
 * remove --check-unused argument. functions are always lazy now.
2017-03-16 16:02:35 -04:00
Andrew Kelley
1195994880 fix inability to write to global in some cases
before, when we initialized a variable by copying the
initialization value, it made the internal const value
references point to a duplicate value, resulting in
a phony duplicate global value being updated instead of
the real on. now the behavior is as expected.

thanks to hoppetosse for pointing out this bug on IRC.
2017-02-27 00:07:11 -05:00
Andrew Kelley
25761570f1 more robust const struct values 2017-02-26 23:50:04 -05:00
Andrew Kelley
6dba1f1c8e slice and array re-work plus some misc. changes
* `@truncate` builtin allows casting to the same size integer.
   It also performs two's complement casting between signed and
   unsigned integers.
 * The idiomatic way to convert between bytes and numbers is now
   `mem.readInt` and `mem.writeInt` instead of an unsafe cast.
   It works at compile time, is safer, and looks cleaner.
 * Implicitly casting an array to a slice is allowed only if the
   slice is const.
 * Constant pointer values know if their memory is from a compile-
   time constant value or a compile-time variable.
 * Cast from [N]u8 to []T no longer allowed, but [N]u8 to []const T
   still allowed.
 * Fix inability to pass a mutable pointer to comptime variable at
   compile-time to a function and have the function modify the
   memory pointed to by the pointer.
 * Add the `comptime T: type` parameter back to mem.eql. Prevents
   accidentally creating instantiations for arrays.
2017-02-12 17:35:51 -05:00
Andrew Kelley
8a859afd58 std.io supports printing integers as hex values
remove "unnecessary if statement" error
this "depends on compile variable" code is too hard to validate,
and has false negatives. not worth it right now.

std.str removed, instead use std.mem.

std.mem.eql and std.mem.sliceEql merged and do not require explicit
type argument.
2017-02-07 17:23:50 -05:00
Andrew Kelley
e5b1758010 remove staticEval builtin in favor of comptime expression 2017-01-22 23:21:00 -05:00
Andrew Kelley
3b5e26b7f7 self hosted tests import std library 2017-01-05 03:57:48 -05:00
Andrew Kelley
aee7ad3de2 IR: port all passing tests over 2016-12-26 03:44:59 -05:00
Andrew Kelley
6c9ec3688e IR testing: rename cases3 dir to cases 2016-12-26 02:49:30 -05:00