Skip to content

Can we get report.info equivalent of Context.info #12017

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

Closed
deusaquilus opened this issue Apr 7, 2021 · 2 comments
Closed

Can we get report.info equivalent of Context.info #12017

deusaquilus opened this issue Apr 7, 2021 · 2 comments

Comments

@deusaquilus
Copy link
Contributor

deusaquilus commented Apr 7, 2021

Compiler version

3.0.0-RC1

Minimized example

Quill creates queries during compile time it is very useful for the user to know what run expressions create what queries. In Scala 2 I would print this information using Context.info

    def query(queryString: String, idiom: Idiom): Unit = {
      if (debugEnabled) c.info(c.enclosingPosition, queryString, force = true)
    }

This gives the output:

[info] queries.scala: 284: SELECT x.name, x.age FROM Person x
[info] val result = run(query[Person])
[info]                 ^

It would be really nice to be able to do this with report.info:

report.info(queryString)

And get an output that looks like this:

[info] -- Info: /Users/me/git/protoquill/quill-sql/src/test/scala/io/getquill/ActionTest.scala:81:26 
[info] 81 |      val result = ctx.run(query[Person].insert(Person(lift("Joe"), 123)))
[info]    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[info]    |    Compile Time Query Is: INSERT INTO Person (name,age) VALUES (?, 123)
[info]    | This location contains code that was inlined from ActionTest.scala:81
[info]    | This location contains code that was inlined from Context.scala:139

Right now there's only report.warning which I couldn't use since lots of users do -Xfatal-warnings.

@griggt
Copy link
Contributor

griggt commented Apr 7, 2021

Isn't this what #11626 added (to 3.0.0-RC2)?

@deusaquilus
Copy link
Contributor Author

It must be my birthday! Thank you @kubukoz!
Thank you @griggt for pointing this out.

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