Refine member scope for types with projections

Instead of erasing descriptors with conflicting substitution,
use invariant CapturedType(<projection>) as replacement for type parameter
within default member scope.

After substitution leave such types 'as is' everywhere except return types,
use common approximation for them.

 #KT-9294 In Progress
 #KT-5411 Fixed
 #KT-8647 Fixed

 #KT-9462 Fixed
 #KT-9893 Fixed
 #KT-7581 Fixed
 #KT-7296 In Progress
This commit is contained in:
Denis Zharkov
2015-12-22 14:02:55 +03:00
parent 365ff593f3
commit e2c02f825f
50 changed files with 655 additions and 60 deletions
@@ -28,10 +28,9 @@ fun main() {
checkSubtype<Outer<out CharSequence>.Inner>(outer.bar())
checkSubtype<Outer<out CharSequence>.Inner>(outer.Inner())
// Should not actually work as in Java (captured constructor type mismatch)
outer.set(outer.bar())
outer.set(outer.Inner())
outer.set(<!TYPE_MISMATCH(kotlin.Nothing; Outer<out kotlin.String>.Inner)!>outer.bar()<!>)
outer.set(<!TYPE_MISMATCH(kotlin.Nothing; Outer<out kotlin.String>.Inner)!>outer.Inner()<!>)
val x: Outer<String>.Inner = factoryString()
outer.set(x)
outer.set(<!TYPE_MISMATCH(kotlin.Nothing; Outer<kotlin.String>.Inner)!>x<!>)
}