From 237308a64d720e573893d8396623585416cb0922 Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Fri, 10 Feb 2023 12:34:15 -0600 Subject: [PATCH] Add Bar case to test --- crates/nargo/tests/test_data/generics/src/main.nr | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/nargo/tests/test_data/generics/src/main.nr b/crates/nargo/tests/test_data/generics/src/main.nr index 4e134f83786..56078a304e0 100644 --- a/crates/nargo/tests/test_data/generics/src/main.nr +++ b/crates/nargo/tests/test_data/generics/src/main.nr @@ -25,6 +25,12 @@ impl BigInt { } } +impl Bar { + fn get_other(self) -> Field { + self.other + } +} + fn main(x: Field, y: Field) { let bar1: Bar = Bar { one: x, two: y, other: 0 }; let bar2 = Bar { one: x, two: y, other: [0] }; @@ -37,4 +43,10 @@ fn main(x: Field, y: Field) { let int2 = BigInt { limbs: [2] }; let BigInt { limbs } = int1.second(int2).first(int1); constrain limbs == int2.limbs; + + // Test impl exclusively for Bar + constrain bar1.get_other() == bar1.other; + + // Expected type error + // constrain bar2.get_other() == bar2.other; }