Classified usages in "is" of when entry correctly.

#KT-7047 fixed
This commit is contained in:
Evgeny Gerashchenko
2015-03-19 22:09:06 +03:00
parent f7883fb1df
commit e752dd0a80
3 changed files with 8 additions and 3 deletions
@@ -103,7 +103,8 @@ public object UsageTypeUtils {
refExpr.getParentOfTypeAndBranch<JetParameter>(){ getTypeReference() } != null ->
VALUE_PARAMETER_TYPE
refExpr.getParentOfTypeAndBranch<JetIsExpression>(){ getTypeReference() } != null ->
refExpr.getParentOfTypeAndBranch<JetIsExpression>(){ getTypeReference() } != null
|| refExpr.getParentOfTypeAndBranch<JetWhenConditionIsPattern>(){ getTypeReference() } != null ->
IS
with(refExpr.getParentOfTypeAndBranch<JetBinaryExpressionWithTypeRHS>(){ getRight() }) {
@@ -38,5 +38,8 @@ fun Client.hasNextServer(): Boolean {
}
fun Any.asServer(): Server? {
when (this) {
is Server -> println("Server!")
}
return if (this is Server) this as Server else null
}
@@ -11,6 +11,7 @@ Super type qualifier (19: 15) super<Server>.work()
Supertype (23: 23) companion object: Server() {
Supertype (28: 22) object ClientObject: Server() {
Supertype (5: 43) class Client(name: String = Server.NAME): Server() {
Target type of 'is' operation (41: 24) return if (this is Server) this as Server else null
Usage in cast target type (41: 40) return if (this is Server) this as Server else null
Target type of 'is' operation (42: 12) is Server -> println("Server!")
Target type of 'is' operation (44: 24) return if (this is Server) this as Server else null
Usage in cast target type (44: 40) return if (this is Server) this as Server else null
Usage in import (3: 15) import server.Server