fix: resolve always-true is-check and redundant cast warnings in ExplainedFilterTest

Declaring 'advanced' as the base Filter type keeps the copy() regression
guard as a genuine runtime assertion instead of a compile-time triviality,
which is what the compiler was warning about.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KG9YkeFp6zyth5J364DLF
This commit is contained in:
Claude
2026-08-01 18:03:03 +00:00
parent 31c3eaf2b3
commit 0cc3f72f55
@@ -108,7 +108,9 @@ class ExplainedFilterTest {
*/
@Test
fun `copy preserves the purpose`() {
val advanced = explained().copy(since = 1_785_379_272)
// Typed as the base Filter so the is-check below stays a runtime assertion — with the
// override's covariant return type inferred, the compiler would prove it true statically.
val advanced: Filter = explained().copy(since = 1_785_379_272)
assertTrue("copy() must stay an ExplainedFilter", advanced is ExplainedFilter)
assertEquals(SubPurpose.NOTIFICATIONS, advanced.purposeOrNull())