4b94eb5e2b
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.
13 lines
246 B
Plaintext
13 lines
246 B
Plaintext
// NamedFunctionDescriptor.substitute substitutes "overrides"
|
|
// this test checks it does it properly
|
|
|
|
trait Foo<P> {
|
|
fun quux(p: P, q: Int = 17) = 18
|
|
}
|
|
|
|
trait Bar<Q> : Foo<Q>
|
|
|
|
abstract class Baz() : Bar<String>
|
|
|
|
fun zz(b: Baz) = b.quux("a")
|