aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 007eaa468..dc41cc567 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -553,9 +553,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
}
+ def typedBlockStats(stats: List[untpd.Tree])(implicit ctx: Context): (Context, List[tpd.Tree]) =
+ (index(stats), typedStats(stats, ctx.owner))
+
def typedBlock(tree: untpd.Block, pt: Type)(implicit ctx: Context) = track("typedBlock") {
- val exprCtx = index(tree.stats)
- val stats1 = typedStats(tree.stats, ctx.owner)
+ val (exprCtx, stats1) = typedBlockStats(tree.stats)
val ept =
if (tree.isInstanceOf[untpd.InfixOpBlock])
// Right-binding infix operations are expanded to InfixBlocks, which may be followed by arguments.
@@ -943,6 +945,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
assignType(cpy.SeqLiteral(tree)(elems1, elemtpt1), elems1, elemtpt1)
}
+ def typedInlined(tree: untpd.Inlined, pt: Type)(implicit ctx: Context): Inlined = {
+ val (exprCtx, bindings1) = typedBlockStats(tree.bindings)
+ val expansion1 = typed(tree.expansion, pt)(Inliner.inlineContext(tree)(exprCtx))
+ cpy.Inlined(tree)(tree.call, bindings1.asInstanceOf[List[MemberDef]], expansion1)
+ .withType(expansion1.tpe)
+ }
+
def typedTypeTree(tree: untpd.TypeTree, pt: Type)(implicit ctx: Context): TypeTree = track("typedTypeTree") {
if (tree.original.isEmpty)
tree match {
@@ -1429,6 +1438,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
case tree: untpd.TypeApply => typedTypeApply(tree, pt)
case tree: untpd.Super => typedSuper(tree, pt)
case tree: untpd.SeqLiteral => typedSeqLiteral(tree, pt)
+ case tree: untpd.Inlined => typedInlined(tree, pt)
case tree: untpd.TypeTree => typedTypeTree(tree, pt)
case tree: untpd.SingletonTypeTree => typedSingletonTypeTree(tree)
case tree: untpd.AndTypeTree => typedAndTypeTree(tree)