ReplaceWith now functions correctly in built-ins #KT-9351 Fixed
This commit is contained in:
+8
-2
@@ -222,8 +222,14 @@ object ReplaceWithAnnotationAnalyzer {
|
|||||||
resolutionFacade: ResolutionFacade
|
resolutionFacade: ResolutionFacade
|
||||||
): BindingContext {
|
): BindingContext {
|
||||||
val traceContext = BindingTraceContext()
|
val traceContext = BindingTraceContext()
|
||||||
resolutionFacade.getFrontendService(module, ExpressionTypingServices::class.java)
|
val frontendService = if (module.builtIns.builtInsModule == module) {
|
||||||
.getTypeInfo(scope, expression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, traceContext, false)
|
// TODO: doubtful place, do we require this module or not? Built-ins module doesn't have some necessary components...
|
||||||
|
resolutionFacade.getFrontendService(ExpressionTypingServices::class.java)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolutionFacade.getFrontendService(module, ExpressionTypingServices::class.java)
|
||||||
|
}
|
||||||
|
frontendService.getTypeInfo(scope, expression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, traceContext, false)
|
||||||
return traceContext.bindingContext
|
return traceContext.bindingContext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ fun foo() {
|
|||||||
val xx = valX
|
val xx = valX
|
||||||
varX = 50
|
varX = 50
|
||||||
varY = 60
|
varY = 60
|
||||||
|
1.identityEquals(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unnecessarySafeCall(x: String) {
|
fun unnecessarySafeCall(x: String) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ fun foo() {
|
|||||||
val xx = valX
|
val xx = valX
|
||||||
varX = 50
|
varX = 50
|
||||||
varY = 60
|
varY = 60
|
||||||
|
1 === 2
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unnecessarySafeCall(x: String) {
|
fun unnecessarySafeCall(x: String) {
|
||||||
|
|||||||
Reference in New Issue
Block a user