Fix synthetic method generation for extension properties

If several annotated extension properties with the same name were declared in
one class, JVM issued a ClassFormatError, since we generated a synthetic method
for each of them with the same name and signature. Make the signature of this
synthetic method depend on a receiver parameter, if a property has one
This commit is contained in:
Alexander Udalov
2013-10-09 23:09:17 +04:00
parent 806d264771
commit 2445d04338
11 changed files with 114 additions and 4 deletions
@@ -0,0 +1,14 @@
package test
annotation class IntAnno
annotation class StringAnno
annotation class DoubleAnno
[IntAnno] val Int.extension: Int
get() = this
[StringAnno] val String.extension: String
get() = this
[DoubleAnno] val Double.extension: Int
get() = 42
@@ -0,0 +1,20 @@
package test
test.DoubleAnno() internal val jet.Double.extension: jet.Int
internal fun jet.Double.<get-extension>(): jet.Int
test.IntAnno() internal val jet.Int.extension: jet.Int
internal fun jet.Int.<get-extension>(): jet.Int
test.StringAnno() internal val jet.String.extension: jet.String
internal fun jet.String.<get-extension>(): jet.String
internal final annotation class DoubleAnno : jet.Annotation {
/*primary*/ public constructor DoubleAnno()
}
internal final annotation class IntAnno : jet.Annotation {
/*primary*/ public constructor IntAnno()
}
internal final annotation class StringAnno : jet.Annotation {
/*primary*/ public constructor StringAnno()
}