Files
kotlin-fork/compiler/testData/cfg/declarations/classesAndObjects/EnumEntryRefersCompanion.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

24 lines
1.2 KiB
Plaintext
Vendored

== EE ==
enum class EE(val x: Int) {
INSTANCE(Companion.foo()),
ANOTHER(foo());
companion object {
fun foo() = 42
}
}
---------------------
<v0>: Int NEW: magic[FAKE_INITIALIZER](val x: Int) -> <v0>
<v10>: EE.Companion NEW: magic[FAKE_INITIALIZER](companion object { fun foo() = 42 }) -> <v10>
<v1>: {<: EE} NEW: magic[FAKE_INITIALIZER](INSTANCE(Companion.foo()),) -> <v1>
<v5>: {<: EE} NEW: magic[FAKE_INITIALIZER](ANOTHER(foo());) -> <v5>
<v7>: EE.Companion NEW: magic[IMPLICIT_RECEIVER](foo()) -> <v7>
Companion <v2>: EE.Companion NEW: r(Companion) -> <v2>
foo() <v3>: Int NEW: call(foo(), foo|<v2>) -> <v3>
Companion.foo() <v3>: Int COPY
(Companion.foo()) <v4>: * NEW: call((Companion.foo()), <init>|<v3>) -> <v4>
foo <v6>: * NEW: r(foo, Companion) -> <v6>
foo() <v8>: Int NEW: call(foo(), foo|<v7>) -> <v8>
(foo()) <v9>: * NEW: call((foo()), <init>|<v8>) -> <v9>
=====================