JS: support internal visibility from friend modules
Friend modules should be provided using the -Xfriend-modules flag in the same format as -libraries. No manual configuration required for JPS, Gradle and Maven plugins. Friend modules could be switched off using the -Xfriend-modules-disabled flag. Doing that will * prevent internal declarations from being exported, * values provided by -Xfriend-modules ignored, * raise a compilation error on attemps to use internal declarations from other modules Fixes #KT-15135 and #KT-16568.
This commit is contained in:
@@ -39,10 +39,11 @@ object TopDownAnalyzerFacadeForJS {
|
||||
val context = ContextForNewModule(
|
||||
ProjectContext(config.project), Name.special("<${config.moduleId}>"), JsPlatform.builtIns, null
|
||||
)
|
||||
context.setDependencies(
|
||||
context.module.setDependencies(
|
||||
listOf(context.module) +
|
||||
config.moduleDescriptors.map { it.data } +
|
||||
listOf(JsPlatform.builtIns.builtInsModule)
|
||||
listOf(JsPlatform.builtIns.builtInsModule),
|
||||
config.friendModuleDescriptors.map { it.data }.toSet()
|
||||
)
|
||||
val trace = BindingTraceContext()
|
||||
trace.record(MODULE_KIND, context.module, config.moduleKind)
|
||||
|
||||
@@ -45,4 +45,10 @@ public class JSConfigurationKeys {
|
||||
CompilerConfigurationKey.create("fallback metadata");
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> SERIALIZE_FRAGMENTS = CompilerConfigurationKey.create("serialize fragments");
|
||||
|
||||
public static final CompilerConfigurationKey<Boolean> FRIEND_PATHS_DISABLED =
|
||||
CompilerConfigurationKey.create("disable support for friend paths");
|
||||
|
||||
public static final CompilerConfigurationKey<List<String>> FRIEND_PATHS =
|
||||
CompilerConfigurationKey.create("friend module paths");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.intellij.util.SmartList;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import kotlin.Unit;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
import kotlin.jvm.functions.Function2;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.config.*;
|
||||
@@ -63,10 +63,14 @@ public class JsConfig {
|
||||
private final LockBasedStorageManager storageManager = new LockBasedStorageManager();
|
||||
|
||||
private final List<KotlinJavascriptMetadata> metadata = new SmartList<>();
|
||||
private final List<KotlinJavascriptMetadata> friends = new SmartList<>();
|
||||
|
||||
@Nullable
|
||||
private List<JsModuleDescriptor<ModuleDescriptorImpl>> moduleDescriptors = null;
|
||||
|
||||
@Nullable
|
||||
private List<JsModuleDescriptor<ModuleDescriptorImpl>> friendModuleDescriptors = null;
|
||||
|
||||
private boolean initialized = false;
|
||||
|
||||
public JsConfig(@NotNull Project project, @NotNull CompilerConfiguration configuration) {
|
||||
@@ -99,6 +103,13 @@ public class JsConfig {
|
||||
return getConfiguration().getList(JSConfigurationKeys.LIBRARIES);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<String> getFriends() {
|
||||
if (getConfiguration().getBoolean(JSConfigurationKeys.FRIEND_PATHS_DISABLED)) return Collections.emptyList();
|
||||
return getConfiguration().getList(JSConfigurationKeys.FRIEND_PATHS);
|
||||
}
|
||||
|
||||
|
||||
public static abstract class Reporter {
|
||||
public void error(@NotNull String message) { /*Do nothing*/ }
|
||||
|
||||
@@ -109,8 +120,15 @@ public class JsConfig {
|
||||
return checkLibFilesAndReportErrors(report, null);
|
||||
}
|
||||
|
||||
private boolean checkLibFilesAndReportErrors(@NotNull JsConfig.Reporter report, @Nullable Function1<VirtualFile, Unit> action) {
|
||||
List<String> libraries = getLibraries();
|
||||
private boolean checkLibFilesAndReportErrors(@NotNull JsConfig.Reporter report, @Nullable Function2<VirtualFile, String, Unit> action) {
|
||||
return checkLibFilesAndReportErrors(getLibraries(), report, action);
|
||||
}
|
||||
|
||||
private boolean checkLibFilesAndReportErrors(
|
||||
@NotNull Collection<String> libraries,
|
||||
@NotNull JsConfig.Reporter report,
|
||||
@Nullable Function2<VirtualFile, String, Unit> action
|
||||
) {
|
||||
if (libraries.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -163,7 +181,7 @@ public class JsConfig {
|
||||
}
|
||||
|
||||
if (action != null) {
|
||||
action.invoke(file);
|
||||
action.invoke(file, path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,49 +211,85 @@ public class JsConfig {
|
||||
return moduleDescriptors;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<JsModuleDescriptor<ModuleDescriptorImpl>> getFriendModuleDescriptors() {
|
||||
init();
|
||||
if (friendModuleDescriptors != null) return friendModuleDescriptors;
|
||||
|
||||
friendModuleDescriptors = new SmartList<>();
|
||||
for (KotlinJavascriptMetadata metadataEntry : friends) {
|
||||
JsModuleDescriptor<ModuleDescriptorImpl> descriptor = createModuleDescriptor(metadataEntry);
|
||||
friendModuleDescriptors.add(descriptor);
|
||||
}
|
||||
|
||||
friendModuleDescriptors = Collections.unmodifiableList(friendModuleDescriptors);
|
||||
|
||||
return friendModuleDescriptors;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if (initialized) return;
|
||||
|
||||
if (!getLibraries().isEmpty()) {
|
||||
Function1<VirtualFile, Unit> action = file -> {
|
||||
String libraryPath = PathUtil.getLocalPath(file);
|
||||
assert libraryPath != null : "libraryPath for " + file + " should not be null";
|
||||
metadata.addAll(KotlinJavascriptMetadataUtils.loadMetadata(libraryPath));
|
||||
|
||||
return Unit.INSTANCE;
|
||||
};
|
||||
|
||||
boolean hasErrors = checkLibFilesAndReportErrors(new Reporter() {
|
||||
JsConfig.Reporter reporter = new Reporter() {
|
||||
@Override
|
||||
public void error(@NotNull String message) {
|
||||
throw new IllegalStateException(message);
|
||||
}
|
||||
}, action);
|
||||
};
|
||||
|
||||
boolean hasErrors = checkLibFilesAndReportErrors(getFriends(), reporter, (file, path) -> {
|
||||
List<KotlinJavascriptMetadata> metaList = loadMetadata(file, "friendPath");
|
||||
metadata.addAll(metaList);
|
||||
friends.addAll(metaList);
|
||||
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
|
||||
hasErrors |= checkLibFilesAndReportErrors(CollectionsKt.subtract(getLibraries(), getFriends()), reporter, (file, path) -> {
|
||||
metadata.addAll(loadMetadata(file, "libraryPath"));
|
||||
|
||||
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
assert !hasErrors : "hasErrors should be false";
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<KotlinJavascriptMetadata> loadMetadata(@NotNull VirtualFile file, @NotNull String name) {
|
||||
String libraryPath = PathUtil.getLocalPath(file);
|
||||
assert libraryPath != null : name + " for " + file + " should not be null";
|
||||
return KotlinJavascriptMetadataUtils.loadMetadata(libraryPath);
|
||||
}
|
||||
|
||||
private final IdentityHashMap<KotlinJavascriptMetadata, JsModuleDescriptor<ModuleDescriptorImpl>> factoryMap = new IdentityHashMap<>();
|
||||
|
||||
private JsModuleDescriptor<ModuleDescriptorImpl> createModuleDescriptor(KotlinJavascriptMetadata metadata) {
|
||||
LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration);
|
||||
assert metadata.getVersion().isCompatible() ||
|
||||
languageVersionSettings.isFlagEnabled(AnalysisFlags.getSkipMetadataVersionCheck()) :
|
||||
"Expected JS metadata version " + JsMetadataVersion.INSTANCE + ", but actual metadata version is " + metadata.getVersion();
|
||||
return factoryMap.computeIfAbsent(metadata, m -> {
|
||||
LanguageVersionSettings languageVersionSettings = CommonConfigurationKeysKt.getLanguageVersionSettings(configuration);
|
||||
assert m.getVersion().isCompatible() ||
|
||||
languageVersionSettings.isFlagEnabled(AnalysisFlags.getSkipMetadataVersionCheck()) :
|
||||
"Expected JS metadata version " + JsMetadataVersion.INSTANCE + ", but actual metadata version is " + m.getVersion();
|
||||
|
||||
ModuleDescriptorImpl moduleDescriptor = new ModuleDescriptorImpl(
|
||||
Name.special("<" + metadata.getModuleName() + ">"), storageManager, JsPlatform.INSTANCE.getBuiltIns()
|
||||
);
|
||||
ModuleDescriptorImpl moduleDescriptor = new ModuleDescriptorImpl(
|
||||
Name.special("<" + m.getModuleName() + ">"), storageManager, JsPlatform.INSTANCE.getBuiltIns()
|
||||
);
|
||||
|
||||
JsModuleDescriptor<PackageFragmentProvider> rawDescriptor = KotlinJavascriptSerializationUtil.readModule(
|
||||
metadata.getBody(), storageManager, moduleDescriptor,
|
||||
new CompilerDeserializationConfiguration(languageVersionSettings)
|
||||
);
|
||||
JsModuleDescriptor<PackageFragmentProvider> rawDescriptor = KotlinJavascriptSerializationUtil.readModule(
|
||||
m.getBody(), storageManager, moduleDescriptor,
|
||||
new CompilerDeserializationConfiguration(languageVersionSettings)
|
||||
);
|
||||
|
||||
PackageFragmentProvider provider = rawDescriptor.getData();
|
||||
moduleDescriptor.initialize(provider != null ? provider : PackageFragmentProvider.Empty.INSTANCE);
|
||||
PackageFragmentProvider provider = rawDescriptor.getData();
|
||||
moduleDescriptor.initialize(provider != null ? provider : PackageFragmentProvider.Empty.INSTANCE);
|
||||
|
||||
return rawDescriptor.copy(moduleDescriptor);
|
||||
return rawDescriptor.copy(moduleDescriptor);
|
||||
});
|
||||
}
|
||||
|
||||
private static void setDependencies(ModuleDescriptorImpl module, List<ModuleDescriptorImpl> modules) {
|
||||
|
||||
@@ -273,38 +273,40 @@ class NameSuggestion {
|
||||
}
|
||||
|
||||
fun mangledAndStable() = NameAndStability(getStableMangledName(baseName, encodeSignature(descriptor)), true)
|
||||
fun mangledInternal() = NameAndStability(getInternalMangledName(baseName, encodeSignature(descriptor)), true)
|
||||
fun mangledPrivate() = NameAndStability(getPrivateMangledName(baseName, descriptor), false)
|
||||
|
||||
val effectiveVisibility = descriptor.ownEffectiveVisibility
|
||||
|
||||
val containingDeclaration = descriptor.containingDeclaration
|
||||
return when (containingDeclaration) {
|
||||
is PackageFragmentDescriptor -> if (effectiveVisibility.isPublicAPI) mangledAndStable() else regularAndUnstable()
|
||||
is ClassDescriptor -> {
|
||||
is PackageFragmentDescriptor -> when {
|
||||
effectiveVisibility.isPublicAPI -> mangledAndStable()
|
||||
|
||||
effectiveVisibility == Visibilities.INTERNAL -> mangledInternal()
|
||||
|
||||
else -> regularAndUnstable()
|
||||
}
|
||||
is ClassDescriptor -> when {
|
||||
// valueOf() is created in the library with a mangled name for every enum class
|
||||
if (descriptor is FunctionDescriptor && descriptor.isEnumValueOfMethod()) return mangledAndStable()
|
||||
descriptor is FunctionDescriptor && descriptor.isEnumValueOfMethod() -> mangledAndStable()
|
||||
|
||||
// Make all public declarations stable
|
||||
if (effectiveVisibility == Visibilities.PUBLIC) {
|
||||
return mangledAndStable()
|
||||
}
|
||||
effectiveVisibility == Visibilities.PUBLIC -> mangledAndStable()
|
||||
|
||||
if (descriptor is CallableMemberDescriptor && descriptor.isOverridableOrOverrides) return mangledAndStable()
|
||||
descriptor is CallableMemberDescriptor && descriptor.isOverridableOrOverrides -> mangledAndStable()
|
||||
|
||||
// Make all protected declarations of non-final public classes stable
|
||||
if (effectiveVisibility == Visibilities.PROTECTED &&
|
||||
effectiveVisibility == Visibilities.PROTECTED &&
|
||||
!containingDeclaration.isFinalClass &&
|
||||
containingDeclaration.visibility.isPublicAPI
|
||||
) {
|
||||
return mangledAndStable()
|
||||
}
|
||||
containingDeclaration.visibility.isPublicAPI -> mangledAndStable()
|
||||
|
||||
effectiveVisibility == Visibilities.INTERNAL -> mangledInternal()
|
||||
|
||||
// Mangle (but make unstable) all non-public API of public classes
|
||||
if (containingDeclaration.visibility.isPublicAPI && !containingDeclaration.isFinalClass) {
|
||||
return mangledPrivate()
|
||||
}
|
||||
containingDeclaration.visibility.isPublicAPI && !containingDeclaration.isFinalClass -> mangledPrivate()
|
||||
|
||||
regularAndUnstable()
|
||||
else -> regularAndUnstable()
|
||||
}
|
||||
else -> {
|
||||
assert(containingDeclaration is CallableMemberDescriptor) {
|
||||
@@ -323,6 +325,11 @@ class NameSuggestion {
|
||||
return getStableMangledName(baseName, ownerName + ":" + encodeSignature(descriptor))
|
||||
}
|
||||
|
||||
fun getInternalMangledName(suggestedName: String, forCalculateId: String): String {
|
||||
val suffix = "_${mangledId("internal:" + forCalculateId)}\$"
|
||||
return suggestedName + suffix
|
||||
}
|
||||
|
||||
@JvmStatic fun getStableMangledName(suggestedName: String, forCalculateId: String): String {
|
||||
val suffix = if (forCalculateId.isEmpty()) "" else "_${mangledId(forCalculateId)}\$"
|
||||
return suggestedName + suffix
|
||||
|
||||
@@ -96,9 +96,10 @@ abstract class BasicBoxTest(
|
||||
|
||||
val generatedJsFiles = orderedModules.asReversed().mapNotNull { module ->
|
||||
val dependencies = module.dependencies.mapNotNull { modules[it]?.outputFileName(outputDir) + ".meta.js" }
|
||||
val friends = module.friends.mapNotNull { modules[it]?.outputFileName(outputDir) + ".meta.js" }
|
||||
|
||||
val outputFileName = module.outputFileName(outputDir) + ".js"
|
||||
generateJavaScriptFile(file.parent, module, outputFileName, dependencies, modules.size > 1,
|
||||
generateJavaScriptFile(file.parent, module, outputFileName, dependencies, friends, modules.size > 1,
|
||||
outputPrefixFile, outputPostfixFile, mainCallParameters)
|
||||
|
||||
if (!module.name.endsWith(OLD_MODULE_SUFFIX)) outputFileName else null
|
||||
@@ -222,6 +223,7 @@ abstract class BasicBoxTest(
|
||||
module: TestModule,
|
||||
outputFileName: String,
|
||||
dependencies: List<String>,
|
||||
friends: List<String>,
|
||||
multiModule: Boolean,
|
||||
outputPrefixFile: File?,
|
||||
outputPostfixFile: File?,
|
||||
@@ -239,7 +241,7 @@ abstract class BasicBoxTest(
|
||||
val additionalFiles = globalCommonFiles + localCommonFiles + additionalCommonFiles
|
||||
val psiFiles = createPsiFiles(testFiles + additionalFiles)
|
||||
|
||||
val config = createConfig(module, dependencies, multiModule, additionalMetadata = null)
|
||||
val config = createConfig(module, dependencies, friends, multiModule, additionalMetadata = null)
|
||||
val outputFile = File(outputFileName)
|
||||
|
||||
translateFiles(psiFiles.map(TranslationUnit::SourceFile), outputFile, config, outputPrefixFile, outputPostfixFile, mainCallParameters)
|
||||
@@ -263,7 +265,7 @@ abstract class BasicBoxTest(
|
||||
}
|
||||
|
||||
val headerFile = File(incrementalDir, HEADER_FILE)
|
||||
val recompiledConfig = createConfig(module, dependencies, multiModule, Pair(headerFile,serializedMetadata))
|
||||
val recompiledConfig = createConfig(module, dependencies, friends, multiModule, Pair(headerFile,serializedMetadata))
|
||||
val recompiledOutputFile = File(outputFile.parentFile, outputFile.nameWithoutExtension + "-recompiled.js")
|
||||
|
||||
translateFiles(allTranslationUnits, recompiledOutputFile, recompiledConfig, outputPrefixFile, outputPostfixFile,
|
||||
@@ -357,7 +359,7 @@ abstract class BasicBoxTest(
|
||||
private fun createPsiFiles(fileNames: List<String>): List<KtFile> = fileNames.map(this::createPsiFile)
|
||||
|
||||
private fun createConfig(
|
||||
module: TestModule, dependencies: List<String>, multiModule: Boolean, additionalMetadata: Pair<File, List<File>>?
|
||||
module: TestModule, dependencies: List<String>, friends: List<String>, multiModule: Boolean, additionalMetadata: Pair<File, List<File>>?
|
||||
): JsConfig {
|
||||
val configuration = environment.configuration.copy()
|
||||
|
||||
@@ -368,6 +370,7 @@ abstract class BasicBoxTest(
|
||||
}
|
||||
|
||||
configuration.put(JSConfigurationKeys.LIBRARIES, JsConfig.JS_STDLIB + JsConfig.JS_KOTLIN_TEST + dependencies)
|
||||
configuration.put(JSConfigurationKeys.FRIEND_PATHS, friends)
|
||||
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, module.name.removeSuffix(OLD_MODULE_SUFFIX))
|
||||
configuration.put(JSConfigurationKeys.MODULE_KIND, module.moduleKind)
|
||||
@@ -397,7 +400,7 @@ abstract class BasicBoxTest(
|
||||
private inner class TestFileFactoryImpl : TestFileFactory<TestModule, TestFile>, Closeable {
|
||||
var testPackage: String? = null
|
||||
val tmpDir = KotlinTestUtils.tmpDir("js-tests")
|
||||
val defaultModule = TestModule(TEST_MODULE, emptyList())
|
||||
val defaultModule = TestModule(TEST_MODULE, emptyList(), emptyList())
|
||||
|
||||
override fun createFile(module: TestModule?, fileName: String, text: String, directives: Map<String, String>): TestFile? {
|
||||
val currentModule = module ?: defaultModule
|
||||
@@ -433,8 +436,8 @@ abstract class BasicBoxTest(
|
||||
return TestFile(temporaryFile.absolutePath, currentModule, recompile = RECOMPILE_PATTERN.matcher(text).find())
|
||||
}
|
||||
|
||||
override fun createModule(name: String, dependencies: List<String>): TestModule? {
|
||||
return TestModule(name, dependencies)
|
||||
override fun createModule(name: String, dependencies: List<String>, friends: List<String>): TestModule? {
|
||||
return TestModule(name, dependencies, friends)
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
@@ -450,9 +453,11 @@ abstract class BasicBoxTest(
|
||||
|
||||
private class TestModule(
|
||||
val name: String,
|
||||
dependencies: List<String>
|
||||
dependencies: List<String>,
|
||||
friends: List<String>
|
||||
) {
|
||||
val dependencies = dependencies.toMutableList()
|
||||
val friends = friends.toMutableList()
|
||||
var moduleKind = ModuleKind.PLAIN
|
||||
var inliningDisabled = false
|
||||
val files = mutableListOf<TestFile>()
|
||||
|
||||
@@ -12072,6 +12072,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("internal.kt")
|
||||
public void testInternal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/mangling/internal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("internalOverride.kt")
|
||||
public void testInternalOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/mangling/internalOverride.kt");
|
||||
|
||||
+10
-2
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.js.backend.ast.*
|
||||
import org.jetbrains.kotlin.js.backend.ast.metadata.exportedPackage
|
||||
import org.jetbrains.kotlin.js.backend.ast.metadata.exportedTag
|
||||
import org.jetbrains.kotlin.js.backend.ast.metadata.staticRef
|
||||
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
|
||||
import org.jetbrains.kotlin.js.translate.utils.AnnotationsUtils
|
||||
import org.jetbrains.kotlin.js.translate.utils.AnnotationsUtils.isLibraryObject
|
||||
import org.jetbrains.kotlin.js.translate.utils.AnnotationsUtils.isNativeObject
|
||||
@@ -151,7 +152,14 @@ internal class DeclarationExporter(val context: StaticContext) {
|
||||
private fun JsExpression.exportStatement(declaration: DeclarationDescriptor) = JsExpressionStatement(this).also {
|
||||
it.exportedTag = context.getTag(declaration)
|
||||
}
|
||||
|
||||
private fun EffectiveVisibility.publicOrInternal(): Boolean {
|
||||
if (publicApi) return true
|
||||
if (context.config.configuration.getBoolean(JSConfigurationKeys.FRIEND_PATHS_DISABLED)) return false
|
||||
return toVisibility() == Visibilities.INTERNAL
|
||||
}
|
||||
|
||||
private fun MemberDescriptor.shouldBeExported(force: Boolean) =
|
||||
force || effectiveVisibility(checkPublishedApi = true).publicOrInternal() || AnnotationsUtils.getJsNameAnnotation(this) != null
|
||||
}
|
||||
|
||||
private fun MemberDescriptor.shouldBeExported(force: Boolean) =
|
||||
force || effectiveVisibility(checkPublishedApi = true).publicApi || AnnotationsUtils.getJsNameAnnotation(this) != null
|
||||
|
||||
@@ -214,6 +214,7 @@ val SIMPLE = "baz"
|
||||
val SIMPLE0 = "${SIMPLE}_0"
|
||||
val NATIVE = SIMPLE
|
||||
val STABLE = "baz_za3lpa$"
|
||||
val INTERNAL = "baz_kcn2v3$"
|
||||
|
||||
fun box(): String {
|
||||
testGroup = "Top Level"
|
||||
@@ -225,7 +226,7 @@ fun box(): String {
|
||||
testGroup = "Public Class"
|
||||
test(STABLE) { PublicClass().public_baz(0) }
|
||||
test(NATIVE) { PublicClass().public_baz("native") }
|
||||
test(SIMPLE0) { PublicClass().internal_baz(0) }
|
||||
test(INTERNAL) { PublicClass().internal_baz(0) }
|
||||
test(NATIVE) { PublicClass().internal_baz("native") }
|
||||
test(SIMPLE0, PublicClass().call_private_baz)
|
||||
test(NATIVE, PublicClass().call_private_native_baz)
|
||||
@@ -233,7 +234,7 @@ fun box(): String {
|
||||
testGroup = "Internal Class"
|
||||
test(STABLE) { InternalClass().public_baz(0) }
|
||||
test(NATIVE) { InternalClass().public_baz("native") }
|
||||
test(SIMPLE0) { InternalClass().internal_baz(0) }
|
||||
test(INTERNAL) { InternalClass().internal_baz(0) }
|
||||
test(NATIVE) { InternalClass().internal_baz("native") }
|
||||
test(SIMPLE0, InternalClass().call_private_baz)
|
||||
test(NATIVE, InternalClass().call_private_native_baz)
|
||||
@@ -241,7 +242,7 @@ fun box(): String {
|
||||
testGroup = "Private Class"
|
||||
test(STABLE) { PrivateClass().public_baz(0) }
|
||||
test(NATIVE) { PrivateClass().public_baz("native") }
|
||||
test(SIMPLE0) { PrivateClass().internal_baz(0) }
|
||||
test(INTERNAL) { PrivateClass().internal_baz(0) }
|
||||
test(NATIVE) { PrivateClass().internal_baz("native") }
|
||||
test(SIMPLE0, PrivateClass().call_private_baz)
|
||||
test(NATIVE, PrivateClass().call_private_native_baz)
|
||||
@@ -249,7 +250,7 @@ fun box(): String {
|
||||
testGroup = "Open Public Class"
|
||||
test(STABLE) { OpenPublicClass().public_baz(0) }
|
||||
test(NATIVE) { OpenPublicClass().public_baz("native") }
|
||||
testMangledPrivate { OpenPublicClass().internal_baz(0) }
|
||||
test(INTERNAL) { OpenPublicClass().internal_baz(0) }
|
||||
test(NATIVE) { OpenPublicClass().internal_baz("native") }
|
||||
testMangledPrivate(OpenPublicClass().call_private_baz)
|
||||
test(NATIVE, OpenPublicClass().call_private_native_baz)
|
||||
@@ -257,7 +258,7 @@ fun box(): String {
|
||||
testGroup = "Open Internal Class"
|
||||
test(STABLE) { OpenInternalClass().public_baz(0) }
|
||||
test(NATIVE) { OpenInternalClass().public_baz("native") }
|
||||
test(SIMPLE0) { OpenInternalClass().internal_baz(0) }
|
||||
test(INTERNAL) { OpenInternalClass().internal_baz(0) }
|
||||
test(NATIVE) { OpenInternalClass().internal_baz("native") }
|
||||
test(SIMPLE0, OpenInternalClass().call_private_baz)
|
||||
test(NATIVE, OpenInternalClass().call_private_native_baz)
|
||||
@@ -265,7 +266,7 @@ fun box(): String {
|
||||
testGroup = "Open Private Class"
|
||||
test(STABLE) { OpenPrivateClass().public_baz(0) }
|
||||
test(NATIVE) { OpenPrivateClass().public_baz("native") }
|
||||
test(SIMPLE0) { OpenPrivateClass().internal_baz(0) }
|
||||
test(INTERNAL) { OpenPrivateClass().internal_baz(0) }
|
||||
test(NATIVE) { OpenPrivateClass().internal_baz("native") }
|
||||
test(SIMPLE0, OpenPrivateClass().call_private_baz)
|
||||
test(NATIVE, OpenPrivateClass().call_private_native_baz)
|
||||
|
||||
@@ -14,9 +14,11 @@ fun test2(`p 1`: Int, `.p 2`: Int) = `+`(`p 1`, `.p 2`)
|
||||
fun test3(): String {
|
||||
val `#` = "K"
|
||||
class ` `(private val `::`: String) {
|
||||
internal fun `@`() = `::` + `#`
|
||||
private fun `@`() = `::` + `#`
|
||||
|
||||
operator fun invoke() = `@`()
|
||||
}
|
||||
return ` `("O").`@`()
|
||||
return ` `("O")()
|
||||
}
|
||||
|
||||
fun test4(): String {
|
||||
|
||||
Reference in New Issue
Block a user