skunk-tables icon indicating copy to clipboard operation
skunk-tables copied to clipboard

Opaque types don't work if placed outside of the companion object of a table class

Open chuwy opened this issue 1 year ago • 2 comments

In the below code:

  opaque type Id = Long
  inline given IsColumn[Id] = ???

  case class Task(id: Id, title: Task.Title)
  object Task:
    opaque type Title = String
    inline given IsColumn[Title] = ???

    val table = Table.of[Task].withName("tasks").build

Columns in table end up being:

(TypedColumn["id", Long, "tasks", EmptyTuple], TypedColumn["title", Task.Title, "tasks", EmptyTuple])

And the only difference between Id and Title is that they're defined at different levels. I managed to narrow down this problem to quotidian.MacroMirror, i.e. at this moment at the very beginning of MacroTable existence I already have wrong types.

chuwy avatar Jul 24 '23 18:07 chuwy