Skip to content

Commit 524091f

Browse files
committed
Convert type apply with splices to SplicePattern
1 parent c363aff commit 524091f

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
@@ -1095,6 +1095,7 @@ trait Applications extends Compatibility {
10951095
}
10961096
else {
10971097
val app = tree.fun match
1098+
case untpd.TypeApply(_: untpd.SplicePattern, _) => typedAppliedSpliceWithTypes(tree, pt)
10981099
case _: untpd.SplicePattern => typedAppliedSplice(tree, pt)
10991100
case _ => realApply
11001101
app match {
@@ -1148,6 +1149,10 @@ trait Applications extends Compatibility {
11481149
val isNamed = hasNamedArg(tree.args)
11491150
val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
11501151
record("typedTypeApply")
1152+
tree.fun match
1153+
case _: untpd.SplicePattern => return typedTypeAppliedSplice(tree, pt)
1154+
case _ =>
1155+
11511156
typedExpr(tree.fun, PolyProto(typedArgs, pt)) match {
11521157
case fun: TypeApply if !ctx.isAfterTyper =>
11531158
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
@@ -193,6 +193,10 @@ trait QuotesAndSplices {
193193
typedSplicePattern(untpd.cpy.SplicePattern(tree)(splice.body, typeargs, args), pt)
194194
}
195195

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

0 commit comments

Comments
 (0)