Guide to Scala 3 Compiler Contribution

Common Issue Locations


Many issues are localised to small domains of the compiler and are self-contained, here is a non-exhaustive list of such domains, and the files associated with them:

Pretty Printing of Types and Trees

Objects in the compiler that inherit from Showable can be pretty printed. The pretty-printing of objects is used in many places, from debug output, to user-facing error messages and printing of trees after each phase.

Look in RefinedPrinter (or its parent class PlainPrinter) for the implementation of pretty printing.

Content of Error Messages

You can find the definitions of most error messages in messages (with IDs defined in ErrorMessageID). If the message is not defined there, try the -Ydebug-error compiler flag, which will print a stack trace leading to the production of the error, and the contents of the message.

Compiler Generated Given Instances

If the issue lies in given instances provided by the compiler, such as scala.reflect.ClassTag, scala.deriving.Mirror, scala.reflect.TypeTest, scala.CanEqual, scala.ValueOf, scala.reflect.Manifest, etc, look in Synthesizer, which provides factories for given instances.

Compiler Generated Methods

Members can be generated for many classes, such as equals and hashCode for case classes and value classes, and ordinal and fromProduct for Mirrors. To change the implementation, see SyntheticMembers.

Code Completions

For suggestions to auto-complete method selections, see Completion.

Enum Desugaring

See Desugar and DesugarEnums.

Pattern Match Exhaustivity

See Space.


Quotes Reflection

See the quoted runtime package.

Inline match

See Inliner.

Compiletime Ops Types

See tryCompiletimeConstantFold in Types.

Contributors to this page: