| author | |
| committer | |
| log | 0ea51f7f494cd84a48fd997b60196d6c4254ccac |
| tree | 16e37b2d217f7ea6418b04d37542b5f937351e34 |
| parent | 6c045f9e83434e98fbfbd7c511e673274cb22afc |
| parent | b96d5fd71f12a56ba97c6ca36e47a7cbceee9696 |
| signature |
stage2: fix a couple issues with peer resolution and const casting arrays2 files changed, 14 insertions(+), 6 deletions(-)
src/Sema.zig+4-4| ... | @@ -18270,7 +18270,7 @@ fn resolvePeerTypes( | ... | @@ -18270,7 +18270,7 @@ fn resolvePeerTypes( |
| 18270 | 18270 | ||
| 18271 | convert_to_slice = false; | 18271 | convert_to_slice = false; |
| 18272 | 18272 | ||
| 18273 | if (chosen_ty.childType().isConstPtr() and !candidate_ty.childType().isConstPtr()) | 18273 | if (chosen_ty.isConstPtr() and !candidate_ty.isConstPtr()) |
| 18274 | seen_const = true; | 18274 | seen_const = true; |
| 18275 | 18275 | ||
| 18276 | continue; | 18276 | continue; |
| ... | @@ -18282,7 +18282,7 @@ fn resolvePeerTypes( | ... | @@ -18282,7 +18282,7 @@ fn resolvePeerTypes( |
| 18282 | chosen_ty_tag == .Pointer and | 18282 | chosen_ty_tag == .Pointer and |
| 18283 | chosen_ty.ptrSize() == .Many) | 18283 | chosen_ty.ptrSize() == .Many) |
| 18284 | { | 18284 | { |
| 18285 | if (candidate_ty.childType().isConstPtr() and !chosen_ty.childType().isConstPtr()) | 18285 | if (candidate_ty.isConstPtr() and !chosen_ty.isConstPtr()) |
| 18286 | seen_const = true; | 18286 | seen_const = true; |
| 18287 | 18287 | ||
| 18288 | continue; | 18288 | continue; |
| ... | @@ -18303,7 +18303,7 @@ fn resolvePeerTypes( | ... | @@ -18303,7 +18303,7 @@ fn resolvePeerTypes( |
| 18303 | convert_to_slice = false; // it already is a slice | 18303 | convert_to_slice = false; // it already is a slice |
| 18304 | 18304 | ||
| 18305 | // If the pointer is const then we need to const | 18305 | // If the pointer is const then we need to const |
| 18306 | if (candidate_ty.childType().isConstPtr()) | 18306 | if (candidate_ty.isConstPtr()) |
| 18307 | seen_const = true; | 18307 | seen_const = true; |
| 18308 | 18308 | ||
| 18309 | continue; | 18309 | continue; |
| ... | @@ -18326,7 +18326,7 @@ fn resolvePeerTypes( | ... | @@ -18326,7 +18326,7 @@ fn resolvePeerTypes( |
| 18326 | convert_to_slice = false; // it already is a slice | 18326 | convert_to_slice = false; // it already is a slice |
| 18327 | 18327 | ||
| 18328 | // If the prev pointer is const then we need to const | 18328 | // If the prev pointer is const then we need to const |
| 18329 | if (chosen_child_ty.isConstPtr()) | 18329 | if (chosen_ty.isConstPtr()) |
| 18330 | seen_const = true; | 18330 | seen_const = true; |
| 18331 | 18331 | ||
| 18332 | continue; | 18332 | continue; |
test/behavior/cast.zig+10-2| ... | @@ -964,7 +964,11 @@ test "cast between C pointer with different but compatible types" { | ... | @@ -964,7 +964,11 @@ test "cast between C pointer with different but compatible types" { |
| 964 | } | 964 | } |
| 965 | 965 | ||
| 966 | test "peer type resolve string lit with sentinel-terminated mutable slice" { | 966 | test "peer type resolve string lit with sentinel-terminated mutable slice" { |
| 967 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | 967 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 968 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 969 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 970 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 971 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 968 | 972 | ||
| 969 | var array: [4:0]u8 = undefined; | 973 | var array: [4:0]u8 = undefined; |
| 970 | array[4] = 0; // TODO remove this when #4372 is solved | 974 | array[4] = 0; // TODO remove this when #4372 is solved |
| ... | @@ -981,7 +985,11 @@ test "peer type resolve array pointers, one of them const" { | ... | @@ -981,7 +985,11 @@ test "peer type resolve array pointers, one of them const" { |
| 981 | } | 985 | } |
| 982 | 986 | ||
| 983 | test "peer type resolve array pointer and unknown pointer" { | 987 | test "peer type resolve array pointer and unknown pointer" { |
| 984 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | 988 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 989 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 990 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 991 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 992 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | ||
| 985 | 993 | ||
| 986 | const const_array: [4]u8 = undefined; | 994 | const const_array: [4]u8 = undefined; |
| 987 | var array: [4]u8 = undefined; | 995 | var array: [4]u8 = undefined; |