blob: 04f59b6c5d375447321e7258239f62eacbb39ad2 [file] [log] [blame]
Jinseong Jeon3682ef42019-05-28 00:54:31 -07001// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4package unused_arg_in_lambdas_kstyle
5
6import kotlin.jvm.internal.TypeIntrinsics
7
8private var COUNT = 11
9
10private fun next() = "${COUNT++}"
11
12fun consumeTwo(l: ((x: Any?, unused: Any?) -> Any)) : Any {
13 // This can be implicitly added by kotlinc
14 TypeIntrinsics.beforeCheckcastToFunctionOfArity(l, 2)
15 return l(next(), next())
16}
17
18private fun lambdaFactory() {
19 println(consumeTwo { x, _ -> x.toString() + "-" })
20 println(consumeTwo { x, _ -> x.toString() + "*" })
21 println(consumeTwo { x, _ -> x.toString() + "+" })
22}
23
24fun main(args: Array<String>) {
25 lambdaFactory()
26}