[NI] Consider explicitly specified type argument as an input type
#KT-31860 Fixed
This commit is contained in:
+2
-1
@@ -37,7 +37,8 @@ class MutableVariableWithConstraints(
|
||||
get() =
|
||||
mutableConstraints.filter {
|
||||
val position = it.position.from
|
||||
position is ArgumentConstraintPosition || position is ReceiverConstraintPosition || position is ExpectedTypeConstraintPosition
|
||||
position is ArgumentConstraintPosition || position is ReceiverConstraintPosition ||
|
||||
position is ExpectedTypeConstraintPosition || position is ExplicitTypeParameterConstraintPosition
|
||||
}.map {
|
||||
(it.type as KotlinType).unCapture().unwrap()
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -UNUSED_PARAMETER
|
||||
|
||||
interface Parent
|
||||
object ChildA : Parent
|
||||
object ChildB : Parent
|
||||
|
||||
fun <@kotlin.internal.OnlyInputTypes T> select(a: T, b: T) {}
|
||||
|
||||
fun test() {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>select<!>(ChildA, ChildB) // should be error
|
||||
select<Any>(ChildA, ChildB) // should be ok
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ @kotlin.internal.OnlyInputTypes T> select(/*0*/ a: T, /*1*/ b: T): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public object ChildA : Parent {
|
||||
private constructor ChildA()
|
||||
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 object ChildB : Parent {
|
||||
private constructor ChildB()
|
||||
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 interface Parent {
|
||||
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
|
||||
}
|
||||
+5
@@ -2738,6 +2738,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("explicitTypeArgumentAsValidInputType.kt")
|
||||
public void testExplicitTypeArgumentAsValidInputType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/explicitTypeArgumentAsValidInputType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("internalAnnotationsOnTypes.kt")
|
||||
public void testInternalAnnotationsOnTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.kt");
|
||||
|
||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+5
@@ -2738,6 +2738,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/exactAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("explicitTypeArgumentAsValidInputType.kt")
|
||||
public void testExplicitTypeArgumentAsValidInputType() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/explicitTypeArgumentAsValidInputType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("internalAnnotationsOnTypes.kt")
|
||||
public void testInternalAnnotationsOnTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.kt");
|
||||
|
||||
Reference in New Issue
Block a user