KJS: don't load declarations marked by PlatformDependent annotation

#KT-17450 Fixed
This commit is contained in:
Zalim Bashorov
2017-09-11 22:24:57 +03:00
parent d7ad973843
commit 30c7f633bd
4 changed files with 17 additions and 1 deletions
@@ -0,0 +1,5 @@
fun test(m: Map<String, Int>, mm: MutableMap<Int, String>) {
m.<!UNRESOLVED_REFERENCE!>getOrDefault<!>("2", 1)
mm.<!UNRESOLVED_REFERENCE!>getOrDefault<!>(1, "2")
mm.remove(1, <!TOO_MANY_ARGUMENTS!>"2"<!>)
}
@@ -0,0 +1,3 @@
package
public fun test(/*0*/ m: kotlin.collections.Map<kotlin.String, kotlin.Int>, /*1*/ mm: kotlin.collections.MutableMap<kotlin.Int, kotlin.String>): kotlin.Unit
@@ -54,6 +54,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
doTest(fileName);
}
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/platformDependent.kt");
doTest(fileName);
}
@TestMetadata("runtimeAnnotations.kt")
public void testRuntimeAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/runtimeAnnotations.kt");
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.NotFoundClasses
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.PackageFragmentProviderImpl
import org.jetbrains.kotlin.descriptors.deserialization.PlatformDependentDeclarationFilter
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.serialization.ProtoBuf
@@ -56,7 +57,8 @@ fun createKotlinJavascriptPackageFragmentProvider(
lookupTracker,
DynamicTypeDeserializer,
emptyList(),
notFoundClasses
notFoundClasses,
platformDependentDeclarationFilter = PlatformDependentDeclarationFilter.NoPlatformDependent
)
for (packageFragment in packageFragments) {