Smart completion: inheritors instantiation suggested + fixed a bug with incorrect presentation of generic java class instantiation

This commit is contained in:
Valentin Kipyatkov
2014-11-26 17:58:18 +03:00
parent 07f7a35bc9
commit 820c2c7cd8
33 changed files with 396 additions and 36 deletions
@@ -0,0 +1,15 @@
import p.*
fun foo(): KotlinTrait<I1, I2> {
return <caret>
}
// EXIST: { lookupString: "object", itemText: "object: KotlinTrait<I1, I2>{...}" }
// EXIST: { lookupString: "KotlinInheritor1", itemText: "KotlinInheritor1<I1>", tailText: "() (p)" }
// EXIST: { lookupString: "KotlinInheritor2", itemText: "KotlinInheritor2", tailText: "() (p)" }
// ABSENT: KotlinInheritor3
// EXIST: { lookupString: "object", itemText: "object: KotlinInheritor4<I1, I2>(){...}" }
// ABSENT: KotlinInheritor5
// EXIST: { lookupString: "KotlinInheritor6", itemText: "KotlinInheritor6<I1, out Any?, out I3>", tailText: "() (p)" }
// EXIST: { lookupString: "JavaInheritor1", itemText: "JavaInheritor1", tailText: "() (<root>)" }
// ABSENT: JavaInheritor2
@@ -0,0 +1,6 @@
import p.*
class JavaInheritor1 implements KotlinTrait<I1, I2>{}
// is not suitable because type arguments do not match
class JavaInheritor2 implements KotlinTrait<I1, I3>{}
@@ -0,0 +1,23 @@
package p
trait I1
trait I2
trait I3
trait KotlinTrait<T1, T2>
open class KotlinInheritor1<T> : KotlinTrait<T, I2>
class KotlinInheritor2 : KotlinInheritor1<I1>()
// is not suitable because type arguments do not match
class KotlinInheritor3 : KotlinInheritor1<Any>()
abstract class KotlinInheritor4<T, V> : KotlinTrait<T, V>
// is not suitable because type arguments do not match
class KotlinInheritor5 : KotlinTrait<Char, I2>
class KotlinInheritor6<T1, T2, T3 : I3> : KotlinTrait<T1, I2>
// ALLOW_AST_ACCESS