Do not return field signature if there's none in the metadata

Otherwise this code behaves incorrectly on getter-only properties: it
returns a meaningless field signature whereas the property has no field.
It's hard to come up with an example of when this could matter in
compiler code, but it's very noticeable in kotlinx-metadata-jvm

 #KT-26188 Fixed
This commit is contained in:
Alexander Udalov
2018-08-10 17:19:08 +02:00
parent 3f32e1cce9
commit 3345dc81fd
5 changed files with 63 additions and 5 deletions
+12
View File
@@ -0,0 +1,12 @@
class C(val constructorParam: String = "") {
val getterOnlyVal: Double get() = 0.0
var accessorOnlyVar: Int
get() = 1
set(value) {}
var withBackingField: String = "42"
val <T : Number> T.delegated: List<Nothing> by null
operator fun Nothing?.getValue(x: Any?, y: Any?) = emptyList<Nothing>()
}