Skip to content

Commit 48f3f87

Browse files
committed
fix error in test
1 parent 1009b9a commit 48f3f87

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

tests/neg/i11118-pre3-4.check

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- Warning: tests/neg/i11118-pre3-4.scala:4:12 -------------------------------------------------------------------------
2+
4 |val (a,b) = (1,2,3) // error // warning
3+
| ^^^^^^^
4+
| pattern's type (Any, Any) does not match the right hand side expression's type (Int, Int, Int)
5+
|
6+
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
7+
| which may result in a MatchError at runtime.
8+
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
9+
-- Error: tests/neg/i11118-pre3-4.scala:4:4 ----------------------------------------------------------------------------
10+
4 |val (a,b) = (1,2,3) // error // warning
11+
| ^
12+
| this case is unreachable since type (Int, Int, Int) is not a subclass of class Tuple2

tests/neg/i11118-pre3-4.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import scala.language.`3.3`
2+
3+
// https://github.com/lampepfl/dotty/issues/11118
4+
val (a,b) = (1,2,3) // error // warning

tests/neg/i11118.check

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
-- Warning: tests/neg/i11118.scala:2:12 --------------------------------------------------------------------------------
2-
2 |val (a,b) = (1,2,3) // error // warning
1+
-- Error: tests/neg/i11118.scala:2:12 ----------------------------------------------------------------------------------
2+
2 |val (a,b) = (1,2,3) // error
33
| ^^^^^^^
44
| pattern's type (Any, Any) does not match the right hand side expression's type (Int, Int, Int)
55
|
66
| If the narrowing 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-
-- Error: tests/neg/i11118.scala:2:4 -----------------------------------------------------------------------------------
10-
2 |val (a,b) = (1,2,3) // error // warning
11-
| ^
12-
| this case is unreachable since type (Int, Int, Int) is not a subclass of class Tuple2

tests/neg/i11118.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// https://github.com/lampepfl/dotty/issues/11118
2-
val (a,b) = (1,2,3) // error // warning
2+
val (a,b) = (1,2,3) // error

0 commit comments

Comments
 (0)