Skip to content

Tests don't compile with Kotlin 2.1.20 #504

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

Open
martinkretzschmar opened this issue Mar 20, 2025 · 2 comments · Fixed by #505
Open

Tests don't compile with Kotlin 2.1.20 #504

martinkretzschmar opened this issue Mar 20, 2025 · 2 comments · Fixed by #505

Comments

@martinkretzschmar
Copy link

martinkretzschmar commented Mar 20, 2025

The tests that

import kotlinx.datetime.*
import kotlin.time.*

do not compile because there are now both kotlinx.datetime and kotlin.time versions of Clock and Instant:

ClockTimeSourceTest.kt:26: error: overload resolution ambiguity between candidates:
interface Clock : Any
interface Clock : Any
        val timeSource = Clock.System.asTimeSource()
                         ^^^^^
@dkhalanskyjb
Copy link
Collaborator

You probably mean kotlinx.datetime, not kotlinx.time, right? Yes, that's true, the standard library now has Clock and Instant. You are advised to avoid star imports, or you will encounter such issues when some library adds a new API.

@martinkretzschmar
Copy link
Author

You probably mean kotlinx.datetime, not kotlinx.time, right?

Yes, thanks. Edited.

Yes, that's true, the standard library now has Clock and Instant. You are advised to avoid star imports, or you will encounter such issues when some library adds a new API.

I mean there are tests in this repository that have this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants