Phase 04: Type mapping
Status: Planned
Deliverables
package3/kotlin/typemap/map.go—Translate(kt KotlinType) (MochiType, bool)— returns the Mochi type andfalseif the type is in the refusal set.package3/kotlin/typemap/table.go— the closed translation table as a Go data structure (no reflection).package3/kotlin/typemap/refusal.go—IsRefused(kt KotlinType) RefusalReason— identifies why a type is not bridgeable.package3/kotlin/typemap/nullable.go— nullable type desugar:T?→Option<T>.package3/kotlin/typemap/collections.go— collection type desugar:List<T>→List<T>(recursive translation of type arguments).
Refusal reasons
type RefusalReason int
const (
NotRefused RefusalReason = iota
RefusalUnresolvedTypeParam
RefusalInlineReifiedNoMonomorphise
RefusalDynamicType
RefusalThrowableReturn
RefusalRawContinuation
RefusalRawLambda
RefusalKClassReflection
RefusalUnsignedIntJVM17
RefusalJavaNonPrimitiveArray
)
Gate
Type-map all public functions of all 20 corpus artifacts. Validate:
kotlin.Int→int.kotlin.String?→Option<string>.List<kotlin.Long>→List<long>.Map<kotlin.String, kotlin.Int>→Map<string, int>.data class User(val id: Long, val name: String)→extern type Userwith accessor fns.enum class Status { ACTIVE, INACTIVE }→extern type Statuswith constructor fns.sealed class Resultwith two subclasses → discriminant + sub-type accessors.suspend fun fetch(): String→RefusalRawContinuation(without coroutines bridge config).fun <T> parse(s: String): T→RefusalUnresolvedTypeParam.- Zero panics when processing all 20 corpus JARs.