Make methods be available in earlier stages of analysis. Add @adhoc attribute to allow types with ad hoc generic declarations.

This commit is contained in:
Christoffer Lerno
2024-09-25 14:26:49 +02:00
parent 6f7ffbeb3c
commit da47588502
14 changed files with 150 additions and 66 deletions

View File

@@ -1,10 +1,12 @@
struct Foo { int a; }
struct Foo2 { 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** Foo.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 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 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'