From 8410a36f9979a7d8caf78527c6879aab2d86d0d2 Mon Sep 17 00:00:00 2001 From: Yichen Xu Date: Tue, 14 Nov 2023 02:31:23 +0100 Subject: [PATCH 1/2] Reset comparersInUse --- compiler/src/dotty/tools/dotc/core/Contexts.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala index c575f7bc72f7..dec73f7243e8 100644 --- a/compiler/src/dotty/tools/dotc/core/Contexts.scala +++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala @@ -1063,6 +1063,7 @@ object Contexts { sources.clear() files.clear() comparers.clear() // forces re-evaluation of top and bottom classes in TypeComparer + comparersInUse = 0 // Test that access is single threaded From 44c96748887fe47ac8df55069639154373cb7819 Mon Sep 17 00:00:00 2001 From: Yichen Xu Date: Tue, 14 Nov 2023 02:31:51 +0100 Subject: [PATCH 2/2] Add test case for #18855 --- tests/pos-macros/i18855/invoc.scala | 3 +++ tests/pos-macros/i18855/macro.scala | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/pos-macros/i18855/invoc.scala create mode 100644 tests/pos-macros/i18855/macro.scala diff --git a/tests/pos-macros/i18855/invoc.scala b/tests/pos-macros/i18855/invoc.scala new file mode 100644 index 000000000000..2923abd4836a --- /dev/null +++ b/tests/pos-macros/i18855/invoc.scala @@ -0,0 +1,3 @@ +import scala.language.experimental.captureChecking +val x = run() + diff --git a/tests/pos-macros/i18855/macro.scala b/tests/pos-macros/i18855/macro.scala new file mode 100644 index 000000000000..1c0ee28effbe --- /dev/null +++ b/tests/pos-macros/i18855/macro.scala @@ -0,0 +1,7 @@ +import scala.quoted.* +import scala.language.experimental.captureChecking + +def impl()(using Quotes): Expr[Unit] = '{()} +inline def run(): Unit = ${impl()} + +