[NI] Fix loosing type annotations on extension functions
#KT-32138 fixed
This commit is contained in:
+10
@@ -11030,6 +11030,16 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32189returnTypeWithTypealiasSubtitution.kt")
|
||||
public void testKt32189returnTypeWithTypealiasSubtitution() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt32189returnTypeWithTypealiasSubtitution.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32189returnTypeWithTypealiasSubtitutionOldInference.kt")
|
||||
public void testKt32189returnTypeWithTypealiasSubtitutionOldInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt32189returnTypeWithTypealiasSubtitutionOldInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6081SubstituteIntoClassCorrectly.kt")
|
||||
public void testKt6081SubstituteIntoClassCorrectly() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt6081SubstituteIntoClassCorrectly.kt");
|
||||
|
||||
+5
-3
@@ -35,9 +35,11 @@ object JvmDeclarationReturnTypeSanitizer : DeclarationReturnTypeSanitizer {
|
||||
if (languageVersionSettings.supportsFeature(LanguageFeature.StrictJavaNullabilityAssertions)) {
|
||||
// NB can't check for presence of EnhancedNullability here,
|
||||
// because it will also cause recursion in declaration type resolution.
|
||||
inferred.replaceAnnotations(FilteredAnnotations(inferred.annotations) {
|
||||
it != JvmAnnotationNames.ENHANCED_NULLABILITY_ANNOTATION
|
||||
})
|
||||
inferred.replaceAnnotations(
|
||||
FilteredAnnotations(inferred.annotations, languageVersionSettings.supportsFeature(LanguageFeature.NewInference)) {
|
||||
it != JvmAnnotationNames.ENHANCED_NULLABILITY_ANNOTATION
|
||||
}
|
||||
)
|
||||
}
|
||||
else inferred
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
class B {
|
||||
class Builder
|
||||
}
|
||||
|
||||
typealias ApplyRestrictions = B.Builder.() -> B.Builder
|
||||
|
||||
fun applyRestrictions1(): ApplyRestrictions = TODO()
|
||||
fun applyRestrictions2() = applyRestrictions1()
|
||||
fun <K> applyRestrictions3(e: K) = applyRestrictions1()
|
||||
|
||||
fun buildB() {
|
||||
val a1 = applyRestrictions1()
|
||||
val a2 = applyRestrictions2()
|
||||
val a3 = applyRestrictions3("foo")
|
||||
|
||||
B.Builder().a1()
|
||||
B.Builder().a2()
|
||||
B.Builder().a3()
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package
|
||||
|
||||
public fun applyRestrictions1(): ApplyRestrictions /* = B.Builder.() -> B.Builder */
|
||||
public fun applyRestrictions2(): ApplyRestrictions /* = B.Builder.() -> B.Builder */
|
||||
public fun </*0*/ K> applyRestrictions3(/*0*/ e: K): ApplyRestrictions /* = B.Builder.() -> B.Builder */
|
||||
public fun buildB(): kotlin.Unit
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
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 final class Builder {
|
||||
public constructor Builder()
|
||||
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 typealias ApplyRestrictions = B.Builder.() -> B.Builder
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
class B {
|
||||
class Builder
|
||||
}
|
||||
|
||||
typealias ApplyRestrictions = B.Builder.() -> B.Builder
|
||||
|
||||
fun applyRestrictions1(): ApplyRestrictions = TODO()
|
||||
fun applyRestrictions2() = applyRestrictions1()
|
||||
fun <K> applyRestrictions3(e: K) = applyRestrictions1()
|
||||
|
||||
fun buildB() {
|
||||
val a1 = applyRestrictions1()
|
||||
val a2 = applyRestrictions2()
|
||||
val a3 = applyRestrictions3("foo")
|
||||
|
||||
B.Builder().a1()
|
||||
B.Builder().a2()
|
||||
B.Builder().<!UNRESOLVED_REFERENCE!>a3<!>()
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package
|
||||
|
||||
public fun applyRestrictions1(): ApplyRestrictions /* = B.Builder.() -> B.Builder */
|
||||
public fun applyRestrictions2(): ApplyRestrictions /* = B.Builder.() -> B.Builder */
|
||||
public fun </*0*/ K> applyRestrictions3(/*0*/ e: K): ApplyRestrictions /* = B.Builder.() -> B.Builder */
|
||||
public fun buildB(): kotlin.Unit
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
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 final class Builder {
|
||||
public constructor Builder()
|
||||
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 typealias ApplyRestrictions = B.Builder.() -> B.Builder
|
||||
@@ -11037,6 +11037,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32189returnTypeWithTypealiasSubtitution.kt")
|
||||
public void testKt32189returnTypeWithTypealiasSubtitution() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt32189returnTypeWithTypealiasSubtitution.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32189returnTypeWithTypealiasSubtitutionOldInference.kt")
|
||||
public void testKt32189returnTypeWithTypealiasSubtitutionOldInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt32189returnTypeWithTypealiasSubtitutionOldInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6081SubstituteIntoClassCorrectly.kt")
|
||||
public void testKt6081SubstituteIntoClassCorrectly() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt6081SubstituteIntoClassCorrectly.kt");
|
||||
|
||||
Generated
+10
@@ -11032,6 +11032,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32189returnTypeWithTypealiasSubtitution.kt")
|
||||
public void testKt32189returnTypeWithTypealiasSubtitution() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt32189returnTypeWithTypealiasSubtitution.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32189returnTypeWithTypealiasSubtitutionOldInference.kt")
|
||||
public void testKt32189returnTypeWithTypealiasSubtitutionOldInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt32189returnTypeWithTypealiasSubtitutionOldInference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt6081SubstituteIntoClassCorrectly.kt")
|
||||
public void testKt6081SubstituteIntoClassCorrectly() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/substitutions/kt6081SubstituteIntoClassCorrectly.kt");
|
||||
|
||||
Reference in New Issue
Block a user