aboutsummaryrefslogtreecommitdiff
path: root/tests/disabled/not-representable/pos/t8111.scala
blob: 04a8e20de1ea9b239f9767b04cc1cc9ccf6d3901 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// structural types, cannot represent
trait T {

  def crashy(ma: Any): Unit = {
    // okay
    val f1 = (u: Unit) => ma
    foo(f1)()
    foo((u: Unit) => ma)
    foo(0, (u: Any) => ma) apply ()

    // crash due to side effects on the onwer of the symbol in the
    // qualifier or arguments of the application during an abandoned
    // names/defaults transform. The code type checkes because of
    // autp-tupling which promotes and empty parmater list to `(): Unit`
    foo((u: Any) => ma)()

    {{(u: Any) => ma}; this}.foo(0)()

    foo({def foo = ma; 0})()

    {def foo = ma; this}.foo(0)()
  }

  def foo(f: Any): Any => Any
}