Introduce a compiler X-flag to use the builder inference by default for all calls

^KT-48622 Fixed
This commit is contained in:
Victor Petukhov
2021-09-06 12:56:00 +03:00
parent df700117c3
commit 86d8468b8b
7 changed files with 39 additions and 0 deletions
+2
View File
@@ -52,6 +52,8 @@ where advanced options include:
-Xdump-fqname FqName of declaration that should be dumped
-Xdump-perf=<path> Dump detailed performance statistics to the specified file
-Xeffect-system Enable experimental language feature: effect system
-Xenable-builder-inference Use the builder inference by default, for all calls with lambdas which can't be resolved without it.
The corresponding calls' declarations may not be marked with @BuilderInference.
-Xexpect-actual-linker Enable experimental expect/actual linker
-Xexplicit-api={strict|warning|disable}
Force compiler to report errors on all public API declarations without explicit visibility or return type.
@@ -0,0 +1,4 @@
$TESTDATA_DIR$/builderInferenceByDefault.kt
-d
$TEMP_DIR$
-Xenable-builder-inference
@@ -0,0 +1,8 @@
fun <K, V> buildMap(builderAction: MutableMap<K, V>.() -> Unit): Map<K, V> = mapOf()
fun box(): String {
val x = buildMap {
put("", "")
}
return "OK"
}
@@ -0,0 +1,7 @@
compiler/testData/cli/jvm/builderInferenceByDefault.kt:1:21: warning: parameter 'builderAction' is never used
fun <K, V> buildMap(builderAction: MutableMap<K, V>.() -> Unit): Map<K, V> = mapOf()
^
compiler/testData/cli/jvm/builderInferenceByDefault.kt:4:9: warning: variable 'x' is never used
val x = buildMap {
^
OK
+2
View File
@@ -154,6 +154,8 @@ where advanced options include:
-Xdump-fqname FqName of declaration that should be dumped
-Xdump-perf=<path> Dump detailed performance statistics to the specified file
-Xeffect-system Enable experimental language feature: effect system
-Xenable-builder-inference Use the builder inference by default, for all calls with lambdas which can't be resolved without it.
The corresponding calls' declarations may not be marked with @BuilderInference.
-Xexpect-actual-linker Enable experimental expect/actual linker
-Xexplicit-api={strict|warning|disable}
Force compiler to report errors on all public API declarations without explicit visibility or return type.