remove type coercion from array values to references

* Implements #3768. This is a sweeping breaking change that requires
   many (trivial) edits to Zig source code. Array values no longer
   coerced to slices; however one may use `&` to obtain a reference to
   an array value, which may then be coerced to a slice.

 * Adds `IrInstruction::dump`, for debugging purposes. It's useful to
   call to inspect the instruction when debugging Zig IR.

 * Fixes bugs with result location semantics. See the new behavior test
   cases, and compile error test cases.

 * Fixes bugs with `@typeInfo` not properly resolving const values.

 * Behavior tests are passing but std lib tests are not yet. There
   is more work to do before merging this branch.
This commit is contained in:
Andrew Kelley
2019-11-27 03:30:39 -05:00
parent 379d547603
commit bf3ac66150
67 changed files with 727 additions and 837 deletions

View File

@@ -22,7 +22,7 @@ pub fn PriorityQueue(comptime T: type) type {
/// `fn lessThan(a: T, b: T) bool { return a < b; }`
pub fn init(allocator: *Allocator, compareFn: fn (a: T, b: T) bool) Self {
return Self{
.items = [_]T{},
.items = &[_]T{},
.len = 0,
.allocator = allocator,
.compareFn = compareFn,