Metals/Bloop and quoted type pattern

Dear All

Would somebody have issue with “quoted type pattern” (MatchError) witj Metals/Bloop where IntelliJ works?
Does Bloop analyze the code itself and not throught the compiler? Does there is something specific to configure to support Scala 3?
I use scala 3.7.3.

The example code is the following:

def macroImpl[A: Type](using Quotes): Expr[EchoC ::: of[A]] =

  import quotes.\*

  import quotes.reflect.\*

  val tpe = TypeRepr.of\[A\] 

  tpe.asType match

      case '\[t\] => 

        '{

          singleton.asInstanceOf\[

            EchoC:

              type Self = A

              type Companion = t

            \]

        }

  report.errorAndAbort(s"end of macro")  

and the error message is:
Exception occurred while executing macro expansion.

scala.MatchError: scala.quoted.runtime.impl.TypeImpl@26386310 (of class scala.quoted.runtime.impl.TypeImpl)

Do you have a full example? This should work the same if it also compiled in command line.

I solved the issue:

  • with bloop by pointing the java home to a courier java installation (normally it was supposed to be exatly the same jdk 21 version)
  • by using the bsp of sbt directly.

In general I found the installation of metals on vs code not easy. I geenrally always uninstall and reinstall only one jdk. IntelliJ is extremely slow as soon as I used new scala3 features.

1 Like

Do you know which version of Java was used before chaning Java Home ? We should discover anything on JAVA_HOME or under java binary automatically. We fall back to coursier installation if it’s not found.

The JDK is jdk-21.0.8.9-hotspot.

I have try another implementation test and only using sbt server works.
I am confused from where the error could come as I would except bloop server jvm configuration to be independant from the project configuration.

It might be, but it uses the same Java version as does metals. You should be able to see in the Output (Metals), where the java is take from