New method resolution.

This commit is contained in:
Christoffer Lerno
2025-08-15 19:00:44 +02:00
committed by Christoffer Lerno
parent 34b0b6f8f9
commit 4b95d6be4c
19 changed files with 440 additions and 482 deletions

View File

@@ -27,11 +27,11 @@ Bar y = { 1 };
fn int test()
{
x.get1(); // #error: method
x.get1();
x.get2();
x.get3(); // #error: method
y.get1(); // #error: method
x.get3();
y.get1();
y.get2();
y.get3(); // #error: method
y.get3();
return 1;
}

View File

@@ -29,9 +29,9 @@ fn int test()
{
x.get1();
x.get2();
x.get3(); // #error: method
x.get3();
y.get1();
y.get2();
y.get3(); // #error: method
y.get3();
return 1;
}

View File

@@ -1,12 +1,15 @@
struct Foo { int a; }
struct Foo2 { int a; }
struct Foo3 { int a; }
struct Bar { int a; }
fn int Foo.x(&self, int x) @operator([]) => 1;
fn int Foo.y(&self, int x) @operator(&[]) => 1; // #error: The return type must be a pointer
fn int Foo2.y(&self, int x) @operator([]) => null;
fn int** Foo2.y2(&self, int x) @operator(&[]) => null; // #error: There is a mismatch of the 'value' type
fn void Foo.z(&self, uint x, int a) @operator([]=) {} // #error: There is a mismatch of the 'index'
fn int Foo3.x(&self, int x) @operator([]) => 1;
fn void Foo3.z(&self, uint x, int a) @operator([]=) {} // #error: There is a mismatch of the 'index'
fn double Bar.x(&self, int x) @operator([]) => 0.1;
fn void Bar.y(&self, int x, float y) @operator([]=) {} // #error: There is a mismatch of the 'value'