Skip to content

Commit 9da23ec

Browse files
committed
SI-9178 Test for the status quo of eta-expansion to Func0
1 parent 639e52a commit 9da23ec

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/files/pos/t9178.flags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-Xfatal-warnings -deprecation

test/files/pos/t9178.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// eta expansion to Function0 is problematic (as shown here).
2+
// Perhaps we should we deprecate it? See discussion in the comments of
3+
// on SI-9178.
4+
//
5+
// This test encodes the status quo: no deprecation.
6+
object Test {
7+
def foo(): () => String = () => ""
8+
val f: () => Any = foo
9+
10+
def main(args: Array[String]): Unit = {
11+
println(f()) // <function0>
12+
}
13+
}

0 commit comments

Comments
 (0)