Skip to content

Scaladoc snippet compilation fails to evaluate a macro #21279

Open
@lbialy

Description

@lbialy

Compiler version

3.3.3

Minimized code

Quite hard to minimize. Problem shows up in scala-yaml repo and can be reproduced reliably by checking out the repo at commit 5bf61d1.

git clone [email protected]:VirtusLab/scala-yaml.git

cd scala-yaml

git fetch --all

git checkout 5bf61d1

sbt core/doc

# or

sbt core/publishLocal

Output

[error] -- Error: /home/runner/work/scala-yaml/scala-yaml/docs/_docs/examples.md:34:86 -
[error] 34 |case class Keys(key1: String, key2: Option[String], key3: Option[String]) derives YamlDecoder 
[error]    |                                                                                      ^
[error]    |Failed to evaluate macro.
[error]    |  Caused by class java.lang.ClassNotFoundException: org.virtuslab.yaml.DecoderMacros$
[error]    |    java.lang.ClassLoader.loadClass(ClassLoader.java:418)
[error]    |    java.lang.ClassLoader.loadClass(ClassLoader.java:351)
[error]    |    dotty.tools.dotc.quoted.Interpreter.loadClass(Interpreter.scala:212)
[error]    |    dotty.tools.dotc.quoted.Interpreter.loadModule(Interpreter.scala:197)
[error]    |    dotty.tools.dotc.quoted.Interpreter.interpretedStaticMethodCall(Interpreter.scala:165)
[error]    |    dotty.tools.dotc.quoted.Interpreter.interpretTree(Interpreter.scala:80)
[error]    |    dotty.tools.dotc.transform.Splicer$SpliceInterpreter.interpretTree(Splicer.scala:258)
[error]    |    dotty.tools.dotc.quoted.Interpreter.interpretTree$$anonfun$2(Interpreter.scala:99)

Expectation

Scaladoc can compile snippets that call macros.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions