diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index dc10d467331..9793c08c429 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -105,12 +105,12 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) { convert() private fun KtDeclaration.toFirDeclaration( - delegatedSuperType: FirTypeRef?, delegatedSelfType: FirTypeRef, owner: KtClassOrObject, hasPrimaryConstructor: Boolean + delegatedSuperType: FirTypeRef?, delegatedSelfType: FirTypeRef?, owner: KtClassOrObject, hasPrimaryConstructor: Boolean ): FirDeclaration { return when (this) { is KtSecondaryConstructor -> toFirConstructor( delegatedSuperType, - delegatedSelfType, + delegatedSelfType!!, owner, hasPrimaryConstructor ) @@ -322,7 +322,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) { } private fun KtClassOrObject.extractSuperTypeListEntriesTo( - container: FirModifiableClass, delegatedSelfTypeRef: FirTypeRef + container: FirModifiableClass, delegatedSelfTypeRef: FirTypeRef? ): FirTypeRef? { var superTypeCallEntry: KtSuperTypeCallEntry? = null var delegatedSuperTypeRef: FirTypeRef? = null @@ -365,7 +365,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) { val firPrimaryConstructor = primaryConstructor.toFirConstructor( superTypeCallEntry, delegatedSuperTypeRef, - delegatedSelfTypeRef, + delegatedSelfTypeRef ?: delegatedSuperTypeRef, owner = this ) container.declarations += firPrimaryConstructor @@ -450,12 +450,6 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) { ) } - @Deprecated("TODO, proper type") - private fun KtObjectDeclaration.toDelegatedSelfType(): FirTypeRef { - return FirUserTypeRefImpl(session, this, isMarkedNullable = false).apply { - qualifier.add(FirQualifierPartImpl(nameAsSafeName)) - } - } override fun visitEnumEntry(enumEntry: KtEnumEntry, data: Unit): FirElement { @@ -602,12 +596,12 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) { val objectDeclaration = expression.objectDeclaration return FirAnonymousObjectImpl(session, expression).apply { objectDeclaration.extractAnnotationsTo(this) - val delegatedSelfType = objectDeclaration.toDelegatedSelfType() - objectDeclaration.extractSuperTypeListEntriesTo(this, delegatedSelfType) + objectDeclaration.extractSuperTypeListEntriesTo(this, null) + this.typeRef = superTypeRefs.first() // TODO for (declaration in objectDeclaration.declarations) { declarations += declaration.toFirDeclaration( - delegatedSuperType = null, delegatedSelfType = delegatedSelfType, + delegatedSuperType = null, delegatedSelfType = null, owner = objectDeclaration, hasPrimaryConstructor = false ) } diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/locals.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/locals.txt index a3b321e780b..cba4b93c1e6 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/locals.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/locals.txt @@ -20,7 +20,7 @@ FILE: locals.kt } lval code: = object : Any { - private constructor(): { + private constructor(): Any { super() } diff --git a/compiler/fir/resolve/testData/resolve/expresssions/localImplicitBodies.txt b/compiler/fir/resolve/testData/resolve/expresssions/localImplicitBodies.txt index c7c34afe614..a9df799a27d 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/localImplicitBodies.txt +++ b/compiler/fir/resolve/testData/resolve/expresssions/localImplicitBodies.txt @@ -1,7 +1,7 @@ FILE: localImplicitBodies.kt public final fun foo(): R|kotlin/Unit| { - lval x: = object : R|kotlin/Any| { - private constructor(): R|class error: Symbol not found, for ``| { + lval x: R|kotlin/Any| = object : R|kotlin/Any| { + private constructor(): R|kotlin/Any| { super() }