Make JetTypeMapper aware of SAM constructor arguments

This obsoletes 'replaceName' workaround that was present in ClosureCodegen but
missing in other crucial call sites of mapSignature, e.g. generation of
EnclosingMethod info

 #KT-6691 Fixed
This commit is contained in:
Alexander Udalov
2015-02-06 15:50:14 +03:00
parent ca2cfb9859
commit e7a744b315
5 changed files with 50 additions and 11 deletions
@@ -0,0 +1,24 @@
var lambda = {}
class A {
val prop = Runnable {
lambda = { println("") }
}
}
fun box(): String {
A().prop.run()
val javaClass = lambda.javaClass
val enclosingMethod = javaClass.getEnclosingMethod()
if (enclosingMethod?.getName() != "run") return "method: $enclosingMethod"
val enclosingClass = javaClass.getEnclosingClass()!!.getName()
if (enclosingClass != "A\$prop\$1") return "enclosing class: $enclosingClass"
val declaringClass = javaClass.getDeclaringClass()
if (declaringClass != null) return "anonymous function has a declaring class: $declaringClass"
return "OK"
}