-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Is your feature request related to a problem? Please describe.
In 3.7.0 with the introduction of NamedTuple a pattern to easily create type safe DSL with field access using Selectable and Fields
trait Expr[Result] extends Selectable:
type Fields = NamedTuple.Map[NamedTuple.From[Result], Expr]
def selectDynamic(fieldName: String) = ???
(for a more compete example see: https://github.com/scala/scala3/blob/7d9042fbc09741ca21b476691e1b133321839569/tests/run/tyql.scala#L15)
The problem with this pattern is that in used code like
final case class Person(name: String)
val _: Expr[Person] => Expr[String] = _.name // Going to definition on `name` will go to selectDynamic
on can only use _.name to go to the selectDynamic which is of course correct. But probably not what the user wanted.
Describe the solution you'd like
I would like go to definition on name would return both selectDynamic and the name in the case class Person. As that is what a user mostly likely intended. They probably do not care how the query dsl was designed but cared more about there domain logic case class.
Describe alternatives you've considered
I just accept the status quo.
Additional context
No response
Search terms
Selectable NamedTuple Fields