Diego DeSouza
12/07/2022, 4:15 PMmin(10, 2)
error: unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : Comparable<TypeVariable(T)>> Array<out TypeVariable(T)>.min(): TypeVariable(T) defined in kotlin.collections
public fun Array<out Double>.min(): Double defined in kotlin.collections
public fun Array<out Float>.min(): Float defined in kotlin.collections
public fun ByteArray.min(): Byte defined in kotlin.collections
Diego DeSouza
12/07/2022, 4:16 PMimport kotlin.collections
min(10, 2)
error: packages cannot be imported
import kotlin.collections
Joffrey
12/07/2022, 4:16 PMmin
function needs to be imported I believe. It should be from kotlin.math
. You're not trying to use the .min()
extension function on collections hereDiego DeSouza
12/07/2022, 4:17 PMimport kotlin.math
min(10, 2)
error: packages cannot be imported
import kotlin.math
Joffrey
12/07/2022, 4:18 PMimport kotlin.math.*
or import kotlin.math.min
, you cannot import the package itselfDiego DeSouza
12/07/2022, 4:19 PMJoffrey
12/07/2022, 4:19 PMJoffrey
12/07/2022, 4:19 PMkotlin.collections.*
is imported by default AFAIR, so you'll never need to import it. That's why the initial error already knew about these extension functions on collectionsephemient
12/07/2022, 4:20 PMminOf
does not require an importJoffrey
12/07/2022, 4:21 PM