Skip to content

-Yexplicit-nulls breaks macros expecting Type context bound #23845

@WojciechMazur

Description

@WojciechMazur

Based on OpenCB failure in https://github.com/tabdulradi/nullable - OpenCB logs

Compiler version

Last good release: 3.8.0-RC1-bin-20250822-658c8bd-NIGHTLY
First bad release: 3.8.0-RC1-bin-20250823-712d5bc-NIGHTLY

Bisect pointed to 712d5bc but it does not make sense - this change was not touching the compiler.

Minimized code

//> using options -Yexplicit-nulls
import scala.quoted.*

private def typeNameMacro[A: Type](using Quotes) = Expr(Type.show[A])
transparent inline def typeName[A]: String = ${typeNameMacro[A]}

Output

-- [E007] Type Mismatch Error: /Users/wmazur/projects/scala/community-build3/example.scala:4:47 ---------------------------------------------------------------------------------------------
4 |transparent inline def typeName[A]: String = ${typeNameMacro[A]}
  |                                               ^^^^^^^^^^^^^^^^
  |                                               Found:    (scala.quoted.Type[A], scala.quoted.Quotes) ?=> (scala.quoted.Expr[(String)?])?
  |                                               Required: (((scala.quoted.Quotes)?) ?=> (scala.quoted.Expr[(String)?])?)?
  |
  | longer explanation available when compiling with `-explain`

Expectation

Should compile

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions