Fix incremental compilation for calls to inner classes from supertypes
The problem became actual after 8c2baf0704
This commit is contained in:
committed by
Ilya Muradyan
parent
6b81cc8b77
commit
3ce980fd88
+5
@@ -310,6 +310,11 @@ public class IncrementalJsCompilerRunnerTestGenerated extends AbstractIncrementa
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassesFromSupertypes")
|
||||||
|
public void testInnerClassesFromSupertypes() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/innerClassesFromSupertypes/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("internalClassChanged")
|
@TestMetadata("internalClassChanged")
|
||||||
public void testInternalClassChanged() throws Exception {
|
public void testInternalClassChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
||||||
|
|||||||
+5
@@ -310,6 +310,11 @@ public class IncrementalJsCompilerRunnerWithMetadataOnlyTestGenerated extends Ab
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassesFromSupertypes")
|
||||||
|
public void testInnerClassesFromSupertypes() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/innerClassesFromSupertypes/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("internalClassChanged")
|
@TestMetadata("internalClassChanged")
|
||||||
public void testInternalClassChanged() throws Exception {
|
public void testInternalClassChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
||||||
|
|||||||
+5
@@ -312,6 +312,11 @@ public class IncrementalJsKlibCompilerRunnerTestGenerated extends AbstractIncrem
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassesFromSupertypes")
|
||||||
|
public void testInnerClassesFromSupertypes() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/innerClassesFromSupertypes/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("internalClassChanged")
|
@TestMetadata("internalClassChanged")
|
||||||
public void testInternalClassChanged() throws Exception {
|
public void testInternalClassChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
||||||
|
|||||||
+5
@@ -310,6 +310,11 @@ public class IncrementalJsKlibCompilerWithScopeExpansionRunnerTestGenerated exte
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassesFromSupertypes")
|
||||||
|
public void testInnerClassesFromSupertypes() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/innerClassesFromSupertypes/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("internalClassChanged")
|
@TestMetadata("internalClassChanged")
|
||||||
public void testInternalClassChanged() throws Exception {
|
public void testInternalClassChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
||||||
|
|||||||
+5
@@ -311,6 +311,11 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassesFromSupertypes")
|
||||||
|
public void testInnerClassesFromSupertypes() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/innerClassesFromSupertypes/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("internalClassChanged")
|
@TestMetadata("internalClassChanged")
|
||||||
public void testInternalClassChanged() throws Exception {
|
public void testInternalClassChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
||||||
|
|||||||
+5
@@ -311,6 +311,11 @@ public class IrIncrementalJvmCompilerRunnerTestGenerated extends AbstractIrIncre
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassesFromSupertypes")
|
||||||
|
public void testInnerClassesFromSupertypes() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/innerClassesFromSupertypes/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("internalClassChanged")
|
@TestMetadata("internalClassChanged")
|
||||||
public void testInternalClassChanged() throws Exception {
|
public void testInternalClassChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
||||||
|
|||||||
+1
@@ -126,6 +126,7 @@ class MetadataPackageFragment(
|
|||||||
override fun hasClass(name: Name): Boolean = hasTopLevelClass(name)
|
override fun hasClass(name: Name): Boolean = hasTopLevelClass(name)
|
||||||
override fun definitelyDoesNotContainName(name: Name) = false
|
override fun definitelyDoesNotContainName(name: Name) = false
|
||||||
override fun getClassifierNames(): Set<Name>? = null
|
override fun getClassifierNames(): Set<Name>? = null
|
||||||
|
override fun getNonDeclaredClassifierNames(): Set<Name>? = null
|
||||||
})
|
})
|
||||||
|
|
||||||
return ChainedMemberScope.create("Metadata scope", scopes)
|
return ChainedMemberScope.create("Metadata scope", scopes)
|
||||||
|
|||||||
+7
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.types.SimpleType
|
|||||||
import org.jetbrains.kotlin.types.TypeConstructor
|
import org.jetbrains.kotlin.types.TypeConstructor
|
||||||
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
|
import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
|
||||||
import org.jetbrains.kotlin.types.refinement.TypeRefinement
|
import org.jetbrains.kotlin.types.refinement.TypeRefinement
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.flatMapToNullable
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class DeserializedClassDescriptor(
|
class DeserializedClassDescriptor(
|
||||||
@@ -307,6 +308,12 @@ class DeserializedClassDescriptor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getNonDeclaredClassifierNames(): Set<Name>? {
|
||||||
|
return classDescriptor.typeConstructor.supertypes.flatMapToNullable(LinkedHashSet()) {
|
||||||
|
it.memberScope.getClassifierNames()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||||
recordLookup(name, location)
|
recordLookup(name, location)
|
||||||
classDescriptor.enumEntries?.findEnumEntry(name)?.let { return it }
|
classDescriptor.enumEntries?.findEnumEntry(name)?.let { return it }
|
||||||
|
|||||||
+8
-1
@@ -81,9 +81,15 @@ abstract class DeserializedMemberScope protected constructor(
|
|||||||
|
|
||||||
internal val classNames by c.storageManager.createLazyValue { classNames().toSet() }
|
internal val classNames by c.storageManager.createLazyValue { classNames().toSet() }
|
||||||
|
|
||||||
|
|
||||||
|
private val classifierNamesLazy = c.storageManager.createNullableLazyValue {
|
||||||
|
val nonDeclaredNames = getNonDeclaredClassifierNames() ?: return@createNullableLazyValue null
|
||||||
|
this.classNames + typeAliasNames + nonDeclaredNames
|
||||||
|
}
|
||||||
|
|
||||||
override fun getFunctionNames() = functionNamesLazy
|
override fun getFunctionNames() = functionNamesLazy
|
||||||
override fun getVariableNames() = variableNamesLazy
|
override fun getVariableNames() = variableNamesLazy
|
||||||
override fun getClassifierNames(): Set<Name>? = classNames + typeAliasNames
|
override fun getClassifierNames(): Set<Name>? = classifierNamesLazy()
|
||||||
|
|
||||||
override fun definitelyDoesNotContainName(name: Name): Boolean {
|
override fun definitelyDoesNotContainName(name: Name): Boolean {
|
||||||
return name !in functionNamesLazy && name !in variableNamesLazy && name !in classNames && name !in typeAliasNames
|
return name !in functionNamesLazy && name !in variableNamesLazy && name !in classNames && name !in typeAliasNames
|
||||||
@@ -256,6 +262,7 @@ abstract class DeserializedMemberScope protected constructor(
|
|||||||
|
|
||||||
protected abstract fun getNonDeclaredFunctionNames(): Set<Name>
|
protected abstract fun getNonDeclaredFunctionNames(): Set<Name>
|
||||||
protected abstract fun getNonDeclaredVariableNames(): Set<Name>
|
protected abstract fun getNonDeclaredVariableNames(): Set<Name>
|
||||||
|
protected abstract fun getNonDeclaredClassifierNames(): Set<Name>?
|
||||||
|
|
||||||
protected abstract fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean)
|
protected abstract fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean)
|
||||||
|
|
||||||
|
|||||||
+1
@@ -69,6 +69,7 @@ open class DeserializedPackageMemberScope(
|
|||||||
|
|
||||||
override fun getNonDeclaredFunctionNames(): Set<Name> = emptySet()
|
override fun getNonDeclaredFunctionNames(): Set<Name> = emptySet()
|
||||||
override fun getNonDeclaredVariableNames(): Set<Name> = emptySet()
|
override fun getNonDeclaredVariableNames(): Set<Name> = emptySet()
|
||||||
|
override fun getNonDeclaredClassifierNames(): Set<Name>? = emptySet()
|
||||||
|
|
||||||
override fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean) {
|
override fun addEnumEntryDescriptors(result: MutableCollection<DeclarationDescriptor>, nameFilter: (Name) -> Boolean) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|||||||
Generated
+5
@@ -979,6 +979,11 @@ public class IncrementalJvmJpsTestGenerated extends AbstractIncrementalJvmJpsTes
|
|||||||
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/inlineUsedWhereDeclared/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("innerClassesFromSupertypes")
|
||||||
|
public void testInnerClassesFromSupertypes() throws Exception {
|
||||||
|
runTest("jps-plugin/testData/incremental/pureKotlin/innerClassesFromSupertypes/");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("internalClassChanged")
|
@TestMetadata("internalClassChanged")
|
||||||
public void testInternalClassChanged() throws Exception {
|
public void testInternalClassChanged() throws Exception {
|
||||||
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
runTest("jps-plugin/testData/incremental/pureKotlin/internalClassChanged/");
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
abstract class A {
|
||||||
|
inner class Inner(val x: String)
|
||||||
|
}
|
||||||
|
abstract class B : A()
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// TODO add var
|
||||||
|
package test
|
||||||
|
|
||||||
|
class C : B() {
|
||||||
|
val i = Inner("")
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
================ Step #1 =================
|
||||||
|
|
||||||
|
Cleaning output files:
|
||||||
|
out/production/module/META-INF/module.kotlin_module
|
||||||
|
out/production/module/test/C.class
|
||||||
|
End of files
|
||||||
|
Compiling files:
|
||||||
|
src/b.kt
|
||||||
|
End of files
|
||||||
|
Exit code: OK
|
||||||
|
------------------------------------------
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
C().i.x
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user