Add configuration key to enable new inference for compiler tests

This commit is contained in:
Mikhail Zarechenskiy
2017-11-07 14:54:58 +03:00
parent 0b484771dd
commit fbbe396881
4 changed files with 8 additions and 2 deletions
@@ -204,7 +204,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> extends CLI
extraLanguageFeatures.put(LanguageFeature.Coroutines, coroutinesState); extraLanguageFeatures.put(LanguageFeature.Coroutines, coroutinesState);
} }
if (arguments.getNewInference()) { if (arguments.getNewInference() || configuration.getBoolean(CommonConfigurationKeys.USE_NEW_INFERENCE)) {
extraLanguageFeatures.put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED); extraLanguageFeatures.put(LanguageFeature.NewInference, LanguageFeature.State.ENABLED);
} }
@@ -355,6 +355,8 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
} }
private fun putAdvancedOptions(configuration: CompilerConfiguration, arguments: 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_CALL_ASSERTIONS, arguments.noCallAssertions)
configuration.put(JVMConfigurationKeys.DISABLE_RECEIVER_ASSERTIONS, arguments.noReceiverAssertions) configuration.put(JVMConfigurationKeys.DISABLE_RECEIVER_ASSERTIONS, arguments.noReceiverAssertions)
configuration.put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions) configuration.put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions)
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2015 JetBrains s.r.o. * Copyright 2010-2017 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -33,6 +33,9 @@ object CommonConfigurationKeys {
@JvmField @JvmField
val LOOKUP_TRACKER = CompilerConfigurationKey.create<LookupTracker>("lookup tracker") val LOOKUP_TRACKER = CompilerConfigurationKey.create<LookupTracker>("lookup tracker")
@JvmField
val USE_NEW_INFERENCE = CompilerConfigurationKey.create<Boolean>("use new inference")
} }
var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings var CompilerConfiguration.languageVersionSettings: LanguageVersionSettings
@@ -471,6 +471,7 @@ public class KotlinTestUtils {
public static CompilerConfiguration newConfiguration() { public static CompilerConfiguration newConfiguration() {
CompilerConfiguration configuration = new CompilerConfiguration(); CompilerConfiguration configuration = new CompilerConfiguration();
configuration.put(CommonConfigurationKeys.MODULE_NAME, TEST_MODULE_NAME); configuration.put(CommonConfigurationKeys.MODULE_NAME, TEST_MODULE_NAME);
configuration.put(CommonConfigurationKeys.USE_NEW_INFERENCE, "true".equals(System.getProperty("kotlin.ni")));
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, new MessageCollector() { configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, new MessageCollector() {
@Override @Override