Put using underscored type arguments under a feature
This commit is contained in:
+6
@@ -13479,6 +13479,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/inference/typeParameterInConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoredTypeArgument.kt")
|
||||
public void testUnderscoredTypeArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/underscoredTypeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useFunctionLiteralsToInferType.kt")
|
||||
public void testUseFunctionLiteralsToInferType() throws Exception {
|
||||
|
||||
+6
@@ -13479,6 +13479,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/inference/typeParameterInConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoredTypeArgument.kt")
|
||||
public void testUnderscoredTypeArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/underscoredTypeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useFunctionLiteralsToInferType.kt")
|
||||
public void testUseFunctionLiteralsToInferType() throws Exception {
|
||||
|
||||
+6
@@ -13479,6 +13479,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/inference/typeParameterInConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoredTypeArgument.kt")
|
||||
public void testUnderscoredTypeArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/underscoredTypeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useFunctionLiteralsToInferType.kt")
|
||||
public void testUseFunctionLiteralsToInferType() throws Exception {
|
||||
|
||||
@@ -77,6 +77,8 @@ class PSICallResolver(
|
||||
) {
|
||||
private val givenCandidatesName = Name.special("<given candidates>")
|
||||
|
||||
private val arePartiallySpecifiedTypeArgumentsEnabled = languageVersionSettings.supportsFeature(LanguageFeature.PartiallySpecifiedTypeArguments)
|
||||
|
||||
val defaultResolutionKinds = setOf(
|
||||
NewResolutionOldInference.ResolutionKind.Function,
|
||||
NewResolutionOldInference.ResolutionKind.Variable,
|
||||
@@ -689,7 +691,7 @@ class PSICallResolver(
|
||||
|
||||
val typeReference = projection.typeReference ?: return@map TypeArgumentPlaceholder
|
||||
|
||||
if (typeReference.isPlaceholder) {
|
||||
if (typeReference.isPlaceholder && arePartiallySpecifiedTypeArgumentsEnabled) {
|
||||
val resolvedAnnotations = typeResolver.resolveTypeAnnotations(context.trace, context.scope, typeReference)
|
||||
.apply(ForceResolveUtil::forceResolveAllContents)
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +PartiallySpecifiedTypeArguments
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <K, T> foo(x: (K) -> T): Pair<K, T> = (1 as K) to (1f as T)
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +PartiallySpecifiedTypeArguments
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// !LANGUAGE: +PartiallySpecifiedTypeArguments
|
||||
|
||||
sealed class MyResult<out T>{
|
||||
data class Success<T>(val value: T): MyResult<T>()
|
||||
data class Failure(val exception: Throwable): MyResult<Nothing>()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// !LANGUAGE: +PartiallySpecifiedTypeArguments
|
||||
|
||||
interface RProps
|
||||
open class RComponent<K, T> : Component<K, T>
|
||||
interface RState
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +PartiallySpecifiedTypeArguments
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <K, T> foo(x: (K) -> T): Pair<K, T> = (1 as K) to (1f as T)
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +PartiallySpecifiedTypeArguments
|
||||
// !DIAGNOSTICS: -UNCHECKED_CAST
|
||||
// FIR_IDENTICAL
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNCHECKED_CAST
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun <K, T> foo(x: (K) -> T): Pair<K, T> = (1 as K) to (1f as T)
|
||||
|
||||
fun box(): String {
|
||||
val x = foo<Int, <!UNRESOLVED_REFERENCE!>_<!>> { it.toFloat() } // Pair<Int, Float>
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun box(): kotlin.String
|
||||
public fun </*0*/ K, /*1*/ T> foo(/*0*/ x: (K) -> T): kotlin.Pair<K, T>
|
||||
Generated
+6
@@ -13485,6 +13485,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/typeParameterInConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("underscoredTypeArgument.kt")
|
||||
public void testUnderscoredTypeArgument() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/underscoredTypeArgument.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useFunctionLiteralsToInferType.kt")
|
||||
public void testUseFunctionLiteralsToInferType() throws Exception {
|
||||
|
||||
@@ -238,6 +238,7 @@ enum class LanguageFeature(
|
||||
ProhibitNonExhaustiveIfInRhsOfElvis(KOTLIN_1_7, kind = BUG_FIX), // KT-44705
|
||||
ForbidExposingTypesInPrimaryConstructorProperties(KOTLIN_1_7, kind = BUG_FIX),
|
||||
ProhibitAccessToEnumCompanionMembersInEnumConstructorCall(KOTLIN_1_7, kind = BUG_FIX),
|
||||
PartiallySpecifiedTypeArguments(KOTLIN_1_7),
|
||||
|
||||
// 1.8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user