diff --git a/sway-core/src/semantic_analysis/node_dependencies.rs b/sway-core/src/semantic_analysis/node_dependencies.rs index 1b8e993e323..6a577d7caae 100644 --- a/sway-core/src/semantic_analysis/node_dependencies.rs +++ b/sway-core/src/semantic_analysis/node_dependencies.rs @@ -963,7 +963,7 @@ fn decl_name(engines: &Engines, decl: &Declaration) -> Option { } }) .collect::>() - .join(""), + .join(","), ) } else if decl.trait_name.prefixes.is_empty() { impl_sym( @@ -986,7 +986,7 @@ fn decl_name(engines: &Engines, decl: &Declaration) -> Option { } }) .collect::>() - .join(""), + .join(","), ) } else { None diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/.gitignore b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/.gitignore new file mode 100644 index 00000000000..77d3844f58c --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/.gitignore @@ -0,0 +1,2 @@ +out +target diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/Forc.lock new file mode 100644 index 00000000000..1693df3a853 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = "core" +source = "path+from-root-0C133FB33C94FAC1" + +[[package]] +name = "impl_self_dependency_order_conflict" +source = "member" +dependencies = ["std"] + +[[package]] +name = "std" +source = "path+from-root-0C133FB33C94FAC1" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/Forc.toml new file mode 100644 index 00000000000..d50f5de5701 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/Forc.toml @@ -0,0 +1,8 @@ +[project] +entry = "main.sw" +authors = ["Fuel Labs "] +license = "Apache-2.0" +name = "impl_self_dependency_order_conflict" + +[dependencies] +std = { path = "../../../reduced_std_libs/sway-lib-std-assert" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/src/foo.sw b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/src/foo.sw new file mode 100644 index 00000000000..11422a3c6a0 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/src/foo.sw @@ -0,0 +1,5 @@ +library; + +pub fn foo() -> u32 { + 1 +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/src/main.sw new file mode 100644 index 00000000000..76a5d4c4a1e --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/src/main.sw @@ -0,0 +1,27 @@ +library; + +mod foo; +use foo::*; + +struct S {} + +impl S { //dependency of this impl is overwritten by the next impl + fn a() -> u32 { foo() } + fn b() {} +} + +impl S { //this will overwrite the dependency for the previous impl + fn ab() {} +} + +fn foo() -> u32 { + 2 +} + +fn main() {} + +#[test] +fn test() { + assert_eq(2, S::a()); +} + diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/test.toml new file mode 100644 index 00000000000..f5f5a974e08 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/impl_self_dependency_order_conflict/test.toml @@ -0,0 +1,2 @@ +category = "unit_tests_pass" +