[FE 1.0] Make "Unit conversions" accessible experimental feature

This commit is contained in:
Victor Petukhov
2022-05-16 11:07:52 +02:00
parent 88d35067e3
commit bbf52e8b90
22 changed files with 82 additions and 16 deletions
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion +SuspendConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions +SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun interface SuspendRunnable {
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion +SuspendConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions +SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun interface SuspendRunnable {
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun interface KRunnable {
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun interface KRunnable {
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion +SuspendConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions +SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: suspend () -> Unit) {}
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion +SuspendConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions +SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: suspend () -> Unit) {}
@@ -0,0 +1,15 @@
fun interface Run {
fun run()
}
fun handle(run: Run) {
//...
}
val x = {
"STRING"
}
fun test() {
handle(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
}
@@ -0,0 +1,15 @@
fun interface Run {
fun run()
}
fun handle(run: Run) {
//...
}
val x = {
"STRING"
}
fun test() {
handle(<!UNSUPPORTED_FEATURE("The feature "unit conversions on arbitrary expressions" is experimental and should be enabled explicitly")!>x<!>)
}
@@ -0,0 +1,12 @@
package
public val x: () -> kotlin.String
public fun handle(/*0*/ run: Run): kotlin.Unit
public fun test(): kotlin.Unit
public fun interface Run {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public abstract fun run(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,4 +1,4 @@
// !LANGUAGE: -UnitConversion
// !LANGUAGE: -UnitConversionsOnArbitraryExpressions
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: () -> Unit) {}
@@ -1,4 +1,4 @@
// !LANGUAGE: -UnitConversion
// !LANGUAGE: -UnitConversionsOnArbitraryExpressions
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: () -> Unit) {}
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: () -> Unit) {}
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: () -> Unit) {}
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: (Int, String) -> Unit) {}
@@ -1,4 +1,4 @@
// !LANGUAGE: +UnitConversion
// !LANGUAGE: +UnitConversionsOnArbitraryExpressions
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: (Int, String) -> Unit) {}