rewrite owner when copying FunctionDescriptor from supertype scope
that fixes invocation: >>> StringBuilder.length() that was compiled to >>> invokevirtual CharSequence.length() and now compiles to >>> invokevirtual StringBuilder.length() Essentially patch rewrites FunctionDescriptor.containingDeclaration when FunctionDescriptor is copied to subclass scope. FunctionDescriptor now has kind field that can be * DECLARATION (for "real" function, maybe abstract) * DELEGATION * FAKE_OVERRIDE (created for functions from supertypes) All tests pass although some parts of code are buggy and ugly. Random comments about this patch: * FunctionDescriptor.overrides point to function descriptors of supertype scopes * Filling of memberScope with supertypes is moved to OverrideResolver * ExpressionCodegen.intermediateValueForProperty must be rewritten * Patch adds not nice REDECLARATION reports (see compiler/testData/diagnostics/tests/*). Will be fixed later.
This commit is contained in:
@@ -12,7 +12,7 @@ class C() : B() {
|
||||
this.b = 123
|
||||
super.b = 23
|
||||
<!VAL_REASSIGNMENT!>this.c<!> = 34
|
||||
super.c = 3535 //repeat for 'c'
|
||||
<!VAL_REASSIGNMENT!>super.c<!> = 3535 //repeat for 'c'
|
||||
|
||||
<!VARIABLE_EXPECTED!>getInt()<!> = 12
|
||||
}
|
||||
@@ -140,4 +140,4 @@ fun Array<Int>.checkThis() {
|
||||
|
||||
abstract class Ab {
|
||||
abstract fun getArray() : Array<Int>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user