Skip to content

Commit b84a68b

Browse files
committed
Second batch of neg -> warn test changes
1 parent 9ff3583 commit b84a68b

File tree

81 files changed

+648
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+648
-381
lines changed

tests/neg/14034b.scala

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

tests/neg/17284.scala

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

tests/neg/18493.check

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

tests/neg/avoid-warn-deprecation.scala

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

tests/neg/main-functions-nameclash.scala

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

tests/neg/manifest-summoning-b.scala

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

tests/neg/matchable.scala

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

tests/neg/old-syntax.scala

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

tests/neg/ovlazy.scala

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

tests/neg/private-this-3.4.scala

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

tests/neg/private-this-future-migration.scala

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

tests/neg/quote-simple-hole.scala

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

tests/neg/refinements-this.scala

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

tests/neg/refutable-pattern-binding-messages.check

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@
2222
| If the narrowing is intentional, this can be communicated by adding the `case` keyword before the full pattern,
2323
| which will result in a filtering for expression (using `withFilter`).
2424
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
25-
-- Error: tests/neg/refutable-pattern-binding-messages.scala:5:14 ------------------------------------------------------
26-
5 | val Positive(p) = 5 // error: refutable extractor
25+
-- Warning: tests/neg/refutable-pattern-binding-messages.scala:5:14 ----------------------------------------------------
26+
5 | val Positive(p) = 5 // warn: refutable extractor
2727
| ^^^^^^^^^^^^^^^
2828
| pattern binding uses refutable extractor `Test.Positive`
2929
|
3030
| If this usage is intentional, this can be communicated by adding `: @unchecked` after the expression,
3131
| which may result in a MatchError at runtime.
3232
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
33-
-- Error: tests/neg/refutable-pattern-binding-messages.scala:10:20 -----------------------------------------------------
34-
10 | val i :: is = List(1, 2, 3) // error: pattern type more specialized
33+
-- Warning: tests/neg/refutable-pattern-binding-messages.scala:10:20 ---------------------------------------------------
34+
10 | val i :: is = List(1, 2, 3) // warn: pattern type more specialized
3535
| ^^^^^^^^^^^^^
3636
| pattern's type ::[Int] is more specialized than the right hand side expression's type List[Int]
3737
|
3838
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
3939
| which may result in a MatchError at runtime.
4040
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
41-
-- Error: tests/neg/refutable-pattern-binding-messages.scala:16:10 -----------------------------------------------------
42-
16 | val 1 = 2 // error: pattern type does not match
41+
-- Warning: tests/neg/refutable-pattern-binding-messages.scala:16:10 ---------------------------------------------------
42+
16 | val 1 = 2 // warn: pattern type does not match
4343
| ^
4444
| pattern's type (1 : Int) does not match the right hand side expression's type (2 : Int)
4545
|
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
//> using options -Werror
1+
22
object Test {
33
// refutable extractor
44
object Positive { def unapply(i: Int): Option[Int] = Some(i).filter(_ > 0) }
5-
val Positive(p) = 5 // error: refutable extractor
5+
val Positive(p) = 5 // warn: refutable extractor
66
for Positive(i) <- List(1, 2, 3) do () // error: refutable extractor
77

88
// more specialized
99
val xs: List[AnyRef] = ???
10-
val i :: is = List(1, 2, 3) // error: pattern type more specialized
10+
val i :: is = List(1, 2, 3) // warn: pattern type more specialized
1111
for ((x: String) <- xs) do () // error: pattern type more specialized
1212

1313
// does not match
1414
val ys: List[Option[?]] = ???
1515
for none @ None <- ys do () // error: pattern type does not match
16-
val 1 = 2 // error: pattern type does not match
16+
val 1 = 2 // warn: pattern type does not match
1717
}

tests/neg/rewrite-messages.scala

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

tests/neg/strict-pattern-bindings-3.2.scala

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

tests/neg/symbolic-packages.scala

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

tests/neg/warn-value-discard.check

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

tests/neg/with-type-operator-future-migration.scala

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

tests/warn/14034b.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//> using options -deprecation
2+
3+
@deprecated trait Exp
4+
@deprecated val exp = 1
5+
6+
def test1 = exp // warn
7+
def test2(a: Exp) = () // warn
8+
9+
type Foo0 = Exp // warn
10+
type Foo = Option[Exp] // warn
11+
type Bar = Option[exp.type] // warn
12+
type Baz = Exp | Int // warn
13+
type Quux = [X] =>> X match
14+
case Exp => Int // warn
15+
type Quuz[A <: Exp] = Int // warn

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- [E092] Pattern Match Error: tests/neg/15981.scala:4:45 --------------------------------------------------------------
2-
4 | override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // error
1+
-- [E092] Pattern Match Unchecked Warning: tests/warn/15981.scala:4:45 -------------------------------------------------
2+
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
|
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//> using options -Werror
1+
22
val _ = locally{
33
sealed abstract class PosInt(val value: Int) {
4-
override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // error
4+
override def equals(any: Any): Boolean = any.isInstanceOf[PosInt] // warn
55
}
66
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
-- [E187] Potential Issue Error: tests/neg/17284.scala:4:6 -------------------------------------------------------------
2-
4 | 451.synchronized {} // error
1+
-- [E187] Potential Issue Warning: tests/warn/17284.scala:4:6 ----------------------------------------------------------
2+
4 | 451.synchronized {} // warn
33
| ^^^^^^^^^^^^^^^^
44
| Suspicious synchronized call on boxed class
55
|---------------------------------------------------------------------------------------------------------------------
@@ -8,8 +8,8 @@
88
| You called the synchronized method on a boxed primitive. This might not be what
99
| you intended.
1010
---------------------------------------------------------------------------------------------------------------------
11-
-- [E187] Potential Issue Error: tests/neg/17284.scala:8:4 -------------------------------------------------------------
12-
8 | x.synchronized {} // error
11+
-- [E187] Potential Issue Warning: tests/warn/17284.scala:8:4 ----------------------------------------------------------
12+
8 | x.synchronized {} // warn
1313
| ^^^^^^^^^^^^^^
1414
| Suspicious synchronized call on boxed class
1515
|---------------------------------------------------------------------------------------------------------------------
@@ -18,8 +18,8 @@
1818
| You called the synchronized method on a boxed primitive. This might not be what
1919
| you intended.
2020
---------------------------------------------------------------------------------------------------------------------
21-
-- [E187] Potential Issue Error: tests/neg/17284.scala:11:7 ------------------------------------------------------------
22-
11 | true.synchronized {} // error
21+
-- [E187] Potential Issue Warning: tests/warn/17284.scala:11:7 ---------------------------------------------------------
22+
11 | true.synchronized {} // warn
2323
| ^^^^^^^^^^^^^^^^^
2424
| Suspicious synchronized call on boxed class
2525
|--------------------------------------------------------------------------------------------------------------------

tests/warn/17284.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//> using options -explain
2+
3+
def test =
4+
451.synchronized {} // warn
5+
6+
def test2 =
7+
val x: Integer = 451
8+
x.synchronized {} // warn
9+
10+
def test3 =
11+
true.synchronized {} // warn
12+
13+
def test4 =
14+
true.hashCode() // success

tests/warn/1828.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
class Test {
4+
def remove[S](a: S | Int, f: Int => S):S = a match {
5+
case a: S => a // warn
6+
case a: Int => f(a)
7+
}
8+
9+
val t: Int | String = 5
10+
val t1 = remove[String](t, _.toString)
11+
}

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

0 commit comments

Comments
 (0)