Do not serialize constructors for anonymous objects

The only client of this data is reflection, and since anonymous objects
do not have constructors in the source code, they shouldn't in
reflection as well

 #KT-20442 Fixed
This commit is contained in:
Alexander Udalov
2018-01-05 16:21:23 +01:00
parent 17fc41e0f9
commit 50c515deca
7 changed files with 8 additions and 6 deletions
@@ -18,6 +18,7 @@ fun box(): String {
assertTrue(Interface::class.constructors.isEmpty())
assertTrue(Obj::class.constructors.isEmpty())
assertTrue(C.Companion::class.constructors.isEmpty())
assertTrue(object {}::class.constructors.isEmpty())
return "OK"
}
@@ -49,11 +49,13 @@ fun box(): String {
val p4 = TwoSecondaries::class.primaryConstructor
assertNull(p4)
assertNotNull(En::class.primaryConstructor) // TODO: maybe primaryConstructor should be null for enum classes
assertNotNull(En::class.primaryConstructor)
assertNull(I::class.primaryConstructor)
assertNull(O::class.primaryConstructor)
assertNull(C.Companion::class.primaryConstructor)
assertNull(object {}::class.primaryConstructor)
return "OK"
}