1
+ package foo
2
+
3
+ // Multi-line only cases: make sure trailing commas are only supported when multi-line
4
+
5
+ trait ArgumentExprs1 { validMethod(23 , " bar" , )(Ev0 , Ev1 ) } // error // error
6
+ trait ArgumentExprs2 { validMethod(23 , " bar" )(Ev0 , Ev1 , ) } // error // error
7
+ trait ArgumentExprs3 { new ValidClass (23 , " bar" , )(Ev0 , Ev1 ) } // error // error
8
+ trait ArgumentExprs4 { new ValidClass (23 , " bar" )(Ev0 , Ev1 , ) } // error // error
9
+
10
+ trait Params1 { def f (foo : Int , bar : String , )(implicit ev0 : Ev0 , ev1 : Ev1 , ) = 1 } // error // error // error
11
+
12
+ trait Params2 { def f (foo : Int , bar : String , )(implicit ev0 : Ev0 , ev1 : Ev1 , ) = 1 } // error // error // error
13
+
14
+ trait ClassParams1 { final class C (foo : Int , bar : String , )(implicit ev0 : Ev0 , ev1 : Ev1 ) } // error
15
+ trait ClassParams2 { final class C (foo : Int , bar : String )(implicit ev0 : Ev0 , ev1 : Ev1 , ) } // error
16
+
17
+ trait SimpleExpr { (23 , " bar" , ) } // error
18
+ trait TypeArgs { def f : ValidGeneric [Int , String , ] } // error
19
+
20
+ trait TypeParamClause { type C [A , B , ] } // error
21
+ trait FunTypeParamClause { def f [A , B , ] } // error
22
+
23
+ trait SimpleType { def f : (Int , String , ) } // error
24
+ trait FunctionArgTypes { def f : (Int , String , ) => Boolean } // error
25
+
26
+ trait SimplePattern { val (foo, bar, ) = null : Any } // error
27
+
28
+ trait ImportSelectors { import foo .{ Ev0 , Ev1 , } } // error
29
+
30
+ trait Import { import foo .Ev0 , foo .Ev1 , } // error
31
+
32
+ trait ValDcl { val foo, bar, = 23 } // error
33
+
34
+ trait VarDef { var foo, bar, = _ } // error
35
+
36
+ trait PatDef { val Foo (foo), Bar (bar), = bippy } // error
37
+
38
+
39
+ // The Tuple 1 cases
40
+
41
+ // the Tuple1 value case: make sure that the possible "(23, )" syntax for Tuple1 doesn't compile to "23"
42
+ trait SimpleExpr2 { (23 , ) } // error
43
+
44
+ // the Tuple1 type case: make sure that the possible "(Int, )" syntax for Tuple1[Int] doesn't compile to "Int"
45
+ trait SimpleType2 { def f : (Int , ) } // error
46
+
47
+ // Test utilities
48
+ object `package` {
49
+ sealed trait Ev0 ; implicit object Ev0 extends Ev0
50
+ sealed trait Ev1 ; implicit object Ev1 extends Ev1
51
+
52
+ class ValidClass (foo : Int , bar : String )(implicit ev0 : Ev0 , ev1 : Ev1 )
53
+ class ValidGeneric [A , B ]
54
+ def validMethod (foo : Int , bar : String )(implicit ev0 : Ev0 , ev1 : Ev1 ): Int = 1
55
+
56
+ case class Foo (foo : Any )
57
+ case class Bar (foo : Any )
58
+ }
0 commit comments