[FIR] add missing Any super type to Cloneable
^KTIJ-24272 Fixed
This commit is contained in:
committed by
Space Team
parent
85919c4d62
commit
050c66ea81
+6
@@ -20084,6 +20084,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ktij24272.kt")
|
||||||
|
public void testKtij24272() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/ktij24272.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("matchers.kt")
|
@TestMetadata("matchers.kt")
|
||||||
public void testMatchers() throws Exception {
|
public void testMatchers() throws Exception {
|
||||||
|
|||||||
+6
@@ -20084,6 +20084,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ktij24272.kt")
|
||||||
|
public void testKtij24272() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/ktij24272.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("matchers.kt")
|
@TestMetadata("matchers.kt")
|
||||||
public void testMatchers() throws Exception {
|
public void testMatchers() throws Exception {
|
||||||
|
|||||||
+6
@@ -20084,6 +20084,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ktij24272.kt")
|
||||||
|
public void testKtij24272() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/ktij24272.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("matchers.kt")
|
@TestMetadata("matchers.kt")
|
||||||
public void testMatchers() throws Exception {
|
public void testMatchers() throws Exception {
|
||||||
|
|||||||
+6
@@ -20090,6 +20090,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ktij24272.kt")
|
||||||
|
public void testKtij24272() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/ktij24272.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("matchers.kt")
|
@TestMetadata("matchers.kt")
|
||||||
public void testMatchers() throws Exception {
|
public void testMatchers() throws Exception {
|
||||||
|
|||||||
+12
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
|||||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildRegularClass
|
import org.jetbrains.kotlin.fir.declarations.builder.buildRegularClass
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunction
|
import org.jetbrains.kotlin.fir.declarations.builder.buildSimpleFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
|
||||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolNamesProvider
|
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolNamesProvider
|
||||||
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolNamesProviderWithoutCallables
|
import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolNamesProviderWithoutCallables
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl
|
||||||
@@ -36,7 +35,7 @@ import org.jetbrains.kotlin.name.StandardClassIds
|
|||||||
class FirCloneableSymbolProvider(
|
class FirCloneableSymbolProvider(
|
||||||
session: FirSession,
|
session: FirSession,
|
||||||
moduleData: FirModuleData,
|
moduleData: FirModuleData,
|
||||||
scopeProvider: FirScopeProvider
|
scopeProvider: FirScopeProvider,
|
||||||
) : FirSymbolProvider(session) {
|
) : FirSymbolProvider(session) {
|
||||||
private val klass = buildRegularClass {
|
private val klass = buildRegularClass {
|
||||||
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
||||||
@@ -47,9 +46,14 @@ class FirCloneableSymbolProvider(
|
|||||||
Modality.ABSTRACT,
|
Modality.ABSTRACT,
|
||||||
EffectiveVisibility.Public
|
EffectiveVisibility.Public
|
||||||
)
|
)
|
||||||
|
|
||||||
classKind = ClassKind.INTERFACE
|
classKind = ClassKind.INTERFACE
|
||||||
val classSymbol = FirRegularClassSymbol(StandardClassIds.Cloneable)
|
val classSymbol = FirRegularClassSymbol(StandardClassIds.Cloneable)
|
||||||
symbol = classSymbol
|
symbol = classSymbol
|
||||||
|
superTypeRefs += buildResolvedTypeRef {
|
||||||
|
type = session.builtinTypes.anyType.type
|
||||||
|
}
|
||||||
|
|
||||||
declarations += buildSimpleFunction {
|
declarations += buildSimpleFunction {
|
||||||
this.moduleData = moduleData
|
this.moduleData = moduleData
|
||||||
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
||||||
@@ -57,14 +61,18 @@ class FirCloneableSymbolProvider(
|
|||||||
returnTypeRef = buildResolvedTypeRef {
|
returnTypeRef = buildResolvedTypeRef {
|
||||||
type = session.builtinTypes.anyType.type
|
type = session.builtinTypes.anyType.type
|
||||||
}
|
}
|
||||||
|
|
||||||
status = FirResolvedDeclarationStatusImpl(
|
status = FirResolvedDeclarationStatusImpl(
|
||||||
Visibilities.Protected,
|
Visibilities.Protected,
|
||||||
Modality.OPEN,
|
Modality.OPEN,
|
||||||
Visibilities.Protected.toEffectiveVisibility(classSymbol))
|
Visibilities.Protected.toEffectiveVisibility(classSymbol)
|
||||||
|
)
|
||||||
|
|
||||||
name = StandardClassIds.Callables.clone.callableName
|
name = StandardClassIds.Callables.clone.callableName
|
||||||
symbol = FirNamedFunctionSymbol(StandardClassIds.Callables.clone)
|
symbol = FirNamedFunctionSymbol(StandardClassIds.Callables.clone)
|
||||||
dispatchReceiverType = this@buildRegularClass.symbol.constructType(emptyArray(), isNullable = false)
|
dispatchReceiverType = this@buildRegularClass.symbol.constructType(emptyArray(), isNullable = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scopeProvider = scopeProvider
|
this.scopeProvider = scopeProvider
|
||||||
name = StandardClassIds.Cloneable.shortClassName
|
name = StandardClassIds.Cloneable.shortClassName
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// FILE: use.kt
|
||||||
|
package one
|
||||||
|
|
||||||
|
fun getStructureElementFor() {
|
||||||
|
val container: SuperJava = if (true) {
|
||||||
|
true <!CAST_NEVER_SUCCEEDS!>as<!> Child2
|
||||||
|
} else {
|
||||||
|
false <!CAST_NEVER_SUCCEEDS!>as<!> Child1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: SuperJava.java
|
||||||
|
package one;
|
||||||
|
|
||||||
|
public class SuperJava {
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Child1.java
|
||||||
|
package one;
|
||||||
|
|
||||||
|
public class Child1 extends SuperJava implements Cloneable {
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Child2.java
|
||||||
|
package one;
|
||||||
|
|
||||||
|
public class Child2 extends SuperJava implements Cloneable {
|
||||||
|
}
|
||||||
Generated
+6
@@ -20090,6 +20090,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
runTest("compiler/testData/diagnostics/tests/j+k/kt7523.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("ktij24272.kt")
|
||||||
|
public void testKtij24272() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/j+k/ktij24272.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("matchers.kt")
|
@TestMetadata("matchers.kt")
|
||||||
public void testMatchers() throws Exception {
|
public void testMatchers() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user