Skip to content

Commit

Permalink
fix error in test
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Sep 28, 2023
1 parent 1009b9a commit 48f3f87
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
12 changes: 12 additions & 0 deletions tests/neg/i11118-pre3-4.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Warning: tests/neg/i11118-pre3-4.scala:4:12 -------------------------------------------------------------------------
4 |val (a,b) = (1,2,3) // error // warning
| ^^^^^^^
| pattern's type (Any, Any) does not match the right hand side expression's type (Int, Int, Int)
|
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
| which may result in a MatchError at runtime.
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
-- Error: tests/neg/i11118-pre3-4.scala:4:4 ----------------------------------------------------------------------------
4 |val (a,b) = (1,2,3) // error // warning
| ^
| this case is unreachable since type (Int, Int, Int) is not a subclass of class Tuple2
4 changes: 4 additions & 0 deletions tests/neg/i11118-pre3-4.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import scala.language.`3.3`

// https://github.com/lampepfl/dotty/issues/11118
val (a,b) = (1,2,3) // error // warning
8 changes: 2 additions & 6 deletions tests/neg/i11118.check
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
-- Warning: tests/neg/i11118.scala:2:12 --------------------------------------------------------------------------------
2 |val (a,b) = (1,2,3) // error // warning
-- Error: tests/neg/i11118.scala:2:12 ----------------------------------------------------------------------------------
2 |val (a,b) = (1,2,3) // error
| ^^^^^^^
| pattern's type (Any, Any) does not match the right hand side expression's type (Int, Int, Int)
|
| If the narrowing is intentional, this can be communicated by adding `: @unchecked` after the expression,
| which may result in a MatchError at runtime.
| This patch can be rewritten automatically under -rewrite -source 3.2-migration.
-- Error: tests/neg/i11118.scala:2:4 -----------------------------------------------------------------------------------
2 |val (a,b) = (1,2,3) // error // warning
| ^
| this case is unreachable since type (Int, Int, Int) is not a subclass of class Tuple2
2 changes: 1 addition & 1 deletion tests/neg/i11118.scala
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// https://github.com/lampepfl/dotty/issues/11118
val (a,b) = (1,2,3) // error // warning
val (a,b) = (1,2,3) // error

0 comments on commit 48f3f87

Please sign in to comment.