From dd711ee841716c0dc11c4389f3e31a6722baad0b Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Mon, 24 Jun 2024 15:28:29 -0700 Subject: [PATCH 1/3] Avoid jpath in example --- docs/_docs/reference/metaprogramming/reflection.md | 2 +- docs/_spec/TODOreference/metaprogramming/reflection.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_docs/reference/metaprogramming/reflection.md b/docs/_docs/reference/metaprogramming/reflection.md index 68cb7dafcfbb..12ca856f4940 100644 --- a/docs/_docs/reference/metaprogramming/reflection.md +++ b/docs/_docs/reference/metaprogramming/reflection.md @@ -82,7 +82,7 @@ def macroImpl()(quotes: Quotes): Expr[Unit] = import quotes.reflect.* val pos = Position.ofMacroExpansion - val path = pos.sourceFile.jpath.toString + val path = pos.sourceFile.path 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..6ab1eeab6ac0 100644 --- a/docs/_spec/TODOreference/metaprogramming/reflection.md +++ b/docs/_spec/TODOreference/metaprogramming/reflection.md @@ -82,7 +82,7 @@ def macroImpl()(quotes: Quotes): Expr[Unit] = import quotes.reflect.* val pos = Position.ofMacroExpansion - val path = pos.sourceFile.jpath.toString + val path = pos.sourceFile.path val start = pos.start val end = pos.end val startLine = pos.startLine From e7acd53883a517b39af0b1fa22abfcd6f0adb787 Mon Sep 17 00:00:00 2001 From: som-snytt Date: Tue, 25 Jun 2024 02:28:51 -0700 Subject: [PATCH 2/3] Update docs/_docs/reference/metaprogramming/reflection.md Co-authored-by: Jamie Thompson --- docs/_docs/reference/metaprogramming/reflection.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/_docs/reference/metaprogramming/reflection.md b/docs/_docs/reference/metaprogramming/reflection.md index 12ca856f4940..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.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 From 2c7d497e9fe60f1390f55908d6283dbff527b549 Mon Sep 17 00:00:00 2001 From: som-snytt Date: Tue, 25 Jun 2024 02:29:03 -0700 Subject: [PATCH 3/3] Update docs/_spec/TODOreference/metaprogramming/reflection.md Co-authored-by: Jamie Thompson --- 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