Properly load top-level constant initializers from multifile classes

Before Kotlin 1.3-M2 we didn't write `has_field` flag for constants
 inside multifile classes. Now we write and rely on this when
 trying to load constant initializers, which is totally fine for
 binaries that were compiled with the 1.3-M2 or newer version.
 Unfortunately, constant initializers will not be loaded for old binaries.

 One way is to avoid relying on this flag, but then we'll get other
 problems (e.g. 3345dc81fd).

 Therefore, for binaries that were compiled with at least 1.3-M2 version,
 we'll rely on the flag, otherwise, we won't.
This commit is contained in:
Mikhail Zarechenskiy
2018-09-16 22:06:21 +03:00
parent 8e66dadb47
commit 7d2bc5c0f6
4 changed files with 26 additions and 11 deletions
@@ -35,6 +35,9 @@ abstract class BinaryVersion(private vararg val numbers: Int) {
else major == ourVersion.major && minor <= ourVersion.minor
}
fun isAtLeast(version: BinaryVersion): Boolean =
isAtLeast(version.major, version.minor, version.patch)
fun isAtLeast(major: Int, minor: Int, patch: Int): Boolean {
if (this.major > major) return true
if (this.major < major) return false