Skip to content

Commit 3bd31c0

Browse files
authored
Avoid jpath in example (#20775)
2 parents 4ff676e + 2c7d497 commit 3bd31c0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/_docs/reference/metaprogramming/reflection.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ def macroImpl()(quotes: Quotes): Expr[Unit] =
8282
import quotes.reflect.*
8383
val pos = Position.ofMacroExpansion
8484

85-
val path = pos.sourceFile.jpath.toString
85+
val jpath = pos.sourceFile.getJPath.getOrElse(report.errorAndAbort("virtual file not supported", pos))
86+
val path = pos.sourceFile.path // fallback for a virtual file
8687
val start = pos.start
8788
val end = pos.end
8889
val startLine = pos.startLine

docs/_spec/TODOreference/metaprogramming/reflection.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ def macroImpl()(quotes: Quotes): Expr[Unit] =
8282
import quotes.reflect.*
8383
val pos = Position.ofMacroExpansion
8484

85-
val path = pos.sourceFile.jpath.toString
85+
val jpath = pos.sourceFile.getJPath.getOrElse(report.errorAndAbort("virtual file not supported", pos))
86+
val path = pos.sourceFile.path // fallback for a virtual file
8687
val start = pos.start
8788
val end = pos.end
8889
val startLine = pos.startLine

0 commit comments

Comments
 (0)