Skip to content

Commit

Permalink
Fix NullPointerException when using sourcecode.File in Scala 3 repl (#…
Browse files Browse the repository at this point in the history
…161)

In analogy to #153 fixes a NullPointerException when using
`sourcecode.File` in the REPL.
  • Loading branch information
fachammer authored May 18, 2024
1 parent a423594 commit bbe8e3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sourcecode/src-3/sourcecode/Macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ object Macros {

def fileImpl(using Quotes): Expr[sourcecode.File] = {
import quotes.reflect._
val file = quotes.reflect.Position.ofMacroExpansion.sourceFile.jpath.toAbsolutePath.toString
val file = quotes.reflect.Position.ofMacroExpansion.sourceFile.path
'{sourcecode.File(${Expr(file)})}
}

Expand Down

0 comments on commit bbe8e3f

Please sign in to comment.