From 39efa570e2c61b02f6a740fd6b596715823abae1 Mon Sep 17 00:00:00 2001 From: som-snytt Date: Tue, 25 Jun 2024 02:29:03 -0700 Subject: [PATCH] Update docs/_spec/TODOreference/metaprogramming/reflection.md Co-authored-by: Jamie Thompson [Cherry-picked 2c7d497e9fe60f1390f55908d6283dbff527b549] --- docs/_spec/TODOreference/metaprogramming/reflection.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/_spec/TODOreference/metaprogramming/reflection.md b/docs/_spec/TODOreference/metaprogramming/reflection.md index 6ab1eeab6ac0..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.path + 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