| author | |
| committer | |
| log | c42763f8cc9223fc43ac3478a5f15d4bd9f438e4 |
| tree | 8dc9c3e3cf9f6e5ebb4308da37142c70df947fb4 |
| parent | 57e1f6a89f044e731fe60ce15e98b496dcbaa74f |
Related: #96307 files changed, 15 insertions(+), 6 deletions(-)
lib/std/math/ln.zig+1-1| ... | ... | @@ -32,7 +32,7 @@ pub fn ln(x: anytype) @TypeOf(x) { |
| 32 | 32 | return @as(comptime_int, math.floor(ln_64(@as(f64, x)))); |
| 33 | 33 | }, |
| 34 | 34 | .Int => |IntType| switch (IntType.signedness) { |
| 35 | .signed => return @compileError("ln not implemented for signed integers"), | |
| 35 | .signed => @compileError("ln not implemented for signed integers"), | |
| 36 | 36 | .unsigned => return @as(T, math.floor(ln_64(@as(f64, x)))), |
| 37 | 37 | }, |
| 38 | 38 | else => @compileError("ln not implemented for " ++ @typeName(T)), |
lib/std/math/log.zig+1-1| ... | ... | @@ -29,7 +29,7 @@ pub fn log(comptime T: type, base: T, x: T) T { |
| 29 | 29 | |
| 30 | 30 | // TODO implement integer log without using float math |
| 31 | 31 | .Int => |IntType| switch (IntType.signedness) { |
| 32 | .signed => return @compileError("log not implemented for signed integers"), | |
| 32 | .signed => @compileError("log not implemented for signed integers"), | |
| 33 | 33 | .unsigned => return @floatToInt(T, math.floor(math.ln(@intToFloat(f64, x)) / math.ln(float_base))), |
| 34 | 34 | }, |
| 35 | 35 |
lib/std/math/log10.zig+1-1| ... | ... | @@ -33,7 +33,7 @@ pub fn log10(x: anytype) @TypeOf(x) { |
| 33 | 33 | return @as(comptime_int, math.floor(log10_64(@as(f64, x)))); |
| 34 | 34 | }, |
| 35 | 35 | .Int => |IntType| switch (IntType.signedness) { |
| 36 | .signed => return @compileError("log10 not implemented for signed integers"), | |
| 36 | .signed => @compileError("log10 not implemented for signed integers"), | |
| 37 | 37 | .unsigned => return @floatToInt(T, math.floor(log10_64(@intToFloat(f64, x)))), |
| 38 | 38 | }, |
| 39 | 39 | else => @compileError("log10 not implemented for " ++ @typeName(T)), |
lib/std/math/log2.zig+1-1| ... | ... | @@ -39,7 +39,7 @@ pub fn log2(x: anytype) @TypeOf(x) { |
| 39 | 39 | return result; |
| 40 | 40 | }, |
| 41 | 41 | .Int => |IntType| switch (IntType.signedness) { |
| 42 | .signed => return @compileError("log2 not implemented for signed integers"), | |
| 42 | .signed => @compileError("log2 not implemented for signed integers"), | |
| 43 | 43 | .unsigned => return math.log2_int(T, x), |
| 44 | 44 | }, |
| 45 | 45 | else => @compileError("log2 not implemented for " ++ @typeName(T)), |
lib/std/math/sqrt.zig+1-1| ... | ... | @@ -26,7 +26,7 @@ pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) { |
| 26 | 26 | return @as(T, sqrt_int(u128, x)); |
| 27 | 27 | }, |
| 28 | 28 | .Int => |IntType| switch (IntType.signedness) { |
| 29 | .signed => return @compileError("sqrt not implemented for signed integers"), | |
| 29 | .signed => @compileError("sqrt not implemented for signed integers"), | |
| 30 | 30 | .unsigned => return sqrt_int(T, x), |
| 31 | 31 | }, |
| 32 | 32 | else => @compileError("sqrt not implemented for " ++ @typeName(T)), |
src/AstGen.zig+1-1| ... | ... | @@ -5963,7 +5963,7 @@ fn ret(gz: *GenZir, scope: *Scope, node: Ast.Node.Index) InnerError!Zir.Inst.Ref |
| 5963 | 5963 | } else .{ |
| 5964 | 5964 | .ty = try gz.addNodeExtended(.ret_type, node), |
| 5965 | 5965 | }; |
| 5966 | const operand = try expr(gz, scope, rl, operand_node); | |
| 5966 | const operand = try reachableExpr(gz, scope, rl, operand_node, node); | |
| 5967 | 5967 | |
| 5968 | 5968 | switch (nodeMayEvalToError(tree, operand_node)) { |
| 5969 | 5969 | .never => { |
test/compile_errors.zig+9| ... | ... | @@ -4999,6 +4999,15 @@ pub fn addCases(ctx: *TestContext) !void { |
| 4999 | 4999 | "tmp.zig:2:5: note: control flow is diverted here", |
| 5000 | 5000 | }); |
| 5001 | 5001 | |
| 5002 | ctx.objErrStage1("unreachable code - return return", | |
| 5003 | \\export fn a() i32 { | |
| 5004 | \\ return return 1; | |
| 5005 | \\} | |
| 5006 | , &[_][]const u8{ | |
| 5007 | "tmp.zig:2:5: error: unreachable code", | |
| 5008 | "tmp.zig:2:12: note: control flow is diverted here", | |
| 5009 | }); | |
| 5010 | ||
| 5002 | 5011 | ctx.objErrStage1("bad import", |
| 5003 | 5012 | \\const bogus = @import("bogus-does-not-exist.zig",); |
| 5004 | 5013 | , &[_][]const u8{ |