From 0500a8cdf4190123518d8dbda801a1b30a63071d Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Mon, 13 May 2024 20:58:31 +0200 Subject: [PATCH] bugfix: Don't include target option for PC It's not important for presentation compiler and causes a warning when wrongly paired with release option. It's easier to just ingore it. --- .../scala/meta/internal/metals/CompilerConfiguration.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/metals/src/main/scala/scala/meta/internal/metals/CompilerConfiguration.scala b/metals/src/main/scala/scala/meta/internal/metals/CompilerConfiguration.scala index 84079928bdf..03c0cb760bd 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/CompilerConfiguration.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/CompilerConfiguration.scala @@ -353,7 +353,12 @@ class CompilerConfiguration( releaseVersion match { case Some(version) => - scalacOptions ++ List("-release", version.toString()) + /* Filter out -target: and -Xtarget: options, since they are not relevant and + * might interfere with -release option */ + val filterOutTarget = scalacOptions.filter(opt => + opt.startsWith("-target:") || opt.startsWith("-Xtarget:") + ) + filterOutTarget ++ List("-release", version.toString()) case _ => scalacOptions } }