| ... | ... | @@ -2511,7 +2511,7 @@ test "null terminated array" { |
| 2511 | 2511 | and vectors. Zig provides the {#link|@splat#} builtin to easily convert from scalars |
| 2512 | 2512 | to vectors, and it supports {#link|@reduce#} and array indexing syntax to convert |
| 2513 | 2513 | from vectors to scalars. Vectors also support assignment to and from fixed-length |
| 2514 | | arrays with comptime known length. |
| 2514 | arrays with comptime-known length. |
| 2515 | 2515 | </p> |
| 2516 | 2516 | <p> |
| 2517 | 2517 | For rearranging elements within and between vectors, Zig provides the {#link|@shuffle#} and {#link|@select#} functions. |
| ... | ... | @@ -2557,7 +2557,7 @@ test "Conversion between vectors, arrays, and slices" { |
| 2557 | 2557 | var offset: u32 = 1; |
| 2558 | 2558 | // To extract a comptime-known length from a runtime-known offset, |
| 2559 | 2559 | // first extract a new slice from the starting offset, then an array of |
| 2560 | | // comptime known length |
| 2560 | // comptime-known length |
| 2561 | 2561 | const vec3: @Vector(2, f32) = slice[offset..][0..2].*; |
| 2562 | 2562 | try expectEqual(slice[offset], vec2[0]); |
| 2563 | 2563 | try expectEqual(slice[offset + 1], vec2[1]); |
| ... | ... | @@ -3013,7 +3013,7 @@ test "slice pointer" { |
| 3013 | 3013 | |
| 3014 | 3014 | {#header_open|Sentinel-Terminated Slices#} |
| 3015 | 3015 | <p> |
| 3016 | | The syntax {#syntax#}[:x]T{#endsyntax#} is a slice which has a runtime known length |
| 3016 | The syntax {#syntax#}[:x]T{#endsyntax#} is a slice which has a runtime-known length |
| 3017 | 3017 | and also guarantees a sentinel value at the element indexed by the length. The type does not |
| 3018 | 3018 | guarantee that there are no sentinel elements before that. Sentinel-terminated slices allow element |
| 3019 | 3019 | access to the {#syntax#}len{#endsyntax#} index. |
| ... | ... | @@ -3233,7 +3233,7 @@ test "default struct initialization fields" { |
| 3233 | 3233 | .b = 5, |
| 3234 | 3234 | }; |
| 3235 | 3235 | if (x.a + x.b != 1239) { |
| 3236 | | @compileError("it's even comptime known!"); |
| 3236 | @compileError("it's even comptime-known!"); |
| 3237 | 3237 | } |
| 3238 | 3238 | } |
| 3239 | 3239 | {#code_end#} |
| ... | ... | @@ -4257,7 +4257,7 @@ fn isFieldOptional(comptime T: type, field_index: usize) !bool { |
| 4257 | 4257 | const fields = @typeInfo(T).Struct.fields; |
| 4258 | 4258 | return switch (field_index) { |
| 4259 | 4259 | // This prong is analyzed `fields.len - 1` times with `idx` being an |
| 4260 | | // unique comptime known value each time. |
| 4260 | // unique comptime-known value each time. |
| 4261 | 4261 | inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].field_type) == .Optional, |
| 4262 | 4262 | else => return error.IndexOutOfBounds, |
| 4263 | 4263 | }; |
| ... | ... | @@ -4352,8 +4352,8 @@ const U = union(enum) { |
| 4352 | 4352 | |
| 4353 | 4353 | fn getNum(u: U) u32 { |
| 4354 | 4354 | switch (u) { |
| 4355 | | // Here `num` is a runtime known value that is either |
| 4356 | | // `u.a` or `u.b` and `tag` is `u`'s comptime known tag value. |
| 4355 | // Here `num` is a runtime-known value that is either |
| 4356 | // `u.a` or `u.b` and `tag` is `u`'s comptime-known tag value. |
| 4357 | 4357 | inline else => |num, tag| { |
| 4358 | 4358 | if (tag == .b) { |
| 4359 | 4359 | return @floatToInt(u32, num); |
| ... | ... | @@ -6399,7 +6399,7 @@ test "coercion to error unions" { |
| 6399 | 6399 | const std = @import("std"); |
| 6400 | 6400 | const expect = std.testing.expect; |
| 6401 | 6401 | |
| 6402 | | test "coercing large integer type to smaller one when value is comptime known to fit" { |
| 6402 | test "coercing large integer type to smaller one when value is comptime-known to fit" { |
| 6403 | 6403 | const x: u64 = 255; |
| 6404 | 6404 | const y: u8 = x; |
| 6405 | 6405 | try expect(y == 255); |