Skip to content

Commit

Permalink
Fix NullPointerException when using fileName under Scala 3 repl (#153)
Browse files Browse the repository at this point in the history
#125

Wasn't able to run tests locally - kept seeing failures with mill
script.
  • Loading branch information
hearnadam committed Apr 15, 2024
1 parent 5364af2 commit 59a708e
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 @@ -152,7 +152,7 @@ object Macros {
}

def fileNameImpl(using Quotes): Expr[sourcecode.FileName] = {
val name = quotes.reflect.Position.ofMacroExpansion.sourceFile.jpath.getFileName.toString
val name = quotes.reflect.Position.ofMacroExpansion.sourceFile.name
'{sourcecode.FileName(${Expr(name)})}
}

Expand Down

0 comments on commit 59a708e

Please sign in to comment.