Skip to content

Instantly share code, notes, and snippets.

@missingfaktor
Created September 26, 2014 16:37
Show Gist options
  • Save missingfaktor/8bf43f09541fde7dd906 to your computer and use it in GitHub Desktop.
Save missingfaktor/8bf43f09541fde7dd906 to your computer and use it in GitHub Desktop.
scala> def foo[R <: { def f1: Int }](x: R): (R, Int) = (x, x.f1)
foo: [R <: AnyRef{def f1: Int}](x: R)(R, Int)
scala> val x = new {
| def f1 = 90
| def f2 = "hello"
| }
x: AnyRef{def f1: Int; def f2: String} = $anon$1@adeb0ee
scala> foo(x)._1.f2
res8: String = hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment