Introduced NewQualifiedExpressionResolver
This commit is contained in:
@@ -101,7 +101,6 @@ public interface Errors {
|
|||||||
|
|
||||||
// Imports
|
// Imports
|
||||||
|
|
||||||
DiagnosticFactory1<JetSimpleNameExpression, DeclarationDescriptor> CANNOT_IMPORT_FROM_ELEMENT = DiagnosticFactory1.create(ERROR);
|
|
||||||
DiagnosticFactory1<JetSimpleNameExpression, ClassDescriptor> CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<JetSimpleNameExpression, ClassDescriptor> CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON = DiagnosticFactory1.create(ERROR);
|
||||||
DiagnosticFactory1<JetSimpleNameExpression, DeclarationDescriptor> CANNOT_BE_IMPORTED = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<JetSimpleNameExpression, DeclarationDescriptor> CANNOT_BE_IMPORTED = DiagnosticFactory1.create(ERROR);
|
||||||
|
|
||||||
@@ -410,6 +409,8 @@ public interface Errors {
|
|||||||
|
|
||||||
DiagnosticFactory1<JetExpression, String> ILLEGAL_SELECTOR = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<JetExpression, String> ILLEGAL_SELECTOR = DiagnosticFactory1.create(ERROR);
|
||||||
|
|
||||||
|
DiagnosticFactory0<PsiElement> SAFE_CALL_IN_QUALIFIER = DiagnosticFactory0.create(ERROR);
|
||||||
|
|
||||||
DiagnosticFactory2<JetExpression, JetExpression, JetType> FUNCTION_EXPECTED = DiagnosticFactory2.create(ERROR);
|
DiagnosticFactory2<JetExpression, JetExpression, JetType> FUNCTION_EXPECTED = DiagnosticFactory2.create(ERROR);
|
||||||
DiagnosticFactory2<JetExpression, JetExpression, Boolean> FUNCTION_CALL_EXPECTED = DiagnosticFactory2.create(ERROR, CALL_EXPRESSION);
|
DiagnosticFactory2<JetExpression, JetExpression, Boolean> FUNCTION_CALL_EXPECTED = DiagnosticFactory2.create(ERROR, CALL_EXPRESSION);
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -143,7 +143,6 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(LABEL_NAME_CLASH, "There is more than one label with such a name in this scope");
|
MAP.put(LABEL_NAME_CLASH, "There is more than one label with such a name in this scope");
|
||||||
MAP.put(EXPRESSION_EXPECTED_PACKAGE_FOUND, "Expression expected, but a package name found");
|
MAP.put(EXPRESSION_EXPECTED_PACKAGE_FOUND, "Expression expected, but a package name found");
|
||||||
|
|
||||||
MAP.put(CANNOT_IMPORT_FROM_ELEMENT, "Cannot import from ''{0}''", NAME);
|
|
||||||
MAP.put(CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON, "Cannot import-on-demand from object ''{0}''", NAME);
|
MAP.put(CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON, "Cannot import-on-demand from object ''{0}''", NAME);
|
||||||
MAP.put(CANNOT_BE_IMPORTED, "Cannot import ''{0}'', functions and properties can be imported only from packages", NAME);
|
MAP.put(CANNOT_BE_IMPORTED, "Cannot import ''{0}'', functions and properties can be imported only from packages", NAME);
|
||||||
MAP.put(CONFLICTING_IMPORT, "Conflicting import, imported name ''{0}'' is ambiguous", STRING);
|
MAP.put(CONFLICTING_IMPORT, "Conflicting import, imported name ''{0}'' is ambiguous", STRING);
|
||||||
@@ -427,6 +426,8 @@ public class DefaultErrorMessages {
|
|||||||
|
|
||||||
MAP.put(ILLEGAL_SELECTOR, "Expression ''{0}'' cannot be a selector (occur after a dot)", STRING);
|
MAP.put(ILLEGAL_SELECTOR, "Expression ''{0}'' cannot be a selector (occur after a dot)", STRING);
|
||||||
|
|
||||||
|
MAP.put(SAFE_CALL_IN_QUALIFIER, "Safe call is not allowed for qualifier");
|
||||||
|
|
||||||
MAP.put(NO_TAIL_CALLS_FOUND, "A function is marked as tail-recursive but no tail calls are found");
|
MAP.put(NO_TAIL_CALLS_FOUND, "A function is marked as tail-recursive but no tail calls are found");
|
||||||
MAP.put(VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION, "A type annotation is required on a value parameter");
|
MAP.put(VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION, "A type annotation is required on a value parameter");
|
||||||
MAP.put(BREAK_OR_CONTINUE_OUTSIDE_A_LOOP, "'break' and 'continue' are only allowed inside a loop");
|
MAP.put(BREAK_OR_CONTINUE_OUTSIDE_A_LOOP, "'break' and 'continue' are only allowed inside a loop");
|
||||||
|
|||||||
@@ -1,204 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.resolve
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors
|
|
||||||
import org.jetbrains.kotlin.name.FqName
|
|
||||||
import org.jetbrains.kotlin.psi.*
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
|
||||||
import java.util.ArrayList
|
|
||||||
|
|
||||||
public class ImportDirectiveProcessor(
|
|
||||||
private val qualifiedExpressionResolver: QualifiedExpressionResolver
|
|
||||||
) {
|
|
||||||
public fun processImportReference(
|
|
||||||
importDirective: JetImportDirective,
|
|
||||||
moduleDescriptor: ModuleDescriptor,
|
|
||||||
trace: BindingTrace,
|
|
||||||
lookupMode: QualifiedExpressionResolver.LookupMode
|
|
||||||
): JetScope {
|
|
||||||
if (importDirective.isAbsoluteInRootPackage()) {
|
|
||||||
trace.report(Errors.UNSUPPORTED.on(importDirective, "TypeHierarchyResolver")) // TODO
|
|
||||||
return JetScope.Empty
|
|
||||||
}
|
|
||||||
|
|
||||||
val importedReference = importDirective.getImportedReference() ?: return JetScope.Empty
|
|
||||||
val importPath = importDirective.getImportPath() ?: return JetScope.Empty
|
|
||||||
val (packageViewDescriptor, selectorsToLookUp) = tryResolvePackagesFromRightToLeft(
|
|
||||||
moduleDescriptor, trace, importPath.fqnPart(), importedReference
|
|
||||||
)
|
|
||||||
val descriptors = lookUpMembersFromLeftToRight(moduleDescriptor, trace, packageViewDescriptor, selectorsToLookUp, lookupMode)
|
|
||||||
|
|
||||||
val referenceExpression = JetPsiUtil.getLastReference(importedReference)
|
|
||||||
if (importDirective.isAllUnder()) {
|
|
||||||
if (!canAllUnderImportFrom(descriptors) && referenceExpression != null) {
|
|
||||||
val toReportOn = descriptors.filterIsInstance<ClassDescriptor>().first()
|
|
||||||
trace.report(Errors.CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON.on(referenceExpression, toReportOn))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (referenceExpression == null || !canImportMembersFrom(descriptors, referenceExpression, trace, lookupMode)) {
|
|
||||||
return JetScope.Empty
|
|
||||||
}
|
|
||||||
|
|
||||||
val importsScope = AllUnderImportsScope()
|
|
||||||
for (descriptor in descriptors) {
|
|
||||||
importsScope.addAllUnderImport(descriptor)
|
|
||||||
}
|
|
||||||
return importsScope
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
val aliasName = JetPsiUtil.getAliasName(importDirective) ?: return JetScope.Empty
|
|
||||||
return SingleImportScope(aliasName, descriptors)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun tryResolvePackagesFromRightToLeft(
|
|
||||||
moduleDescriptor: ModuleDescriptor,
|
|
||||||
trace: BindingTrace,
|
|
||||||
fqName: FqName,
|
|
||||||
jetExpression: JetExpression?
|
|
||||||
): Pair<PackageViewDescriptor, List<JetSimpleNameExpression>> {
|
|
||||||
val selectorsToLookUp = ArrayList<JetSimpleNameExpression>()
|
|
||||||
|
|
||||||
fun recTryResolvePackagesFromRightToLeft(
|
|
||||||
fqName: FqName,
|
|
||||||
jetExpression: JetExpression?
|
|
||||||
): PackageViewDescriptor {
|
|
||||||
val packageView = moduleDescriptor.getPackage(fqName)
|
|
||||||
if (jetExpression == null) {
|
|
||||||
assert(fqName.isRoot())
|
|
||||||
return packageView
|
|
||||||
}
|
|
||||||
return when {
|
|
||||||
!packageView.isEmpty() -> {
|
|
||||||
recordPackageViews(jetExpression, packageView, trace)
|
|
||||||
packageView
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
assert(!fqName.isRoot())
|
|
||||||
val (expressionRest, selector) = jetExpression.getReceiverAndSelector()
|
|
||||||
if (selector != null) {
|
|
||||||
selectorsToLookUp.add(selector)
|
|
||||||
}
|
|
||||||
recTryResolvePackagesFromRightToLeft(fqName.parent(), expressionRest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val packageView = recTryResolvePackagesFromRightToLeft(fqName, jetExpression)
|
|
||||||
return Pair(packageView, selectorsToLookUp.reverse())
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun recordPackageViews(jetExpression: JetExpression, packageView: PackageViewDescriptor, trace: BindingTrace) {
|
|
||||||
trace.record(BindingContext.REFERENCE_TARGET, JetPsiUtil.getLastReference(jetExpression), packageView)
|
|
||||||
val containingView = packageView.getContainingDeclaration()
|
|
||||||
val (receiver, _) = jetExpression.getReceiverAndSelector()
|
|
||||||
if (containingView != null && receiver != null) {
|
|
||||||
recordPackageViews(receiver, containingView, trace)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun lookUpMembersFromLeftToRight(
|
|
||||||
moduleDescriptor: ModuleDescriptor,
|
|
||||||
trace: BindingTrace,
|
|
||||||
packageView: PackageViewDescriptor,
|
|
||||||
selectorsToLookUp: List<JetSimpleNameExpression>,
|
|
||||||
lookupMode: QualifiedExpressionResolver.LookupMode
|
|
||||||
): Collection<DeclarationDescriptor> {
|
|
||||||
var currentDescriptors: Collection<DeclarationDescriptor> = listOf(packageView)
|
|
||||||
for ((i, selector) in selectorsToLookUp.withIndex()) {
|
|
||||||
currentDescriptors = qualifiedExpressionResolver.lookupSelectorDescriptors(
|
|
||||||
selector, currentDescriptors, trace, moduleDescriptor, lookupMode, lookupMode.isEverything()
|
|
||||||
)
|
|
||||||
val isLastReference = i == selectorsToLookUp.size() - 1
|
|
||||||
if (!isLastReference && !canImportMembersFrom(currentDescriptors, selector, trace, lookupMode)) {
|
|
||||||
return emptyList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return currentDescriptors
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun JetExpression.getReceiverAndSelector(): Pair<JetExpression?, JetSimpleNameExpression?> {
|
|
||||||
when (this) {
|
|
||||||
is JetDotQualifiedExpression -> {
|
|
||||||
return Pair(this.getReceiverExpression(), this.getSelectorExpression() as? JetSimpleNameExpression)
|
|
||||||
}
|
|
||||||
is JetSimpleNameExpression -> {
|
|
||||||
return Pair(null, this)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
throw AssertionError("Invalid expression in import $this of class ${this.javaClass}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
public fun canAllUnderImportFrom(descriptors: Collection<DeclarationDescriptor>): Boolean {
|
|
||||||
if (descriptors.isEmpty()) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return descriptors.any { it !is ClassDescriptor || canAllUnderImportFromClass(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
public fun canAllUnderImportFromClass(descriptor: ClassDescriptor): Boolean = !descriptor.getKind().isSingleton()
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
public fun canImportMembersFrom(
|
|
||||||
descriptors: Collection<DeclarationDescriptor>,
|
|
||||||
reference: JetSimpleNameExpression,
|
|
||||||
trace: BindingTrace,
|
|
||||||
lookupMode: QualifiedExpressionResolver.LookupMode
|
|
||||||
): Boolean {
|
|
||||||
if (lookupMode.isOnlyClassesAndPackages()) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
descriptors.singleOrNull()?.let { return canImportMembersFrom(it, reference, trace, lookupMode) }
|
|
||||||
|
|
||||||
val temporaryTrace = TemporaryBindingTrace.create(trace, "trace to find out if members can be imported from", reference)
|
|
||||||
var canImport = false
|
|
||||||
for (descriptor in descriptors) {
|
|
||||||
canImport = canImport || canImportMembersFrom(descriptor, reference, temporaryTrace, lookupMode)
|
|
||||||
}
|
|
||||||
if (!canImport) {
|
|
||||||
temporaryTrace.commit()
|
|
||||||
}
|
|
||||||
return canImport
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun canImportMembersFrom(
|
|
||||||
descriptor: DeclarationDescriptor,
|
|
||||||
reference: JetSimpleNameExpression,
|
|
||||||
trace: BindingTrace,
|
|
||||||
lookupMode: QualifiedExpressionResolver.LookupMode
|
|
||||||
): Boolean {
|
|
||||||
assert(lookupMode.isEverything())
|
|
||||||
if (descriptor is PackageViewDescriptor || descriptor is ClassDescriptor) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
trace.report(Errors.CANNOT_IMPORT_FROM_ELEMENT.on(reference, descriptor))
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun QualifiedExpressionResolver.LookupMode.isEverything() = this == QualifiedExpressionResolver.LookupMode.EVERYTHING
|
|
||||||
private fun QualifiedExpressionResolver.LookupMode.isOnlyClassesAndPackages() = this == QualifiedExpressionResolver.LookupMode.ONLY_CLASSES_AND_PACKAGES
|
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2015 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.resolve
|
||||||
|
|
||||||
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
|
import com.intellij.util.SmartList
|
||||||
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.diagnostics.Errors
|
||||||
|
import org.jetbrains.kotlin.incremental.KotlinLookupLocation
|
||||||
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.psi.*
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.receivers.QualifierReceiver
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||||
|
import org.jetbrains.kotlin.resolve.validation.SymbolUsageValidator
|
||||||
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
|
|
||||||
|
public class NewQualifiedExpressionResolver(val symbolUsageValidator: SymbolUsageValidator) {
|
||||||
|
|
||||||
|
public fun processImportReference(
|
||||||
|
importDirective: JetImportDirective,
|
||||||
|
moduleDescriptor: ModuleDescriptor,
|
||||||
|
trace: BindingTrace,
|
||||||
|
shouldBeVisibleFrom: DeclarationDescriptor
|
||||||
|
): JetScope {
|
||||||
|
val importedReference = importDirective.importedReference ?: return JetScope.Empty
|
||||||
|
val path = importedReference.asQualifierPartList(trace)
|
||||||
|
val lastPart = path.lastOrNull() ?: return JetScope.Empty
|
||||||
|
|
||||||
|
if (importDirective.isAllUnder) {
|
||||||
|
val packageOrClassDescriptor = resolveToPackageOrClass(path, moduleDescriptor, trace, shouldBeVisibleFrom) ?: return JetScope.Empty
|
||||||
|
if (packageOrClassDescriptor is ClassDescriptor && packageOrClassDescriptor.kind.isSingleton) {
|
||||||
|
trace.report(Errors.CANNOT_IMPORT_ON_DEMAND_FROM_SINGLETON.on(lastPart.expression, packageOrClassDescriptor))
|
||||||
|
}
|
||||||
|
val scope = AllUnderImportsScope()
|
||||||
|
scope.addAllUnderImport(packageOrClassDescriptor)
|
||||||
|
return scope
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
val packageOrClassDescriptor = resolveToPackageOrClass(path.subList(0, path.size() - 1), moduleDescriptor, trace, shouldBeVisibleFrom)
|
||||||
|
?: return JetScope.Empty
|
||||||
|
val descriptors = SmartList<DeclarationDescriptor>()
|
||||||
|
|
||||||
|
when (packageOrClassDescriptor) {
|
||||||
|
is PackageViewDescriptor -> {
|
||||||
|
val packageScope = packageOrClassDescriptor.memberScope
|
||||||
|
descriptors.addIfNotNull(packageScope.getClassifier(lastPart.name, lastPart.location))
|
||||||
|
descriptors.addAll(packageScope.getProperties(lastPart.name, lastPart.location))
|
||||||
|
descriptors.addAll(packageScope.getFunctions(lastPart.name, lastPart.location))
|
||||||
|
}
|
||||||
|
is ClassDescriptor -> {
|
||||||
|
descriptors.addIfNotNull(
|
||||||
|
packageOrClassDescriptor.unsubstitutedInnerClassesScope.getClassifier(lastPart.name, lastPart.location)
|
||||||
|
)
|
||||||
|
val staticClassScope = packageOrClassDescriptor.staticScope
|
||||||
|
descriptors.addAll(staticClassScope.getFunctions(lastPart.name, lastPart.location))
|
||||||
|
descriptors.addAll(staticClassScope.getProperties(lastPart.name, lastPart.location))
|
||||||
|
}
|
||||||
|
// todo assert?
|
||||||
|
else -> return JetScope.Empty
|
||||||
|
}
|
||||||
|
storageResult(trace, lastPart, descriptors, shouldBeVisibleFrom)
|
||||||
|
|
||||||
|
val aliasName = JetPsiUtil.getAliasName(importDirective) ?: return JetScope.Empty
|
||||||
|
return SingleImportScope(aliasName, descriptors)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun JetExpression.asQualifierPartList(trace: BindingTrace): List<QualifierPart> {
|
||||||
|
val result = SmartList<QualifierPart>()
|
||||||
|
var expression: JetExpression? = this
|
||||||
|
loop@ while (expression != null) {
|
||||||
|
when (expression) {
|
||||||
|
is JetSimpleNameExpression -> {
|
||||||
|
result add QualifierPart(expression.getReferencedNameAsName(), expression)
|
||||||
|
break@loop
|
||||||
|
}
|
||||||
|
is JetQualifiedExpression -> {
|
||||||
|
(expression.selectorExpression as? JetSimpleNameExpression)?.let {
|
||||||
|
result add QualifierPart(it.getReferencedNameAsName(), it)
|
||||||
|
}
|
||||||
|
expression = expression.receiverExpression
|
||||||
|
if (expression is JetSafeQualifiedExpression) {
|
||||||
|
trace.report(Errors.SAFE_CALL_IN_QUALIFIER.on(expression.operationTokenNode.psi))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> expression = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.asReversed()
|
||||||
|
}
|
||||||
|
|
||||||
|
private data class QualifierPart(
|
||||||
|
val name: Name,
|
||||||
|
val expression: JetSimpleNameExpression,
|
||||||
|
val typeArguments: JetTypeArgumentList? = null
|
||||||
|
) {
|
||||||
|
val location = KotlinLookupLocation(expression)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun resolveToPackageOrClass(
|
||||||
|
path: List<QualifierPart>,
|
||||||
|
moduleDescriptor: ModuleDescriptor,
|
||||||
|
trace: BindingTrace,
|
||||||
|
shouldBeVisibleFrom: DeclarationDescriptor,
|
||||||
|
firstPartResolver: (QualifierPart) -> DeclarationDescriptor? = { null }
|
||||||
|
): DeclarationDescriptor? {
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
return moduleDescriptor.getPackage(FqName.ROOT)
|
||||||
|
}
|
||||||
|
|
||||||
|
val (currentDescriptor, currentIndex) = firstPartResolver(path.first())?.let {
|
||||||
|
Pair(it, 1)
|
||||||
|
} ?: moduleDescriptor.quickResolveToPackage(path, trace, shouldBeVisibleFrom)
|
||||||
|
return path.subList(currentIndex, path.size()).fold<QualifierPart, DeclarationDescriptor?>(currentDescriptor) {
|
||||||
|
descriptor, qualifierPart ->
|
||||||
|
val nextDescriptor = when (descriptor) {
|
||||||
|
// TODO: support inner classes which captured type parameter from outer class
|
||||||
|
is ClassDescriptor ->
|
||||||
|
descriptor.unsubstitutedInnerClassesScope.getClassifier(qualifierPart.name, qualifierPart.location)
|
||||||
|
is PackageViewDescriptor -> {
|
||||||
|
val packageView = if (qualifierPart.typeArguments == null) {
|
||||||
|
moduleDescriptor.getPackage(descriptor.fqName.child(qualifierPart.name))
|
||||||
|
} else null
|
||||||
|
|
||||||
|
|
||||||
|
if (packageView != null && !packageView.isEmpty()) {
|
||||||
|
packageView
|
||||||
|
} else {
|
||||||
|
descriptor.memberScope.getClassifier(qualifierPart.name, qualifierPart.location)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
storageResult(trace, qualifierPart, listOfNotNull(nextDescriptor), shouldBeVisibleFrom)
|
||||||
|
nextDescriptor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun ModuleDescriptor.quickResolveToPackage(
|
||||||
|
path: List<QualifierPart>,
|
||||||
|
trace: BindingTrace,
|
||||||
|
shouldBeVisibleFrom: DeclarationDescriptor
|
||||||
|
): Pair<PackageViewDescriptor, Int> {
|
||||||
|
val possiblePackagePrefixSize = path.indexOfFirst { it.typeArguments != null }.let { if (it == -1) path.size() else it + 1 }
|
||||||
|
var fqName = path.subList(0, possiblePackagePrefixSize).fold(FqName.ROOT) { fqName, qualifierPart ->
|
||||||
|
fqName.child(qualifierPart.name)
|
||||||
|
}
|
||||||
|
var prefixSize = possiblePackagePrefixSize
|
||||||
|
while (!fqName.isRoot) {
|
||||||
|
val packageDescriptor = getPackage(fqName)
|
||||||
|
if (!packageDescriptor.isEmpty()) {
|
||||||
|
recordPackageViews(path.subList(0, prefixSize), packageDescriptor, trace, shouldBeVisibleFrom)
|
||||||
|
return Pair(packageDescriptor, prefixSize)
|
||||||
|
}
|
||||||
|
fqName = fqName.parent()
|
||||||
|
prefixSize--
|
||||||
|
}
|
||||||
|
return Pair(getPackage(FqName.ROOT), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun recordPackageViews(
|
||||||
|
path: List<QualifierPart>,
|
||||||
|
packageView: PackageViewDescriptor,
|
||||||
|
trace: BindingTrace,
|
||||||
|
shouldBeVisibleFrom: DeclarationDescriptor
|
||||||
|
) {
|
||||||
|
path.foldRight(packageView) { qualifierPart, currentView ->
|
||||||
|
storageResult(trace, qualifierPart, listOfNotNull(currentView), shouldBeVisibleFrom)
|
||||||
|
val parentView = currentView.containingDeclaration
|
||||||
|
assert(parentView != null) {
|
||||||
|
"Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " +
|
||||||
|
"path: ${path.joinToString()}, packageView fqName: ${packageView.fqName}"
|
||||||
|
}
|
||||||
|
parentView!!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun storageResult(
|
||||||
|
trace: BindingTrace,
|
||||||
|
qualifierPart: QualifierPart,
|
||||||
|
descriptors: Collection<DeclarationDescriptor>,
|
||||||
|
shouldBeVisibleFrom: DeclarationDescriptor
|
||||||
|
) {
|
||||||
|
|
||||||
|
val referenceExpression = qualifierPart.expression
|
||||||
|
if (descriptors.isEmpty()) {
|
||||||
|
trace.report(Errors.UNRESOLVED_REFERENCE.on(referenceExpression, referenceExpression))
|
||||||
|
}
|
||||||
|
else if(descriptors.size() > 1) {
|
||||||
|
// todo all descriptors invisible - report specific error
|
||||||
|
trace.record(BindingContext.AMBIGUOUS_REFERENCE_TARGET, referenceExpression, descriptors)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
val descriptor = descriptors.single()
|
||||||
|
trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, descriptor)
|
||||||
|
if (descriptor is ClassifierDescriptor) {
|
||||||
|
symbolUsageValidator.validateTypeUsage(descriptor, trace, referenceExpression)
|
||||||
|
}
|
||||||
|
if (descriptor is DeclarationDescriptorWithVisibility) {
|
||||||
|
checkVisibility(descriptor, trace, referenceExpression, shouldBeVisibleFrom)
|
||||||
|
}
|
||||||
|
|
||||||
|
storageQualifier(trace, qualifierPart.expression, descriptor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun storageQualifier(trace: BindingTrace, referenceExpression: JetSimpleNameExpression, descriptor: DeclarationDescriptor) {
|
||||||
|
if (descriptor is PackageViewDescriptor || descriptor is ClassifierDescriptor) {
|
||||||
|
val qualifier = QualifierReceiver(referenceExpression, descriptor as? PackageViewDescriptor, descriptor as? ClassifierDescriptor)
|
||||||
|
trace.record(BindingContext.QUALIFIER, qualifier.expression, qualifier)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkVisibility(
|
||||||
|
descriptor: DeclarationDescriptorWithVisibility,
|
||||||
|
trace: BindingTrace,
|
||||||
|
referenceExpression: JetSimpleNameExpression,
|
||||||
|
shouldBeVisibleFrom: DeclarationDescriptor) {
|
||||||
|
val visibility = descriptor.visibility
|
||||||
|
if (PsiTreeUtil.getParentOfType(referenceExpression, JetImportDirective::class.java) != null && !visibility.mustCheckInImports()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!Visibilities.isVisible(ReceiverValue.IRRELEVANT_RECEIVER, descriptor, shouldBeVisibleFrom)) {
|
||||||
|
trace.report(Errors.INVISIBLE_REFERENCE.on(referenceExpression, descriptor, visibility, descriptor.containingDeclaration!!))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,10 +42,11 @@ import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
|||||||
|
|
||||||
public class QualifiedExpressionResolver {
|
public class QualifiedExpressionResolver {
|
||||||
@NotNull private final SymbolUsageValidator symbolUsageValidator;
|
@NotNull private final SymbolUsageValidator symbolUsageValidator;
|
||||||
@NotNull private final ImportDirectiveProcessor importDirectiveProcessor = new ImportDirectiveProcessor(this);
|
@NotNull private final NewQualifiedExpressionResolver newQualifiedExpressionResolver;
|
||||||
|
|
||||||
public QualifiedExpressionResolver(@NotNull SymbolUsageValidator symbolUsageValidator) {
|
public QualifiedExpressionResolver(@NotNull SymbolUsageValidator symbolUsageValidator, @NotNull NewQualifiedExpressionResolver newQualifiedExpressionResolver) {
|
||||||
this.symbolUsageValidator = symbolUsageValidator;
|
this.symbolUsageValidator = symbolUsageValidator;
|
||||||
|
this.newQualifiedExpressionResolver = newQualifiedExpressionResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Predicate<DeclarationDescriptor> CLASSIFIERS_AND_PACKAGE_VIEWS = new Predicate<DeclarationDescriptor>() {
|
private static final Predicate<DeclarationDescriptor> CLASSIFIERS_AND_PACKAGE_VIEWS = new Predicate<DeclarationDescriptor>() {
|
||||||
@@ -70,7 +71,8 @@ public class QualifiedExpressionResolver {
|
|||||||
@NotNull BindingTrace trace,
|
@NotNull BindingTrace trace,
|
||||||
@NotNull LookupMode lookupMode
|
@NotNull LookupMode lookupMode
|
||||||
) {
|
) {
|
||||||
return importDirectiveProcessor.processImportReference(importDirective, moduleDescriptor, trace, lookupMode);
|
// todo fix shouldBeVisibleFrom
|
||||||
|
return newQualifiedExpressionResolver.processImportReference(importDirective, moduleDescriptor, trace, moduleDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ class LazyImportResolver(
|
|||||||
|
|
||||||
@Volatile var importResolveStatus: ImportResolveStatus? = null
|
@Volatile var importResolveStatus: ImportResolveStatus? = null
|
||||||
|
|
||||||
fun scopeForMode(mode: LookupMode): JetScope {
|
fun scopeForMode(realMode: LookupMode): JetScope {
|
||||||
|
val mode = LookupMode.EVERYTHING // todo
|
||||||
val status = importResolveStatus
|
val status = importResolveStatus
|
||||||
if (status != null && (status.lookupMode == mode || status.lookupMode == LookupMode.EVERYTHING)) {
|
if (status != null && (status.lookupMode == mode || status.lookupMode == LookupMode.EVERYTHING)) {
|
||||||
return status.scope
|
return status.scope
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
// MODULE: m1
|
||||||
|
// FILE: a.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
class B {
|
||||||
|
fun m1() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2
|
||||||
|
// FILE: b.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
class B {
|
||||||
|
fun m2() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m3(m1, m2)
|
||||||
|
// FILE: c.kt
|
||||||
|
import a.B
|
||||||
|
|
||||||
|
fun test(b: B) {
|
||||||
|
b.m1()
|
||||||
|
b.<!UNRESOLVED_REFERENCE!>m2<!>()
|
||||||
|
|
||||||
|
val b_: B = B()
|
||||||
|
b_.m1()
|
||||||
|
|
||||||
|
val b_1: a.B = B()
|
||||||
|
b_1.m1()
|
||||||
|
|
||||||
|
val b_2: B = a.B()
|
||||||
|
b_2.m1()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------TOP LEVEL---------------------
|
||||||
|
// MODULE: top_m1
|
||||||
|
// FILE: top_a.kt
|
||||||
|
class B {
|
||||||
|
fun m1() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: top_m2
|
||||||
|
// FILE: top_b.kt
|
||||||
|
class B {
|
||||||
|
fun m2() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: top_m3(top_m1, top_m2)
|
||||||
|
// FILE: top_c.kt
|
||||||
|
import B
|
||||||
|
|
||||||
|
fun test(b: B) {
|
||||||
|
b.m1()
|
||||||
|
b.<!UNRESOLVED_REFERENCE!>m2<!>()
|
||||||
|
|
||||||
|
val b_: B = B()
|
||||||
|
b_.m1()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: top_d.kt
|
||||||
|
|
||||||
|
fun test2(b: B) {
|
||||||
|
b.m1()
|
||||||
|
b.<!UNRESOLVED_REFERENCE!>m2<!>()
|
||||||
|
|
||||||
|
val b_: B = B()
|
||||||
|
b_.m1()
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
// -- Module: <m1> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun m1(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m2> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun m2(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m3> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ b: a.B): kotlin.Unit
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
// -- Module: <m1> --
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
// -- Module: <m2> --
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m1> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun m1(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m2> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun m2(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m3> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ b: B): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ b: B): kotlin.Unit
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
// -- Module: <top_m1> --
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
// -- Module: <top_m2> --
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// MODULE: m1
|
||||||
|
// FILE: a.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
class B {
|
||||||
|
fun m1() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2
|
||||||
|
// FILE: b.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
class B {
|
||||||
|
fun m2() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m3(m2, m1)
|
||||||
|
// FILE: b.kt
|
||||||
|
import a.*
|
||||||
|
|
||||||
|
|
||||||
|
fun test(b: B) {
|
||||||
|
b.m2()
|
||||||
|
b.<!UNRESOLVED_REFERENCE!>m1<!>()
|
||||||
|
|
||||||
|
val b_: B = B()
|
||||||
|
b_.m2()
|
||||||
|
|
||||||
|
val b_1: a.B = B()
|
||||||
|
b_1.m2()
|
||||||
|
|
||||||
|
val b_2: B = a.B()
|
||||||
|
b_2.m2()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------TOP LEVEL---------------------
|
||||||
|
|
||||||
|
// MODULE: top_m1
|
||||||
|
// FILE: top_a.kt
|
||||||
|
class B {
|
||||||
|
fun m1() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: top_m2
|
||||||
|
// FILE: top_b.kt
|
||||||
|
class B {
|
||||||
|
fun m2() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: top_m3(top_m2, top_m1)
|
||||||
|
// FILE: top_c.kt
|
||||||
|
|
||||||
|
fun test(b: B) {
|
||||||
|
b.m2()
|
||||||
|
b.<!UNRESOLVED_REFERENCE!>m1<!>()
|
||||||
|
|
||||||
|
val b_: B = B()
|
||||||
|
b_.m2()
|
||||||
|
|
||||||
|
val b_2 = B()
|
||||||
|
b_2.m2()
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
// -- Module: <m1> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun m1(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m2> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun m2(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m3> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ b: a.B): kotlin.Unit
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
// -- Module: <m1> --
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
// -- Module: <m2> --
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m1> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun m1(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m2> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final fun m2(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m3> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ b: B): kotlin.Unit
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
// -- Module: <top_m1> --
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
// -- Module: <top_m2> --
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
+2
-2
@@ -11,7 +11,7 @@ class X
|
|||||||
// FILE: c.kt
|
// FILE: c.kt
|
||||||
package c
|
package c
|
||||||
|
|
||||||
import <!CONFLICTING_IMPORT!>a.x<!>
|
import a.<!UNRESOLVED_REFERENCE!>x<!>
|
||||||
import <!CONFLICTING_IMPORT!>b.x<!>
|
import b.<!UNRESOLVED_REFERENCE!>x<!>
|
||||||
|
|
||||||
class Y : <!UNRESOLVED_REFERENCE!>x<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>X<!>
|
class Y : <!UNRESOLVED_REFERENCE!>x<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>X<!>
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
// MODULE: m1
|
||||||
|
// FILE: a.kt
|
||||||
|
package a.b
|
||||||
|
|
||||||
|
class c {
|
||||||
|
fun ab_c() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2
|
||||||
|
// FILE: b.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
class b<T> {
|
||||||
|
class c {
|
||||||
|
fun a_bc() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m3(m1, m2)
|
||||||
|
// FILE: c.kt
|
||||||
|
import a.b.c
|
||||||
|
|
||||||
|
fun test(ab_c: c) {
|
||||||
|
ab_c.ab_c()
|
||||||
|
|
||||||
|
val ab_c2: a.b.c = a.b.c()
|
||||||
|
ab_c2.ab_c()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2(a_bc: a.b<Int>.c) {
|
||||||
|
a_bc.<!UNRESOLVED_REFERENCE!>a_bc<!>() // todo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------TOP LEVEL----------
|
||||||
|
// MODULE: top_m1
|
||||||
|
// FILE: top_a.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
class b {
|
||||||
|
fun a_b() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: top_m2
|
||||||
|
// FILE: top_b.kt
|
||||||
|
class a<T> {
|
||||||
|
class b {
|
||||||
|
fun _ab() {}
|
||||||
|
}
|
||||||
|
fun _a() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: top_m3(top_m1, top_m2)
|
||||||
|
// FILE: top_c.kt
|
||||||
|
import a.b
|
||||||
|
|
||||||
|
fun test(a_b: b) {
|
||||||
|
a_b.a_b()
|
||||||
|
|
||||||
|
val a_b2: a.b = a.b()
|
||||||
|
a_b2.a_b()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2(_ab: a<Int>.b) {
|
||||||
|
_ab.<!UNRESOLVED_REFERENCE!>_ab<!>() // todo
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
// -- Module: <m1> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
package a.b {
|
||||||
|
|
||||||
|
public final class c {
|
||||||
|
public constructor c()
|
||||||
|
public final fun ab_c(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m2> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class b</*0*/ T> {
|
||||||
|
public constructor b</*0*/ T>()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class c {
|
||||||
|
public constructor c()
|
||||||
|
public final fun a_bc(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m3> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ ab_c: a.b.c): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ a_bc: a.b.c): kotlin.Unit
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class b</*0*/ T> {
|
||||||
|
// -- Module: <m2> --
|
||||||
|
}
|
||||||
|
|
||||||
|
package a.b {
|
||||||
|
|
||||||
|
public final class c {
|
||||||
|
// -- Module: <m1> --
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m1> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
public constructor b()
|
||||||
|
public final fun a_b(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m2> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public final class a</*0*/ T> {
|
||||||
|
public constructor a</*0*/ T>()
|
||||||
|
public final fun _a(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
public constructor b()
|
||||||
|
public final fun _ab(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <top_m3> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ a_b: a.b): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ _ab: a.b): kotlin.Unit
|
||||||
|
|
||||||
|
public final class a</*0*/ T> {
|
||||||
|
// -- Module: <top_m2> --
|
||||||
|
}
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
// -- Module: <top_m1> --
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
-7
@@ -5,16 +5,16 @@ import b.B //class
|
|||||||
import b.foo //function
|
import b.foo //function
|
||||||
import b.ext //extension function
|
import b.ext //extension function
|
||||||
import b.value //property
|
import b.value //property
|
||||||
import b.C.Companion.<!CANNOT_BE_IMPORTED!>bar<!> //function from companion object
|
import b.C.Companion.<!UNRESOLVED_REFERENCE!>bar<!> //function from companion object
|
||||||
import b.C.Companion.<!CANNOT_BE_IMPORTED!>cValue<!> //property from companion object
|
import b.C.Companion.<!UNRESOLVED_REFERENCE!>cValue<!> //property from companion object
|
||||||
import b.<!CANNOT_IMPORT_FROM_ELEMENT!>constant<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>fff<!> //function from val
|
import b.<!UNRESOLVED_REFERENCE!>constant<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>fff<!> //function from val
|
||||||
import b.<!CANNOT_IMPORT_FROM_ELEMENT!>constant<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>dValue<!> //property from val
|
import b.<!UNRESOLVED_REFERENCE!>constant<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>dValue<!> //property from val
|
||||||
import b.constant
|
import b.constant
|
||||||
import b.E.Companion.<!CANNOT_BE_IMPORTED!>f<!> //val from companion object
|
import b.E.Companion.<!UNRESOLVED_REFERENCE!>f<!> //val from companion object
|
||||||
import <!UNRESOLVED_REFERENCE!>smth<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>illegal<!>
|
import <!UNRESOLVED_REFERENCE!>smth<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>illegal<!>
|
||||||
import b.C.<!UNRESOLVED_REFERENCE!>smth<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>illegal<!>
|
import b.C.<!UNRESOLVED_REFERENCE!>smth<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>illegal<!>
|
||||||
import b.<!CANNOT_IMPORT_FROM_ELEMENT!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>smth<!>
|
import b.<!UNRESOLVED_REFERENCE!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>smth<!>
|
||||||
import b.<!CANNOT_IMPORT_FROM_ELEMENT!>bar<!>.*
|
import b.<!UNRESOLVED_REFERENCE!>bar<!>.*
|
||||||
|
|
||||||
fun test(arg: B) {
|
fun test(arg: B) {
|
||||||
foo(value)
|
foo(value)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package test
|
|||||||
import <!UNRESOLVED_REFERENCE!>some<!>.<!SYNTAX!><!>
|
import <!UNRESOLVED_REFERENCE!>some<!>.<!SYNTAX!><!>
|
||||||
import <!SYNTAX!>.some<!>
|
import <!SYNTAX!>.some<!>
|
||||||
import <!SYNTAX!>.kotlin<!>
|
import <!SYNTAX!>.kotlin<!>
|
||||||
import kotlin.<!SYNTAX!><!>
|
import <!UNRESOLVED_REFERENCE!>kotlin<!>.<!SYNTAX!><!>
|
||||||
import<!SYNTAX!><!>
|
import<!SYNTAX!><!>
|
||||||
import <!SYNTAX!>.<!>
|
import <!SYNTAX!>.<!>
|
||||||
import <!SYNTAX!>*<!>
|
import <!SYNTAX!>*<!>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
// FILE: a.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
class A {
|
||||||
|
class B
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: b.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
class D {
|
||||||
|
class B
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: c.kt
|
||||||
|
import <!CONFLICTING_IMPORT!>a.A.B<!>
|
||||||
|
import <!CONFLICTING_IMPORT!>a.D.B<!>
|
||||||
|
|
||||||
|
fun test(b: <!UNRESOLVED_REFERENCE!>B<!>) {
|
||||||
|
<!UNRESOLVED_REFERENCE!>B<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: d.kt
|
||||||
|
import a.A.*
|
||||||
|
import a.D.*
|
||||||
|
|
||||||
|
// todo ambiguvity here
|
||||||
|
fun test2(b: <!UNRESOLVED_REFERENCE!>B<!>) {
|
||||||
|
<!UNRESOLVED_REFERENCE!>B<!>()
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ b: [ERROR : B]): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ b: [ERROR : B]): kotlin.Unit
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
public final class A {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class D {
|
||||||
|
public constructor D()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
// MODULE: m1
|
||||||
|
// FILE: a.kt
|
||||||
|
package a.b
|
||||||
|
|
||||||
|
fun ab_fun() {}
|
||||||
|
|
||||||
|
class c {
|
||||||
|
fun ab_c() {}
|
||||||
|
|
||||||
|
class d {
|
||||||
|
fun ab_cd() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2
|
||||||
|
// FILE: b.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
fun a_fun() {}
|
||||||
|
|
||||||
|
class b {
|
||||||
|
fun a_b() {}
|
||||||
|
|
||||||
|
class c {
|
||||||
|
fun a_bc() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m3(m1, m2)
|
||||||
|
// FILE: c.kt
|
||||||
|
import a.a_fun
|
||||||
|
import a.b
|
||||||
|
|
||||||
|
import a.b.ab_fun
|
||||||
|
import a.b.c
|
||||||
|
|
||||||
|
fun test(a_b: b) {
|
||||||
|
a_b.a_b()
|
||||||
|
|
||||||
|
val a_bc: b.c = b.c()
|
||||||
|
a_bc.a_bc()
|
||||||
|
|
||||||
|
a_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2(ab_c: c) {
|
||||||
|
ab_c.ab_c()
|
||||||
|
|
||||||
|
val ab_cd: c.d = c.d()
|
||||||
|
ab_cd.ab_cd()
|
||||||
|
|
||||||
|
ab_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: d.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
import a.b.ab_fun
|
||||||
|
import a.b.c
|
||||||
|
|
||||||
|
fun test(a_b: b) {
|
||||||
|
a_b.a_b()
|
||||||
|
|
||||||
|
val a_bc: b.c = b.c()
|
||||||
|
a_bc.a_bc()
|
||||||
|
|
||||||
|
a_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2(ab_c: c) {
|
||||||
|
ab_c.ab_c()
|
||||||
|
|
||||||
|
val ab_cd: c.d = c.d()
|
||||||
|
ab_cd.ab_cd()
|
||||||
|
|
||||||
|
ab_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
//---- Changed dependence order
|
||||||
|
// MODULE: m4(m2, m1)
|
||||||
|
// FILE: c.kt
|
||||||
|
import a.a_fun
|
||||||
|
import a.b
|
||||||
|
|
||||||
|
import a.b.ab_fun
|
||||||
|
import a.b.c
|
||||||
|
|
||||||
|
fun test(a_b: b) {
|
||||||
|
a_b.a_b()
|
||||||
|
|
||||||
|
val a_bc: b.c = b.c()
|
||||||
|
a_bc.a_bc()
|
||||||
|
|
||||||
|
a_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2(ab_c: c) {
|
||||||
|
ab_c.ab_c()
|
||||||
|
|
||||||
|
val ab_cd: c.d = c.d()
|
||||||
|
ab_cd.ab_cd()
|
||||||
|
|
||||||
|
ab_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: d.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
import a.b.ab_fun
|
||||||
|
import a.b.c
|
||||||
|
|
||||||
|
fun test(a_b: b) {
|
||||||
|
a_b.a_b()
|
||||||
|
|
||||||
|
val a_bc: b.c = b.c()
|
||||||
|
a_bc.a_bc()
|
||||||
|
|
||||||
|
a_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test2(ab_c: c) {
|
||||||
|
ab_c.ab_c()
|
||||||
|
|
||||||
|
val ab_cd: c.d = c.d()
|
||||||
|
ab_cd.ab_cd()
|
||||||
|
|
||||||
|
ab_fun()
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
// -- Module: <m1> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
|
||||||
|
package a.b {
|
||||||
|
public fun ab_fun(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class c {
|
||||||
|
public constructor c()
|
||||||
|
public final fun ab_c(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class d {
|
||||||
|
public constructor d()
|
||||||
|
public final fun ab_cd(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m2> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
public fun a_fun(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
public constructor b()
|
||||||
|
public final fun a_b(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class c {
|
||||||
|
public constructor c()
|
||||||
|
public final fun a_bc(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m3> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ a_b: a.b): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ ab_c: a.b.c): kotlin.Unit
|
||||||
|
|
||||||
|
package a {
|
||||||
|
public fun a_fun(): kotlin.Unit
|
||||||
|
public fun test(/*0*/ a_b: a.b): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ ab_c: a.b.c): kotlin.Unit
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
// -- Module: <m2> --
|
||||||
|
}
|
||||||
|
|
||||||
|
package a.b {
|
||||||
|
public fun ab_fun(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class c {
|
||||||
|
// -- Module: <m1> --
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m4> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun test(/*0*/ a_b: a.b): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ ab_c: a.b.c): kotlin.Unit
|
||||||
|
|
||||||
|
package a {
|
||||||
|
public fun a_fun(): kotlin.Unit
|
||||||
|
public fun test(/*0*/ a_b: a.b): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ ab_c: a.b.c): kotlin.Unit
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
// -- Module: <m2> --
|
||||||
|
}
|
||||||
|
|
||||||
|
package a.b {
|
||||||
|
public fun ab_fun(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class c {
|
||||||
|
// -- Module: <m1> --
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
// MODULE: m1
|
||||||
|
// FILE: a.kt
|
||||||
|
package a
|
||||||
|
|
||||||
|
fun a_fun() {}
|
||||||
|
|
||||||
|
class b {
|
||||||
|
fun a_b() {}
|
||||||
|
|
||||||
|
class c {
|
||||||
|
fun a_bc() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2
|
||||||
|
// FILE: b.kt
|
||||||
|
fun _fun() {}
|
||||||
|
|
||||||
|
class a {
|
||||||
|
fun _a() {}
|
||||||
|
|
||||||
|
class b {
|
||||||
|
fun _ab() {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m3(m1, m2)
|
||||||
|
// FILE: c.kt
|
||||||
|
import a.a_fun
|
||||||
|
import a.b
|
||||||
|
|
||||||
|
fun test(a_b: b) {
|
||||||
|
a_b.a_b()
|
||||||
|
|
||||||
|
val a_bc: b.c = b.c()
|
||||||
|
a_bc.a_bc()
|
||||||
|
|
||||||
|
a_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: d.kt
|
||||||
|
fun test2(_a: a) {
|
||||||
|
_a._a()
|
||||||
|
|
||||||
|
val _ab: a.b = a.b()
|
||||||
|
_ab.<!UNRESOLVED_REFERENCE!>_ab<!>() // todo
|
||||||
|
|
||||||
|
_fun()
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: e.kt
|
||||||
|
import a
|
||||||
|
import _fun
|
||||||
|
|
||||||
|
fun test3(_a: a) {
|
||||||
|
_a._a()
|
||||||
|
|
||||||
|
val _ab: a.b = a.b()
|
||||||
|
_ab.<!UNRESOLVED_REFERENCE!>_ab<!>() // todo
|
||||||
|
|
||||||
|
_fun()
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
// -- Module: <m1> --
|
||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
public fun a_fun(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
public constructor b()
|
||||||
|
public final fun a_b(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class c {
|
||||||
|
public constructor c()
|
||||||
|
public final fun a_bc(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m2> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun _fun(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class a {
|
||||||
|
public constructor a()
|
||||||
|
public final fun _a(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
public constructor b()
|
||||||
|
public final fun _ab(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m3> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public fun _fun(): kotlin.Unit
|
||||||
|
public fun test(/*0*/ a_b: a.b): kotlin.Unit
|
||||||
|
public fun test2(/*0*/ _a: a): kotlin.Unit
|
||||||
|
public fun test3(/*0*/ _a: a): kotlin.Unit
|
||||||
|
|
||||||
|
public final class a {
|
||||||
|
// -- Module: <m2> --
|
||||||
|
}
|
||||||
|
|
||||||
|
package a {
|
||||||
|
public fun a_fun(): kotlin.Unit
|
||||||
|
|
||||||
|
public final class b {
|
||||||
|
// -- Module: <m1> --
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -6489,6 +6489,18 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ClassClash.kt")
|
||||||
|
public void testClassClash() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/ClassClash.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ClassClashStarImport.kt")
|
||||||
|
public void testClassClashStarImport() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/ClassClashStarImport.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ClassImportsConflicting.kt")
|
@TestMetadata("ClassImportsConflicting.kt")
|
||||||
public void testClassImportsConflicting() throws Exception {
|
public void testClassImportsConflicting() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/ClassImportsConflicting.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/ClassImportsConflicting.kt");
|
||||||
@@ -6531,6 +6543,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("GenericClassVsPackage.kt")
|
||||||
|
public void testGenericClassVsPackage() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/GenericClassVsPackage.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ImportFromCurrentWithDifferentName.kt")
|
@TestMetadata("ImportFromCurrentWithDifferentName.kt")
|
||||||
public void testImportFromCurrentWithDifferentName() throws Exception {
|
public void testImportFromCurrentWithDifferentName() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/ImportFromCurrentWithDifferentName.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/ImportFromCurrentWithDifferentName.kt");
|
||||||
@@ -6627,6 +6645,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("NestedClassClash.kt")
|
||||||
|
public void testNestedClassClash() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/NestedClassClash.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("PackageLocalClassNotImported.kt")
|
@TestMetadata("PackageLocalClassNotImported.kt")
|
||||||
public void testPackageLocalClassNotImported() throws Exception {
|
public void testPackageLocalClassNotImported() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/PackageLocalClassNotImported.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/PackageLocalClassNotImported.kt");
|
||||||
@@ -6639,6 +6663,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PackageVsClass.kt")
|
||||||
|
public void testPackageVsClass() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/PackageVsClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("PrivateClassNotImported.kt")
|
@TestMetadata("PrivateClassNotImported.kt")
|
||||||
public void testPrivateClassNotImported() throws Exception {
|
public void testPrivateClassNotImported() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/PrivateClassNotImported.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/PrivateClassNotImported.kt");
|
||||||
@@ -6668,6 +6698,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/StarImportFromObject.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/StarImportFromObject.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("TopLevelClassVsPackage.kt")
|
||||||
|
public void testTopLevelClassVsPackage() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/imports/TopLevelClassVsPackage.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/incompleteCode")
|
@TestMetadata("compiler/testData/diagnostics/tests/incompleteCode")
|
||||||
|
|||||||
Reference in New Issue
Block a user