1 /* 2 * Copyright 2021 Google LLC 3 * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 // WITH_RUNTIME 19 // TEST PROCESSOR: FunctionTypeProcessor 20 // EXPECTED: 21 // a: Function0 : true, false 22 // b: Function1 : true, false 23 // c: Function0 : true, false 24 // d: Function2 : true, false 25 // e: KFunction0 : true, false 26 // f: KSuspendFunction0 : false, true 27 // g: KFunction1 : true, false 28 // h: KSuspendFunction1 : false, true 29 // i: Function1 : true, false 30 // j: SuspendFunction1 : false, true 31 // k: SuspendFunction0 : false, true 32 // l: SuspendFunction1 : false, true 33 // m: SuspendFunction0 : false, true 34 // n: SuspendFunction2 : false, true 35 // o: KFunction0 : true, false 36 // p: KSuspendFunction0 : false, true 37 // vbar: KSuspendFunction0 : false, true 38 // vfoo: KFunction0 : true, false 39 // END 40 41 @file:Suppress("Boolean", "Byte", "Int", "Short", "Double", "Float", "Unit", "Suppress", "C") 42 43 class C { foonull44 fun foo(): Boolean = true 45 suspend fun bar(): Int = 0 46 val vfoo = ::foo 47 val vbar = ::bar 48 } 49 50 fun foo() = Unit 51 suspend fun bar() = Unit 52 53 val a: () -> Unit = TODO() 54 val b: (Int) -> Unit = TODO() 55 val c: () -> Byte = TODO() 56 val d: (Short, Float) -> Double = TODO() 57 58 val e = C().vfoo 59 val f = C().vbar 60 val g = C::foo 61 val h = C::bar 62 63 val i: Int.() -> Boolean = TODO() 64 val j: suspend Boolean.() -> Int = TODO() 65 66 val k: suspend () -> Unit = TODO() 67 val l: suspend (Int) -> Unit = TODO() 68 val m: suspend () -> Byte = TODO() 69 val n: suspend (Short, Float) -> Double = TODO() 70 71 val o = ::foo 72 val p = ::bar 73