File tree Expand file tree Collapse file tree 3 files changed +45
-2
lines changed
Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Scala (https://www.scala-lang.org)
3+ *
4+ * Copyright EPFL and Lightbend, Inc. dba Akka
5+ *
6+ * Licensed under Apache License 2.0
7+ * (http://www.apache.org/licenses/LICENSE-2.0).
8+ *
9+ * See the NOTICE file distributed with this work for
10+ * additional information regarding copyright ownership.
11+ */
12+
13+ package scala
14+
15+ /** This class implements errors which are thrown whenever an
16+ * object doesn't match any pattern of a pattern matching
17+ * expression.
18+ */
19+ final class MatchError (@ transient obj : Any ) extends RuntimeException {
20+ /** There's no reason we need to call toString eagerly,
21+ * so defer it until getMessage is called or object is serialized
22+ */
23+ private [this ] lazy val objString = {
24+ if (obj == null ) " null"
25+ else {
26+ val cls = obj.getClass()
27+ val ofClass =
28+ if (cls == null ) " of a JS class"
29+ else s " of class ${cls.getName()}"
30+ try s " $obj ( $ofClass) "
31+ catch {
32+ case _ : Throwable => " an instance " + ofClass
33+ }
34+ }
35+ }
36+
37+ @ throws[java.io.ObjectStreamException ]
38+ private def writeReplace (): Object = {
39+ objString
40+ this
41+ }
42+
43+ override def getMessage () = objString
44+ }
Original file line number Diff line number Diff line change 66libraryDependencySchemes +=
77 " org.scala-lang.modules" %% " scala-xml" % VersionScheme .Always
88
9- addSbtPlugin(" org.scala-js" % " sbt-scalajs" % " 1.20.1 " )
9+ addSbtPlugin(" org.scala-js" % " sbt-scalajs" % " 1.20.2 " )
1010
1111addSbtPlugin(" com.github.sbt" % " sbt-pgp" % " 2.2.1" )
1212
Original file line number Diff line number Diff line change 1- // scalajs: --skip --pending
21object Test {
32 type T = String
43
You can’t perform that action at this time.
0 commit comments