Compiler Articles

Kotlin K2 Compiler: Unified Frontend, Type Inference, and Android Migration

A practical deep dive into Kotlin K2's FIR frontend, rewritten type inference, build-performance impact, kapt-to-KSP migration, compiler plugin changes, and Android project rollout.

Kotlin `suspend` Internals: From CPS Transformation to State-Machine Bytecode

A compiler-level walkthrough of how Kotlin turns suspend functions into state-machine bytecode, from CPS transformation and Continuation to local-variable liveness and coroutine resumption.

Kotlin Contracts: Smart Casts, Type Inference, and callsInPlace

A deep dive into Kotlin Contracts, showing how returns() implies and callsInPlace help the compiler recover smart casts, variable initialization, and better type inference.