Skip to content

Commit f8bbc39

Browse files
committed
Fixed tests
1 parent 56f0bf7 commit f8bbc39

12 files changed

+74
-69
lines changed

tests/init-global/neg/i15883.scala

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/init-global/warn/i15883.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
val a = b // warn
2+
val b = 1

tests/init-global/neg/lazy-local-val.scala renamed to tests/init-global/warn/lazy-local-val.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ object A:
55
val b = a
66
Box(b)
77

8-
val box = f(n) // error
8+
val box = f(n) // warn
99
val n = 10
1010

1111
object B:
@@ -15,5 +15,5 @@ object B:
1515
lazy val b = a
1616
Box(b)
1717

18-
val box = f(n) // error
18+
val box = f(n) // warn
1919
val n = 10
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
-- Error: tests/neg-custom-args/sourcepath2/hi/A.scala:3:6 -------------------------------------------------------------
2-
3 |class Hello { // error
1+
-- Warning: tests/neg-custom-args/sourcepath2/hi/A.scala:3:6 -----------------------------------------------------------
2+
3 |class Hello { // warn
33
| ^
44
| class Hello is in the wrong directory.
55
| It was declared to be in package <empty>
66
| But it is found in directory hi
7+
No warnings can be incurred under -Werror.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Missing `package hi`
22

3-
class Hello { // error
3+
class Hello { // warn
44
val x: Int = 1
55
}
6+
// nopos-error: werror

tests/neg/i17612b.check

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
-- Error: tests/neg/i17612b/i17612b.scala:21:15 ------------------------------------------------------------------------
2-
21 | class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // error // error / for x, y translated to private[this] x field & shadowing var Base.x, Base.y
1+
-- Warning: tests/neg/i17612b/i17612b.scala:21:15 ----------------------------------------------------------------------
2+
21 | class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y
33
| ^
44
| value x in class Derived shadows field x inherited from trait Base
5-
-- Error: tests/neg/i17612b/i17612b.scala:21:33 ------------------------------------------------------------------------
6-
21 | class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // error // error / for x, y translated to private[this] x field & shadowing var Base.x, Base.y
5+
-- Warning: tests/neg/i17612b/i17612b.scala:21:33 ----------------------------------------------------------------------
6+
21 | class Derived(x : Int, x3: Int, y: Int, z2: Int) extends BaseB, BaseC(x3), Base(x, y + 1, z2): // warn // warn / for x, y translated to private[this] x field & shadowing var Base.x, Base.y
77
| ^
88
| value y in class Derived shadows field y inherited from trait Base
9-
-- Error: tests/neg/i17612b/i17612b.scala:23:2 -------------------------------------------------------------------------
10-
23 | private val shadowed2 = 2 + 2 // error (In Scala 2 we cannot do that got the warning)
9+
-- Warning: tests/neg/i17612b/i17612b.scala:23:2 -----------------------------------------------------------------------
10+
23 | private val shadowed2 = 2 + 2 // warn (In Scala 2 we cannot do that got the warning)
1111
| ^
1212
| value shadowed2 in class Derived shadows field shadowed2 inherited from trait Base
13-
-- Error: tests/neg/i17612b/i17612b.scala:24:2 -------------------------------------------------------------------------
14-
24 | private[this] val shadowed3 = 3 + 3 // error
13+
-- Warning: tests/neg/i17612b/i17612b.scala:24:2 -----------------------------------------------------------------------
14+
24 | private[this] val shadowed3 = 3 + 3 // warn
1515
| ^
1616
| value shadowed3 in class Derived shadows field shadowed3 inherited from trait Base
17-
-- Error: tests/neg/i17612b/i17612b.scala:26:2 -------------------------------------------------------------------------
18-
26 | private val shadowed5 = 5 + 5 // error
17+
-- Warning: tests/neg/i17612b/i17612b.scala:26:2 -----------------------------------------------------------------------
18+
26 | private val shadowed5 = 5 + 5 // warn
1919
| ^
2020
| value shadowed5 in class Derived shadows field shadowed5 inherited from trait Base
21-
-- Error: tests/neg/i17612b/i17612b.scala:41:20 ------------------------------------------------------------------------
22-
41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // error // error // error
21+
-- Warning: tests/neg/i17612b/i17612b.scala:41:20 ----------------------------------------------------------------------
22+
41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn
2323
| ^
2424
| value x in class UnderDerived shadows field x inherited from trait Base
25-
-- Error: tests/neg/i17612b/i17612b.scala:41:28 ------------------------------------------------------------------------
26-
41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // error // error // error
25+
-- Warning: tests/neg/i17612b/i17612b.scala:41:28 ----------------------------------------------------------------------
26+
41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn
2727
| ^
2828
| value y in class UnderDerived shadows field y inherited from trait Base
29-
-- Error: tests/neg/i17612b/i17612b.scala:41:36 ------------------------------------------------------------------------
30-
41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // error // error // error
29+
-- Warning: tests/neg/i17612b/i17612b.scala:41:36 ----------------------------------------------------------------------
30+
41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn
3131
| ^
3232
| value z in class UnderDerived shadows field z inherited from trait Base
33+
No warnings can be incurred under -Werror.

tests/neg/i17613b.check

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,61 @@
1-
-- Error: tests/neg/i17613b/i17613b.scala:9:13 -------------------------------------------------------------------------
2-
9 | def foobar[ImTrait](in: D) = in.toString // error
3-
| ^^^^^^^
4-
| Type parameter ImTrait for method foobar shadows the type defined by trait ImTrait in object importTry
5-
-- Error: tests/neg/i17613b/i17613b.scala:10:13 ------------------------------------------------------------------------
6-
10 | type MySeq[ImTrait] = Seq[D] // error
1+
-- Warning: tests/neg/i17613b/i17613b.scala:7:18 -----------------------------------------------------------------------
2+
7 | trait Typeclass[T]
3+
| ^
4+
| Type parameter T for trait Typeclass shadows the type defined by type T in class B
5+
-- Warning: tests/neg/i17613b/i17613b.scala:10:13 ----------------------------------------------------------------------
6+
10 | def foobar[ImTrait](in: D) = in.toString // warn
7+
| ^^^^^^^
8+
| Type parameter ImTrait for method foobar shadows the type defined by trait ImTrait in object importTry
9+
-- Warning: tests/neg/i17613b/i17613b.scala:11:13 ----------------------------------------------------------------------
10+
11 | type MySeq[ImTrait] = Seq[D] // warn
711
| ^^^^^^^
812
| Type parameter ImTrait for type MySeq shadows the type defined by trait ImTrait in object importTry
9-
-- Error: tests/neg/i17613b/i17613b.scala:12:14 ------------------------------------------------------------------------
10-
12 | def foobar2[ImClass](in: D) = in.toString // error
13+
-- Warning: tests/neg/i17613b/i17613b.scala:13:14 ----------------------------------------------------------------------
14+
13 | def foobar2[ImClass](in: D) = in.toString // warn
1115
| ^^^^^^^
1216
| Type parameter ImClass for method foobar2 shadows the type defined by class ImClass in object importTry
13-
-- Error: tests/neg/i17613b/i17613b.scala:13:14 ------------------------------------------------------------------------
14-
13 | type MySeq2[ImClass] = Seq[D] // error
17+
-- Warning: tests/neg/i17613b/i17613b.scala:14:14 ----------------------------------------------------------------------
18+
14 | type MySeq2[ImClass] = Seq[D] // warn
1519
| ^^^^^^^
1620
| Type parameter ImClass for type MySeq2 shadows the type defined by class ImClass in object importTry
17-
-- Error: tests/neg/i17613b/i17613b.scala:16:24 ------------------------------------------------------------------------
18-
16 | type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B] // error
21+
-- Warning: tests/neg/i17613b/i17613b.scala:17:24 ----------------------------------------------------------------------
22+
17 | type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B]
1923
| ^^^^^^^
2024
| Type parameter ImTrait for type TypeLambda shadows the type defined by trait ImTrait in object importTry
21-
-- Error: tests/neg/i17613b/i17613b.scala:17:21 ------------------------------------------------------------------------
22-
17 | type PolyFun[A] = [ImTrait] => ImTrait => B // error
25+
-- Warning: tests/neg/i17613b/i17613b.scala:18:21 ----------------------------------------------------------------------
26+
18 | type PolyFun[A] = [ImTrait] => ImTrait => B // warn
2327
| ^^^^^^^
2428
| Type parameter ImTrait for type PolyFun shadows the type defined by trait ImTrait in object importTry
25-
-- Error: tests/neg/i17613b/i17613b.scala:23:12 ------------------------------------------------------------------------
26-
23 | class Foo[T](t: T): // error class parameter shadows some other type
29+
-- Warning: tests/neg/i17613b/i17613b.scala:24:12 ----------------------------------------------------------------------
30+
24 | class Foo[T](t: T): // warn class parameter shadows some other type
2731
| ^
2832
| Type parameter T for class Foo shadows the type defined by type T in class B
29-
-- Error: tests/neg/i17613b/i17613b.scala:27:15 ------------------------------------------------------------------------
30-
27 | def intType[List1](x: T) = x.toString() // error
33+
-- Warning: tests/neg/i17613b/i17613b.scala:28:15 ----------------------------------------------------------------------
34+
28 | def intType[List1](x: T) = x.toString() // warn
3135
| ^^^^^
3236
| Type parameter List1 for method intType shadows an explicitly renamed type : List1
33-
-- Error: tests/neg/i17613b/i17613b.scala:32:10 ------------------------------------------------------------------------
34-
32 | given [Int]: Ordering[Int]() // error
37+
-- Warning: tests/neg/i17613b/i17613b.scala:33:10 ----------------------------------------------------------------------
38+
33 | given [Int]: Typeclass[Int]() // warn
3539
| ^^^
36-
| Type parameter Int for method given_Ordering_Int shadows the type defined by class Int in package scala
37-
-- Error: tests/neg/i17613b/i17613b.scala:34:12 ------------------------------------------------------------------------
38-
34 | class C[M[List[_]]] // error List not renamed here
40+
| Type parameter Int for method given_Typeclass_Int shadows the type defined by class Int in package scala
41+
-- Warning: tests/neg/i17613b/i17613b.scala:35:12 ----------------------------------------------------------------------
42+
35 | class C[M[List[_]]] // warn List not renamed here
3943
| ^^^^^^^
4044
| Type parameter List for class C shadows the type defined by type List in package scala
41-
-- Error: tests/neg/i17613b/i17613b.scala:35:11 ------------------------------------------------------------------------
42-
35 | type E[M[Int[_]]] = Int // error
45+
-- Warning: tests/neg/i17613b/i17613b.scala:36:11 ----------------------------------------------------------------------
46+
36 | type E[M[Int[_]]] = Int // warn
4347
| ^^^^^^
4448
| Type parameter Int for type E shadows the type defined by class Int in package scala
45-
-- Error: tests/neg/i17613b/i17613b.scala:37:14 ------------------------------------------------------------------------
46-
37 | def foo[N[M[List[_]]]] = // error
49+
-- Warning: tests/neg/i17613b/i17613b.scala:38:14 ----------------------------------------------------------------------
50+
38 | def foo[N[M[List[_]]]] = // warn
4751
| ^^^^^^^
4852
| Type parameter List for method foo shadows the type defined by type List in package scala
49-
-- Error: tests/neg/i17613b/i17613b.scala:40:11 ------------------------------------------------------------------------
50-
40 | type Z[ImClassR] = Int // error
53+
-- Warning: tests/neg/i17613b/i17613b.scala:41:11 ----------------------------------------------------------------------
54+
41 | type Z[ImClassR] = Int // warn
5155
| ^^^^^^^^
5256
| Type parameter ImClassR for type Z shadows an explicitly renamed type : ImClassR
53-
-- Error: tests/neg/i17613b/i17613b.scala:41:18 ------------------------------------------------------------------------
54-
41 | class InnerCl[ImClassR] // error
57+
-- Warning: tests/neg/i17613b/i17613b.scala:42:18 ----------------------------------------------------------------------
58+
42 | class InnerCl[ImClassR] // warn
5559
| ^^^^^^^^
5660
| Type parameter ImClassR for class InnerCl shadows an explicitly renamed type : ImClassR
61+
No warnings can be incurred under -Werror.

tests/neg/i9408b.check

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
-- Error: tests/neg/i9408b/Test_2.scala:8:20 ---------------------------------------------------------------------------
3-
8 | val length: Int = "abc" // error
2+
-- Migration Warning: tests/neg/i9408b/Test_2.scala:8:20 ---------------------------------------------------------------
3+
8 | val length: Int = "abc" // warn
44
| ^^^^^
55
|The conversion (test.conversions.Conv.implicitLength : String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views.
6+
No warnings can be incurred under -Werror.

tests/neg/infix.check

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
| ^^^
44
| Alphanumeric method mop is not declared infix; it should not be used as infix operator.
55
| Instead, use method syntax .mop(...) or backticked identifier `mop`.
6-
| The latter can be rewritten automatically under -rewrite -source future-migration.
6+
| The latter can be rewritten automatically under -rewrite -source 3.4-migration.
77
-- Error: tests/neg/infix.scala:27:4 -----------------------------------------------------------------------------------
88
27 | c meth 2 // error: should not be used as infix operator
99
| ^^^^
1010
| Alphanumeric method meth is not declared infix; it should not be used as infix operator.
1111
| Instead, use method syntax .meth(...) or backticked identifier `meth`.
12-
| The latter can be rewritten automatically under -rewrite -source future-migration.
12+
| The latter can be rewritten automatically under -rewrite -source 3.4-migration.
1313
-- Error: tests/neg/infix.scala:45:14 ----------------------------------------------------------------------------------
1414
45 | val x1: Int Map String = ??? // error
1515
| ^^^
1616
| Alphanumeric type Map is not declared infix; it should not be used as infix operator.
1717
| Instead, use prefix syntax Map[...] or backticked identifier `Map`.
18-
| The latter can be rewritten automatically under -rewrite -source future-migration.
18+
| The latter can be rewritten automatically under -rewrite -source 3.4-migration.
1919
-- Error: tests/neg/infix.scala:47:14 ----------------------------------------------------------------------------------
2020
47 | val x3: Int AndC String = ??? // error
2121
| ^^^^
2222
| Alphanumeric type AndC is not declared infix; it should not be used as infix operator.
2323
| Instead, use prefix syntax AndC[...] or backticked identifier `AndC`.
24-
| The latter can be rewritten automatically under -rewrite -source future-migration.
24+
| The latter can be rewritten automatically under -rewrite -source 3.4-migration.
2525
-- Error: tests/neg/infix.scala:61:8 -----------------------------------------------------------------------------------
2626
61 | val _ Pair _ = p // error
2727
| ^^^^
2828
| Alphanumeric extractor Pair is not declared infix; it should not be used as infix operator.
2929
| Instead, use prefix syntax Pair(...) or backticked identifier `Pair`.
30-
| The latter can be rewritten automatically under -rewrite -source future-migration.
30+
| The latter can be rewritten automatically under -rewrite -source 3.4-migration.
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
//> using options -Werror
2-
31
import language.`3.4`
42

53
class Foo:
64
def x(i: Int) = i
75
infix def y(i: Int) = i
86

97
def test(foo: Foo): Unit =
10-
foo x 1 // error (because it was compiled with 3.4+)
8+
foo x 1 // warn (because it was compiled with 3.4+)
119
foo y 2 // ok: is marked as infix

tests/neg/alphanumeric-infix-operator.check renamed to tests/warn/alphanumeric-infix-operator.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- Error: tests/neg/alphanumeric-infix-operator.scala:8:6 --------------------------------------------------------------
2-
8 | foo x 1 // error (because it was compiled with 3.4+)
1+
-- Warning: tests/warn/alphanumeric-infix-operator.scala:6:6 -----------------------------------------------------------
2+
6 | foo x 1 // warn (because it was compiled with 3.4+)
33
| ^
44
| Alphanumeric method x is not declared infix; it should not be used as infix operator.
55
| Instead, use method syntax .x(...) or backticked identifier `x`.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
//> using options -Werror
2-
31
class Foo:
42
def x(i: Int) = i
53
infix def y(i: Int) = i
64

75
def test(foo: Foo): Unit =
8-
foo x 1 // error (because it was compiled with 3.4+)
6+
foo x 1 // warn (because it was compiled with 3.4+)
97
foo y 2 // ok: is marked as infix

0 commit comments

Comments
 (0)