"casted" -> "cast"
This commit is contained in:
+14
-14
@@ -122,8 +122,8 @@ class PartialBodyResolveFilter(
|
||||
map.getOrPut(name, { ArrayList(places.size) }).addAll(places)
|
||||
}
|
||||
|
||||
fun addIfCanBeSmartCasted(expression: JetExpression) {
|
||||
val name = expression.smartCastedExpressionName() ?: return
|
||||
fun addIfCanBeSmartCast(expression: JetExpression) {
|
||||
val name = expression.smartCastExpressionName() ?: return
|
||||
if (filter(name)) {
|
||||
addPlace(name, expression)
|
||||
}
|
||||
@@ -134,7 +134,7 @@ class PartialBodyResolveFilter(
|
||||
expression.acceptChildren(this)
|
||||
|
||||
if (expression.getOperationToken() == JetTokens.EXCLEXCL) {
|
||||
addIfCanBeSmartCasted(expression.getBaseExpression())
|
||||
addIfCanBeSmartCast(expression.getBaseExpression())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class PartialBodyResolveFilter(
|
||||
expression.acceptChildren(this)
|
||||
|
||||
if (expression.getOperationReference()?.getReferencedNameElementType() == JetTokens.AS_KEYWORD) {
|
||||
addIfCanBeSmartCasted(expression.getLeft())
|
||||
addIfCanBeSmartCast(expression.getLeft())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,11 +151,11 @@ class PartialBodyResolveFilter(
|
||||
val thenBranch = expression.getThen()
|
||||
val elseBranch = expression.getElse()
|
||||
|
||||
val smartCastedNames = collectPossiblySmartCastedInCondition(condition).filter(filter)
|
||||
if (smartCastedNames.isNotEmpty()) {
|
||||
val smartCastNames = collectPossiblySmartCastInCondition(condition).filter(filter)
|
||||
if (smartCastNames.isNotEmpty()) {
|
||||
val exits = collectAlwaysExitPoints(thenBranch) + collectAlwaysExitPoints(elseBranch)
|
||||
if (exits.isNotEmpty()) {
|
||||
for (name in smartCastedNames) {
|
||||
for (name in smartCastNames) {
|
||||
addPlaces(name, exits)
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ class PartialBodyResolveFilter(
|
||||
return map
|
||||
}
|
||||
|
||||
private fun collectPossiblySmartCastedInCondition(condition: JetExpression?): Set<String> {
|
||||
private fun collectPossiblySmartCastInCondition(condition: JetExpression?): Set<String> {
|
||||
val result = HashSet<String>()
|
||||
condition?.accept(object : ControlFlowVisitor() {
|
||||
override fun visitBinaryExpression(expression: JetBinaryExpression) {
|
||||
@@ -212,15 +212,15 @@ class PartialBodyResolveFilter(
|
||||
|
||||
val operation = expression.getOperationToken()
|
||||
if (operation == JetTokens.EQEQ || operation == JetTokens.EXCLEQ) {
|
||||
result.addIfNotNull(expression.getLeft()?.smartCastedExpressionName())
|
||||
result.addIfNotNull(expression.getRight()?.smartCastedExpressionName())
|
||||
result.addIfNotNull(expression.getLeft()?.smartCastExpressionName())
|
||||
result.addIfNotNull(expression.getRight()?.smartCastExpressionName())
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitIsExpression(expression: JetIsExpression) {
|
||||
expression.acceptChildren(this)
|
||||
|
||||
result.addIfNotNull(expression.getLeftHandSide()?.smartCastedExpressionName())
|
||||
result.addIfNotNull(expression.getLeftHandSide()?.smartCastExpressionName())
|
||||
}
|
||||
})
|
||||
return result
|
||||
@@ -342,15 +342,15 @@ class PartialBodyResolveFilter(
|
||||
|
||||
private fun PsiElement.isStatement() = this is JetExpression && getParent() is JetBlockExpression
|
||||
|
||||
private fun JetExpression.smartCastedExpressionName(): String? {
|
||||
private fun JetExpression.smartCastExpressionName(): String? {
|
||||
return when (this) {
|
||||
is JetSimpleNameExpression -> this.getReferencedName()
|
||||
|
||||
is JetQualifiedExpression -> {
|
||||
val selectorName = getSelectorExpression().smartCastedExpressionName() ?: return null
|
||||
val selectorName = getSelectorExpression().smartCastExpressionName() ?: return null
|
||||
val receiver = getReceiverExpression()
|
||||
if (receiver is JetThisExpression) return selectorName
|
||||
val receiverName = receiver.smartCastedExpressionName() ?: return null
|
||||
val receiverName = receiver.smartCastExpressionName() ?: return null
|
||||
return selectorName + "." + receiverName
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
y(p as? Int)
|
||||
z(f() as String)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Resolve target: value-parameter val p: kotlin.String? smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.String? smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
y(f()!!)
|
||||
p1!!
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Resolve target: value-parameter val p: kotlin.Boolean? smart-casted to kotlin.Boolean
|
||||
Resolve target: value-parameter val p: kotlin.Boolean? smart-cast to kotlin.Boolean
|
||||
Skipped statements:
|
||||
print(p1!!.hashCode())
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
print(p1!!)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Resolve target: value-parameter val p1: kotlin.Any? smart-casted to kotlin.Any
|
||||
Resolve target: value-parameter val p1: kotlin.Any? smart-cast to kotlin.Any
|
||||
Skipped statements:
|
||||
print(p!!)
|
||||
print(p2!!)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: value-parameter val o: kotlin.Any? smart-casted to kotlin.Any
|
||||
Resolve target: value-parameter val o: kotlin.Any? smart-cast to kotlin.Any
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: value-parameter val o: kotlin.String? smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val o: kotlin.String? smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
print("null")
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: val v: kotlin.Any smart-casted to kotlin.String
|
||||
Resolve target: val v: kotlin.Any smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.Any smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.Any
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-cast to kotlin.Any
|
||||
Skipped statements:
|
||||
print("not null")
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: val x: kotlin.Any? smart-casted to kotlin.Any
|
||||
Resolve target: val x: kotlin.Any? smart-cast to kotlin.Any
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: val x: kotlin.Any? smart-casted to kotlin.Any
|
||||
Resolve target: val x: kotlin.Any? smart-cast to kotlin.Any
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.Any
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-cast to kotlin.Any
|
||||
Skipped statements:
|
||||
print("null")
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: value-parameter val p: kotlin.String? smart-casted to kotlin.String
|
||||
Resolve target: value-parameter val p: kotlin.String? smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Resolve target: val s: kotlin.String? smart-casted to kotlin.String
|
||||
Resolve target: val s: kotlin.String? smart-cast to kotlin.String
|
||||
Skipped statements:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-casted to kotlin.Any
|
||||
Resolve target: value-parameter val p: kotlin.Any? smart-cast to kotlin.Any
|
||||
Skipped statements:
|
||||
print(p1!!)
|
||||
|
||||
@@ -109,7 +109,7 @@ public abstract class AbstractPartialBodyResolveTest : JetLightCodeInsightFixtur
|
||||
|
||||
val renderType = this is VariableDescriptor && type != this.getReturnType()
|
||||
if (!renderType) return s
|
||||
return s + " smart-casted to " + if (type != null) DescriptorRenderer.COMPACT.renderType(type) else "unknown type"
|
||||
return s + " smart-cast to " + if (type != null) DescriptorRenderer.COMPACT.renderType(type) else "unknown type"
|
||||
}
|
||||
|
||||
private fun JetExpression.presentation(): String {
|
||||
|
||||
Reference in New Issue
Block a user