Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings from reified intersection types in :poko-tests #467

Merged
merged 1 commit into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions poko-tests/src/commonTest/kotlin/AnyArrayHolderTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class AnyArrayHolderTest {
@Test fun two_AnyArrayHolder_instances_holding_equivalent_nested_typed_arrays_match() {
val a = AnyArrayHolderPoko(
any = arrayOf(arrayOf("xx", "xy"), arrayOf("yx", "yy")),
nullableAny = arrayOf(arrayOf(1L, 2f), arrayOf(3.0, 4)),
nullableAny = arrayOf<Array<Number>>(arrayOf(1L, 2f), arrayOf(3.0, 4)),
trailingProperty = "trailing string",
)
val b = AnyArrayHolderPoko(
any = arrayOf(arrayOf("xx", "xy"), arrayOf("yx", "yy")),
nullableAny = arrayOf(arrayOf(1L, 2f), arrayOf(3.0, 4)),
nullableAny = arrayOf<Array<Number>>(arrayOf(1L, 2f), arrayOf(3.0, 4)),
trailingProperty = "trailing string",
)
assertAll {
Expand Down Expand Up @@ -238,7 +238,7 @@ class AnyArrayHolderTest {
trailingProperty = "trailing string",
)
val b = AnyArrayHolderPoko(
any = arrayOf(arrayOf(1L, 2f), arrayOf(3.0, 4)),
any = arrayOf<Array<Number>>(arrayOf(1L, 2f), arrayOf(3.0, 4)),
nullableAny = null,
trailingProperty = "trailing string",
)
Expand Down Expand Up @@ -278,13 +278,13 @@ class AnyArrayHolderTest {

@Test fun AnyArrayHolder_has_same_behavior_as_handwritten_implementation() {
val poko = AnyArrayHolderPoko(
any = arrayOf(1, 2L, 3f, 4.0),
nullableAny = arrayOf(1, 2L, 3f, 4.0),
any = arrayOf<Number>(1, 2L, 3f, 4.0),
nullableAny = arrayOf<Number>(1, 2L, 3f, 4.0),
trailingProperty = "trailing",
)
val data = AnyArrayHolderData(
any = arrayOf(1, 2L, 3f, 4.0),
nullableAny = arrayOf(1, 2L, 3f, 4.0),
any = arrayOf<Number>(1, 2L, 3f, 4.0),
nullableAny = arrayOf<Number>(1, 2L, 3f, 4.0),
trailingProperty = "trailing",
)
assertThat(poko).all {
Expand Down
19 changes: 17 additions & 2 deletions poko-tests/src/commonTest/kotlin/GenericArrayHolderTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,23 @@ import poko.GenericArrayHolder

class GenericArrayHolderTest {
@Test fun two_GenericArrayHolder_instances_with_equivalent_typed_arrays_are_equals() {
val a = GenericArrayHolder(arrayOf(arrayOf("5%, 10%"), intArrayOf(5, 10), booleanArrayOf(false, true)))
val b = GenericArrayHolder(arrayOf(arrayOf("5%, 10%"), intArrayOf(5, 10), booleanArrayOf(false, true)))
val a = GenericArrayHolder(
generic = arrayOf(
arrayOf("5%, 10%"),
intArrayOf(5, 10),
booleanArrayOf(false, true),
Unit,
),
)
val b = GenericArrayHolder(
generic = arrayOf(
arrayOf("5%, 10%"),
intArrayOf(5, 10),
booleanArrayOf(false, true),
Unit,
),
)

assertThat(a).isEqualTo(b)
assertThat(b).isEqualTo(a)
assertThat(a).hashCodeFun().isEqualTo(b.hashCode())
Expand Down
Loading