From 1414c642b7313271d8d77ae570f639bf32228201 Mon Sep 17 00:00:00 2001 From: Christoph Burgdorf Date: Mon, 7 Nov 2022 14:40:25 +0100 Subject: [PATCH] WIP --- crates/analyzer/src/traversal/expressions.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/analyzer/src/traversal/expressions.rs b/crates/analyzer/src/traversal/expressions.rs index ead10dac06..de70436da7 100644 --- a/crates/analyzer/src/traversal/expressions.rs +++ b/crates/analyzer/src/traversal/expressions.rs @@ -995,7 +995,19 @@ fn expr_call_path( generic_args: &Option>>, args: &Node>>, ) -> Result<(ExpressionAttributes, CallType), FatalError> { + + // TODO: We need to handle the case of trait associated functions + // If we fail to resolve `whatever::SomeType::foo()` then: + // 1. Remove the last segment (e.g. `foo` in this case) + // 2. If we can resolve `whatever::SomeType` check each trait in scope that is implemented + // for `whatever::SometType` (if any) and collect pure `foo` functions if available + // 3. + // - If we find multiple -> error because call is ambigious + // - If we find a single one -> call it + // - If we find none -> error no match + dbg!("here we go {}", path); let named_thing = context.resolve_path(path, func.span)?; + dbg!("here we don't"); expr_call_named_thing(context, named_thing, func, generic_args, args) }