Skip to content

Support scala 3 #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ jdk:
- openjdk8
env:
- SCALAJS_VERSION=0.6.28
- SCALAJS_VERSION=1.0.0
- SCALAJS_VERSION=1.5.0
matrix:
exclude:
- scala: 2.10.7
env: SCALAJS_VERSION=1.0.0
env: SCALAJS_VERSION=1.5.0
include:
- scala: 2.12.10
env: SCALAJS_VERSION=1.0.0
env: SCALAJS_VERSION=1.5.0
script:
- sbt readme/run

Expand Down
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ lazy val root = project.in(file(".")).
name := "Scala.js DOM"

crossScalaVersions in ThisBuild := {
if (scalaJSVersion.startsWith("1.")) Seq("2.12.10", "2.11.12", "2.13.1")
if (scalaJSVersion.startsWith("1.")) Seq("2.12.10", "2.11.12", "2.13.5", "3.0.0-RC1")
else Seq("2.12.10", "2.11.12", "2.10.7", "2.13.1")
}
scalaVersion in ThisBuild := crossScalaVersions.value.head

val commonSettings = Seq(
resolvers += Resolver.JCenterRepository,
version := "1.2.0-SNAPSHOT",
organization := "org.scala-js",
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings")
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.2.8
sbt.version=1.5.0-M2
2 changes: 1 addition & 1 deletion project/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
val scalaJSVersion =
Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.0.0")
Option(System.getenv("SCALAJS_VERSION")).getOrElse("1.5.0")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)

Expand Down
2 changes: 0 additions & 2 deletions src/main/scala/org/scalajs/dom/crypto/Crypto.scala
Original file line number Diff line number Diff line change
Expand Up @@ -930,10 +930,8 @@ object KeyFormat {
trait RSAPublicKey extends js.Object {

/* modulus, as a base64 URL encoded String */
@js.native
def n: String = js.native

/* exponent, as a base64 URL encoded String */
@js.native
def e: String = js.native
}
2 changes: 1 addition & 1 deletion src/main/scala/org/scalajs/dom/experimental/URL.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import scala.scalajs.js.annotation._
*/
@js.native
@JSGlobal
class URL(url: String, base: String = js.native) extends js.Object {
class URL(val url: String, val base: String) extends js.Object {

/**
* Returns a DOMString containing the origin of the URL, that is its scheme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import org.scalajs.dom.webworkers
*/
@js.native
@JSGlobal
class SharedWorker(stringUrl: String, name: js.UndefOr[String] = js.native)
class SharedWorker(stringUrl: String, name: js.UndefOr[String])
extends webworkers.AbstractWorker {

/**
Expand Down
13 changes: 7 additions & 6 deletions src/main/scala/org/scalajs/dom/ext/package.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.scalajs.dom

import scala.language.implicitConversions

Comment on lines 3 to -4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this empty line. We always keep import scala.language.* separate from the others.

import scala.collection.mutable
import scala.runtime.RichDouble

package object ext {

Expand All @@ -22,17 +22,18 @@ package object ext {
def cast[T] = x.asInstanceOf[T]
}

implicit def pimpAnimatedNumber(x: svg.AnimatedNumber) = x.baseVal
implicit def pimpAnimatedNumber(x: svg.AnimatedNumber): Double = x.baseVal

implicit def pimpRichAnimatedNumber(x: svg.AnimatedNumber) =
implicit def pimpRichAnimatedNumber(x: svg.AnimatedNumber): RichDouble =
x.baseVal: runtime.RichDouble

implicit def pimpAnimatedLength(x: svg.AnimatedLength) = x.baseVal.value
implicit def pimpAnimatedLength(x: svg.AnimatedLength): Double =
x.baseVal.value

implicit def pimpRichAnimatedLength(x: svg.AnimatedLength) =
implicit def pimpRichAnimatedLength(x: svg.AnimatedLength): RichDouble =
x.baseVal.value: runtime.RichDouble

implicit def color2String(c: Color) = c.toString
implicit def color2String(c: Color): String = c.toString
implicit class pimpedContext(val ctx: CanvasRenderingContext2D) {
def prepCircle(x: Double, y: Double, r: Double) = {
ctx.beginPath()
Expand Down