ReplaceWith now functions correctly in built-ins #KT-9351 Fixed

This commit is contained in:
Mikhail Glukhikh
2015-09-28 15:35:19 +03:00
parent ee1175d5e5
commit 3ad628522a
3 changed files with 10 additions and 2 deletions
@@ -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
}
+1
View File
@@ -20,6 +20,7 @@ fun foo() {
val xx = valX
varX = 50
varY = 60
1.identityEquals(2)
}
fun unnecessarySafeCall(x: String) {
+1
View File
@@ -19,6 +19,7 @@ fun foo() {
val xx = valX
varX = 50
varY = 60
1 === 2
}
fun unnecessarySafeCall(x: String) {