Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. class MyApp {
  2.  
  3. interface X {
  4.  
  5. fun <Q : Any, A : Any> method1(argStr: String = "", argQ: Q, argH: (A) -> Unit)
  6.  
  7. fun <Q : Any, A : Any> method2(argQ: Q, argStr: String = "", argH: (A) -> Unit)
  8. }
  9.  
  10. fun test(x: X) {
  11.  
  12. /* Call to method1 does not work - the following errors are produced
  13. * Error: Kotlin: Type inference failed:
  14. * fun <Q : Any, A : Any> method1(argStr: String = ..., argQ: Q, argH: (A) -> Unit): Unit
  15. * cannot be applied to (Int,(Int) -> Unit)
  16. * Error: Kotlin: The integer literal does not conform to the expected type String
  17. * Error:(13, 20) Kotlin: No value passed for parameter 'argQ'
  18. */
  19.  
  20. x.method1(1) { res: Int -> println(res) }
  21.  
  22. /* No errors here */
  23. x.method2(1) { res: Int -> println(res) }
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement