[FIR] Add diagnostic UPPER_BOUND_VIOLATED

This commit is contained in:
Nick
2020-07-09 13:46:16 +03:00
committed by Mikhail Glukhikh
parent b9a220c624
commit 41a0cfe002
17 changed files with 361 additions and 34 deletions
+7 -7
View File
@@ -7,13 +7,13 @@ package boundsWithSubstitutors
class C : A<C>()
val a = B<C>()
val a1 = B<Int>()
val a1 = B<<!UPPER_BOUND_VIOLATED!>Int<!>>()
class X<A, B : A>()
val b = X<Any, X<A<C>, C>>()
val b0 = X<Any, Any?>()
val b1 = X<Any, X<A<C>, String>>()
val b0 = X<Any, <!UPPER_BOUND_VIOLATED!>Any?<!>>()
val b1 = X<Any, <!UPPER_BOUND_VIOLATED!>X<A<C>, String><!>>()
// FILE: b.kt
open class A {}
@@ -22,19 +22,19 @@ package boundsWithSubstitutors
class Pair<A, B>
abstract class C<T : B<Int>, X : (B<Char>) -> Pair<B<Any>, B<A>>>() : B<Any>() { // 2 errors
val a = B<Char>() // error
val a = B<<!UPPER_BOUND_VIOLATED!>Char<!>>() // error
abstract val x : (B<Char>) -> B<Any>
}
fun test() {
foo<Int?>()
foo<<!UPPER_BOUND_VIOLATED!>Int?<!>>()
foo<Int>()
bar<Int?>()
bar<Int>()
bar<Double?>()
bar<Double>()
bar<<!UPPER_BOUND_VIOLATED!>Double?<!>>()
bar<<!UPPER_BOUND_VIOLATED!>Double<!>>()
1.<!INAPPLICABLE_CANDIDATE!>buzz<!><Double>()
}