Improve diagnostics for "not yet supported in inline"
- Tell user what exactly is not supported (e.g., local inline function) - Reduce diagnostics range to a keyword or an identifier where appropriate #KT-16223 Fixed Target versions 1.1.50
This commit is contained in:
@@ -17,9 +17,9 @@ fun find(): Any? {
|
||||
}
|
||||
|
||||
fun find4(): Any? {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>inline fun visit(element: Any) {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>inline<!> fun visit(element: Any) {
|
||||
<!RETURN_NOT_ALLOWED!>return@find4<!> element
|
||||
}<!>
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
fun main(args: Array<String>) {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>inline fun a(){
|
||||
}<!>
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>inline<!> fun a(){
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<!NOTHING_TO_INLINE!>inline<!> fun inlineFun() {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE(Local functions)!>fun<!> localFun() {}
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE(Local classes)!>class<!> LocalClass {}
|
||||
}
|
||||
|
||||
fun outerFun() {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE(Local inline functions)!>inline<!> fun localInlineFun() {}
|
||||
}
|
||||
|
||||
abstract class Base {
|
||||
abstract fun withDefault(f: () -> Unit = { -> })
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
<!OVERRIDE_BY_INLINE!>override final inline fun withDefault(
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE(Functional parameters with inherited default values)!>f: () -> Unit<!>
|
||||
)<!> {}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package
|
||||
|
||||
public inline fun inlineFun(): kotlin.Unit
|
||||
public fun outerFun(): kotlin.Unit
|
||||
|
||||
public abstract class Base {
|
||||
public constructor Base()
|
||||
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 open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public abstract fun withDefault(/*0*/ f: () -> kotlin.Unit = ...): kotlin.Unit
|
||||
}
|
||||
|
||||
public final class Derived : Base {
|
||||
public constructor Derived()
|
||||
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 open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final inline override /*1*/ fun withDefault(/*0*/ f: () -> kotlin.Unit = ...): kotlin.Unit
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
|
||||
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun a() {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun<!> a() {
|
||||
val z = p()
|
||||
}<!>
|
||||
}
|
||||
a()
|
||||
}
|
||||
|
||||
inline fun <R> inlineFun(p: () -> R) {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun a() {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun<!> a() {
|
||||
<!NON_LOCAL_RETURN_NOT_ALLOWED!>p<!>()
|
||||
}<!>
|
||||
}
|
||||
a()
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,23 +1,23 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||
|
||||
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class A {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class<!> A {
|
||||
|
||||
val z = p()
|
||||
|
||||
fun a() {
|
||||
p()
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <R> inlineFun(p: () -> R) {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class A {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class<!> A {
|
||||
|
||||
val z = <!NON_LOCAL_RETURN_NOT_ALLOWED!>p<!>()
|
||||
|
||||
fun a() {
|
||||
<!NON_LOCAL_RETURN_NOT_ALLOWED!>p<!>()
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ public fun test() {
|
||||
}
|
||||
}
|
||||
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>inline fun localFun2() {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>inline<!> fun localFun2() {
|
||||
Z().localFun()
|
||||
}<!>
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,8 +4,8 @@ public fun test() {
|
||||
|
||||
}
|
||||
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>inline fun localFun2() {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>inline<!> fun localFun2() {
|
||||
localFun()
|
||||
}<!>
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -3,18 +3,18 @@
|
||||
inline val z: Int
|
||||
get() {
|
||||
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class A {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class<!> A {
|
||||
fun a() {
|
||||
class AInner {}
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
|
||||
<!LOCAL_OBJECT_NOT_ALLOWED!>object B<!>{
|
||||
<!LOCAL_OBJECT_NOT_ALLOWED!>object BInner<!> {}
|
||||
}
|
||||
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun local() {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun<!> local() {
|
||||
fun localInner() {}
|
||||
}<!>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
|
||||
inline fun unsupported() {
|
||||
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class A {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class<!> A {
|
||||
fun a() {
|
||||
class AInner {}
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
|
||||
<!LOCAL_OBJECT_NOT_ALLOWED!>object B<!>{
|
||||
<!LOCAL_OBJECT_NOT_ALLOWED!>object BInner<!> {}
|
||||
}
|
||||
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun local() {
|
||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun<!> local() {
|
||||
fun localInner() {}
|
||||
}<!>
|
||||
}
|
||||
}
|
||||
|
||||
inline fun unsupportedDefault(<!NOT_YET_SUPPORTED_IN_INLINE!>s : ()->Unit = {}<!>) {
|
||||
|
||||
Reference in New Issue
Block a user