Skip to content

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

Closed
@deusaquilus

Description

@deusaquilus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions