I find very interesting that this code isn't ambig...
# getting-started
c
I find very interesting that this code isn't ambiguous.
Copy code
import io.ktor.http.HttpStatusCode.*

@Serializable
private data class NotFound(val id: String)

val f = foo<NotFound>(NotFound)
            |         |
            |         HttpStatusCode.NotFound
            data class NotFound
y
the class has no companion object, so
NotFound
as a value stands for nothing. I see how it can be a little confusing. You need to remember that values and types are completely different namespaces (although companion objects, and objects in general, blur that line), so the value
NotFound
is not necessarily related to the type
NotFound
. In fact, imagine you just had a local variable
val NotFound
. this same situation would occur. We just usually don't name variables with an uppercase letter
c
Yep, I understand why it works. Could be a funny puzzler though