Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ FILE: classDeclaration.kt

public final fun funD(): R|kotlin/Int|

public final inline fun funE(): R|kotlin/String| {
local final fun funF(): R|kotlin/String| {
^funF String(funF body)
}

^funE R|<local>/funF|()
}

}
public abstract interface B : R|kotlin/Any| {
public open fun funA(): R|kotlin/String|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ class A {
}

fun funD() = 1 + 2

inline fun funE(): String {
fun funF() = "funF body"
return funF()
}
}

interface B {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FILE: constructorDeclaration.kt
public final class A : R|kotlin/Any| {
public constructor(a: R|kotlin/String|, b: R|kotlin/Int|): R|A| {
super<R|kotlin/Any|>()
}

public final val a: R|kotlin/String| = R|<local>/a|
public get(): R|kotlin/String|

public final val b: R|kotlin/Int| = R|<local>/b|
public get(): R|kotlin/Int|

public constructor(e: R|kotlin/String|): R|A| {
this<R|A|>(R|<local>/e|, Int(0))
}

public constructor(): R|A| {
this<R|A|>(String())
}

}
public final class B : R|kotlin/Any| {
private constructor(a: R|kotlin/String|, b: R|kotlin/Int|): R|B| {
super<R|kotlin/Any|>()
}

public final val a: R|kotlin/String| = R|<local>/a|
public get(): R|kotlin/String|

public final val b: R|kotlin/Int| = R|<local>/b|
public get(): R|kotlin/Int|

public constructor(e: R|kotlin/String|): R|B| {
this<R|B|>(R|<local>/e|, Int(0))
}

public constructor(): R|B| {
this<R|B|>(String())
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// RUN_PIPELINE_TILL: BACKEND
// FIR_DUMP
class A(val a: String, val b: Int) {
constructor(e: String): this(e, 0) {
val message = "Secondary constructor body"
}
constructor(): this("") {
val message = "Secondary constructor body with delegated constructor call"
}
}

class B private constructor(val a: String, val b: Int) {
constructor(e: String): this(e, 0) {
val message = "Secondary constructor body"
}
constructor(): this("") {
val message = "Secondary constructor body with delegated constructor call"
}
}

/* GENERATED_FIR_TAGS: classDeclaration, functionDeclaration, primaryConstructor, propertyDeclaration,
secondaryConstructor */
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FILE: dataClassDeclaration.kt
public final data class User : R|kotlin/Any| {
public constructor(name: R|kotlin/String|, age: R|kotlin/Int|): R|User| {
super<R|kotlin/Any|>()
}

public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|

public final val age: R|kotlin/Int| = R|<local>/age|
public get(): R|kotlin/Int|

public final operator fun component1(): R|kotlin/String|

public final operator fun component2(): R|kotlin/Int|

public final fun copy(name: R|kotlin/String| = this@R|/User|.R|/User.name|, age: R|kotlin/Int| = this@R|/User|.R|/User.age|): R|User|

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN_PIPELINE_TILL: BACKEND
// FIR_DUMP
data class User(val name: String, val age: Int)

/* GENERATED_FIR_TAGS: classDeclaration, data, primaryConstructor, propertyDeclaration */
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FILE: enumClassDeclaration.kt
public final enum class A : R|kotlin/Enum<A>| {
private constructor(): R|A| {
super<R|kotlin/Enum<A>|>()
}

public final static enum entry EAST: R|A|
public final static enum entry WEST: R|A|
public final static fun values(): R|kotlin/Array<A>|

public final static fun valueOf(value: R|kotlin/String|): R|A|

public final static val entries: R|kotlin/enums/EnumEntries<A>|
public get(): R|kotlin/enums/EnumEntries<A>|

}
public final enum class B : R|kotlin/Enum<B>| {
private constructor(): R|B| {
super<R|kotlin/Enum<B>|>()
}

public final static enum entry NORTH: R|B| = object : R|B| {
private constructor(): R|<anonymous>| {
super<R|B|>()
}

public open override fun getString(): R|kotlin/String| {
^getString String(north)
}

}

public final static enum entry SOUTH: R|B| = object : R|B| {
private constructor(): R|<anonymous>| {
super<R|B|>()
}

public open override fun getString(): R|kotlin/String| {
}

}

public abstract fun getString(): R|kotlin/String|

public final static fun values(): R|kotlin/Array<B>|

public final static fun valueOf(value: R|kotlin/String|): R|B|

public final static val entries: R|kotlin/enums/EnumEntries<B>|
public get(): R|kotlin/enums/EnumEntries<B>|

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// RUN_PIPELINE_TILL: BACKEND
// FIR_DUMP
enum class A {
EAST,
WEST
}

enum class B {
NORTH {
override fun getString() = "north"
},
SOUTH {
override fun getString(): String {
return "south"
}
};

abstract fun getString(): String
}

/* GENERATED_FIR_TAGS: enumDeclaration, enumEntry */
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,27 @@ FILE: functionDeclaration.kt

private final fun funC(): R|kotlin/String|
public final fun funD(): R|kotlin/Int|
public final inline fun funE(): R|kotlin/String| {
local final fun funF(): R|kotlin/String| {
^funF String(funF body)
}

^funE R|<local>/funF|()
}
public final inline fun funG(): R|kotlin/String| {
local final class classA : R|kotlin/Any| {
public constructor(): R|<local>/classA| {
super<R|kotlin/Any|>()
}

public final fun funH(): R|kotlin/String| {
^funH String(funH body)
}

}

lval a: R|<local>/classA| = R|<local>/classA.classA|()
^funG R|<local>/a|.R|<local>/funH|()
}
public final fun funI(): R|kotlin/Int|
public final fun funJ(): R|kotlin/String|
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract

// Public function
fun funA(): String {
return "funA body"
}

// Inline function
inline fun funB(): String {
return "funB body"
}

// Function with contract
@OptIn(ExperimentalContracts::class)
fun isNotNull(value: Any?): Boolean {
contract {
Expand All @@ -19,11 +22,38 @@ fun isNotNull(value: Any?): Boolean {
return value != null
}

// Private function
private fun funC(): String {
return "funC body"
}

// Implicit return type
fun funD() = 1 + 2

// Function inside a function
inline fun funE(): String {
fun funF(): String {
return "funF body"
}
return funF()
}

// Class inside a function
inline fun funG(): String {
class classA {
fun funH() = "funH body"
}
val a = classA()
return a.funH()
}

// Implicit type reference from another function.
fun funI() = funD()

fun funJ(): String {
inline fun funK() = "funK body"
return funK()
}

/* GENERATED_FIR_TAGS: classReference, contractConditionalEffect, contracts, functionDeclaration, inline, nullableType,
stringLiteral */
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@ FILE: objectDeclaration.kt

public final fun funD(): R|kotlin/Int|

public final inline fun funE(): R|kotlin/String| {
local final fun funF(): R|kotlin/String| {
^funF String(funF body)
}

^funE R|<local>/funF|()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ object A {
}

fun funD() = 1 + 2

inline fun funE(): String {
fun funF() = "funF body"
return funF()
}
}

/* GENERATED_FIR_TAGS: classReference, contractConditionalEffect, contracts, functionDeclaration, inline, nullableType,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FILE: propertyDeclaration.kt
public final val a: R|kotlin/String| = String(A)
public get(): R|kotlin/String|
public final val b: R|kotlin/String| = String(B)
public get(): R|kotlin/String|
public final fun getC(): R|kotlin/String|
public final val c: <ERROR TYPE REF: Cannot infer variable type without initializer / getter / delegate>
public get(): <ERROR TYPE REF: Cannot infer variable type without initializer / getter / delegate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN_PIPELINE_TILL: BACKEND
// FIR_DUMP
// Public property with explicit type
//val a: String = "A"
// Public property with implicit type
//val b = "B"
// Property with overriden getter and implicit type.
fun getC() = "C"
val c get() = getC()

/* GENERATED_FIR_TAGS: propertyDeclaration, stringLiteral */
Loading