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:
+3
-1
@@ -108,7 +108,9 @@ class ExplainedFilterTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
fun `copy preserves the purpose`() {
|
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)
|
assertTrue("copy() must stay an ExplainedFilter", advanced is ExplainedFilter)
|
||||||
assertEquals(SubPurpose.NOTIFICATIONS, advanced.purposeOrNull())
|
assertEquals(SubPurpose.NOTIFICATIONS, advanced.purposeOrNull())
|
||||||
|
|||||||
Reference in New Issue
Block a user