Do not overuse makeNullableAsSpecified in TypeSubstitutor
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
// FILE: p/MultiMap.java
|
||||||
|
|
||||||
|
package p;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class MultiMap<K, V> {
|
||||||
|
public Set<Collection<V>> entrySet() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: k.kt
|
||||||
|
|
||||||
|
import p.*
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val map = MultiMap<Int, String>()
|
||||||
|
val set = map.entrySet()
|
||||||
|
set.iterator()
|
||||||
|
|
||||||
|
val set1 = map.entrySet()!!
|
||||||
|
set1.iterator()
|
||||||
|
}
|
||||||
@@ -7779,6 +7779,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/platformTypes/methodCall"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/platformTypes/methodCall"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("entrySet.kt")
|
||||||
|
public void testEntrySet() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/platformTypes/methodCall/entrySet.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("int.kt")
|
@TestMetadata("int.kt")
|
||||||
public void testInt() throws Exception {
|
public void testInt() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/methodCall/int.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/platformTypes/methodCall/int.kt");
|
||||||
|
|||||||
@@ -191,8 +191,8 @@ public class TypeSubstitutor {
|
|||||||
substitutedType = typeVariable.substitutionResult(replacement.getType());
|
substitutedType = typeVariable.substitutionResult(replacement.getType());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
boolean resultingIsNullable = type.isNullable() || replacement.getType().isNullable();
|
// this is a simple type T or T?: if it's T, we should just take replacement, if T? - we make replacement nullable
|
||||||
substitutedType = TypeUtils.makeNullableAsSpecified(replacement.getType(), resultingIsNullable);
|
substitutedType = type.isNullable() ? TypeUtils.makeNullable(replacement.getType()) : replacement.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
Variance resultingProjectionKind = combine(originalProjectionKind, replacement.getProjectionKind());
|
Variance resultingProjectionKind = combine(originalProjectionKind, replacement.getProjectionKind());
|
||||||
|
|||||||
Reference in New Issue
Block a user