aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/escapingRefs.scala
blob: 9e7dfe1e353e06cbe6cc205cef5030914e5c7b37 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
object O {
  class A
  class B
  def f[T](x: T, y: T): T = y

  val x: A = f(new A { }, new B { })                  // error

  val y = f({ class C { def member: Int = 1 }; new C }, { class C { def member: Int = 1 }; new C })
  val z = y.member                                    // error
}