Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:

- name: Scala.js Test
run: |
./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test ;sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
./project/scripts/sbt ";sjsSandbox/run ;sjsSandbox/test ;sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test"

test_windows_fast:
runs-on: [self-hosted, Windows]
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
shell: cmd

- name: Scala.js Test
run: sbt ";sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test ;sjsCompilerTests/test"
run: sbt ";sjsJUnitTests/test ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToESModules ;sjsJUnitTests/test"
shell: cmd

test_windows_full:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/stdlib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,24 @@ jobs:
- name: Report MiMa issues in `tasty-core-bootstrapped`
run: ./project/scripts/sbt tasty-core-bootstrapped-new/mimaReportBinaryIssues

mima-scala-library-sjs:
runs-on: ubuntu-latest
needs: scala-library-sjs
steps:
- name: Git Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'

- uses: sbt/setup-sbt@v1
- name: Report MiMa issues in `scala-library-sjs`
run: ./project/scripts/sbt scala-library-sjs/mimaReportBinaryIssues

#################################################################################################
########################################### TEST JOBS ###########################################
#################################################################################################
Expand Down Expand Up @@ -499,3 +517,20 @@ jobs:
- uses: sbt/setup-sbt@v1
- name: Test `tasty-core-bootstrapped`
run: ./project/scripts/sbt tasty-core-bootstrapped-new/test

test-scala-js:
runs-on: ubuntu-latest
needs: [scala3-compiler-bootstrapped, tasty-core-bootstrapped, scala3-staging, scala3-tasty-inspector, scala-library-sjs]
steps:
- name: Git Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'
- uses: sbt/setup-sbt@v1
- name: Test `tasty-core-bootstrapped`
run: ./project/scripts/sbt sjsCompilerTests/test
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeErasure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ object SourceLanguage:
SourceLanguage.Java
// Scala 2 methods don't have Inline set, except for the ones injected with `patchStdlibClass`
// which are really Scala 3 methods.
else if denot.isClass && denot.is(Scala2x) || (denot.maybeOwner.lastKnownDenotation.is(Scala2x) && !denot.is(Inline)) then
else if denot.isClass && denot.is(Scala2x)
|| (denot.maybeOwner.lastKnownDenotation.is(Scala2x) && !denot.is(Inline))
|| denot.is(Param) && denot.maybeOwner.is(Method) && denot.maybeOwner.maybeOwner.lastKnownDenotation.is(Scala2x) then
SourceLanguage.Scala2
else
SourceLanguage.Scala3
Expand Down
3 changes: 0 additions & 3 deletions compiler/test/dotty/Properties.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ object Properties {
/** dotty-interfaces jar */
def dottyInterfaces: String = sys.props("dotty.tests.classes.dottyInterfaces")

/** dotty-library-js jar */
def dottyLibraryJS: String = sys.props("dotty.tests.classes.dottyLibraryJS")

/** dotty-compiler jar */
def dottyCompiler: String = sys.props("dotty.tests.classes.dottyCompiler")

Expand Down
1 change: 0 additions & 1 deletion compiler/test/dotty/tools/vulpix/TestConfiguration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ object TestConfiguration {
Properties.scalaJSJavalib,
Properties.scalaJSScalalib,
Properties.scalaJSLibrary,
Properties.dottyLibraryJS
))

def mkClasspath(classpaths: List[String]): String =
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/App.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

package scala

import scala.language.`2.13`

import java.lang.System.{currentTimeMillis => currentTime}
import scala.collection.mutable.ListBuffer

Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/Array.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

package scala

import scala.language.`2.13`

import language.experimental.captureChecking

//import scala.collection.generic._
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/Console.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

package scala

import scala.language.`2.13`

import java.io.{ BufferedReader, InputStream, InputStreamReader, OutputStream, PrintStream, Reader }
import scala.io.AnsiColor
import scala.util.DynamicVariable
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/Enumeration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

package scala

import scala.language.`2.13`

import scala.collection.{SpecificIterableFactory, StrictOptimizedIterableOps, View, immutable, mutable}
import java.lang.reflect.{Field => JField, Method => JMethod}

Expand Down
66 changes: 6 additions & 60 deletions library-js/src/scala/Symbol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

package scala

import scala.language.`2.13`

import scala.scalajs.js

