Skip to content

Instantly share code, notes, and snippets.

@sajjadyousefnia
Created July 18, 2018 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sajjadyousefnia/0bf0868731861bcfe4340528e2b5b3ac to your computer and use it in GitHub Desktop.
Save sajjadyousefnia/0bf0868731861bcfe4340528e2b5b3ac to your computer and use it in GitHub Desktop.
class A { // implicit label @A
inner class B { // implicit label @B
fun Int.foo() { // implicit label @foo
val a = this@A // A's this
val b = this@B // B's this
val c = this // foo()'s receiver, an Int
val c1 = this@foo // foo()'s receiver, an Int
val funLit = lambda@ fun String.() {
val d = this // funLit's receiver
}
val funLit2 = { s: String ->
// foo()'s receiver, since enclosing lambda expression
// doesn't have any receiver
val d1 = this
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment