[FIR-TEST] Add new testdata generated after changes in previous commit

This commit is contained in:
Dmitriy Novozhilov
2019-12-11 16:16:22 +03:00
parent e9c02a1cca
commit 2536fa0cd5
4578 changed files with 104067 additions and 1 deletions
@@ -0,0 +1,4 @@
open class C : D() {
open class CC
}
open class D : C.CC()
@@ -0,0 +1,3 @@
open class E : E.EE() {
open class EE
}
@@ -0,0 +1,8 @@
open class A : B()
open class B : <!OTHER_ERROR!>A<!>()
fun <T> select(vararg xs: T): T = xs[0]
fun foo() {
val x = select(A(), B(), "foo")
}
@@ -0,0 +1,8 @@
open class A : B()
open class B : <!OTHER_ERROR!>A<!>()
fun <T> select(vararg xs: T): T = xs[0]
fun foo() {
select(A(), B())
}
@@ -0,0 +1,30 @@
interface A {
fun foo() {}
}
interface B : A, E {}
interface C : <!OTHER_ERROR!>B<!> {}
interface D : <!OTHER_ERROR!>B<!> {}
interface E : F {}
interface F : D, C {}
interface G : F {}
interface H : F {}
val a : A? = null
val b : B? = null
val c : C? = null
val d : D? = null
val e : E? = null
val f : F? = null
val g : G? = null
val h : H? = null
fun test() {
a?.foo()
b?.foo()
c?.<!UNRESOLVED_REFERENCE!>foo<!>()
d?.<!UNRESOLVED_REFERENCE!>foo<!>()
e?.<!UNRESOLVED_REFERENCE!>foo<!>()
f?.<!UNRESOLVED_REFERENCE!>foo<!>()
g?.<!UNRESOLVED_REFERENCE!>foo<!>()
h?.<!UNRESOLVED_REFERENCE!>foo<!>()
}
@@ -0,0 +1,28 @@
// FILE: A.java
public interface A extends A {
int getFoo();
}
// FILE: B.java
public class B {
interface B1 extends B2 {
int getFoo();
}
interface B2 extends B3 {
int getFoo();
}
interface B3 extends B2 {
int getFoo();
}
}
// FILE: main.kt
fun foo() {
object : A { override fun getFoo() = 1 }
object : B.B1 { override fun getFoo() = 1 }
object : B.B2 { override fun getFoo() = 1 }
object : B.B3 { override fun getFoo() = 1 }
}
@@ -0,0 +1,24 @@
// FILE: A.java
public interface A extends A.B {
interface B extends A { public int getFoo() { return 1; } }
}
// FILE: A0.java
public interface A0 extends A0.B {
interface B { public int getFoo() { return 1; } }
}
// FILE: B.java
public class B extends D {
public int getFoo() { return 1; }
public static class C {
public int getFoo() { return 1; }
}
}
// FILE: D.java
public class D extends B.C {
public int getFoo() { return 1; }
}
@@ -0,0 +1,17 @@
// FILE: A.java
interface A extends C {
void foo();
}
// FILE: B.kt
interface B : A {
fun bar()
}
// FILE: C.java
interface C extends B {
void baz();
}
@@ -0,0 +1,11 @@
// FILE: J.java
class J extends K {
void foo() {}
}
// FILE: K.kt
class K : <!AMBIGUITY!>J<!>() {
fun bar() {}
}
@@ -0,0 +1,17 @@
// FILE: I.kt
open class I : <!AMBIGUITY!>K<!>() {
fun foo() {}
}
// FILE: J.java
class J extends I {
void bar() {}
}
// FILE: K.kt
open class K : <!AMBIGUITY!>J<!>() {
fun baz() {}
}
@@ -0,0 +1,21 @@
// FILE: ExceptionTracker.kt
interface ExceptionTracker : LockBasedStorageManager.ExceptionHandlingStrategy {
}
// FILE: StorageManager.kt
interface StorageManager : ExceptionTracker {
fun foo()
}
// FILE: LockBasedStorageManager.java
class LockBasedStorageManager extends StorageManager {
interface ExceptionHandlingStrategy {
void bar();
}
@Override
void foo() {}
}
@@ -0,0 +1,12 @@
// !WITH_NEW_INFERENCE
// KT-303 Stack overflow on a cyclic class hierarchy
open class Foo() : Bar() {
val a : Int = 1
}
open class Bar() : <!OTHER_ERROR!>Foo<!>() {
}
val x : Int = Foo()
@@ -0,0 +1,5 @@
open class X<T>
class A: X<A.B>() {
class B
}
@@ -0,0 +1,22 @@
// As in KT-18514
object A : A.I {
interface I
}
// Similar to 'classIndirectlyInheritsNested.kt'
object D : E() {
open class NestedD
}
open class E : D.NestedD()
// Similar to 'twoClassesWithNestedCycle.kt'
object G : H.NestedH() {
open class NestedG
}
object H : G.NestedG() {
open class NestedH
}
@@ -0,0 +1,6 @@
open class A : B.BB() {
open class AA
}
open class B : A.AA() {
open class BB
}
@@ -0,0 +1,15 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
open class Container {
open class Base {
open fun m() {}
}
// note that Base() supertype will be resolved in scope that was created on recursion
abstract class DerivedAbstract : Base()
companion object : DerivedAbstract() {
override fun m() {}
}
}
@@ -0,0 +1,15 @@
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
open class Container {
open class Base {
open fun m() {}
}
// note that Base() supertype will be resolved in scope that was created on recursion
abstract class DerivedAbstract : Base()
companion object : DerivedAbstract() {
override fun m() {}
}
}
@@ -0,0 +1,15 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
abstract class DerivedAbstract : C.Base() {
open class Data
}
public class C {
open class Base ()
class Foo : Data()
companion object : DerivedAbstract()
}
@@ -0,0 +1,15 @@
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
abstract class DerivedAbstract : C.Base() {
open class Data
}
public class C {
open class Base ()
class Foo : Data()
companion object : DerivedAbstract()
}
@@ -0,0 +1,18 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
open class Container {
// Note that here we also have errors and diagnostics, even though there are actually no loops.
// (this is case because we can't know if there are any loops without resolving, but resolving
// itself provokes loops)
interface Base {
open fun m() {}
}
interface DerivedAbstract : Base
companion object : DerivedAbstract {
override fun m() {}
}
}
@@ -0,0 +1,18 @@
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
open class Container {
// Note that here we also have errors and diagnostics, even though there are actually no loops.
// (this is case because we can't know if there are any loops without resolving, but resolving
// itself provokes loops)
interface Base {
open fun m() {}
}
interface DerivedAbstract : Base
companion object : DerivedAbstract {
override fun m() {}
}
}
@@ -0,0 +1,20 @@
// see https://youtrack.jetbrains.com/issue/KT-21515
abstract class DerivedAbstract : C.Base() {
override abstract fun m()
}
public class C {
class Data
open class Base () {
open fun m() {}
}
// Note that Data is resolved successfully here because we don't step on error-scope
val data: Data = Data()
companion object : DerivedAbstract() {
override fun m() {}
}
}
@@ -0,0 +1,20 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
interface SomeIrrelevantInterface
// note that C.Base() supertype will be resolved in normal scope
abstract class DerivedAbstract : C.Base()
class Data
public class C {
val data: Data = Data()
// Note that any supertype of Base will be resolved in error-scope, even if it absolutely irrelevant
// to the types in cycle.
open class Base() : SomeIrrelevantInterface
companion object : DerivedAbstract()
}
@@ -0,0 +1,20 @@
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
interface SomeIrrelevantInterface
// note that C.Base() supertype will be resolved in normal scope
abstract class DerivedAbstract : C.Base()
class Data
public class C {
val data: Data = Data()
// Note that any supertype of Base will be resolved in error-scope, even if it absolutely irrelevant
// to the types in cycle.
open class Base() : SomeIrrelevantInterface
companion object : DerivedAbstract()
}
@@ -0,0 +1,58 @@
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
object WithFunctionInBase {
abstract class DerivedAbstract : C.Base()
class Data
public class C {
val data: Data = Data()
open class Base() {
fun foo(): Int = 42
}
companion object : DerivedAbstract()
}
}
object WithPropertyInBase {
// This case is very similar to previous one, but there are subtle differences from POV of implementation
abstract class DerivedAbstract : C.Base()
class Data
public class C {
open class Base() {
val foo: Int = 42
}
val data: Data = Data()
companion object : DerivedAbstract()
}
}
object WithPropertyInBaseDifferentOrder {
// This case is very similar to previous one, but there are subtle differences from POV of implementation
// Note how position of property in file affected order of resolve, and, consequently, its results and
// diagnostics.
abstract class DerivedAbstract : C.Base()
class Data
public class C {
val data: Data = Data()
open class Base() {
val foo: Int = 42
}
companion object : DerivedAbstract()
}
}
@@ -0,0 +1,64 @@
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
// see https://youtrack.jetbrains.com/issue/KT-21515
object WithFunctionInBase {
abstract class DerivedAbstract : C.Base()
class Data
public class C {
// error-scope
val data: Data = Data()
open class Base() {
// error-scope
fun foo(): Int = 42
}
companion object : DerivedAbstract()
}
}
object WithPropertyInBase {
// This case is very similar to previous one, but there are subtle differences from POV of implementation
abstract class DerivedAbstract : C.Base()
class Data
public class C {
open class Base() {
// error-scope
val foo: Int = 42
}
// error-scope
val data: Data = Data()
companion object : DerivedAbstract()
}
}
object WithPropertyInBaseDifferentOrder {
// This case is very similar to previous one, but there are subtle differences from POV of implementation
// Note how position of property in file affected order of resolve, and, consequently, its results and
// diagnostics.
abstract class DerivedAbstract : C.Base()
class Data
public class C {
// Now it is successfully resolved (vs. ErrorType like in the previous case)
val data: Data = Data()
open class Base() {
// Now it is unresolved (vs. ErrorType like in the previous case)
val foo: Int = 42
}
companion object : DerivedAbstract()
}
}
@@ -0,0 +1,17 @@
// see https://youtrack.jetbrains.com/issue/KT-21515
abstract class DerivedAbstract : C.Base()
class Data
open class C {
open class Base {
open fun m() {}
}
val field = Data()
companion object : DerivedAbstract() {
override fun m() {}
}
}