Closed liufengyun closed 6 years ago
@liufengyun Could you elaborate on how this works in Dotty? I don't have enough familiarity with Dotty internals to make suggestions.
@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
overloading resolution is handled here in the typer: https://github.com/lampepfl/dotty/blob/9b99107d2837019254660abfdbb7e8d36a292d09/compiler/src/dotty/tools/dotc/typer/Typer.scala#L1902
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.
@DarkDimius FYI, we've proposed a solution to address the good problem you raised before.
@xeno-by: By a discussion with @DarkDimius, currently we still have a problem with dealing with typed trees. The problem is:
Scalac does it by symbols, Dotty does it by signatures. What should we do in the macro system?