doobie
doobie copied to clipboard
sql macro leads to macro expansion error in the REPL
I'm not a Scala expert, so feel free to close if I missed something basic. And I'm always happy to submit PRs to update documentation to clarify for others if that's useful.
Basic issue: As I understand the documentation, I should be able to run commands in the REPL. So I try to run the following in the REPL (sbt console
):
import doobie.implicits._
val program2 = sql"select 42".query[Int].unique
This results in the following error:
-- Error: ----------------------------------------------------------------------
1 |val program2 = sql"select 42".query[Int].unique
| ^
|Exception occurred while executing macro expansion.
|java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.toString()" because the return value of "scala.quoted.Quotes$reflectModule$SourceFileMethods.jpath(Object)" is null
| at doobie.util.PosPlatform$.originImpl(PosPlatform.scala:21)
|
| This location contains code that was inlined from rs$line$2:1
1 error found
Other possibly useful info:
Project initiated with: sbt new scala/scala3.g8
sbt version: 1.6.2
doobie version: 1.0.0-RC2
(same result with 1.0.0-RC1
)
The build.sbt
:
val scala3Version = "3.1.2"
lazy val root = project
.in(file("."))
.settings(
name := "pr",
version := "0.1.0-SNAPSHOT",
scalaVersion := scala3Version,
libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test
)
lazy val doobieVersion = "1.0.0-RC2"
libraryDependencies ++= Seq(
"org.tpolecat" %% "doobie-core" % doobieVersion,
)
Ok that's a bug in SourcePos. Thanks for reporting.