[NI] Decrease only input types check diagnostic level to warning
This commit is contained in:
+5
@@ -1993,6 +1993,11 @@ public class FirOldFrontendDiagnosticsTestWithStdlibGenerated extends AbstractFi
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesWarning.kt")
|
||||
public void testOnlyInputTypesWarning() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWarning.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesWithVarargs.kt")
|
||||
public void testOnlyInputTypesWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWithVarargs.kt");
|
||||
|
||||
@@ -764,6 +764,7 @@ public interface Errors {
|
||||
DiagnosticFactory1<PsiElement, InferenceErrorData> TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> TYPE_INFERENCE_INCORPORATION_ERROR = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory1<PsiElement, TypeParameterDescriptor> TYPE_INFERENCE_ONLY_INPUT_TYPES = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<PsiElement, TypeParameterDescriptor> TYPE_INFERENCE_ONLY_INPUT_TYPES_WARNING = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<PsiElement, InferenceErrorData> TYPE_INFERENCE_UPPER_BOUND_VIOLATED = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory2<KtElement, KotlinType, KotlinType> TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> TYPE_INFERENCE_CANDIDATE_WITH_SAM_AND_VARARG = DiagnosticFactory0.create(WARNING);
|
||||
|
||||
+2
@@ -858,6 +858,8 @@ public class DefaultErrorMessages {
|
||||
MAP.put(TYPE_INFERENCE_INCORPORATION_ERROR, "Type inference failed. Please try to specify type arguments explicitly.");
|
||||
MAP.put(TYPE_INFERENCE_ONLY_INPUT_TYPES, "Type inference failed. The value of the type parameter {0} should be mentioned in input types " +
|
||||
"(argument types, receiver type or expected type). Try to specify it explicitly.", NAME);
|
||||
MAP.put(TYPE_INFERENCE_ONLY_INPUT_TYPES_WARNING, "Type inference failed. The value of the type parameter {0} should be mentioned in input types " +
|
||||
"(argument types, receiver type or expected type). Try to specify it explicitly.", NAME);
|
||||
MAP.put(TYPE_INFERENCE_UPPER_BOUND_VIOLATED, "{0}", TYPE_INFERENCE_UPPER_BOUND_VIOLATED_RENDERER);
|
||||
MAP.put(TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH, "Type inference failed. Expected type mismatch: inferred type is {1} but {0} was expected", RENDER_TYPE, RENDER_TYPE);
|
||||
MAP.put(TYPE_INFERENCE_CANDIDATE_WITH_SAM_AND_VARARG, "Please use spread operator to pass an array as vararg. It will be an error in 1.5.");
|
||||
|
||||
+4
-1
@@ -67,7 +67,10 @@ class DiagnosticReporterByTrackingStrategy(
|
||||
OnlyInputTypesDiagnostic::class.java -> {
|
||||
val typeVariable = (diagnostic as OnlyInputTypesDiagnostic).typeVariable as? TypeVariableFromCallableDescriptor ?: return
|
||||
psiKotlinCall.psiCall.calleeExpression?.let {
|
||||
trace.report(TYPE_INFERENCE_ONLY_INPUT_TYPES.on(it, typeVariable.originalTypeParameter))
|
||||
val factory = if (context.languageVersionSettings.supportsFeature(LanguageFeature.NonStrictOnlyInputTypesChecks))
|
||||
TYPE_INFERENCE_ONLY_INPUT_TYPES_WARNING
|
||||
else TYPE_INFERENCE_ONLY_INPUT_TYPES
|
||||
trace.report(factory.on(it, typeVariable.originalTypeParameter))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
// See also KT-10386
|
||||
interface A
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
// See also KT-10386
|
||||
interface A
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
|
||||
import java.util.*
|
||||
fun foo() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
|
||||
import java.util.*
|
||||
fun foo() {
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
|
||||
interface Parent
|
||||
object ChildA : Parent
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
|
||||
interface Parent
|
||||
object ChildA : Parent
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
open class Base()
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
open class Base()
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// ISSUE: KT-29307
|
||||
|
||||
fun test_1(map: Map<String, String>) {
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// ISSUE: KT-29307
|
||||
|
||||
fun test_1(map: Map<String, String>) {
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
class Inv<T>
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
class Inv<T>
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// Issue: KT-26698
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// Issue: KT-26698
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !LANGUAGE: +NewInference +NonStrictOnlyInputTypesChecks
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes S> select(a1: S, a2: S): S = TODO()
|
||||
|
||||
interface Common
|
||||
class First : Common
|
||||
class Second : Common
|
||||
|
||||
fun test(first: First, second: Second) {
|
||||
select(first, second)
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// !LANGUAGE: +NewInference +NonStrictOnlyInputTypesChecks
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <@kotlin.internal.OnlyInputTypes S> select(a1: S, a2: S): S = TODO()
|
||||
|
||||
interface Common
|
||||
class First : Common
|
||||
class Second : Common
|
||||
|
||||
fun test(first: First, second: Second) {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_WARNING!>select<!>(first, second)
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public fun </*0*/ @kotlin.internal.OnlyInputTypes S> select(/*0*/ a1: S, /*1*/ a2: S): S
|
||||
public fun test(/*0*/ first: First, /*1*/ second: Second): kotlin.Unit
|
||||
|
||||
public interface Common {
|
||||
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 First : Common {
|
||||
public constructor First()
|
||||
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 Second : Common {
|
||||
public constructor Second()
|
||||
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
|
||||
}
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: -ProhibitConcurrentHashMapContains
|
||||
// !LANGUAGE: -ProhibitConcurrentHashMapContains -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: -ProhibitConcurrentHashMapContains
|
||||
// !LANGUAGE: -ProhibitConcurrentHashMapContains -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +ProhibitConcurrentHashMapContains
|
||||
// !LANGUAGE: +ProhibitConcurrentHashMapContains -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +ProhibitConcurrentHashMapContains
|
||||
// !LANGUAGE: +ProhibitConcurrentHashMapContains -NonStrictOnlyInputTypesChecks
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FULL_JDK
|
||||
|
||||
|
||||
+5
@@ -2923,6 +2923,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesWarning.kt")
|
||||
public void testOnlyInputTypesWarning() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWarning.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesWithVarargs.kt")
|
||||
public void testOnlyInputTypesWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWithVarargs.kt");
|
||||
|
||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+5
@@ -2923,6 +2923,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesUpperBound.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesWarning.kt")
|
||||
public void testOnlyInputTypesWarning() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWarning.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onlyInputTypesWithVarargs.kt")
|
||||
public void testOnlyInputTypesWithVarargs() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesWithVarargs.kt");
|
||||
|
||||
@@ -147,6 +147,7 @@ enum class LanguageFeature(
|
||||
SamConversionPerArgument(sinceVersion = KOTLIN_1_3, defaultState = State.DISABLED),
|
||||
NewDataFlowForTryExpressions(sinceVersion = KOTLIN_1_3, defaultState = State.DISABLED),
|
||||
FunctionReferenceWithDefaultValueAsOtherType(sinceVersion = KOTLIN_1_3, defaultState = State.DISABLED),
|
||||
NonStrictOnlyInputTypesChecks(KOTLIN_1_4),
|
||||
// ------
|
||||
// Next features can be enabled regardless of new inference
|
||||
|
||||
|
||||
Reference in New Issue
Block a user