[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
open class Outer<E> {
|
||||
inner class Inner<F>
|
||||
|
||||
}
|
||||
|
||||
class Derived : Outer<String>() {
|
||||
// Inner<Int> here means Outer<String>.Inner<Int>
|
||||
fun foo(x: Inner<Int>) {}
|
||||
}
|
||||
|
||||
class A {
|
||||
companion object : Outer<String>()
|
||||
|
||||
// Does not work, could be Outer<String>.Inner<Int>
|
||||
// TODO: Should work?
|
||||
fun foo(x: Inner<Int>) {
|
||||
// Inner<Char>() call use companion as implicit receiver
|
||||
val y: Outer<String>.Inner<Char> = Inner<Char>()
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
open class Outer<E> {
|
||||
inner class Inner<F>
|
||||
|
||||
}
|
||||
|
||||
class Derived : Outer<String>() {
|
||||
// Inner<Int> here means Outer<String>.Inner<Int>
|
||||
fun foo(x: Inner<Int>) {}
|
||||
}
|
||||
|
||||
class A {
|
||||
companion object : Outer<String>()
|
||||
|
||||
// Does not work, could be Outer<String>.Inner<Int>
|
||||
// TODO: Should work?
|
||||
fun foo(x: Inner<Int>) {
|
||||
// Inner<Char>() call use companion as implicit receiver
|
||||
val y: Outer<String>.Inner<Char> = Inner<Char>()
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class A<T> {
|
||||
fun foo() {
|
||||
val q = object {
|
||||
open inner class B
|
||||
inner class C : B()
|
||||
|
||||
// No WRONG_NUMBER_OF_TYPE_ARGUMENTS should be reported on these types
|
||||
val x: B = B()
|
||||
val y: C = C()
|
||||
}
|
||||
|
||||
q.x
|
||||
q.y
|
||||
}
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY
|
||||
// !CHECK_TYPE
|
||||
open class Outer<X, Y> {
|
||||
inner class Inner<Z>
|
||||
typealias Alias<W> = Map<W, X>
|
||||
}
|
||||
|
||||
class Derived : Outer<String, Int>() {
|
||||
fun foo(): Inner<Char> = null!!
|
||||
fun baz(): Alias<Char> = null!!
|
||||
}
|
||||
|
||||
|
||||
class A : Outer<Double, Short>() {
|
||||
class B : Outer<Float, Long>() {
|
||||
fun bar(): Inner<String> = null!!
|
||||
fun x(): Alias<String> = null!!
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
Derived().foo() checkType { <!UNRESOLVED_REFERENCE!>_<!><Outer<String, Int>.Inner<Char>>() }
|
||||
Derived().baz() checkType { <!UNRESOLVED_REFERENCE!>_<!><Map<Char, String>>() }
|
||||
A.B().bar() checkType { <!UNRESOLVED_REFERENCE!>_<!><Outer<Float, Long>.Inner<String>>() }
|
||||
A.B().x() checkType { <!UNRESOLVED_REFERENCE!>_<!><Map<String, Float>>() }
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER -TOPLEVEL_TYPEALIASES_ONLY
|
||||
|
||||
class A<R1, R2, R3, R4>
|
||||
|
||||
private fun <E> foobar() = {
|
||||
open class LocalOuter<X, Y> {
|
||||
inner class LocalInner<Z> {
|
||||
fun a() = A<E, X, Y, Z>()
|
||||
}
|
||||
|
||||
typealias LocalAlias<W> = A<E, X, Y, W>
|
||||
}
|
||||
|
||||
class Derived : LocalOuter<Double, Short>() {
|
||||
fun foo(): LocalInner<Long> = null!!
|
||||
fun bar(): LocalAlias<Char> = null!!
|
||||
}
|
||||
|
||||
Derived()
|
||||
}
|
||||
|
||||
private fun noParameters() = {
|
||||
open class LocalOuter2<X, Y> {
|
||||
inner class LocalInner2<Z> {
|
||||
fun a() = A<Any, X, Y, Z>()
|
||||
}
|
||||
|
||||
typealias LocalAlias2<W> = A<Any, X, Y, W>
|
||||
}
|
||||
|
||||
class Derived2 : LocalOuter2<Double, Short>() {
|
||||
fun foo(): LocalInner2<Long> = null!!
|
||||
fun bar(): LocalAlias2<Char> = null!!
|
||||
}
|
||||
|
||||
Derived2()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
var x = foobar<String>()
|
||||
x = foobar<String>()
|
||||
|
||||
x().foo().a() checkType { <!UNRESOLVED_REFERENCE!>_<!><A<String, Double, Short, Long>>() }
|
||||
x().bar() <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><A<String, Double, Short, Char>>() }
|
||||
|
||||
x = foobar<Int>()
|
||||
|
||||
var y = noParameters()
|
||||
y = noParameters()
|
||||
|
||||
y().foo().a() checkType { <!UNRESOLVED_REFERENCE!>_<!><A<Any, Double, Short, Long>>() }
|
||||
y().bar() <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><A<Any, Double, Short, Char>>() }
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER -TOPLEVEL_TYPEALIASES_ONLY
|
||||
|
||||
class A<R1, R2, R3, R4, R5, R6>
|
||||
|
||||
class Outer<T> {
|
||||
inner class Inner<F> {
|
||||
private fun <E> foobar() = {
|
||||
open class LocalOuter<X, Y> {
|
||||
inner class LocalInner<Z> {
|
||||
fun a() = A<T, F, E, X, Y, Z>()
|
||||
}
|
||||
|
||||
typealias LocalAlias<W> = A<T, F, E, X, Y, W>
|
||||
}
|
||||
|
||||
class Derived : LocalOuter<Double, Short>() {
|
||||
fun foo(): LocalInner<Long> = null!!
|
||||
fun bar(): LocalAlias<Char> = null!!
|
||||
}
|
||||
|
||||
Derived()
|
||||
}
|
||||
|
||||
private fun noParameters() = {
|
||||
open class LocalOuter2<X, Y> {
|
||||
inner class LocalInner2<Z> {
|
||||
fun a() = A<T, F, Any, X, Y, Z>()
|
||||
}
|
||||
|
||||
typealias LocalAlias2<W> = A<T, F, Any, X, Y, W>
|
||||
}
|
||||
|
||||
class Derived2 : LocalOuter2<Double, Short>() {
|
||||
fun foo(): LocalInner2<Long> = null!!
|
||||
fun bar(): LocalAlias2<Char> = null!!
|
||||
}
|
||||
Derived2()
|
||||
}
|
||||
|
||||
fun test(z: Outer<String>.Inner<F>) {
|
||||
var x = foobar<String>()
|
||||
x = foobar<String>()
|
||||
|
||||
x().foo().a() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><A<T, F, String, Double, Short, Long>>() }
|
||||
x().bar() <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><A<T, F, String, Double, Short, Char>>() }
|
||||
|
||||
x = foobar<Int>()
|
||||
x = z.foobar<String>()
|
||||
|
||||
var y = noParameters()
|
||||
y = noParameters()
|
||||
|
||||
y().foo().a() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><A<T, F, Any, Double, Short, Long>>() }
|
||||
y().bar() <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><A<T, F, Any, Double, Short, Char>>() }
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -TOPLEVEL_TYPEALIASES_ONLY
|
||||
// !CHECK_TYPE
|
||||
open class Outer<X, Y> {
|
||||
inner class Inner<Z>
|
||||
typealias Alias<W> = Map<W, X>
|
||||
}
|
||||
|
||||
open class BaseDerived1<E, F> : Outer<F, E>()
|
||||
open class BaseDerived2<X> : BaseDerived1<String, X>()
|
||||
|
||||
class Derived : BaseDerived2<Int>() {
|
||||
fun foo(): Inner<Char> = null!!
|
||||
fun baz(): Alias<Char> = null!!
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
Derived().foo() checkType { <!UNRESOLVED_REFERENCE!>_<!><Outer<Int, String>.Inner<Char>>() }
|
||||
Derived().baz() checkType { <!UNRESOLVED_REFERENCE!>_<!><Map<Char, Int>>() }
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
interface Inv<X>
|
||||
class Outer<E> {
|
||||
inner class Inner
|
||||
|
||||
class Nested : Inv<Inner>
|
||||
object Obj : Inv<Inner>
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// !CHECK_TYPE
|
||||
open class Outer<E> {
|
||||
inner open class Inner<F> {
|
||||
inner class Inner2<D> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DerivedOuter : Outer<String>() {
|
||||
inner class DerivedInner : Inner<Int>() {
|
||||
fun foo(): Inner2<Char> = null!!
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
DerivedOuter().DerivedInner().foo() checkType { <!UNRESOLVED_REFERENCE!>_<!><Outer<String>.Inner<Int>.Inner2<Char>>() }
|
||||
}
|
||||
Reference in New Issue
Block a user