[FIR] Let FirErrorExpression have a working type if possible
^KT-65337 Fixed
This commit is contained in:
committed by
Space Team
parent
7f42596935
commit
389f02b016
+3
-4
@@ -34,7 +34,8 @@ internal class FirErrorExpressionImpl(
|
|||||||
override var nonExpressionElement: FirElement?,
|
override var nonExpressionElement: FirElement?,
|
||||||
) : FirErrorExpression() {
|
) : FirErrorExpression() {
|
||||||
@OptIn(UnresolvedExpressionTypeAccess::class)
|
@OptIn(UnresolvedExpressionTypeAccess::class)
|
||||||
override var coneTypeOrNull: ConeKotlinType? = ConeErrorType(ConeStubDiagnostic(diagnostic))
|
override val coneTypeOrNull: ConeKotlinType?
|
||||||
|
get() = expression?.coneTypeOrNull ?: ConeErrorType(ConeStubDiagnostic(diagnostic))
|
||||||
|
|
||||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||||
annotations.forEach { it.accept(visitor, data) }
|
annotations.forEach { it.accept(visitor, data) }
|
||||||
@@ -54,9 +55,7 @@ internal class FirErrorExpressionImpl(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {
|
override fun replaceConeTypeOrNull(newConeTypeOrNull: ConeKotlinType?) {}
|
||||||
coneTypeOrNull = newConeTypeOrNull
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
override fun replaceAnnotations(newAnnotations: List<FirAnnotation>) {
|
||||||
annotations = newAnnotations.toMutableOrEmpty()
|
annotations = newAnnotations.toMutableOrEmpty()
|
||||||
|
|||||||
+1
-1
@@ -518,7 +518,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl(errorExpression) {
|
impl(errorExpression) {
|
||||||
default("coneTypeOrNull", "ConeErrorType(ConeStubDiagnostic(diagnostic))")
|
default("coneTypeOrNull", "expression?.coneTypeOrNull ?: ConeErrorType(ConeStubDiagnostic(diagnostic))", withGetter = true)
|
||||||
additionalImports(coneErrorTypeType, coneStubDiagnosticType)
|
additionalImports(coneErrorTypeType, coneStubDiagnosticType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
// ISSUE: KT-65337
|
// ISSUE: KT-65337
|
||||||
|
|
||||||
inline fun bar(s: () -> Unit) {
|
inline fun bar(s: () -> Unit) {
|
||||||
(<!UNRESOLVED_REFERENCE!><!UNDERSCORE_IS_RESERVED!>_<!>@ s<!>)()
|
(<!UNDERSCORE_IS_RESERVED!>_<!>@ s)()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
annotation class A(val a: IntArray = <!TYPE_MISMATCH!>arrayOf(1)<!>)
|
annotation class A(val a: IntArray = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>arrayOf(1)<!>)
|
||||||
annotation class B(val a: IntArray = intArrayOf(1))
|
annotation class B(val a: IntArray = intArrayOf(1))
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
// NI_EXPECTED_FILE
|
// NI_EXPECTED_FILE
|
||||||
|
|
||||||
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!>.<!SYNTAX!><<!><!UNRESOLVED_REFERENCE!>cabc<!><!SYNTAX!><!SYNTAX!>$Wrapper<!><<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>out<!> Any><!>::<!UNRESOLVED_REFERENCE!>unwrap<!>
|
val unwrapped = <!UNRESOLVED_REFERENCE!>some<!>.<!SYNTAX!><<!>cabc<!SYNTAX!><!SYNTAX!>$Wrapper<!><<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT!>out<!> Any><!>::<!UNRESOLVED_REFERENCE!>unwrap<!>
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ fun main() {
|
|||||||
val h1 : String = <!INITIALIZER_TYPE_MISMATCH!>--v<!>;
|
val h1 : String = <!INITIALIZER_TYPE_MISMATCH!>--v<!>;
|
||||||
val i : String = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>!true<!>;
|
val i : String = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>!true<!>;
|
||||||
val j : String = <!INITIALIZER_TYPE_MISMATCH!>foo@ true<!>;
|
val j : String = <!INITIALIZER_TYPE_MISMATCH!>foo@ true<!>;
|
||||||
val k : String = <!MULTIPLE_LABELS_ARE_FORBIDDEN!>foo@<!> bar@ true;
|
val k : String = <!INITIALIZER_TYPE_MISMATCH!><!MULTIPLE_LABELS_ARE_FORBIDDEN!>foo@<!> bar@ true<!>;
|
||||||
val l : String = <!INITIALIZER_TYPE_MISMATCH!>-1<!>;
|
val l : String = <!INITIALIZER_TYPE_MISMATCH!>-1<!>;
|
||||||
val m : String = <!INITIALIZER_TYPE_MISMATCH!>+1<!>;
|
val m : String = <!INITIALIZER_TYPE_MISMATCH!>+1<!>;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -4,4 +4,4 @@ fun foo(l: () -> Unit) {}
|
|||||||
fun bar(l: () -> String) {}
|
fun bar(l: () -> String) {}
|
||||||
|
|
||||||
val a = foo { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, UNSUPPORTED!>[]<!> }
|
val a = foo { <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, UNSUPPORTED!>[]<!> }
|
||||||
val b = bar { <!TYPE_MISMATCH, UNSUPPORTED!>[]<!> }
|
val b = bar { <!ARGUMENT_TYPE_MISMATCH, TYPE_MISMATCH, UNSUPPORTED!>[]<!> }
|
||||||
|
|||||||
+2
-1
@@ -186,9 +186,10 @@ abstract class AbstractImplementationConfigurator<Implementation, Element, Imple
|
|||||||
*
|
*
|
||||||
* Use [additionalImports] if the default value uses types/functions that are not otherwise imported.
|
* Use [additionalImports] if the default value uses types/functions that are not otherwise imported.
|
||||||
*/
|
*/
|
||||||
fun default(field: String, value: String) {
|
fun default(field: String, value: String, withGetter: Boolean = false) {
|
||||||
default(field) {
|
default(field) {
|
||||||
this.value = value
|
this.value = value
|
||||||
|
this.withGetter = withGetter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user