提交 5e150d62 编写于 作者: J Jinseong Jeon 提交者: Dmitriy Novozhilov

FIR checker: differentiate UNSAFE_IMPLICIT_INVOKE_CALL from UNSAFE_CALL

上级 0c0c53cc
......@@ -218,7 +218,6 @@ val DIAGNOSTICS_LIST = DiagnosticListBuilder.buildDiagnosticList {
parameter<Name>("containingClassName")
}
val OVERRIDING_FINAL_MEMBER by error<FirSourceElement, KtNamedDeclaration>(PositioningStrategy.OVERRIDE_MODIFIER) {
parameter<FirCallableDeclaration<*>>("overriddenDeclaration")
parameter<Name>("containingClassName")
......@@ -240,7 +239,6 @@ val DIAGNOSTICS_LIST = DiagnosticListBuilder.buildDiagnosticList {
parameter<FirMemberDeclaration>("overridingDeclaration")
parameter<FirMemberDeclaration>("overriddenDeclaration")
}
}
group("Redeclarations") {
......@@ -282,13 +280,11 @@ val DIAGNOSTICS_LIST = DiagnosticListBuilder.buildDiagnosticList {
parameter<FirMemberDeclaration>("function")
}
val FUNCTION_DECLARATION_WITH_NO_NAME by error<FirSourceElement, KtFunction>(PositioningStrategy.DECLARATION_SIGNATURE)
// TODO: val ANONYMOUS_FUNCTION_WITH_NAME by error1<FirSourceElement, PsiElement, Name>(SourceElementPositioningStrategies.DECLARATION_NAME)
val ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE by error<FirSourceElement, KtParameter>(PositioningStrategy.PARAMETER_DEFAULT_VALUE)
val USELESS_VARARG_ON_PARAMETER by warning<FirSourceElement, KtParameter>()
}
group("Properties & accessors") {
......@@ -324,7 +320,6 @@ val DIAGNOSTICS_LIST = DiagnosticListBuilder.buildDiagnosticList {
val EXPECTED_DELEGATED_PROPERTY by error<FirSourceElement, KtPropertyDelegate>()
}
group("Destructuring declaration") {
val INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION by error<FirSourceElement, KtDestructuringDeclaration>()
val COMPONENT_FUNCTION_MISSING by error<FirSourceElement, PsiElement> {
......@@ -340,7 +335,6 @@ val DIAGNOSTICS_LIST = DiagnosticListBuilder.buildDiagnosticList {
parameter<Name>("componentFunctionName")
}
// TODO: val COMPONENT_FUNCTION_ON_NULLABLE by ...
// TODO: val COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH by ...
}
......@@ -363,7 +357,9 @@ val DIAGNOSTICS_LIST = DiagnosticListBuilder.buildDiagnosticList {
val UNSAFE_CALL by error<FirSourceElement, PsiElement>(PositioningStrategy.DOT_BY_SELECTOR) {
parameter<ConeKotlinType>("receiverType")
}
// TODO: val UNSAFE_IMPLICIT_INVOKE_CALL by error1<FirSourceElement, PsiElement, ConeKotlinType>()
val UNSAFE_IMPLICIT_INVOKE_CALL by error<FirSourceElement, PsiElement>() {
parameter<ConeKotlinType>("receiverType")
}
// TODO: val UNSAFE_INFIX_CALL by ...
// TODO: val UNSAFE_OPERATOR_CALL by ...
// TODO: val UNEXPECTED_SAFE_CALL by ...
......
......@@ -230,6 +230,7 @@ object FirErrors {
// Nullability
val UNSAFE_CALL by error1<FirSourceElement, PsiElement, ConeKotlinType>(SourceElementPositioningStrategies.DOT_BY_SELECTOR)
val UNSAFE_IMPLICIT_INVOKE_CALL by error1<FirSourceElement, PsiElement, ConeKotlinType>()
// When expressions
val NO_ELSE_IN_WHEN by error1<FirSourceElement, KtWhenExpression, List<WhenMissingCase>>(SourceElementPositioningStrategies.WHEN_EXPRESSION)
......
......@@ -101,7 +101,7 @@ object FirDestructuringDeclarationChecker : FirPropertyChecker() {
reporter.report(
FirErrors.COMPONENT_FUNCTION_ON_NULLABLE.on(
originalDestructuringDeclarationOrInitializerSource,
(diagnostic.candidateSymbol.fir as FirSimpleFunction).name
(diagnostic.candidate.symbol.fir as FirSimpleFunction).name
),
context
)
......
......@@ -157,6 +157,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNINITIALIZED_VAR
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNRESOLVED_LABEL
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNRESOLVED_REFERENCE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNSAFE_CALL
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNSAFE_IMPLICIT_INVOKE_CALL
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UNUSED_VARIABLE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.UPPER_BOUND_VIOLATED
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.USELESS_VARARG_ON_PARAMETER
......@@ -506,11 +507,11 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension {
"Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type {0}",
RENDER_TYPE
)
//map.put(
// UNSAFE_IMPLICIT_INVOKE_CALL,
// "Reference has a nullable type ''{0}'', use explicit \"?.invoke\" to make a function-like call instead.",
// RENDER_TYPE
//)
map.put(
UNSAFE_IMPLICIT_INVOKE_CALL,
"Reference has a nullable type ''{0}'', use explicit \"?.invoke\" to make a function-like call instead.",
RENDER_TYPE
)
// When expressions
map.put(NO_ELSE_IN_WHEN, "''when'' expression must be exhaustive, add necessary {0}", WHEN_MISSING_CASES)
......
......@@ -58,20 +58,19 @@ private fun mapInapplicableCandidateError(
source: FirSourceElement,
): FirDiagnostic<*> {
// TODO: Need to distinguish SMARTCAST_IMPOSSIBLE
// TODO: handle other UNSAFE_* variants: invoke, infix, operator
val rootCause = diagnostic.diagnostics.find { it.applicability == diagnostic.applicability }
// TODO: handle other UNSAFE_* variants: infix, operator
val rootCause = diagnostic.candidate.diagnostics.find { it.applicability == diagnostic.applicability }
if (rootCause != null &&
rootCause is InapplicableWrongReceiver &&
rootCause.actualType?.isNullable == true &&
(rootCause.expectedType == null || !rootCause.expectedType!!.isMarkedNullable)
(rootCause.expectedType == null || rootCause.expectedType!!.isEffectivelyNotNull())
) {
val expectedType = rootCause.expectedType
if (expectedType == null || expectedType.isEffectivelyNotNull()) {
return FirErrors.UNSAFE_CALL.on(source, rootCause.actualType!!)
if (diagnostic.candidate.callInfo.isImplicitInvoke) {
return FirErrors.UNSAFE_IMPLICIT_INVOKE_CALL.on(source, rootCause.actualType!!)
}
return FirErrors.UNSAFE_CALL.on(source, rootCause.actualType!!)
}
return FirErrors.INAPPLICABLE_CANDIDATE.on(source, diagnostic.candidateSymbol)
return FirErrors.INAPPLICABLE_CANDIDATE.on(source, diagnostic.candidate.symbol)
}
private fun ConeSimpleDiagnostic.getFactory(): FirDiagnosticFactory0<FirSourceElement, *> {
......
......@@ -1231,9 +1231,9 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
private fun FlowContent.generate(diagnostic: ConeDiagnostic) {
when (diagnostic) {
is ConeInapplicableCandidateError -> {
describeVerbose(diagnostic.candidateSymbol)
describeVerbose(diagnostic.candidate.symbol)
br
diagnostic.errors.forEach { callDiagnostic ->
diagnostic.candidate.system.errors.forEach { callDiagnostic ->
when (callDiagnostic) {
is NewConstraintError -> {
ident()
......
......@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.fir.resolve.calls.tower
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.expressions.FirResolvedQualifier
import org.jetbrains.kotlin.fir.expressions.builder.FirQualifiedAccessExpressionBuilder
......@@ -156,7 +155,9 @@ internal class FirInvokeResolveTowerExtension(
val invokeFunctionInfo =
info.copy(
explicitReceiver = invokeReceiverExpression, name = OperatorNameConventions.INVOKE,
explicitReceiver = invokeReceiverExpression,
name = OperatorNameConventions.INVOKE,
isImplicitInvoke = true,
candidateForCommonInvokeReceiver = invokeReceiverCandidate.takeUnless { invokeBuiltinExtensionMode }
).let {
when {
......
......@@ -38,20 +38,11 @@ class ConeHiddenCandidateError(
override val reason: String get() = "HIDDEN: ${describeSymbol(candidateSymbol)} is invisible"
}
class ConeInapplicableCandidateError private constructor(
class ConeInapplicableCandidateError(
val applicability: CandidateApplicability,
val candidateSymbol: AbstractFirBasedSymbol<*>,
val diagnostics: List<ResolutionDiagnostic>,
val errors: List<ConstraintSystemError>
val candidate: Candidate,
) : ConeDiagnostic() {
constructor(applicability: CandidateApplicability, candidate: Candidate) : this(
applicability,
candidate.symbol,
candidate.diagnostics,
candidate.system.errors
)
override val reason: String get() = "Inapplicable($applicability): ${describeSymbol(candidateSymbol)}"
override val reason: String get() = "Inapplicable($applicability): ${describeSymbol(candidate.symbol)}"
}
class ConeAmbiguityError(val name: Name, val applicability: CandidateApplicability, val candidates: Collection<AbstractFirBasedSymbol<*>>) : ConeDiagnostic() {
......
......@@ -9,13 +9,13 @@ interface T {
}
fun test(t: T) {
t<!UNSAFE_CALL!>.<!>f(1) //unsafe call error
t.<!UNSAFE_IMPLICIT_INVOKE_CALL!>f<!>(1) //unsafe call error
t.f?.invoke(1)
}
fun test1(t: T?) {
t.<!UNRESOLVED_REFERENCE!>f<!>(1) // todo resolve f as value and report UNSAFE_CALL
t?.<!UNSAFE_CALL!>f<!>(1)
t?.<!UNSAFE_IMPLICIT_INVOKE_CALL!>f<!>(1)
t<!UNSAFE_CALL!>.<!>f?.invoke(1)
t?.f?.invoke(1)
}
// FILE: J.java
import org.jetbrains.annotations.*;
public class J {
public interface Invoke {
void invoke();
}
@NotNull
public static Invoke staticNN;
@Nullable
public static Invoke staticN;
public static Invoke staticJ;
}
// FILE: k.kt
fun test() {
J.staticNN()
J<!UNSAFE_CALL!>.<!>staticN()
J.staticJ()
}
\ No newline at end of file
// FIR_IDENTICAL
// FILE: J.java
import org.jetbrains.annotations.*;
......
......@@ -4,7 +4,7 @@
operator fun String.invoke(i: Int) {}
fun foo(s: String?) {
<!UNSAFE_CALL!>s<!>(1)
<!UNSAFE_IMPLICIT_INVOKE_CALL!>s<!>(1)
<!UNSAFE_CALL!>(s ?: null)(1)<!>
<!UNSAFE_IMPLICIT_INVOKE_CALL!>(s ?: null)(1)<!>
}
......@@ -7,8 +7,8 @@ fun test(a: A) {
(a.x)("")
}
"".<!UNRESOLVED_REFERENCE!>(a.x)()<!>
a<!UNSAFE_CALL!>.<!>x("")
<!UNSAFE_CALL!>(a.x)("")<!>
a.<!UNSAFE_IMPLICIT_INVOKE_CALL!>x<!>("")
<!UNSAFE_IMPLICIT_INVOKE_CALL!>(a.x)("")<!>
with("") {
a.<!INAPPLICABLE_CANDIDATE!>x<!>()
......
......@@ -14,7 +14,7 @@ class MemberInvokeOwner {
class Cls {
fun testImplicitReceiver() {
<!UNSAFE_CALL!>nullableExtensionProperty<!>()
<!UNSAFE_IMPLICIT_INVOKE_CALL!>nullableExtensionProperty<!>()
}
}
......@@ -30,7 +30,7 @@ fun testNullableReceiver(nullable: Cls?) {
}
fun testNotNullableReceiver(notNullable: Cls) {
notNullable<!UNSAFE_CALL!>.<!>nullableExtensionProperty()
notNullable.<!UNSAFE_IMPLICIT_INVOKE_CALL!>nullableExtensionProperty<!>()
notNullable?.extensionProperty()
}
......@@ -38,6 +38,6 @@ fun testFlexibleReceiver() {
val flexible = JavaClass.createFlexible()
flexible.extensionProperty()
flexible?.extensionProperty()
flexible<!UNSAFE_CALL!>.<!>nullableExtensionProperty()
flexible?.<!UNSAFE_CALL!>nullableExtensionProperty<!>()
flexible.<!UNSAFE_IMPLICIT_INVOKE_CALL!>nullableExtensionProperty<!>()
flexible?.<!UNSAFE_IMPLICIT_INVOKE_CALL!>nullableExtensionProperty<!>()
}
// !WITH_NEW_INFERENCE
fun f(s: String, action: (String.() -> Unit)?) {
s.foo().bar()<!UNSAFE_CALL!>.<!>action()
s.foo().bar().<!UNSAFE_IMPLICIT_INVOKE_CALL!>action<!>()
}
fun String.foo() = ""
......@@ -12,4 +12,4 @@ fun String.bar() = ""
val functions: Map<String, () -> Any> = TODO()
fun run(name: String) = <!UNSAFE_CALL!>functions[name]()<!>
\ No newline at end of file
fun run(name: String) = <!UNSAFE_IMPLICIT_INVOKE_CALL!>functions[name]()<!>
\ No newline at end of file
......@@ -361,23 +361,23 @@ fun case_21() {
// TESTCASE NUMBER: 22
fun case_22(a: (() -> Unit)?) {
if (a != null !is Boolean) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_CALL!>a<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>propAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>propNullableT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>propNullableAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>funT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>funAny()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>funNullableT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>a()<!><!UNSAFE_CALL!>.<!>funNullableAny()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.propAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.propNullableT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.propNullableAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.funT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.funAny()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.funNullableT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>.funNullableAny()
}
}
// TESTCASE NUMBER: 23
fun case_23(a: ((Float) -> Int?)?, b: Float?) {
if (a != null !is Boolean && b !== null is Boolean) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
if (x != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x<!>.equals(null)
......@@ -396,8 +396,8 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?) {
// TESTCASE NUMBER: 24
fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) =
if (a !== null is Boolean && b !== null !is Boolean) {
<!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>)
<!UNSAFE_CALL!>a<!>(b)
<!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>)
<!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(b)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!><!UNSAFE_CALL!>.<!>propAny
......@@ -440,7 +440,7 @@ fun case_25(b: Boolean) {
// TESTCASE NUMBER: 26
fun case_26(a: ((Float) -> Int?)?, b: Float?) {
if (a != null == true == false && b != null == true == false) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
if (x != null == true === false) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
......
......@@ -67,7 +67,7 @@ fun case_3(b: Boolean) {
val y = if (b) x else null
if (false || false || false || false || y !== null) {
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_CALL!>y<!>()<!>
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>y<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<<anonymous>?>?")!>y<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<<anonymous>?>?")!>y<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<<anonymous>?>?")!>y<!><!UNSAFE_CALL!>.<!>propAny
......@@ -87,7 +87,7 @@ fun case_3(b: Boolean) {
// TESTCASE NUMBER: 4
fun case_4(a: ((Float) -> Int?)?, b: Float?) {
if (a != null == true && b != null == true || false || false || false || false || false || false || false || false || false) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>?")!>a<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>?")!>a<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>?")!>a<!><!UNSAFE_CALL!>.<!>propAny
......@@ -274,7 +274,7 @@ fun case_11(b: Boolean) {
val y = if (b) x else null
if (y === null && true) else {
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_CALL!>y<!>()<!>
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>y<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<<anonymous>?>?")!>y<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<<anonymous>?>?")!>y<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<<anonymous>?>?")!>y<!><!UNSAFE_CALL!>.<!>propAny
......@@ -298,7 +298,7 @@ fun case_12(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) {
if (true && a == null == true || b == null == true) {
} else {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float?")!>b<!>)<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>?")!>a<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>?")!>a<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>?")!>a<!><!UNSAFE_CALL!>.<!>propAny
......
......@@ -422,7 +422,7 @@ fun case_21() {
// TESTCASE NUMBER: 22
fun case_22(a: (() -> Unit)?) {
if (a != implicitNullableNothingProperty) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_CALL!>a<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>propAny
......@@ -438,7 +438,7 @@ fun case_22(a: (() -> Unit)?) {
// TESTCASE NUMBER: 23
fun case_23(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) {
if (a != z && b !== z && b !== z) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
if (x != z || x !== implicitNullableNothingProperty) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
......@@ -457,7 +457,7 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) {
// TESTCASE NUMBER: 24
fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?, z: Nothing?) =
if (a !== z && b !== z) {
<!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>)
<!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>?")!>a<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>propAny
......@@ -489,7 +489,7 @@ fun case_25(b: Boolean, z: Nothing?) {
val y = if (b) x else z
if (y !== z || y != implicitNullableNothingProperty) {
val z1 = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_CALL!>y<!>()<!>
val z1 = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>y<!>()<!>
if (z1 != z && implicitNullableNothingProperty !== z1) {
<!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!>z1<!><!UNSAFE_CALL!>.<!>a
......@@ -511,7 +511,7 @@ fun case_26(a: ((Float) -> Int?)?, b: Float?) {
var z = null
if (a != z == true && b != implicitNullableNothingProperty == true) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
if (x != implicitNullableNothingProperty == true || z !== x) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
......@@ -575,7 +575,7 @@ fun case_29(x: Boolean) {
val y = if (x) z else null
if (false || false || false || false || y !== v) {
val t = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_CALL!>y<!>()<!>
val t = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>y<!>()<!>
if (z !== t || false) {
<!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!>t<!><!UNSAFE_CALL!>.<!>a
......@@ -595,7 +595,7 @@ fun case_29(x: Boolean) {
// TESTCASE NUMBER: 30
fun case_30(a: ((Float) -> Int?)?, b: Float?) {
if (implicitNullableNothingProperty != a == true && b != implicitNullableNothingProperty == true || false || false || false || false || false || false || false || false || false) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
if (false || implicitNullableNothingProperty != x == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
......@@ -651,7 +651,7 @@ fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) {
if (true && a == z == true || b == null == true) {
} else {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float?")!>b<!>)<!>
if (x == z == true && x === z || (c != z && <!UNSAFE_CALL!>!<!>c)) {
} else {
......@@ -1054,7 +1054,7 @@ fun case_60(b: Boolean) {
val y = if (b) x else nullableNothingProperty
if (y != nullableNothingProperty) {
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_CALL!>y<!>()<!>
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>y<!>()<!>
if (z == nullableNothingProperty) {
<!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!>z<!>
......
......@@ -406,7 +406,7 @@ fun case_21() {
fun case_22(a: (() -> Unit)?) {
var y = null
if (a != null || y != a) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_CALL!>a<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>()<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>propAny
......@@ -422,7 +422,7 @@ fun case_22(a: (() -> Unit)?) {
// TESTCASE NUMBER: 23
fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) {
if (a != null && b !== null || a != c && b !== c) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
if (x != null || c !== x) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
......@@ -441,7 +441,7 @@ fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) {
// TESTCASE NUMBER: 24
fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) =
if (a !== null && b !== null || implicitNullableNothingProperty != a && nullableNothingProperty !== b) {
<!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>)
<!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>b<!>)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>?")!>a<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>?")!>a<!><!UNSAFE_CALL!>.<!>propAny
......@@ -475,7 +475,7 @@ fun case_25(b: Boolean) {
if (y !== null || x()!!.b != y) {
if (x()!!.b != y) {
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_CALL!>y<!>()<!>
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>y<!>()<!>
if (z != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("<anonymous> & <anonymous>?")!>z<!>.a
......@@ -498,7 +498,7 @@ fun case_26(a: ((Float) -> Int?)?, b: Float?) {
var c: Nothing? = null
if (a != null == true && b != null == true || c != a == true && b != c == true) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
if (x != null == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?")!>x<!>.equals(null)
......
......@@ -41,7 +41,7 @@ internal fun FirReference.getResolvedKtSymbolOfNameReference(builder: KtSymbolBy
internal fun FirErrorNamedReference.getCandidateSymbols(): Collection<FirBasedSymbol<*>> =
when (val diagnostic = diagnostic) {
is ConeInapplicableCandidateError -> listOf(diagnostic.candidateSymbol)
is ConeInapplicableCandidateError -> listOf(diagnostic.candidate.symbol)
is ConeHiddenCandidateError -> listOf(diagnostic.candidateSymbol)
is ConeAmbiguityError -> diagnostic.candidates
is ConeOperatorAmbiguityError -> diagnostic.candidates
......
......@@ -268,7 +268,7 @@ internal object FirReferenceResolveHelper {
val candidates = when (val diagnostic = fir.diagnostic) {
is ConeAmbiguityError -> diagnostic.candidates
is ConeOperatorAmbiguityError -> diagnostic.candidates
is ConeInapplicableCandidateError -> listOf(diagnostic.candidateSymbol)
is ConeInapplicableCandidateError -> listOf(diagnostic.candidate.symbol)
else -> emptyList()
}
return candidates.mapNotNull { it.fir.buildSymbol(symbolBuilder) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册