Refactor protocols.

This commit is contained in:
Christoffer Lerno
2023-10-06 20:29:20 +02:00
committed by Christoffer Lerno
parent f3e3aa231d
commit 99cfaa1583
98 changed files with 756 additions and 590 deletions

View File

@@ -4,22 +4,22 @@ protocol TestProto
}
struct Foo { int a; }
struct Foo (TestProto) { int a; }
fn int! Foo.test(Foo* f) : TestProto { return 1; } // #error: The prototype method has a return type 'int'
fn int! Foo.test(Foo* f) @dynamic { return 1; } // #error: The prototype method has a return type 'int'
struct Foo1 { int a; }
struct Foo1 (TestProto) { int a; }
fn int Foo1.test(Foo1* f, int a) : TestProto { return 1; }
fn int Foo1.test(Foo1* f, int a) @dynamic { return 1; }
struct Foo2 { int a; }
struct Foo2 (TestProto) { int a; }
fn int Foo2.test(Foo2* f) : TestProto { return 1; } // #error: This function is missing parameters, 2
fn int Foo2.test(Foo2* f) @dynamic { return 1; } // #error: This function is missing parameters, 2
struct Foo3 { int a; }
struct Foo3 (TestProto) { int a; }
fn int Foo3.test(Foo3* f, double a) : TestProto { return 1; } // #error: The prototype argument has type 'int'
fn int Foo3.test(Foo3* f, double a) @dynamic { return 1; } // #error: The prototype argument has type 'int'
struct Foo4 { int a; }
struct Foo4 (TestProto) { int a; }
fn int Foo4.test(Foo4* f, double a, int x) : TestProto { return 1; } // #error: This function has too many parameters
fn int Foo4.test(Foo4* f, double a, int x) @dynamic { return 1; } // #error: This function has too many parameters