Skip to content

Commit

Permalink
Fix test program
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Dec 23, 2024
1 parent dc2033b commit 03b5c9a
Showing 1 changed file with 96 additions and 21 deletions.
117 changes: 96 additions & 21 deletions test_programs/compile_success_empty/trait_function_calls/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,31 @@
// 1a) trait default method -> trait default method
trait Trait1a {
fn trait_method1(self) -> Field {
self.trait_method2() * 7892 - self.vl
self.trait_method2() * 7892 - self.vl()
}
fn trait_method2(self) -> Field {
let _ = self;
43278
}
fn vl(self) -> Field;
}
struct Struct1a {
vl: Field,
}
impl Trait1a for Struct1a {}
impl Trait1a for Struct1a {
fn vl(self) -> Field {
self.vl
}
}
// 1b) trait default method -> trait overriden method
trait Trait1b {
fn trait_method1(self) -> Field {
self.trait_method2() * 2832 - self.vl
self.trait_method2() * 2832 - self.vl()
}
fn trait_method2(self) -> Field {
9323
}
fn vl(self) -> Field;
}
struct Struct1b {
vl: Field,
Expand All @@ -51,13 +57,17 @@ impl Trait1b for Struct1b {
let _ = self;
2394
}
fn vl(self) -> Field {
self.vl
}
}
// 1c) trait default method -> trait overriden (no default) method
trait Trait1c {
fn trait_method1(self) -> Field {
self.trait_method2() * 7635 - self.vl
self.trait_method2() * 7635 - self.vl()
}
fn trait_method2(self) -> Field;
fn vl(self) -> Field;
}
struct Struct1c {
vl: Field,
Expand All @@ -67,16 +77,20 @@ impl Trait1c for Struct1c {
let _ = self;
5485
}
fn vl(self) -> Field {
self.vl
}
}
// 1d) trait overriden method -> trait default method
trait Trait1d {
fn trait_method1(self) -> Field {
self.trait_method2() * 2825 - self.vl
self.trait_method2() * 2825 - self.vl()
}
fn trait_method2(self) -> Field {
let _ = self;
29341
}
fn vl(self) -> Field;
}
struct Struct1d {
vl: Field,
Expand All @@ -85,15 +99,19 @@ impl Trait1d for Struct1d {
fn trait_method1(self) -> Field {
self.trait_method2() * 9342 - self.vl
}
fn vl(self) -> Field {
self.vl
}
}
// 1e) trait overriden method -> trait overriden method
trait Trait1e {
fn trait_method1(self) -> Field {
self.trait_method2() * 85465 - self.vl
self.trait_method2() * 85465 - self.vl()
}
fn trait_method2(self) -> Field {
2381
}
fn vl(self) -> Field;
}
struct Struct1e {
vl: Field,
Expand All @@ -106,13 +124,17 @@ impl Trait1e for Struct1e {
let _ = self;
58945
}
fn vl(self) -> Field {
self.vl
}
}
// 1f) trait overriden method -> trait overriden (no default) method
trait Trait1f {
fn trait_method1(self) -> Field {
self.trait_method2() * 43257 - self.vl
self.trait_method2() * 43257 - self.vl()
}
fn trait_method2(self) -> Field;
fn vl(self) -> Field;
}
struct Struct1f {
vl: Field,
Expand All @@ -125,6 +147,9 @@ impl Trait1f for Struct1f {
let _ = self;
5748
}
fn vl(self) -> Field {
self.vl
}
}
// 1g) trait overriden (no default) method -> trait default method
trait Trait1g {
Expand Down Expand Up @@ -182,24 +207,30 @@ impl Trait1i for Struct1i {
// 2a) trait default method -> trait default function
trait Trait2a {
fn trait_method1(self) -> Field {
Self::trait_function2() * 2385 - self.vl
Self::trait_function2() * 2385 - self.vl()
}
fn trait_function2() -> Field {
7843
}
fn vl(self) -> Field;
}
struct Struct2a {
vl: Field,
}
impl Trait2a for Struct2a {}
impl Trait2a for Struct2a {
fn vl(self) -> Field {
self.vl
}
}
// 2b) trait default method -> trait overriden function
trait Trait2b {
fn trait_method1(self) -> Field {
Self::trait_function2() * 6583 - self.vl
Self::trait_function2() * 6583 - self.vl()
}
fn trait_function2() -> Field {
3752
}
fn vl(self) -> Field;
}
struct Struct2b {
vl: Field,
Expand All @@ -208,13 +239,17 @@ impl Trait2b for Struct2b {
fn trait_function2() -> Field {
8477
}
fn vl(self) -> Field {
self.vl
}
}
// 2c) trait default method -> trait overriden (no default) function
trait Trait2c {
fn trait_method1(self) -> Field {
Self::trait_function2() * 2831 - self.vl
Self::trait_function2() * 2831 - self.vl()
}
fn trait_function2() -> Field;
fn vl(self) -> Field;
}
struct Struct2c {
vl: Field,
Expand All @@ -223,15 +258,19 @@ impl Trait2c for Struct2c {
fn trait_function2() -> Field {
8342
}
fn vl(self) -> Field {
self.vl
}
}
// 2d) trait overriden method -> trait default function
trait Trait2d {
fn trait_method1(self) -> Field {
Self::trait_function2() * 924 - self.vl
Self::trait_function2() * 924 - self.vl()
}
fn trait_function2() -> Field {
384
}
fn vl(self) -> Field;
}
struct Struct2d {
vl: Field,
Expand All @@ -240,15 +279,19 @@ impl Trait2d for Struct2d {
fn trait_method1(self) -> Field {
Self::trait_function2() * 3984 - self.vl
}
fn vl(self) -> Field {
self.vl
}
}
// 2e) trait overriden method -> trait overriden function
trait Trait2e {
fn trait_method1(self) -> Field {
Self::trait_function2() * 3642 - self.vl
Self::trait_function2() * 3642 - self.vl()
}
fn trait_function2() -> Field {
97342
}
fn vl(self) -> Field;
}
struct Struct2e {
vl: Field,
Expand All @@ -260,13 +303,17 @@ impl Trait2e for Struct2e {
fn trait_function2() -> Field {
39400
}
fn vl(self) -> Field {
self.vl
}
}
// 2f) trait overriden method -> trait overriden (no default) function
trait Trait2f {
fn trait_method1(self) -> Field {
Self::trait_function2() * 2783 - self.vl
Self::trait_function2() * 2783 - self.vl()
}
fn trait_function2() -> Field;
fn vl(self) -> Field;
}
struct Struct2f {
vl: Field,
Expand All @@ -278,6 +325,9 @@ impl Trait2f for Struct2f {
fn trait_function2() -> Field {
72311
}
fn vl(self) -> Field {
self.vl
}
}
// 2g) trait overriden (no default) method -> trait default function
trait Trait2g {
Expand Down Expand Up @@ -332,25 +382,31 @@ impl Trait2i for Struct2i {
// 3a) trait default function -> trait default method
trait Trait3a {
fn trait_function1(a: Field, b: Self) -> Field {
b.trait_method2() * 8344 - b.vl + a
b.trait_method2() * 8344 - b.vl() + a
}
fn trait_method2(self) -> Field {
let _ = self;
19212
}
fn vl(self) -> Field;
}
struct Struct3a {
vl: Field,
}
impl Trait3a for Struct3a {}
impl Trait3a for Struct3a {
fn vl(self) -> Field {
self.vl
}
}
// 3b) trait default function -> trait overriden method
trait Trait3b {
fn trait_function1(a: Field, b: Self) -> Field {
b.trait_method2() * 9233 - b.vl + a
b.trait_method2() * 9233 - b.vl() + a
}
fn trait_method2(self) -> Field {
9111
}
fn vl(self) -> Field;
}
struct Struct3b {
vl: Field,
Expand All @@ -360,13 +416,17 @@ impl Trait3b for Struct3b {
let _ = self;
2392
}
fn vl(self) -> Field {
self.vl
}
}
// 3c) trait default function -> trait overriden (no default) method
trait Trait3c {
fn trait_function1(a: Field, b: Self) -> Field {
b.trait_method2() * 2822 - b.vl + a
b.trait_method2() * 2822 - b.vl() + a
}
fn trait_method2(self) -> Field;
fn vl(self) -> Field;
}
struct Struct3c {
vl: Field,
Expand All @@ -376,16 +436,20 @@ impl Trait3c for Struct3c {
let _ = self;
7743
}
fn vl(self) -> Field {
self.vl
}
}
// 3d) trait overriden function -> trait default method
trait Trait3d {
fn trait_function1(a: Field, b: Self) -> Field {
b.trait_method2() * 291 - b.vl + a
b.trait_method2() * 291 - b.vl() + a
}
fn trait_method2(self) -> Field {
let _ = self;
3328
}
fn vl(self) -> Field;
}
struct Struct3d {
vl: Field,
Expand All @@ -394,15 +458,19 @@ impl Trait3d for Struct3d {
fn trait_function1(a: Field, b: Self) -> Field {
b.trait_method2() * 4933 - b.vl + a
}
fn vl(self) -> Field {
self.vl
}
}
// 3e) trait overriden function -> trait overriden method
trait Trait3e {
fn trait_function1(a: Field, b: Self) -> Field {
b.trait_method2() * 71231 - b.vl + a
b.trait_method2() * 71231 - b.vl() + a
}
fn trait_method2(self) -> Field {
373
}
fn vl(self) -> Field;
}
struct Struct3e {
vl: Field,
Expand All @@ -415,13 +483,17 @@ impl Trait3e for Struct3e {
let _ = self;
80002
}
fn vl(self) -> Field {
self.vl
}
}
// 3f) trait overriden function -> trait overriden (no default) method
trait Trait3f {
fn trait_function1(a: Field, b: Self) -> Field {
b.trait_method2() * 28223 - b.vl + a
b.trait_method2() * 28223 - b.vl() + a
}
fn trait_method2(self) -> Field;
fn vl(self) -> Field;
}
struct Struct3f {
vl: Field,
Expand All @@ -434,6 +506,9 @@ impl Trait3f for Struct3f {
let _ = self;
63532
}
fn vl(self) -> Field {
self.vl
}
}
// 3g) trait overriden (no default) function -> trait default method
trait Trait3g {
Expand Down

0 comments on commit 03b5c9a

Please sign in to comment.