liufengyun / gestalt

gestalt : portable and solid macros for Scala
https://github.com/scalacenter/macros
31 stars 3 forks source link

overloaded selection on typed trees #94

Closed liufengyun closed 6 years ago

liufengyun commented 7 years ago

@xeno-by: By a discussion with @DarkDimius, currently we still have a problem with dealing with typed trees. The problem is:

how to support selecting a specific overloaded name from a typed tree?

Scalac does it by symbols, Dotty does it by signatures. What should we do in the macro system?

xeno-by commented 7 years ago

@liufengyun Could you elaborate on how this works in Dotty? I don't have enough familiarity with Dotty internals to make suggestions.

liufengyun commented 7 years ago

@xeno-by I'm not 100% sure, but there's a type TermRefWithSignature, which uniquely identify an overloaded name by signature: https://github.com/lampepfl/dotty/blob/a33258e333c494e0d28d95f64dcf0cec11417e04/compiler/src/dotty/tools/dotc/core/Types.scala#L1888

liufengyun commented 7 years ago

overloading resolution is handled here in the typer: https://github.com/lampepfl/dotty/blob/9b99107d2837019254660abfdbb7e8d36a292d09/compiler/src/dotty/tools/dotc/typer/Typer.scala#L1902

liufengyun commented 6 years ago

More generally, this is the adaptation problem in writing typed macros: users need to do apply insertion, type parameter synthesis, overloading resolution, implicit resolution manually.

We need a general solution to the adaptation problem.

liufengyun commented 6 years ago

@DarkDimius FYI, we've proposed a solution to address the good problem you raised before.