From 8b3dadbd5308729743c3e64738f95f3cff2edf2b Mon Sep 17 00:00:00 2001 From: Jan Chyb Date: Fri, 5 Apr 2024 15:10:01 +0200 Subject: [PATCH] Fix TermRef prefixes not having their type healed --- compiler/src/dotty/tools/dotc/staging/HealType.scala | 2 +- tests/pos-macros/i19767.scala | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/pos-macros/i19767.scala diff --git a/compiler/src/dotty/tools/dotc/staging/HealType.scala b/compiler/src/dotty/tools/dotc/staging/HealType.scala index 08e1e91b0bad..5a26803c8137 100644 --- a/compiler/src/dotty/tools/dotc/staging/HealType.scala +++ b/compiler/src/dotty/tools/dotc/staging/HealType.scala @@ -35,7 +35,7 @@ class HealType(pos: SrcPos)(using Context) extends TypeMap { case tp: TermRef => val inconsistentRoot = levelInconsistentRootOfPath(tp) if inconsistentRoot.exists then levelError(inconsistentRoot, tp, pos) - else tp + else mapOver(tp) case tp: AnnotatedType => derivedAnnotatedType(tp, apply(tp.parent), tp.annot) case _ => diff --git a/tests/pos-macros/i19767.scala b/tests/pos-macros/i19767.scala new file mode 100644 index 000000000000..2fb655b58a1b --- /dev/null +++ b/tests/pos-macros/i19767.scala @@ -0,0 +1,7 @@ +import scala.quoted.* + +class ICons[K <: Singleton](val key: K) + +def filterX(using Quotes): Unit = + (??? : Expr[Any]) match + case '{ $y : ICons[k1] } => '{ ICons($y.key) } \ No newline at end of file