Files
kotlin-fork/compiler/testData/cfg/declarations/classesAndObjects/ObjectEnumQualifiers.values
T
Alexander Udalov 6e410cb182 Make TypeConstructor.isFinal return false for enums
The reason is that before dc02b2e3ab and 8a0dcca957,
TypeConstructor.isFinal for some class descriptors
(DeserializedClassDescriptor, LazyJavaClassDescriptor,
MutableClassDescriptor) were implemented as `isFinalClass` (which is
`modality == FINAL && kind != ENUM_CLASS`), and all others as
`modality == FINAL` or simply true/false. This led to differences in
behavior depending on the exact instance of the class descriptor.
Now that TypeConstructor.isFinal is always `modality == FINAL`, some
tests (PseudoValueTestGenerated) fail because the finality of some type
constructors changed and these tests render final vs non-final type
constructors differently.

In this commit, TypeConstructor.isFinal is now made to behave safer,
i.e. considering enum class type constructor to be non-final (as was the
case earlier for some ClassDescriptor instances). Some diagnostics might
disappear (e.g. FINAL_UPPER_BOUND) but it doesn't look like a big deal
2017-10-18 12:45:45 +02:00

41 lines
1.3 KiB
Plaintext
Vendored

== O ==
object O {
val y = 1
}
---------------------
1 <v0>: Int NEW: r(1) -> <v0>
=====================
== E ==
enum class E(val x: Int) {
E1(0)
}
---------------------
<v0>: Int NEW: magic[FAKE_INITIALIZER](val x: Int) -> <v0>
<v1>: {<: E} NEW: magic[FAKE_INITIALIZER](E1(0)) -> <v1>
0 <v2>: Int NEW: r(0) -> <v2>
(0) <v3>: * NEW: call((0), <init>|<v2>) -> <v3>
=====================
== C ==
class C {
companion object {
val z = 2
}
}
---------------------
=====================
== foo ==
fun foo() = E1.x + O.y + C.z
---------------------
E1 <v0>: {<: E} NEW: r(E1) -> <v0>
x <v1>: Int NEW: r(x|<v0>) -> <v1>
E1.x <v1>: Int COPY
O <v2>: O NEW: r(O) -> <v2>
y <v3>: Int NEW: r(y|<v2>) -> <v3>
O.y <v3>: Int COPY
E1.x + O.y <v4>: Int NEW: call(E1.x + O.y, plus|<v1>, <v3>) -> <v4>
C <v5>: C.Companion NEW: r(C, Companion) -> <v5>
z <v6>: Int NEW: r(z|<v5>) -> <v6>
C.z <v6>: Int COPY
E1.x + O.y + C.z <v7>: Int NEW: call(E1.x + O.y + C.z, plus|<v4>, <v6>) -> <v7>
=====================