Don't check DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE when compiling to 1.0
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.resolve.checkers
|
package org.jetbrains.kotlin.resolve.checkers
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
|
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
@@ -30,13 +32,16 @@ import org.jetbrains.kotlin.resolve.DelegationResolver
|
|||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
import org.jetbrains.kotlin.resolve.OverridingUtil
|
import org.jetbrains.kotlin.resolve.OverridingUtil
|
||||||
|
|
||||||
class DelegationChecker : SimpleDeclarationChecker {
|
class DelegationChecker : DeclarationChecker {
|
||||||
override fun check(
|
override fun check(
|
||||||
declaration: KtDeclaration,
|
declaration: KtDeclaration,
|
||||||
descriptor: DeclarationDescriptor,
|
descriptor: DeclarationDescriptor,
|
||||||
diagnosticHolder: DiagnosticSink,
|
diagnosticHolder: DiagnosticSink,
|
||||||
bindingContext: BindingContext
|
bindingContext: BindingContext,
|
||||||
|
languageVersionSettings: LanguageVersionSettings
|
||||||
) {
|
) {
|
||||||
|
if (languageVersionSettings.languageVersion == LanguageVersion.KOTLIN_1_0) return
|
||||||
|
|
||||||
if (descriptor !is ClassDescriptor) return
|
if (descriptor !is ClassDescriptor) return
|
||||||
if (declaration !is KtClassOrObject) return
|
if (declaration !is KtClassOrObject) return
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// LANGUAGE_VERSION: 1.0
|
||||||
|
|
||||||
|
public interface Base {
|
||||||
|
fun test() = "base fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Base2 : Base {
|
||||||
|
override fun test() = "base 2fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
class Delegate : Base {
|
||||||
|
override fun test(): String {
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return object : Base2, Base by Delegate() {
|
||||||
|
}.test()
|
||||||
|
}
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
@kotlin.Metadata
|
||||||
|
public interface Base {
|
||||||
|
inner class Base/DefaultImpls
|
||||||
|
public abstract @org.jetbrains.annotations.NotNull method test(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class Base/DefaultImpls {
|
||||||
|
inner class Base/DefaultImpls
|
||||||
|
public static @org.jetbrains.annotations.NotNull method test(p0: Base): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public interface Base2 {
|
||||||
|
inner class Base2/DefaultImpls
|
||||||
|
public abstract @org.jetbrains.annotations.NotNull method test(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class Base2/DefaultImpls {
|
||||||
|
inner class Base2/DefaultImpls
|
||||||
|
public static @org.jetbrains.annotations.NotNull method test(p0: Base2): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class Delegate {
|
||||||
|
public method <init>(): void
|
||||||
|
public @org.jetbrains.annotations.NotNull method test(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlin.Metadata
|
||||||
|
public final class HiddenSuperOverrideIn1_0Kt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
+6
@@ -6251,6 +6251,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
|
||||||
|
public void testHiddenSuperOverrideIn1_0() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt8154.kt")
|
@TestMetadata("kt8154.kt")
|
||||||
public void testKt8154() throws Exception {
|
public void testKt8154() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt");
|
||||||
|
|||||||
@@ -6251,6 +6251,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
|
||||||
|
public void testHiddenSuperOverrideIn1_0() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt8154.kt")
|
@TestMetadata("kt8154.kt")
|
||||||
public void testKt8154() throws Exception {
|
public void testKt8154() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt");
|
||||||
|
|||||||
@@ -6251,6 +6251,12 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
|
||||||
|
public void testHiddenSuperOverrideIn1_0() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt8154.kt")
|
@TestMetadata("kt8154.kt")
|
||||||
public void testKt8154() throws Exception {
|
public void testKt8154() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt");
|
||||||
|
|||||||
@@ -7080,6 +7080,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("hiddenSuperOverrideIn1.0.kt")
|
||||||
|
public void testHiddenSuperOverrideIn1_0() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/hiddenSuperOverrideIn1.0.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt8154.kt")
|
@TestMetadata("kt8154.kt")
|
||||||
public void testKt8154() throws Exception {
|
public void testKt8154() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegation/kt8154.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user