Skip to content

Commit fae048c

Browse files
committed
Add a .check file
1 parent 9dc1404 commit fae048c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

tests/neg/warn-value-discard.check

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- [E171] Potential Issue Error: tests/neg/warn-value-discard.scala:14:35 ----------------------------------------------
2+
14 | firstThing().map(_ => secondThing()) // error
3+
| ^^^^^^^^^^^^^
4+
| discarded non-Unit value of type Either[Failed, Unit]
5+
-- [E171] Potential Issue Error: tests/neg/warn-value-discard.scala:17:35 ----------------------------------------------
6+
17 | firstThing().map(_ => secondThing()) // error
7+
| ^^^^^^^^^^^^^
8+
| discarded non-Unit value of type Either[Failed, Unit]

tests/neg/warn-value-discard.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import scala.util.{Either, Right, Left}
44

55
case class Failed(msg: String)
66

7-
def doSomething(): Either[Failed, Unit] =
7+
def firstThing(): Either[Failed, Unit] =
88
Right(())
99

10-
def log(): Either[Failed, Unit] =
10+
def secondThing(): Either[Failed, Unit] =
1111
Left(Failed("whoops you should have flatMapped me"))
1212

1313
def singleExpr(): Either[Failed, Unit] =
14-
doSomething().map(_ => log()) // error
14+
firstThing().map(_ => secondThing()) // error
1515

1616
def block(): Either[Failed, Unit] = {
17-
doSomething().map(_ => log()) // error
17+
firstThing().map(_ => secondThing()) // error
1818
}

0 commit comments

Comments
 (0)