Skip to content

Commit f108c9f

Browse files
committed
Add test
1 parent 5cdf2d6 commit f108c9f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/neg/main-functions2.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
object Test2 {
2+
@main val x = 2 // error: @main annotation cannot be applied to value x
3+
}
4+
5+
class Foo {
6+
@main def f = () // error: method f cannot be a @main method since it cannot be accessed statically
7+
}
8+
9+
@main def g(x: Int*)(y: Int*) = () // error: varargs parameter of @main method must come last
10+
11+
@main def h[T: util.FromString](x: T) = () // error: @main method cannot have type parameters

0 commit comments

Comments
 (0)