From 181acad4c43f9136ef7e955320136f056413141a Mon Sep 17 00:00:00 2001 From: Marcos Henrich Date: Thu, 2 Nov 2023 14:15:58 +0000 Subject: [PATCH] Adds test that covers #5162 --- .../generic_and_associated_type/Forc.lock | 3 +++ .../generic_and_associated_type/Forc.toml | 6 ++++++ .../json_abi_oracle.json | 1 + .../generic_and_associated_type/src/main.sw | 15 +++++++++++++++ .../generic_and_associated_type/test.toml | 8 ++++++++ 5 files changed, 33 insertions(+) create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/json_abi_oracle.json create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/test.toml diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/Forc.lock new file mode 100644 index 00000000000..66eb083490f --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/Forc.lock @@ -0,0 +1,3 @@ +[[package]] +name = "generic_and_associated_type" +source = "member" diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/Forc.toml new file mode 100644 index 00000000000..8d9796821c4 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/Forc.toml @@ -0,0 +1,6 @@ +[project] +authors = ["Fuel Labs "] +license = "Apache-2.0" +name = "generic_and_associated_type" +entry = "main.sw" +implicit-std = false diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/json_abi_oracle.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/json_abi_oracle.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/src/main.sw new file mode 100644 index 00000000000..2c4ebfa5bad --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/src/main.sw @@ -0,0 +1,15 @@ +script; + +trait TypeTrait { + type T; + + fn method() -> Self::T; +} { + fn method2() -> T { + Self::method() + } +} + +fn main() -> u32 { + 1 +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/test.toml new file mode 100644 index 00000000000..c6d7130f372 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/generic_and_associated_type/test.toml @@ -0,0 +1,8 @@ +category = "fail" + +# check: $()Self::method() +# nextln: $()Mismatched types. +# nextln: $()expected: T +# nextln: $()found: trait type Self::T +# nextln: $()help: Function return type does not match up with local type annotation. +