Created
February 1, 2019 01:49
-
-
Save ZacSweers/6f716940fb97d0104b42b5e7128d167e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun String.extension(): String = removePrefix("hello") | |
val lambda: (String) -> String = { it.removePrefix("hello") } | |
val lambdaWithReceiver: String.() -> String = { removePrefix("hello") } | |
fun function(arg: (String) -> String) { | |
} | |
fun function2(arg: String.() -> String) { | |
} | |
// Which of the below do or don't compile? | |
//function(String::extension) | |
//function2(String::extension) | |
//function(lambda) | |
//function2(lambda) | |
//function(lambdaWithReceiver) | |
//function2(lambdaWithReceiver) | |
//var variable: (String) -> String = lambda | |
//variable = lambdaWithReceiver | |
//variable = String::extension | |
//var variable2: String.() -> String = lambdaWithReceiver | |
//variable2 = lambda | |
//variable2 = String::extension | |
//val assignment: String.() -> String = { arg: String -> "" } | |
//val assignment2: String.() -> String = lambda |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment