Do not force resolve descriptors for explicit imports. Create lazy scope instead.
This commit is contained in:
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2017 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.util.SmartList
|
||||||
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.BaseImportingScope
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||||
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||||
|
|
||||||
|
class LazyExplicitImportScope(
|
||||||
|
private val packageOrClassDescriptor: DeclarationDescriptor,
|
||||||
|
private val packageFragmentForVisibilityCheck: PackageFragmentDescriptor?,
|
||||||
|
private val declaredName: Name,
|
||||||
|
private val aliasName: Name,
|
||||||
|
private val storeReferences: (Collection<DeclarationDescriptor>) -> Unit
|
||||||
|
): BaseImportingScope(null) {
|
||||||
|
|
||||||
|
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||||
|
if (name != aliasName) return null
|
||||||
|
|
||||||
|
return when (packageOrClassDescriptor) {
|
||||||
|
is PackageViewDescriptor -> packageOrClassDescriptor.memberScope.getContributedClassifier(declaredName, location)
|
||||||
|
is ClassDescriptor -> packageOrClassDescriptor.unsubstitutedInnerClassesScope.getContributedClassifier(declaredName, location)
|
||||||
|
else -> throw IllegalStateException("Should be class or package: $packageOrClassDescriptor")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<FunctionDescriptor> {
|
||||||
|
if (name != aliasName) return emptyList()
|
||||||
|
|
||||||
|
return collectCallableMemberDescriptors(location, MemberScope::getContributedFunctions)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getContributedVariables(name: Name, location: LookupLocation): Collection<VariableDescriptor> {
|
||||||
|
if (name != aliasName) return emptyList()
|
||||||
|
|
||||||
|
return collectCallableMemberDescriptors(location, MemberScope::getContributedVariables)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
||||||
|
val descriptors = SmartList<DeclarationDescriptor>()
|
||||||
|
descriptors.addIfNotNull(getContributedClassifier(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
|
||||||
|
descriptors.addAll(getContributedFunctions(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
|
||||||
|
descriptors.addAll(getContributedVariables(aliasName, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS))
|
||||||
|
|
||||||
|
return descriptors
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun printStructure(p: Printer) {
|
||||||
|
p.println(javaClass.simpleName, ": ", aliasName)
|
||||||
|
}
|
||||||
|
|
||||||
|
// should be called only once
|
||||||
|
internal fun storeReferencesToDescriptors() = getContributedDescriptors().apply(storeReferences)
|
||||||
|
|
||||||
|
private fun <D : CallableMemberDescriptor> collectCallableMemberDescriptors(
|
||||||
|
location: LookupLocation,
|
||||||
|
getDescriptors: MemberScope.(Name, LookupLocation) -> Collection<D>
|
||||||
|
): Collection<D> {
|
||||||
|
val descriptors = SmartList<D>()
|
||||||
|
|
||||||
|
when (packageOrClassDescriptor) {
|
||||||
|
is PackageViewDescriptor -> {
|
||||||
|
val packageScope = packageOrClassDescriptor.memberScope
|
||||||
|
descriptors.addAll(packageScope.getDescriptors(declaredName, location))
|
||||||
|
}
|
||||||
|
|
||||||
|
is ClassDescriptor -> {
|
||||||
|
val staticClassScope = packageOrClassDescriptor.staticScope
|
||||||
|
descriptors.addAll(staticClassScope.getDescriptors(declaredName, location))
|
||||||
|
|
||||||
|
if (packageOrClassDescriptor.kind == ClassKind.OBJECT) {
|
||||||
|
descriptors.addAll(
|
||||||
|
packageOrClassDescriptor.unsubstitutedMemberScope.getDescriptors(declaredName, location)
|
||||||
|
.mapNotNull { it.asImportedFromObjectIfPossible() }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> throw IllegalStateException("Should be class or package: $packageOrClassDescriptor")
|
||||||
|
}
|
||||||
|
|
||||||
|
return descriptors.choseOnlyVisibleOrAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
private fun <D : CallableMemberDescriptor> D.asImportedFromObjectIfPossible(): D? = when (this) {
|
||||||
|
is PropertyDescriptor -> asImportedFromObject() as D
|
||||||
|
is FunctionDescriptor -> asImportedFromObject() as D
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun <D : CallableMemberDescriptor> Collection<D>.choseOnlyVisibleOrAll() =
|
||||||
|
filter { isVisible(it, packageFragmentForVisibilityCheck, position = QualifierPosition.IMPORT) }.
|
||||||
|
check { it.isNotEmpty() } ?: this
|
||||||
|
}
|
||||||
@@ -36,7 +36,6 @@ import org.jetbrains.kotlin.resolve.scopes.utils.memberScopeAsImportingScope
|
|||||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
|
import org.jetbrains.kotlin.types.expressions.ExpressionTypingContext
|
||||||
import org.jetbrains.kotlin.types.expressions.isWithoutValueArguments
|
import org.jetbrains.kotlin.types.expressions.isWithoutValueArguments
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||||
|
|
||||||
class QualifiedExpressionResolver {
|
class QualifiedExpressionResolver {
|
||||||
@@ -107,7 +106,7 @@ class QualifiedExpressionResolver {
|
|||||||
val lastPart = qualifierPartList.last()
|
val lastPart = qualifierPartList.last()
|
||||||
val classifier = when (qualifier) {
|
val classifier = when (qualifier) {
|
||||||
is PackageViewDescriptor -> qualifier.memberScope.getContributedClassifier(lastPart.name, lastPart.location)
|
is PackageViewDescriptor -> qualifier.memberScope.getContributedClassifier(lastPart.name, lastPart.location)
|
||||||
is ClassDescriptor -> {
|
is ClassDescriptor -> {
|
||||||
val descriptor = qualifier.unsubstitutedInnerClassesScope.getContributedClassifier(lastPart.name, lastPart.location)
|
val descriptor = qualifier.unsubstitutedInnerClassesScope.getContributedClassifier(lastPart.name, lastPart.location)
|
||||||
checkNotEnumEntry(descriptor, trace, lastPart.expression)
|
checkNotEnumEntry(descriptor, trace, lastPart.expression)
|
||||||
descriptor
|
descriptor
|
||||||
@@ -207,7 +206,7 @@ class QualifiedExpressionResolver {
|
|||||||
path: List<QualifierPart>,
|
path: List<QualifierPart>,
|
||||||
lastPart: QualifierPart,
|
lastPart: QualifierPart,
|
||||||
packageFragmentForVisibilityCheck: PackageFragmentDescriptor?
|
packageFragmentForVisibilityCheck: PackageFragmentDescriptor?
|
||||||
): SingleImportScope? {
|
): ImportingScope? {
|
||||||
val aliasName = KtPsiUtil.getAliasName(importDirective)
|
val aliasName = KtPsiUtil.getAliasName(importDirective)
|
||||||
if (aliasName == null) {
|
if (aliasName == null) {
|
||||||
// import kotlin.
|
// import kotlin.
|
||||||
@@ -220,58 +219,16 @@ class QualifiedExpressionResolver {
|
|||||||
packageFragmentForVisibilityCheck, scopeForFirstPart = null, position = QualifierPosition.IMPORT
|
packageFragmentForVisibilityCheck, scopeForFirstPart = null, position = QualifierPosition.IMPORT
|
||||||
) ?: return null
|
) ?: return null
|
||||||
|
|
||||||
val candidates = collectCandidateDescriptors(lastPart, packageOrClassDescriptor)
|
return LazyExplicitImportScope(packageOrClassDescriptor, packageFragmentForVisibilityCheck, lastPart.name, aliasName) {
|
||||||
if (candidates.isNotEmpty()) {
|
candidates ->
|
||||||
storeResult(trace, lastPart.expression, candidates, packageFragmentForVisibilityCheck, position = QualifierPosition.IMPORT, isQualifier = false)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tryResolveDescriptorsWhichCannotBeImported(trace, moduleDescriptor, packageOrClassDescriptor, lastPart)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
val importedDescriptors = candidates.filter { isVisible(it, packageFragmentForVisibilityCheck, position = QualifierPosition.IMPORT) }.
|
if (candidates.isNotEmpty()) {
|
||||||
check { it.isNotEmpty() } ?: candidates
|
storeResult(trace, lastPart.expression, candidates, packageFragmentForVisibilityCheck, position = QualifierPosition.IMPORT, isQualifier = false)
|
||||||
|
|
||||||
return SingleImportScope(aliasName, importedDescriptors)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun collectCandidateDescriptors(lastPart: QualifierPart, packageOrClassDescriptor: DeclarationDescriptor): SmartList<DeclarationDescriptor> {
|
|
||||||
val descriptors = SmartList<DeclarationDescriptor>()
|
|
||||||
|
|
||||||
val lastName = lastPart.name
|
|
||||||
val location = lastPart.location
|
|
||||||
when (packageOrClassDescriptor) {
|
|
||||||
is PackageViewDescriptor -> {
|
|
||||||
val packageScope = packageOrClassDescriptor.memberScope
|
|
||||||
descriptors.addIfNotNull(packageScope.getContributedClassifier(lastName, location))
|
|
||||||
descriptors.addAll(packageScope.getContributedVariables(lastName, location))
|
|
||||||
descriptors.addAll(packageScope.getContributedFunctions(lastName, location))
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
is ClassDescriptor -> {
|
tryResolveDescriptorsWhichCannotBeImported(trace, moduleDescriptor, packageOrClassDescriptor, lastPart)
|
||||||
descriptors.addIfNotNull(
|
|
||||||
packageOrClassDescriptor.unsubstitutedInnerClassesScope.getContributedClassifier(lastName, location)
|
|
||||||
)
|
|
||||||
val staticClassScope = packageOrClassDescriptor.staticScope
|
|
||||||
descriptors.addAll(staticClassScope.getContributedFunctions(lastName, location))
|
|
||||||
descriptors.addAll(staticClassScope.getContributedVariables(lastName, location))
|
|
||||||
|
|
||||||
if (packageOrClassDescriptor.kind == ClassKind.OBJECT) {
|
|
||||||
descriptors.addAll(
|
|
||||||
packageOrClassDescriptor.unsubstitutedMemberScope.getContributedFunctions(lastName, location)
|
|
||||||
.map { it.asImportedFromObject() }
|
|
||||||
)
|
|
||||||
descriptors.addAll(
|
|
||||||
packageOrClassDescriptor.unsubstitutedMemberScope.getContributedVariables(lastName, location)
|
|
||||||
.filterIsInstance<PropertyDescriptor>()
|
|
||||||
.map { it.asImportedFromObject() }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> throw IllegalStateException("Should be class or package: $packageOrClassDescriptor")
|
|
||||||
}
|
}
|
||||||
return descriptors
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun tryResolveDescriptorsWhichCannotBeImported(
|
private fun tryResolveDescriptorsWhichCannotBeImported(
|
||||||
@@ -344,9 +301,6 @@ class QualifiedExpressionResolver {
|
|||||||
val location = KotlinLookupLocation(expression)
|
val location = KotlinLookupLocation(expression)
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum class QualifierPosition {
|
|
||||||
PACKAGE_HEADER, IMPORT, TYPE, EXPRESSION
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun resolveToPackageOrClass(
|
private fun resolveToPackageOrClass(
|
||||||
path: List<QualifierPart>,
|
path: List<QualifierPart>,
|
||||||
@@ -403,7 +357,7 @@ class QualifiedExpressionResolver {
|
|||||||
moduleDescriptor.quickResolveToPackage(path, trace, position)
|
moduleDescriptor.quickResolveToPackage(path, trace, position)
|
||||||
|
|
||||||
var currentDescriptor: DeclarationDescriptor? = prefixDescriptor
|
var currentDescriptor: DeclarationDescriptor? = prefixDescriptor
|
||||||
for (qualifierPartIndex in nextIndexAfterPrefix .. path.size - 1) {
|
for (qualifierPartIndex in nextIndexAfterPrefix..path.size - 1) {
|
||||||
val qualifierPart = path[qualifierPartIndex]
|
val qualifierPart = path[qualifierPartIndex]
|
||||||
|
|
||||||
val nextPackageOrClassDescriptor =
|
val nextPackageOrClassDescriptor =
|
||||||
@@ -499,7 +453,7 @@ class QualifiedExpressionResolver {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (result == null) return QualifiedExpressionResolveResult.UNRESOLVED
|
if (result == null) return QualifiedExpressionResolveResult.UNRESOLVED
|
||||||
return when(index) {
|
return when (index) {
|
||||||
path.size -> QualifiedExpressionResolveResult(result, null)
|
path.size -> QualifiedExpressionResolveResult(result, null)
|
||||||
path.size - 1 -> QualifiedExpressionResolveResult(result, path[index].name)
|
path.size - 1 -> QualifiedExpressionResolveResult(result, path[index].name)
|
||||||
else -> QualifiedExpressionResolveResult.UNRESOLVED
|
else -> QualifiedExpressionResolveResult.UNRESOLVED
|
||||||
@@ -640,12 +594,12 @@ class QualifiedExpressionResolver {
|
|||||||
|
|
||||||
if (descriptor is DeclarationDescriptorWithVisibility) {
|
if (descriptor is DeclarationDescriptorWithVisibility) {
|
||||||
val fromToCheck =
|
val fromToCheck =
|
||||||
if (shouldBeVisibleFrom is PackageFragmentDescriptor && shouldBeVisibleFrom.source == SourceElement.NO_SOURCE && referenceExpression.containingFile !is DummyHolder) {
|
if (shouldBeVisibleFrom is PackageFragmentDescriptor && shouldBeVisibleFrom.source == SourceElement.NO_SOURCE && referenceExpression.containingFile !is DummyHolder) {
|
||||||
PackageFragmentWithCustomSource(shouldBeVisibleFrom, KotlinSourceElement(referenceExpression.getContainingKtFile()))
|
PackageFragmentWithCustomSource(shouldBeVisibleFrom, KotlinSourceElement(referenceExpression.getContainingKtFile()))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
shouldBeVisibleFrom
|
shouldBeVisibleFrom
|
||||||
}
|
}
|
||||||
if (!isVisible(descriptor, fromToCheck, position)) {
|
if (!isVisible(descriptor, fromToCheck, position)) {
|
||||||
trace.report(Errors.INVISIBLE_REFERENCE.on(referenceExpression, descriptor, descriptor.visibility, descriptor))
|
trace.report(Errors.INVISIBLE_REFERENCE.on(referenceExpression, descriptor, descriptor.visibility, descriptor))
|
||||||
}
|
}
|
||||||
@@ -671,21 +625,25 @@ class QualifiedExpressionResolver {
|
|||||||
|
|
||||||
return qualifier
|
return qualifier
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isVisible(
|
internal fun isVisible(
|
||||||
descriptor: DeclarationDescriptor,
|
descriptor: DeclarationDescriptor,
|
||||||
shouldBeVisibleFrom: DeclarationDescriptor?,
|
shouldBeVisibleFrom: DeclarationDescriptor?,
|
||||||
position: QualifierPosition
|
position: QualifierPosition
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (descriptor !is DeclarationDescriptorWithVisibility || shouldBeVisibleFrom == null) return true
|
if (descriptor !is DeclarationDescriptorWithVisibility || shouldBeVisibleFrom == null) return true
|
||||||
|
|
||||||
val visibility = descriptor.visibility
|
val visibility = descriptor.visibility
|
||||||
if (position == QualifierPosition.IMPORT) {
|
if (position == QualifierPosition.IMPORT) {
|
||||||
if (Visibilities.isPrivate(visibility)) return false
|
if (Visibilities.isPrivate(visibility)) return false
|
||||||
if (!visibility.mustCheckInImports()) return true
|
if (!visibility.mustCheckInImports()) return true
|
||||||
}
|
|
||||||
return Visibilities.isVisibleIgnoringReceiver(descriptor, shouldBeVisibleFrom)
|
|
||||||
}
|
}
|
||||||
|
return Visibilities.isVisibleIgnoringReceiver(descriptor, shouldBeVisibleFrom)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum class QualifierPosition {
|
||||||
|
PACKAGE_HEADER, IMPORT, TYPE, EXPRESSION
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,45 +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.*
|
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.BaseImportingScope
|
|
||||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
|
||||||
|
|
||||||
class SingleImportScope(private val aliasName: Name, private val descriptors: Collection<DeclarationDescriptor>) : BaseImportingScope(null) {
|
|
||||||
override fun getContributedClassifier(name: Name, location: LookupLocation)
|
|
||||||
= if (name == aliasName) descriptors.filterIsInstance<ClassifierDescriptor>().singleOrNull() else null
|
|
||||||
|
|
||||||
override fun getContributedPackage(name: Name)
|
|
||||||
= if (name == aliasName) descriptors.filterIsInstance<PackageViewDescriptor>().singleOrNull() else null
|
|
||||||
|
|
||||||
override fun getContributedVariables(name: Name, location: LookupLocation)
|
|
||||||
= if (name == aliasName) descriptors.filterIsInstance<VariableDescriptor>() else emptyList()
|
|
||||||
|
|
||||||
override fun getContributedFunctions(name: Name, location: LookupLocation)
|
|
||||||
= if (name == aliasName) descriptors.filterIsInstance<FunctionDescriptor>() else emptyList()
|
|
||||||
|
|
||||||
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean)
|
|
||||||
= descriptors
|
|
||||||
|
|
||||||
override fun printStructure(p: Printer) {
|
|
||||||
p.println(javaClass.simpleName, ": ", aliasName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -88,13 +88,20 @@ class LazyImportResolver(
|
|||||||
|
|
||||||
qualifiedExpressionResolver.processImportReference(
|
qualifiedExpressionResolver.processImportReference(
|
||||||
directive, moduleDescriptor, traceForImportResolve, excludedImportNames, packageFragment
|
directive, moduleDescriptor, traceForImportResolve, excludedImportNames, packageFragment
|
||||||
)?.apply {
|
)
|
||||||
if (!directive.isAllUnder) {
|
}
|
||||||
PlatformClassesMappedToKotlinChecker.checkPlatformClassesMappedToKotlin(
|
|
||||||
platformToKotlinClassMap, traceForImportResolve, directive, getContributedDescriptors()
|
private val forceResolveImportDirective = storageManager.createMemoizedFunction {
|
||||||
)
|
directive: KtImportDirective ->
|
||||||
}
|
val scope = importedScopesProvider(directive)
|
||||||
|
if (scope is LazyExplicitImportScope) {
|
||||||
|
val allDescriptors = scope.storeReferencesToDescriptors()
|
||||||
|
PlatformClassesMappedToKotlinChecker.checkPlatformClassesMappedToKotlin(
|
||||||
|
platformToKotlinClassMap, traceForImportResolve, directive, allDescriptors
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun forceResolveAllImports() {
|
override fun forceResolveAllImports() {
|
||||||
@@ -140,7 +147,7 @@ class LazyImportResolver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun forceResolveImport(importDirective: KtImportDirective) {
|
override fun forceResolveImport(importDirective: KtImportDirective) {
|
||||||
getImportScope(importDirective)
|
forceResolveImportDirective(importDirective)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <D : DeclarationDescriptor> selectSingleFromImports(
|
fun <D : DeclarationDescriptor> selectSingleFromImports(
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// FILE: com/winterbe/domain/IEntity.java
|
||||||
|
package com.winterbe.domain;
|
||||||
|
import com.winterbe.observer.ObserverSupport;
|
||||||
|
|
||||||
|
public interface IEntity {
|
||||||
|
ObserverSupport getObserverSupport();
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 1.kt
|
||||||
|
package com.winterbe.observer
|
||||||
|
import com.winterbe.domain.IEntity
|
||||||
|
|
||||||
|
abstract class Observer : List<IEntity>
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: 2.kt
|
||||||
|
package com.winterbe.observer
|
||||||
|
import com.winterbe.domain.IEntity
|
||||||
|
|
||||||
|
class ObserverSupport<T : IEntity>(private val observers: List<Observer>)
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package com {
|
||||||
|
|
||||||
|
package com.winterbe {
|
||||||
|
|
||||||
|
package com.winterbe.domain {
|
||||||
|
public /*synthesized*/ fun IEntity(/*0*/ function: () -> com.winterbe.observer.ObserverSupport<(raw) com.winterbe.domain.IEntity>!): com.winterbe.domain.IEntity
|
||||||
|
|
||||||
|
public interface IEntity {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun getObserverSupport(): com.winterbe.observer.ObserverSupport<(raw) com.winterbe.domain.IEntity>!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package com.winterbe.observer {
|
||||||
|
|
||||||
|
public abstract class Observer : kotlin.collections.List<com.winterbe.domain.IEntity> {
|
||||||
|
public constructor Observer()
|
||||||
|
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun contains(/*0*/ element: com.winterbe.domain.IEntity): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.collections.Collection<com.winterbe.domain.IEntity>): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): com.winterbe.domain.IEntity
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun indexOf(/*0*/ element: com.winterbe.domain.IEntity): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.Iterator<com.winterbe.domain.IEntity>
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: com.winterbe.domain.IEntity): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun listIterator(): kotlin.collections.ListIterator<com.winterbe.domain.IEntity>
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.collections.ListIterator<com.winterbe.domain.IEntity>
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.collections.List<com.winterbe.domain.IEntity>
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class ObserverSupport</*0*/ T : com.winterbe.domain.IEntity> {
|
||||||
|
public constructor ObserverSupport</*0*/ T : com.winterbe.domain.IEntity>(/*0*/ observers: kotlin.collections.List<com.winterbe.observer.Observer>)
|
||||||
|
private final val observers: kotlin.collections.List<com.winterbe.observer.Observer>
|
||||||
|
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,13 @@
|
|||||||
|
// FILE: 1.kt
|
||||||
|
package a
|
||||||
|
import b.ObserverSupport
|
||||||
|
|
||||||
|
interface IEntity
|
||||||
|
|
||||||
|
fun IEntity(<!UNUSED_PARAMETER!>f<!>: ObserverSupport<IEntity>) {}
|
||||||
|
|
||||||
|
// FILE: 2.kt
|
||||||
|
package b
|
||||||
|
import a.IEntity
|
||||||
|
|
||||||
|
class ObserverSupport<T : IEntity>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
package a {
|
||||||
|
public fun IEntity(/*0*/ f: b.ObserverSupport<a.IEntity>): kotlin.Unit
|
||||||
|
|
||||||
|
public interface IEntity {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package b {
|
||||||
|
|
||||||
|
public final class ObserverSupport</*0*/ T : a.IEntity> {
|
||||||
|
public constructor ObserverSupport</*0*/ T : a.IEntity>()
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16129,6 +16129,18 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt16086.kt")
|
||||||
|
public void testKt16086() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt16086.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt16086_2.kt")
|
||||||
|
public void testKt16086_2() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt16086_2.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt1639-JFrame.kt")
|
@TestMetadata("kt1639-JFrame.kt")
|
||||||
public void testKt1639_JFrame() throws Exception {
|
public void testKt1639_JFrame() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ERROR: Cannot access 'd': it is private in file
|
// ERROR: Cannot access 'd': it is private in file
|
||||||
// ERROR: Cannot access 'd': it is private in file
|
|
||||||
// ERROR: Cannot access 'b': it is private in file
|
// ERROR: Cannot access 'b': it is private in file
|
||||||
// ERROR: Cannot access 'b': it is private in file
|
// ERROR: Cannot access 'b': it is private in file
|
||||||
|
// ERROR: Cannot access 'd': it is private in file
|
||||||
package to
|
package to
|
||||||
|
|
||||||
import a.b
|
import a.b
|
||||||
|
|||||||
+2
-2
@@ -2,6 +2,6 @@ package foo
|
|||||||
|
|
||||||
import bar.*
|
import bar.*
|
||||||
|
|
||||||
/*p:foo*/fun <T : /*p:foo*/A?, B : /*p:foo*/Iterable</*p:foo*/Number>, C, D> test()
|
/*p:foo*/fun <T : /*p:foo*/A?, B : /*p:foo p:kotlin.collections*/Iterable</*p:foo p:kotlin*/Number>, C, D> test()
|
||||||
where C : /*p:foo*/Number, C : /*p:foo*/Comparable</*p:foo*/Number>, D : B
|
where C : /*p:foo p:kotlin*/Number, C : /*p:foo p:kotlin*/Comparable</*p:foo p:kotlin*/Number>, D : B
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import bar.*
|
|||||||
val a = /*p:kotlin(Int)*/1
|
val a = /*p:kotlin(Int)*/1
|
||||||
var b = /*p:kotlin(String)*/""
|
var b = /*p:kotlin(String)*/""
|
||||||
|
|
||||||
val c: /*c:foo.A c:foo.A.Companion p:foo*/String
|
val c: /*c:foo.A c:foo.A.Companion p:foo p:kotlin*/String
|
||||||
get() = /*c:foo.A p:kotlin(String)*/b
|
get() = /*c:foo.A p:kotlin(String)*/b
|
||||||
|
|
||||||
var d: /*c:foo.A c:foo.A.Companion p:foo*/String = /*p:kotlin(String)*/"ddd"
|
var d: /*c:foo.A c:foo.A.Companion p:foo p:kotlin*/String = /*p:kotlin(String)*/"ddd"
|
||||||
get() = /*p:kotlin(String)*/field
|
get() = /*p:kotlin(String)*/field
|
||||||
set(v) { /*p:kotlin(String)*/field = /*p:kotlin(String)*/v }
|
set(v) { /*p:kotlin(String)*/field = /*p:kotlin(String)*/v }
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ import bar.*
|
|||||||
val a = /*p:kotlin(Int)*/1
|
val a = /*p:kotlin(Int)*/1
|
||||||
|
|
||||||
companion object CO {
|
companion object CO {
|
||||||
fun bar(a: /*c:foo.A.B.CO c:foo.A.B c:foo.A c:foo.A.Companion p:foo*/Int) {}
|
fun bar(a: /*c:foo.A.B.CO c:foo.A.B c:foo.A c:foo.A.Companion p:foo p:kotlin*/Int) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ import bar.*
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*p:foo*/interface I {
|
/*p:foo*/interface I {
|
||||||
var a: /*c:foo.I p:foo*/Int
|
var a: /*c:foo.I p:foo p:kotlin*/Int
|
||||||
fun foo()
|
fun foo()
|
||||||
|
|
||||||
class NI
|
class NI
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
/*p:foo.bar*/fun testComparisons(a: /*p:foo.bar*/A, b: /*p:foo.bar*/Int, c: /*p:foo.bar*/Any, na: /*p:foo.bar*/A?) /*p:kotlin(Boolean)*/{
|
/*p:foo.bar*/fun testComparisons(a: /*p:foo.bar*/A, b: /*p:foo.bar p:kotlin*/Int, c: /*p:foo.bar p:kotlin*/Any, na: /*p:foo.bar*/A?) /*p:kotlin(Boolean)*/{
|
||||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(equals)*/== /*p:kotlin(Any)*/c
|
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(equals)*/== /*p:kotlin(Any)*/c
|
||||||
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(equals)*/!= /*p:kotlin(Any)*/c
|
/*p:foo.bar(A) p:kotlin(Boolean)*/a /*c:foo.bar.A(equals)*/!= /*p:kotlin(Any)*/c
|
||||||
/*p:foo.bar(A) p:kotlin(Boolean)*/na /*c:foo.bar.A(equals)*/== /*p:foo.bar(A)*/a
|
/*p:foo.bar(A) p:kotlin(Boolean)*/na /*c:foo.bar.A(equals)*/== /*p:foo.bar(A)*/a
|
||||||
|
|||||||
+12
-12
@@ -1,15 +1,15 @@
|
|||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
/*p:foo.bar*/class A {
|
/*p:foo.bar*/class A {
|
||||||
operator fun plus(a: /*c:foo.bar.A p:foo.bar*/Int) = /*p:foo.bar(A)*/this
|
operator fun plus(a: /*c:foo.bar.A p:foo.bar p:kotlin*/Int) = /*p:foo.bar(A)*/this
|
||||||
operator fun timesAssign(a: /*c:foo.bar.A p:foo.bar*/Any?) {}
|
operator fun timesAssign(a: /*c:foo.bar.A p:foo.bar p:kotlin*/Any?) {}
|
||||||
operator fun inc(): /*c:foo.bar.A p:foo.bar*/A = /*p:foo.bar(A)*/this
|
operator fun inc(): /*c:foo.bar.A p:foo.bar*/A = /*p:foo.bar(A)*/this
|
||||||
|
|
||||||
operator fun get(i: /*c:foo.bar.A p:foo.bar*/Int) = /*p:kotlin(Int)*/1
|
operator fun get(i: /*c:foo.bar.A p:foo.bar p:kotlin*/Int) = /*p:kotlin(Int)*/1
|
||||||
operator fun contains(a: /*c:foo.bar.A p:foo.bar*/Int): /*c:foo.bar.A p:foo.bar*/Boolean = /*p:kotlin(Boolean)*/false
|
operator fun contains(a: /*c:foo.bar.A p:foo.bar p:kotlin*/Int): /*c:foo.bar.A p:foo.bar p:kotlin*/Boolean = /*p:kotlin(Boolean)*/false
|
||||||
operator fun invoke() {}
|
operator fun invoke() {}
|
||||||
|
|
||||||
operator fun compareTo(a: /*c:foo.bar.A p:foo.bar*/Int) = /*p:kotlin(Int)*/0
|
operator fun compareTo(a: /*c:foo.bar.A p:foo.bar p:kotlin*/Int) = /*p:kotlin(Int)*/0
|
||||||
|
|
||||||
operator fun component1() = /*p:foo.bar(A)*/this
|
operator fun component1() = /*p:foo.bar(A)*/this
|
||||||
|
|
||||||
@@ -17,19 +17,19 @@ package foo.bar
|
|||||||
operator fun next() = /*p:foo.bar(A)*/this
|
operator fun next() = /*p:foo.bar(A)*/this
|
||||||
}
|
}
|
||||||
|
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.minus(a: /*p:foo.bar*/Int) = /*p:foo.bar(A)*/this
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.minus(a: /*p:foo.bar p:kotlin*/Int) = /*p:foo.bar(A)*/this
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.divAssign(a: /*p:foo.bar*/Any?) {}
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.divAssign(a: /*p:foo.bar p:kotlin*/Any?) {}
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.dec(): /*p:foo.bar*/A = /*p:foo.bar(A)*/this
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.dec(): /*p:foo.bar*/A = /*p:foo.bar(A)*/this
|
||||||
|
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.not() {}
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.not() {}
|
||||||
|
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.set(i: /*p:foo.bar*/Int, v: /*p:foo.bar*/Int) {}
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.set(i: /*p:foo.bar p:kotlin*/Int, v: /*p:foo.bar p:kotlin*/Int) {}
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.contains(a: /*p:foo.bar*/Any): /*p:foo.bar*/Boolean = /*p:kotlin(Boolean)*/true
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.contains(a: /*p:foo.bar p:kotlin*/Any): /*p:foo.bar p:kotlin*/Boolean = /*p:kotlin(Boolean)*/true
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.invoke(i: /*p:foo.bar*/Int) {}
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.invoke(i: /*p:foo.bar p:kotlin*/Int) {}
|
||||||
|
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.compareTo(a: /*p:foo.bar*/Any) = /*p:kotlin(Int)*/0
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.compareTo(a: /*p:foo.bar p:kotlin*/Any) = /*p:kotlin(Int)*/0
|
||||||
|
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.component2() = /*p:foo.bar(A)*/this
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.component2() = /*p:foo.bar(A)*/this
|
||||||
|
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A?.iterator() = /*p:foo.bar(A)*/this!!
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A?.iterator() = /*p:foo.bar(A)*/this!!
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/A.hasNext(): /*p:foo.bar*/Boolean = /*p:kotlin(Boolean)*/false
|
/*p:foo.bar*/operator fun /*p:foo.bar*/A.hasNext(): /*p:foo.bar p:kotlin*/Boolean = /*p:kotlin(Boolean)*/false
|
||||||
|
|||||||
+7
-7
@@ -1,22 +1,22 @@
|
|||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
import kotlin.reflect./*p:kotlin.reflect*/KProperty
|
/*p:kotlin.reflect(KProperty)*/import kotlin.reflect.KProperty
|
||||||
|
|
||||||
/*p:foo.bar*/class D1 {
|
/*p:foo.bar*/class D1 {
|
||||||
operator fun getValue(t: /*c:foo.bar.D1 p:foo.bar*/Any?, p: /*c:foo.bar.D1*/KProperty<*>) = /*p:kotlin(Int)*/1
|
operator fun getValue(t: /*c:foo.bar.D1 p:foo.bar p:kotlin*/Any?, p: /*c:foo.bar.D1 p:kotlin.reflect*/KProperty<*>) = /*p:kotlin(Int)*/1
|
||||||
}
|
}
|
||||||
|
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/D1.setValue(t: /*p:foo.bar*/Any?, p: KProperty<*>, v: /*p:foo.bar*/Int) {}
|
/*p:foo.bar*/operator fun /*p:foo.bar*/D1.setValue(t: /*p:foo.bar p:kotlin*/Any?, p: /*p:kotlin.reflect*/KProperty<*>, v: /*p:foo.bar p:kotlin*/Int) {}
|
||||||
|
|
||||||
/*p:foo.bar(D2)*/open class D2 {
|
/*p:foo.bar(D2)*/open class D2 {
|
||||||
operator fun setValue(t: /*c:foo.bar.D2 p:foo.bar*/Any?, p: /*c:foo.bar.D2*/KProperty<*>, v: /*c:foo.bar.D2 p:foo.bar*/Int) {}
|
operator fun setValue(t: /*c:foo.bar.D2 p:foo.bar p:kotlin*/Any?, p: /*c:foo.bar.D2 p:kotlin.reflect*/KProperty<*>, v: /*c:foo.bar.D2 p:foo.bar p:kotlin*/Int) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/D2.getValue(t: /*p:foo.bar*/Any?, p: KProperty<*>) = /*p:kotlin(Int)*/1
|
/*p:foo.bar*/operator fun /*p:foo.bar*/D2.getValue(t: /*p:foo.bar p:kotlin*/Any?, p: /*p:kotlin.reflect*/KProperty<*>) = /*p:kotlin(Int)*/1
|
||||||
/*p:foo.bar*/operator fun /*p:foo.bar*/D2.provideDelegate(p: /*p:foo.bar*/Any?, k: /*p:foo.bar*/Any) = /*p:foo.bar(D2)*/this
|
/*p:foo.bar*/operator fun /*p:foo.bar*/D2.provideDelegate(p: /*p:foo.bar p:kotlin*/Any?, k: /*p:foo.bar p:kotlin*/Any) = /*p:foo.bar(D2)*/this
|
||||||
|
|
||||||
/*p:foo.bar*/class D3 : /*p:foo.bar*/D2() {
|
/*p:foo.bar*/class D3 : /*p:foo.bar*/D2() {
|
||||||
operator fun provideDelegate(p: /*c:foo.bar.D3 c:foo.bar.D2 p:foo.bar*/Any?, k: /*c:foo.bar.D3 c:foo.bar.D2 p:foo.bar*/Any) = /*p:foo.bar(D3)*/this
|
operator fun provideDelegate(p: /*c:foo.bar.D3 c:foo.bar.D2 p:foo.bar p:kotlin*/Any?, k: /*c:foo.bar.D3 c:foo.bar.D2 p:foo.bar p:kotlin*/Any) = /*p:foo.bar(D3)*/this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
/*p:foo.bar*/fun testOperators(a: /*p:foo.bar*/A, b: /*p:foo.bar*/Int) {
|
/*p:foo.bar*/fun testOperators(a: /*p:foo.bar*/A, b: /*p:foo.bar p:kotlin*/Int) {
|
||||||
var d = /*p:foo.bar(A)*/a
|
var d = /*p:foo.bar(A)*/a
|
||||||
|
|
||||||
/*p:foo.bar(A)*/d/*c:foo.bar.A(inc)*/++
|
/*p:foo.bar(A)*/d/*c:foo.bar.A(inc)*/++
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
/*p:foo.bar*/fun testOther(a: /*p:foo.bar*/A, b: /*p:foo.bar*/Int, c: /*p:foo.bar*/Any, na: /*p:foo.bar*/A?) {
|
/*p:foo.bar*/fun testOther(a: /*p:foo.bar*/A, b: /*p:foo.bar p:kotlin*/Int, c: /*p:foo.bar p:kotlin*/Any, na: /*p:foo.bar*/A?) {
|
||||||
/*p:foo.bar(A) c:foo.bar.A(set) c:foo.bar.A(getSet) c:foo.bar.A(getSET) p:foo.bar(set)*/a[1] = /*p:foo.bar(A) c:foo.bar.A(get) p:kotlin(Int)*/a[2]
|
/*p:foo.bar(A) c:foo.bar.A(set) c:foo.bar.A(getSet) c:foo.bar.A(getSET) p:foo.bar(set)*/a[1] = /*p:foo.bar(A) c:foo.bar.A(get) p:kotlin(Int)*/a[2]
|
||||||
|
|
||||||
/*p:kotlin(Int) p:kotlin(Boolean)*/b /*c:foo.bar.A(contains)*/in /*p:foo.bar(A)*/a
|
/*p:kotlin(Int) p:kotlin(Boolean)*/b /*c:foo.bar.A(contains)*/in /*p:foo.bar(A)*/a
|
||||||
|
|||||||
+2
-2
@@ -9,8 +9,8 @@ package foo
|
|||||||
/*p:foo*/fun getListOfA() = /*p:foo p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin.collections(List) p:foo(A)*/listOf(/*p:foo*/A())
|
/*p:foo*/fun getListOfA() = /*p:foo p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin.collections(List) p:foo(A)*/listOf(/*p:foo*/A())
|
||||||
/*p:foo*/fun getListOfB() = /*p:foo p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin.collections(List) p:foo(B)*/listOf(/*p:foo*/B())
|
/*p:foo*/fun getListOfB() = /*p:foo p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin.collections(List) p:foo(B)*/listOf(/*p:foo*/B())
|
||||||
|
|
||||||
/*p:foo*/fun useListOfA(a: /*p:foo*/List</*p:foo*/A>) {}
|
/*p:foo*/fun useListOfA(a: /*p:foo p:kotlin.collections*/List</*p:foo*/A>) {}
|
||||||
/*p:foo*/fun useListOfB(b: /*p:foo*/List</*p:foo*/B>) {}
|
/*p:foo*/fun useListOfB(b: /*p:foo p:kotlin.collections*/List</*p:foo*/B>) {}
|
||||||
|
|
||||||
/*p:foo*/fun testInferredType() {
|
/*p:foo*/fun testInferredType() {
|
||||||
/*p:foo*/useListOfA(/*p:foo p:kotlin.collections(List) p:foo(A)*/getListOfA())
|
/*p:foo*/useListOfA(/*p:foo p:kotlin.collections(List) p:foo(A)*/getListOfA())
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@ package foo
|
|||||||
|
|
||||||
/*p:foo*/class C
|
/*p:foo*/class C
|
||||||
|
|
||||||
/*p:foo*/fun lambdaConsumer(fn: (/*p:foo*/A)->/*p:foo*/Unit) {}
|
/*p:foo*/fun lambdaConsumer(fn: (/*p:foo*/A)->/*p:foo p:kotlin*/Unit) {}
|
||||||
/*p:foo*/fun extensionConsumer(fn: /*p:foo*/A.()->/*p:foo*/Unit) {}
|
/*p:foo*/fun extensionConsumer(fn: /*p:foo*/A.()->/*p:foo p:kotlin*/Unit) {}
|
||||||
|
|
||||||
/*p:foo*/fun testLambdaParameterType() {
|
/*p:foo*/fun testLambdaParameterType() {
|
||||||
/*p:foo*/lambdaConsumer /*p:kotlin(Function1) p:foo(A)*/{ /*p:foo(A)*/it }
|
/*p:foo*/lambdaConsumer /*p:kotlin(Function1) p:foo(A)*/{ /*p:foo(A)*/it }
|
||||||
|
|||||||
+11
-11
@@ -1,6 +1,6 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
import bar./*p:bar*/C
|
/*p:bar(C)*/import bar.C
|
||||||
import baz.*
|
import baz.*
|
||||||
|
|
||||||
/*p:foo*/fun usages() {
|
/*p:foo*/fun usages() {
|
||||||
@@ -11,16 +11,16 @@ import baz.*
|
|||||||
/*p:bar(C)*/c./*c:bar.C*/func()
|
/*p:bar(C)*/c./*c:bar.C*/func()
|
||||||
/*p:bar(C) c:bar.C(B)*/c./*c:bar.C*/B()
|
/*p:bar(C) c:bar.C(B)*/c./*c:bar.C*/B()
|
||||||
|
|
||||||
/*p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin(String)*/C./*c:bar.C*/sfield
|
/*p:bar p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin(String)*/C./*c:bar.C*/sfield
|
||||||
/*p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin(String)*/C./*c:bar.C*/sfield = /*p:kotlin(String)*/"new"
|
/*p:bar p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin(String)*/C./*c:bar.C*/sfield = /*p:kotlin(String)*/"new"
|
||||||
/*p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm*/C./*c:bar.C*/sfunc()
|
/*p:bar p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm*/C./*c:bar.C*/sfunc()
|
||||||
/*p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm c:bar.C(S)*/C./*c:bar.C*/S()
|
/*p:bar p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm c:bar.C(S)*/C./*c:bar.C*/S()
|
||||||
|
|
||||||
// inherited from I
|
// inherited from I
|
||||||
/*p:bar(C)*/c./*c:bar.C*/ifunc()
|
/*p:bar(C)*/c./*c:bar.C*/ifunc()
|
||||||
/*p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin(String)*/C./*c:bar.C*/isfield
|
/*p:bar p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:kotlin(String)*/C./*c:bar.C*/isfield
|
||||||
// expected error: Unresolved reference: IS
|
// expected error: Unresolved reference: IS
|
||||||
/*p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm*/C./*c:bar.C*/IS()
|
/*p:bar p:foo p:baz p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm*/C./*c:bar.C*/IS()
|
||||||
|
|
||||||
|
|
||||||
val i: /*p:foo*/I = /*p:bar(C)*/c
|
val i: /*p:foo*/I = /*p:bar(C)*/c
|
||||||
@@ -35,10 +35,10 @@ import baz.*
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*p:foo*/fun classifiers(
|
/*p:foo*/fun classifiers(
|
||||||
c: C,
|
c: /*p:bar*/C,
|
||||||
b: C./*c:bar.C*/B,
|
b: /*p:bar*/C./*c:bar.C*/B,
|
||||||
s: C./*c:bar.C*/S,
|
s: /*p:bar*/C./*c:bar.C*/S,
|
||||||
cis: C./*c:bar.C*/IS,
|
cis: /*p:bar*/C./*c:bar.C*/IS,
|
||||||
i: /*p:foo*/I,
|
i: /*p:foo*/I,
|
||||||
iis: /*p:foo*/I./*c:foo.I*/IS,
|
iis: /*p:foo*/I./*c:foo.I*/IS,
|
||||||
e: /*p:foo p:baz*/E
|
e: /*p:foo p:baz*/E
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ package local.declarations
|
|||||||
|
|
||||||
import bar.*
|
import bar.*
|
||||||
|
|
||||||
/*p:local.declarations*/fun f(p: /*p:local.declarations*/Any) /*p:kotlin(Int)*/{
|
/*p:local.declarations*/fun f(p: /*p:local.declarations p:kotlin*/Any) /*p:kotlin(Int)*/{
|
||||||
/*p:kotlin(Any) p:kotlin(String)*/p.toString()
|
/*p:kotlin(Any) p:kotlin(String)*/p.toString()
|
||||||
|
|
||||||
val a = /*p:kotlin(Int)*/1
|
val a = /*p:kotlin(Int)*/1
|
||||||
val b = /*p:kotlin(Int)*/a
|
val b = /*p:kotlin(Int)*/a
|
||||||
fun localFun() = /*p:kotlin(Int)*/b
|
fun localFun() = /*p:kotlin(Int)*/b
|
||||||
fun /*p:local.declarations*/Int.localExtFun() = /*p:kotlin(Int)*/localFun()
|
fun /*p:local.declarations p:kotlin*/Int.localExtFun() = /*p:kotlin(Int)*/localFun()
|
||||||
|
|
||||||
abstract class LocalI {
|
abstract class LocalI {
|
||||||
abstract var a: /*p:local.declarations*/Int
|
abstract var a: /*p:local.declarations p:kotlin*/Int
|
||||||
abstract fun foo()
|
abstract fun foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
import bar.*
|
import bar.*
|
||||||
import baz./*p:baz*/C
|
/*p:baz(C)*/import baz.C
|
||||||
|
|
||||||
/*p:foo*/val a = /*p:foo p:bar*/A()
|
/*p:foo*/val a = /*p:foo p:bar*/A()
|
||||||
/*p:foo*/var b: /*p:foo p:bar p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm*/baz./*p:baz*/B = /*p:foo p:bar p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:baz(B)*/baz./*p:baz*/B()
|
/*p:foo*/var b: /*p:foo p:bar p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm*/baz./*p:baz*/B = /*p:foo p:bar p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:baz(B)*/baz./*p:baz*/B()
|
||||||
@@ -11,7 +11,7 @@ import baz./*p:baz*/C
|
|||||||
/*p:kotlin(Nothing)*/return /*p:foo p:bar*/B()
|
/*p:kotlin(Nothing)*/return /*p:foo p:bar*/B()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*p:foo*/fun /*p:foo*/MyClass.extFunc(p: /**p:foo p:bar*//*p:foo*/Array</*p:foo p:bar*/B>, e: /*p:foo*/MyEnum, c: /**???*/C): /*p:foo*/MyInterface /*p:kotlin(Nothing)*/{
|
/*p:foo*/fun /*p:foo*/MyClass.extFunc(p: /**p:foo p:bar*//*p:foo p:kotlin*/Array</*p:foo p:bar*/B>, e: /*p:foo*/MyEnum, c: /**???*//*p:baz*/C): /*p:foo*/MyInterface /*p:kotlin(Nothing)*/{
|
||||||
/*c:foo.MyClass c:foo.MyClass(getB) p:foo p:bar p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:baz(B)*/b
|
/*c:foo.MyClass c:foo.MyClass(getB) p:foo p:bar p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm p:baz(B)*/b
|
||||||
/*p:kotlin(Nothing)*/return /*c:foo.MyClass p:foo p:bar p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm*/MyClass()
|
/*p:kotlin(Nothing)*/return /*c:foo.MyClass p:foo p:bar p:kotlin p:kotlin.annotation p:kotlin.collections p:kotlin.ranges p:kotlin.sequences p:kotlin.text p:kotlin.io p:kotlin.comparisons p:java.lang p:kotlin.jvm*/MyClass()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
/*p:foo.bar*/fun main(args: /*p:foo.bar*/Array</*p:foo.bar*/String>) {
|
/*p:foo.bar*/fun main(args: /*p:foo.bar p:kotlin*/Array</*p:foo.bar p:kotlin*/String>) {
|
||||||
val f: /*p:foo.bar*/Array</*p:foo.bar*/Int>
|
val f: /*p:foo.bar p:kotlin*/Array</*p:foo.bar p:kotlin*/Int>
|
||||||
val s: /*p:foo.bar*/String
|
val s: /*p:foo.bar p:kotlin*/String
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
import /*p:<root>*/JavaClass
|
/*p:<root>(JavaClass)*/import JavaClass
|
||||||
|
|
||||||
/*p:foo*/class KotlinClass : JavaClass() {
|
/*p:foo*/class KotlinClass : /*p:<root>*/JavaClass() {
|
||||||
override fun getFoo() = /*p:kotlin(Int)*/2
|
override fun getFoo() = /*p:kotlin(Int)*/2
|
||||||
fun setFoo(i: /*c:foo.KotlinClass c:JavaClass p:foo*/Int) {}
|
fun setFoo(i: /*c:foo.KotlinClass c:JavaClass p:foo p:kotlin*/Int) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package foo.bar
|
package foo.bar
|
||||||
|
|
||||||
import /*p:<root>*/JavaClass
|
/*p:<root>(JavaClass)*/import JavaClass
|
||||||
import foo./*p:foo*/KotlinClass
|
/*p:foo(KotlinClass)*/import foo.KotlinClass
|
||||||
|
|
||||||
/*p:foo.bar*/fun test() {
|
/*p:foo.bar*/fun test() {
|
||||||
val j = /*p:<root>*/JavaClass()
|
val j = /*p:<root>*/JavaClass()
|
||||||
|
|||||||
Reference in New Issue
Block a user