[FIR] PsiRawFirBuilder: reuse type for copy from generated property
Previously, this call was required to avoid sharing to have independent instances with their own resolution cycle. Now we will have stable order (in the next commit), so it is possible to share instances. Also, this change makes the logic consistency with Light Tree ^KT-63042
This commit is contained in:
committed by
Space Team
parent
a79cef08b5
commit
6c1f5b7a74
+1
-19
@@ -1494,25 +1494,7 @@ open class PsiRawFirBuilder(
|
||||
context.className,
|
||||
createClassTypeRefWithSourceKind = { firPrimaryConstructor.returnTypeRef.copyWithNewSourceKind(it) },
|
||||
createParameterTypeRefWithSourceKind = { property, newKind ->
|
||||
// just making a shallow copy isn't enough type ref may be a function type ref
|
||||
// and contain value parameters inside
|
||||
|
||||
val returnTypeRef = property.returnTypeRef
|
||||
|
||||
when (returnTypeRef) {
|
||||
is FirErrorTypeRef -> {
|
||||
buildErrorTypeRefCopy(returnTypeRef) {
|
||||
source = returnTypeRef.source?.fakeElement(newKind)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
withDefaultSourceElementKind(newKind) {
|
||||
(returnTypeRef.psi as KtTypeReference?).toFirOrImplicitType()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
property.returnTypeRef.copyWithNewSourceKind(newKind)
|
||||
},
|
||||
addValueParameterAnnotations = { addAnnotationsFrom(it as KtParameter, isFromPrimaryConstructor = true) },
|
||||
).generate()
|
||||
|
||||
Reference in New Issue
Block a user