Skip to content

Commit

Permalink
WIP: Adapt types of parameters in Higher-order term hole
Browse files Browse the repository at this point in the history
  • Loading branch information
zeptometer committed Jun 3, 2023
1 parent f45e98f commit 209d763
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import dotty.tools.dotc.core.Types.*
import dotty.tools.dotc.core.StdNames.nme
import dotty.tools.dotc.core.Symbols.*
import dotty.tools.dotc.util.optional
import dotty.tools.dotc.core.Types
import dotty.tools.dotc.core.Definitions

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

/** The Definitions object */
def defn(using Context): Definitions = ctx.definitions

/*
* PR-17567 Remaining TODOs
* * [ ] Implicit / Contextual parameters
* * [ ] Nested Method Types
* * [ ] Erased Types
*/
def adaptTypes(tpe: Type)(using Context): Type =
new Types.TypeMap {
def apply(tp: Types.Type): Types.Type = tp match
case tp: MethodType => {
return defn.FunctionOf(tp.paramInfos, tp.resultType)
}
case _ => mapOver(tp)
}.apply(tpe)

/** Return the expression that was extracted from a hole.
*
* If it was a closed expression it returns that expression. Otherwise,
Expand Down

0 comments on commit 209d763

Please sign in to comment.