[FIR] Don't report ARGUMENT_TYPE_MISMATCH on error types
This commit is contained in:
committed by
Space Team
parent
32f6b71525
commit
0e84bf2053
@@ -11,7 +11,7 @@ FILE: class.kt
|
||||
private [BODY_RESOLVE] get(): <ERROR TYPE REF: Symbol not found for C>
|
||||
|
||||
public final [BODY_RESOLVE] fun foo([BODY_RESOLVE] a: <ERROR TYPE REF: Symbol not found for A>): <ERROR TYPE REF: Cannot infer argument for type parameter R> {
|
||||
^foo <Inapplicable(INAPPLICABLE): kotlin/with>#<R|ERROR CLASS: Cannot infer argument for type parameter T|, R|ERROR CLASS: Cannot infer argument for type parameter R|>(R|<local>/a|, <L> = [BODY_RESOLVE] with@fun <ERROR TYPE REF: Cannot infer argument for type parameter T>.<anonymous>(): <ERROR TYPE REF: Cannot infer argument for type parameter R> <inline=Unknown, kind=EXACTLY_ONCE> {
|
||||
^foo <CS errors: kotlin/with>#<R|ERROR CLASS: Cannot infer argument for type parameter T|, R|ERROR CLASS: Cannot infer argument for type parameter R|>(R|<local>/a|, <L> = [BODY_RESOLVE] with@fun <ERROR TYPE REF: Cannot infer argument for type parameter T>.<anonymous>(): <ERROR TYPE REF: Cannot infer argument for type parameter R> <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^ <Unresolved name: bar>#(String(a), this@R|/B|.R|/B.y|)
|
||||
}
|
||||
)
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ class B(other: B = <!NO_THIS!>this<!>)
|
||||
class C() {
|
||||
constructor(x: Int) : this(<!ARGUMENT_TYPE_MISMATCH!>{
|
||||
val a = 10
|
||||
<!ARGUMENT_TYPE_MISMATCH, INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>
|
||||
<!INSTANCE_ACCESS_BEFORE_SUPER_CALL!>this<!>
|
||||
}<!>) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -362,18 +362,19 @@ private fun checkApplicabilityForArgumentType(
|
||||
// todo run this approximation only once for call
|
||||
val argumentType = captureFromTypeParameterUpperBoundIfNeeded(argumentTypeBeforeCapturing, expectedType, context.session)
|
||||
|
||||
fun subtypeError(actualExpectedType: ConeKotlinType): ResolutionDiagnostic {
|
||||
fun subtypeError(actualExpectedType: ConeKotlinType): ResolutionDiagnostic? {
|
||||
if (argument.isNullLiteral && actualExpectedType.nullability == ConeNullability.NOT_NULL) {
|
||||
return NullForNotNullType(argument)
|
||||
}
|
||||
|
||||
fun tryGetConeTypeThatCompatibleWithKtType(type: ConeKotlinType): ConeKotlinType {
|
||||
fun tryGetConeTypeThatCompatibleWithKtType(type: ConeKotlinType): ConeKotlinType? {
|
||||
if (type is ConeErrorType) return null
|
||||
if (type is ConeTypeVariableType) {
|
||||
val lookupTag = type.lookupTag
|
||||
|
||||
val constraints = (csBuilder as VariableFixationFinder.Context).notFixedTypeVariables[lookupTag]?.constraints
|
||||
val constraints = csBuilder.currentStorage().notFixedTypeVariables[lookupTag]?.constraints
|
||||
val constraintTypes = constraints?.mapNotNull { it.type as? ConeKotlinType }
|
||||
if (constraintTypes != null && constraintTypes.isNotEmpty()) {
|
||||
if (!constraintTypes.isNullOrEmpty()) {
|
||||
return ConeTypeIntersector.intersectTypes(context.session.typeContext, constraintTypes)
|
||||
}
|
||||
|
||||
@@ -389,9 +390,11 @@ private fun checkApplicabilityForArgumentType(
|
||||
return type
|
||||
}
|
||||
|
||||
val preparedExpectedType = tryGetConeTypeThatCompatibleWithKtType(actualExpectedType) ?: return null
|
||||
val preparedActualType = tryGetConeTypeThatCompatibleWithKtType(argumentType) ?: return null
|
||||
return ArgumentTypeMismatch(
|
||||
tryGetConeTypeThatCompatibleWithKtType(actualExpectedType),
|
||||
tryGetConeTypeThatCompatibleWithKtType(argumentType),
|
||||
preparedExpectedType,
|
||||
preparedActualType,
|
||||
argument,
|
||||
// Reaching here means argument types mismatch, and we want to record whether it's due to the nullability by checking a subtype
|
||||
// relation with nullable expected type.
|
||||
|
||||
@@ -16,9 +16,6 @@ class B(other: B = this)
|
||||
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:10:32: error: argument type mismatch: actual type is kotlin/Function0<ERROR CLASS: Cannot access ''<this>'' before the instance has been initialized> but kotlin/Int was expected
|
||||
constructor(x: Int) : this({
|
||||
^
|
||||
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:12:9: error: argument type mismatch: actual type is ERROR CLASS: Cannot access ''<this>'' before the instance has been initialized but ERROR CLASS: Unknown return lambda parameter type was expected
|
||||
this
|
||||
^
|
||||
compiler/testData/cli/jvm/instanceAccessBeforeSuperCall.kt:12:9: error: cannot access '<this>' before the instance has been initialized
|
||||
this
|
||||
^
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr?) {
|
||||
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G<!>
|
||||
checkSubtype<G<*>>(<!ARGUMENT_TYPE_MISMATCH!>v<!>)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) {
|
||||
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G<!>
|
||||
checkSubtype<G<*>>(<!ARGUMENT_TYPE_MISMATCH!>v<!>)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
var a: Int by A()
|
||||
var a1 by <!DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>A()<!>
|
||||
var a1 by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>A()<!>
|
||||
|
||||
var b: Int by B()
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class B {
|
||||
val c by Delegate(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>ag<!>)
|
||||
val c by <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>Delegate<!>(<!UNRESOLVED_REFERENCE!>ag<!>)
|
||||
}
|
||||
|
||||
class Delegate<T: Any>(val init: T) {
|
||||
|
||||
compiler/testData/diagnostics/tests/extensions/contextReceivers/conflictingWithDifferentOrder.fir.kt
Vendored
+1
-1
@@ -12,7 +12,7 @@ fun f(): Unit<!> = TODO()
|
||||
fun test(a: A, b: B) {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(a) {
|
||||
with(b) {
|
||||
<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>f<!>()<!>
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>f<!>()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ class Foo {
|
||||
}
|
||||
|
||||
fun main() {
|
||||
with("", {
|
||||
<!ARGUMENT_TYPE_MISMATCH!>Foo.<!UNRESOLVED_REFERENCE!>findByName<!>("")<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>("", {
|
||||
Foo.<!UNRESOLVED_REFERENCE!>findByName<!>("")
|
||||
})
|
||||
with(Foo) {
|
||||
findByName("")
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ fun testUnit() {
|
||||
fun testParameter() {
|
||||
takeFnToParameter { }
|
||||
takeFnToParameter { Unit }
|
||||
takeFnToParameter { <!ARGUMENT_TYPE_MISMATCH!><!UNRESOLVED_REFERENCE!>unresolved<!>()<!> }
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>takeFnToParameter<!> { <!UNRESOLVED_REFERENCE!>unresolved<!>() }
|
||||
takeFnToParameter { if (true) <!UNRESOLVED_REFERENCE!>unresolved<!>() }
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>takeFnToParameter<!> {
|
||||
if (true) <!UNRESOLVED_REFERENCE!>unresolved<!>() else <!UNRESOLVED_REFERENCE!>unresolved<!>()
|
||||
@@ -65,7 +65,7 @@ fun testParameter() {
|
||||
takeFnToParameter(fun(): Unit { return Unit })
|
||||
takeFnToParameter(fun() { if (true) return })
|
||||
takeFnToParameter(fun() { if (true) return Unit })
|
||||
takeFnToParameter(fun() = <!ARGUMENT_TYPE_MISMATCH!><!UNRESOLVED_REFERENCE!>unresolved<!>()<!>)
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>takeFnToParameter<!>(fun() = <!UNRESOLVED_REFERENCE!>unresolved<!>())
|
||||
takeFnToParameter(fun() { <!UNRESOLVED_REFERENCE!>unresolved<!>() })
|
||||
takeFnToParameter(fun(): Unit { <!UNRESOLVED_REFERENCE!>unresolved<!>() })
|
||||
takeFnToParameter(fun() { return <!UNRESOLVED_REFERENCE!>unresolved<!>() })
|
||||
|
||||
+1
-1
@@ -14,5 +14,5 @@ fun <T: Any> joinT(x: Comparable<*>, y: T): T? {
|
||||
|
||||
fun test() {
|
||||
val x2 = <!NONE_APPLICABLE!>joinT<!>(Unit, "2")
|
||||
checkSubtype<String?>(<!ARGUMENT_TYPE_MISMATCH!>x2<!>)
|
||||
checkSubtype<String?>(x2)
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,6 +20,6 @@ public class Foo {
|
||||
|
||||
fun test(e: <!UNRESOLVED_REFERENCE!>ErrorType<!>) {
|
||||
Foo.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!> {
|
||||
Sam.Result.create(<!ARGUMENT_TYPE_MISMATCH!>e<!>)
|
||||
Sam.Result.create(e)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ fun main() {
|
||||
val number: Int = 5 // doesn't work
|
||||
// val number: Long = 5 // works
|
||||
|
||||
with (WrapperFunctions()) {
|
||||
<!ARGUMENT_TYPE_MISMATCH!>wrapper <!NONE_APPLICABLE!>greaterEq<!> number<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!> (WrapperFunctions()) {
|
||||
wrapper <!NONE_APPLICABLE!>greaterEq<!> number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,5 +4,5 @@ fun <T> foo(t: T, t1: T) {}
|
||||
|
||||
fun test() {
|
||||
//no type inference error
|
||||
foo(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>aaab<!>, <!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>bbb<!>)
|
||||
}
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!UNRESOLVED_REFERENCE!>aaab<!>, <!UNRESOLVED_REFERENCE!>bbb<!>)
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -15,7 +15,7 @@ fun testAny() {
|
||||
|
||||
fun testAnyCall() {
|
||||
callAny {
|
||||
error -> <!ARGUMENT_TYPE_MISMATCH!><!UNRESOLVED_REFERENCE!>error<!>()<!>
|
||||
error -> <!UNRESOLVED_REFERENCE!>error<!>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ fun testParam() {
|
||||
}
|
||||
|
||||
fun testParamCall() {
|
||||
callParam {
|
||||
param -> <!ARGUMENT_TYPE_MISMATCH!><!UNRESOLVED_REFERENCE!>param<!>()<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>callParam<!> {
|
||||
param -> <!UNRESOLVED_REFERENCE!>param<!>()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -37,7 +37,7 @@ fun testStarProjection() = BiParam(
|
||||
intersect(First, Second),
|
||||
makeStarProjection()
|
||||
)
|
||||
fun testErrorType() = BiParam(
|
||||
fun testErrorType() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>BiParam<!>(
|
||||
intersect(First, Second),
|
||||
<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
<!UNRESOLVED_REFERENCE!>unresolved<!>
|
||||
)
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ fun insideJob1() = doTheJob1()
|
||||
suspend fun insideJob2() = doTheJob2()
|
||||
suspend fun insideJob3() = doTheJob3()
|
||||
|
||||
fun doTheJob0() = simpleAsync0 { <!ARGUMENT_TYPE_MISMATCH, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob0()<!> }
|
||||
fun doTheJob1() = simpleAsync1 { <!ARGUMENT_TYPE_MISMATCH, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob1()<!> }
|
||||
suspend fun doTheJob2() = simpleAsync2 { <!ARGUMENT_TYPE_MISMATCH, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!NON_LOCAL_SUSPENSION_POINT!>insideJob2<!>()<!> }
|
||||
suspend fun doTheJob3() = simpleAsync3 { <!ARGUMENT_TYPE_MISMATCH, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob3()<!> }
|
||||
fun doTheJob0() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync0<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob0()<!> }
|
||||
fun doTheJob1() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync1<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob1()<!> }
|
||||
suspend fun doTheJob2() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync2<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!><!NON_LOCAL_SUSPENSION_POINT!>insideJob2<!>()<!> }
|
||||
suspend fun doTheJob3() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>simpleAsync3<!> { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>insideJob3()<!> }
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ fun foo() {
|
||||
fun bar1() = bar1()
|
||||
|
||||
fun bar2() = 1 <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> bar2()
|
||||
fun bar3() = id(<!ARGUMENT_TYPE_MISMATCH!>bar3()<!>)
|
||||
fun bar3() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!>(bar3())
|
||||
}
|
||||
|
||||
fun <T> id(x: T) = x
|
||||
|
||||
@@ -8,5 +8,5 @@ fun <T> _arrayList(vararg values: T) : List<T> = throw Exception()
|
||||
class _Pair<A>(val a: A)
|
||||
|
||||
fun test() {
|
||||
_arrayList(_Pair(1))._sortBy { it -> <!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>xxx<!> }
|
||||
_arrayList(_Pair(1)).<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>_sortBy<!> { it -> <!UNRESOLVED_REFERENCE!>xxx<!> }
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ public inline fun <T: Closeable, R> T.use1(block: (T)-> R) : R {
|
||||
}
|
||||
|
||||
fun main() {
|
||||
C().use1 {
|
||||
C().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use1<!> {
|
||||
w -> // ERROR here
|
||||
<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>x<!>
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ public inline fun <T: Closeable, R> T.use(block: (t: T)-> R) : R {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
C().use {
|
||||
C().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!> {
|
||||
it.close()
|
||||
<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>x<!>
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,9 +12,9 @@ public inline fun <T: Closeable, R> use(t: T, block: T.(T)-> R) : R {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
use(C()) {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!>(C()) {
|
||||
this.close()
|
||||
it.close()
|
||||
<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>xx<!>
|
||||
<!UNRESOLVED_REFERENCE!>xx<!>
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ public inline fun <T: Closeable, R> T.use(block: T.()-> R) : R {
|
||||
}
|
||||
|
||||
fun test() {
|
||||
C().use {
|
||||
C().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>use<!> {
|
||||
this.close()
|
||||
<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>x<!>
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,21 +4,21 @@ import java.lang.Exception
|
||||
fun <K> id(arg: K): K = arg
|
||||
|
||||
fun test() {
|
||||
id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>)!!
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)!!
|
||||
<!UNRESOLVED_REFERENCE!>unresolved<!>!!!!
|
||||
try {
|
||||
id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
} catch (e: Exception) {
|
||||
id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
}
|
||||
|
||||
if (true)
|
||||
id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
else
|
||||
id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
|
||||
when {
|
||||
true -> id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
true -> <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!>(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
}
|
||||
id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>) ?: id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>) ?: id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ fun <M> materialize(): M = TODO()
|
||||
|
||||
fun test(b: Boolean) {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!>(if (b) {
|
||||
id(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
} else {
|
||||
id(
|
||||
materialize()
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ fun <T, R> foo(a: A<T, R>) = a
|
||||
fun <T, R> bar(f: (T) -> R) = f
|
||||
|
||||
fun test() {
|
||||
foo <!ARGUMENT_TYPE_MISMATCH!>{ <!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>it<!> }<!>
|
||||
foo <!ARGUMENT_TYPE_MISMATCH!>{ <!UNRESOLVED_REFERENCE!>it<!> }<!>
|
||||
foo <!ARGUMENT_TYPE_MISMATCH!>{ x -> x}<!>
|
||||
foo <!ARGUMENT_TYPE_MISMATCH!>{ x: Int -> x}<!>
|
||||
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ fun <T: Closeable, R> T.foo(block: (T)-> R) = block
|
||||
fun <T: Closeable, R> T.foo(block: (T, T)-> R) = block
|
||||
|
||||
fun main() {
|
||||
C().foo { // no ambiguity here
|
||||
C().<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!> { // no ambiguity here
|
||||
www ->
|
||||
<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>xs<!>
|
||||
<!UNRESOLVED_REFERENCE!>xs<!>
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ fun <K> id2(x: K, s: String): K = x
|
||||
fun <K> ret(s: String): K = TODO()
|
||||
|
||||
fun test() {
|
||||
id2(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>, "foo")
|
||||
id2(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unresolved<!>, <!ARGUMENT_TYPE_MISMATCH!>42<!>)
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id2<!>(<!UNRESOLVED_REFERENCE!>unresolved<!>, "foo")
|
||||
id2(<!UNRESOLVED_REFERENCE!>unresolved<!>, <!ARGUMENT_TYPE_MISMATCH!>42<!>)
|
||||
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>ret<!>("foo")
|
||||
ret(<!ARGUMENT_TYPE_MISMATCH!>42<!>)
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ object Outer {
|
||||
get() = 0
|
||||
|
||||
override fun get(index: Int): Char {
|
||||
checkSubtype<CharSequence>(<!ARGUMENT_TYPE_MISMATCH, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>x<!>)
|
||||
checkSubtype<CharSequence>(<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>x<!>)
|
||||
return ' '
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ class A {
|
||||
val a get() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>b<!>
|
||||
val b get() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>a<!>
|
||||
|
||||
val z1 get() = id(<!ARGUMENT_TYPE_MISMATCH, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>z1<!>)
|
||||
val z2 get() = l(<!ARGUMENT_TYPE_MISMATCH, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>z2<!>)
|
||||
val z1 get() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>id<!>(<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>z1<!>)
|
||||
val z2 get() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>l<!>(<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>z2<!>)
|
||||
|
||||
val u get() = <!UNRESOLVED_REFERENCE!>field<!>
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ fun test2() { // to extension lambda 1
|
||||
val i27a: E1 = <!INITIALIZER_TYPE_MISMATCH!>when (e) { E.VALUE -> { s -> <!NO_THIS!>this<!> + s.<!UNRESOLVED_REFERENCE!>length<!> } }<!> // oi+ ni+
|
||||
|
||||
val w28 = W2 <!ARGUMENT_TYPE_MISMATCH!>{ i: Int, <!CANNOT_INFER_PARAMETER_TYPE!>s<!> -> i <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> s.<!UNRESOLVED_REFERENCE!>length<!> }<!> // oi- ni-
|
||||
val i28: E1 = id { i: Int, <!CANNOT_INFER_PARAMETER_TYPE!>s<!> -> <!ARGUMENT_TYPE_MISMATCH!>i <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> s.<!UNRESOLVED_REFERENCE!>length<!><!> } // oi- ni-
|
||||
val i28: E1 = id { i: Int, <!CANNOT_INFER_PARAMETER_TYPE!>s<!> -> i <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> s.<!UNRESOLVED_REFERENCE!>length<!> } // oi- ni-
|
||||
val w29 = W2 <!ARGUMENT_TYPE_MISMATCH!>{ i: Int, s: String -> i + s.length }<!> // oi- ni-
|
||||
val i29: E1 = id { i: Int, s: String -> i + s.length } // oi+ ni+
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ abstract class KFunctionKt9005WorkAround<out R: Any?>(private val _functionInsta
|
||||
private val _reflectedFunction: kotlin.reflect.KFunction<R> = _functionInstance.<!UNRESOLVED_REFERENCE!>reflect<!>() ?: throw IllegalStateException("")
|
||||
|
||||
private val _parameters: List<kotlin.reflect.KParameter> = run {
|
||||
<!ARGUMENT_TYPE_MISMATCH!>_functionInstance.javaClass.methods.first().<!UNRESOLVED_REFERENCE!>parameters<!>.map {
|
||||
_functionInstance.javaClass.methods.first().<!UNRESOLVED_REFERENCE!>parameters<!>.map {
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>object<!> : kotlin.reflect.KParameter {
|
||||
override val index: Int = 0
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
|
||||
fun Int.with() {
|
||||
with("") {
|
||||
<!ARGUMENT_TYPE_MISMATCH!>this@with.<!UNRESOLVED_REFERENCE!>inc<!>()<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>("") {
|
||||
this@with.<!UNRESOLVED_REFERENCE!>inc<!>()
|
||||
}
|
||||
}
|
||||
|
||||
fun Int.bar() {
|
||||
with("") bar@{
|
||||
<!ARGUMENT_TYPE_MISMATCH!>this@bar.<!UNRESOLVED_REFERENCE!>inc<!>()<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>("") bar@{
|
||||
this@bar.<!UNRESOLVED_REFERENCE!>inc<!>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ fun foo(f: with.() -> Unit) {}
|
||||
|
||||
class with {
|
||||
fun foo() {
|
||||
with("") {
|
||||
<!ARGUMENT_TYPE_MISMATCH!>this@with.<!UNRESOLVED_REFERENCE!>foo<!>()<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>("") {
|
||||
this@with.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
}
|
||||
|
||||
with("") with@{
|
||||
<!ARGUMENT_TYPE_MISMATCH!>this@with.<!UNRESOLVED_REFERENCE!>foo<!>()<!>
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>("") with@{
|
||||
this@with.<!UNRESOLVED_REFERENCE!>foo<!>()
|
||||
}
|
||||
|
||||
with("") other@{
|
||||
|
||||
+4
-4
@@ -101,10 +101,10 @@ fun case_5() {
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6() {
|
||||
checkSubtype<Byte>(<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
|
||||
checkSubtype<Short>(<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
|
||||
checkSubtype<Int>(<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
|
||||
checkSubtype<Long>(<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!><!>)
|
||||
checkSubtype<Byte>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
|
||||
checkSubtype<Short>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
|
||||
checkSubtype<Int>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
|
||||
checkSubtype<Long>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Byte>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Short>() }
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Int>() }
|
||||
|
||||
+6
-6
@@ -2,24 +2,24 @@
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1() {
|
||||
checkSubtype<Long>(<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!><!>)
|
||||
checkSubtype<Long>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
|
||||
checkSubtype<Long>(<!ARGUMENT_TYPE_MISMATCH, INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!>)
|
||||
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!>)
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>9223372036854775808L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2() {
|
||||
checkSubtype<Long>(<!ARGUMENT_TYPE_MISMATCH, INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!>)
|
||||
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!>)
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
|
||||
checkSubtype<Long>(<!ARGUMENT_TYPE_MISMATCH, INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!>)
|
||||
checkSubtype<Long>(<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!>)
|
||||
<!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
|
||||
checkSubtype<Long>(<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!><!>)
|
||||
checkSubtype<Long>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000L<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
|
||||
checkSubtype<Long>(<!ARGUMENT_TYPE_MISMATCH!><!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!><!>)
|
||||
checkSubtype<Long>(<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>-<!><!INT_LITERAL_OUT_OF_RANGE!>100000000000000000000000000000000l<!> <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { check<Long>() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user