diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/saveRawCapabilitiesAfterSubtitution.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/saveRawCapabilitiesAfterSubtitution.kt new file mode 100644 index 00000000000..aac713a9e7a --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/saveRawCapabilitiesAfterSubtitution.kt @@ -0,0 +1,20 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// FILE: A.java + +import java.util.*; + +class A { + public class Inner { + List foo() {} + } +} + +// FILE: Test.java + +class Test { + static A rawAField = null; +} + +// FILE: main.kt + +val result = Test.rawAField.Inner().foo() diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/saveRawCapabilitiesAfterSubtitution.txt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/saveRawCapabilitiesAfterSubtitution.txt new file mode 100644 index 00000000000..6c2a20593fb --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/saveRawCapabilitiesAfterSubtitution.txt @@ -0,0 +1,28 @@ +package + +internal val result: kotlin.(Mutable)List<(raw) kotlin.Any?>! + +public/*package*/ open class A { + public/*package*/ 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 open inner class Inner { + public constructor Inner() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public/*package*/ open fun foo(): kotlin.(Mutable)List! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +public/*package*/ open class Test { + public/*package*/ constructor Test() + 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 + + // Static members + public/*package*/ final var rawAField: A<(raw) kotlin.Any!>! +} diff --git a/compiler/testData/diagnostics/tests/platformTypes/supertypeTypeArguments.txt b/compiler/testData/diagnostics/tests/platformTypes/supertypeTypeArguments.txt index d9c2082df6f..b9e3587c525 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/supertypeTypeArguments.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/supertypeTypeArguments.txt @@ -61,7 +61,7 @@ internal final class HashMapEx : java.util.HashMap, ExtM invisible_fake open override /*1*/ /*fake_override*/ fun resize(/*0*/ p0: kotlin.Int): kotlin.Unit public open override /*2*/ /*fake_override*/ fun size(): kotlin.Int public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String - invisible_fake open override /*1*/ /*fake_override*/ fun transfer(/*0*/ p0: kotlin.Array<(out) (java.util.HashMap.Entry..java.util.HashMap.Entry<*, *>?)>!, /*1*/ p1: kotlin.Boolean): kotlin.Unit + invisible_fake open override /*1*/ /*fake_override*/ fun transfer(/*0*/ p0: kotlin.Array<(out) java.util.HashMap.Entry<(raw) kotlin.Any!, (raw) kotlin.Any!>!>!, /*1*/ p1: kotlin.Boolean): kotlin.Unit public open override /*2*/ /*fake_override*/ fun values(): kotlin.MutableCollection invisible_fake open override /*1*/ /*fake_override*/ fun writeObject(/*0*/ p0: java.io.ObjectOutputStream!): kotlin.Unit } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 40d0c0666b4..f3d3c79370d 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -10772,6 +10772,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("saveRawCapabilitiesAfterSubtitution.kt") + public void testSaveRawCapabilitiesAfterSubtitution() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/rawTypes/saveRawCapabilitiesAfterSubtitution.kt"); + doTest(fileName); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/rawTypes/simple.kt"); diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitutor.java b/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitutor.java index f082cf059e4..1ca07c0bf8d 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitutor.java +++ b/core/descriptors/src/org/jetbrains/kotlin/types/TypeSubstitutor.java @@ -230,7 +230,9 @@ public class TypeSubstitutor { type.getConstructor(), // The same constructor type.isMarkedNullable(), // Same nullability substitutedArguments, - new SubstitutingScope(type.getMemberScope(), create(substitutionFilteringTypeParameters))); + substitutionFilteringTypeParameters, + new SubstitutingScope(type.getMemberScope(), create(substitutionFilteringTypeParameters)), + type.getCapabilities()); return new TypeProjectionImpl(projectionKind, substitutedType); }