Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ object bangnotation {
def reify[V](body: quoted.Expr[_])(using valueType: quoted.Type[V]): quoted.Expr[_] = {
val bodyTerm = body.asTerm.underlyingArgument
val reifiedTerm = KeywordTree(bodyTerm).keywordTerm
reifiedTerm.usingExpr { [K] => (k: quoted.Expr[K]) => (tk: quoted.Type[K]) =>
given quoted.Type[K] = tk
'{keywords.Typed[K, V]($k)}: quoted.Expr[_]
}
reifiedTerm.usingExpr { [K] => (k: quoted.Expr[K]) => (tk: quoted.Type[K]) =>
given quoted.Type[K] = tk
'{keywords.Typed[K, V]($k)}: quoted.Expr[_]
}
}

def resetDefDef(defDef: DefDef): DefDef = {
val DefDef(name, typeParamsAndParams, tpt, rhsOption) = defDef
Expand Down Expand Up @@ -149,8 +149,6 @@ object bangnotation {
def where(blockTemplate: qctx.reflect.Block, statement: Statement): KeywordTree = Let(blockTemplate, statement, this)
def block: KeywordTree = Block(this)
def usingKeyword[B, Bound](f: [K, V <: Bound] => quoted.Expr[K] => (tk: quoted.Type[K], tv: quoted.Type[V]) => B): B = {
// given quoted.Type[K] = tk
// given quoted.Type[V] = tv
keywordTerm.usingExpr[B, Any]{ [K] => (keyword: quoted.Expr[K]) => ( keywordType: quoted.Type[K]) =>
{
given quoted.Type[K] = keywordType
Expand Down Expand Up @@ -296,7 +294,6 @@ object bangnotation {
term.tpe
)
case typed @ qctx.reflect.Typed(expr, tpt) =>
// Typed(KeywordTree(expr), typed)
KeywordTree(expr).flatMap { pureExpr =>
Pure(qctx.reflect.Typed.copy(typed)(pureExpr, tpt), term.tpe)
}
Expand Down Expand Up @@ -660,19 +657,6 @@ object bangnotation {
}
}

// case class Typed(originalTree: KeywordTree, template: qctx.reflect.Typed) extends KeywordTree {
// def valueType = template.tpe
// override def flatMap(flatMapper: Term => KeywordTree): KeywordTree = {
// originalTree.flatMap { term =>
// flatMapper(qctx.reflect.Typed.copy(template)(term, template.tpt))
// }
// }
// lazy val keywordTerm = {
// val typedObject = '{keywords.Typed}.asTerm
// Apply(TypeApply(Select.unique(typedObject, "apply"), List(Inferred(originalTree.keywordTerm.tpe), Inferred(valueType))), List(originalTree.keywordTerm))
// }
// }

case class Keyword(keywordTerm: Term, valueType: TypeRepr) extends KeywordTree

case class Pure(term: Term, valueType: TypeRepr) extends KeywordTree {
Expand Down