Testable Compiler Plugin Development in Scala 3
summary
Shows how to build a working Scala 3 compiler plugin and a test harness that actually runs the Dotty compiler phases, using SBT, the Scala 3 compiler internals and munit. Provides a giter8 template, an sbt-munit-compiler-toolkit plugin, a library of munit fixtures and a snapshot test gadget (munit-snap) that captures compiler output. Demonstrates hooking into nearly 90 compiler phases, handling ~60 typed tree variants, creating contexts, running checkCompile-based tests, and validating that generated-transformations and snapshot regressions pass in CI.
AI-written summary · about
chapters (9)
- 0:00Intro
- 1:15Programs are Data
- 3:03What is a Compiler Plugin?
- 3:52Creating a compiler plugin
- 11:01The scala phases
- 12:41Testing a compiler plugin.
- 15:13Attribution for technique
- 21:29Implementing a transform.
- 28:39Snapshot Testing








