-
Notifications
You must be signed in to change notification settings - Fork 5
Release: v2.2.20-0.13.1 #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e8715b2
bd19577
55eed6f
ebad6bf
19b8740
3ae9499
17ec6dd
71a1589
0c53db8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Kotlin version: `v2.2.20` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Kotlin version: `v2.2.20-Beta1` |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -165,7 +165,7 @@ class SuspendTransformFirTransformer( | |||||||||||||
} | ||||||||||||||
|
||||||||||||||
private val cache: FirCache<FirCacheKey, Map<Name, Map<FirNamedFunctionSymbol, SyntheticFunData>>?, Nothing?> = | ||||||||||||||
session.firCachesFactory.createCache { cacheKey, c -> | ||||||||||||||
session.firCachesFactory.createCache { cacheKey, _ -> | ||||||||||||||
val (symbol, scope) = cacheKey | ||||||||||||||
initScopeSymbol() | ||||||||||||||
val transformerFunctionMap = initTransformerFunctionSymbolMap(symbol, scope) | ||||||||||||||
|
@@ -212,7 +212,7 @@ class SuspendTransformFirTransformer( | |||||||||||||
): List<FirValueParameter> { | ||||||||||||||
return map { vp -> | ||||||||||||||
buildValueParameterCopy(vp) { | ||||||||||||||
symbol = FirValueParameterSymbol(vp.symbol.name) | ||||||||||||||
symbol = FirValueParameterSymbol() | ||||||||||||||
containingDeclarationSymbol = newContainingDeclarationSymbol | ||||||||||||||
|
||||||||||||||
val copiedConeType = vp.returnTypeRef.coneTypeOrNull | ||||||||||||||
|
@@ -348,11 +348,11 @@ class SuspendTransformFirTransformer( | |||||||||||||
newFunTarget: FirFunctionTarget, | ||||||||||||||
transformer: Transformer | ||||||||||||||
): FirBlock = buildBlock { | ||||||||||||||
this.source = originFunc.body?.source | ||||||||||||||
|
||||||||||||||
this.source = originFunSymbol.bodySource ?: originFunSymbol.source | ||||||||||||||
// lambda: suspend () -> T | ||||||||||||||
val lambdaTarget = FirFunctionTarget(null, isLambda = true) | ||||||||||||||
val lambda = buildAnonymousFunction { | ||||||||||||||
this.source = originFunSymbol.bodySource ?: originFunSymbol.source | ||||||||||||||
this.resolvePhase = FirResolvePhase.BODY_RESOLVE | ||||||||||||||
// this.resolvePhase = FirResolvePhase.RAW_FIR | ||||||||||||||
this.isLambda = true | ||||||||||||||
|
@@ -701,7 +701,7 @@ class SuspendTransformFirTransformer( | |||||||||||||
val (functionAnnotations, propertyAnnotations, includeToOriginal) = | ||||||||||||||
copyAnnotations(original, funData) | ||||||||||||||
|
||||||||||||||
val pSymbol = FirPropertySymbol(callableId) | ||||||||||||||
val pSymbol = FirRegularPropertySymbol(callableId) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed from FirPropertySymbol to FirRegularPropertySymbol. Ensure this change is compatible with the property generation requirements and doesn't break synthetic property creation.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||
|
||||||||||||||
// val pKey = SuspendTransformPluginKey( | ||||||||||||||
// data = SuspendTransformUserDataFir( | ||||||||||||||
|
@@ -754,7 +754,6 @@ class SuspendTransformFirTransformer( | |||||||||||||
) | ||||||||||||||
|
||||||||||||||
isVar = false | ||||||||||||||
isLocal = false | ||||||||||||||
// Copy return type | ||||||||||||||
returnTypeRef = resolvedReturnType | ||||||||||||||
deprecationsProvider = UnresolvedDeprecationProvider //original.deprecationsProvider | ||||||||||||||
|
@@ -837,51 +836,50 @@ class SuspendTransformFirTransformer( | |||||||||||||
val markAnnotation = syntheticFunData.transformer.markAnnotation | ||||||||||||||
|
||||||||||||||
if (func.isOverride && !isOverride) { | ||||||||||||||
// func.processOverriddenFunctionsSafe() | ||||||||||||||
func.processOverriddenFunctionsSafe( | ||||||||||||||
checkContext | ||||||||||||||
) processOverridden@{ overriddenFunction -> | ||||||||||||||
if (!isOverride) { | ||||||||||||||
// check parameters and receivers | ||||||||||||||
val resolvedReceiverTypeRef = overriddenFunction.resolvedReceiverTypeRef | ||||||||||||||
val originReceiverTypeRef = func.resolvedReceiverTypeRef | ||||||||||||||
|
||||||||||||||
// origin receiver should be the same as symbol receiver | ||||||||||||||
if (originReceiverTypeRef != resolvedReceiverTypeRef) { | ||||||||||||||
return@processOverridden | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
// all value parameters should be a subtype of symbol's value parameters | ||||||||||||||
val symbolParameterSymbols = overriddenFunction.valueParameterSymbols | ||||||||||||||
val originParameterSymbols = func.valueParameterSymbols | ||||||||||||||
with(checkContext) { | ||||||||||||||
func.processOverriddenFunctionsSafe processOverridden@{ overriddenFunction -> | ||||||||||||||
Comment on lines
+839
to
+840
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The massive simplification of the override checking logic removes important validation steps. The original code verified receiver types, parameter counts, and parameter types before determining override status. This simplified version may incorrectly mark functions as overrides. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||
if (!isOverride) { | ||||||||||||||
// check parameters and receivers | ||||||||||||||
val resolvedReceiverTypeRef = overriddenFunction.resolvedReceiverTypeRef | ||||||||||||||
val originReceiverTypeRef = func.resolvedReceiverTypeRef | ||||||||||||||
|
||||||||||||||
// origin receiver should be the same as symbol receiver | ||||||||||||||
if (originReceiverTypeRef != resolvedReceiverTypeRef) { | ||||||||||||||
return@processOverridden | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
if (symbolParameterSymbols.size != originParameterSymbols.size) { | ||||||||||||||
return@processOverridden | ||||||||||||||
} | ||||||||||||||
// all value parameters should be a subtype of symbol's value parameters | ||||||||||||||
val symbolParameterSymbols = overriddenFunction.valueParameterSymbols | ||||||||||||||
val originParameterSymbols = func.valueParameterSymbols | ||||||||||||||
|
||||||||||||||
for ((index, symbolParameter) in symbolParameterSymbols.withIndex()) { | ||||||||||||||
val originParameter = originParameterSymbols[index] | ||||||||||||||
if ( | ||||||||||||||
originParameter.resolvedReturnType != symbolParameter.resolvedReturnType | ||||||||||||||
) { | ||||||||||||||
if (symbolParameterSymbols.size != originParameterSymbols.size) { | ||||||||||||||
return@processOverridden | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
val overriddenAnnotation = firAnnotation( | ||||||||||||||
overriddenFunction, markAnnotation, overriddenFunction.getContainingClassSymbol() | ||||||||||||||
) ?: return@processOverridden | ||||||||||||||
for ((index, symbolParameter) in symbolParameterSymbols.withIndex()) { | ||||||||||||||
val originParameter = originParameterSymbols[index] | ||||||||||||||
if ( | ||||||||||||||
originParameter.resolvedReturnType != symbolParameter.resolvedReturnType | ||||||||||||||
) { | ||||||||||||||
return@processOverridden | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
val overriddenAnnotation = firAnnotation( | ||||||||||||||
overriddenFunction, markAnnotation, overriddenFunction.getContainingClassSymbol() | ||||||||||||||
) ?: return@processOverridden | ||||||||||||||
|
||||||||||||||
val overriddenAnnoData = overriddenAnnotation.toTransformAnnotationData( | ||||||||||||||
markAnnotation, overriddenFunction.name.asString() | ||||||||||||||
) | ||||||||||||||
val overriddenAnnoData = overriddenAnnotation.toTransformAnnotationData( | ||||||||||||||
markAnnotation, overriddenFunction.name.asString() | ||||||||||||||
) | ||||||||||||||
|
||||||||||||||
// Same functionName, same asProperty, the generated synthetic function will be same too. | ||||||||||||||
if ( | ||||||||||||||
overriddenAnnoData.functionName == annoData.functionName | ||||||||||||||
&& overriddenAnnoData.asProperty == annoData.asProperty | ||||||||||||||
) { | ||||||||||||||
isOverride = true | ||||||||||||||
// Same functionName, same asProperty, the generated synthetic function will be same too. | ||||||||||||||
if ( | ||||||||||||||
overriddenAnnoData.functionName == annoData.functionName | ||||||||||||||
&& overriddenAnnoData.asProperty == annoData.asProperty | ||||||||||||||
) { | ||||||||||||||
isOverride = true | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
@@ -1220,7 +1218,7 @@ class SuspendTransformFirTransformer( | |||||||||||||
// it.declarationSymbols.filterIsInstance<FirPropertySymbol>() | ||||||||||||||
} | ||||||||||||||
.filter { !it.isFinal } | ||||||||||||||
.filter { it.callableId.callableName == functionName } | ||||||||||||||
.filter { it.callableId?.callableName == functionName } | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added null-safe operator
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||
// overridable receiver parameter. | ||||||||||||||
.filter { | ||||||||||||||
thisReceiverTypeRef sameAs it.resolvedReceiverTypeRef | ||||||||||||||
|
@@ -1349,16 +1347,20 @@ class SuspendTransformFirTransformer( | |||||||||||||
} | ||||||||||||||
|
||||||||||||||
is ConeCapturedType -> { | ||||||||||||||
// val lowerType = projection.lowerType?.let { lowerType -> | ||||||||||||||
// findCopied(lowerType) | ||||||||||||||
// }?.toConeType() | ||||||||||||||
|
||||||||||||||
val lowerType = projection.lowerType?.copyWithTypeParameters(parameters) | ||||||||||||||
val constructorLowerType = projection.constructor.lowerType?.copyWithTypeParameters(parameters) | ||||||||||||||
|
||||||||||||||
if (lowerType == null) { | ||||||||||||||
projection.copy(lowerType = lowerType) | ||||||||||||||
} else { | ||||||||||||||
if (constructorLowerType == null) { | ||||||||||||||
null | ||||||||||||||
} else { | ||||||||||||||
projection.copy( | ||||||||||||||
constructor = ConeCapturedTypeConstructor( | ||||||||||||||
projection = projection.constructor.projection, | ||||||||||||||
lowerType = constructorLowerType, | ||||||||||||||
captureStatus = projection.constructor.captureStatus, | ||||||||||||||
supertypes = projection.constructor.supertypes, | ||||||||||||||
typeParameterMarker = projection.constructor.typeParameterMarker, | ||||||||||||||
) | ||||||||||||||
) | ||||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version": "2.2.10-0.13.1"} | ||
{"version": "2.2.20-0.13.1"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the name parameter from FirValueParameterSymbol() constructor may cause issues with parameter identification. The original code
FirValueParameterSymbol(vp.symbol.name)
preserved parameter naming which could be important for debugging and reflection.Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?