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(flatten): use LinkedHashSet instead of HashSet #1841

Merged
merged 2 commits into from Apr 5, 2024

Conversation

hoc081098
Copy link

to maintain the insertion order

@arnaudgiuliani
Copy link
Member

still get error, but order is maintained in the reverse order I see 🤔

@Test
    fun `allow overrides by type`() {
        val app = koinApplication {
            modules(
                module {
                    single<Simple.ComponentInterface1> { Simple.Component2() }
                },
                module {
                    single<Simple.ComponentInterface1> { Simple.Component1() }
                },
            )
        }

        app.assertDefinitionsCount(1)
        assertTrue(app.koin.get<Simple.ComponentInterface1>() is Simple.Component1)
    }

Good thing is that order seems stable

image

@arnaudgiuliani arnaudgiuliani added core status:checking currently in analysis - discussion or need more detailed specs labels Apr 5, 2024
@arnaudgiuliani
Copy link
Member

Could test that with this test too:

@Test
    fun test_flatten_list() {

        (1..100).all { i ->
            val modules = listOf(module { },module { },module { },module { },module { },module { },module { },module { },module { },module { })
            val flatten = flatten(modules)
            flatten.reversed() == modules
        }
    }

ArrayDeque(modules.asReversed())
@hoc081098
Copy link
Author

@arnaudgiuliani just updated

-ArrayDeque(modules)
+ArrayDeque(modules.asReversed())

@arnaudgiuliani
Copy link
Member

Sounds good 🎉. Need to check the fails on test examples 🤔

@arnaudgiuliani
Copy link
Member

Seen the problem. It's not from your side 👍 Will fix it

@arnaudgiuliani arnaudgiuliani merged commit c3aad5c into InsertKoinIO:3.6.0 Apr 5, 2024
3 of 4 checks passed
@hoc081098 hoc081098 deleted the patch-1 branch April 5, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core status:checking currently in analysis - discussion or need more detailed specs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants