Skip to content

Instantly share code, notes, and snippets.

@Stebalien
Forked from abreslav/sample.kt
Last active January 4, 2016 07:29
Show Gist options
  • Save Stebalien/8589423 to your computer and use it in GitHub Desktop.
Save Stebalien/8589423 to your computer and use it in GitHub Desktop.
class Bar {
fun invoke(x: Int): Int = x
}
class Foo {
val get: Bar = Bar()
}
class Baz {
public fun get(x: Int) : Int = x
}
// Compiles
fun test1 () {
Foo().get(1)
}
// Compiles
fun test2() {
Baz()[1]
}
// Does not compile
fun test3() {
Foo()[1]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment