summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2016-10-24 19:25:17 -0700
committerGitHub <noreply@github.com>2016-10-24 19:25:17 -0700
commiteff0aabb7824513498a4081072845001dbe4897f (patch)
tree79e2dade4a231364d2aedc8e8f8f0d0b034a87c4
parent01b76a26ef4285aa4dfc9e1fc00c4886538e8b7d (diff)
parente0a8ffe88740995150fa7ca58797a4cceed3169f (diff)
downloadscala-eff0aabb7824513498a4081072845001dbe4897f.tar.gz
scala-eff0aabb7824513498a4081072845001dbe4897f.tar.bz2
scala-eff0aabb7824513498a4081072845001dbe4897f.zip
Merge pull request #5383 from SethTisue/post-rc1-cleanups
assorted cleanups
-rw-r--r--project/VersionUtil.scala2
-rw-r--r--spec/08-pattern-matching.md2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala10
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala6
-rw-r--r--src/eclipse/README.md4
-rw-r--r--src/interactive/scala/tools/nsc/interactive/CompilerControl.scala4
-rw-r--r--src/library/scala/collection/GenTraversableOnce.scala2
-rw-r--r--src/library/scala/inline.scala2
-rw-r--r--src/library/scala/noinline.scala2
-rw-r--r--src/library/scala/util/Either.scala38
-rw-r--r--src/repl/scala/tools/nsc/interpreter/IMain.scala2
-rw-r--r--test/files/run/indy-via-macro-with-dynamic-args/macro_1.scala4
-rw-r--r--test/files/run/indy-via-macro/macro_1.scala4
-rw-r--r--test/junit/scala/lang/primitives/BoxUnboxTest.scala391
-rw-r--r--test/junit/scala/runtime/ScalaRunTimeTest.scala2
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala2
-rw-r--r--versions.properties32
20 files changed, 242 insertions, 275 deletions
diff --git a/project/VersionUtil.scala b/project/VersionUtil.scala
index e2c2715320..409efdd261 100644
--- a/project/VersionUtil.scala
+++ b/project/VersionUtil.scala
@@ -149,7 +149,7 @@ object VersionUtil {
s"https://repo.lightbend.com/typesafe/scala-sha-bootstrap/org/scala-lang/bootstrap/$sha/$path/$libName.jar"
}
- /** Copy a boostrap dependency JAR that is on the classpath to a file */
+ /** Copy a bootstrap dependency JAR that is on the classpath to a file */
def copyBootstrapJar(cp: Seq[Attributed[File]], baseDir: File, path: String, libName: String): Unit = {
val org = bootstrapOrganization(path)
val resolved = cp.find { a =>
diff --git a/spec/08-pattern-matching.md b/spec/08-pattern-matching.md
index 38eabf29c5..ecaaa04c2b 100644
--- a/spec/08-pattern-matching.md
+++ b/spec/08-pattern-matching.md
@@ -441,7 +441,7 @@ complexity.
### Type parameter inference for constructor patterns
Assume a constructor pattern $C(p_1 , \ldots , p_n)$ where class $C$
-has type type parameters $a_1 , \ldots , a_n$. These type parameters
+has type parameters $a_1 , \ldots , a_n$. These type parameters
are inferred in the same way as for the typed pattern
`(_: $C[a_1 , \ldots , a_n]$)`.
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index bac84a4959..0b07e12917 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -297,14 +297,14 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
case app : Apply =>
generatedType = genApply(app, expectedType)
- case app @ ApplyDynamic(qual, Literal(Constant(boostrapMethodRef: Symbol)) :: staticAndDynamicArgs) =>
- val numStaticArgs = boostrapMethodRef.paramss.head.size - 3 /*JVM provided args*/
+ case app @ ApplyDynamic(qual, Literal(Constant(bootstrapMethodRef: Symbol)) :: staticAndDynamicArgs) =>
+ val numStaticArgs = bootstrapMethodRef.paramss.head.size - 3 /*JVM provided args*/
val (staticArgs, dynamicArgs) = staticAndDynamicArgs.splitAt(numStaticArgs)
- val boostrapDescriptor = staticHandleFromSymbol(boostrapMethodRef)
+ val bootstrapDescriptor = staticHandleFromSymbol(bootstrapMethodRef)
val bootstrapArgs = staticArgs.map({case t @ Literal(c: Constant) => bootstrapMethodArg(c, t.pos)})
val descriptor = methodBTypeFromMethodType(qual.symbol.info, false)
genLoadArguments(dynamicArgs, qual.symbol.info.params.map(param => typeToBType(param.info)))
- mnode.visitInvokeDynamicInsn(qual.symbol.name.encoded, descriptor.descriptor, boostrapDescriptor, bootstrapArgs : _*)
+ mnode.visitInvokeDynamicInsn(qual.symbol.name.encoded, descriptor.descriptor, bootstrapDescriptor, bootstrapArgs : _*)
case ApplyDynamic(qual, args) => sys.error("No invokedynamic support yet.")
@@ -613,7 +613,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
}
argsSize match {
case 1 => bc newarray elemKind
- case _ => // this is currently dead code is Scalac, unlike in Dotty
+ case _ => // this is currently dead code in Scalac, unlike in Dotty
val descr = ("[" * argsSize) + elemKind.descriptor // denotes the same as: arrayN(elemKind, argsSize).descriptor
mnode.visitMultiANewArrayInsn(descr, argsSize)
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala
index b088b5ee48..e0fd77bb54 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala
@@ -27,7 +27,7 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
*
* Indexing the call graph by the containing MethodNode and the invocation MethodInsnNode allows
* finding callsites efficiently. For example, an inlining heuristic might want to know all
- * callsites withing a callee method.
+ * callsites within a callee method.
*
* Note that the call graph is not guaranteed to be complete: callsites may be missing. In
* particular, if a method is very large, all of its callsites might not be in the hash map.
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala
index fedacdac41..65d1e20d69 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/LocalOpt.scala
@@ -47,7 +47,7 @@ import scala.tools.nsc.backend.jvm.opt.BytecodeUtils._
* note that eliminating empty handlers and stale local variable descriptors is required for
* correctness, see the comment in the body of `methodOptimizations`.
*
- * box-unbox elimination (eliminates box-unbox pairs withing the same method)
+ * box-unbox elimination (eliminates box-unbox pairs within the same method)
* + enables UPSTREAM:
* - nullness optimizations (a box extraction operation (unknown nullness) may be rewritten to
* a read of a non-null local. example in doc comment of box-unbox implementation)
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index cc234eb623..25475515aa 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -1093,7 +1093,7 @@ abstract class Erasure extends InfoTransform
// See SI-5568.
tree setSymbol Object_getClass
} else {
- devWarning(s"The symbol '${fn.symbol}' was interecepted but didn't match any cases, that means the intercepted methods set doesn't match the code")
+ devWarning(s"The symbol '${fn.symbol}' was intercepted but didn't match any cases, that means the intercepted methods set doesn't match the code")
tree
}
} else qual match {
@@ -1209,7 +1209,7 @@ abstract class Erasure extends InfoTransform
try super.transform(tree1).clearType()
finally tpt setType specialErasure(tree1.symbol)(tree1.symbol.tpe).resultType
- case ApplyDynamic(qual, Literal(Constant(boostrapMethodRef: Symbol)) :: _) =>
+ case ApplyDynamic(qual, Literal(Constant(bootstrapMethodRef: Symbol)) :: _) =>
tree
case _ =>
super.transform(tree1).clearType()
diff --git a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
index 2cd4785fbf..8b62409076 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
@@ -103,13 +103,13 @@ abstract class ConstantFolder {
case nme.XOR => Constant(x.longValue ^ y.longValue)
case nme.AND => Constant(x.longValue & y.longValue)
case nme.LSL if x.tag <= IntTag
- => Constant(x.intValue << y.longValue.toInt) // TODO: remove .toInt once starr includes the fix for SI-9516 (2.12.0-M5)
+ => Constant(x.intValue << y.longValue)
case nme.LSL => Constant(x.longValue << y.longValue)
case nme.LSR if x.tag <= IntTag
- => Constant(x.intValue >>> y.longValue.toInt) // TODO: remove .toInt once starr includes the fix for SI-9516 (2.12.0-M5)
+ => Constant(x.intValue >>> y.longValue)
case nme.LSR => Constant(x.longValue >>> y.longValue)
case nme.ASR if x.tag <= IntTag
- => Constant(x.intValue >> y.longValue.toInt) // TODO: remove .toInt once starr includes the fix for SI-9516 (2.12.0-M5)
+ => Constant(x.intValue >> y.longValue)
case nme.ASR => Constant(x.longValue >> y.longValue)
case nme.EQ => Constant(x.longValue == y.longValue)
case nme.NE => Constant(x.longValue != y.longValue)
diff --git a/src/eclipse/README.md b/src/eclipse/README.md
index f67fa26e5e..c7a4827341 100644
--- a/src/eclipse/README.md
+++ b/src/eclipse/README.md
@@ -57,10 +57,10 @@ If it doesn’t compile
=====================
The likely reason is that the build path of the imported projects isn’t correct. This can happen for instance
-when the [version.properties](https://github.com/scala/scala/blob/master/versions.properties) file is updated,
+when the [versions.properties](https://github.com/scala/scala/blob/master/versions.properties) file is updated,
and Eclipse .classpath of the different projects isn’t updated accordingly. The fix is simple, manually inspect
the build path of each project and make sure the version of the declared dependencies is in sync with the version
-declared in the `version.properties` file. If it isn’t, update it manually and, when done, don’t forget to share
+declared in the `versions.properties` file. If it isn’t, update it manually and, when done, don’t forget to share
your changes via a pull request.
(We are aware this is cumbersome. If you feel like scripting the process, pull requests are of course welcome.)
diff --git a/src/interactive/scala/tools/nsc/interactive/CompilerControl.scala b/src/interactive/scala/tools/nsc/interactive/CompilerControl.scala
index cb12cebc49..462f4432cd 100644
--- a/src/interactive/scala/tools/nsc/interactive/CompilerControl.scala
+++ b/src/interactive/scala/tools/nsc/interactive/CompilerControl.scala
@@ -101,11 +101,11 @@ trait CompilerControl { self: Global =>
* the given sources at the head of the list of to-be-compiled sources.
*/
def askReload(sources: List[SourceFile], response: Response[Unit]) = {
- val superseeded = scheduler.dequeueAll {
+ val superseded = scheduler.dequeueAll {
case ri: ReloadItem if ri.sources == sources => Some(ri)
case _ => None
}
- superseeded.foreach(_.response.set(()))
+ superseded.foreach(_.response.set(()))
postWorkItem(new ReloadItem(sources, response))
}
diff --git a/src/library/scala/collection/GenTraversableOnce.scala b/src/library/scala/collection/GenTraversableOnce.scala
index d3096a872c..f87f7654bc 100644
--- a/src/library/scala/collection/GenTraversableOnce.scala
+++ b/src/library/scala/collection/GenTraversableOnce.scala
@@ -96,7 +96,7 @@ trait GenTraversableOnce[+A] extends Any {
*/
def size: Int
- /** The size of this $coll if it is can be cheaply computed
+ /** The size of this $coll, if it can be cheaply computed
*
* @return the number of elements in this $coll, or -1 if the size cannot be determined cheaply
*/
diff --git a/src/library/scala/inline.scala b/src/library/scala/inline.scala
index dc55af301c..f6d7c7569e 100644
--- a/src/library/scala/inline.scala
+++ b/src/library/scala/inline.scala
@@ -29,7 +29,7 @@ package scala
* }
* }}}
*
- * Note: parentheses are required when annotating a callsite withing a larger expression.
+ * Note: parentheses are required when annotating a callsite within a larger expression.
*
* {{{
* def t1 = f1(1) + f1(1): @noinline // equivalent to (f1(1) + f1(1)): @noinline
diff --git a/src/library/scala/noinline.scala b/src/library/scala/noinline.scala
index a427e170f4..0cd5ef9f64 100644
--- a/src/library/scala/noinline.scala
+++ b/src/library/scala/noinline.scala
@@ -29,7 +29,7 @@ package scala
* }
* }}}
*
- * Note: parentheses are required when annotating a callsite withing a larger expression.
+ * Note: parentheses are required when annotating a callsite within a larger expression.
*
* {{{
* def t1 = f1(1) + f1(1): @noinline // equivalent to (f1(1) + f1(1)): @noinline
diff --git a/src/library/scala/util/Either.scala b/src/library/scala/util/Either.scala
index c332f18295..7bded972f2 100644
--- a/src/library/scala/util/Either.scala
+++ b/src/library/scala/util/Either.scala
@@ -55,31 +55,31 @@ package util
* val left23: Left[Double, Int] = Left(23.0)
* val left42 = Left(42.0)
*
- * for (
- * a <- right1;
- * b <- right2;
+ * for {
+ * a <- right1
+ * b <- right2
* c <- right3
- * ) yield a + b + c // Right(6)
+ * } yield a + b + c // Right(6)
*
- * for (
- * a <- right1;
- * b <- right2;
+ * for {
+ * a <- right1
+ * b <- right2
* c <- left23
- * ) yield a + b + c // Left(23.0)
+ * } yield a + b + c // Left(23.0)
*
- * for (
- * a <- right1;
- * b <- left23;
+ * for {
+ * a <- right1
+ * b <- left23
* c <- right2
- * ) yield a + b + c // Left(23.0)
+ * } yield a + b + c // Left(23.0)
*
* // It is advisable to provide the type of the “missing” value (especially the right value for `Left`)
* // as otherwise that type might be infered as `Nothing` without context:
- * for (
- * a <- left23;
- * b <- right1;
+ * for {
+ * a <- left23
+ * b <- right1
* c <- left42 // type at this position: Either[Double, Nothing]
- * ) yield a + b + c
+ * } yield a + b + c
* // ^
* // error: ambiguous reference to overloaded definition,
* // both method + in class Int of type (x: Char)Int
@@ -136,10 +136,10 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
* @example {{{
* val right = Right(2)
* val left = Left(3)
- * for (
- * r1 <- right;
+ * for {
+ * r1 <- right
* r2 <- left.swap
- * ) yield r1 * r2 // Right(6)
+ * } yield r1 * r2 // Right(6)
* }}}
*/
def swap: Either[B, A] = this match {
diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala
index 44784aa953..65f2c95f73 100644
--- a/src/repl/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala
@@ -1203,7 +1203,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends
/** Utility methods for the Interpreter. */
object IMain {
- /** Dummy identifier fragement inserted at the cursor before presentation compilation. Needed to support completion of `global.def<TAB>` */
+ /** Dummy identifier fragment inserted at the cursor before presentation compilation. Needed to support completion of `global.def<TAB>` */
val DummyCursorFragment = "_CURSOR_"
// The two name forms this is catching are the two sides of this assignment:
diff --git a/test/files/run/indy-via-macro-with-dynamic-args/macro_1.scala b/test/files/run/indy-via-macro-with-dynamic-args/macro_1.scala
index cb8719a235..eaafbf08e1 100644
--- a/test/files/run/indy-via-macro-with-dynamic-args/macro_1.scala
+++ b/test/files/run/indy-via-macro-with-dynamic-args/macro_1.scala
@@ -24,8 +24,8 @@ object Macro {
import c.universe._
pat match {
case l @ Literal(Constant(pat: String)) =>
- val boostrapSym = typeOf[test.Bootstrap].companion.member(TermName("bootstrap"))
- Indy(boostrapSym, l :: Nil, text :: Nil)
+ val bootstrapSym = typeOf[test.Bootstrap].companion.member(TermName("bootstrap"))
+ Indy(bootstrapSym, l :: Nil, text :: Nil)
case _ =>
q"_root_.java.util.regex.Pattern.compile($pat).matcher($text)"
}
diff --git a/test/files/run/indy-via-macro/macro_1.scala b/test/files/run/indy-via-macro/macro_1.scala
index 66e319e262..26daad7deb 100644
--- a/test/files/run/indy-via-macro/macro_1.scala
+++ b/test/files/run/indy-via-macro/macro_1.scala
@@ -23,8 +23,8 @@ object Macro {
import c.universe._
s match {
case l @ Literal(Constant(s: String)) =>
- val boostrapSym = typeOf[test.Bootstrap].companion.member(TermName("bootstrap"))
- Indy(boostrapSym, l :: Nil)
+ val bootstrapSym = typeOf[test.Bootstrap].companion.member(TermName("bootstrap"))
+ Indy(bootstrapSym, l :: Nil)
case _ =>
q"_root_.java.util.regex.Pattern.compile($s)"
}
diff --git a/test/junit/scala/lang/primitives/BoxUnboxTest.scala b/test/junit/scala/lang/primitives/BoxUnboxTest.scala
index e4911f1af5..94413b69b4 100644
--- a/test/junit/scala/lang/primitives/BoxUnboxTest.scala
+++ b/test/junit/scala/lang/primitives/BoxUnboxTest.scala
@@ -17,98 +17,84 @@ class BoxUnboxTest extends RunTesting {
@Test
def boxUnboxInt(): Unit = {
- // Once we use 2.12.0-M5 as starr, this code can be run directly in the JUnit test.
- // Some fixes not yet available in M4 make the test fail when compiled with M4.
- val code =
- """import scala.tools.testing.AssertUtil._
- |import org.junit.Assert._
- |
- |def genericNull[T] = null.asInstanceOf[T] // allowed, see SI-4437, point 2
- |
- |val b = new Integer(1)
- |val u = 1
- |
- |assertEquals(1.toInt, u)
- |
- |assertEquals(Predef.int2Integer(1), b)
- |assertEquals(1: Integer, b)
- |assertEquals(Int.box(1), b)
- |assertEquals(1.asInstanceOf[Object], b)
- |
- |assertThrows[ClassCastException]("".asInstanceOf[Integer])
- |
- |assertEquals(Predef.Integer2int(b), u)
- |assertEquals(b: Int, u)
- |assertEquals(Int.unbox(b), u)
- |assertEquals(b.asInstanceOf[Int], u)
- |assertEquals(b.intValue, u)
- |assertEquals(b.toInt, u)
- |intWrapper(b).toInt
- |
- |assertThrows[ClassCastException](Int.unbox(""))
- |assertThrows[ClassCastException]("".asInstanceOf[Int])
- |
- |// null unboxing in various positions
- |
- |val n1 = Int.unbox(null)
- |assertEquals(n1, 0)
- |val n2 = Predef.Integer2int(null)
- |assertEquals(n2, 0)
- |val n3 = (null: Integer): Int
- |assertEquals(n3, 0)
- |val n4 = null.asInstanceOf[Int]
- |assertEquals(n4, 0)
- |val n5 = null.asInstanceOf[Int] == 0
- |assertTrue(n5)
- |val n6 = null.asInstanceOf[Int] == null
- |assertFalse(n6)
- |val n7 = null.asInstanceOf[Int] != 0
- |assertFalse(n7)
- |val n8 = null.asInstanceOf[Int] != null
- |assertTrue(n8)
- |
- |val mp = new java.util.HashMap[Int, Int]
- |val n9 = mp.get(0)
- |assertEquals(n9, 0)
- |val n10 = mp.get(0) == null // SI-602
- |assertThrows[AssertionError](assertFalse(n10)) // should not throw
- |
- |def f(a: Any) = "" + a
- |val n11 = f(null.asInstanceOf[Int])
- |assertEquals(n11, "0")
- |
- |def n12 = genericNull[Int]
- |assertEquals(n12, 0)
- """.stripMargin
-
- run[Unit](code)
+ import scala.tools.testing.AssertUtil._
+ import org.junit.Assert._
+
+ def genericNull[T] = null.asInstanceOf[T] // allowed, see SI-4437, point 2
+
+ val b = new Integer(1)
+ val u = 1
+
+ assertEquals(1.toInt, u)
+
+ assertEquals(Predef.int2Integer(1), b)
+ assertEquals(1: Integer, b)
+ assertEquals(Int.box(1), b)
+ assertEquals(1.asInstanceOf[Object], b)
+
+ assertThrows[ClassCastException]("".asInstanceOf[Integer])
+
+ assertEquals(Predef.Integer2int(b), u)
+ assertEquals(b: Int, u)
+ assertEquals(Int.unbox(b), u)
+ assertEquals(b.asInstanceOf[Int], u)
+ assertEquals(b.intValue, u)
+ assertEquals(b.toInt, u)
+ intWrapper(b).toInt
+
+ assertThrows[ClassCastException](Int.unbox(""))
+ assertThrows[ClassCastException]("".asInstanceOf[Int])
+
+ // null unboxing in various positions
+
+ val n1 = Int.unbox(null)
+ assertEquals(n1, 0)
+ val n2 = Predef.Integer2int(null)
+ assertEquals(n2, 0)
+ val n3 = (null: Integer): Int
+ assertEquals(n3, 0)
+ val n4 = null.asInstanceOf[Int]
+ assertEquals(n4, 0)
+ val n5 = null.asInstanceOf[Int] == 0
+ assertTrue(n5)
+ val n6 = null.asInstanceOf[Int] == null
+ assertFalse(n6)
+ val n7 = null.asInstanceOf[Int] != 0
+ assertFalse(n7)
+ val n8 = null.asInstanceOf[Int] != null
+ assertTrue(n8)
+
+ val mp = new java.util.HashMap[Int, Int]
+ val n9 = mp.get(0)
+ assertEquals(n9, 0)
+ val n10 = mp.get(0) == null // SI-602
+ assertThrows[AssertionError](assertFalse(n10)) // should not throw
+
+ def f(a: Any) = "" + a
+ val n11 = f(null.asInstanceOf[Int])
+ assertEquals(n11, "0")
+
+ def n12 = genericNull[Int]
+ assertEquals(n12, 0)
}
@Test
def numericConversions(): Unit = {
- // Once we use 2.12.0-M5 as starr, this code can be run directly in the JUnit test.
- val code =
- """import scala.tools.testing.AssertUtil._
- |import org.junit.Assert._
- |
- |val i1 = 1L.asInstanceOf[Int]
- |assertEquals(i1, 1)
- |assertThrows[ClassCastException] {
- | val i2 = (1L: Any).asInstanceOf[Int] // SI-1448, should not throw. see also SI-4437 point 1.
- | assertEquals(i2, 1)
- |}
- """.stripMargin
- run[Unit](code)
+ import scala.tools.testing.AssertUtil._
+ import org.junit.Assert._
+
+ val i1 = 1L.asInstanceOf[Int]
+ assertEquals(i1, 1)
+ assertThrows[ClassCastException] {
+ val i2 = (1L: Any).asInstanceOf[Int] // SI-1448, should not throw. see also SI-4437 point 1.
+ assertEquals(i2, 1)
+ }
}
@Test
def boxUnboxBoolean(): Unit = {
- // Once we use 2.12.0-M5 as starr, this code can be run directly in the JUnit test.
- val code =
- """val n1 = Option(null.asInstanceOf[Boolean])
- |n1
- """.stripMargin
- assertEquals(run[Option[Boolean]](code), Some(false))
+ val n1 = Option(null.asInstanceOf[Boolean])
+ assertEquals(n1, Some(false))
}
@Test
@@ -117,133 +103,126 @@ class BoxUnboxTest extends RunTesting {
// not conform to Object, but for Java-defined methods scalac makes an exception and treats them
// as Any. passing a Unit as Any makes the compiler go through another layer of boxing, so it
// can hide some bugs (where we actually have a null, but the compiler makes it a ()).
+ import scala.tools.testing.AssertUtil._
+ import org.junit.Assert._
+
+ var v = 0
+ def eff() = { v = 1 }
+ def chk() = { assert(v == 1); v = 0 }
+
+ val b = runtime.BoxedUnit.UNIT
+
+ assert(eff() == b); chk()
+ assert(Unit.box(eff()) == b); chk()
+ assert(().asInstanceOf[Object] == b)
+
+ Unit.unbox({eff(); b}); chk()
+ Unit.unbox({eff(); null}); chk()
+ assertThrows[ClassCastException](Unit.unbox({eff(); ""})); chk()
+
+ val n1 = null.asInstanceOf[Unit]
+ assert(n1 == b)
- // Once we use 2.12.0-M5 as starr, this code can be run directly in the JUnit test.
- val code =
- """import scala.tools.testing.AssertUtil._
- |import org.junit.Assert._
- |
- |var v = 0
- |def eff() = { v = 1 }
- |def chk() = { assert(v == 1); v = 0 }
- |
- |val b = runtime.BoxedUnit.UNIT
- |
- |assert(eff() == b); chk()
- |assert(Unit.box(eff()) == b); chk()
- |assert(().asInstanceOf[Object] == b)
- |
- |Unit.unbox({eff(); b}); chk()
- |Unit.unbox({eff(); null}); chk()
- |assertThrows[ClassCastException](Unit.unbox({eff(); ""})); chk()
- |
- |val n1 = null.asInstanceOf[Unit]
- |assert(n1 == b)
- |
- |val n2 = null.asInstanceOf[Unit] == b
- |assert(n2)
- |
- |def f(a: Any) = "" + a
- |val n3 = f(null.asInstanceOf[Unit])
- |assertEquals(n3, "()")
- """.stripMargin
- run[Unit](code)
+ val n2 = null.asInstanceOf[Unit] == b
+ assert(n2)
+
+ def f(a: Any) = "" + a
+ val n3 = f(null.asInstanceOf[Unit])
+ assertEquals(n3, "()")
}
@Test
def t9671(): Unit = {
- // Once we use 2.12.0-M5 as starr, this code can be run directly in the JUnit test.
- val code =
- """import scala.lang.primitives.BoxUnboxTest.VCI
- |
- |def f1(a: Any) = "" + a
- |def f2(a: AnyVal) = "" + a
- |def f3[T](a: T) = "" + a
- |def f4(a: Int) = "" + a
- |def f5(a: VCI) = "" + a
- |def f6(u: Unit) = "" + u
- |
- |def n1: AnyRef = null
- |def n2: Null = null
- |def n3: Any = null
- |def n4[T]: T = null.asInstanceOf[T]
- |
- |def npe(s: => String) = try { s; throw new Error() } catch { case _: NullPointerException => "npe" }
- |
- | f1(null.asInstanceOf[Int]) +
- | f1( n1.asInstanceOf[Int]) +
- | f1( n2.asInstanceOf[Int]) +
- | f1( n3.asInstanceOf[Int]) +
- | f1( n4[Int]) + // "null"
- |"-" +
- | f1(null.asInstanceOf[VCI]) +
- |npe(f1( n1.asInstanceOf[VCI])) + // SI-8097
- | f1( n2.asInstanceOf[VCI]) +
- |npe(f1( n3.asInstanceOf[VCI])) + // SI-8097
- | f1( n4[VCI]) + // "null"
- |"-" +
- | f1(null.asInstanceOf[Unit]) +
- | f1( n1.asInstanceOf[Unit]) +
- | f1( n2.asInstanceOf[Unit]) +
- | f1( n3.asInstanceOf[Unit]) +
- | f1( n4[Unit]) + // "null"
- |"-" +
- | f2(null.asInstanceOf[Int]) +
- | f2( n1.asInstanceOf[Int]) +
- | f2( n2.asInstanceOf[Int]) +
- | f2( n3.asInstanceOf[Int]) +
- | f2( n4[Int]) + // "null"
- |"-" +
- | f2(null.asInstanceOf[VCI]) +
- |npe(f2( n1.asInstanceOf[VCI])) + // SI-8097
- | f2( n2.asInstanceOf[VCI]) +
- |npe(f2( n3.asInstanceOf[VCI])) + // SI-8097
- | f2( n4[VCI]) + // "null"
- |"-" +
- | f2(null.asInstanceOf[Unit]) +
- | f2( n1.asInstanceOf[Unit]) +
- | f2( n2.asInstanceOf[Unit]) +
- | f2( n3.asInstanceOf[Unit]) +
- | f2( n4[Unit]) + // "null"
- |"-" +
- | f3(null.asInstanceOf[Int]) +
- | f3( n1.asInstanceOf[Int]) +
- | f3( n2.asInstanceOf[Int]) +
- | f3( n3.asInstanceOf[Int]) +
- | f3( n4[Int]) + // "null"
- |"-" +
- | f3(null.asInstanceOf[VCI]) +
- |npe(f3( n1.asInstanceOf[VCI])) + // SI-8097
- | f3( n2.asInstanceOf[VCI]) +
- |npe(f3( n3.asInstanceOf[VCI])) + // SI-8097
- | f3( n4[VCI]) + // "null"
- |"-" +
- | f3(null.asInstanceOf[Unit]) +
- | f3( n1.asInstanceOf[Unit]) +
- | f3( n2.asInstanceOf[Unit]) +
- | f3( n3.asInstanceOf[Unit]) +
- | f3( n4[Unit]) + // "null"
- |"-" +
- | f4(null.asInstanceOf[Int]) +
- | f4( n1.asInstanceOf[Int]) +
- | f4( n2.asInstanceOf[Int]) +
- | f4( n3.asInstanceOf[Int]) +
- | f4( n4[Int]) +
- |"-" +
- | f5(null.asInstanceOf[VCI]) +
- |npe(f5( n1.asInstanceOf[VCI])) + // SI-8097
- | f5( n2.asInstanceOf[VCI]) +
- |npe(f5( n3.asInstanceOf[VCI])) + // SI-8097
- |npe(f5( n4[VCI])) + // SI-8097
- |"-" +
- | f6(null.asInstanceOf[Unit]) +
- | f6( n1.asInstanceOf[Unit]) +
- | f6( n2.asInstanceOf[Unit]) +
- | f6( n3.asInstanceOf[Unit]) +
- | f6( n4[Unit]) // "null"
- """.stripMargin
-
- assertEquals(run[String](code),
+ import scala.lang.primitives.BoxUnboxTest.VCI
+
+ def f1(a: Any) = "" + a
+ def f2(a: AnyVal) = "" + a
+ def f3[T](a: T) = "" + a
+ def f4(a: Int) = "" + a
+ def f5(a: VCI) = "" + a
+ def f6(u: Unit) = "" + u
+
+ def n1: AnyRef = null
+ def n2: Null = null
+ def n3: Any = null
+ def n4[T]: T = null.asInstanceOf[T]
+
+ def npe(s: => String) = try { s; throw new Error() } catch { case _: NullPointerException => "npe" }
+
+ val result =
+ f1(null.asInstanceOf[Int]) +
+ f1( n1.asInstanceOf[Int]) +
+ f1( n2.asInstanceOf[Int]) +
+ f1( n3.asInstanceOf[Int]) +
+ f1( n4[Int]) + // "null"
+ "-" +
+ f1(null.asInstanceOf[VCI]) +
+ npe(f1( n1.asInstanceOf[VCI])) + // SI-8097
+ f1( n2.asInstanceOf[VCI]) +
+ npe(f1( n3.asInstanceOf[VCI])) + // SI-8097
+ f1( n4[VCI]) + // "null"
+ "-" +
+ f1(null.asInstanceOf[Unit]) +
+ f1( n1.asInstanceOf[Unit]) +
+ f1( n2.asInstanceOf[Unit]) +
+ f1( n3.asInstanceOf[Unit]) +
+ f1( n4[Unit]) + // "null"
+ "-" +
+ f2(null.asInstanceOf[Int]) +
+ f2( n1.asInstanceOf[Int]) +
+ f2( n2.asInstanceOf[Int]) +
+ f2( n3.asInstanceOf[Int]) +
+ f2( n4[Int]) + // "null"
+ "-" +
+ f2(null.asInstanceOf[VCI]) +
+ npe(f2( n1.asInstanceOf[VCI])) + // SI-8097
+ f2( n2.asInstanceOf[VCI]) +
+ npe(f2( n3.asInstanceOf[VCI])) + // SI-8097
+ f2( n4[VCI]) + // "null"
+ "-" +
+ f2(null.asInstanceOf[Unit]) +
+ f2( n1.asInstanceOf[Unit]) +
+ f2( n2.asInstanceOf[Unit]) +
+ f2( n3.asInstanceOf[Unit]) +
+ f2( n4[Unit]) + // "null"
+ "-" +
+ f3(null.asInstanceOf[Int]) +
+ f3( n1.asInstanceOf[Int]) +
+ f3( n2.asInstanceOf[Int]) +
+ f3( n3.asInstanceOf[Int]) +
+ f3( n4[Int]) + // "null"
+ "-" +
+ f3(null.asInstanceOf[VCI]) +
+ npe(f3( n1.asInstanceOf[VCI])) + // SI-8097
+ f3( n2.asInstanceOf[VCI]) +
+ npe(f3( n3.asInstanceOf[VCI])) + // SI-8097
+ f3( n4[VCI]) + // "null"
+ "-" +
+ f3(null.asInstanceOf[Unit]) +
+ f3( n1.asInstanceOf[Unit]) +
+ f3( n2.asInstanceOf[Unit]) +
+ f3( n3.asInstanceOf[Unit]) +
+ f3( n4[Unit]) + // "null"
+ "-" +
+ f4(null.asInstanceOf[Int]) +
+ f4( n1.asInstanceOf[Int]) +
+ f4( n2.asInstanceOf[Int]) +
+ f4( n3.asInstanceOf[Int]) +
+ f4( n4[Int]) +
+ "-" +
+ f5(null.asInstanceOf[VCI]) +
+ npe(f5( n1.asInstanceOf[VCI])) + // SI-8097
+ f5( n2.asInstanceOf[VCI]) +
+ npe(f5( n3.asInstanceOf[VCI])) + // SI-8097
+ npe(f5( n4[VCI])) + // SI-8097
+ "-" +
+ f6(null.asInstanceOf[Unit]) +
+ f6( n1.asInstanceOf[Unit]) +
+ f6( n2.asInstanceOf[Unit]) +
+ f6( n3.asInstanceOf[Unit]) +
+ f6( n4[Unit]) // "null"
+ assertEquals(result,
"0000null-0npe0npenull-()()()()null-0000null-0npe0npenull-()()()()null-0000null-0npe0npenull-()()()()null-00000-0npe0npenpe-()()()()null")
}
+
}
diff --git a/test/junit/scala/runtime/ScalaRunTimeTest.scala b/test/junit/scala/runtime/ScalaRunTimeTest.scala
index 5bfb12610e..ba3bf0b703 100644
--- a/test/junit/scala/runtime/ScalaRunTimeTest.scala
+++ b/test/junit/scala/runtime/ScalaRunTimeTest.scala
@@ -9,7 +9,7 @@ import org.junit.runners.JUnit4
@RunWith(classOf[JUnit4])
class ScalaRunTimeTest {
@Test
- def testStingOf() {
+ def testStringOf() {
import ScalaRunTime.stringOf
import scala.collection._
import parallel.ParIterable
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala
index a2513cacdc..5362585642 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala
@@ -13,7 +13,7 @@ class InlinerSeparateCompilationTest {
val args = "-opt:l:classpath"
@Test
- def inlnieMixedinMember(): Unit = {
+ def inlineMixedinMember(): Unit = {
val codeA =
"""trait T {
| @inline def f = 0
diff --git a/versions.properties b/versions.properties
index 1f43b9cc56..950f73baa1 100644
--- a/versions.properties
+++ b/versions.properties
@@ -1,24 +1,14 @@
-#Mon, 05 Oct 2015 14:25:00 +0000
-# NOTE: this file determines the content of the scala-distribution
-# via scala-dist-pom.xml and scala-library-all-pom.xml
-# when adding new properties that influence a release,
-# also add them to the update.versions mechanism in build.xml,
-# which is used by the release script scripts/jobs/integrate/bootstrap
-
-# The scala version used for bootstrapping. This has no impact on the final classfiles:
-# there are two stages (locker and quick), so compiler and library are always built
-# with themselves. Stability is ensured by building a third stage (strap).
+# Scala version used for bootstrapping. (This has no impact on the
+# final classfiles, since compiler and library are built first using
+# starr, then rebuilt using themselves.)
starr.version=2.12.0-RC1-1e81a09
-# These are the versions of the modules that go with this release.
-# These properties are used during PR validation and in dbuild builds.
-
-# The scala.binary.version determines how modules are resolved. For example, it
-# determines which partest artifact is being used for running the tests.
-# It has to be set in the following way:
+# Set in the following way:
# - After 2.x.0 is released, the binary version is 2.x.
# - During milestones and RCs, modules are cross-built against the full version.
# So the value is the full version (e.g. 2.12.0-M2).
+# Also determines how modules are resolved. For example, it determines which
+# partest artifact is being used for running the tests.
scala.binary.version=2.12.0-RC1
# external modules shipped with distribution, as specified by scala-library-all's pom
@@ -27,14 +17,12 @@ scala-parser-combinators.version.number=1.0.4
scala-swing.version.number=2.0.0-M2
scala-swing.version.osgi=2.0.0.M2
jline.version=2.14.1
+# this one is shaded and embedded in scala-compiler.jar
scala-asm.version=5.1.0-scala-1
# external modules, used internally (not shipped)
partest.version.number=1.0.17
-# We've embedded these sources in partest-extras for now. After 2.12.0 is released
-# we can switch to a public release.
-# scalacheck.version.number=1.11.6
-# TODO: modularize the compiler
-#scala-compiler-doc.version.number=1.0.0-RC1
-#scala-compiler-interactive.version.number=1.0.0-RC1
+# TODO: We've embedded these sources in partest-extras for now.
+# after 2.12.0 is out, we can switch back to a public release.
+# scalacheck.version.number=1.11.6