Skip to content
Latchkey

Scala 3 Migration Compile Errors in CI

Compiling Scala 2 code under Scala 3 surfaces real incompatibilities - removed syntax, stricter implicit resolution, and Scala-2-only macro libraries. These are genuine source/dependency issues, not transient failures.

What this error means

Switching scalaVersion to 3.x produces compile errors that did not occur on 2.13 - symbol literals, old do/while/procedure syntax, ambiguous implicits, or a macro library with no Scala 3 artifact.

sbt output
[error] -- Error: App.scala:10 ---
[error] 10 |  'foo
[error]    |  ^^^^
[error]    | symbol literal 'foo is no longer supported,
[error]    | use a string literal "foo" or an application Symbol("foo") instead

Common causes

Dropped or changed Scala 3 syntax

Scala 3 removed constructs (symbol literals, procedure syntax) and tightened others, so valid Scala 2 code fails to compile.

Macro libraries / dependencies not on Scala 3

A dependency built only for Scala 2.13 (especially macro-heavy libraries) has no Scala 3 artifact, so resolution or compilation fails.

How to fix it

Use the migration mode to auto-rewrite

Scala 3’s migration flag rewrites many incompatibilities for you.

build.sbt
// build.sbt
scalaVersion := "3.3.3"
scalacOptions += "-source:3.3-migration"
// then: sbt "compile" to apply suggested rewrites

Update dependencies to Scala 3 builds

  1. Bump libraries to versions that publish Scala 3 artifacts.
  2. For Scala-2-only deps, use withDottyCompat/CrossVersion.for3Use2_13 where the library is binary-compatible.
  3. Replace macro libraries that have no Scala 3 equivalent.

How to prevent it

  • Migrate with -source:Nx-migration to surface and auto-fix issues.
  • Audit dependencies for Scala 3 artifacts before switching.
  • Migrate module by module rather than the whole build at once.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →