From b0af8ca09764426c0c81e1008a5e25fd7554f6f8 Mon Sep 17 00:00:00 2001 From: Ori Ziv Date: Fri, 10 Jan 2025 13:48:50 +0200 Subject: [PATCH] Fixed available generic args for default impls. Fixes #7038 commit-id:c29f1286 --- crates/cairo-lang-semantic/src/items/trt.rs | 2 +- tests/bug_samples/issue7038.cairo | 8 ++++++++ tests/bug_samples/lib.cairo | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/bug_samples/issue7038.cairo diff --git a/crates/cairo-lang-semantic/src/items/trt.rs b/crates/cairo-lang-semantic/src/items/trt.rs index bb99e56d40a..de5b07930c5 100644 --- a/crates/cairo-lang-semantic/src/items/trt.rs +++ b/crates/cairo-lang-semantic/src/items/trt.rs @@ -1355,7 +1355,7 @@ pub fn priv_trait_function_body_data( // Compute declaration semantic. let trait_function_declaration_data = db.priv_trait_function_declaration_data(trait_function_id)?; - let parent_resolver_data = db.trait_resolver_data(trait_id)?; + let parent_resolver_data = trait_function_declaration_data.resolver_data; let inference_id = InferenceId::LookupItemDefinition(LookupItemId::TraitItem( TraitItemId::Function(trait_function_id), )); diff --git a/tests/bug_samples/issue7038.cairo b/tests/bug_samples/issue7038.cairo new file mode 100644 index 00000000000..2f2f5e54109 --- /dev/null +++ b/tests/bug_samples/issue7038.cairo @@ -0,0 +1,8 @@ +trait DefaultTraitImpl { + fn call, impl func: core::ops::FnOnce[Output: T], +Drop>( + f: F, + ) { + func::call(f, ()); + f(); + } +} diff --git a/tests/bug_samples/lib.cairo b/tests/bug_samples/lib.cairo index 2d6b0c1a301..8f732fb3581 100644 --- a/tests/bug_samples/lib.cairo +++ b/tests/bug_samples/lib.cairo @@ -53,6 +53,7 @@ mod issue6623; mod issue6755; mod issue6920; mod issue6968; +mod issue7038; mod loop_break_in_match; mod loop_only_change; mod partial_param_local;