[FIR] Introduce TYPE_ARGUMENTS_NOT_ALLOWED & some other type errors

This commit introduces several different things, in particular:
- check type arguments in expressions
- new TypeArgumentList node to deal with diagnostic source
- ConeDiagnostic was moved to fir:cones
- ConeIntermediateDiagnostic to use in inference (?) without reporting
- detailed diagnostics on error type
This commit is contained in:
Mikhail Glukhikh
2020-07-22 10:29:59 +03:00
parent c744dfba9c
commit 0804c6a0f3
196 changed files with 774 additions and 484 deletions
+21 -21
View File
@@ -3,53 +3,53 @@
enum class Color {
RED {
fun <T : RED> simpleName(): RED = null!!
fun <T : <!OTHER_ERROR!>RED<!>> simpleName(): <!OTHER_ERROR!>RED<!> = null!!
}
}
class MyColor(val x: Color.RED, y: Color.RED) : Color.RED {
class MyColor(val x: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Color.RED<!>, y: <!OTHER_ERROR!>Color.RED<!>) : <!OTHER_ERROR!>Color.RED<!> {
var z: Color.RED = Color.RED
var z: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Color.RED<!> = Color.RED
set(arg: Color.RED) { z = arg }
fun foo(arg: Color.RED): Color.RED = arg
fun foo(arg: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Color.RED<!>): <!OTHER_ERROR!>Color.RED<!> = arg
fun bar(): Color.RED {
class Local : Color.RED
fun local(arg: Color.RED): Color.RED = arg
val temp: Color.RED = Color.RED
temp as? Color.RED
if (temp is Color.RED) {
return temp as Color.RED
fun bar(): <!OTHER_ERROR!>Color.RED<!> {
class Local : <!OTHER_ERROR!>Color.RED<!>
fun local(arg: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Color.RED<!>): <!OTHER_ERROR!>Color.RED<!> = arg
val temp: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Color.RED<!> = Color.RED
temp as? <!OTHER_ERROR!>Color.RED<!>
if (temp is <!OTHER_ERROR!>Color.RED<!>) {
return temp as <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Color.RED<!>
}
val obj = object : Color.RED {}
if (obj is Color.RED) {
val obj = object : <!OTHER_ERROR!>Color.RED<!> {}
if (obj is <!OTHER_ERROR!>Color.RED<!>) {
return obj
}
return Color.RED
}
}
fun create(): Array<Color.RED>? = null
fun create(): <!OTHER_ERROR!>Array<Color.RED>?<!> = null
interface Your<T : Color.RED>
interface Your<T : <!OTHER_ERROR!>Color.RED<!>>
class His : Your<Color.RED>
class His : <!OTHER_ERROR!>Your<Color.RED><!>
fun <T : Color.RED> otherCreate(): Array<T>? = null
fun <T : <!OTHER_ERROR!>Color.RED<!>> otherCreate(): Array<T>? = null
typealias RedAlias = Color.RED
typealias RedAlias = <!OTHER_ERROR!>Color.RED<!>
typealias ArrayOfEnumEntry = Array<Color.RED>
typealias ArrayOfEnumEntry = <!OTHER_ERROR!>Array<Color.RED><!>
typealias ArrayOfEnumEntryAlias = Array<RedAlias>
fun <T> bar(a: Any): T = a as T
fun <T> foo() {
foo<Color.RED>()
foo<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>Color.RED<!>>()
foo<RedAlias>()
<!INAPPLICABLE_CANDIDATE!>bar<!><Color.RED>(Color.RED)
}
fun Array<Color.RED>.foo(entries: Array<Color.RED>): Array<Color.RED> = null!!
fun <!OTHER_ERROR!>Array<Color.RED><!>.foo(entries: <!OTHER_ERROR!>Array<Color.RED><!>): <!OTHER_ERROR!>Array<Color.RED><!> = null!!
@@ -9,7 +9,7 @@ package foo
fun f() {
class Local1 {
fun g() : bar.X? = null
fun g() : <!OTHER_ERROR!>bar.X?<!> = null
}
class Local2 {
fun g() : foo.bar.X? = null
+1 -1
View File
@@ -45,7 +45,7 @@ class Foo() {}
class Bar<T : Foo>
class Buzz<T> where T : Bar<Int>, T : nioho
class Buzz<T> where T : Bar<Int>, T : <!OTHER_ERROR!>nioho<!>
class X<T : Foo>
class Y<T> where T : Foo, T : Bar<Foo>
@@ -6,4 +6,4 @@ package foo
// FILE: b.kt
@foo fun bar(p: foo): foo = null!!
@<!OTHER_ERROR!>foo<!> fun bar(p: <!OTHER_ERROR!>foo<!>): <!OTHER_ERROR!>foo<!> = null!!
@@ -6,14 +6,14 @@ package foobar.a
import java.*
val a : java.util.List<Int>? = null
val a2 : util.List<Int>? = null
val a3 : LinkedList<Int>? = null
val a2 : <!OTHER_ERROR, OTHER_ERROR!>util.List<Int>?<!> = null
val a3 : <!OTHER_ERROR, OTHER_ERROR!>LinkedList<Int>?<!> = null
// FILE: b.kt
package foobar
abstract class Foo<T>() {
abstract val x : T<Int>
abstract val x : <!TYPE_ARGUMENTS_NOT_ALLOWED, TYPE_ARGUMENTS_NOT_ALLOWED!>T<Int><!>
}
// FILE: b.kt
@@ -21,7 +21,7 @@ package foobar.a
import java.util.*
val b : List<Int>? = a
val b1 : util.List<Int>? = a
val b1 : <!OTHER_ERROR, OTHER_ERROR!>util.List<Int>?<!> = a
// FILE: b.kt
package foobar
+2 -2
View File
@@ -15,10 +15,10 @@ import java.lang.Comparable as Com
val l : MutableList<in Int> = ArrayList<Int>()
fun test(l : java.util.List<Int>) {
val x : java.List
val x : <!OTHER_ERROR!>java.List<!>
val y : java.util.List<Int>
val b : java.lang.Object
val z : java.utils.List<Int>
val z : <!OTHER_ERROR!>java.utils.List<Int><!>
val f : java.io.File? = null
+2 -2
View File
@@ -3,8 +3,8 @@ package unresolved
class Pair<A, B>(val a: A, val b: B)
fun testGenericArgumentsCount() {
val p1: Pair<Int> = Pair(2, 2)
val p2: Pair = Pair(2, 2)
val p1: <!OTHER_ERROR!>Pair<Int><!> = Pair(2, 2)
val p2: <!OTHER_ERROR!>Pair<!> = Pair(2, 2)
}
fun testUnresolved() {
@@ -2,5 +2,5 @@
import java.util.ArrayList
@ArrayList<Int>(1, 1) fun b() {}
@Xoo(<!UNRESOLVED_REFERENCE!>x<!>) fun c() {}
@<!OTHER_ERROR!>Xoo<!>(<!UNRESOLVED_REFERENCE!>x<!>) fun c() {}
@java.lang.Deprecated(<!UNRESOLVED_REFERENCE!>x<!>) fun a() {}
@@ -1,3 +1,3 @@
// Check that there won't be "Rewrite at slice ANNOTATION key" exception - EA-36935
@someErrorAnnotation object Test {
@<!OTHER_ERROR!>someErrorAnnotation<!> object Test {
}
@@ -3,7 +3,7 @@ package test
// Checks that there is no rewrite error at ANNOTATION slice because of resolving annotations for object in lazy resolve and resolving
// object as property (method tries to resolve annotations too).
@BadAnnotation
@<!OTHER_ERROR!>BadAnnotation<!>
object SomeObject
val some = SomeObject
@@ -34,7 +34,7 @@ annotation class Ann8(val p1: Array<String>,
val p4: Array<Ann1>)
annotation class Ann9(
val error: Unresolved = <!UNRESOLVED_REFERENCE!>Unresolved<!>.<!UNRESOLVED_REFERENCE!>VALUE<!>
val error: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Unresolved<!> = <!UNRESOLVED_REFERENCE!>Unresolved<!>.<!UNRESOLVED_REFERENCE!>VALUE<!>
)
@@ -1,10 +1,10 @@
// !WITH_NEW_INFERENCE
fun foo(@varargs f : Int) {}
fun foo(@<!OTHER_ERROR!>varargs<!> f : Int) {}
var bar : Int = 1
set(@varargs v) {}
set(@<!OTHER_ERROR!>varargs<!> v) {}
val x : (Int) -> Int = {@varargs x <!SYNTAX!>: Int -> x<!>}
val x : (Int) -> Int = {@<!OTHER_ERROR!>varargs<!> x <!SYNTAX!>: Int -> x<!>}
class Hello(@varargs args: Any) {
class Hello(@<!OTHER_ERROR!>varargs<!> args: Any) {
}
@@ -1,5 +1,5 @@
@Ann class A
@Ann class B
@Ann(1) class C
@kotlin.Ann(1) class D
@kotlin.annotation.Ann(1) class E
@<!OTHER_ERROR!>Ann<!> class A
@<!OTHER_ERROR!>Ann<!> class B
@<!OTHER_ERROR!>Ann<!>(1) class C
@<!OTHER_ERROR!>kotlin.Ann<!>(1) class D
@<!OTHER_ERROR!>kotlin.annotation.Ann<!>(1) class E
@@ -27,7 +27,7 @@ class Test {
fun <T> List<T>.testClassLiteral3() = b<T, Any>::class
fun <T> List<T>.testUnresolved1() = <!UNRESOLVED_REFERENCE!>unresolved<!><T>::foo
fun <T> List<T>.testUnresolved2() = a<unresolved>::foo
fun <T> List<T>.testUnresolved2() = a<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>unresolved<!>>::foo
fun <T> List<T>.testUnresolved3() = a<<!SYNTAX!><!>>::foo
fun <T> List<T>.testUnresolved4() = <!UNRESOLVED_REFERENCE!>unresolved<!>?::foo
}
@@ -5,7 +5,7 @@
// MODULE: m1
// FILE: bar.kt
fun <T> bar(ff: Err.() -> Unit) {
fun <T> bar(ff: <!OTHER_ERROR!>Err<!>.() -> Unit) {
}
// MODULE: m2(m1)
@@ -2,10 +2,10 @@
class DTO {
val q: Int = 0
operator fun get(prop: KProperty1<*, Int>): Int = 0
operator fun get(prop: <!OTHER_ERROR!>KProperty1<*, Int><!>): Int = 0
}
fun foo(intDTO: DTO?, p: KProperty1<*, Int>) {
fun foo(intDTO: DTO?, p: <!OTHER_ERROR!>KProperty1<*, Int><!>) {
if (intDTO != null) {
intDTO[DTO::q]
intDTO.q
@@ -1 +1 @@
fun testing(a: Any) = a is UnresolvedType<Int>
fun testing(a: Any) = a is <!OTHER_ERROR!>UnresolvedType<Int><!>
@@ -3,7 +3,7 @@
interface B<T>
interface G<T>: B<T>
fun f(p: B<Foo>): Any {
fun f(p: <!OTHER_ERROR, OTHER_ERROR!>B<Foo><!>): Any {
val v = p as G
return checkSubtype<G<*>>(v)
}
@@ -2,7 +2,7 @@
class G<T>
fun foo(p: P) {
fun foo(p: <!OTHER_ERROR, OTHER_ERROR!>P<!>) {
val v = p as G?
checkSubtype<G<*>>(v!!)
}
@@ -1,6 +1,6 @@
class P
fun foo(p: P): Any {
val v = p as G
val v = p as <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>G<!>
return v
}
@@ -1,7 +1,7 @@
// !LANGUAGE: +BareArrayClassLiteral
val a01 = Array::class
val a02 = Array<Array>::class
val a02 = Array<<!OTHER_ERROR!>Array<!>>::class
val a03 = Array<Any?>::class
val a04 = Array<Array<Any?>?>::class
val a05 = Array<IntArray?>::class
@@ -15,12 +15,12 @@ fun case_3() {
}
val x = object<T, K: Comparable<K>> {
fun test() = 10 as T // OK
fun test() = 10 as <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>T<!> // OK
}
fun case_4() {
val x = object<T> {
fun test() = 10 as T
fun test() = 10 as <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>T<!>
}
val y = x.test() // type y is T
@@ -15,12 +15,12 @@ fun case_3() {
}
val x = object<T, K: Comparable<K>> {
fun test() = 10 as T // OK
fun test() = 10 as <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>T<!> // OK
}
fun case_4() {
val x = object<T> {
fun test() = 10 as T
fun test() = 10 as <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>T<!>
}
val y = x.test() // type y is T
@@ -23,7 +23,7 @@ object DefaultHttpClientWithFun : HttpClient by fClient() {
private fun fClient() = HttpClientImpl()
private fun <T> lazy(init: () -> T): kotlin.Lazy<T> {
private fun <T> lazy(init: () -> T): <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>kotlin.Lazy<T><!> {
init()
null!!
}
@@ -9,7 +9,7 @@ public class C {
open class Base ()
class Foo : Data()
class Foo : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Data<!>()
companion object : DerivedAbstract()
}
@@ -9,7 +9,7 @@ public class C {
open class Base ()
class Foo : Data()
class Foo : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Data<!>()
companion object : DerivedAbstract()
}
@@ -1,6 +1,6 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
data class A(val i: Int, val j: G)
data class B(val i: G, val j: G)
data class A(val i: Int, val j: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>G<!>)
data class B(val i: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>G<!>, val j: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>G<!>)
fun fa(a: A) {
@@ -11,7 +11,7 @@ interface B1<T : B0<*>>
interface AA<T: AA<*>>
interface BB<S : List<AA<*>>>
interface A<T: List<T, T, T>>
interface A<T: <!OTHER_ERROR!>List<T, T, T><!>>
class X<Y>
class D<T : X<in X<out X<T>>>>
@@ -11,7 +11,7 @@ fun test() {
const val <T> a3 = 0
lateinit val <T> a4 = 0
val <T> a5 by Delegate<Int>()
val <T> a6 by <!INAPPLICABLE_CANDIDATE!>Delegate<T>()<!>
val <T> a6 by <!INAPPLICABLE_CANDIDATE!>Delegate<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>T<!>>()<!>
}
class Delegate<F> {
@@ -11,7 +11,7 @@ fun test() {
const val <T> a3 = 0
lateinit val <T> a4 = 0
val <T> a5 by Delegate<Int>()
val <T> a6 by <!INAPPLICABLE_CANDIDATE!>Delegate<T>()<!>
val <T> a6 by <!INAPPLICABLE_CANDIDATE!>Delegate<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>T<!>>()<!>
}
class Delegate<F> {
@@ -1,4 +1,4 @@
interface T {
val x: ErrorType
fun getX(): ErrorType1
val x: <!OTHER_ERROR, OTHER_ERROR!>ErrorType<!>
fun getX(): <!OTHER_ERROR!>ErrorType1<!>
}
@@ -3,4 +3,4 @@ enum class MyEnum {
SECOND
}
fun foo(me: MyEnum): Boolean = if (me is MyEnum.FIRST) true else false
fun foo(me: MyEnum): Boolean = if (me is <!OTHER_ERROR!>MyEnum.FIRST<!>) true else false
@@ -2,4 +2,4 @@ enum class E {
ENTRY
}
class A : E.ENTRY
class A : <!OTHER_ERROR!>E.ENTRY<!>
@@ -3,4 +3,4 @@ enum class MyEnum {
SECOND
}
fun foo(me: MyEnum): Boolean = me is MyEnum.FIRST
fun foo(me: MyEnum): Boolean = me is <!OTHER_ERROR!>MyEnum.FIRST<!>
@@ -12,10 +12,10 @@ inline class ULong(private val l: Long)
// FILE: test.kt
annotation class AnnoUB(val ub0: UByte, val ub1: UByte)
annotation class AnnoUS(val us0: UShort, val us1: UShort)
annotation class AnnoUI(val ui0: UInt, val ui1: UInt, val ui2: UInt, val ui3: UInt)
annotation class AnnoUL(val ul0: ULong, val ul1: ULong)
annotation class AnnoUB(val ub0: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UByte<!>, val ub1: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UByte<!>)
annotation class AnnoUS(val us0: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UShort<!>, val us1: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UShort<!>)
annotation class AnnoUI(val ui0: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UInt<!>, val ui1: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UInt<!>, val ui2: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UInt<!>, val ui3: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UInt<!>)
annotation class AnnoUL(val ul0: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>ULong<!>, val ul1: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>ULong<!>)
const val ub0 = <!UNRESOLVED_REFERENCE!>UByte<!>(1)
const val us0 = <!UNRESOLVED_REFERENCE!>UShort<!>(2)
@@ -37,8 +37,8 @@ fun f2() {}
@AnnoUL(ul0, <!UNRESOLVED_REFERENCE!>ULong<!>(5))
fun f3() {}
const val explicit: UInt = <!UNRESOLVED_REFERENCE!>UInt<!>(2)
const val explicit: <!OTHER_ERROR, OTHER_ERROR!>UInt<!> = <!UNRESOLVED_REFERENCE!>UInt<!>(2)
const val nullable: UInt? = <!UNRESOLVED_REFERENCE!>UInt<!>(3)
const val nullable: <!OTHER_ERROR, OTHER_ERROR!>UInt?<!> = <!UNRESOLVED_REFERENCE!>UInt<!>(3)
annotation class NullableAnno(val u: UInt?)
annotation class NullableAnno(val u: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>UInt?<!>)
@@ -4,10 +4,10 @@
interface A
fun devNull(a: Any?){}
val generic_fun = fun<T>(t: T): T = null!!
val extension_generic_fun = fun<T>T.(t: T): T = null!!
val generic_fun = fun<T>(t: <!OTHER_ERROR!>T<!>): T = null!!
val extension_generic_fun = fun<T><!OTHER_ERROR!>T<!>.(t: <!OTHER_ERROR!>T<!>): T = null!!
fun fun_with_where() = fun <T> T.(t: T): T where T: A = null!!
fun fun_with_where() = fun <T> <!OTHER_ERROR!>T<!>.(t: <!OTHER_ERROR!>T<!>): T where T: A = null!!
fun outer() {
@@ -6,7 +6,7 @@ fun test(bal: Array<Int>) {
val b: () -> Int = { bar = 4 }
val c: () -> UNRESOLVED = { bal[2] = 3 }
val c: () -> <!OTHER_ERROR!>UNRESOLVED<!> = { bal[2] = 3 }
val d: () -> Int = { bar += 4 }
@@ -1,7 +1,7 @@
package p
public fun foo(a: Any) {
a is Map<Int>
a is <!OTHER_ERROR!>Map<Int><!>
a is Map
a is Map<out Any?, Any?>
a is Map<*, *>
@@ -1,6 +1,6 @@
public fun foo(a: Any, b: Map) {
public fun foo(a: Any, b: <!OTHER_ERROR!>Map<!>) {
when (a) {
is Map<Int> -> {}
is <!OTHER_ERROR!>Map<Int><!> -> {}
is Map -> {}
is Map<out Any?, Any?> -> {}
is Map<*, *> -> {}
@@ -1,7 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T> foo(t: T<String, Int>) {}
fun <T> foo(t: <!TYPE_ARGUMENTS_NOT_ALLOWED!>T<String, Int><!>) {}
interface A
class B<T: A>
fun <T> foo1(t: T<B<String>>) {}
fun <T> foo1(t: <!TYPE_ARGUMENTS_NOT_ALLOWED!>T<B<String>><!>) {}
@@ -18,11 +18,11 @@ fun <E> foo(x: Any, y: Any) : Any {
}
// bare type
if (y is Outer.Inner) {
if (y is <!OTHER_ERROR!>Outer.Inner<!>) {
return y
}
y as Outer<*>.Inner
y as <!OTHER_ERROR, OTHER_ERROR!>Outer<*>.Inner<!>
return C()
}
@@ -51,19 +51,19 @@ interface MessageManager9 : Manager<Message3> {
fun <T : Message3> execute4() {}
}
object MessageManager10 : Message5<Int>() {
object MessageManager10 : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Message5<Int><!>() {
fun <T : Int> execute() {}
}
class MessageManager11<A> : Message5<Message5<A>>() {
fun <T : Message5<A>> execute() {}
class MessageManager11<A> : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Message5<Message5<A>><!>() {
fun <T : <!OTHER_ERROR!>Message5<A><!>> execute() {}
}
data class MessageManager12(val x: Int) : Message5<Message2>() {
data class MessageManager12(val x: Int) : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Message5<Message2><!>() {
fun <T : Message2> execute() {}
}
sealed class MessageManager13<A> : Message5<A>() {
sealed class MessageManager13<A> : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Message5<A><!>() {
fun <T : A> execute() {}
}
@@ -29,8 +29,8 @@ fun test() {
a<Foo.Bar<Int>.Baz>()
}
fun <T: Foo<String.Bar>> x() {}
fun <T: <!OTHER_ERROR!>Foo<String.Bar><!>> x() {}
fun Foo<String>.Bar.ext() {}
fun ex1(a: Foo<String>.Bar<String>): Foo<String>.Bar<String> {
fun ex1(a: <!OTHER_ERROR!>Foo<String>.Bar<String><!>): <!OTHER_ERROR!>Foo<String>.Bar<String><!> {
}
@@ -15,7 +15,7 @@ class A {
// Does not work, could be Outer<String>.Inner<Int>
// TODO: Should work?
fun foo(x: Inner<Int>) {
fun foo(x: <!OTHER_ERROR!>Inner<Int><!>) {
// Inner<Char>() call use companion as implicit receiver
val y: Outer<String>.Inner<Char> = Inner<Char>()
}
@@ -15,7 +15,7 @@ class A {
// Does not work, could be Outer<String>.Inner<Int>
// TODO: Should work?
fun foo(x: Inner<Int>) {
fun foo(x: <!OTHER_ERROR!>Inner<Int><!>) {
// Inner<Char>() call use companion as implicit receiver
val y: Outer<String>.Inner<Char> = Inner<Char>()
}
@@ -7,14 +7,14 @@ open class Outer<X, Y> {
class Derived : Outer<String, Int>() {
fun foo(): Inner<Char> = null!!
fun baz(): Alias<Char> = null!!
fun baz(): <!OTHER_ERROR, OTHER_ERROR!>Alias<Char><!> = null!!
}
class A : Outer<Double, Short>() {
class B : Outer<Float, Long>() {
fun bar(): Inner<String> = null!!
fun x(): Alias<String> = null!!
fun x(): <!OTHER_ERROR, OTHER_ERROR!>Alias<String><!> = null!!
}
}
@@ -10,12 +10,12 @@ private fun <E> foobar() = {
fun a() = A<E, X, Y, Z>()
}
typealias LocalAlias<W> = A<E, X, Y, W>
typealias LocalAlias<W> = <!OTHER_ERROR!>A<E, X, Y, W><!>
}
class Derived : LocalOuter<Double, Short>() {
fun foo(): LocalInner<Long> = null!!
fun bar(): LocalAlias<Char> = null!!
fun bar(): <!OTHER_ERROR, OTHER_ERROR!>LocalAlias<Char><!> = null!!
}
Derived()
@@ -27,12 +27,12 @@ private fun noParameters() = {
fun a() = A<Any, X, Y, Z>()
}
typealias LocalAlias2<W> = A<Any, X, Y, W>
typealias LocalAlias2<W> = <!OTHER_ERROR!>A<Any, X, Y, W><!>
}
class Derived2 : LocalOuter2<Double, Short>() {
fun foo(): LocalInner2<Long> = null!!
fun bar(): LocalAlias2<Char> = null!!
fun bar(): <!OTHER_ERROR, OTHER_ERROR!>LocalAlias2<Char><!> = null!!
}
Derived2()
@@ -12,12 +12,12 @@ class Outer<T> {
fun a() = A<T, F, E, X, Y, Z>()
}
typealias LocalAlias<W> = A<T, F, E, X, Y, W>
typealias LocalAlias<W> = <!OTHER_ERROR!>A<T, F, E, X, Y, W><!>
}
class Derived : LocalOuter<Double, Short>() {
fun foo(): LocalInner<Long> = null!!
fun bar(): LocalAlias<Char> = null!!
fun bar(): <!OTHER_ERROR, OTHER_ERROR!>LocalAlias<Char><!> = null!!
}
Derived()
@@ -29,12 +29,12 @@ class Outer<T> {
fun a() = A<T, F, Any, X, Y, Z>()
}
typealias LocalAlias2<W> = A<T, F, Any, X, Y, W>
typealias LocalAlias2<W> = <!OTHER_ERROR!>A<T, F, Any, X, Y, W><!>
}
class Derived2 : LocalOuter2<Double, Short>() {
fun foo(): LocalInner2<Long> = null!!
fun bar(): LocalAlias2<Char> = null!!
fun bar(): <!OTHER_ERROR, OTHER_ERROR!>LocalAlias2<Char><!> = null!!
}
Derived2()
}
@@ -10,7 +10,7 @@ open class BaseDerived2<X> : BaseDerived1<String, X>()
class Derived : BaseDerived2<Int>() {
fun foo(): Inner<Char> = null!!
fun baz(): Alias<Char> = null!!
fun baz(): <!OTHER_ERROR, OTHER_ERROR!>Alias<Char><!> = null!!
}
fun foo() {
@@ -17,4 +17,4 @@ class Outer<E> {
class E
fun bar(x: Inner) {}
fun bar(x: <!OTHER_ERROR!>Inner<!>) {}
@@ -15,9 +15,9 @@ class A<T> {
val y: B<String>.C<String>? = null
val z: B<String>.D? = null
val c: C<Int>? = null
val d: D? = null
val c: <!OTHER_ERROR, OTHER_ERROR!>C<Int>?<!> = null
val d: <!OTHER_ERROR, OTHER_ERROR!>D?<!> = null
val innerMost: Innermost<String>? = null
val innerMost: <!OTHER_ERROR, OTHER_ERROR!>Innermost<String>?<!> = null
}
}
@@ -4,7 +4,7 @@
class Outer<T> {
inner class Inner
fun foo(x: Outer<String>.Inner, y: Outer.Inner, z: Inner) {
fun foo(x: Outer<String>.Inner, y: <!OTHER_ERROR!>Outer.Inner<!>, z: Inner) {
var inner = Inner()
x.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Inner>() }
x.checkType { _<Outer<String>.Inner>() }
@@ -38,14 +38,14 @@ fun ok4(): Outer.Obj.Nested2<A>.Inner5<B> = null!!
fun ok5(): test.Outer.Obj.Nested2<A>.Inner5<B> = null!!
// All arguments are resolved
fun errorTypeWithArguments(): Q<A>.W<B, C, D>.R.M = null!!
fun errorTypeWithArguments(): <!OTHER_ERROR!>Q<A>.W<B, C, D>.R.M<!> = null!!
fun error1(): Outer<A>.Inner<B>.Inner3<C, D> = null!!
fun error2(): Outer<A>.Inner<B, C, D>.Inner2 = null!!
fun error3(): Outer.Inner<A, B>.Inner3<C> = null!!
fun error2(): <!OTHER_ERROR!>Outer<A>.Inner<B, C, D>.Inner2<!> = null!!
fun error3(): <!OTHER_ERROR!>Outer.Inner<A, B>.Inner3<C><!> = null!!
fun error4(): Outer<A>.Nested<B>.Inner4<C> = null!!
fun error5(): Outer<A>.Obj.Nested2<B>.Inner5<C> = null!!
fun error6(): Outer.Obj<A>.Nested2<B>.Inner5<C> = null!!
fun error4(): <!OTHER_ERROR!>Outer<A>.Nested<B>.Inner4<C><!> = null!!
fun error5(): <!OTHER_ERROR!>Outer<A>.Obj.Nested2<B>.Inner5<C><!> = null!!
fun error6(): <!OTHER_ERROR!>Outer.Obj<A>.Nested2<B>.Inner5<C><!> = null!!
fun error7(): test<String>.Outer.Obj.Nested2<A>.Inner5<B> = null!!
fun error7(): <!OTHER_ERROR!>test<String>.Outer.Obj.Nested2<A>.Inner5<B><!> = null!!
@@ -1,14 +1,14 @@
interface I0<T : Unresolved0<String>>
interface I1<T> where T : Unresolved1<String>
interface I2<T : Unresolved2<String>> where T : Unresolved3<String>
interface I0<T : <!OTHER_ERROR!>Unresolved0<String><!>>
interface I1<T> where T : <!OTHER_ERROR!>Unresolved1<String><!>
interface I2<T : <!OTHER_ERROR!>Unresolved2<String><!>> where T : <!OTHER_ERROR!>Unresolved3<String><!>
fun <E : Unresolved4<String>> foo0() {}
fun <E> foo1() where E : Unresolved5<String> {}
fun <E : Unresolved6<String>> foo2() where E : Unresolved7<String> {}
fun <E : <!OTHER_ERROR!>Unresolved4<String><!>> foo0() {}
fun <E> foo1() where E : <!OTHER_ERROR!>Unresolved5<String><!> {}
fun <E : <!OTHER_ERROR!>Unresolved6<String><!>> foo2() where E : <!OTHER_ERROR!>Unresolved7<String><!> {}
val <E : Unresolved7> E.p1: Int
val <E : <!OTHER_ERROR!>Unresolved7<!>> E.p1: Int
get() = 1
val <E> E.p2: Int where E : Unresolved8
val <E> E.p2: Int where E : <!OTHER_ERROR!>Unresolved8<!>
get() = 1
val <E : Unresolved9> E.p3: Int where E : Unresolved10
val <E : <!OTHER_ERROR!>Unresolved9<!>> E.p3: Int where E : <!OTHER_ERROR!>Unresolved10<!>
get() = 1
@@ -14,4 +14,4 @@ package c
import a.x
import b.x
class Y : x.X
class Y : <!OTHER_ERROR!>x.X<!>
@@ -4,7 +4,7 @@ package test
import other.prop
// Note: "prop" is expected to be unresolved and replaced to Any
class PropType: prop
class PropType: <!OTHER_ERROR!>prop<!>
// Note: this time "prop" should be resolved and type should be inferred for "checkTypeProp"
val checkTypeProp = prop
@@ -15,7 +15,7 @@ fun foo() {
}
}
fun bar(i: Int, a: U) {
fun bar(i: Int, a: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>U<!>) {
val r = if (true) i else a
val b: Any = r
}
@@ -19,7 +19,7 @@ fun test1() {
}
}
fun test2(l: List<AA>) {
fun test2(l: <!OTHER_ERROR, OTHER_ERROR!>List<AA><!>) {
l.<!UNRESOLVED_REFERENCE!>map<!> {
<!UNRESOLVED_REFERENCE!>it<!>!!
}
@@ -1,3 +1,3 @@
package typeReferenceError
class Pair<<!SYNTAX!><!>:<!UNRESOLVED_REFERENCE!>(val c: <!SYNTAX!><!SYNTAX!><!>fun<!><!SYNTAX!><!> main<!>()
class Pair<<!SYNTAX!><!>:<!UNRESOLVED_REFERENCE!>(val c: <!SYNTAX!><!SYNTAX!><!>fun<!><!SYNTAX!><!> <!OTHER_ERROR, OTHER_ERROR!>main<!><!>()
@@ -8,14 +8,14 @@ fun <T> consume(x: Foo<out T>, y: Foo<out T>) {}
fun <T> materialize() = null as T
fun test() {
consume(
materialize<<!UPPER_BOUND_VIOLATED!>Foo<Bar<ErrorType>><!>>(),
materialize<<!UPPER_BOUND_VIOLATED!>Foo<Bar<ErrorType>><!>>()
<!INAPPLICABLE_CANDIDATE!>consume<!>(
materialize<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>Foo<Bar<ErrorType>><!>>(),
materialize<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>Foo<Bar<ErrorType>><!>>()
)
<!INAPPLICABLE_CANDIDATE!>consume<!>(
materialize<<!UPPER_BOUND_VIOLATED!>Foo<Bar<ErrorType>><!>>(),
materialize<<!UPPER_BOUND_VIOLATED!>Foo<ErrorType><!>>()
materialize<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>Foo<Bar<ErrorType>><!>>(),
materialize<<!OTHER_ERROR, UPPER_BOUND_VIOLATED!>Foo<ErrorType><!>>()
)
}
@@ -19,7 +19,7 @@ public class Foo {
// FILE: test.kt
fun test(e: ErrorType) {
fun test(e: <!OTHER_ERROR, OTHER_ERROR!>ErrorType<!>) {
Foo.foo {
Sam.Result.<!INAPPLICABLE_CANDIDATE!>create<!>(e)
}
@@ -1 +1 @@
val <T : KClass<T>.something> abc
val <T : <!OTHER_ERROR!>KClass<T>.something<!>> abc
@@ -10,7 +10,7 @@ fun test1() {
}
}
fun bar(f: (A)->Unit) {}
fun bar(f: (<!OTHER_ERROR!>A<!>)->Unit) {}
fun test2() {
bar { a -> } // here we don't have 'cannot infer parameter type' error
@@ -47,18 +47,18 @@ fun test() {
val ic: I.NC = I.NC()
val ii: I.NI? = null
val bc: B.NC = B.<!UNRESOLVED_REFERENCE!>NC<!>()
val bic: B.IC = B().IC()
val bi: B.NI? = null
val bc: <!OTHER_ERROR!>B.NC<!> = B.<!UNRESOLVED_REFERENCE!>NC<!>()
val bic: <!OTHER_ERROR!>B.IC<!> = B().IC()
val bi: <!OTHER_ERROR!>B.NI?<!> = null
val cc: C.NC = C.<!UNRESOLVED_REFERENCE!>NC<!>()
val ci: C.NI? = null
val cc: <!OTHER_ERROR!>C.NC<!> = C.<!UNRESOLVED_REFERENCE!>NC<!>()
val ci: <!OTHER_ERROR!>C.NI?<!> = null
val dc: D.NC = D.<!UNRESOLVED_REFERENCE!>NC<!>()
val dic: D.IC = D().IC()
val di: D.NI? = null
val dc: <!OTHER_ERROR!>D.NC<!> = D.<!UNRESOLVED_REFERENCE!>NC<!>()
val dic: <!OTHER_ERROR!>D.IC<!> = D().IC()
val di: <!OTHER_ERROR!>D.NI?<!> = null
val kc: K.NC = K.<!UNRESOLVED_REFERENCE!>NC<!>()
val kic: K.IC = K().IC()
val ki: K.NI? = null
val kc: <!OTHER_ERROR!>K.NC<!> = K.<!UNRESOLVED_REFERENCE!>NC<!>()
val kic: <!OTHER_ERROR!>K.IC<!> = K().IC()
val ki: <!OTHER_ERROR!>K.NI?<!> = null
}
@@ -31,14 +31,14 @@ fun test() {
val ic: I.NC = I.NC()
val ii: I.NI? = null
val bc: B.NC = B.<!UNRESOLVED_REFERENCE!>NC<!>()
val bic: B.IC = B().IC()
val bi: B.NI? = null
val bc: <!OTHER_ERROR!>B.NC<!> = B.<!UNRESOLVED_REFERENCE!>NC<!>()
val bic: <!OTHER_ERROR!>B.IC<!> = B().IC()
val bi: <!OTHER_ERROR!>B.NI?<!> = null
val cc: C.NC = C.<!UNRESOLVED_REFERENCE!>NC<!>()
val ci: C.NI? = null
val cc: <!OTHER_ERROR!>C.NC<!> = C.<!UNRESOLVED_REFERENCE!>NC<!>()
val ci: <!OTHER_ERROR!>C.NI?<!> = null
val dc: D.NC = D.<!UNRESOLVED_REFERENCE!>NC<!>()
val dic: D.IC = D().IC()
val di: D.NI? = null
val dc: <!OTHER_ERROR!>D.NC<!> = D.<!UNRESOLVED_REFERENCE!>NC<!>()
val dic: <!OTHER_ERROR!>D.IC<!> = D().IC()
val di: <!OTHER_ERROR!>D.NI?<!> = null
}
@@ -3,11 +3,11 @@ interface P<U, Y>
class A<T> {
class B {
fun test() {
class C<W>() : P<W, T> {
companion object : P<W, T> {
class C<W>() : <!OTHER_ERROR!>P<W, T><!> {
companion object : <!OTHER_ERROR!>P<W, T><!> {
}
inner class D : P<W, T>
inner class D : <!OTHER_ERROR!>P<W, T><!>
}
}
}
@@ -2,7 +2,7 @@ class Foo {
companion object {
val bar = 1
fun test(a: Foo.`object`) {
fun test(a: <!OTHER_ERROR!>Foo.`object`<!>) {
}
@@ -1,4 +1,4 @@
@<!SYNTAX!><!>myAnnotation public
@<!OTHER_ERROR!><!SYNTAX!><!>myAnnotation<!> public
package illegal_modifiers
abstract class A() {
@@ -8,6 +8,6 @@ open class Base {
class Derived : Base() {
@Foo
@<!OTHER_ERROR!>Foo<!>
fun foo() = 42
}
@@ -72,28 +72,28 @@ class C : O.B() {
val n: FromCompanionC? = null
// INVISIBLE: direct superclasses themselves.
val a: A? = null
val b: B? = null
val a: <!OTHER_ERROR, OTHER_ERROR!>A?<!> = null
val b: <!OTHER_ERROR, OTHER_ERROR!>B?<!> = null
// DEPRECATED: Classifiers from companions of direct superclasses
val e: FromCompanionA? = null
val f: FromCompanionB? = null
val e: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionA?<!> = null
val f: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionB?<!> = null
// INVISIBLE: "cousin" supertypes themselves
val g: Alpha? = null
val h: Beta? = null
val i: Gamma? = null
val g: <!OTHER_ERROR, OTHER_ERROR!>Alpha?<!> = null
val h: <!OTHER_ERROR, OTHER_ERROR!>Beta?<!> = null
val i: <!OTHER_ERROR, OTHER_ERROR!>Gamma?<!> = null
// DEPRECATED: classifiers from "cousin" superclasses
val k: FromAlpha? = null
val l: FromBeta? = null
val m: FromGamma? = null
val k: <!OTHER_ERROR, OTHER_ERROR!>FromAlpha?<!> = null
val l: <!OTHER_ERROR, OTHER_ERROR!>FromBeta?<!> = null
val m: <!OTHER_ERROR, OTHER_ERROR!>FromGamma?<!> = null
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
val o: FromCompanionAlpha? = null
val p: FromCompanionBeta? = null
val q: FromCompanionGamma? = null
val o: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionAlpha?<!> = null
val p: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionBeta?<!> = null
val q: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionGamma?<!> = null
// DEPRECATED: Classifiers from supertypes of our own companion
val r: FromDelta? = null
val r: <!OTHER_ERROR, OTHER_ERROR!>FromDelta?<!> = null
}
@@ -71,28 +71,28 @@ class C : O.B() {
val n: FromCompanionC? = null
// INVISIBLE: direct superclasses themselves.
val a: A? = null
val b: B? = null
val a: <!OTHER_ERROR, OTHER_ERROR!>A?<!> = null
val b: <!OTHER_ERROR, OTHER_ERROR!>B?<!> = null
// DEPRECATED: Classifiers from companions of direct superclasses
val e: FromCompanionA? = null
val f: FromCompanionB? = null
val e: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionA?<!> = null
val f: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionB?<!> = null
// INVISIBLE: "cousin" supertypes themselves
val g: Alpha? = null
val h: Beta? = null
val i: Gamma? = null
val g: <!OTHER_ERROR, OTHER_ERROR!>Alpha?<!> = null
val h: <!OTHER_ERROR, OTHER_ERROR!>Beta?<!> = null
val i: <!OTHER_ERROR, OTHER_ERROR!>Gamma?<!> = null
// DEPRECATED: classifiers from "cousin" superclasses
val k: FromAlpha? = null
val l: FromBeta? = null
val m: FromGamma? = null
val k: <!OTHER_ERROR, OTHER_ERROR!>FromAlpha?<!> = null
val l: <!OTHER_ERROR, OTHER_ERROR!>FromBeta?<!> = null
val m: <!OTHER_ERROR, OTHER_ERROR!>FromGamma?<!> = null
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
val o: FromCompanionAlpha? = null
val p: FromCompanionBeta? = null
val q: FromCompanionGamma? = null
val o: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionAlpha?<!> = null
val p: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionBeta?<!> = null
val q: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionGamma?<!> = null
// DEPRECATED: Classifiers from supertypes of our own companion
val r: FromDelta? = null
val r: <!OTHER_ERROR, OTHER_ERROR!>FromDelta?<!> = null
}
@@ -73,28 +73,28 @@ open class C : O.B() {
open class n : FromCompanionC()
// INVISIBLE: direct superclasses themselves.
open class a : A()
open class b : B()
open class a : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>A<!>()
open class b : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>B<!>()
// DEPRECATED: Classifiers from companions of direct superclasses
open class e : FromCompanionA()
open class f : FromCompanionB()
open class e : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionA<!>()
open class f : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionB<!>()
// INVISIBLE: "cousin" supertypes themselves
open class g : Alpha()
open class h : Beta()
open class i : Gamma()
open class g : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Alpha<!>()
open class h : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Beta<!>()
open class i : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Gamma<!>()
// DEPRECATED: classifiers from "cousin" superclasses
open class k : FromAlpha()
open class l : FromBeta()
open class m : FromGamma()
open class k : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromAlpha<!>()
open class l : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromBeta<!>()
open class m : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromGamma<!>()
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
open class o : FromCompanionAlpha()
open class p : FromCompanionBeta()
open class q : FromCompanionGamma()
open class o : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionAlpha<!>()
open class p : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionBeta<!>()
open class q : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionGamma<!>()
// DEPRECATED: Classifiers from supertypes of our own companion
open class r : FromDelta()
open class r : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromDelta<!>()
}
@@ -73,28 +73,28 @@ open class C : O.B() {
open class n : FromCompanionC()
// INVISIBLE: direct superclasses themselves.
open class a : A()
open class b : B()
open class a : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>A<!>()
open class b : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>B<!>()
// DEPRECATED: Classifiers from companions of direct superclasses
open class e : FromCompanionA()
open class f : FromCompanionB()
open class e : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionA<!>()
open class f : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionB<!>()
// INVISIBLE: "cousin" supertypes themselves
open class g : Alpha()
open class h : Beta()
open class i : Gamma()
open class g : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Alpha<!>()
open class h : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Beta<!>()
open class i : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Gamma<!>()
// DEPRECATED: classifiers from "cousin" superclasses
open class k : FromAlpha()
open class l : FromBeta()
open class m : FromGamma()
open class k : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromAlpha<!>()
open class l : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromBeta<!>()
open class m : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromGamma<!>()
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
open class o : FromCompanionAlpha()
open class p : FromCompanionBeta()
open class q : FromCompanionGamma()
open class o : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionAlpha<!>()
open class p : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionBeta<!>()
open class q : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionGamma<!>()
// DEPRECATED: Classifiers from supertypes of our own companion
open class r : FromDelta()
open class r : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromDelta<!>()
}
@@ -27,7 +27,7 @@ open class Base {
}
class Derived : Base() {
fun test(javaStaticInTypePosition: Classifier) {
fun test(javaStaticInTypePosition: <!OTHER_ERROR!>Classifier<!>) {
<!UNRESOLVED_REFERENCE!>method<!>()
<!UNRESOLVED_REFERENCE!>property<!>
<!UNRESOLVED_REFERENCE!>Classifier<!>()
@@ -42,7 +42,7 @@ class Derived : Base() {
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
}
class JavaStaticInSupertypeList : Classifier() {
class JavaStaticInSupertypeList : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Classifier<!>() {
}
}
@@ -27,7 +27,7 @@ open class Base {
}
class Derived : Base() {
fun test(javaStaticInTypePosition: Classifier) {
fun test(javaStaticInTypePosition: <!OTHER_ERROR!>Classifier<!>) {
<!UNRESOLVED_REFERENCE!>method<!>()
<!UNRESOLVED_REFERENCE!>property<!>
<!UNRESOLVED_REFERENCE!>Classifier<!>()
@@ -42,7 +42,7 @@ class Derived : Base() {
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
}
class JavaStaticInSupertypeList : Classifier() {
class JavaStaticInSupertypeList : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Classifier<!>() {
}
}
@@ -1,3 +1,3 @@
class C : Base1 by <!UNRESOLVED_REFERENCE!>Base2<!>(1) {
class C : <!OTHER_ERROR, OTHER_ERROR!>Base1<!> by <!UNRESOLVED_REFERENCE!>Base2<!>(1) {
fun test() { }
}
@@ -1,9 +1,9 @@
package test
open class A {
open fun foo(a: E) {}
open fun foo(a: <!OTHER_ERROR!>E<!>) {}
}
class B : A() {
override fun foo(a: E) {}
override fun foo(a: <!OTHER_ERROR!>E<!>) {}
}
@@ -15,18 +15,18 @@ fun test1(a: A.B.<!SYNTAX!><!>): A.B.<!SYNTAX!><!> {
val aa: A.B. <!SYNTAX!>=<!><!SYNTAX!><!> null!!
}
fun test2(a: A.e.C): A.e.C {
val aa: A.e.C = null!!
fun test2(a: <!OTHER_ERROR!>A.e.C<!>): <!OTHER_ERROR!>A.e.C<!> {
val aa: <!OTHER_ERROR!>A.e.C<!> = null!!
}
fun test3(a: a.A.C): a.A.C {
val aa: a.A.C = null!!
fun test3(a: <!OTHER_ERROR!>a.A.C<!>): <!OTHER_ERROR!>a.A.C<!> {
val aa: <!OTHER_ERROR!>a.A.C<!> = null!!
}
fun test4(a: A.B.ee): A.B.ee {
val aa: A.B.ee = null!!
fun test4(a: <!OTHER_ERROR!>A.B.ee<!>): <!OTHER_ERROR!>A.B.ee<!> {
val aa: <!OTHER_ERROR!>A.B.ee<!> = null!!
}
fun test5(a: A.ee): A.ee {
val aa: A.ee = null!!
fun test5(a: <!OTHER_ERROR!>A.ee<!>): <!OTHER_ERROR!>A.ee<!> {
val aa: <!OTHER_ERROR!>A.ee<!> = null!!
}
@@ -3,5 +3,5 @@ interface G<T> {
val bar: Int
}
fun G.foo() {}
val G.bar: Int get() = 42
fun <!OTHER_ERROR!>G<!>.foo() {}
val <!OTHER_ERROR!>G<!>.bar: Int get() = 42
@@ -1,5 +1,5 @@
// !DIAGNOSTICS: -FUNCTION_DECLARATION_WITH_NO_NAME
class ClassB() {
private inner class ClassC: <!SYNTAX!>super<!><!SYNTAX!>.<!>@ClassA()<!SYNTAX!><!> {
private inner class ClassC: <!SYNTAX!>super<!><!SYNTAX!>.<!>@<!OTHER_ERROR!>ClassA<!>()<!SYNTAX!><!> {
}
}
@@ -1,5 +1,5 @@
// !WITH_NEW_INFERENCE
fun bar() {
fun <T: T?> foo() {}
fun <T: <!OTHER_ERROR!>T?<!>> foo() {}
<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
@@ -1,7 +1,7 @@
package kt402
fun getTypeChecker() : (Any)->Boolean {
{ a : Any -> a is T } // reports unsupported
{ a : Any -> a is <!OTHER_ERROR!>T<!> } // reports unsupported
}
fun f() : (Any) -> Boolean {
return { a : Any -> a is String }
@@ -18,7 +18,7 @@ import foo.View
//import foo.TextView
fun String.gah(view:View ?) {
if (view is TextView)
if (view is <!OTHER_ERROR!>TextView<!>)
view
else <!UNRESOLVED_REFERENCE!>TextView<!>() as foo.TextView
}
@@ -1,14 +1,14 @@
// KT-9620 AssertionError in checkBounds
interface E1<T : D<String>, D>
interface E1<T : <!TYPE_ARGUMENTS_NOT_ALLOWED!>D<String><!>, D>
interface A
interface B
interface D<X>
interface E2<T : D<A>, D<!SYNTAX!><<!><!SYNTAX!>B<!><!SYNTAX!>><!><!SYNTAX!>><!>
interface E2<T : <!TYPE_ARGUMENTS_NOT_ALLOWED!>D<A><!>, D<!SYNTAX!><<!><!SYNTAX!>B<!><!SYNTAX!>><!><!SYNTAX!>><!>
// KT-11354 AE from DescriptorResolver
open class L<E>()
class M<C> : L<C<C>>()
class M<C> : L<<!TYPE_ARGUMENTS_NOT_ALLOWED, TYPE_ARGUMENTS_NOT_ALLOWED, TYPE_ARGUMENTS_NOT_ALLOWED!>C<C><!>>()
@@ -1,3 +1,3 @@
class Class1<T : Class2<Class1<X>>>
class Class1<T : <!OTHER_ERROR!>Class2<Class1<X>><!>>
class Class2<T : Class1<Class2<X>>>
class Class2<T : <!OTHER_ERROR!>Class1<Class2<X>><!>>
@@ -1,6 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A<T : Nested, F: Inner, G: Interface> {
class A<T : <!OTHER_ERROR!>Nested<!>, F: <!OTHER_ERROR!>Inner<!>, G: <!OTHER_ERROR!>Interface<!>> {
class Nested
@@ -9,7 +9,7 @@ class A<T : Nested, F: Inner, G: Interface> {
interface Interface
}
class B<T, F, G> where T : Nested, F: Inner, G: Interface {
class B<T, F, G> where T : <!OTHER_ERROR!>Nested<!>, F: <!OTHER_ERROR!>Inner<!>, G: <!OTHER_ERROR!>Interface<!> {
class Nested
@@ -2,7 +2,7 @@
interface I<F, G, H>
class A(impl: Interface) : Nested(), Interface by impl, Inner, I<Nested, Interface, Inner> {
class A(impl: Interface) : <!OTHER_ERROR!>Nested<!>(), <!OTHER_ERROR!>Interface<!> by impl, <!OTHER_ERROR!>Inner<!>, <!OTHER_ERROR!>I<Nested, Interface, Inner><!> {
class Nested
@@ -3,7 +3,7 @@ interface I<F, G>
val aImpl: A.Interface
get() = null!!
object A : Nested(), Interface by aImpl, I<Nested, Interface> {
object A : <!OTHER_ERROR!>Nested<!>(), <!OTHER_ERROR!>Interface<!> by aImpl, <!OTHER_ERROR!>I<Nested, Interface><!> {
class Nested
@@ -9,19 +9,19 @@ interface B {
}
class X: A {
val a: A_ = <!UNRESOLVED_REFERENCE!>A_<!>()
val a: <!OTHER_ERROR, OTHER_ERROR!>A_<!> = <!UNRESOLVED_REFERENCE!>A_<!>()
val b: A.A_ = A.A_()
companion object {
val a: A_ = <!UNRESOLVED_REFERENCE!>A_<!>()
val a: <!OTHER_ERROR, OTHER_ERROR!>A_<!> = <!UNRESOLVED_REFERENCE!>A_<!>()
}
}
class Y: B {
val a: B_ = <!UNRESOLVED_REFERENCE!>B_<!>()
val a: <!OTHER_ERROR, OTHER_ERROR!>B_<!> = <!UNRESOLVED_REFERENCE!>B_<!>()
val b: B.B_ = B.B_()
companion object {
val b: B_ = <!UNRESOLVED_REFERENCE!>B_<!>()
val b: <!OTHER_ERROR, OTHER_ERROR!>B_<!> = <!UNRESOLVED_REFERENCE!>B_<!>()
}
}
@@ -7,14 +7,14 @@ open class A {
}
class C: A() {
val b: B = null!!
val b: <!OTHER_ERROR, OTHER_ERROR!>B<!> = null!!
init {
<!UNRESOLVED_REFERENCE!>B<!>()
}
object O {
val b: B = null!!
val b: <!OTHER_ERROR, OTHER_ERROR!>B<!> = null!!
init {
<!UNRESOLVED_REFERENCE!>B<!>()
@@ -22,7 +22,7 @@ class C: A() {
}
class K {
val b: B = null!!
val b: <!OTHER_ERROR, OTHER_ERROR!>B<!> = null!!
init {
<!UNRESOLVED_REFERENCE!>B<!>()
@@ -30,7 +30,7 @@ class C: A() {
}
inner class I {
val b: B = null!!
val b: <!OTHER_ERROR, OTHER_ERROR!>B<!> = null!!
init {
<!UNRESOLVED_REFERENCE!>B<!>()
@@ -23,7 +23,7 @@ public class C extends B implements A {
// FILE: 1.kt
class X: A {
val a_s: A_S = null!!
val a_s: <!OTHER_ERROR, OTHER_ERROR!>A_S<!> = null!!
init {
<!UNRESOLVED_REFERENCE!>A_S<!>()
@@ -32,7 +32,7 @@ class X: A {
}
object xD {
val a_: A_S = null!!
val a_: <!OTHER_ERROR, OTHER_ERROR!>A_S<!> = null!!
init {
<!UNRESOLVED_REFERENCE!>A_S<!>()
@@ -66,7 +66,7 @@ class Y: B() {
}
class Z: C() {
val a_s: A_S = null!!
val a_s: <!OTHER_ERROR, OTHER_ERROR!>A_S<!> = null!!
val b_: B_ = null!!
val b_s: B_S = null!!
@@ -77,7 +77,7 @@ class Z: C() {
}
object X {
val a_s: A_S = null!!
val a_s: <!OTHER_ERROR, OTHER_ERROR!>A_S<!> = null!!
val b_: B_ = null!!
val b_s: B_S = null!!
@@ -30,7 +30,7 @@ open class A<T> : J() {
foo()
bar()
val a: Int = baz()
val b: T = baz()
val b: <!OTHER_ERROR!>T<!> = baz()
}
}
@@ -39,14 +39,14 @@ open class A<T> : J() {
foo()
bar()
val a: Int = baz()
val b: T = baz()
val b: <!OTHER_ERROR!>T<!> = baz()
}
fun test() {
foo()
bar()
val a: Int = baz()
val b: T = baz()
val b: <!OTHER_ERROR!>T<!> = baz()
}
fun bar() {}
@@ -30,7 +30,7 @@ open class A<T> : J() {
foo()
bar()
val a: Int = baz()
val b: T = baz()
val b: <!OTHER_ERROR!>T<!> = baz()
}
}
@@ -39,14 +39,14 @@ open class A<T> : J() {
foo()
bar()
val a: Int = baz()
val b: T = baz()
val b: <!OTHER_ERROR!>T<!> = baz()
}
fun test() {
foo()
bar()
val a: Int = baz()
val b: T = baz()
val b: <!OTHER_ERROR!>T<!> = baz()
}
fun bar() {}
+1 -1
View File
@@ -10,7 +10,7 @@ import d
import d.Test
import b.d
class Some: Test()
class Some: <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Test<!>()
//FILE:b.kt
+1 -1
View File
@@ -4,7 +4,7 @@
package a
fun foo() {
val b : B = <!UNRESOLVED_REFERENCE!>B<!>() //only B() is unresolved, but in ": B" and "B.foo()" B should also be unresolved
val b : <!OTHER_ERROR!>B<!> = <!UNRESOLVED_REFERENCE!>B<!>() //only B() is unresolved, but in ": B" and "B.foo()" B should also be unresolved
<!UNRESOLVED_REFERENCE!>B<!>.<!UNRESOLVED_REFERENCE!>foo<!>()
<!UNRESOLVED_REFERENCE!>P<!>.<!UNRESOLVED_REFERENCE!>foo<!>()
@@ -2,7 +2,7 @@
class AlternatingDelegate {
var counter: Int = 0
operator fun getValue(thisRef: Any?, property: KProperty<*>): Any? =
operator fun getValue(thisRef: Any?, property: <!OTHER_ERROR!>KProperty<*><!>): Any? =
if (counter++ % 2 == 0) 42 else ""
}
@@ -2,7 +2,7 @@
class AlternatingDelegate {
var counter: Int = 0
operator fun getValue(thisRef: Any?, property: KProperty<*>): Any? =
operator fun getValue(thisRef: Any?, property: <!OTHER_ERROR!>KProperty<*><!>): Any? =
if (counter++ % 2 == 0) 42 else ""
}
@@ -1,7 +1,7 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS -UNUSED_PARAMETER
fun <T> f1(l: List1<T>): T {throw Exception()} // ERROR type here
fun <T> f1(l: List2<T>): T {throw Exception()} // ERROR type here
fun <T> f1(l: <!OTHER_ERROR!>List1<T><!>): T {throw Exception()} // ERROR type here
fun <T> f1(l: <!OTHER_ERROR!>List2<T><!>): T {throw Exception()} // ERROR type here
fun <T> f1(c: Collection<T>): T{throw Exception()}
fun <T> test(l: List<T>) {
@@ -1,3 +1,3 @@
class X : S
class X : <!OTHER_ERROR!>S<!>
fun f(l: List<X>) {}
+1 -1
View File
@@ -1,6 +1,6 @@
//KT-304: Resolve supertype reference to class anyway
open class Foo() : Bar() {
open class Foo() : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Bar<!>() {
}
open class Bar<T>() {

Some files were not shown because too many files have changed in this diff Show More