Report unmet trait requirements
#KT-3006 Fixed
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
trait SimpleClass : java.lang.Object {
|
||||
fun foo() : String = "239 " + toString ()
|
||||
trait Trait : java.lang.Object {
|
||||
fun foo(): String = "239 " + toString()
|
||||
}
|
||||
|
||||
class SimpleClassImpl() : SimpleClass {
|
||||
override fun toString() = "SimpleClassImpl"
|
||||
class Impl : Trait, java.lang.Object() {
|
||||
override fun toString() = "Impl"
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val c = SimpleClassImpl()
|
||||
return if("239 SimpleClassImpl" == c.foo()) "OK" else "fail"
|
||||
fun box(): String {
|
||||
return if ("239 Impl" == Impl().foo()) "OK" else "Fail"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
open class Required
|
||||
|
||||
trait Trait : Required
|
||||
|
||||
abstract class <!UNMET_TRAIT_REQUIREMENT!>Abstract<!> : Trait
|
||||
|
||||
abstract class <!UNMET_TRAIT_REQUIREMENT!>AbstractDerived<!> : Abstract()
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
open class Required
|
||||
|
||||
trait A : Required
|
||||
|
||||
val a = <!UNMET_TRAIT_REQUIREMENT!>object<!> : A {}
|
||||
val b: A = object : A, Required() {}
|
||||
@@ -0,0 +1,8 @@
|
||||
open class Generic<T>
|
||||
|
||||
trait A : Generic<Int>
|
||||
|
||||
trait B : Generic<String>
|
||||
|
||||
class <!UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT!>Y<!> : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>A, B<!>
|
||||
class Z : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>A, B, Generic<Int>()<!>
|
||||
@@ -0,0 +1,13 @@
|
||||
open class Base {
|
||||
}
|
||||
|
||||
trait Derived: Base {
|
||||
fun foo() {
|
||||
f1(this@Derived)
|
||||
}
|
||||
}
|
||||
|
||||
class <!UNMET_TRAIT_REQUIREMENT!>DerivedImpl()<!>: Derived {}
|
||||
object <!UNMET_TRAIT_REQUIREMENT!>ObjectImpl<!>: Derived {}
|
||||
|
||||
fun f1(b: Base) = b
|
||||
@@ -0,0 +1,4 @@
|
||||
open class A
|
||||
open class B
|
||||
|
||||
trait C : A, <!MANY_CLASSES_IN_SUPERTYPE_LIST!>B<!>
|
||||
@@ -0,0 +1,14 @@
|
||||
open class Required
|
||||
|
||||
trait A : Required
|
||||
|
||||
trait B : A, Required
|
||||
|
||||
trait C : Required
|
||||
|
||||
trait D : B, Required
|
||||
|
||||
class <!UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT!>W<!> : D
|
||||
class X : D, Required()
|
||||
class <!UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT, UNMET_TRAIT_REQUIREMENT!>Y<!> : C, D
|
||||
class Z : D, C, Required()
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
open class RequiredBase
|
||||
|
||||
trait Trait : RequiredBase
|
||||
|
||||
open class RequiredDerived : RequiredBase()
|
||||
|
||||
class <!UNMET_TRAIT_REQUIREMENT!>A<!> : Trait
|
||||
class B : Trait, RequiredDerived()
|
||||
@@ -0,0 +1,8 @@
|
||||
open class Required(val value: String)
|
||||
|
||||
trait First : Required
|
||||
|
||||
trait Second : First
|
||||
|
||||
class <!UNMET_TRAIT_REQUIREMENT!>Y<!> : Second
|
||||
class Z : Second, Required(":o)")
|
||||
@@ -0,0 +1,5 @@
|
||||
trait AnyTrait : Any
|
||||
|
||||
class Foo : AnyTrait
|
||||
|
||||
class Bar : AnyTrait, Any()
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
open class Generic<T>
|
||||
|
||||
trait A : Generic<String>
|
||||
|
||||
trait B : Generic<Int>
|
||||
|
||||
trait C : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>A, B<!>
|
||||
Reference in New Issue
Block a user