Type: remove arbitrary restrictions on param and return types
Opaque and `noreturn` makes sense since they don't represent real values, but `null` and `undefined` are perfectly normal comptime-only values. Closes #16088
This commit is contained in:
committed by
Andrew Kelley
parent
e2eabbbc51
commit
a257e33fff
@@ -4,11 +4,6 @@ export fn entry1() void {
|
||||
_ = someFuncPtr;
|
||||
}
|
||||
|
||||
export fn entry2() void {
|
||||
const someFuncPtr: fn (@TypeOf(null)) void = undefined;
|
||||
_ = someFuncPtr;
|
||||
}
|
||||
|
||||
fn foo(p: FooType) void {
|
||||
_ = p;
|
||||
}
|
||||
@@ -16,20 +11,11 @@ export fn entry3() void {
|
||||
_ = foo;
|
||||
}
|
||||
|
||||
fn bar(p: @TypeOf(null)) void {
|
||||
_ = p;
|
||||
}
|
||||
export fn entry4() void {
|
||||
_ = bar;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage2
|
||||
// target=native
|
||||
//
|
||||
// :3:28: error: parameter of opaque type 'tmp.FooType' not allowed
|
||||
// :1:17: note: opaque declared here
|
||||
// :8:28: error: parameter of type '@TypeOf(null)' not allowed
|
||||
// :12:8: error: parameter of opaque type 'tmp.FooType' not allowed
|
||||
// :7:8: error: parameter of opaque type 'tmp.FooType' not allowed
|
||||
// :1:17: note: opaque declared here
|
||||
// :19:8: error: parameter of type '@TypeOf(null)' not allowed
|
||||
|
||||
Reference in New Issue
Block a user