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
|
||||
): BindingContext {
|
||||
val traceContext = BindingTraceContext()
|
||||
resolutionFacade.getFrontendService(module, ExpressionTypingServices::class.java)
|
||||
.getTypeInfo(scope, expression, TypeUtils.NO_EXPECTED_TYPE, DataFlowInfo.EMPTY, traceContext, false)
|
||||
val frontendService = if (module.builtIns.builtInsModule == module) {
|
||||
// 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
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ fun foo() {
|
||||
val xx = valX
|
||||
varX = 50
|
||||
varY = 60
|
||||
1.identityEquals(2)
|
||||
}
|
||||
|
||||
fun unnecessarySafeCall(x: String) {
|
||||
|
||||
@@ -19,6 +19,7 @@ fun foo() {
|
||||
val xx = valX
|
||||
varX = 50
|
||||
varY = 60
|
||||
1 === 2
|
||||
}
|
||||
|
||||
fun unnecessarySafeCall(x: String) {
|
||||
|
||||
Reference in New Issue
Block a user