Preserve type capabilities while substituting

`val result` in test data rendered descriptors should be rendered as having raw type
This commit is contained in:
Denis Zharkov
2015-08-29 13:48:11 +03:00
parent 3b80bf5bda
commit 6dc08f76a6
5 changed files with 58 additions and 2 deletions
@@ -0,0 +1,20 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: A.java
import java.util.*;
class A<T> {
public class Inner<E> {
List<T> foo() {}
}
}
// FILE: Test.java
class Test {
static A rawAField = null;
}
// FILE: main.kt
val result = Test.rawAField.Inner<Double>().foo()
@@ -0,0 +1,28 @@
package
internal val result: kotlin.(Mutable)List<(raw) kotlin.Any?>!
public/*package*/ open class A</*0*/ T : kotlin.Any!> {
public/*package*/ constructor A</*0*/ T : kotlin.Any!>()
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</*0*/ E : kotlin.Any!> {
public constructor Inner</*0*/ E : kotlin.Any!>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public/*package*/ open fun foo(): kotlin.(Mutable)List<T!>!
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!>!
}
@@ -61,7 +61,7 @@ internal final class HashMapEx</*0*/ K, /*1*/ V> : java.util.HashMap<K, V>, 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<kotlin.Any!, kotlin.Any!>..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<V>
invisible_fake open override /*1*/ /*fake_override*/ fun writeObject(/*0*/ p0: java.io.ObjectOutputStream!): kotlin.Unit
}
@@ -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");
@@ -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);
}