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:
+9
@@ -0,0 +1,9 @@
|
||||
annotation class Anno
|
||||
|
||||
[Anno] val Int.foo: Int
|
||||
get() = this
|
||||
|
||||
[Anno] val String.foo: Int
|
||||
get() = 42
|
||||
|
||||
fun box() = if (42.foo == 42 && "OK".foo == 42) "OK" else "Fail"
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package test
|
||||
|
||||
annotation class IntAnno
|
||||
annotation class StringAnno
|
||||
annotation class DoubleAnno
|
||||
|
||||
class Class {
|
||||
[IntAnno] val Int.extension: Int
|
||||
get() = this
|
||||
|
||||
[StringAnno] val String.extension: String
|
||||
get() = this
|
||||
|
||||
[DoubleAnno] val Double.extension: Int
|
||||
get() = 42
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package test
|
||||
|
||||
internal final class Class {
|
||||
/*primary*/ public constructor Class()
|
||||
test.DoubleAnno() internal final val jet.Double.extension: jet.Int
|
||||
internal final fun jet.Double.<get-extension>(): jet.Int
|
||||
test.IntAnno() internal final val jet.Int.extension: jet.Int
|
||||
internal final fun jet.Int.<get-extension>(): jet.Int
|
||||
test.StringAnno() internal final val jet.String.extension: jet.String
|
||||
internal final 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()
|
||||
}
|
||||
+14
@@ -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
|
||||
+20
@@ -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()
|
||||
}
|
||||
Reference in New Issue
Block a user