Fix visibility check for dynamic members within protected method

#KT-11857 Fixed
This commit is contained in:
Denis Zharkov
2016-06-20 20:02:10 +03:00
parent 4a7a04e366
commit fe5fe63f0a
5 changed files with 25 additions and 1 deletions
@@ -0,0 +1,3 @@
public final var something: dynamic
public final fun <get-something>(): dynamic
public final fun <set-something>(/*0*/ <set-?>: dynamic): kotlin.Unit
@@ -0,0 +1,5 @@
open class Foo {
open protected fun bar(a: dynamic){
a.something
}
}
@@ -0,0 +1,9 @@
package
public open class Foo {
public constructor Foo()
protected open fun bar(/*0*/ a: dynamic): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -199,6 +199,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
doTest(fileName);
}
@TestMetadata("protected.kt")
public void testProtected() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/protected.kt");
doTest(fileName);
}
@TestMetadata("reified.kt")
public void testReified() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/reified.kt");
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.resolve.scopes.receivers.SuperCallReceiverValue;
import org.jetbrains.kotlin.resolve.scopes.receivers.ThisClassReceiver;
import org.jetbrains.kotlin.types.DynamicTypesKt;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.util.ModuleVisibilityHelper;
import org.jetbrains.kotlin.utils.CollectionsKt;
@@ -192,7 +193,7 @@ public class Visibilities {
? ((SuperCallReceiverValue) receiver).getThisType()
: receiver.getType();
return DescriptorUtils.isSubtypeOfClass(actualReceiverType, fromClass);
return DescriptorUtils.isSubtypeOfClass(actualReceiverType, fromClass) || DynamicTypesKt.isDynamic(actualReceiverType);
}
};