aboutsummaryrefslogtreecommitdiff
path: root/test/cases/generics.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-05-31 10:56:59 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-05-31 17:28:07 -0400
commitfcbb7426faac5e693ef195defe2d8d2a2eddadb1 (patch)
treed34d161ccdbdacb0d0177b79aeb54605f9a49bd3 /test/cases/generics.zig
parent717ac85a5acb5e6ae063c4d0eb3b8f1bd260776a (diff)
downloadzig-fcbb7426faac5e693ef195defe2d8d2a2eddadb1.tar.gz
zig-fcbb7426faac5e693ef195defe2d8d2a2eddadb1.zip
use * for pointer type instead of &
See #770 To help automatically translate code, see the zig-fmt-pointer-reform-2 branch. This will convert all & into *. Due to the syntax ambiguity (which is why we are making this change), even address-of & will turn into *, so you'll have to manually fix thes instances. You will be guaranteed to get compile errors for them - expected 'type', found 'foo'
Diffstat (limited to 'test/cases/generics.zig')
-rw-r--r--test/cases/generics.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/cases/generics.zig b/test/cases/generics.zig
index 37cd1b89e4..a76990e2a1 100644
--- a/test/cases/generics.zig
+++ b/test/cases/generics.zig
@@ -96,8 +96,8 @@ test "generic struct" {
fn GenNode(comptime T: type) type {
return struct {
value: T,
- next: ?&GenNode(T),
- fn getVal(n: &const GenNode(T)) T {
+ next: ?*GenNode(T),
+ fn getVal(n: *const GenNode(T)) T {
return n.value;
}
};
@@ -126,11 +126,11 @@ test "generic fn with implicit cast" {
13,
}) == 0);
}
-fn getByte(ptr: ?&const u8) u8 {
+fn getByte(ptr: ?*const u8) u8 {
return (??ptr).*;
}
fn getFirstByte(comptime T: type, mem: []const T) u8 {
- return getByte(@ptrCast(&const u8, &mem[0]));
+ return getByte(@ptrCast(*const u8, &mem[0]));
}
const foos = []fn (var) bool{