Skip to content

Commit 209d763

Browse files
committed
WIP: Adapt types of parameters in Higher-order term hole
1 parent f45e98f commit 209d763

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import dotty.tools.dotc.core.Types.*
99
import dotty.tools.dotc.core.StdNames.nme
1010
import dotty.tools.dotc.core.Symbols.*
1111
import dotty.tools.dotc.util.optional
12+
import dotty.tools.dotc.core.Types
13+
import dotty.tools.dotc.core.Definitions
1214

1315
/** Matches a quoted tree against a quoted pattern tree.
1416
* A quoted pattern tree may have type and term holes in addition to normal terms.
@@ -472,6 +474,24 @@ object QuoteMatcher {
472474
*/
473475
case OpenTree(tree: Tree, patternTpe: Type, args: List[Tree], env: Env)
474476

477+
/** The Definitions object */
478+
def defn(using Context): Definitions = ctx.definitions
479+
480+
/*
481+
* PR-17567 Remaining TODOs
482+
* * [ ] Implicit / Contextual parameters
483+
* * [ ] Nested Method Types
484+
* * [ ] Erased Types
485+
*/
486+
def adaptTypes(tpe: Type)(using Context): Type =
487+
new Types.TypeMap {
488+
def apply(tp: Types.Type): Types.Type = tp match
489+
case tp: MethodType => {
490+
return defn.FunctionOf(tp.paramInfos, tp.resultType)
491+
}
492+
case _ => mapOver(tp)
493+
}.apply(tpe)
494+
475495
/** Return the expression that was extracted from a hole.
476496
*
477497
* If it was a closed expression it returns that expression. Otherwise,

0 commit comments

Comments
 (0)