[NI] Consider explicitly specified type argument as an input type

#KT-31860 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-06-07 04:12:06 +03:00
parent 787a8bb9bd
commit 4ddd9f081b
5 changed files with 48 additions and 1 deletions
@@ -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()
}
@@ -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
}
@@ -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
}
@@ -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");
@@ -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");