Skip to content

Commit 2c0528a

Browse files
committed
Fixed all tests but the compiler crashes
1 parent a2fee42 commit 2c0528a

32 files changed

+160
-181
lines changed

tests/neg/18493.check

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

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/warn/i17613b/i17613b.scala renamed to tests/neg/i17613b/i17613b.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
//> using options -Xlint:type-parameter-shadow
1+
//> using options -Xlint:type-parameter-shadow -Xfatal-warnings
22

33
object i17613b:
44
import importTry._
55
class B:
66
type T = Int
7+
trait Typeclass[T]
78
trait D
89

910
def foobar[ImTrait](in: D) = in.toString // warn
@@ -12,7 +13,7 @@ object i17613b:
1213
def foobar2[ImClass](in: D) = in.toString // warn
1314
type MySeq2[ImClass] = Seq[D] // warn
1415

15-
given [A]: Ordering[Int]()
16+
given [A]: Typeclass[Int]() // warn
1617
type TypeLambda[A] = [ImTrait] =>> Map[ImTrait, B]
1718
type PolyFun[A] = [ImTrait] => ImTrait => B // warn
1819
type MatchType[A] = A match {
@@ -28,8 +29,8 @@ object i17613b:
2829

2930
type Y[List] = Int // no warning
3031

31-
given [A]: Ordering[A]()
32-
given [Int]: Ordering[Int]() // warn
32+
given [A]: Typeclass[A]()
33+
given [Int]: Typeclass[Int]() // warn
3334

3435
class C[M[List[_]]] // warn List not renamed here
3536
type E[M[Int[_]]] = Int // warn
@@ -42,3 +43,5 @@ object i17613b:
4243
5
4344

4445
def main(args: Array[String]) = println("Test for type parameter shadow")
46+
47+
// nopos-error fatal warnings
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
-- [E092] Pattern Match Unchecked Warning: tests/neg/15981.scala:4:45 --------------------------------------------------
1+
-- [E092] Pattern Match Unchecked Warning: tests/warn/15981.scala:4:45 -------------------------------------------------
22
4 | override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // warn
33
| ^^^
44
| the type test for PosInt cannot be checked at runtime because it's a local class
55
|
66
| longer explanation available when compiling with `-explain`
7-
No warnings can be incurred under -Werror.

tests/neg/17284.check renamed to tests/warn/17284.check

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- [E187] Potential Issue Warning: tests/neg/17284.scala:4:6 -----------------------------------------------------------
1+
-- [E187] Potential Issue Warning: tests/warn/17284.scala:4:6 ----------------------------------------------------------
22
4 | 451.synchronized {} // warn
33
| ^^^^^^^^^^^^^^^^
44
| Suspicious synchronized call on boxed class
@@ -8,7 +8,7 @@
88
| You called the synchronized method on a boxed primitive. This might not be what
99
| you intended.
1010
---------------------------------------------------------------------------------------------------------------------
11-
-- [E187] Potential Issue Warning: tests/neg/17284.scala:8:4 -----------------------------------------------------------
11+
-- [E187] Potential Issue Warning: tests/warn/17284.scala:8:4 ----------------------------------------------------------
1212
8 | x.synchronized {} // warn
1313
| ^^^^^^^^^^^^^^
1414
| Suspicious synchronized call on boxed class
@@ -18,7 +18,7 @@
1818
| You called the synchronized method on a boxed primitive. This might not be what
1919
| you intended.
2020
---------------------------------------------------------------------------------------------------------------------
21-
-- [E187] Potential Issue Warning: tests/neg/17284.scala:11:7 ----------------------------------------------------------
21+
-- [E187] Potential Issue Warning: tests/warn/17284.scala:11:7 ---------------------------------------------------------
2222
11 | true.synchronized {} // warn
2323
| ^^^^^^^^^^^^^^^^^
2424
| Suspicious synchronized call on boxed class
@@ -28,4 +28,3 @@
2828
| You called the synchronized method on a boxed primitive. This might not be what
2929
| you intended.
3030
--------------------------------------------------------------------------------------------------------------------
31-
No warnings can be incurred under -Werror.

tests/warn/18493.check

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- [E030] Match case Unreachable Warning: tests/warn/18493.scala:6:9 ---------------------------------------------------
2+
6 | case "abc" => // warn
3+
| ^^^^^
4+
| Unreachable case
5+
-- [E030] Match case Unreachable Warning: tests/warn/18493.scala:12:9 --------------------------------------------------
6+
12 | case "abc" => // warn
7+
| ^^^^^
8+
| Unreachable case
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
-- Deprecation Warning: tests/neg/i11022.scala:10:7 --------------------------------------------------------------------
1+
-- Deprecation Warning: tests/warn/i11022.scala:10:7 -------------------------------------------------------------------
22
10 |val a: CaseClass = CaseClass(42) // warn: deprecated type // warn: deprecated apply method
33
| ^^^^^^^^^
44
| class CaseClass is deprecated: no CaseClass
5-
-- Deprecation Warning: tests/neg/i11022.scala:10:19 -------------------------------------------------------------------
5+
-- Deprecation Warning: tests/warn/i11022.scala:10:19 ------------------------------------------------------------------
66
10 |val a: CaseClass = CaseClass(42) // warn: deprecated type // warn: deprecated apply method
77
| ^^^^^^^^^
88
| class CaseClass is deprecated: no CaseClass
9-
-- Deprecation Warning: tests/neg/i11022.scala:11:7 --------------------------------------------------------------------
9+
-- Deprecation Warning: tests/warn/i11022.scala:11:7 -------------------------------------------------------------------
1010
11 |val b: CaseClass = new CaseClass(42) // warn: deprecated type // warn: deprecated class
1111
| ^^^^^^^^^
1212
| class CaseClass is deprecated: no CaseClass
13-
-- Deprecation Warning: tests/neg/i11022.scala:11:23 -------------------------------------------------------------------
13+
-- Deprecation Warning: tests/warn/i11022.scala:11:23 ------------------------------------------------------------------
1414
11 |val b: CaseClass = new CaseClass(42) // warn: deprecated type // warn: deprecated class
1515
| ^^^^^^^^^
1616
| class CaseClass is deprecated: no CaseClass
17-
-- Deprecation Warning: tests/neg/i11022.scala:12:14 -------------------------------------------------------------------
17+
-- Deprecation Warning: tests/warn/i11022.scala:12:14 ------------------------------------------------------------------
1818
12 |val c: Unit = CaseClass(42).magic() // warn: deprecated apply method
1919
| ^^^^^^^^^
2020
| class CaseClass is deprecated: no CaseClass
21-
No warnings can be incurred under -Werror.
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:4:19 --------------------------------------------------------
1+
-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:4:19 -------------------------------------------------------
22
4 | val f1: Float = 123456789 // warn
33
| ^^^^^^^^^
44
| Widening conversion from Int to Float loses precision.
55
| Write `.toFloat` instead.
6-
-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:5:19 --------------------------------------------------------
6+
-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:5:19 -------------------------------------------------------
77
5 | val d1: Double = 1234567890123456789L // warn
88
| ^^^^^^^^^^^^^^^^^^^^
99
| Widening conversion from Long to Double loses precision.
1010
| Write `.toDouble` instead.
11-
-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:6:19 --------------------------------------------------------
11+
-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:6:19 -------------------------------------------------------
1212
6 | val f2: Float = 123456789L // warn
1313
| ^^^^^^^^^^
1414
| Widening conversion from Long to Float loses precision.
1515
| Write `.toFloat` instead.
16-
-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:12:21 -------------------------------------------------------
16+
-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:12:21 ------------------------------------------------------
1717
12 | val f1_b: Float = i1 // warn
1818
| ^^
1919
| Widening conversion from Int to Float loses precision.
2020
| Write `.toFloat` instead.
21-
-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:13:21 -------------------------------------------------------
21+
-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:13:21 ------------------------------------------------------
2222
13 | val d1_b: Double = l1 // warn
2323
| ^^
2424
| Widening conversion from Long to Double loses precision.
2525
| Write `.toDouble` instead.
26-
-- [E167] Lossy Conversion Warning: tests/neg/i11333.scala:14:21 -------------------------------------------------------
26+
-- [E167] Lossy Conversion Warning: tests/warn/i11333.scala:14:21 ------------------------------------------------------
2727
14 | val f2_b: Float = l2 // warn
2828
| ^^
2929
| Widening conversion from Long to Float loses precision.
3030
| Write `.toFloat` instead.
31-
No warnings can be incurred under -Werror.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
-- [E092] Pattern Match Unchecked Warning: tests/neg/i12253.scala:13:10 ------------------------------------------------
1+
-- [E092] Pattern Match Unchecked Warning: tests/warn/i12253.scala:13:10 -----------------------------------------------
22
13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // warn // warn
33
| ^
44
|the type test for extractors.q2.reflect.Term cannot be checked at runtime because it refers to an abstract type member or type parameter
55
|
66
| longer explanation available when compiling with `-explain`
7-
-- [E092] Pattern Match Unchecked Warning: tests/neg/i12253.scala:13:38 ------------------------------------------------
7+
-- [E092] Pattern Match Unchecked Warning: tests/warn/i12253.scala:13:38 -----------------------------------------------
88
13 | case extractors.InlinedLambda(_, Select(_, name)) => Expr(name) // warn // warn
99
| ^
1010
|the type test for q1.reflect.Select cannot be checked at runtime because it refers to an abstract type member or type parameter
1111
|
1212
| longer explanation available when compiling with `-explain`
13-
No warnings can be incurred under -Werror.
1413
there was 1 deprecation warning; re-run with -deprecation for details
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
-- Migration Warning: tests/neg/i13440.scala:5:4 -----------------------------------------------------------------------
1+
-- Migration Warning: tests/warn/i13440.scala:5:4 ----------------------------------------------------------------------
22
5 |def given = 42 // warn
33
| ^
44
| given is now a keyword, write `given` instead of given to keep it as an identifier
5-
-- Migration Warning: tests/neg/i13440.scala:7:13 ----------------------------------------------------------------------
5+
-- Migration Warning: tests/warn/i13440.scala:7:13 ---------------------------------------------------------------------
66
7 |case class C(enum: List[Int] = Nil) { // warn
77
| ^
88
| enum is now a keyword, write `enum` instead of enum to keep it as an identifier
9-
-- Migration Warning: tests/neg/i13440.scala:8:11 ----------------------------------------------------------------------
9+
-- Migration Warning: tests/warn/i13440.scala:8:11 ---------------------------------------------------------------------
1010
8 | val s = s"$enum" // warn
1111
| ^
1212
| enum is now a keyword, write `enum` instead of enum to keep it as an identifier
13-
No warnings can be incurred under -Werror.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
-- Warning: tests/neg/i16649-refutable.scala:6:6 -----------------------------------------------------------------------
1+
-- Warning: tests/warn/i16649-refutable.scala:6:6 ----------------------------------------------------------------------
22
6 | val '{ ($y: Int) + ($z: Int) } = x // warn
33
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44
| pattern binding uses refutable extractor `'{...}`
55
|
66
| If this usage is intentional, this can be communicated by adding `: @unchecked` after the expression,
77
| which may result in a MatchError at runtime.
88
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
9-
No warnings can be incurred under -Werror.

0 commit comments

Comments
 (0)