Skip to content

Commit f41f00c

Browse files
Resolve unknown parameter type as unknown type (not value)
1 parent 856c3fb commit f41f00c

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/analysis.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,7 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, node_handle: NodeWithHandle) e
23502350
else => unreachable,
23512351
}
23522352
}
2353-
break :param_type Type.fromIP(analyser, InternPool.Index.unknown_type, null);
2353+
break :param_type Type.fromIP(analyser, .type_type, .unknown_type);
23542354
};
23552355

23562356
try parameters.append(analyser.arena.allocator(), .{
@@ -2368,7 +2368,7 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, node_handle: NodeWithHandle) e
23682368
if (try analyser.resolveReturnTypeInternal(handle, fn_proto)) |ty| {
23692369
break :blk ty;
23702370
}
2371-
return null;
2371+
break :blk Type.fromIP(analyser, .type_type, .unknown_type);
23722372
};
23732373

23742374
const info: Type.Data.Function = .{

tests/analysis/function.zig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const Unknown: type = undefined;
2+
3+
fn unknown_parameter_type(_: Unknown) void {}
4+
// ^^^^^^^^^^^^^^^^^^^^^^ (fn ((unknown type)) void)()
5+
6+
fn unknown_return_type() Unknown {}
7+
// ^^^^^^^^^^^^^^^^^^^ (fn () (unknown type))()

0 commit comments

Comments
 (0)