Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/features/implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ pub(crate) async fn find_implementation_at(
} = &sym.role
{
if let Some(response) =
find_method_implementations(&sym.name, receiver_type, indexer, uri).await
find_method_implementations(&sym.name, &receiver_type.type_path(), indexer, uri)
.await
{
return Some(response);
}
Expand Down
4 changes: 2 additions & 2 deletions src/features/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub(crate) async fn verified_references_for(
SymbolRole::Reference {
receiver_type: Some(receiver_type),
..
} => (Some(receiver_type.clone()), None),
} => (Some(receiver_type.type_path()), None),
_ => (None, None),
},
None => (None, None),
Expand Down Expand Up @@ -227,7 +227,7 @@ pub(crate) async fn verified_references_for(
..
} => crate::resolver::resolve_implicit_receiver_callee(
index,
receiver_type,
&receiver_type.type_path(),
&symbol.name,
uri,
*shape,
Expand Down
2 changes: 1 addition & 1 deletion src/features/references_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub(crate) fn verify_candidates(
continue;
}
}
let candidate_type = ReceiverType::from_raw(receiver_type.clone()).leaf;
let candidate_type = ReceiverType::from_raw(receiver_type.type_path()).leaf;
// Only charge the agreement-walk unit when a walk will
// actually run: `Exact` (same type, string equality) and
// `Unresolvable` (candidate type not indexed) both return
Expand Down
8 changes: 5 additions & 3 deletions src/features/unresolved_symbol_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use tree_sitter::Node;

use crate::indexer::live_tree::LiveDoc;
use crate::indexer::{
classify_cursor, resolve_identity_with_io, Indexer, NavigationSource, SymbolAtCursor,
SymbolRole,
classify_cursor, resolve_identity_with_io, Indexer, NavigationSource, ResolvedType,
SymbolAtCursor, SymbolRole,
};
use crate::queries::{KIND_IMPORT_HEADER, KIND_PACKAGE_HEADER, KIND_SIMPLE_IDENT, KIND_TYPE_IDENT};

Expand Down Expand Up @@ -119,7 +119,9 @@ pub(crate) fn collect_resolution_outcomes(
continue;
};
let receiver_type = match &symbol.role {
SymbolRole::Reference { receiver_type, .. } => receiver_type.clone(),
SymbolRole::Reference { receiver_type, .. } => {
receiver_type.as_ref().map(ResolvedType::type_path)
}
SymbolRole::Declaration { .. } | SymbolRole::ImportSegment => continue,
};
let name = symbol.name.clone();
Expand Down
42 changes: 27 additions & 15 deletions src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub(crate) use self::infer::{
},
type_subst::{build_type_arg_subst, find_last_dot_at_depth_zero},
};
pub(crate) use self::infer::{CstQuery, Resolution};
pub(crate) use self::infer::{CstQuery, Resolution, ResolvedType};

mod cache;
pub(crate) use self::cache::workspace_cache_path;
Expand Down Expand Up @@ -485,26 +485,38 @@ impl InferDeps for Indexer {
}
Vec::new()
}
fn find_method_return_type_for_type(
fn find_method_return_type_with_origin_for_type(
&self,
class_name: &str,
method_name: &str,
uri: &Url,
) -> Option<String> {
) -> Option<(String, Url)> {
if let Some(type_name) = synthetic_enum_method(self, class_name, method_name) {
return Some(type_name);
return Some((type_name, uri.clone()));
}
// The catalog composite covers member fns, extension fns, and supertype
// inheritance in one call (see `Resolver::method_return_type`); the
// previous explicit `find_extension_fn_return_type` step here was dead —
// `find_method_return_type` already probes extensions first.
// The calling file's uri is load-bearing for jar receivers: it drives
// import-reachability AND on-demand Tier-2 materialization of jar
// extension sets (a `None` here left `Modifier.fillMaxSize()`-style
// receivers unresolvable until some other feature happened to promote
// the same symbols — live-probe scenario C).
crate::resolver::Resolver::method_return_type(self, class_name, method_name, Some(uri))
.map(crate::resolver::ReturnType::into_inner)
// Member fns, extension fns, and supertype inheritance in one pass —
// the catalogue composite. The calling file's uri is load-bearing for
// jar receivers: it drives import-reachability AND on-demand Tier-2
// materialization of jar extension sets (a `None` here left
// `Modifier.fillMaxSize()`-style receivers unresolvable until some
// other feature happened to promote the same symbols).
let declared = crate::resolver::Resolver::method_return_type_declared(
self,
class_name,
method_name,
Some(uri),
)?;
let declared_in = declared.declared_in.unwrap_or_else(|| uri.clone());
Some((declared.type_name, declared_in))
}
fn find_method_return_type_for_type(
&self,
class_name: &str,
method_name: &str,
uri: &Url,
) -> Option<String> {
self.find_method_return_type_with_origin_for_type(class_name, method_name, uri)
.map(|(type_name, _)| type_name)
}
fn find_method_params_text(
&self,
Expand Down
Loading
Loading