removed AutoCastReceiver

check subtype for receiver by AutoCastUtils.isSubTypeByAutoCast directly
 #KT-4403 Fixed
 #KT-4415 Fixed
This commit is contained in:
Svetlana Isakova
2014-01-18 23:13:31 +04:00
parent 5ef320173c
commit 9ed57a5767
14 changed files with 161 additions and 179 deletions
@@ -69,12 +69,12 @@ public final class TipsManager {
info = DataFlowInfo.EMPTY;
}
List<ReceiverValue> variantsForExplicitReceiver = AutoCastUtils.getAutoCastVariants(receiverValue, context, info);
List<JetType> variantsForExplicitReceiver = AutoCastUtils.getAutoCastVariants(receiverValue, context, info);
for (ReceiverValue descriptor : variantsForExplicitReceiver) {
for (JetType variant : variantsForExplicitReceiver) {
descriptors.addAll(includeExternalCallableExtensions(
excludePrivateDescriptors(descriptor.getType().getMemberScope().getAllDescriptors()),
resolutionScope, descriptor));
excludePrivateDescriptors(variant.getMemberScope().getAllDescriptors()),
resolutionScope, receiverValue));
}
return descriptors;
+6 -6
View File
@@ -11,7 +11,7 @@ fun f9(a : A?) {
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
if (a is B) {
<info descr="Automatically cast to B">a</info>.bar()
<info descr="Automatically cast to B">a</info>.foo()
<info descr="Automatically cast to A">a</info>.foo()
}
a<info>?.</info>foo()
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
@@ -26,7 +26,7 @@ fun f9(a : A?) {
return;
}
<info descr="Automatically cast to B">a</info>.bar()
<info descr="Automatically cast to B">a</info>.foo()
<info descr="Automatically cast to A">a</info>.foo()
}
fun f10(a : A?) {
@@ -80,7 +80,7 @@ fun f12(a : A?) {
fun f13(a : A?) {
if (a is B) {
<info descr="Automatically cast to B">a</info>.foo()
<info descr="Automatically cast to A">a</info>.foo()
<info descr="Automatically cast to B">a</info>.bar()
}
else {
@@ -93,12 +93,12 @@ fun f13(a : A?) {
a<info>?.</info>foo()
}
else {
<info descr="Automatically cast to B">a</info>.foo()
<info descr="Automatically cast to A">a</info>.foo()
}
a<info>?.</info>foo()
if (a is B && <info descr="Automatically cast to B">a</info>.foo() == Unit.VALUE) {
<info descr="Automatically cast to B">a</info>.foo()
if (a is B && <info descr="Automatically cast to A">a</info>.foo() == Unit.VALUE) {
<info descr="Automatically cast to A">a</info>.foo()
<info descr="Automatically cast to B">a</info>.bar()
}
else {