aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-07-27 15:25:21 +0300
committerVeikka Tuominen <git@vexu.eu>2022-07-27 18:27:17 +0300
commit793db63746ca044927743ee94405dad2a3f02fb8 (patch)
treeeba9986d8448894a37a262b0f4f790818c02690e /test
parent3818d63dd8b29596e4c3d2499463b7519258a611 (diff)
downloadzig-793db63746ca044927743ee94405dad2a3f02fb8.tar.gz
zig-793db63746ca044927743ee94405dad2a3f02fb8.zip
Sema: copy fn param ty in `zirTypeInfo`
Closes #12247
Diffstat (limited to 'test')
-rw-r--r--test/cases/fn_typeinfo_passed_to_comptime_fn.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/cases/fn_typeinfo_passed_to_comptime_fn.zig b/test/cases/fn_typeinfo_passed_to_comptime_fn.zig
new file mode 100644
index 0000000000..29f1d0c67b
--- /dev/null
+++ b/test/cases/fn_typeinfo_passed_to_comptime_fn.zig
@@ -0,0 +1,17 @@
+const std = @import("std");
+
+test {
+ try foo(@typeInfo(@TypeOf(someFn)));
+}
+
+fn someFn(arg: ?*c_int) f64 {
+ _ = arg;
+ return 8;
+}
+fn foo(comptime info: std.builtin.Type) !void {
+ try std.testing.expect(info.Fn.args[0].arg_type.? == ?*c_int);
+}
+
+// run
+// is_test=1
+//