Drop USE_NEW_INFERENCE, configure language version settings in KotlinTestUtils
This will only have effect for tests which do not use their own instance of LanguageVersionSettings though
This commit is contained in:
@@ -204,7 +204,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
|
||||
extraLanguageFeatures.put(LanguageFeature.Coroutines, coroutinesState);
|
||||
}
|
||||
|
||||
if (arguments.getNewInference() || configuration.getBoolean(CommonConfigurationKeys.USE_NEW_INFERENCE)) {
|
||||
if (arguments.getNewInference()) {
|
||||
extraLanguageFeatures.put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED);
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,6 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
|
||||
File outputFile = new File(arguments.getOutputFile());
|
||||
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, FileUtil.getNameWithoutExtension(outputFile));
|
||||
configuration.put(CommonConfigurationKeys.USE_NEW_INFERENCE, arguments.getNewInference());
|
||||
|
||||
JsConfig config = new JsConfig(project, configuration);
|
||||
JsConfig.Reporter reporter = new JsConfig.Reporter() {
|
||||
|
||||
@@ -355,8 +355,6 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
}
|
||||
|
||||
private fun putAdvancedOptions(configuration: CompilerConfiguration, arguments: K2JVMCompilerArguments) {
|
||||
configuration.put(CommonConfigurationKeys.USE_NEW_INFERENCE, arguments.newInference)
|
||||
|
||||
configuration.put(JVMConfigurationKeys.DISABLE_CALL_ASSERTIONS, arguments.noCallAssertions)
|
||||
configuration.put(JVMConfigurationKeys.DISABLE_RECEIVER_ASSERTIONS, arguments.noReceiverAssertions)
|
||||
configuration.put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions)
|
||||
|
||||
@@ -33,9 +33,6 @@ object CommonConfigurationKeys {
|
||||
|
||||
@JvmField
|
||||
val LOOKUP_TRACKER = CompilerConfigurationKey.create<LookupTracker>("lookup tracker")
|
||||
|
||||
@JvmField
|
||||
val USE_NEW_INFERENCE = CompilerConfigurationKey.create<Boolean>("use new inference")
|
||||
}
|
||||
|
||||
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
|
||||
|
||||
@@ -50,6 +50,7 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.analyzer.AnalysisResult;
|
||||
import org.jetbrains.kotlin.builtins.DefaultBuiltIns;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettings;
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys;
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation;
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity;
|
||||
@@ -58,10 +59,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||
import org.jetbrains.kotlin.cli.jvm.config.JvmContentRootsKt;
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys;
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||
import org.jetbrains.kotlin.config.ContentRootsKt;
|
||||
import org.jetbrains.kotlin.config.JVMConfigurationKeys;
|
||||
import org.jetbrains.kotlin.config.*;
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl;
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic;
|
||||
import org.jetbrains.kotlin.diagnostics.Errors;
|
||||
@@ -471,7 +469,16 @@ public class KotlinTestUtils {
|
||||
public static CompilerConfiguration newConfiguration() {
|
||||
CompilerConfiguration configuration = new CompilerConfiguration();
|
||||
configuration.put(CommonConfigurationKeys.MODULE_NAME, TEST_MODULE_NAME);
|
||||
configuration.put(CommonConfigurationKeys.USE_NEW_INFERENCE, "true".equals(System.getProperty("kotlin.ni")));
|
||||
|
||||
if ("true".equals(System.getProperty("kotlin.ni"))) {
|
||||
// Enable new inference for tests which do not declare their own language version settings
|
||||
CommonConfigurationKeysKt.setLanguageVersionSettings(configuration, new CompilerTestLanguageVersionSettings(
|
||||
Collections.emptyMap(),
|
||||
LanguageVersionSettingsImpl.DEFAULT.getApiVersion(),
|
||||
LanguageVersionSettingsImpl.DEFAULT.getLanguageVersion(),
|
||||
Collections.emptyMap()
|
||||
));
|
||||
}
|
||||
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, new MessageCollector() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user