authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-10-03 19:52:39+02:00
committergravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-10-05 21:19:10+02:00
log654e0b6679f3436bacbf685223d6ab68f707a62f
tree3d643918bf5ab0e1a0754eeca210ee63cdd452e4
parent34835bbbcfe81cc87e823d14dc9b25e698ad5edc

fix(text): hyphenation and other fixes


12 files changed, 25 insertions(+), 24 deletions(-)

doc/langref.html.in+2-2
......@@ -8043,7 +8043,7 @@ fn func(y: *i32) void {
80438043 {#header_open|@mulAdd#}
80448044 <pre>{#syntax#}@mulAdd(comptime T: type, a: T, b: T, c: T) T{#endsyntax#}</pre>
80458045 <p>
8046 Fused multiply add, similar to {#syntax#}(a * b) + c{#endsyntax#}, except
8046 Fused multiply-add, similar to {#syntax#}(a * b) + c{#endsyntax#}, except
80478047 only rounds once, and is thus more accurate.
80488048 </p>
80498049 <p>
......@@ -9178,7 +9178,7 @@ pub const FloatMode = enum {
91789178 <li>Assume the arguments and result are not +/-Inf. Optimizations are required to retain defined behavior over +/-Inf, but the value of the result is undefined.</li>
91799179 <li>Treat the sign of a zero argument or result as insignificant.</li>
91809180 <li>Use the reciprocal of an argument rather than perform division.</li>
9181 <li>Perform floating-point contraction (e.g. fusing a multiply followed by an addition into a fused multiply-and-add).</li>
9181 <li>Perform floating-point contraction (e.g. fusing a multiply followed by an addition into a fused multiply-add).</li>
91829182 <li>Perform algebraically equivalent transformations that may change results in floating point (e.g. reassociate).</li>
91839183 </ul>
91849184 This is equivalent to <code>-ffast-math</code> in GCC.
lib/std/math.zig+4-3
......@@ -762,14 +762,14 @@ fn testOverflow() !void {
762762 try testing.expect((shlExact(i32, 0b11, 4) catch unreachable) == 0b110000);
763763}
764764
765/// Returns the absolute value of x, where x is a value of an integer
766/// type.
765/// Returns the absolute value of x, where x is a value of a signed integer type.
766/// See also: `absCast`
767767pub fn absInt(x: anytype) !@TypeOf(x) {
768768 const T = @TypeOf(x);
769769 comptime assert(@typeInfo(T) == .Int); // must pass an integer to absInt
770770 comptime assert(@typeInfo(T).Int.signedness == .signed); // must pass a signed integer to absInt
771771
772 if (x == minInt(@TypeOf(x))) {
772 if (x == minInt(T)) {
773773 return error.Overflow;
774774 } else {
775775 @setRuntimeSafety(false);
......@@ -977,6 +977,7 @@ pub inline fn fabs(value: anytype) @TypeOf(value) {
977977
978978/// Returns the absolute value of the integer parameter.
979979/// Result is an unsigned integer.
980/// See also: `absInt`
980981pub fn absCast(x: anytype) switch (@typeInfo(@TypeOf(x))) {
981982 .ComptimeInt => comptime_int,
982983 .Int => |int_info| std.meta.Int(.unsigned, int_info.bits),
lib/std/testing.zig+4-4
......@@ -213,8 +213,8 @@ pub fn expectFmt(expected: []const u8, comptime template: []const u8, args: anyt
213213/// This function is intended to be used only in tests. When the actual value is
214214/// not approximately equal to the expected value, prints diagnostics to stderr
215215/// to show exactly how they are not equal, then returns a test failure error.
216/// See `math.approxEqAbs` for more informations on the tolerance parameter.
217/// The types must be floating point.
216/// See `math.approxEqAbs` for more information on the tolerance parameter.
217/// The types must be floating-point.
218218pub fn expectApproxEqAbs(expected: anytype, actual: @TypeOf(expected), tolerance: @TypeOf(expected)) !void {
219219 const T = @TypeOf(expected);
220220
......@@ -245,8 +245,8 @@ test "expectApproxEqAbs" {
245245/// This function is intended to be used only in tests. When the actual value is
246246/// not approximately equal to the expected value, prints diagnostics to stderr
247247/// to show exactly how they are not equal, then returns a test failure error.
248/// See `math.approxEqRel` for more informations on the tolerance parameter.
249/// The types must be floating point.
248/// See `math.approxEqRel` for more information on the tolerance parameter.
249/// The types must be floating-point.
250250pub fn expectApproxEqRel(expected: anytype, actual: @TypeOf(expected), tolerance: @TypeOf(expected)) !void {
251251 const T = @TypeOf(expected);
252252
src/Sema.zig+6-6
......@@ -5039,7 +5039,7 @@ fn analyzeBlockBody(
50395039 const valid_rt = try sema.validateRunTimeType(child_block, type_src, resolved_ty, false);
50405040 if (!valid_rt) {
50415041 const msg = msg: {
5042 const msg = try sema.errMsg(child_block, type_src, "value with comptime only type '{}' depends on runtime control flow", .{resolved_ty.fmt(mod)});
5042 const msg = try sema.errMsg(child_block, type_src, "value with comptime-only type '{}' depends on runtime control flow", .{resolved_ty.fmt(mod)});
50435043 errdefer msg.destroy(sema.gpa);
50445044
50455045 const runtime_src = child_block.runtime_cond orelse child_block.runtime_loop.?;
......@@ -5801,12 +5801,12 @@ fn addComptimeReturnTypeNote(
58015801 break :blk func_src.toSrcLoc(src_decl);
58025802 };
58035803 if (return_ty.tag() == .generic_poison) {
5804 return sema.mod.errNoteNonLazy(src_loc, parent, "generic function is instantiated with a comptime only return type", .{});
5804 return sema.mod.errNoteNonLazy(src_loc, parent, "generic function is instantiated with a comptime-only return type", .{});
58055805 }
58065806 try sema.mod.errNoteNonLazy(
58075807 src_loc,
58085808 parent,
5809 "function is being called at comptime because it returns a comptime only type '{}'",
5809 "function is being called at comptime because it returns a comptime-only type '{}'",
58105810 .{return_ty.fmt(sema.mod)},
58115811 );
58125812 try sema.explainWhyTypeIsComptime(block, func_src, parent, src_loc, return_ty);
......@@ -6343,7 +6343,7 @@ fn analyzeInlineCallArg(
63436343 new_fn_info.param_types[arg_i.*] = param_ty;
63446344 const uncasted_arg = uncasted_args[arg_i.*];
63456345 if (try sema.typeRequiresComptime(param_ty)) {
6346 _ = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to parameter with comptime only type must be comptime known") catch |err| {
6346 _ = sema.resolveConstMaybeUndefVal(arg_block, arg_src, uncasted_arg, "argument to parameter with comptime-only type must be comptime known") catch |err| {
63476347 if (err == error.AnalysisFail and sema.err != null) {
63486348 try sema.addComptimeReturnTypeNote(arg_block, func, func_src, ret_ty, sema.err.?, comptime_only_ret_ty);
63496349 }
......@@ -8026,7 +8026,7 @@ fn funcCommon(
80268026 return sema.failWithOwnedErrorMsg(msg);
80278027 }
80288028
8029 // If the return type is comptime only but not dependent on parameters then all parameter types also need to be comptime
8029 // If the return type is comptime-only but not dependent on parameters then all parameter types also need to be comptime
80308030 if (!sema.is_generic_instantiation and has_body and ret_ty_requires_comptime) comptime_check: {
80318031 for (block.params.items) |param| {
80328032 if (!param.is_comptime) break;
......@@ -8035,7 +8035,7 @@ fn funcCommon(
80358035 const msg = try sema.errMsg(
80368036 block,
80378037 ret_ty_src,
8038 "function with comptime only return type '{}' requires all parameters to be comptime",
8038 "function with comptime-only return type '{}' requires all parameters to be comptime",
80398039 .{return_type.fmt(sema.mod)},
80408040 );
80418041 try sema.explainWhyTypeIsComptime(block, ret_ty_src, msg, ret_ty_src.toSrcLoc(sema.owner_decl), return_type);
src/type.zig+1-1
......@@ -2318,7 +2318,7 @@ pub const Type = extern union {
23182318 /// * the type has only one possible value, making its ABI size 0.
23192319 /// - an enum with an explicit tag type has the ABI size of the integer tag type,
23202320 /// making it one-possible-value only if the integer tag type has 0 bits.
2321 /// When `ignore_comptime_only` is true, then types that are comptime only
2321 /// When `ignore_comptime_only` is true, then types that are comptime-only
23222322 /// may return false positives.
23232323 pub fn hasRuntimeBitsAdvanced(
23242324 ty: Type,
test/behavior/array.zig+1-1
......@@ -564,7 +564,7 @@ test "type coercion of pointer to anon struct literal to pointer to array" {
564564 comptime try S.doTheTest();
565565}
566566
567test "array with comptime only element type" {
567test "array with comptime-only element type" {
568568 const a = [_]type{ u32, i32 };
569569 try testing.expect(a[0] == u32);
570570 try testing.expect(a[1] == i32);
test/cases/compile_errors/error_in_typeof_param.zig+1-1
......@@ -11,4 +11,4 @@ pub export fn entry() void {
1111// target=native
1212//
1313// :6:31: error: unable to resolve comptime value
14// :6:31: note: argument to parameter with comptime only type must be comptime known
14// :6:31: note: argument to parameter with comptime-only type must be comptime known
test/cases/compile_errors/explain_why_fn_is_called_at_comptime.zig+1-1
......@@ -18,6 +18,6 @@ pub export fn entry() void {
1818//
1919// :12:13: error: unable to resolve comptime value
2020// :12:13: note: argument to function being called at comptime must be comptime known
21// :7:25: note: function is being called at comptime because it returns a comptime only type 'tmp.S'
21// :7:25: note: function is being called at comptime because it returns a comptime-only type 'tmp.S'
2222// :2:12: note: struct requires comptime because of this field
2323// :2:12: note: use '*const fn() void' for a function pointer type
test/cases/compile_errors/explain_why_generic_fn_is_called_at_comptime.zig+1-1
......@@ -19,4 +19,4 @@ pub export fn entry() void {
1919//
2020// :14:13: error: unable to resolve comptime value
2121// :14:13: note: argument to function being called at comptime must be comptime known
22// :9:38: note: generic function is instantiated with a comptime only return type
22// :9:38: note: generic function is instantiated with a comptime-only return type
test/cases/compile_errors/non-const_switch_number_literal.zig+1-1
......@@ -14,5 +14,5 @@ fn bar() i32 {
1414// backend=stage2
1515// target=native
1616//
17// :2:15: error: value with comptime only type 'comptime_int' depends on runtime control flow
17// :2:15: error: value with comptime-only type 'comptime_int' depends on runtime control flow
1818// :2:26: note: runtime control flow here
test/cases/compile_errors/non_comptime_param_in_comptime_function.zig+2-2
......@@ -26,10 +26,10 @@ export fn entry2() void {
2626// backend=stage2
2727// target=native
2828//
29// :1:20: error: function with comptime only return type 'type' requires all parameters to be comptime
29// :1:20: error: function with comptime-only return type 'type' requires all parameters to be comptime
3030// :1:20: note: types are not available at runtime
3131// :1:6: note: param 'val' is required to be comptime
32// :11:16: error: function with comptime only return type 'tmp.S' requires all parameters to be comptime
32// :11:16: error: function with comptime-only return type 'tmp.S' requires all parameters to be comptime
3333// :9:10: note: struct requires comptime because of this field
3434// :9:10: note: use '*const fn() void' for a function pointer type
3535// :11:8: note: param is required to be comptime
test/compile_errors.zig+1-1
......@@ -204,7 +204,7 @@ pub fn addCases(ctx: *TestContext) !void {
204204 , &[_][]const u8{
205205 ":3:12: error: unable to resolve comptime value",
206206 ":3:12: note: argument to function being called at comptime must be comptime known",
207 ":2:55: note: generic function is instantiated with a comptime only return type",
207 ":2:55: note: generic function is instantiated with a comptime-only return type",
208208 });
209209 }
210210