Classified usages as type parameters correctly.
#KT-7047 fixed
This commit is contained in:
@@ -64,6 +64,8 @@ public object UsageTypeUtils {
|
||||
}
|
||||
|
||||
fun getClassUsageType(): UsageTypeEnum? {
|
||||
if (refExpr.getNonStrictParentOfType<JetTypeProjection>() != null) return TYPE_PARAMETER
|
||||
|
||||
val property = refExpr.getNonStrictParentOfType<JetProperty>()
|
||||
if (property != null) {
|
||||
when {
|
||||
@@ -97,9 +99,6 @@ public object UsageTypeUtils {
|
||||
refExpr.getParentOfTypeAndBranch<JetTypedef>(){ getTypeReference() } != null ->
|
||||
TYPE_DEFINITION
|
||||
|
||||
refExpr.getNonStrictParentOfType<JetTypeProjection>() != null ->
|
||||
TYPE_PARAMETER
|
||||
|
||||
refExpr.getParentOfTypeAndBranch<JetParameter>(){ getTypeReference() } != null ->
|
||||
VALUE_PARAMETER_TYPE
|
||||
|
||||
|
||||
@@ -29,6 +29,12 @@ object ClientObject: Server() {
|
||||
|
||||
}
|
||||
|
||||
class Servers: Iterator<Server> {
|
||||
|
||||
}
|
||||
|
||||
fun Iterator<Server>.f(p: Iterator<Server>): Iterator<Server> = this
|
||||
|
||||
fun Client.bar(s: Server = Server.NAME) {
|
||||
foo(s)
|
||||
}
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
Class/object property type (6: 21) var nextServer: Server? = new Server()
|
||||
Companion object (32: 28) fun Client.bar(s: Server = Server.NAME) {
|
||||
Companion object (38: 28) fun Client.bar(s: Server = Server.NAME) {
|
||||
Companion object (5: 29) class Client(name: String = Server.NAME): Server() {
|
||||
Companion object (7: 16) val name = Server.NAME
|
||||
Function return types (14: 26) fun getNextServer(): Server? {
|
||||
Function return types (40: 21) fun Any.asServer(): Server? {
|
||||
Function return types (46: 21) fun Any.asServer(): Server? {
|
||||
Local variable declaration (10: 21) val server: Server = s
|
||||
Parameter type (32: 19) fun Client.bar(s: Server = Server.NAME) {
|
||||
Parameter type (38: 19) fun Client.bar(s: Server = Server.NAME) {
|
||||
Parameter type (9: 16) fun foo(s: Server) {
|
||||
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 (42: 12) is Server -> println("Server!")
|
||||
Target type of 'is' operation (44: 24) return if (this is Server) this: Server else this as? Server
|
||||
Usage in cast target type (44: 38) return if (this is Server) this: Server else this as? Server
|
||||
Usage in cast target type (44: 59) return if (this is Server) this: Server else this as? Server
|
||||
Target type of 'is' operation (48: 12) is Server -> println("Server!")
|
||||
Target type of 'is' operation (50: 24) return if (this is Server) this: Server else this as? Server
|
||||
Type parameter (32: 25) class Servers: Iterator<Server> {
|
||||
Type parameter (36: 14) fun Iterator<Server>.f(p: Iterator<Server>): Iterator<Server> = this
|
||||
Type parameter (36: 36) fun Iterator<Server>.f(p: Iterator<Server>): Iterator<Server> = this
|
||||
Type parameter (36: 55) fun Iterator<Server>.f(p: Iterator<Server>): Iterator<Server> = this
|
||||
Usage in cast target type (50: 38) return if (this is Server) this: Server else this as? Server
|
||||
Usage in cast target type (50: 59) return if (this is Server) this: Server else this as? Server
|
||||
Usage in import (3: 15) import server.Server
|
||||
|
||||
Reference in New Issue
Block a user