[Test] Disable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite
This commit is contained in:
committed by
TeamCityServer
parent
85949b387e
commit
cd890d5833
@@ -1,9 +0,0 @@
|
||||
class Item(val name: String, val rating: Int): Comparable<Item> {
|
||||
public override fun compareTo(other: Item): Int {
|
||||
return compareBy(this, other, { rating }, { name })
|
||||
}
|
||||
}
|
||||
|
||||
// from standard library
|
||||
fun <T : Any> compareBy(a: T?, b: T?,
|
||||
vararg functions: T.() -> Comparable<*>?): Int = throw Exception()
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class Item(val name: String, val rating: Int): Comparable<Item> {
|
||||
public override fun compareTo(other: Item): Int {
|
||||
return compareBy(this, other, { rating }, { name })
|
||||
@@ -5,5 +6,5 @@ class Item(val name: String, val rating: Int): Comparable<Item> {
|
||||
}
|
||||
|
||||
// from standard library
|
||||
fun <T : Any> compareBy(<!UNUSED_PARAMETER!>a<!>: T?, <!UNUSED_PARAMETER!>b<!>: T?,
|
||||
vararg <!UNUSED_PARAMETER!>functions<!>: T.() -> Comparable<*>?): Int = throw Exception()
|
||||
fun <T : Any> compareBy(a: T?, b: T?,
|
||||
vararg functions: T.() -> Comparable<*>?): Int = throw Exception()
|
||||
|
||||
@@ -5,10 +5,10 @@ package i
|
||||
|
||||
import checkSubtype
|
||||
|
||||
public fun<T> from(<!UNUSED_PARAMETER!>yielder<!>: ()->Iterable<T>) : Iterable<T> {
|
||||
public fun<T> from(yielder: ()->Iterable<T>) : Iterable<T> {
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
public infix fun<T> Iterable<T>.where(<!UNUSED_PARAMETER!>predicate<!> : (T)->Boolean) : ()->Iterable<T> {
|
||||
public infix fun<T> Iterable<T>.where(predicate : (T)->Boolean) : ()->Iterable<T> {
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
fun a() {
|
||||
|
||||
@@ -6,10 +6,10 @@ package i
|
||||
import java.util.ArrayList
|
||||
import checkSubtype
|
||||
|
||||
public infix fun<TItem> Iterable<TItem>.where(<!UNUSED_PARAMETER!>predicate<!> : (TItem)->Boolean) : ()->Iterable<TItem> {
|
||||
public infix fun<TItem> Iterable<TItem>.where(predicate : (TItem)->Boolean) : ()->Iterable<TItem> {
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
public fun<TItem, TResult> select(<!UNUSED_PARAMETER!>yielder<!>: ()->Iterable<TItem>, <!UNUSED_PARAMETER!>selector<!> : (TItem)->TResult) : ()->Iterable<TResult> {
|
||||
public fun<TItem, TResult> select(yielder: ()->Iterable<TItem>, selector : (TItem)->TResult) : ()->Iterable<TResult> {
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
fun a() {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
package d
|
||||
|
||||
fun <T> asList(<!UNUSED_PARAMETER!>t<!>: T) : List<T>? {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T> asList(t: T) : List<T>? {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
fun main() {
|
||||
val <!UNUSED_VARIABLE!>list<!> : List<String> = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH{OI}, TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}!>asList("")<!>
|
||||
val list : List<String> = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH{OI}, TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}!>asList("")<!>
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ fun test(numbers: Iterable<Int>) {
|
||||
}
|
||||
|
||||
//from library
|
||||
fun <T, R> Iterable<T>.map(<!UNUSED_PARAMETER!>transform<!> : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T, R> Iterable<T>.map(transform : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
fun <T> Iterable<T>.fold(<!UNUSED_PARAMETER!>initial<!>: T, <!UNUSED_PARAMETER!>operation<!>: (T, T) -> T): T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T> Iterable<T>.fold(initial: T, operation: (T, T) -> T): T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -25,4 +25,4 @@ fun test(result: MutableList<in Any>, collection: MutableCollection<String>, pre
|
||||
}
|
||||
|
||||
//from library
|
||||
fun String.startsWith(<!UNUSED_PARAMETER!>prefix<!>: String) : Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun String.startsWith(prefix: String) : Boolean {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -14,5 +14,5 @@ fun test() {
|
||||
}
|
||||
|
||||
//from library
|
||||
fun <T> arrayList(vararg <!UNUSED_PARAMETER!>values<!>: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
operator fun <T> Iterable<T>.plus(<!UNUSED_PARAMETER!>elements<!>: Iterable<T>): List<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T> arrayList(vararg values: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
operator fun <T> Iterable<T>.plus(elements: Iterable<T>): List<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -6,8 +6,8 @@ package n
|
||||
import checkSubtype
|
||||
|
||||
fun main() {
|
||||
val <!UNUSED_VARIABLE!>a<!> = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>array<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>array<!>())
|
||||
val <!UNUSED_VARIABLE!>a0<!> : Array<Array<Int>> = array(array())
|
||||
val a = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>array<!>(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>array<!>())
|
||||
val a0 : Array<Array<Int>> = array(array())
|
||||
val a1 = array(array<Int>())
|
||||
checkSubtype<Array<Array<Int>>>(a1)
|
||||
val a2 = array<Array<Int>>(array())
|
||||
|
||||
@@ -5,10 +5,10 @@ package a
|
||||
|
||||
interface Foo<A>
|
||||
|
||||
fun <A, B> Foo<A>.map(<!UNUSED_PARAMETER!>f<!>: (A) -> B): Foo<B> = object : Foo<B> {}
|
||||
fun <A, B> Foo<A>.map(f: (A) -> B): Foo<B> = object : Foo<B> {}
|
||||
|
||||
|
||||
fun foo() {
|
||||
val l: Foo<String> = object : Foo<String> {}
|
||||
val <!UNUSED_VARIABLE!>m<!>: Foo<String> = l.<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH{OI}!>map { <!UNUSED_ANONYMOUS_PARAMETER!>ppp<!> -> <!CONSTANT_EXPECTED_TYPE_MISMATCH{NI}, CONSTANT_EXPECTED_TYPE_MISMATCH{NI}!>1<!> }<!>
|
||||
val m: Foo<String> = l.<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH{OI}!>map { ppp -> <!CONSTANT_EXPECTED_TYPE_MISMATCH{NI}, CONSTANT_EXPECTED_TYPE_MISMATCH{NI}!>1<!> }<!>
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ abstract class Buggy {
|
||||
}
|
||||
|
||||
//from library
|
||||
fun <T: Any> Iterable<T>.find(<!UNUSED_PARAMETER!>predicate<!>: (T) -> Boolean) : T? {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T: Any> Iterable<T>.find(predicate: (T) -> Boolean) : T? {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
//KT-2320 failure of complex case of type inference
|
||||
package i
|
||||
|
||||
interface NotMap<B>
|
||||
|
||||
interface Entry<B> {
|
||||
fun getValue(): B
|
||||
}
|
||||
|
||||
|
||||
fun <V, R> NotMap<V>.mapValuesOriginal(ff: (Entry<V>) -> R): NotMap<R> = throw Exception()
|
||||
|
||||
fun <B, C> NotMap<B>.mapValuesOnly(f: (B) -> C) = mapValuesOriginal { e -> f(e.getValue()) }
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
//KT-2320 failure of complex case of type inference
|
||||
package i
|
||||
|
||||
@@ -8,6 +9,6 @@ interface Entry<B> {
|
||||
}
|
||||
|
||||
|
||||
fun <V, R> NotMap<V>.mapValuesOriginal(<!UNUSED_PARAMETER!>ff<!>: (Entry<V>) -> R): NotMap<R> = throw Exception()
|
||||
fun <V, R> NotMap<V>.mapValuesOriginal(ff: (Entry<V>) -> R): NotMap<R> = throw Exception()
|
||||
|
||||
fun <B, C> NotMap<B>.mapValuesOnly(f: (B) -> C) = mapValuesOriginal { e -> f(e.getValue()) }
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
//KT-2324 Can't resolve generic by type of function result
|
||||
package i
|
||||
|
||||
//+JDK
|
||||
import java.util.*
|
||||
import checkSubtype
|
||||
|
||||
fun <T, K> someFunction(list: List<T>, transform: (T) -> K): List<K> {
|
||||
val result = arrayList<K>()
|
||||
for (i in list) {
|
||||
result.add(transform(i))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
fun testSomeFunction() {
|
||||
val result1 = someFunction(arrayList<Int>(1, 2), {checkSubtype<Int>(it)}) //type of result1 is List<Int>
|
||||
assertEquals(1, result1.get(0)); //OK
|
||||
|
||||
val result2 = someFunction(arrayList<Int>(1, 2), {it}) // type of result2 is List<DONT_CARE>
|
||||
checkSubtype<List<Int>>(result2)
|
||||
assertEquals(1, result2.get(0)); //resolved to error element
|
||||
}
|
||||
|
||||
//---------------------------------
|
||||
fun assertEquals(expected: Any?, actual: Any?, message: String = "") {
|
||||
}
|
||||
|
||||
fun <T> arrayList(vararg values: T) : ArrayList<T> = values.toCollection(ArrayList<T>(values.size))
|
||||
|
||||
fun <T, C: MutableCollection<in T>> Array<T>.toCollection(result: C) : C {
|
||||
for (element in this) result.add(element)
|
||||
return result
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
//KT-2324 Can't resolve generic by type of function result
|
||||
@@ -25,7 +26,7 @@ fun testSomeFunction() {
|
||||
}
|
||||
|
||||
//---------------------------------
|
||||
fun assertEquals(<!UNUSED_PARAMETER!>expected<!>: Any?, <!UNUSED_PARAMETER!>actual<!>: Any?, <!UNUSED_PARAMETER!>message<!>: String = "") {
|
||||
fun assertEquals(expected: Any?, actual: Any?, message: String = "") {
|
||||
}
|
||||
|
||||
fun <T> arrayList(vararg values: T) : ArrayList<T> = values.toCollection(ArrayList<T>(values.size))
|
||||
|
||||
@@ -12,8 +12,8 @@ fun test() {
|
||||
}
|
||||
|
||||
//from library
|
||||
fun <T> arrayList(vararg <!UNUSED_PARAMETER!>values<!>: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T> arrayList(vararg values: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
fun <T, R> Collection<T>.map(<!UNUSED_PARAMETER!>transform<!> : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T, R> Collection<T>.map(transform : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
fun <T> Iterable<T>.fold(<!UNUSED_PARAMETER!>initial<!>: T, <!UNUSED_PARAMETER!>operation<!>: (T, T) -> T): T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T> Iterable<T>.fold(initial: T, operation: (T, T) -> T): T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -7,4 +7,4 @@ class B<T>(val x: List<T>)
|
||||
fun <T> f(x: T): B<T> = B(arrayList(x))
|
||||
|
||||
// from standard library
|
||||
fun <T> arrayList(vararg <!UNUSED_PARAMETER!>values<!>: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T> arrayList(vararg values: T) : ArrayList<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
package a
|
||||
|
||||
fun <T, R: Comparable<R>> Iterable<T>._sortBy(<!UNUSED_PARAMETER!>f<!>: (T) -> R): List<T> = throw Exception()
|
||||
fun <T> _arrayList(vararg <!UNUSED_PARAMETER!>values<!>: T) : List<T> = throw Exception()
|
||||
fun <T, R: Comparable<R>> Iterable<T>._sortBy(f: (T) -> R): List<T> = throw Exception()
|
||||
fun <T> _arrayList(vararg values: T) : List<T> = throw Exception()
|
||||
|
||||
class _Pair<A>(val a: A)
|
||||
|
||||
fun test() {
|
||||
_arrayList(_Pair(1))._sortBy <!TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}!>{ <!UNUSED_ANONYMOUS_PARAMETER!>it<!> -> <!UNRESOLVED_REFERENCE!>xxx<!> }<!>
|
||||
_arrayList(_Pair(1))._sortBy <!TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}!>{ it -> <!UNRESOLVED_REFERENCE!>xxx<!> }<!>
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
package a
|
||||
|
||||
interface Closeable {}
|
||||
class C : Closeable {}
|
||||
|
||||
public inline fun <T: Closeable, R> T.use1(block: (T)-> R) : R {
|
||||
return block(this)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
C().use1 {
|
||||
w -> // ERROR here
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
package a
|
||||
@@ -11,7 +12,7 @@ public inline fun <T: Closeable, R> T.use1(block: (T)-> R) : R {
|
||||
|
||||
fun main() {
|
||||
C().use1 {
|
||||
<!UNUSED_ANONYMOUS_PARAMETER!>w<!> -> // ERROR here
|
||||
w -> // ERROR here
|
||||
<!UNRESOLVED_REFERENCE!>x<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,15 +19,15 @@ fun foo(){
|
||||
fun <T> bar(t: T): T = t
|
||||
|
||||
fun test() {
|
||||
|
||||
|
||||
doAction { bar(12) }
|
||||
|
||||
val u: Unit = bar(11)
|
||||
}
|
||||
|
||||
fun testWithoutInference(col: MutableCollection<Int>) {
|
||||
|
||||
|
||||
doAction { col.add(2) }
|
||||
|
||||
|
||||
val u: Unit = col.add(2)
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
//KT-2883 Type inference fails due to non-Unit value returned
|
||||
package a
|
||||
|
||||
public fun doAction(<!UNUSED_PARAMETER!>action<!> : () -> Unit){
|
||||
public fun doAction(action : () -> Unit){
|
||||
}
|
||||
|
||||
class Y<TItem>(val itemToString: (TItem) -> String){
|
||||
}
|
||||
|
||||
fun <TItem> bar(<!UNUSED_PARAMETER!>context<!> : Y<TItem>) : TItem{
|
||||
fun <TItem> bar(context : Y<TItem>) : TItem{
|
||||
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
fun foo(){
|
||||
@@ -19,15 +19,15 @@ fun foo(){
|
||||
fun <T> bar(t: T): T = t
|
||||
|
||||
fun test() {
|
||||
|
||||
|
||||
doAction { bar(12) }
|
||||
|
||||
val <!UNUSED_VARIABLE!>u<!>: Unit = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH{OI}, TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}!>bar(11)<!>
|
||||
val u: Unit = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH{OI}, TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}!>bar(11)<!>
|
||||
}
|
||||
|
||||
fun testWithoutInference(col: MutableCollection<Int>) {
|
||||
|
||||
|
||||
doAction { col.add(2) }
|
||||
|
||||
val <!UNUSED_VARIABLE!>u<!>: Unit = <!TYPE_MISMATCH!>col.add(2)<!>
|
||||
|
||||
val u: Unit = <!TYPE_MISMATCH!>col.add(2)<!>
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ enum class SomeEnum {
|
||||
|
||||
// Doesn't work
|
||||
fun Iterable<Int>.some() {
|
||||
this.fold(SomeEnum.FIRST, {res : SomeEnum, <!UNUSED_ANONYMOUS_PARAMETER!>value<!> ->
|
||||
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
|
||||
if (res == SomeEnum.FIRST) SomeEnum.FIRST else SomeEnum.SECOND
|
||||
})
|
||||
}
|
||||
@@ -19,7 +19,7 @@ fun tempFun() : SomeEnum {
|
||||
|
||||
// Doesn't work
|
||||
fun Iterable<Int>.someSimpleWithFun() {
|
||||
this.fold(SomeEnum.FIRST, {<!UNUSED_ANONYMOUS_PARAMETER!>res<!> : SomeEnum, <!UNUSED_ANONYMOUS_PARAMETER!>value<!> ->
|
||||
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
|
||||
tempFun()
|
||||
})
|
||||
}
|
||||
@@ -27,17 +27,17 @@ fun Iterable<Int>.someSimpleWithFun() {
|
||||
|
||||
// Works
|
||||
fun Iterable<Int>.someSimple() {
|
||||
this.fold(SomeEnum.FIRST, {<!UNUSED_ANONYMOUS_PARAMETER!>res<!> : SomeEnum, <!UNUSED_ANONYMOUS_PARAMETER!>value<!> ->
|
||||
this.fold(SomeEnum.FIRST, {res : SomeEnum, value ->
|
||||
SomeEnum.FIRST
|
||||
})
|
||||
}
|
||||
|
||||
// Works
|
||||
fun Iterable<Int>.someInt() {
|
||||
this.fold(0, {res : Int, <!UNUSED_ANONYMOUS_PARAMETER!>value<!> ->
|
||||
this.fold(0, {res : Int, value ->
|
||||
if (res == 0) 1 else 0
|
||||
})
|
||||
}
|
||||
|
||||
//from standard library
|
||||
fun <T,R> Iterable<T>.fold(<!UNUSED_PARAMETER!>initial<!>: R, <!UNUSED_PARAMETER!>operation<!>: (R, T) -> R): R {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T,R> Iterable<T>.fold(initial: R, operation: (R, T) -> R): R {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package aa
|
||||
|
||||
class Some<T>
|
||||
|
||||
class SomeTemplate {
|
||||
fun <T> query(some: Class<T>) = some
|
||||
|
||||
|
||||
// Uncomment this to get CANNOT_COMPLETE_RESOLVE error
|
||||
fun <T> query1(some: Class<T>) = some
|
||||
fun <T> query1(some: Some<T>) = some
|
||||
}
|
||||
|
||||
fun SomeTemplate.query(f: (i: Int) -> Unit) = f
|
||||
fun SomeTemplate.query1(f: (i: Int) -> Unit) = f
|
||||
|
||||
fun test() {
|
||||
val mapperFunction = { i: Int -> }
|
||||
SomeTemplate().query(mapperFunction)
|
||||
|
||||
// TYPE_MISMATCH: Required Class<[ERROR: CANT_INFER]>, Found (kotlin.Int) -> Unit
|
||||
SomeTemplate().query { i: Int -> }
|
||||
SomeTemplate().query1 { i: Int -> }
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
package aa
|
||||
|
||||
class Some<T>
|
||||
@@ -15,10 +16,10 @@ fun SomeTemplate.query(f: (i: Int) -> Unit) = f
|
||||
fun SomeTemplate.query1(f: (i: Int) -> Unit) = f
|
||||
|
||||
fun test() {
|
||||
val mapperFunction = { <!UNUSED_ANONYMOUS_PARAMETER!>i<!>: Int -> }
|
||||
val mapperFunction = { i: Int -> }
|
||||
SomeTemplate().query(mapperFunction)
|
||||
|
||||
// TYPE_MISMATCH: Required Class<[ERROR: CANT_INFER]>, Found (kotlin.Int) -> Unit
|
||||
SomeTemplate().query { <!UNUSED_ANONYMOUS_PARAMETER!>i<!>: Int -> }
|
||||
SomeTemplate().query1 { <!UNUSED_ANONYMOUS_PARAMETER!>i<!>: Int -> }
|
||||
SomeTemplate().query { i: Int -> }
|
||||
SomeTemplate().query1 { i: Int -> }
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ interface B
|
||||
object CAB : A, B
|
||||
object DAB : A, B
|
||||
|
||||
fun m(<!UNUSED_PARAMETER!>args<!> : Array<A>) {
|
||||
fun m(args : Array<A>) {
|
||||
|
||||
}
|
||||
|
||||
@@ -17,4 +17,4 @@ fun test122() {
|
||||
}
|
||||
|
||||
//from library
|
||||
fun <T> array(vararg <!UNUSED_PARAMETER!>t<!>: T): Array<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
fun <T> array(vararg t: T): Array<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// KT-3496 Type inference bug on y[""]
|
||||
|
||||
class B<T> {
|
||||
fun <S> x (y: B<Iterable<S>>) {
|
||||
val z: S = y[""] // does not work with [], but works with .get()
|
||||
}
|
||||
operator fun <S> get(s : String): S = throw Exception()
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// KT-3496 Type inference bug on y[""]
|
||||
|
||||
@@ -5,5 +6,5 @@ class B<T> {
|
||||
fun <S> x (y: B<Iterable<S>>) {
|
||||
val z: S = y[""] // does not work with [], but works with .get()
|
||||
}
|
||||
operator fun <S> get(<!UNUSED_PARAMETER!>s<!> : String): S = throw Exception()
|
||||
}
|
||||
operator fun <S> get(s : String): S = throw Exception()
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class F<T> {
|
||||
fun <T, V> x (y: F<ArrayList<T>>, w: ArrayList<V>) {
|
||||
val z: ArrayList<T> = y["", w]
|
||||
}
|
||||
}
|
||||
operator fun <V, T> Any.get(s: String, w: ArrayList<V>): ArrayList<T> = throw Exception()
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
@@ -8,4 +9,4 @@ class F<T> {
|
||||
val z: ArrayList<T> = y["", w]
|
||||
}
|
||||
}
|
||||
operator fun <V, T> Any.get(<!UNUSED_PARAMETER!>s<!>: String, <!UNUSED_PARAMETER!>w<!>: ArrayList<V>): ArrayList<T> = throw Exception()
|
||||
operator fun <V, T> Any.get(s: String, w: ArrayList<V>): ArrayList<T> = throw Exception()
|
||||
|
||||
@@ -20,4 +20,4 @@ fun foo(lines: List<String>) {
|
||||
//standard library
|
||||
fun <T : Any> T?.sure() : T = this!!
|
||||
|
||||
public inline fun <T> comparator(<!UNUSED_PARAMETER!>fn<!>: (T,T) -> Int): Comparator<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
public inline fun <T> comparator(fn: (T,T) -> Int): Comparator<T> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
interface In<in I>
|
||||
|
||||
interface B : In<B>
|
||||
|
||||
interface C<I, T>
|
||||
|
||||
fun <I, T> In<I>.foo(f: () -> C<I, T>) {}
|
||||
fun <I, T, Self: In<I>> Self.foo2(f: () -> C<I, T>) {}
|
||||
|
||||
class E : B // e <: In<B> <: In<E>
|
||||
|
||||
fun test(c: C<E, Int>, e: E) {
|
||||
e.foo<E, Int> { c }
|
||||
e.foo { c } // error here: expected C<B, ???> but must be C<??? : B, ???>
|
||||
e.foo2 { c }
|
||||
e.foo2 ({ c })
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
// FIR_IDENTICAL
|
||||
interface In<in I>
|
||||
|
||||
interface B : In<B>
|
||||
|
||||
interface C<I, T>
|
||||
|
||||
fun <I, T> In<I>.foo(<!UNUSED_PARAMETER!>f<!>: () -> C<I, T>) {}
|
||||
fun <I, T, Self: In<I>> Self.foo2(<!UNUSED_PARAMETER!>f<!>: () -> C<I, T>) {}
|
||||
fun <I, T> In<I>.foo(f: () -> C<I, T>) {}
|
||||
fun <I, T, Self: In<I>> Self.foo2(f: () -> C<I, T>) {}
|
||||
|
||||
class E : B // e <: In<B> <: In<E>
|
||||
|
||||
@@ -14,4 +15,4 @@ fun test(c: C<E, Int>, e: E) {
|
||||
e.foo { c } // error here: expected C<B, ???> but must be C<??? : B, ???>
|
||||
e.foo2 { c }
|
||||
e.foo2 ({ c })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ fun <T> emptyList() : List<T>? = ArrayList<T>()
|
||||
|
||||
fun foo() {
|
||||
// type arguments shouldn't be required
|
||||
val <!UNUSED_VARIABLE!>l<!> : List<Int> = emptyList()!!
|
||||
val <!UNUSED_VARIABLE!>l1<!> = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>emptyList<!>()!!
|
||||
val l : List<Int> = emptyList()!!
|
||||
val l1 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>emptyList<!>()!!
|
||||
|
||||
checkSubtype<List<Int>>(emptyList()!!)
|
||||
checkSubtype<List<Int>?>(emptyList())
|
||||
|
||||
Reference in New Issue
Block a user