Skip to content

Commit 4536318

Browse files
committed
In the test for the Option.tapEach extension make sure the compiler can't coerce a specific implicit
1 parent d7ed4ad commit 4536318

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/scala/scala/next/TestOptionOpsExtensions.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@ package scala.next
1414

1515
final class TestOptionOpsExtensions {
1616
// Compile checks the return type, no need to run as test.
17-
def tapEachReturnType(): Option[Int] = Option(5).tapEach(identity)
17+
def tapEachReturnType(): Option[Int] = {
18+
// Don't return the Option directly, so the compiler is not able to coerce a specific implicit to be used.
19+
val opt = Option(5).tapEach(identity)
20+
opt.map(identity)
21+
}
1822
}

0 commit comments

Comments
 (0)