/** This class provides a simple way to get unique objects for equal strings.
Expand All @@ -37,15 +39,14 @@ final class Symbol private (val name: String) extends Serializable {
override def equals(other: Any) = this eq other.asInstanceOf[AnyRef]
}

// Modified to use Scala.js specific cache
object Symbol extends JSUniquenessCache[Symbol] {
object Symbol extends UniquenessCache[String, Symbol] {
override def apply(name: String): Symbol = super.apply(name)
protected def valueFromKey(name: String): Symbol = new Symbol(name)
protected def keyFromValue(sym: Symbol): Option[String] = Some(sym.name)
}

private[scala] abstract class JSUniquenessCache[V]
{
// Modified to use Scala.js specific cache
private[scala] abstract class UniquenessCache[K, V >: Null] {
private val cache = js.Dictionary.empty[V]

protected def valueFromKey(k: String): V
Expand All @@ -55,59 +56,4 @@ private[scala] abstract class JSUniquenessCache[V]
cache.getOrElseUpdate(name, valueFromKey(name))

def unapply(other: V): Option[String] = keyFromValue(other)
}

/** This is private so it won't appear in the library API, but
* abstracted to offer some hope of reusability. */
/* DELETED for Scala.js
private[scala] abstract class UniquenessCache[K >: js.String, V >: Null]
{

import java.lang.ref.WeakReference
import java.util.WeakHashMap
import java.util.concurrent.locks.ReentrantReadWriteLock

private[this] val rwl = new ReentrantReadWriteLock()
private[this] val rlock = rwl.readLock
private[this] val wlock = rwl.writeLock
private[this] val map = new WeakHashMap[K, WeakReference[V]]

protected def valueFromKey(k: K): V
protected def keyFromValue(v: V): Option[K]

def apply(name: K): V = {
def cached(): V = {
rlock.lock
try {
val reference = map get name
if (reference == null) null
else reference.get // will be null if we were gc-ed
}
finally rlock.unlock
}
def updateCache(): V = {
wlock.lock
try {
val res = cached()
if (res != null) res
else {
// If we don't remove the old String key from the map, we can
// wind up with one String as the key and a different String as
// the name field in the Symbol, which can lead to surprising GC
// behavior and duplicate Symbols. See scala/bug#6706.
map remove name
val sym = valueFromKey(name)
map.put(name, new WeakReference(sym))
sym
}
}
finally wlock.unlock
}

val res = cached()
if (res == null) updateCache()
else res
}
def unapply(other: V): Option[K] = keyFromValue(other)
}
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

package scala.collection.immutable

import scala.language.`2.13`

import scala.collection.Stepper.EfficientSplit
import scala.collection.{AbstractIterator, AnyStepper, IterableFactoryDefaults, Iterator, Stepper, StepperShape}

Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/collection/immutable/Range.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
package scala
package collection.immutable

import scala.language.`2.13`

import scala.collection.Stepper.EfficientSplit
import scala.collection.convert.impl.RangeStepper
import scala.collection.{AbstractIterator, AnyStepper, IterableFactoryDefaults, Iterator, Stepper, StepperShape}
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/collection/mutable/ArrayBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
package scala.collection
package mutable

import scala.language.`2.13`

import scala.reflect.ClassTag
import scala.runtime.BoxedUnit

Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/collection/mutable/Buffer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
package scala.collection
package mutable

import scala.language.`2.13`

import scala.scalajs.js

/** A `Buffer` is a growable and shrinkable `Seq`. */
Expand Down
1 change: 1 addition & 0 deletions library-js/src/scala/concurrent/ExecutionContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

package scala.concurrent

import scala.language.`2.13`

import java.util.concurrent.{ ExecutorService, Executor }
import scala.annotation.implicitNotFound
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/math/ScalaNumber.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

package scala.math

import scala.language.`2.13`

/** A marker class for Number types introduced by Scala
* @author Martin Odersky, Paul Phillips
* @version 2.8
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import scala.annotation.migration

import scala.language.`2.13`

/**
* Core Scala types. They are always available without an explicit import.
* @contentDiagram hideNodes "scala.Serializable"
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/reflect/ClassTag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
package scala
package reflect

import scala.language.`2.13`

import scala.annotation.unchecked.uncheckedStable

import java.lang.{ Class => jClass }
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/reflect/Manifest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
package scala
package reflect

import scala.language.`2.13`

import scala.collection.mutable.{ArrayBuilder, ArraySeq}

/** A `Manifest[T]` is an opaque descriptor for type T. Its supported use
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/runtime/BoxesRunTime.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.runtime

import scala.language.`2.13`

import scala.math.ScalaNumber

/* The declaration of the class is only to make the JVM back-end happy when
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/runtime/ScalaRunTime.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
package scala
package runtime

import scala.language.`2.13`

import scala.collection.{AbstractIterator, AnyConstr, SortedOps, StrictOptimizedIterableOps, StringOps, StringView, View}
import scala.collection.immutable.{ArraySeq, NumericRange}
import scala.collection.mutable.StringBuilder
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/util/DynamicVariable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
package scala
package util

import scala.language.`2.13`

import java.lang.InheritableThreadLocal

/** `DynamicVariables` provide a binding mechanism where the current
Expand Down
2 changes: 2 additions & 0 deletions library-js/src/scala/util/control/NoStackTrace.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
package scala
package util.control

import scala.language.`2.13`

/** A trait for exceptions which, for efficiency reasons, do not
* fill in the stack trace. Stack trace suppression can be disabled
* on a global basis via a system property wrapper in
Expand Down
Loading
Loading