Struct and typedef subtypes inherit dynamic functions.

This commit is contained in:
Christoffer Lerno
2025-08-23 22:31:29 +02:00
parent 48318c3ad4
commit 961aa0ef61
15 changed files with 686 additions and 470 deletions

View File

@@ -0,0 +1,27 @@
module foo;
import std;
interface Test
{
fn void x();
}
typedef Foo (Test) = int;
fn void Foo.x(&self) @dynamic
{
io::printn("Foo!");
}
enum Tester : inline Foo
{
ABC
}
fn int main()
{
Tester x;
Test t = &x; // #error: but you can use an explicit cast to
t.x();
return 0;
}