Skip to content

Instantly share code, notes, and snippets.

@zainab-ali
Created January 21, 2026 13:49
Show Gist options
  • Select an option

  • Save zainab-ali/00dacdf2c9c694cb994b02986555cb91 to your computer and use it in GitHub Desktop.

Select an option

Save zainab-ali/00dacdf2c9c694cb994b02986555cb91 to your computer and use it in GitHub Desktop.
Scalameta `q` macro behaves strangely when substituting types
//> using scala 2.13.18
//> using dep "org.scalameta::scalameta::4.14.2"
import scala.meta._
val fooType = t"Foo"
val code = q"""
type Bar = ${fooType}
val qux = "any message"
"""
println(code.syntax)
// Expected
// {
// type Bar = Foo
// val qux = "any message"
// }
// Actual
// {
// type Bar = Foo
// val qux =
// }
// Affected versions: 4.14.3, 4.14.4, 4.14.5
// Note that 4.14.2 is correct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment