FIR2IR: convert qualifiers to companion objects, if any

This commit is contained in:
Mikhail Glukhikh
2020-03-06 19:34:23 +03:00
parent 7ea4c20f3d
commit ed6c9e67a1
72 changed files with 11 additions and 73 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import kotlin.reflect.KProperty1
class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FILE: CompanionInitialization.java
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class C() {
companion object {
fun create() = C()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun Any.foo() = 1
class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A() {
companion object {
val value = 10
@@ -1,5 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
// EA-38323 - Illegal field modifiers in class: classObject field in C must be static and final
// EA-38323 - Illegal field modifiers in class: classObject field in C must be static and final
interface C {
companion object {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
companion object {
fun values() = "O"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TODO: Enable for JS when it supports Java class library.
// TARGET_BACKEND: JVM
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class C() {
companion object {
private fun <T> create() = C()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class C() {
companion object Foo
}
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
companion object {
val b = 0
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class Factory(p: Int)
class A {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package mult_constructors_3_bug
public open class Identifier() {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class C() {
companion object Foo {
fun create() = 3
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Foo private constructor(val param: String = "OK") {
companion object {
val s = Foo()
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
companion object {
fun Int.foo(a: Int = 1): Int {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KT-5786 NoSuchMethodError: no accessor for private fun with default arguments
class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var state: String = "Fail"
class A private constructor(x: String = "OK") {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var state: String = "Fail"
class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
companion object
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Test(val prop: String) {
companion object {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package someTest
public class Some private constructor(val v: String) {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: NATIVE
fun box(): String {
if (0.toByte().compareTo(-0.0) != 1) return "fail 1.1"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Outer {
class Nested {
companion object {
@@ -1,5 +1,4 @@
// !JVM_DEFAULT_MODE: enable
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_RUNTIME
@@ -1,5 +1,4 @@
// !LANGUAGE: +JvmFieldInInterface +NestedClassesInAnnotations
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,5 +1,4 @@
// !LANGUAGE: +JvmFieldInInterface
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: tt.kt
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var result = ""
class A {
@@ -1,5 +1,4 @@
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: withCompanionObjectBase.kt
import b.*
@@ -1,5 +1,4 @@
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: withCompanionObjectBase.kt
import b.*
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun <T> assertEquals(a: T, b: T) { if (a != b) throw AssertionError("$a != $b") }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun <T> assertEquals(a: T, b: T) { if (a != b) throw AssertionError("$a != $b") }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
var result = "OK"
class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// Inside of the companion we have to access the instance through the local Companion field,
// not by indirection through the Companion field of the enclosing class.
// Class initialization might not have finished yet.
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Test {
companion object {
fun ok() = "OK"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
abstract class Base(val fn: () -> String)
class Host {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
interface Test {
companion object {
fun ok() = "OK"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
abstract class Base(val fn: () -> String)
interface Host {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.test.assertEquals
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
public open class Outer private constructor(val s: String) {
companion object {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// See also KT-6299
public open class Outer private constructor() {
companion object {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// See also KT-6299
public open class Outer private constructor() {
companion object {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class A private constructor() {
companion object : A() {
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class My {
companion object {
val my: String = "O"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// FILE: J.java
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class My {
companion object {
private val my: String = "O"
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class My {
companion object {
private val my: String = "O"
@@ -1,5 +1,4 @@
// !LANGUAGE: +NoConstantValueAttributeForNonConstVals +JvmFieldInInterface
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class IntentionsBundle {
companion object {
fun message(key: String): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
package test
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class TestObject()
{
companion object {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Foo() {
companion object {
val bar = "OK";
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
public class A {
fun getFromClass(): Boolean {
try {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
class Class {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
import kotlin.test.*
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Foo {
companion object {
val bar: String
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
open class Bar<T>(val prop: String)
class Foo {
companion object : Bar<Foo>("OK") {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class C {
companion object {
private val s: String