diff --git a/docs/_docs/reference/metaprogramming/reflection.md b/docs/_docs/reference/metaprogramming/reflection.md index 68cb7dafcfbb..65ae2f733b7a 100644 --- a/docs/_docs/reference/metaprogramming/reflection.md +++ b/docs/_docs/reference/metaprogramming/reflection.md @@ -82,7 +82,8 @@ def macroImpl()(quotes: Quotes): Expr[Unit] = import quotes.reflect.* val pos = Position.ofMacroExpansion - val path = pos.sourceFile.jpath.toString + val jpath = pos.sourceFile.getJPath.getOrElse(report.errorAndAbort("virtual file not supported", pos)) + val path = pos.sourceFile.path // fallback for a virtual file val start = pos.start val end = pos.end val startLine = pos.startLine diff --git a/docs/_spec/TODOreference/metaprogramming/reflection.md b/docs/_spec/TODOreference/metaprogramming/reflection.md index b2d492657a4e..2af1d04d1b32 100644 --- a/docs/_spec/TODOreference/metaprogramming/reflection.md +++ b/docs/_spec/TODOreference/metaprogramming/reflection.md @@ -82,7 +82,8 @@ def macroImpl()(quotes: Quotes): Expr[Unit] = import quotes.reflect.* val pos = Position.ofMacroExpansion - val path = pos.sourceFile.jpath.toString + val jpath = pos.sourceFile.getJPath.getOrElse(report.errorAndAbort("virtual file not supported", pos)) + val path = pos.sourceFile.path // fallback for a virtual file val start = pos.start val end = pos.end val startLine = pos.startLine