Skip to content

Commit

Permalink
[IR] update testdata: better support for enum and object accesses
Browse files Browse the repository at this point in the history
  • Loading branch information
bashor authored and teamcityserver committed Nov 25, 2020
1 parent 1fd12b7 commit 5cb2572
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions compiler/testData/ir/irText/classes/enum.kt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ abstract enum class TestEnum4 : Enum<TestEnum4> {
}

override fun foo() {
println(message = TestEnum4)
println(message = TestEnum4.TEST1)
}

}
Expand All @@ -108,7 +108,7 @@ abstract enum class TestEnum4 : Enum<TestEnum4> {
}

override fun foo() {
println(message = TestEnum4)
println(message = TestEnum4.TEST2)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ annotation class TestAnn : Annotation {

}

@TestAnn(x = En)
@TestAnn(x = En.A)
fun test1() {
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@file:A(x = "File annotation")
package test

@Target(allowedTargets = [AnnotationTarget])
@Target(allowedTargets = [AnnotationTarget.FILE])
annotation class A : Annotation {
constructor(x: String) /* primary */
val x: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Target(allowedTargets = [AnnotationTarget])
@Target(allowedTargets = [AnnotationTarget.TYPEALIAS])
annotation class TestAnn : Annotation {
constructor(x: String) /* primary */
val x: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Target(allowedTargets = [AnnotationTarget])
@Target(allowedTargets = [AnnotationTarget.TYPE_PARAMETER])
annotation class Anno : Annotation {
constructor() /* primary */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract enum class X : Enum<X> {

override val value: Function0<String>
field = local fun <anonymous>(): String {
return B.<get-value2>()
return X.B.<get-value2>()
}

override get
Expand All @@ -36,6 +36,6 @@ abstract enum class X : Enum<X> {
}

fun box(): String {
return X.<get-value>().invoke()
return X.B.<get-value>().invoke()
}

Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ open enum class MyEnum : Enum<MyEnum> {

val aLambda: Function0<Unit>
field = local fun <anonymous>() {
Z.<set-counter>(<set-?> = 1)
Z.foo()
MyEnum.Z.<set-counter>(<set-?> = 1)
MyEnum.Z.foo()
}

get
Expand All @@ -44,13 +44,13 @@ open enum class MyEnum : Enum<MyEnum> {
}

init {
Z.<set-counter>(<set-?> = 1)
Z.foo()
MyEnum.Z.<set-counter>(<set-?> = 1)
MyEnum.Z.foo()
}

fun test() {
Z.<set-counter>(<set-?> = 1)
Z.foo()
MyEnum.Z.<set-counter>(<set-?> = 1)
MyEnum.Z.foo()
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fun testVariableAssignment_throws(a: A) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> x = 11
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> x = 11
true -> noWhenBranchMatchedException()
}
}
Expand All @@ -28,7 +28,7 @@ fun testStatement_empty(a: A) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
Expand All @@ -37,7 +37,7 @@ fun testParenthesized_throwsJvm(a: A) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
Expand All @@ -46,7 +46,7 @@ fun testAnnotated_throwsJvm(a: A) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
Expand All @@ -55,7 +55,7 @@ fun testExpression_throws(a: A): Int {
return { // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1
true -> noWhenBranchMatchedException()
}
}
Expand All @@ -68,7 +68,7 @@ fun testIfTheElseStatement_empty(a: A, flag: Boolean) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
Expand All @@ -82,7 +82,7 @@ fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
Expand All @@ -96,7 +96,7 @@ fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1 /*~> Unit */
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
Expand All @@ -108,7 +108,7 @@ fun testLambdaResultExpression_throws(a: A) {
return { // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A) -> 1
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1
true -> noWhenBranchMatchedException()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ val test1: Int
get

val test2: Int
field = En.invoke(i = 42)
field = En.X.invoke(i = 42)
get

2 changes: 1 addition & 1 deletion compiler/testData/ir/irText/expressions/values.kt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Z {
}

fun test1(): Enum {
return Enum
return Enum.A
}

fun test2(): A {
Expand Down
2 changes: 1 addition & 1 deletion compiler/testData/ir/irText/singletons/enumEntry.kt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ open enum class Z : Enum<Z> {
}

fun test2() {
ENTRY.test()
Z.ENTRY.test()
}

}
Expand Down
2 changes: 1 addition & 1 deletion compiler/testData/ir/irText/stubs/javaEnum.kt.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val test: JEnum
field = JEnum
field = JEnum.ONE
get

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inline fun <T : Any?> unsafeFlow(crossinline block: @ExtensionFunctionType Suspe
TODO()
}

@Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel)
@Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel.HIDDEN)
fun <T : Any?> Flow<T>.onCompletion(action: SuspendFunction1<@ParameterName(name = "cause") Throwable?, Unit>): Flow<T> {
return <this>.onCompletion<T>(action = local suspend fun FlowCollector<T>.<anonymous>(it: Throwable?) {
action.invoke(p1 = it)
Expand Down

0 comments on commit 5cb2572

Please sign in to comment.