Support OptionalExpectation (#2040)
This commit is contained in:
committed by
Nikolay Igotti
parent
88e86cbdd4
commit
d406b1b16d
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CLITool
|
||||
import org.jetbrains.kotlin.cli.common.CommonCompilerPerformanceManager
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot
|
||||
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoots
|
||||
import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR
|
||||
@@ -108,7 +109,10 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
arguments : K2NativeCompilerArguments,
|
||||
services : Services) {
|
||||
|
||||
configuration.addKotlinSourceRoots(arguments.freeArgs)
|
||||
val commonSources = arguments.commonSources?.toSet().orEmpty()
|
||||
arguments.freeArgs.forEach {
|
||||
configuration.addKotlinSourceRoot(it, it in commonSources)
|
||||
}
|
||||
|
||||
with(KonanConfigKeys) {
|
||||
with(configuration) {
|
||||
|
||||
@@ -2301,6 +2301,15 @@ task mpp_default_args(type: RunStandaloneKonanTest) {
|
||||
flags = ['-tr', '-Xmulti-platform']
|
||||
}
|
||||
|
||||
task mpp_optional_expectation(type: RunStandaloneKonanTest) {
|
||||
source = "codegen/mpp/mpp_optional_expectation.kt"
|
||||
def outputRoot = project.ext."$outputSourceSetName"
|
||||
flags = [
|
||||
'-Xmulti-platform',
|
||||
"-Xcommon-sources=${file("$outputRoot/$name/mpp_optional_expectation.kt")}"
|
||||
]
|
||||
}
|
||||
|
||||
task unit1(type: RunKonanTest) {
|
||||
goldValue = "First\nkotlin.Unit\n"
|
||||
source = "codegen/basics/unit1.kt"
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
@file:Suppress("EXPERIMENTAL_API_USAGE_ERROR")
|
||||
@OptionalExpectation
|
||||
expect annotation class Optional()
|
||||
|
||||
@Optional
|
||||
fun foo() { println(42) }
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
foo()
|
||||
}
|
||||
Reference in New Issue
Block a user