Fix NPE on equals/hashCode of local function references

Anonymous classes for local function references implement their
getOwner() as "return null" currently (KT-14291). To avoid NPE in this
case, we now consider two local functions the same if their name and
signature are equal. This is incorrect in general, but unlikely to cause
major problems and is going to be fixed by KT-14291 eventually anyway

 #KT-17055
This commit is contained in:
Alexander Udalov
2017-03-29 13:04:32 +03:00
parent 8dc4fa62ac
commit 93d5f6e635
6 changed files with 45 additions and 2 deletions
@@ -0,0 +1,13 @@
// IGNORE_BACKEND: JS, NATIVE
fun box(): String {
fun bar() {}
fun baz() {}
if (!::bar.equals(::bar)) return "Fail 1"
if (::bar.hashCode() != ::bar.hashCode()) return "Fail 2"
if (::bar == ::baz) return "Fail 3"
return "OK"
}