authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-08-27 23:07:39+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-09-03 15:05:10+03:00
log9a59cdcd41f5a05d70a02d89178afaf8789791c6
tree041051ba83a2aefef9e769c5438e7dc6a4021eae
parentfb3c5b84ede6fa48949c8069bf735ac67ec21091
signaturelock-open Commit is signed but in an unrecognized format.

stage2: various small type fixes


4 files changed, 20 insertions(+), 8 deletions(-)

src-self-hosted/Module.zig+6
...@@ -2801,6 +2801,12 @@ pub fn resolvePeerTypes(self: *Module, scope: *Scope, instructions: []*Inst) !Ty...@@ -2801,6 +2801,12 @@ pub fn resolvePeerTypes(self: *Module, scope: *Scope, instructions: []*Inst) !Ty
2801 prev_inst = next_inst;2801 prev_inst = next_inst;
2802 continue;2802 continue;
2803 }2803 }
2804 if (next_inst.ty.zigTypeTag() == .Undefined)
2805 continue;
2806 if (prev_inst.ty.zigTypeTag() == .Undefined) {
2807 prev_inst = next_inst;
2808 continue;
2809 }
2804 if (prev_inst.ty.isInt() and2810 if (prev_inst.ty.isInt() and
2805 next_inst.ty.isInt() and2811 next_inst.ty.isInt() and
2806 prev_inst.ty.isSignedInt() == next_inst.ty.isSignedInt())2812 prev_inst.ty.isSignedInt() == next_inst.ty.isSignedInt())
src-self-hosted/type.zig+5-5
...@@ -163,7 +163,7 @@ pub const Type = extern union {...@@ -163,7 +163,7 @@ pub const Type = extern union {
163 // Hot path for common case:163 // Hot path for common case:
164 if (a.castPointer()) |a_payload| {164 if (a.castPointer()) |a_payload| {
165 if (b.castPointer()) |b_payload| {165 if (b.castPointer()) |b_payload| {
166 return eql(a_payload.pointee_type, b_payload.pointee_type);166 return a.tag() == b.tag() and eql(a_payload.pointee_type, b_payload.pointee_type);
167 }167 }
168 }168 }
169 const is_slice_a = isSlice(a);169 const is_slice_a = isSlice(a);
...@@ -189,7 +189,7 @@ pub const Type = extern union {...@@ -189,7 +189,7 @@ pub const Type = extern union {
189 .Array => {189 .Array => {
190 if (a.arrayLen() != b.arrayLen())190 if (a.arrayLen() != b.arrayLen())
191 return false;191 return false;
192 if (a.elemType().eql(b.elemType()))192 if (!a.elemType().eql(b.elemType()))
193 return false;193 return false;
194 const sentinel_a = a.arraySentinel();194 const sentinel_a = a.arraySentinel();
195 const sentinel_b = b.arraySentinel();195 const sentinel_b = b.arraySentinel();
...@@ -501,9 +501,9 @@ pub const Type = extern union {...@@ -501,9 +501,9 @@ pub const Type = extern union {
501 .noreturn,501 .noreturn,
502 => return out_stream.writeAll(@tagName(t)),502 => return out_stream.writeAll(@tagName(t)),
503503
504 .enum_literal => return out_stream.writeAll("@TypeOf(.EnumLiteral)"),504 .enum_literal => return out_stream.writeAll("@Type(.EnumLiteral)"),
505 .@"null" => return out_stream.writeAll("@TypeOf(null)"),505 .@"null" => return out_stream.writeAll("@Type(.Null)"),
506 .@"undefined" => return out_stream.writeAll("@TypeOf(undefined)"),506 .@"undefined" => return out_stream.writeAll("@Type(.Undefined)"),
507507
508 .@"anyframe" => return out_stream.writeAll("anyframe"),508 .@"anyframe" => return out_stream.writeAll("anyframe"),
509 .anyerror_void_error_union => return out_stream.writeAll("anyerror!void"),509 .anyerror_void_error_union => return out_stream.writeAll("anyerror!void"),
src-self-hosted/value.zig+3-3
...@@ -301,15 +301,15 @@ pub const Value = extern union {...@@ -301,15 +301,15 @@ pub const Value = extern union {
301 .comptime_int_type => return out_stream.writeAll("comptime_int"),301 .comptime_int_type => return out_stream.writeAll("comptime_int"),
302 .comptime_float_type => return out_stream.writeAll("comptime_float"),302 .comptime_float_type => return out_stream.writeAll("comptime_float"),
303 .noreturn_type => return out_stream.writeAll("noreturn"),303 .noreturn_type => return out_stream.writeAll("noreturn"),
304 .null_type => return out_stream.writeAll("@TypeOf(null)"),304 .null_type => return out_stream.writeAll("@Type(.Null)"),
305 .undefined_type => return out_stream.writeAll("@TypeOf(undefined)"),305 .undefined_type => return out_stream.writeAll("@Type(.Undefined)"),
306 .fn_noreturn_no_args_type => return out_stream.writeAll("fn() noreturn"),306 .fn_noreturn_no_args_type => return out_stream.writeAll("fn() noreturn"),
307 .fn_void_no_args_type => return out_stream.writeAll("fn() void"),307 .fn_void_no_args_type => return out_stream.writeAll("fn() void"),
308 .fn_naked_noreturn_no_args_type => return out_stream.writeAll("fn() callconv(.Naked) noreturn"),308 .fn_naked_noreturn_no_args_type => return out_stream.writeAll("fn() callconv(.Naked) noreturn"),
309 .fn_ccc_void_no_args_type => return out_stream.writeAll("fn() callconv(.C) void"),309 .fn_ccc_void_no_args_type => return out_stream.writeAll("fn() callconv(.C) void"),
310 .single_const_pointer_to_comptime_int_type => return out_stream.writeAll("*const comptime_int"),310 .single_const_pointer_to_comptime_int_type => return out_stream.writeAll("*const comptime_int"),
311 .const_slice_u8_type => return out_stream.writeAll("[]const u8"),311 .const_slice_u8_type => return out_stream.writeAll("[]const u8"),
312 .enum_literal_type => return out_stream.writeAll("@TypeOf(.EnumLiteral)"),312 .enum_literal_type => return out_stream.writeAll("@Type(.EnumLiteral)"),
313 .anyframe_type => return out_stream.writeAll("anyframe"),313 .anyframe_type => return out_stream.writeAll("anyframe"),
314314
315 .null_value => return out_stream.writeAll("null"),315 .null_value => return out_stream.writeAll("null"),
src-self-hosted/zir_sema.zig+6
...@@ -1239,6 +1239,12 @@ fn analyzeInstArithmetic(mod: *Module, scope: *Scope, inst: *zir.Inst.BinOp) Inn...@@ -1239,6 +1239,12 @@ fn analyzeInstArithmetic(mod: *Module, scope: *Scope, inst: *zir.Inst.BinOp) Inn
12391239
1240 if (casted_lhs.value()) |lhs_val| {1240 if (casted_lhs.value()) |lhs_val| {
1241 if (casted_rhs.value()) |rhs_val| {1241 if (casted_rhs.value()) |rhs_val| {
1242 if (lhs_val.isUndef() or rhs_val.isUndef()) {
1243 return mod.constInst(scope, inst.base.src, .{
1244 .ty = resolved_type,
1245 .val = Value.initTag(.undef),
1246 });
1247 }
1242 return analyzeInstComptimeOp(mod, scope, scalar_type, inst, lhs_val, rhs_val);1248 return analyzeInstComptimeOp(mod, scope, scalar_type, inst, lhs_val, rhs_val);
1243 }1249 }
1244 }1250 }