From 94a69dbe060fb954aedcef6d9e46815e744dd941 Mon Sep 17 00:00:00 2001 From: Matt Bovel Date: Fri, 25 Oct 2024 09:53:54 +0200 Subject: [PATCH] Allow JS Symbols --- compiler/src/dotty/tools/dotc/core/Definitions.scala | 1 + compiler/src/dotty/tools/dotc/typer/Checking.scala | 1 + 2 files changed, 2 insertions(+) diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index fe9269264124..206a3f2cf0ca 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -500,6 +500,7 @@ class Definitions { @tu lazy val DummyImplicitClass: ClassSymbol = requiredClass("scala.DummyImplicit") @tu lazy val SymbolModule: Symbol = requiredModule("scala.Symbol") + @tu lazy val JSSymbolModule: Symbol = requiredModule("scala.scalajs.js.Symbol") @tu lazy val ScalaRuntimeModule: Symbol = requiredModule("scala.runtime.ScalaRunTime") def runtimeMethodRef(name: PreName): TermRef = ScalaRuntimeModule.requiredMethodRef(name) diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index 1c38fad2df76..f604839135cd 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -958,6 +958,7 @@ object Checking { qual.symbol == defn.ArrayModule || qual.symbol == defn.ClassTagModule // class tags are used as arguments to Array.apply || qual.symbol == defn.SymbolModule // used in Akka + || qual.symbol == defn.JSSymbolModule // used in Scala.js || isTupleModule(qual.symbol) case Select(New(clazz), nme.CONSTRUCTOR) => clazz.symbol.isAnnotation case Apply(fun, _) => isFunctionAllowed(fun)