aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorManlio Perillo <manlio.perillo@gmail.com>2022-12-12 09:03:51 +0100
committerAndrew Kelley <andrew@ziglang.org>2022-12-13 15:00:42 -0500
commit89a9e927ad97bf1ef5f45a0a004dd2d46390e441 (patch)
treef92edbd710b92884e43f1dab502c0bb3fa3ab010 /doc
parent1d5368fa35740f64d81f755588edc5c6698036ec (diff)
downloadzig-89a9e927ad97bf1ef5f45a0a004dd2d46390e441.tar.gz
zig-89a9e927ad97bf1ef5f45a0a004dd2d46390e441.zip
langref: improve the test_fn_reflection.zig doctest
Currently, the test_fn_reflection.zig doctest has an example of .Fn.is_var_args. This example can confuse the reader, since there is no documentation about variadic functions and is_var_args is mainly used in the compiler. Remove the example with .Fn.is_var_args and add instead examples with .Fn.return_type and .Fn.is_generic.
Diffstat (limited to 'doc')
-rw-r--r--doc/langref.html.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in
index 868de8f1aa..c163575cbd 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -5246,11 +5246,15 @@ test "fn type inference" {
{#header_close#}
{#header_open|Function Reflection#}
{#code_begin|test|test_fn_reflection#}
-const expect = @import("std").testing.expect;
+const std = @import("std");
+const math = std.math;
+const testing = std.testing;
test "fn reflection" {
- try expect(@typeInfo(@TypeOf(expect)).Fn.args[0].arg_type.? == bool);
- try expect(@typeInfo(@TypeOf(expect)).Fn.is_var_args == false);
+ try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.args[0].arg_type.? == bool);
+ try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).Fn.return_type.? == testing.TmpDir);
+
+ try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).Fn.is_generic);
}
{#code_end#}
{#header_close#}