[FE 1.0] Don't expand type enhancement
Actually shallow type enhancement is primary, it's more specific ^KT-50734 Fixed
This commit is contained in:
committed by
teamcity
parent
59b92c02b4
commit
6c994787b3
+6
@@ -98,6 +98,12 @@ public class FirOldFrontendForeignAnnotationsCompiledJavaTestGenerated extends A
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt50734.kt")
|
||||||
|
public void testKt50734() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt50734.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lombokSimple.kt")
|
@TestMetadata("lombokSimple.kt")
|
||||||
public void testLombokSimple() throws Exception {
|
public void testLombokSimple() throws Exception {
|
||||||
|
|||||||
+6
@@ -98,6 +98,12 @@ public class FirOldFrontendForeignAnnotationsCompiledJavaWithPsiClassReadingTest
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt50734.kt")
|
||||||
|
public void testKt50734() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt50734.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lombokSimple.kt")
|
@TestMetadata("lombokSimple.kt")
|
||||||
public void testLombokSimple() throws Exception {
|
public void testLombokSimple() throws Exception {
|
||||||
|
|||||||
+6
@@ -98,6 +98,12 @@ public class FirOldFrontendForeignAnnotationsSourceJavaTestGenerated extends Abs
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt50734.kt")
|
||||||
|
public void testKt50734() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt50734.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lombokSimple.kt")
|
@TestMetadata("lombokSimple.kt")
|
||||||
public void testLombokSimple() throws Exception {
|
public void testLombokSimple() throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// FILE: Supplier.java
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.annotations.Nullable;
|
||||||
|
|
||||||
|
// Shown from RxJava for reference
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface Supplier<@NonNull T> {
|
||||||
|
T get() throws Throwable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Maybe.java
|
||||||
|
public abstract class Maybe<T> {
|
||||||
|
public final void subscribe() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: FromSupplier.java
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.annotations.Nullable;
|
||||||
|
|
||||||
|
public class FromSupplier {
|
||||||
|
static <@NonNull T> Maybe<T> fromSupplier3(Supplier<? extends @Nullable T> supplier) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
static <@NonNull T> Maybe<T> fromSupplier5(@NonNull Supplier<? extends @Nullable T> supplier) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
fun main() {
|
||||||
|
// No Warning
|
||||||
|
// In this case, we have nullable type enhancement
|
||||||
|
FromSupplier.fromSupplier3<Boolean> { null }
|
||||||
|
.subscribe()
|
||||||
|
|
||||||
|
// In this case, we have not-null type enhancement
|
||||||
|
// Warning: Type Mismatch: Required Boolean? found Nothing
|
||||||
|
FromSupplier.fromSupplier5<Boolean> { null }
|
||||||
|
.subscribe()
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
// FILE: Supplier.java
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.annotations.Nullable;
|
||||||
|
|
||||||
|
// Shown from RxJava for reference
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface Supplier<@NonNull T> {
|
||||||
|
T get() throws Throwable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Maybe.java
|
||||||
|
public abstract class Maybe<T> {
|
||||||
|
public final void subscribe() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: FromSupplier.java
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.annotations.Nullable;
|
||||||
|
|
||||||
|
public class FromSupplier {
|
||||||
|
static <@NonNull T> Maybe<T> fromSupplier3(Supplier<? extends @Nullable T> supplier) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
static <@NonNull T> Maybe<T> fromSupplier5(@NonNull Supplier<? extends @Nullable T> supplier) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
fun main() {
|
||||||
|
// No Warning
|
||||||
|
// In this case, we have nullable type enhancement
|
||||||
|
FromSupplier.fromSupplier3<Boolean> { <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!> }
|
||||||
|
.subscribe()
|
||||||
|
|
||||||
|
// In this case, we have not-null type enhancement
|
||||||
|
// Warning: Type Mismatch: Required Boolean? found Nothing
|
||||||
|
FromSupplier.fromSupplier5<Boolean> { <!NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS!>null<!> }
|
||||||
|
.subscribe()
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun main(): kotlin.Unit
|
||||||
|
|
||||||
|
public open class FromSupplier {
|
||||||
|
public constructor FromSupplier()
|
||||||
|
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*/ open fun </*0*/ @io.reactivex.rxjava3.annotations.NonNull T : kotlin.Any!> fromSupplier3(/*0*/ supplier: Supplier<out @io.reactivex.rxjava3.annotations.Nullable T!>!): Maybe<T!>!
|
||||||
|
public/*package*/ open fun </*0*/ @io.reactivex.rxjava3.annotations.NonNull T : kotlin.Any!> fromSupplier5(/*0*/ @io.reactivex.rxjava3.annotations.NonNull supplier: @io.reactivex.rxjava3.annotations.NonNull Supplier<out @io.reactivex.rxjava3.annotations.Nullable T!>!): Maybe<T!>!
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class Maybe</*0*/ T : kotlin.Any!> {
|
||||||
|
public constructor Maybe</*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 final fun subscribe(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface /* annotation class not found */ public interface Supplier</*0*/ @io.reactivex.rxjava3.annotations.NonNull T : kotlin.Any!> {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract fun get(): T!
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
+6
@@ -98,6 +98,12 @@ public class ForeignAnnotationsCompiledJavaTestGenerated extends AbstractForeign
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt50734.kt")
|
||||||
|
public void testKt50734() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt50734.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lombokSimple.kt")
|
@TestMetadata("lombokSimple.kt")
|
||||||
public void testLombokSimple() throws Exception {
|
public void testLombokSimple() throws Exception {
|
||||||
|
|||||||
+6
@@ -98,6 +98,12 @@ public class ForeignAnnotationsCompiledJavaWithPsiClassReadingTestGenerated exte
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt50734.kt")
|
||||||
|
public void testKt50734() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt50734.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lombokSimple.kt")
|
@TestMetadata("lombokSimple.kt")
|
||||||
public void testLombokSimple() throws Exception {
|
public void testLombokSimple() throws Exception {
|
||||||
|
|||||||
+6
@@ -98,6 +98,12 @@ public class ForeignAnnotationsSourceJavaTestGenerated extends AbstractForeignAn
|
|||||||
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt48316_multiModuleAnnotationDefault.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt50734.kt")
|
||||||
|
public void testKt50734() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/foreignAnnotationsTests/tests/kt50734.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lombokSimple.kt")
|
@TestMetadata("lombokSimple.kt")
|
||||||
public void testLombokSimple() throws Exception {
|
public void testLombokSimple() throws Exception {
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ public class TypeSubstitutor implements TypeSubstitutorMarker {
|
|||||||
KotlinType substitutedEnhancement = substitute(enhancement, originalProjection.getProjectionKind());
|
KotlinType substitutedEnhancement = substitute(enhancement, originalProjection.getProjectionKind());
|
||||||
KotlinType resultingType = TypeWithEnhancementKt.wrapEnhancement(
|
KotlinType resultingType = TypeWithEnhancementKt.wrapEnhancement(
|
||||||
substitution.getType().unwrap(),
|
substitution.getType().unwrap(),
|
||||||
substitutedEnhancement instanceof TypeWithEnhancement ? ((TypeWithEnhancement) substitutedEnhancement).getEnhancement() : substitutedEnhancement
|
substitutedEnhancement
|
||||||
);
|
);
|
||||||
|
|
||||||
return new TypeProjectionImpl(substitution.getProjectionKind(), resultingType);
|
return new TypeProjectionImpl(substitution.getProjectionKind(), resultingType);
|
||||||
|
|||||||
Reference in New Issue
Block a user