From 54ae45d8523e76f770089b8453a724e68e25f51b Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Tue, 3 Sep 2024 13:17:51 +0100 Subject: [PATCH] Fixed false positive unreachable local object I think this was fixed in PR 21000, but I didn't check. --- tests/warn/i21218.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/warn/i21218.scala diff --git a/tests/warn/i21218.scala b/tests/warn/i21218.scala new file mode 100644 index 000000000000..29fa957e2e70 --- /dev/null +++ b/tests/warn/i21218.scala @@ -0,0 +1,10 @@ +def Test[U, A](thisElem: A, thatElem: U) = { + case object passedEnd + val any: Seq[Any] = ??? + any.zip(any) + .map { + case (`passedEnd`, r: U @unchecked) => (thisElem, r) + case (l: A @unchecked, `passedEnd`) => (l, thatElem) + case t: (A, U) @unchecked => t // false-positive warning + } +}