psi2ir: handle 'this' as reference to a super companion object

In super class constructor arguments, 'this' can be resolved
as a reference to a companion object of a superclass.
This breaks an assumption in psi2ir that 'this' can only refer to some
receiver from the current scope.

If 'this' refers to an 'object' (including 'companion obejct'),
and we are not inside the corresponding class scope,
then 'this' represents a reference to a singleton instance "by name"
(represented as IrGetObjectValue).
This commit is contained in:
Dmitry Petrov
2019-01-17 13:45:28 +03:00
parent 9c8188002d
commit 202e992ae3
6 changed files with 148 additions and 19 deletions
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR, JS_IR
fun WithCompanion.test(): String {
object : WithCompanion(this) {}
return "OK"