Skip to content

Commit

Permalink
up6
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad20012 committed Apr 28, 2022
1 parent c6e3e9e commit 952e9a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/main/kotlin/org/rust/lang/core/resolve/NameResolution.kt
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ fun processPathResolveVariants(lookup: ImplLookup?, path: RsPath, isCompletion:
if (parent is RsMacroCall) {
error("Tried to use `processPathResolveVariants` for macro path. See `RsMacroPathReferenceImpl`")
}
if (parent is RsAssocTypeBinding) {
return processAssocTypeVariants(parent, processor)
}
val qualifier = path.qualifier
val typeQual = path.typeQual
val ns = path.allowedNamespaces(isCompletion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,16 @@ fun resolvePathRaw(path: RsPath, lookup: ImplLookup? = null): List<ScopeEntry> {
}

fun resolvePath(path: RsPath, lookup: ImplLookup? = null): List<BoundElementWithVisibility<RsElement>> {
val pathParent = path.parent

val result = if (pathParent is RsAssocTypeBinding) {
collectPathResolveVariants(path) { processAssocTypeVariants(pathParent, it) }
} else {
collectPathResolveVariants(path) { processPathResolveVariants(lookup, path, false, it) }
.let { rawResult -> tryRefineAssocTypePath(path, lookup, rawResult) ?: rawResult }
val result = collectPathResolveVariants(path) {
processPathResolveVariants(lookup, path, false, it)
}.let { rawResult ->
tryRefineAssocTypePath(path, lookup, rawResult) ?: rawResult
}

// type A = Foo<T>
// ~ `T` can be either type or const argument.
// Prefer types if they are
val pathParent = path.parent
val result2 = if (pathParent is RsTypeReference && pathParent.parent is RsTypeArgumentList) {
when (result.size) {
0 -> emptyList()
Expand Down

0 comments on commit 952e9a1

Please sign in to comment.