[FIR] Fix some disappeared AMBIGUOUS_ANONYMOUS_TYPE_INFERRED
^KT-59932 Merge-request: KT-MR-12312 Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
fa34021a04
commit
70ea0de2db
+8
-5
@@ -40,13 +40,16 @@ object FirAmbiguousAnonymousTypeChecker : FirBasicDeclarationChecker() {
|
|||||||
* 2. `val x = ...`
|
* 2. `val x = ...`
|
||||||
* 3. `val x get() = ...`
|
* 3. `val x get() = ...`
|
||||||
*/
|
*/
|
||||||
val type = when (declaration) {
|
val (type, source) = when (declaration) {
|
||||||
is FirProperty -> declaration.initializer?.resolvedType ?: declaration.getter?.body?.singleExpressionType
|
is FirProperty -> {
|
||||||
is FirFunction -> declaration.body?.singleExpressionType
|
declaration.initializer?.resolvedType?.let { it to declaration.source }
|
||||||
|
?: (declaration.getter?.body?.singleExpressionType to declaration.getter?.source)
|
||||||
|
}
|
||||||
|
is FirFunction -> declaration.body?.singleExpressionType to declaration.source
|
||||||
else -> error("Should not be there")
|
else -> error("Should not be there")
|
||||||
} ?: return
|
}
|
||||||
|
|
||||||
checkTypeAndArguments(type, context, reporter, declaration.source)
|
type?.let { checkTypeAndArguments(it, context, reporter, source) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkTypeAndArguments(
|
private fun checkTypeAndArguments(
|
||||||
|
|||||||
+2
-2
@@ -38,8 +38,8 @@ class Foo(val myTrait: MyTrait) {
|
|||||||
|
|
||||||
<!AMBIGUOUS_ANONYMOUS_TYPE_INFERRED!>public val publicProperty<!> = object : MyClass(), MyTrait {}
|
<!AMBIGUOUS_ANONYMOUS_TYPE_INFERRED!>public val publicProperty<!> = object : MyClass(), MyTrait {}
|
||||||
|
|
||||||
<!AMBIGUOUS_ANONYMOUS_TYPE_INFERRED!>val propertyWithGetter<!>
|
val propertyWithGetter
|
||||||
get() = object: MyClass(), MyTrait {}
|
<!AMBIGUOUS_ANONYMOUS_TYPE_INFERRED!>get()<!> = object: MyClass(), MyTrait {}
|
||||||
|
|
||||||
private val privateDelegateProperty by lazy { object : MyClass(), MyTrait {} }
|
private val privateDelegateProperty by lazy { object : MyClass(), MyTrait {} }
|
||||||
val publicDelegatePropertyWithSingleSuperType by lazy {
|
val publicDelegatePropertyWithSingleSuperType by lazy {
|
||||||
|
|||||||
Reference in New Issue
Block a user