Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql macro leads to macro expansion error in the REPL #1698

Open
cgoldammer opened this issue May 26, 2022 · 1 comment
Open

sql macro leads to macro expansion error in the REPL #1698

cgoldammer opened this issue May 26, 2022 · 1 comment

Comments

@cgoldammer
Copy link

cgoldammer commented May 26, 2022

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,
)
@tpolecat
Copy link
Owner

Ok that's a bug in SourcePos. Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants