From 988087cce6fe893399246560d34b3ad27bd150d9 Mon Sep 17 00:00:00 2001 From: Yuito Murase Date: Mon, 24 Jul 2023 16:02:44 +0900 Subject: [PATCH] Update validation rule of splice pattern with type args --- .../src/dotty/tools/dotc/typer/QuotesAndSplices.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala b/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala index 08c0b1142cb4..c4f54f02b8da 100644 --- a/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala +++ b/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala @@ -191,10 +191,11 @@ trait QuotesAndSplices { val splice1 = typedSplicePattern(splice, ProtoTypes.PolyProto(typedArgs, defn.FunctionOf(argTypes, pt))) val typedTypeApply = untpd.cpy.TypeApply(typeApplyTree)(splice1.select(nme.apply), typedTypeargs) untpd.cpy.Apply(tree)(typedTypeApply, typedArgs).withType(pt) - else // $x(...) higher-order quasipattern - // TODO-18271: Case for highr-order quasi-quote pattern with type params - if typeargs.isEmpty || args.isEmpty then - report.error("Missing arguments for open pattern", tree.srcPos) + else // $x[...](...) higher-order quasipattern + // Empty args is allowed + if typeargs.isEmpty then + // TODO-18271: Better error message + report.error("Missing type arguments for open pattern", tree.srcPos) typedSplicePattern(untpd.cpy.SplicePattern(tree)(splice.body, typeargs, args), pt) }