NI: extract diagnostics from partially resolved call instead of separately handling it including running all checks
^KT-37630 Fixed ^KT-35494 Fixed
This commit is contained in:
+5
@@ -10564,6 +10564,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("iltInsideSeveralCalls.kt")
|
||||||
|
public void testIltInsideSeveralCalls() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/iltInsideSeveralCalls.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inferenceWithUpperBoundsInLambda.kt")
|
@TestMetadata("inferenceWithUpperBoundsInLambda.kt")
|
||||||
public void testInferenceWithUpperBoundsInLambda() throws Exception {
|
public void testInferenceWithUpperBoundsInLambda() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/inferenceWithUpperBoundsInLambda.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/inferenceWithUpperBoundsInLambda.kt");
|
||||||
|
|||||||
+1
-6
@@ -279,12 +279,7 @@ class KotlinToResolvedCallTransformer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo very beginning code
|
// todo very beginning code
|
||||||
fun runArgumentsChecks(
|
fun runArgumentsChecks(context: BasicCallResolutionContext, resolvedCall: NewResolvedCallImpl<*>) {
|
||||||
context: BasicCallResolutionContext,
|
|
||||||
trace: BindingTrace,
|
|
||||||
resolvedCall: NewResolvedCallImpl<*>,
|
|
||||||
) {
|
|
||||||
|
|
||||||
for (valueArgument in resolvedCall.call.valueArguments) {
|
for (valueArgument in resolvedCall.call.valueArguments) {
|
||||||
val argumentMapping = resolvedCall.getArgumentMapping(valueArgument!!)
|
val argumentMapping = resolvedCall.getArgumentMapping(valueArgument!!)
|
||||||
val parameter: ValueParameterDescriptor?
|
val parameter: ValueParameterDescriptor?
|
||||||
|
|||||||
+15
-5
@@ -77,7 +77,6 @@ class ResolvedAtomCompleter(
|
|||||||
is ResolvedLambdaAtom -> completeLambda(resolvedAtom)
|
is ResolvedLambdaAtom -> completeLambda(resolvedAtom)
|
||||||
is ResolvedCallAtom -> completeResolvedCall(resolvedAtom, emptyList())
|
is ResolvedCallAtom -> completeResolvedCall(resolvedAtom, emptyList())
|
||||||
is ResolvedSubCallArgument -> completeSubCallArgument(resolvedAtom)
|
is ResolvedSubCallArgument -> completeSubCallArgument(resolvedAtom)
|
||||||
is PartialCallResolutionResult -> completeResolvedCall(resolvedAtom.resultCallAtom, resolvedAtom.diagnostics)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,20 +101,24 @@ class ResolvedAtomCompleter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun completeResolvedCall(resolvedCallAtom: ResolvedCallAtom, diagnostics: Collection<KotlinCallDiagnostic>): ResolvedCall<*>? {
|
fun completeResolvedCall(resolvedCallAtom: ResolvedCallAtom, diagnostics: Collection<KotlinCallDiagnostic>): ResolvedCall<*>? {
|
||||||
|
val diagnosticsFromPartiallyResolvedCall = extractDiagnosticsFromPartiallyResolvedCall(resolvedCallAtom)
|
||||||
|
|
||||||
clearPartiallyResolvedCall(resolvedCallAtom)
|
clearPartiallyResolvedCall(resolvedCallAtom)
|
||||||
|
|
||||||
if (resolvedCallAtom.atom.psiKotlinCall is PSIKotlinCallForVariable) return null
|
if (resolvedCallAtom.atom.psiKotlinCall is PSIKotlinCallForVariable) return null
|
||||||
|
|
||||||
|
val allDiagnostics = diagnostics + diagnosticsFromPartiallyResolvedCall
|
||||||
|
|
||||||
val resolvedCall = kotlinToResolvedCallTransformer.transformToResolvedCall<CallableDescriptor>(
|
val resolvedCall = kotlinToResolvedCallTransformer.transformToResolvedCall<CallableDescriptor>(
|
||||||
resolvedCallAtom,
|
resolvedCallAtom,
|
||||||
topLevelTrace,
|
topLevelTrace,
|
||||||
resultSubstitutor,
|
resultSubstitutor,
|
||||||
diagnostics
|
allDiagnostics
|
||||||
)
|
)
|
||||||
|
|
||||||
val lastCall = if (resolvedCall is VariableAsFunctionResolvedCall) resolvedCall.functionCall else resolvedCall
|
val lastCall = if (resolvedCall is VariableAsFunctionResolvedCall) resolvedCall.functionCall else resolvedCall
|
||||||
if (ErrorUtils.isError(resolvedCall.candidateDescriptor)) {
|
if (ErrorUtils.isError(resolvedCall.candidateDescriptor)) {
|
||||||
kotlinToResolvedCallTransformer.runArgumentsChecks(topLevelCallContext, topLevelTrace, lastCall as NewResolvedCallImpl<*>)
|
kotlinToResolvedCallTransformer.runArgumentsChecks(topLevelCallContext, lastCall as NewResolvedCallImpl<*>)
|
||||||
checkMissingReceiverSupertypes(resolvedCall, missingSupertypesResolver, topLevelTrace)
|
checkMissingReceiverSupertypes(resolvedCall, missingSupertypesResolver, topLevelTrace)
|
||||||
return resolvedCall
|
return resolvedCall
|
||||||
}
|
}
|
||||||
@@ -135,11 +138,11 @@ class ResolvedAtomCompleter(
|
|||||||
|
|
||||||
kotlinToResolvedCallTransformer.bind(topLevelTrace, resolvedCall)
|
kotlinToResolvedCallTransformer.bind(topLevelTrace, resolvedCall)
|
||||||
|
|
||||||
kotlinToResolvedCallTransformer.runArgumentsChecks(topLevelCallContext, topLevelTrace, lastCall as NewResolvedCallImpl<*>)
|
kotlinToResolvedCallTransformer.runArgumentsChecks(topLevelCallContext, lastCall as NewResolvedCallImpl<*>)
|
||||||
kotlinToResolvedCallTransformer.runCallCheckers(resolvedCall, callCheckerContext)
|
kotlinToResolvedCallTransformer.runCallCheckers(resolvedCall, callCheckerContext)
|
||||||
kotlinToResolvedCallTransformer.runAdditionalReceiversCheckers(resolvedCall, topLevelCallContext)
|
kotlinToResolvedCallTransformer.runAdditionalReceiversCheckers(resolvedCall, topLevelCallContext)
|
||||||
|
|
||||||
kotlinToResolvedCallTransformer.reportDiagnostics(topLevelCallContext, topLevelTrace, resolvedCall, diagnostics)
|
kotlinToResolvedCallTransformer.reportDiagnostics(topLevelCallContext, topLevelTrace, resolvedCall, allDiagnostics)
|
||||||
|
|
||||||
return resolvedCall
|
return resolvedCall
|
||||||
}
|
}
|
||||||
@@ -160,6 +163,13 @@ class ResolvedAtomCompleter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun extractDiagnosticsFromPartiallyResolvedCall(resolvedCallAtom: ResolvedCallAtom): Set<KotlinCallDiagnostic> {
|
||||||
|
val psiCall = KotlinToResolvedCallTransformer.keyForPartiallyResolvedCall(resolvedCallAtom)
|
||||||
|
val partialCallContainer = topLevelTrace[BindingContext.ONLY_RESOLVED_CALL, psiCall]
|
||||||
|
|
||||||
|
return partialCallContainer?.result?.diagnostics.orEmpty().toSet()
|
||||||
|
}
|
||||||
|
|
||||||
private fun clearPartiallyResolvedCall(resolvedCallAtom: ResolvedCallAtom) {
|
private fun clearPartiallyResolvedCall(resolvedCallAtom: ResolvedCallAtom) {
|
||||||
val psiCall = KotlinToResolvedCallTransformer.keyForPartiallyResolvedCall(resolvedCallAtom)
|
val psiCall = KotlinToResolvedCallTransformer.keyForPartiallyResolvedCall(resolvedCallAtom)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -222,7 +222,7 @@ class KotlinCallCompleter(
|
|||||||
forwardToInferenceSession: Boolean = false
|
forwardToInferenceSession: Boolean = false
|
||||||
): CallResolutionResult {
|
): CallResolutionResult {
|
||||||
val systemStorage = getSystem().asReadOnlyStorage()
|
val systemStorage = getSystem().asReadOnlyStorage()
|
||||||
val allDiagnostics = diagnosticsHolder.getDiagnostics() + this.diagnosticsFromResolutionParts
|
val allDiagnostics = diagnosticsHolder.getDiagnostics() + diagnosticsFromResolutionParts
|
||||||
|
|
||||||
if (isErrorCandidate()) {
|
if (isErrorCandidate()) {
|
||||||
return ErrorCallResolutionResult(resolvedCall, allDiagnostics, systemStorage)
|
return ErrorCallResolutionResult(resolvedCall, allDiagnostics, systemStorage)
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ fun <A> main() {
|
|||||||
val <!UNUSED_VARIABLE!>b<!>: Int = f()
|
val <!UNUSED_VARIABLE!>b<!>: Int = f()
|
||||||
f<Int>()
|
f<Int>()
|
||||||
|
|
||||||
val <!UNUSED_VARIABLE!>с<!>: A = id(<!NI;TYPE_PARAMETER_AS_REIFIED, TYPE_PARAMETER_AS_REIFIED!>f<!>())
|
val <!UNUSED_VARIABLE!>с<!>: A = id(<!TYPE_PARAMETER_AS_REIFIED!>f<!>())
|
||||||
}
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNCHECKED_CAST -UNUSED_EXPRESSION
|
||||||
|
|
||||||
|
fun <T> consumeLongAndMaterialize(x: Long): T = null as T
|
||||||
|
fun consumeAny(x: Any) = x
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
consumeAny(consumeLongAndMaterialize(3 * 1000))
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
consumeLongAndMaterialize(3 * 1000)
|
||||||
|
} else true
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun consumeAny(/*0*/ x: kotlin.Any): kotlin.Any
|
||||||
|
public fun </*0*/ T> consumeLongAndMaterialize(/*0*/ x: kotlin.Long): T
|
||||||
|
public fun main(): kotlin.Unit
|
||||||
+1
-1
@@ -20,5 +20,5 @@ fun testFunctions() {
|
|||||||
fun testNestedCalls() {
|
fun testNestedCalls() {
|
||||||
id<String>(inferFromLambda { materialize() })
|
id<String>(inferFromLambda { materialize() })
|
||||||
id<String>(inferFromLambda(fun() = materialize()))
|
id<String>(inferFromLambda(fun() = materialize()))
|
||||||
id<String>(inferFromLambda2(<!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>fun<!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>()<!> = materialize()<!>))
|
id<String>(inferFromLambda2(<!TYPE_MISMATCH, TYPE_MISMATCH!>fun<!EXPECTED_PARAMETERS_NUMBER_MISMATCH!>()<!> = materialize()<!>))
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -30,7 +30,7 @@ class Foo<out A> {
|
|||||||
other1.product(
|
other1.product(
|
||||||
other2.product(
|
other2.product(
|
||||||
other3.product(
|
other3.product(
|
||||||
<!TYPE_MISMATCH, TYPE_MISMATCH!>bar { d -> { c -> { b -> { a -> function(<!DEBUG_INFO_EXPRESSION_TYPE("A")!>a<!>, <!DEBUG_INFO_EXPRESSION_TYPE("B")!>b<!>, <!DEBUG_INFO_EXPRESSION_TYPE("C")!>c<!>, <!DEBUG_INFO_EXPRESSION_TYPE("D")!>d<!>) } } } }<!>
|
<!TYPE_MISMATCH!>bar { d -> { c -> { b -> { a -> function(<!DEBUG_INFO_EXPRESSION_TYPE("A")!>a<!>, <!DEBUG_INFO_EXPRESSION_TYPE("B")!>b<!>, <!DEBUG_INFO_EXPRESSION_TYPE("C")!>c<!>, <!DEBUG_INFO_EXPRESSION_TYPE("D")!>d<!>) } } } }<!>
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -43,7 +43,7 @@ class Foo<out A> {
|
|||||||
other1.product(
|
other1.product(
|
||||||
other2.product(
|
other2.product(
|
||||||
other3.product(
|
other3.product(
|
||||||
<!TYPE_MISMATCH, TYPE_MISMATCH!>other4.product(
|
<!TYPE_MISMATCH!>other4.product(
|
||||||
bar { e -> { d -> { c -> { b -> { a -> function(<!DEBUG_INFO_EXPRESSION_TYPE("A")!>a<!>, <!DEBUG_INFO_EXPRESSION_TYPE("B")!>b<!>, <!DEBUG_INFO_EXPRESSION_TYPE("C")!>c<!>, <!DEBUG_INFO_EXPRESSION_TYPE("D")!>d<!>, <!DEBUG_INFO_EXPRESSION_TYPE("E")!>e<!>) } } } } }
|
bar { e -> { d -> { c -> { b -> { a -> function(<!DEBUG_INFO_EXPRESSION_TYPE("A")!>a<!>, <!DEBUG_INFO_EXPRESSION_TYPE("B")!>b<!>, <!DEBUG_INFO_EXPRESSION_TYPE("C")!>c<!>, <!DEBUG_INFO_EXPRESSION_TYPE("D")!>d<!>, <!DEBUG_INFO_EXPRESSION_TYPE("E")!>e<!>) } } } } }
|
||||||
)<!>
|
)<!>
|
||||||
)
|
)
|
||||||
|
|||||||
Vendored
+2
-2
@@ -35,7 +35,7 @@ fun test5(): Bound? = select(
|
|||||||
fun test6() {
|
fun test6() {
|
||||||
select(
|
select(
|
||||||
null,
|
null,
|
||||||
<!IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>materializeReified<!>()
|
<!IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>materializeReified<!>()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +48,6 @@ fun test7(): Bound? =
|
|||||||
fun test8() {
|
fun test8() {
|
||||||
select(
|
select(
|
||||||
null,
|
null,
|
||||||
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>materializeReifiedUnbound<!>()
|
<!REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>materializeReifiedUnbound<!>()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -28,7 +28,7 @@ inline fun <reified T : In<T>> testIn(): T {
|
|||||||
// Unexpected behaviour
|
// Unexpected behaviour
|
||||||
inline fun <reified T : Out<T>> testOut(): T {
|
inline fun <reified T : Out<T>> testOut(): T {
|
||||||
<!UNREACHABLE_CODE!>return<!> try {
|
<!UNREACHABLE_CODE!>return<!> try {
|
||||||
<!IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>outBound<!>()
|
<!IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>outBound<!>()
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
throw Exception()
|
throw Exception()
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||||
|
|
||||||
fun test(a: Int, b: Boolean) {
|
fun test(a: Int, b: Boolean) {
|
||||||
<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>(a.<!OI;TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>foo<!>(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, TYPE_MISMATCH!>b<!>))
|
<!OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>(a.<!OI;TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR!>foo<!>(<!NI;TYPE_MISMATCH, TYPE_MISMATCH!>b<!>))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T, R> T.foo(l: (T) -> R): R = TODO()
|
fun <T, R> T.foo(l: (T) -> R): R = TODO()
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ fun test() {
|
|||||||
<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>2<!>
|
<!OI;CONSTANT_EXPECTED_TYPE_MISMATCH!>2<!>
|
||||||
}<!>)
|
}<!>)
|
||||||
|
|
||||||
bar(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!><!CONSTANT_EXPECTED_TYPE_MISMATCH, NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!> ?: <!CONSTANT_EXPECTED_TYPE_MISMATCH, NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>2<!><!>)
|
bar(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!><!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!> ?: <!CONSTANT_EXPECTED_TYPE_MISMATCH!>2<!><!>)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bar(s: String) = s
|
fun bar(s: String) = s
|
||||||
@@ -51,6 +51,6 @@ fun test6() = <!UNSUPPORTED!>foo<!><Nothing>()
|
|||||||
|
|
||||||
class B<T>(val array: Array<T>)
|
class B<T>(val array: Array<T>)
|
||||||
|
|
||||||
fun <T> bar() = B<Array<T>>(<!NI;TYPE_PARAMETER_AS_REIFIED_ARRAY, TYPE_PARAMETER_AS_REIFIED_ARRAY!>arrayOf<!>())
|
fun <T> bar() = B<Array<T>>(<!TYPE_PARAMETER_AS_REIFIED_ARRAY!>arrayOf<!>())
|
||||||
|
|
||||||
fun test7() = <!UNSUPPORTED!>bar<!><Nothing>()
|
fun test7() = <!UNSUPPORTED!>bar<!><Nothing>()
|
||||||
|
|||||||
+1
-1
@@ -6,6 +6,6 @@ public @interface A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FILE: b.kt
|
// FILE: b.kt
|
||||||
@A(*<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;CONSTANT_EXPECTED_TYPE_MISMATCH, NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, "b")<!>)
|
@A(*<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, "b")<!>)
|
||||||
fun test() {
|
fun test() {
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
annotation class B(vararg val args: String)
|
annotation class B(vararg val args: String)
|
||||||
|
|
||||||
@B(*<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;CONSTANT_EXPECTED_TYPE_MISMATCH, NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, "b")<!>)
|
@B(*<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, "b")<!>)
|
||||||
fun test() {
|
fun test() {
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -14,7 +14,7 @@ class MyClass1
|
|||||||
@Ann1(arrayOf(Any::class))
|
@Ann1(arrayOf(Any::class))
|
||||||
class MyClass1a
|
class MyClass1a
|
||||||
|
|
||||||
@Ann1(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>B1::class<!>)<!>)
|
@Ann1(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH!>B1::class<!>)<!>)
|
||||||
class MyClass2
|
class MyClass2
|
||||||
|
|
||||||
annotation class Ann2(val arg: Array<KClass<in B1>>)
|
annotation class Ann2(val arg: Array<KClass<in B1>>)
|
||||||
@@ -25,5 +25,5 @@ class MyClass3
|
|||||||
@Ann2(arrayOf(B1::class))
|
@Ann2(arrayOf(B1::class))
|
||||||
class MyClass4
|
class MyClass4
|
||||||
|
|
||||||
@Ann2(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>B2::class<!>)<!>)
|
@Ann2(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH!>B2::class<!>)<!>)
|
||||||
class MyClass5
|
class MyClass5
|
||||||
|
|||||||
+3
-3
@@ -11,7 +11,7 @@ annotation class Ann1(val arg: Array<KClass<out A>>)
|
|||||||
@Ann1(arrayOf(A::class))
|
@Ann1(arrayOf(A::class))
|
||||||
class MyClass1
|
class MyClass1
|
||||||
|
|
||||||
@Ann1(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>Any::class<!>)<!>)
|
@Ann1(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH!>Any::class<!>)<!>)
|
||||||
class MyClass1a
|
class MyClass1a
|
||||||
|
|
||||||
@Ann1(arrayOf(B1::class))
|
@Ann1(arrayOf(B1::class))
|
||||||
@@ -19,11 +19,11 @@ class MyClass2
|
|||||||
|
|
||||||
annotation class Ann2(val arg: Array<KClass<out B1>>)
|
annotation class Ann2(val arg: Array<KClass<out B1>>)
|
||||||
|
|
||||||
@Ann2(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>A::class<!>)<!>)
|
@Ann2(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH!>A::class<!>)<!>)
|
||||||
class MyClass3
|
class MyClass3
|
||||||
|
|
||||||
@Ann2(arrayOf(B1::class))
|
@Ann2(arrayOf(B1::class))
|
||||||
class MyClass4
|
class MyClass4
|
||||||
|
|
||||||
@Ann2(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>B2::class<!>)<!>)
|
@Ann2(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;TYPE_MISMATCH!>B2::class<!>)<!>)
|
||||||
class MyClass5
|
class MyClass5
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ fun <T> fail2(): Array<T> = ok1 { Array<<!TYPE_PARAMETER_AS_REIFIED!>T<!>>(1) {
|
|||||||
fun <T> ok3(block: () -> Array<T>): Array<T> = ok1 { block() }
|
fun <T> ok3(block: () -> Array<T>): Array<T> = ok1 { block() }
|
||||||
inline fun <reified T> ok4(): Array<T> = ok1 { Array<T>(1) { null!! } }
|
inline fun <reified T> ok4(): Array<T> = ok1 { Array<T>(1) { null!! } }
|
||||||
|
|
||||||
fun <T> fail3(block: () -> T): Pair<Array<T>, Array<T>> = Pair(<!NI;TYPE_PARAMETER_AS_REIFIED, TYPE_PARAMETER_AS_REIFIED!>arrayOf<!>(
|
fun <T> fail3(block: () -> T): Pair<Array<T>, Array<T>> = Pair(<!TYPE_PARAMETER_AS_REIFIED!>arrayOf<!>(
|
||||||
block()), <!NI;TYPE_PARAMETER_AS_REIFIED, TYPE_PARAMETER_AS_REIFIED!>arrayOf<!>()
|
block()), <!TYPE_PARAMETER_AS_REIFIED!>arrayOf<!>()
|
||||||
)
|
)
|
||||||
inline fun <reified T> ok5(block: () -> T): Pair<Array<T>, Array<T>> = Pair(
|
inline fun <reified T> ok5(block: () -> T): Pair<Array<T>, Array<T>> = Pair(
|
||||||
arrayOf(block()), arrayOf()
|
arrayOf(block()), arrayOf()
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ fun test2(): Map<Int, Int> = run {
|
|||||||
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>try {
|
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>try {
|
||||||
emptyMap()
|
emptyMap()
|
||||||
} catch (e: ExcA) {
|
} catch (e: ExcA) {
|
||||||
<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>mapOf(<!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>"" to ""<!>)<!>
|
<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>mapOf(<!NI;TYPE_MISMATCH!>"" to ""<!>)<!>
|
||||||
}<!>
|
}<!>
|
||||||
}
|
}
|
||||||
+2
-3
@@ -47,7 +47,6 @@ fun case2() {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* TESTCASE NUMBER: 3
|
* TESTCASE NUMBER: 3
|
||||||
* UNEXPECTED BEHAVIOUR
|
|
||||||
* ISSUES: KT-35494
|
* ISSUES: KT-35494
|
||||||
*/
|
*/
|
||||||
fun case3() {
|
fun case3() {
|
||||||
@@ -56,9 +55,9 @@ fun case3() {
|
|||||||
throwExceptionA(false)
|
throwExceptionA(false)
|
||||||
A(2)
|
A(2)
|
||||||
} catch (e: ExcA) {
|
} catch (e: ExcA) {
|
||||||
A(<!NULL_FOR_NONNULL_TYPE, NULL_FOR_NONNULL_TYPE!>null<!>) //diag duplication
|
A(<!NULL_FOR_NONNULL_TYPE!>null<!>) //diag duplication
|
||||||
} catch (e: ExcB) {
|
} catch (e: ExcB) {
|
||||||
B(<!NULL_FOR_NONNULL_TYPE, NULL_FOR_NONNULL_TYPE!>null<!>) //diag duplication
|
B(<!NULL_FOR_NONNULL_TYPE!>null<!>) //diag duplication
|
||||||
}<!>
|
}<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10571,6 +10571,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("iltInsideSeveralCalls.kt")
|
||||||
|
public void testIltInsideSeveralCalls() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/iltInsideSeveralCalls.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inferenceWithUpperBoundsInLambda.kt")
|
@TestMetadata("inferenceWithUpperBoundsInLambda.kt")
|
||||||
public void testInferenceWithUpperBoundsInLambda() throws Exception {
|
public void testInferenceWithUpperBoundsInLambda() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/inferenceWithUpperBoundsInLambda.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/inferenceWithUpperBoundsInLambda.kt");
|
||||||
|
|||||||
Generated
+5
@@ -10566,6 +10566,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("iltInsideSeveralCalls.kt")
|
||||||
|
public void testIltInsideSeveralCalls() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/iltInsideSeveralCalls.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inferenceWithUpperBoundsInLambda.kt")
|
@TestMetadata("inferenceWithUpperBoundsInLambda.kt")
|
||||||
public void testInferenceWithUpperBoundsInLambda() throws Exception {
|
public void testInferenceWithUpperBoundsInLambda() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/inferenceWithUpperBoundsInLambda.kt");
|
runTest("compiler/testData/diagnostics/tests/inference/commonSystem/inferenceWithUpperBoundsInLambda.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user