Skip to content

Commit e1d4216

Browse files
authored
Merge pull request scala#6623 from SethTisue/scala-js-friendly-property-check
check system property in a Scala.js-friendly way
2 parents 7cb938b + 5b758bd commit e1d4216

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/library/scala/collection/immutable/Map.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ trait MapOps[K, +V, +CC[X, +Y] <: MapOps[X, Y, CC, _], +C <: MapOps[K, V, CC, C]
126126
*/
127127
object Map extends MapFactory[Map] {
128128

129+
// getenv not getProperty for Scala.js friendliness.
130+
// TODO remove before 2.13.0-RC1? see scala/collection-strawman#572
129131
private final val useBaseline: Boolean =
130-
scala.sys.props.get("scala.collection.immutable.useBaseline").contains("true")
132+
System.getenv("SCALA_COLLECTION_IMMUTABLE_USE_BASELINE") == "true"
131133

132134
@SerialVersionUID(3L)
133135
class WithDefault[K, +V](val underlying: Map[K, V], val defaultValue: K => V)

src/library/scala/collection/immutable/Set.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ trait SetOps[A, +CC[X], +C <: SetOps[A, CC, C]]
6161
*/
6262
object Set extends IterableFactory[Set] {
6363

64+
// getenv not getProperty for Scala.js friendliness.
65+
// TODO remove before 2.13.0-RC1? see scala/collection-strawman#572
6466
private final val useBaseline: Boolean =
65-
scala.sys.props.get("scala.collection.immutable.useBaseline").contains("true")
67+
System.getenv("SCALA_COLLECTION_IMMUTABLE_USE_BASELINE") == "true"
6668

6769
def empty[A]: Set[A] = EmptySet.asInstanceOf[Set[A]]
6870

@@ -219,4 +221,4 @@ object Set extends IterableFactory[Set] {
219221
}
220222

221223
/** Explicit instantiation of the `Set` trait to reduce class file size in subclasses. */
222-
abstract class AbstractSet[A] extends scala.collection.AbstractSet[A] with Set[A]
224+
abstract class AbstractSet[A] extends scala.collection.AbstractSet[A] with Set[A]

0 commit comments

Comments
 (0)