Skip to content

Commit a28b1ce

Browse files
committed
Convert type apply with splices to SplicePattern
1 parent e498e3a commit a28b1ce

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ trait Applications extends Compatibility {
10971097
}
10981098
else {
10991099
val app = tree.fun match
1100+
case untpd.TypeApply(_: untpd.SplicePattern, _) => typedAppliedSpliceWithTypes(tree, pt)
11001101
case _: untpd.SplicePattern => typedAppliedSplice(tree, pt)
11011102
case _ => realApply
11021103
app match {
@@ -1150,6 +1151,10 @@ trait Applications extends Compatibility {
11501151
val isNamed = hasNamedArg(tree.args)
11511152
val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
11521153
record("typedTypeApply")
1154+
tree.fun match
1155+
case _: untpd.SplicePattern => return typedTypeAppliedSplice(tree, pt)
1156+
case _ =>
1157+
11531158
typedExpr(tree.fun, PolyProto(typedArgs, pt)) match {
11541159
case fun: TypeApply if !ctx.isAfterTyper =>
11551160
val function = fun.fun

compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ trait QuotesAndSplices {
192192
typedSplicePattern(untpd.cpy.SplicePattern(tree)(splice.body, typeargs, args), pt)
193193
}
194194

195+
def typedTypeAppliedSplice(tree: untpd.TypeApply, pt: Type)(using Context): Tree = {
196+
typedAppliedSpliceWithTypes(untpd.Apply(tree, Nil), pt)
197+
}
198+
195199
/** Type check a type binding reference in a quoted pattern.
196200
*
197201
* If no binding exists with that name, this becomes the definition of a new type binding.

0 commit comments

Comments
 (0)