From 0a7a2c31641f14855c555b87bc5c0acb1e2f6c6f Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Thu, 19 Feb 2015 15:48:29 -0800 Subject: Performance optimization - Iterator flatMap, find, indexWhere, indexOf Tightened up bytecode, logic, and/or performance by using local return instead of a mutable variable in several methods. Performance/bytecode size improvements (smaller bytecode = better inlining) ``` method reason =========== =============================================================== flatMap hasNext bytecode 34 bytes down from 62 find bytecode 41 bytes instead of 53 indexWhere 1.5x faster on small collections (some contexts) indexOf bytecode 89 bytes instead of 110 ``` --- src/library/scala/collection/Iterator.scala | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index c9037eb3e3..d44b45a4d7 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -392,8 +392,16 @@ trait Iterator[+A] extends TraversableOnce[A] { */ def flatMap[B](f: A => GenTraversableOnce[B]): Iterator[B] = new AbstractIterator[B] { private var cur: Iterator[B] = empty - def hasNext: Boolean = - cur.hasNext || self.hasNext && { cur = f(self.next()).toIterator; hasNext } + private def nextCur() { cur = f(self.next()).toIterator } + def hasNext: Boolean = { + // Equivalent to cur.hasNext || self.hasNext && { nextCur(); hasNext } + // but slightly shorter bytecode (better JVM inlining!) + while (!cur.hasNext) { + if (!self.hasNext) return false + nextCur() + } + true + } def next(): B = (if (hasNext) cur else empty).next() } @@ -405,6 +413,7 @@ trait Iterator[+A] extends TraversableOnce[A] { * @note Reuse: $consumesAndProducesIterator */ def filter(p: A => Boolean): Iterator[A] = new AbstractIterator[A] { + // TODO 2.12 - Make a full-fledged FilterImpl that will reverse sense of p private var hd: A = _ private var hdDefined: Boolean = false @@ -777,7 +786,7 @@ trait Iterator[+A] extends TraversableOnce[A] { * is equal (as determined by `==`) to `elem`, `false` otherwise. * @note Reuse: $consumesIterator */ - def contains(elem: Any): Boolean = exists(_ == elem) + def contains(elem: Any): Boolean = exists(_ == elem) // Note--this seems faster than manual inlining! /** Finds the first value produced by the iterator satisfying a * predicate, if any. @@ -789,12 +798,11 @@ trait Iterator[+A] extends TraversableOnce[A] { * @note Reuse: $consumesIterator */ def find(p: A => Boolean): Option[A] = { - var res: Option[A] = None - while (res.isEmpty && hasNext) { - val e = next() - if (p(e)) res = Some(e) + while (hasNext) { + val a = next() + if (p(a)) return Some(a) } - res + None } /** Returns the index of the first produced value satisfying a predicate, or -1. @@ -807,15 +815,11 @@ trait Iterator[+A] extends TraversableOnce[A] { */ def indexWhere(p: A => Boolean): Int = { var i = 0 - var found = false - while (!found && hasNext) { - if (p(next())) { - found = true - } else { - i += 1 - } + while (hasNext) { + if (p(next())) return i + i += 1 } - if (found) i else -1 + -1 } /** Returns the index of the first occurrence of the specified @@ -829,15 +833,11 @@ trait Iterator[+A] extends TraversableOnce[A] { */ def indexOf[B >: A](elem: B): Int = { var i = 0 - var found = false - while (!found && hasNext) { - if (next() == elem) { - found = true - } else { - i += 1 - } + while (hasNext) { + if (next() == elem) return i + i += 1 } - if (found) i else -1 + -1 } /** Creates a buffered iterator from this iterator. -- cgit v1.2.3 From 301011e173785d4c0c05cff52c7a4af3acb88802 Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Thu, 19 Feb 2015 15:48:36 -0800 Subject: Performance optimization - Iterator span, collect, dropWhile Rewrite of span to avoid double-indirection of `.buffered` and to avoid use of `mutable.Queue` unless it is absolutely necessary. Rewrite of `span` and `dropWhile` to also avoid `.buffered` (less DRY but single vs. double indirection and object allocation). Performance improvements: ``` method reason =========== =============================================================== collect 2.3x faster on small collections, 1.5x on large span 1.6-1.7x faster on small collections 0.85x-1.8x slower/faster on large collections depending on how much must be cached (0.85x all, 1.8x none) dropWhile 1.2x faster on small collections, half the garbage ``` --- src/library/scala/collection/Iterator.scala | 173 ++++++++++++++++++++++------ 1 file changed, 138 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index d44b45a4d7..b69e51fdf5 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -479,13 +479,27 @@ trait Iterator[+A] extends TraversableOnce[A] { * @note Reuse: $consumesAndProducesIterator */ @migration("`collect` has changed. The previous behavior can be reproduced with `toSeq`.", "2.8.0") - def collect[B](pf: PartialFunction[A, B]): Iterator[B] = { - val self = buffered - new AbstractIterator[B] { - private def skip() = while (self.hasNext && !pf.isDefinedAt(self.head)) self.next() - def hasNext = { skip(); self.hasNext } - def next() = { skip(); pf(self.next()) } + def collect[B](pf: PartialFunction[A, B]): Iterator[B] = new AbstractIterator[B] { + // Manually buffer to avoid extra layer of wrapping with buffered + private[this] var hd: A = _ + + // Little state machine to keep track of where we are + // Seek = 0; Found = 1; Empty = -1 + // Not in vals because scalac won't make them static (@inline def only works with -optimize) + // BE REALLY CAREFUL TO KEEP COMMENTS AND NUMBERS IN SYNC! + private[this] var status = 0/*Seek*/ + + def hasNext = { + while (status == 0/*Seek*/) { + if (self.hasNext) { + hd = self.next() + if (pf.isDefinedAt(hd)) status = 1/*Found*/ + } + else status = -1/*Empty*/ + } + status == 1/*Found*/ } + def next() = if (hasNext) { status = 0/*Seek*/; pf(hd) } else Iterator.empty.next() } /** Produces a collection containing cumulative results of applying the @@ -587,33 +601,105 @@ trait Iterator[+A] extends TraversableOnce[A] { * @note Reuse: $consumesOneAndProducesTwoIterators */ def span(p: A => Boolean): (Iterator[A], Iterator[A]) = { - val self = buffered - - // Must be a named class to avoid structural call to finish from trailing iterator + /* + * Giving a name to following iterator (as opposed to trailing) because + * anonymous class is represented as a structural type that trailing + * iterator is referring (the finish() method) and thus triggering + * handling of structural calls. It's not what's intended here. + */ class Leading extends AbstractIterator[A] { - private val drained = new mutable.Queue[A] - private var finished = false - def finish(): Unit = { - require(!finished) - finished = true - while (selfish) drained += self.next + var lookahead: mutable.Queue[A] = null + var hd: A = _ + /* Status is kept with magic numbers + * 1 means next element is in hd and we're still reading into this iterator + * 0 means we're still reading but haven't found a next element + * -1 means we are done reading into the iterator, so we must rely on lookahead + * -2 means we are done but have saved hd for the other iterator to use as its first element + */ + var status = 0 + private def store(a: A) { + if (lookahead == null) lookahead = new mutable.Queue[A] + lookahead += a + } + def hasNext = { + if (status < 0) (lookahead ne null) && lookahead.nonEmpty + else if (status > 0) true + else { + if (self.hasNext) { + hd = self.next() + status = if (p(hd)) 1 else -2 + } + else status = -1 + status > 0 + } } - private def selfish = self.hasNext && p(self.head) - def hasNext = if (finished) drained.nonEmpty else selfish def next() = { - if (finished) drained.dequeue() - else if (selfish) self.next() + if (hasNext) { + if (status == 1) { status = 0; hd } + else lookahead.dequeue() + } else empty.next() } + def finish(): Boolean = { + if (status == -1) false + else if (status == -2) { + status = -1 + true + } + else { + if (status == 1) store(hd) + while (self.hasNext) { + val a = self.next() + if (p(a)) store(a) + else { + hd = a + status = -1 + return true + } + } + false + } + } } + val leading = new Leading + val trailing = new AbstractIterator[A] { - private lazy val it = { - leading.finish() - self + private[this] var myLeading = leading + /* Status flags meanings: + * -1 not yet accesssed + * 0 single element waiting in leading + * 1 defer to self + */ + private[this] var status = -1 + def hasNext = { + if (status > 0) self.hasNext + else { + if (status == 0) true + else if (myLeading.finish()) { + status = 0 + true + } + else { + status = 1 + myLeading = null + self.hasNext + } + } } - def hasNext = it.hasNext - def next() = it.next() + def next() = { + if (hasNext) { + if (status > 0) self.next() + else { + status = 1 + val ans = myLeading.hd + myLeading = null + ans + } + } + else Iterator.empty.next() + } + override def toString = "unknown-if-empty iterator" } @@ -627,18 +713,35 @@ trait Iterator[+A] extends TraversableOnce[A] { * @return an iterator consisting of the remaining elements * @note Reuse: $consumesAndProducesIterator */ - def dropWhile(p: A => Boolean): Iterator[A] = { - val self = buffered - new AbstractIterator[A] { - var dropped = false - private def skip() = - if (!dropped) { - while (self.hasNext && p(self.head)) self.next() - dropped = true + def dropWhile(p: A => Boolean): Iterator[A] = new AbstractIterator[A] { + // Magic value: -1 = hasn't dropped, 0 = found first, 1 = defer to parent iterator + private[this] var status = -1 + // Local buffering to avoid double-wrap with .buffered + private[this] var fst: A = _ + def hasNext: Boolean = + if (status == 1) self.hasNext + else if (status == 0) true + else { + while (self.hasNext) { + val a = self.next() + if (!p(a)) { + fst = a + status = 0 + return true + } } - def hasNext = { skip(); self.hasNext } - def next() = { skip(); self.next() } - } + status = 1 + false + } + def next() = + if (hasNext) { + if (status == 1) self.next() + else { + status = 1 + fst + } + } + else Iterator.empty.next() } /** Creates an iterator formed from this iterator and another iterator -- cgit v1.2.3 From 43d3eec9fd3656b8ed0746a25c0a1ce0e9e74353 Mon Sep 17 00:00:00 2001 From: Jan Bessai Date: Sun, 23 Aug 2015 12:11:58 +0200 Subject: SI-6636 Fix macro expansion in toolboxes --- .../scala/tools/nsc/typechecker/Macros.scala | 7 +++++++ .../scala/tools/reflect/ReflectGlobal.scala | 16 +++++++++++++++ test/files/run/toolbox_expand_macro.check | 1 + test/files/run/toolbox_expand_macro.scala | 23 ++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 test/files/run/toolbox_expand_macro.check create mode 100644 test/files/run/toolbox_expand_macro.scala (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index 99dd81c7e2..9090c90264 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -55,6 +55,13 @@ trait Macros extends MacroRuntimes with Traces with Helpers { def globalSettings = global.settings + /** Obtains a `ClassLoader` instance used for macro expansion. + * + * By default a new `ScalaClassLoader` is created using the classpath + * from global and the classloader of self as parent. + * + * Mirrors with runtime definitions (e.g. Repl) need to adjust this method. + */ protected def findMacroClassLoader(): ClassLoader = { val classpath = global.classPath.asURLs macroLogVerbose("macro classloader: initializing from -cp: %s".format(classpath)) diff --git a/src/compiler/scala/tools/reflect/ReflectGlobal.scala b/src/compiler/scala/tools/reflect/ReflectGlobal.scala index ac63232967..e30d1ed7cd 100644 --- a/src/compiler/scala/tools/reflect/ReflectGlobal.scala +++ b/src/compiler/scala/tools/reflect/ReflectGlobal.scala @@ -1,9 +1,11 @@ package scala.tools package reflect +import scala.reflect.internal.util.ScalaClassLoader import scala.tools.nsc.Global import scala.tools.nsc.reporters.Reporter import scala.tools.nsc.Settings +import scala.tools.nsc.typechecker.Analyzer /** A version of Global that uses reflection to get class * infos, instead of reading class or source files. @@ -11,6 +13,20 @@ import scala.tools.nsc.Settings class ReflectGlobal(currentSettings: Settings, reporter: Reporter, override val rootClassLoader: ClassLoader) extends Global(currentSettings, reporter) with scala.tools.reflect.ReflectSetup with scala.reflect.runtime.SymbolTable { + override lazy val analyzer = new { + val global: ReflectGlobal.this.type = ReflectGlobal.this + } with Analyzer { + /** Obtains the classLoader used for runtime macro expansion. + * + * Macro expansion can use everything available in [[global.classPath]] or [[rootClassLoader]]. + * The [[rootClassLoader]] is used to obtain runtime defined macros. + */ + override protected def findMacroClassLoader(): ClassLoader = { + val classpath = global.classPath.asURLs + ScalaClassLoader.fromURLs(classpath, rootClassLoader) + } + } + override def transformedType(sym: Symbol) = postErasure.transformInfo(sym, erasure.transformInfo(sym, diff --git a/test/files/run/toolbox_expand_macro.check b/test/files/run/toolbox_expand_macro.check new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/files/run/toolbox_expand_macro.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/toolbox_expand_macro.scala b/test/files/run/toolbox_expand_macro.scala new file mode 100644 index 0000000000..a52e449168 --- /dev/null +++ b/test/files/run/toolbox_expand_macro.scala @@ -0,0 +1,23 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox} + +object Test extends App { + val toolBox = cm.mkToolBox() + val x = 21 + val runtimeMacro = + q"""object RuntimeMacro { + import scala.reflect.macros.whitebox.Context + import scala.language.experimental.macros + + def add(y: Int): Int = macro addImpl + def addImpl(c: Context)(y: c.Expr[Int]): c.Expr[Int] = { + import c.universe._ + val x = $x + c.Expr[Int](q"$$x + $$y") + } + }""" + val s = toolBox.define(runtimeMacro) + println(toolBox.eval(q"$s.add(21)")) +} -- cgit v1.2.3 From 31ae74f2dd649bd67457492af6305b92a8ea9cf6 Mon Sep 17 00:00:00 2001 From: Michał Pociecha Date: Sat, 22 Aug 2015 01:02:46 +0200 Subject: Fix typos in spec, docs and comments --- docs/TODO | 2 +- spec/01-lexical-syntax.md | 2 +- spec/06-expressions.md | 2 +- spec/07-implicits.md | 2 +- spec/12-the-scala-standard-library.md | 6 +++--- spec/15-changelog.md | 4 ++-- src/actors/scala/actors/Future.scala | 2 +- src/compiler/scala/tools/nsc/ast/TreeGen.scala | 2 +- src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 4 ++-- src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala | 2 +- src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala | 4 ++-- src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala | 2 +- .../scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala | 2 +- src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala | 2 +- src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala | 2 +- src/compiler/scala/tools/nsc/transform/Constructors.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Macros.scala | 2 +- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 +++--- src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java | 2 +- src/library/scala/util/Sorting.scala | 2 +- src/reflect/scala/reflect/api/Types.scala | 2 +- src/reflect/scala/reflect/internal/Kinds.scala | 2 +- src/reflect/scala/reflect/internal/Symbols.scala | 2 +- src/reflect/scala/reflect/internal/Trees.scala | 2 +- src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala | 2 +- test/files/neg/name-lookup-stable.check | 2 +- test/files/neg/name-lookup-stable.scala | 2 +- test/files/neg/t5376.scala | 2 +- test/files/neg/t8597b.scala | 2 +- test/files/neg/t8675b.scala | 2 +- test/files/neg/virtpatmat_exhaust_compound.scala | 2 +- test/files/pos/t2405.scala | 4 ++-- test/files/pos/t8002-nested-scope.scala | 2 +- test/files/run/dead-code-elimination.scala | 2 +- test/files/run/names-defaults.scala | 2 +- test/files/run/nothingTypeNoOpt.scala | 2 +- test/files/run/t8047.scala | 2 +- .../scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala | 2 +- versions.properties | 2 +- 39 files changed, 47 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/docs/TODO b/docs/TODO index 094202f53e..558aa87205 100644 --- a/docs/TODO +++ b/docs/TODO @@ -53,7 +53,7 @@ The process is about the same for symbols in PolyTypes. The main difference is that type parameters may be referenced and thus we - need something like De Bruijn indicies to represent these + need something like De Bruijn indices to represent these references. diff --git a/spec/01-lexical-syntax.md b/spec/01-lexical-syntax.md index e26cb796c8..b26e5b2328 100644 --- a/spec/01-lexical-syntax.md +++ b/spec/01-lexical-syntax.md @@ -443,7 +443,7 @@ multiLineChars ::= {[‘"’] [‘"’] charNoDoubleQuote} {‘"’} A multi-line string literal is a sequence of characters enclosed in triple quotes `""" ... """`. The sequence of characters is -arbitrary, except that it may contain three or more consuctive quote characters +arbitrary, except that it may contain three or more consecutive quote characters only at the very end. Characters must not necessarily be printable; newlines or other control characters are also permitted. Unicode escapes work as everywhere else, but none diff --git a/spec/06-expressions.md b/spec/06-expressions.md index 85e288bf5f..9cd58ea346 100644 --- a/spec/06-expressions.md +++ b/spec/06-expressions.md @@ -1736,7 +1736,7 @@ so `scala.Any` is the type inferred for `a`. _Eta-expansion_ converts an expression of method type to an equivalent expression of function type. It proceeds in two steps. -First, one identifes the maximal sub-expressions of $e$; let's +First, one identifies the maximal sub-expressions of $e$; let's say these are $e_1 , \ldots , e_m$. For each of these, one creates a fresh name $x_i$. Let $e'$ be the expression resulting from replacing every maximal subexpression $e_i$ in $e$ by the diff --git a/spec/07-implicits.md b/spec/07-implicits.md index 5e10373959..726320ed33 100644 --- a/spec/07-implicits.md +++ b/spec/07-implicits.md @@ -84,7 +84,7 @@ The _parts_ of a type $T$ are: - if $T$ is an abstract type, the parts of its upper bound; - if $T$ denotes an implicit conversion to a type with a method with argument types $T_1 , \ldots , T_n$ and result type $U$, the union of the parts of $T_1 , \ldots , T_n$ and $U$; -- the parts of quantified (existential or univeral) and annotated types are defined as the parts of the underlying types (e.g., the parts of `T forSome { ... }` are the parts of `T`); +- the parts of quantified (existential or universal) and annotated types are defined as the parts of the underlying types (e.g., the parts of `T forSome { ... }` are the parts of `T`); - in all other cases, just $T$ itself. Note that packages are internally represented as classes with companion modules to hold the package members. diff --git a/spec/12-the-scala-standard-library.md b/spec/12-the-scala-standard-library.md index e76035f458..8f65191312 100644 --- a/spec/12-the-scala-standard-library.md +++ b/spec/12-the-scala-standard-library.md @@ -171,7 +171,7 @@ Any numeric value type $T$ supports the following methods. evaluated by converting the receiver and its argument to their operation type and performing the given arithmetic operation of that type. - * Parameterless arithmethic methods identity (`+`) and negation + * Parameterless arithmetic methods identity (`+`) and negation (`-`), with result type $T$. The first of these returns the receiver unchanged, whereas the second returns its negation. * Conversion methods `toByte`, `toShort`, `toChar`, @@ -194,7 +194,7 @@ Integer numeric value types support in addition the following operations: operation of that type. * A parameterless bit-negation method (`~`). Its result type is - the reciver type $T$ or `Int`, whichever is larger. + the receiver type $T$ or `Int`, whichever is larger. The operation is evaluated by converting the receiver to the result type and negating every bit in its value. * Bit-shift methods left-shift (`<<`), arithmetic right-shift @@ -745,7 +745,7 @@ object Predef { def readf2(format: String) = Console.readf2(format) def readf3(format: String) = Console.readf3(format) - // Implict conversions ------------------------------------------------ + // Implicit conversions ------------------------------------------------ ... } diff --git a/spec/15-changelog.md b/spec/15-changelog.md index 3c8739359a..751a571ecc 100644 --- a/spec/15-changelog.md +++ b/spec/15-changelog.md @@ -31,7 +31,7 @@ formal parameter types. Added section on [numeric widening](06-expressions.html#numeric-widening) to support weak conformance. -Tightened rules to avoid accidential [overrides](05-classes-and-objects.html#overriding). +Tightened rules to avoid accidental [overrides](05-classes-and-objects.html#overriding). Removed class literals. @@ -53,7 +53,7 @@ has been brought in line with. From now on `+=`, has the same precedence as `=`. #### Wildcards as function parameters -A formal parameter to an anonymous fucntion may now be a +A formal parameter to an anonymous function may now be a [wildcard represented by an underscore](06-expressions.html#placeholder-syntax-for-anonymous-functions). > _ => 7 // The function that ignores its argument diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index 4421c7a07a..11602f52a2 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -12,7 +12,7 @@ package scala.actors import scala.actors.scheduler.DaemonScheduler import scala.concurrent.SyncVar -/** A function of arity 0, returing a value of type `T` that, +/** A function of arity 0, returning a value of type `T` that, * when applied, blocks the current actor (`Actor.self`) * until the future's value is available. * diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala index bf53c47e9a..332acf4a26 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala @@ -261,7 +261,7 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL { * Create a method based on a Function * * Used both to under `-Ydelambdafy:method` create a lifted function and - * under `-Ydelamdafy:inline` to create the apply method on the anonymous + * under `-Ydelambdafy:inline` to create the apply method on the anonymous * class. * * It creates a method definition with value params cloned from the diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 3e23291e92..b6f9bcc9ab 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -2016,7 +2016,7 @@ abstract class GenICode extends SubComponent { * * This could result in unreachable code which has to be cleaned up later, e.g. if the try and all the exception * handlers always end in RETURN then there will be no "normal" flow out of the try/catch/finally. - * Later reachability analysis will remove unreacahble code. + * Later reachability analysis will remove unreachable code. */ def Try(body: Context => Context, handlers: List[(Symbol, TypeKind, Context => Context)], @@ -2060,7 +2060,7 @@ abstract class GenICode extends SubComponent { if (settings.YdisableUnreachablePrevention || !outerCtx.bb.ignore) { if (finalizer != EmptyTree) { val exh = outerCtx.newExceptionHandler(NoSymbol, finalizer.pos) // finalizer covers exception handlers - this.addActiveHandler(exh) // .. and body aswell + this.addActiveHandler(exh) // .. and body as well val exhStartCtx = finalizerCtx.enterExceptionHandler(exh) exhStartCtx.bb killIf outerCtx.bb.ignore val exception = exhStartCtx.makeLocal(finalizer.pos, ThrowableTpe, "exc") diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala index 843648282b..0f17b5d694 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala @@ -20,7 +20,7 @@ abstract class ICodeCheckers { *

*
    *
  • - * for primitive operations: the type and numer of operands match + * for primitive operations: the type and number of operands match * the type of the operation *
  • *
  • diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala index 67fc7923ea..416628d5ba 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala @@ -92,8 +92,8 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { def genThrow(expr: Tree): BType = { val thrownKind = tpeTK(expr) - // `throw null` is valid although scala.Null (as defined in src/libray-aux) isn't a subtype of Throwable. - // Similarly for scala.Nothing (again, as defined in src/libray-aux). + // `throw null` is valid although scala.Null (as defined in src/library-aux) isn't a subtype of Throwable. + // Similarly for scala.Nothing (again, as defined in src/library-aux). assert(thrownKind.isNullType || thrownKind.isNothingType || thrownKind.asClassBType.isSubtypeOf(ThrowableReference).get) genLoad(expr, thrownKind) lineNumber(expr) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala index 8720da84e8..0c26e01322 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala @@ -1126,7 +1126,7 @@ object BTypes { * The map is indexed by the string s"$name$descriptor" (to * disambiguate overloads). * - * @param warning Contains an warning message if an error occured when building this + * @param warning Contains an warning message if an error occurred when building this * InlineInfo, for example if some classfile could not be found on * the classpath. This warning can be reported later by the inliner. */ diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala index 31710dcbee..31b62f747e 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/NullnessAnalyzer.scala @@ -12,7 +12,7 @@ import scala.tools.nsc.backend.jvm.opt.BytecodeUtils import BytecodeUtils._ /** - * Some notes on the ASM ananlyzer framework. + * Some notes on the ASM analyzer framework. * * Value * - Abstract, needs to be implemented for each analysis. diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala index 92b9b34006..b0dc6ead1b 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/ClosureOptimizer.scala @@ -359,7 +359,7 @@ class ClosureOptimizer[BT <: BTypes](val btypes: BT) { } /** - * Stores a local varaible index the opcode offset required for operating on that variable. + * Stores a local variable index the opcode offset required for operating on that variable. * * The xLOAD / xSTORE opcodes are in the following sequence: I, L, F, D, A, so the offset for * a local variable holding a reference (`A`) is 4. See also method `getOpcode` in [[scala.tools.asm.Type]]. diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala index 8477f5461a..2c4a0ad3c3 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala @@ -366,7 +366,7 @@ class Inliner[BT <: BTypes](val btypes: BT) { clonedInstructions.insert(argStores) - // label for the exit of the inlined functions. xRETURNs are rplaced by GOTOs to this label. + // label for the exit of the inlined functions. xRETURNs are replaced by GOTOs to this label. val postCallLabel = newLabelNode clonedInstructions.add(postCallLabel) diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 86685d46de..6a46c65267 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -137,7 +137,7 @@ abstract class Constructors extends Statics with Transform with ast.TreeDSL { * and thus may only be accessed from value or method definitions owned by the current class * (ie there's no point drilling down into nested classes). * - * (d) regarding candidates in (b), they are accesible from all places listed in (c) and in addition + * (d) regarding candidates in (b), they are accessible from all places listed in (c) and in addition * from nested classes (nested at any number of levels). * * In all cases, we're done with traversing as soon as all candidates have been ruled out. diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index 99dd81c7e2..031245346b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -658,7 +658,7 @@ trait Macros extends MacroRuntimes with Traces with Helpers { // // Situation #2 requires measures to be taken. If we're in it, then noone's going to help us infer // the undetermined type params. Therefore we need to do something ourselves or otherwise this - // expandee will forever remaing not expanded (see SI-5692). A traditional way out of this conundrum + // expandee will forever remain not expanded (see SI-5692). A traditional way out of this conundrum // is to call `instantiate` and let the inferencer try to find the way out. It works for simple cases, // but sometimes, if the inferencer lacks information, it will be forced to approximate. // diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index a7046e45e0..8113cd9b96 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3305,7 +3305,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper // https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.3 // // One can think of these methods as being infinitely overloaded. We create - // a ficticious new cloned method symbol for each call site that takes on a signature + // a fictitious new cloned method symbol for each call site that takes on a signature // governed by a) the argument types and b) the expected type val args1 = typedArgs(args, forArgMode(fun, mode)) val pts = args1.map(_.tpe.deconst) @@ -4106,7 +4106,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper def resultingTypeTree(tpe: Type) = { // we need symbol-ful originals for reification - // hence we go the extra mile to hand-craft tis guy + // hence we go the extra mile to hand-craft this guy val original = arg1 match { case tt @ TypeTree() if tt.original != null => Annotated(ann, tt.original) // this clause is needed to correctly compile stuff like "new C @D" or "@(inline @getter)" @@ -4258,7 +4258,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper // in the special (though common) case where the types are equal, it pays to pack before comparing // especially virtpatmat needs more aggressive unification of skolemized types // this breaks src/library/scala/collection/immutable/TrieIterator.scala - // annotated types need to be lubbed regardless (at least, continations break if you by pass them like this) + // annotated types need to be lubbed regardless (at least, continuations break if you bypass them like this) def samePackedTypes = ( !isPastTyper && thenp1.tpe.annotations.isEmpty diff --git a/src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java b/src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java index 19237c9092..a7ef492057 100644 --- a/src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java +++ b/src/forkjoin/scala/concurrent/forkjoin/ThreadLocalRandom.java @@ -24,7 +24,7 @@ import java.util.Random; * {@code ThreadLocalRandom.current().nextX(...)} (where * {@code X} is {@code Int}, {@code Long}, etc). * When all usages are of this form, it is never possible to - * accidently share a {@code ThreadLocalRandom} across multiple threads. + * accidentally share a {@code ThreadLocalRandom} across multiple threads. * *

    This class also provides additional commonly used bounded random * generation methods. diff --git a/src/library/scala/util/Sorting.scala b/src/library/scala/util/Sorting.scala index ee2bdbc4a7..b4f965f69b 100644 --- a/src/library/scala/util/Sorting.scala +++ b/src/library/scala/util/Sorting.scala @@ -88,7 +88,7 @@ object Sorting { a(pL - 1) = current pL -= 1 case x if x < 0 => - // Already in place. Just update indicies. + // Already in place. Just update indices. iA += 1 case _ if iB > pR => // Wrong side. There's room on the other side, so swap diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala index cd7648a44a..f9b49f1730 100644 --- a/src/reflect/scala/reflect/api/Types.scala +++ b/src/reflect/scala/reflect/api/Types.scala @@ -588,7 +588,7 @@ trait Types { /** An extractor class to create and pattern match with syntax `TypeRef(pre, sym, args)` * Here, `pre` is the prefix of the type reference, `sym` is the symbol * referred to by the type reference, and `args` is a possible empty list of - * type argumenrts. + * type arguments. * @group Extractors */ abstract class TypeRefExtractor { diff --git a/src/reflect/scala/reflect/internal/Kinds.scala b/src/reflect/scala/reflect/internal/Kinds.scala index 8ae201f045..902ba9fa80 100644 --- a/src/reflect/scala/reflect/internal/Kinds.scala +++ b/src/reflect/scala/reflect/internal/Kinds.scala @@ -237,7 +237,7 @@ trait Kinds { * * Proper types are represented using ProperTypeKind. * - * Type constructors are reprented using TypeConKind. + * Type constructors are represented using TypeConKind. */ abstract class Kind { import Kind.StringState diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala index 56fb1181fe..2e3449588b 100644 --- a/src/reflect/scala/reflect/internal/Symbols.scala +++ b/src/reflect/scala/reflect/internal/Symbols.scala @@ -2113,7 +2113,7 @@ trait Symbols extends api.Symbols { self: SymbolTable => /** The package class containing this symbol, or NoSymbol if there * is not one. * TODO: formulate as enclosingSuchThat, after making sure - * we can start with current symbol rather than onwner. + * we can start with current symbol rather than owner. * TODO: Also harmonize with enclClass, enclMethod etc. */ def enclosingPackageClass: Symbol = { diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index e3f95f9fd8..498e7bddd0 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -1601,7 +1601,7 @@ trait Trees extends api.Trees { case _ => // no special handling is required for Function or Import nodes here. // as they don't have interesting infos attached to their symbols. - // Subsitution of the referenced symbol of Return nodes is handled + // Substitution of the referenced symbol of Return nodes is handled // in .ChangeOwnerTraverser } tree match { diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala index b5375558ac..6b13a02c54 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala @@ -781,7 +781,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp if (isReduced) NodeSeq.Empty else { def paramsToHtml(vlsss: List[List[ValueParam]]): NodeSeq = { def param0(vl: ValueParam): NodeSeq = - // notice the }{ in the next lines, they are necessary to avoid an undesired withspace in output + // notice the }{ in the next lines, they are necessary to avoid an undesired whitespace in output { Text(vl.name) }{ Text(": ") ++ typeToHtml(vl.resultType, hasLinks) }{ diff --git a/test/files/neg/name-lookup-stable.check b/test/files/neg/name-lookup-stable.check index 751df9505e..68d98c4162 100644 --- a/test/files/neg/name-lookup-stable.check +++ b/test/files/neg/name-lookup-stable.check @@ -6,6 +6,6 @@ import ColumnOption._ name-lookup-stable.scala:17: error: reference to PrimaryKey is ambiguous; it is both defined in class A and imported subsequently by import ColumnOption._ - PrimaryKey // was already ambigious in 2.10.3 + PrimaryKey // was already ambiguous in 2.10.3 ^ two errors found diff --git a/test/files/neg/name-lookup-stable.scala b/test/files/neg/name-lookup-stable.scala index 0d862f06e1..2941e05875 100644 --- a/test/files/neg/name-lookup-stable.scala +++ b/test/files/neg/name-lookup-stable.scala @@ -14,7 +14,7 @@ class A { (null: Any) match { case PrimaryKey => } - PrimaryKey // was already ambigious in 2.10.3 + PrimaryKey // was already ambiguous in 2.10.3 } } diff --git a/test/files/neg/t5376.scala b/test/files/neg/t5376.scala index 8da3868566..b1ba41bd54 100644 --- a/test/files/neg/t5376.scala +++ b/test/files/neg/t5376.scala @@ -12,7 +12,7 @@ object Test { "a": Int } - // Import one implict and one non-implicit method with the + // Import one implicit and one non-implicit method with the // same name in the same scope. def m2 = { import O1._ diff --git a/test/files/neg/t8597b.scala b/test/files/neg/t8597b.scala index b29d591cb1..cbf0bf1c5a 100644 --- a/test/files/neg/t8597b.scala +++ b/test/files/neg/t8597b.scala @@ -4,7 +4,7 @@ object Unchecked { // t is a fresh pattern type variable, despite our attempts to // backtick our way to the enclosing `t`. Under this interpretation, - // the absense of an unchecked warning is expected. + // the absence of an unchecked warning is expected. (null: Any) match { case _: Some[t] => // no warn } diff --git a/test/files/neg/t8675b.scala b/test/files/neg/t8675b.scala index bffed2141c..b2212fa234 100644 --- a/test/files/neg/t8675b.scala +++ b/test/files/neg/t8675b.scala @@ -9,7 +9,7 @@ object Test { } trait Reportable1[Params, R] - // "missing paramater type" error was swallowed in 2.11.0 leading to a crash + // "missing parameter type" error was swallowed in 2.11.0 leading to a crash // in the backend. // // This error is itself a regression (or at least a change) in 2.11.0-M7, diff --git a/test/files/neg/virtpatmat_exhaust_compound.scala b/test/files/neg/virtpatmat_exhaust_compound.scala index 386c7af98d..4ff04dd06a 100644 --- a/test/files/neg/virtpatmat_exhaust_compound.scala +++ b/test/files/neg/virtpatmat_exhaust_compound.scala @@ -10,7 +10,7 @@ case object O3 extends Base2 case object O4 extends Base with Base2 object Test { - val a /*: Product with Serialiable with Base */ = if (true) O1 else O2 + val a /*: Product with Serializable with Base */ = if (true) O1 else O2 a match { case null => } diff --git a/test/files/pos/t2405.scala b/test/files/pos/t2405.scala index 224b2ce83b..0bc7a771b2 100644 --- a/test/files/pos/t2405.scala +++ b/test/files/pos/t2405.scala @@ -6,14 +6,14 @@ object Test1 { implicitly[Int] } -// Testing for the absense of shadowing #1. +// Testing for the absence of shadowing #1. object Test2 { import A.{x => y} val x = 2 implicitly[Int] } -// Testing for the absense of shadowing #2. +// Testing for the absence of shadowing #2. object Test3 { { import A.{x => y} diff --git a/test/files/pos/t8002-nested-scope.scala b/test/files/pos/t8002-nested-scope.scala index a2088bce7a..8ce809e556 100644 --- a/test/files/pos/t8002-nested-scope.scala +++ b/test/files/pos/t8002-nested-scope.scala @@ -1,5 +1,5 @@ // This test serves to capture the status quo, but should really -// emit an accessibiltiy error. +// emit an accessibility error. // `Namers#companionSymbolOf` seems too lenient, and currently doesn't // implement the same-scope checks mentioned: diff --git a/test/files/run/dead-code-elimination.scala b/test/files/run/dead-code-elimination.scala index fd3f2a996a..2291b22f7a 100644 --- a/test/files/run/dead-code-elimination.scala +++ b/test/files/run/dead-code-elimination.scala @@ -10,7 +10,7 @@ // the stack after code elimination. // // Originally, this did not compile, but I included it in the run -// tests because this was ASM-dependand and did not happen for GenJVM. +// tests because this was ASM-dependent and did not happen for GenJVM. // // Thus, we run the code and force the loading of class B -- if the // bytecode is incorrect, it will fail the test. diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala index 7fb4a04546..4159dbdf91 100644 --- a/test/files/run/names-defaults.scala +++ b/test/files/run/names-defaults.scala @@ -192,7 +192,7 @@ object Test extends App { println(argName) // should be 4 test5 { argName = 5 } println(argName) // should be 5 - val a: Unit = test1(a = 10, b = "2") // local values a and b exist, but not ambiuous since they're val's + val a: Unit = test1(a = 10, b = "2") // local values a and b exist, but it's not ambiguous since they're vals // dependent types and copy method diff --git a/test/files/run/nothingTypeNoOpt.scala b/test/files/run/nothingTypeNoOpt.scala index 5c5a20fa3b..454539a4b1 100644 --- a/test/files/run/nothingTypeNoOpt.scala +++ b/test/files/run/nothingTypeNoOpt.scala @@ -26,7 +26,7 @@ class C { } def f5(x: Boolean) = { - // stack heights need to be the smae. ??? looks to the jvm like returning a value of + // stack heights need to be the same. ??? looks to the jvm like returning a value of // type Nothing$, need to drop or throw it. println( if (x) { ???; 10 } diff --git a/test/files/run/t8047.scala b/test/files/run/t8047.scala index f5660541e8..9ec8c1dc56 100644 --- a/test/files/run/t8047.scala +++ b/test/files/run/t8047.scala @@ -1,7 +1,7 @@ object Test extends App { import scala.reflect.runtime.universe._ // - // x's owner is outer Test scope. Previosly the quasiquote expansion + // x's owner is outer Test scope. Previously the quasiquote expansion // looked like: // // object Test { diff --git a/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala index a5b3faced8..941a167114 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerTest.scala @@ -204,7 +204,7 @@ class ProdConsAnalyzerTest extends ClearAfterClass { def iincProdCons(): Unit = { import Opcodes._ val m = genMethod(descriptor = "(I)I")( - Incr(IINC, 1, 1), // producer and cosumer of local variable 1 + Incr(IINC, 1, 1), // producer and consumer of local variable 1 VarOp(ILOAD, 1), Op(IRETURN) ) diff --git a/versions.properties b/versions.properties index c3270736d8..a2f74bbd08 100644 --- a/versions.properties +++ b/versions.properties @@ -5,7 +5,7 @@ # 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 boostrapping. This has no impact on the final classfiles: +# 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). starr.version=2.11.7 -- cgit v1.2.3 From 4b6395313bec6d0bf0bb9ecab18c6c4a90494c38 Mon Sep 17 00:00:00 2001 From: Michał Pociecha Date: Sun, 23 Aug 2015 12:19:16 +0200 Subject: Fix typo in the name of a private method Since it's a private method, it's safe to just rename it. --- src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 4f195c2985..70abdf6bc0 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -2031,11 +2031,11 @@ self => /** Drop `private` modifier when followed by a qualifier. * Contract `abstract` and `override` to ABSOVERRIDE */ - private def normalizeModifers(mods: Modifiers): Modifiers = + private def normalizeModifiers(mods: Modifiers): Modifiers = if (mods.isPrivate && mods.hasAccessBoundary) - normalizeModifers(mods &~ Flags.PRIVATE) + normalizeModifiers(mods &~ Flags.PRIVATE) else if (mods hasAllFlags (Flags.ABSTRACT | Flags.OVERRIDE)) - normalizeModifers(mods &~ (Flags.ABSTRACT | Flags.OVERRIDE) | Flags.ABSOVERRIDE) + normalizeModifiers(mods &~ (Flags.ABSTRACT | Flags.OVERRIDE) | Flags.ABSOVERRIDE) else mods @@ -2080,7 +2080,7 @@ self => * AccessModifier ::= (private | protected) [AccessQualifier] * }}} */ - def accessModifierOpt(): Modifiers = normalizeModifers { + def accessModifierOpt(): Modifiers = normalizeModifiers { in.token match { case m @ (PRIVATE | PROTECTED) => in.nextToken() ; accessQualifierOpt(Modifiers(flagTokens(m))) case _ => NoMods @@ -2094,7 +2094,7 @@ self => * | override * }}} */ - def modifiers(): Modifiers = normalizeModifers { + def modifiers(): Modifiers = normalizeModifiers { def loop(mods: Modifiers): Modifiers = in.token match { case PRIVATE | PROTECTED => loop(accessQualifierOpt(addMod(mods, flagTokens(in.token), tokenRange(in)))) -- cgit v1.2.3 From 6b336f86d677f5aedd40bd673cdd7ffbea780fbd Mon Sep 17 00:00:00 2001 From: Vlad Ureche Date: Sun, 23 Aug 2015 03:55:48 +0200 Subject: SI-9442 Fix the uncurry-erasure types Using the "uncurry-erased" type (the one after the uncurry phase) can lead to incorrect tree transformations. For example, compiling: ``` def foo(c: Ctx)(l: c.Tree): Unit = { val l2: c.Tree = l } ``` Results in the following AST: ``` def foo(c: Ctx, l: Ctx#Tree): Unit = { val l$1: Ctx#Tree = l.asInstanceOf[Ctx#Tree] val l2: c.Tree = l$1 // no, not really, it's not. } ``` Of course, this is incorrect, since `l$1` has type `Ctx#Tree`, which is not a subtype of `c.Tree`. So what we need to do is to use the pre-uncurry type when creating `l$1`, which is `c.Tree` and is correct. Now, there are two additional problems: 1. when varargs and byname params are involved, the uncurry transformation desugares these special cases to actual typerefs, eg: ``` T* ~> Seq[T] (Scala-defined varargs) T* ~> Array[T] (Java-defined varargs) =>T ~> Function0[T] (by name params) ``` we use the DesugaredParameterType object (defined in scala.reflect.internal.transform.UnCurry) to redo this desugaring manually here 2. the type needs to be normalized, since `gen.mkCast` checks this (no HK here, just aliases have to be expanded before handing the type to `gen.mkAttributedCast`, which calls `gen.mkCast`) --- .../scala/tools/nsc/transform/UnCurry.scala | 41 ++++++++++++++++++++-- .../scala/reflect/internal/transform/UnCurry.scala | 22 ++++++++---- .../scala/reflect/runtime/JavaUniverseForce.scala | 2 +- test/files/pos/t9442.scala | 14 ++++++++ 4 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 test/files/pos/t9442.scala (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 7a9dfda43e..163c44822e 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -691,9 +691,46 @@ abstract class UnCurry extends InfoTransform // declared type and assign this to a synthetic val. Later, we'll patch // the method body to refer to this, rather than the parameter. val tempVal: ValDef = { + // SI-9442: using the "uncurry-erased" type (the one after the uncurry phase) can lead to incorrect + // tree transformations. For example, compiling: + // ``` + // def foo(c: Ctx)(l: c.Tree): Unit = { + // val l2: c.Tree = l + // } + // ``` + // Results in the following AST: + // ``` + // def foo(c: Ctx, l: Ctx#Tree): Unit = { + // val l$1: Ctx#Tree = l.asInstanceOf[Ctx#Tree] + // val l2: c.Tree = l$1 // no, not really, it's not. + // } + // ``` + // Of course, this is incorrect, since `l$1` has type `Ctx#Tree`, which is not a subtype of `c.Tree`. + // + // So what we need to do is to use the pre-uncurry type when creating `l$1`, which is `c.Tree` and is + // correct. Now, there are two additional problems: + // 1. when varargs and byname params are involved, the uncurry transformation desugares these special + // cases to actual typerefs, eg: + // ``` + // T* ~> Seq[T] (Scala-defined varargs) + // T* ~> Array[T] (Java-defined varargs) + // =>T ~> Function0[T] (by name params) + // ``` + // we use the DesugaredParameterType object (defined in scala.reflect.internal.transform.UnCurry) + // to redo this desugaring manually here + // 2. the type needs to be normalized, since `gen.mkCast` checks this (no HK here, just aliases have + // to be expanded before handing the type to `gen.mkAttributedCast`, which calls `gen.mkCast`) + val info0 = + enteringUncurry(p.symbol.info) match { + case DesugaredParameterType(desugaredTpe) => + desugaredTpe + case tpe => + tpe + } + val info = info0.normalize val tempValName = unit freshTermName (p.name + "$") - val newSym = dd.symbol.newTermSymbol(tempValName, p.pos, SYNTHETIC).setInfo(p.symbol.info) - atPos(p.pos)(ValDef(newSym, gen.mkAttributedCast(Ident(p.symbol), p.symbol.info))) + val newSym = dd.symbol.newTermSymbol(tempValName, p.pos, SYNTHETIC).setInfo(info) + atPos(p.pos)(ValDef(newSym, gen.mkAttributedCast(Ident(p.symbol), info))) } Packed(newParam, tempVal) } diff --git a/src/reflect/scala/reflect/internal/transform/UnCurry.scala b/src/reflect/scala/reflect/internal/transform/UnCurry.scala index abea8bed9f..85e3ac60e8 100644 --- a/src/reflect/scala/reflect/internal/transform/UnCurry.scala +++ b/src/reflect/scala/reflect/internal/transform/UnCurry.scala @@ -40,19 +40,27 @@ trait UnCurry { apply(MethodType(h.cloneSymbol.resetFlag(IMPLICIT) :: t, restpe)) case NullaryMethodType(restpe) => apply(MethodType(List(), restpe)) - case TypeRef(pre, ByNameParamClass, arg :: Nil) => - apply(functionType(List(), arg)) - case TypeRef(pre, RepeatedParamClass, arg :: Nil) => - apply(seqType(arg)) - case TypeRef(pre, JavaRepeatedParamClass, arg :: Nil) => - apply(arrayType( - if (isUnboundedGeneric(arg)) ObjectTpe else arg)) + case DesugaredParameterType(desugaredTpe) => + apply(desugaredTpe) case _ => expandAlias(mapOver(tp)) } } } + object DesugaredParameterType { + def unapply(tpe: Type): Option[Type] = tpe match { + case TypeRef(pre, ByNameParamClass, arg :: Nil) => + Some(functionType(List(), arg)) + case TypeRef(pre, RepeatedParamClass, arg :: Nil) => + Some(seqType(arg)) + case TypeRef(pre, JavaRepeatedParamClass, arg :: Nil) => + Some(arrayType(if (isUnboundedGeneric(arg)) ObjectTpe else arg)) + case _ => + None + } + } + private val uncurryType = new TypeMap { def apply(tp0: Type): Type = { val tp = expandAlias(tp0) diff --git a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala index ea213cadd9..5477bdd6d4 100644 --- a/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala +++ b/src/reflect/scala/reflect/runtime/JavaUniverseForce.scala @@ -444,7 +444,7 @@ trait JavaUniverseForce { self: runtime.JavaUniverse => definitions.ScalaValueClassesNoUnit definitions.ScalaValueClasses - + uncurry.DesugaredParameterType erasure.GenericArray erasure.scalaErasure erasure.specialScalaErasure diff --git a/test/files/pos/t9442.scala b/test/files/pos/t9442.scala new file mode 100644 index 0000000000..2ea81e79cb --- /dev/null +++ b/test/files/pos/t9442.scala @@ -0,0 +1,14 @@ +trait Ctx { + trait Tree +} +trait Lst[+A] { + def zip[A1 >: A, B](that: Lst[B]): Nothing +} +class C[@specialized(Int) T] { + def moo(t: T) = { + def foo1(c: Ctx)(l: Lst[c.Tree]) = l zip l + def foo2(c: Ctx)(l: Lst[c.Tree]*) = l(0) zip l(1) + def foo3(c: Ctx)(l: => Lst[c.Tree]) = l zip l + ??? + } +} -- cgit v1.2.3 From 9d73937bb30c84a258ec523259353cbdb272cb2a Mon Sep 17 00:00:00 2001 From: Vlad Ureche Date: Sun, 23 Aug 2015 14:51:39 +0200 Subject: Re-enable tree checkers My expectation is that tree checkers are re-typechecking the trees and making sure they are consistent. Unfortunately, following patch aced32d05c97651534f468bc9a475ea5f6ae75b8, the call to clearType() was removed, thus the typer no longer recursed inside the trees, rendering the type checkers framework useless. This is an attempt to make the tree checkers run again, by resetting the type of a tree before the call to super.typed, thus allowing the typer to actually visit the entire tree (not just the outer package definition). The work was prompted by SI-9442, where the type checkers would gladly allow validate the inconsistent trees. --- src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala index a7d48ceb89..e8db8309f1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala @@ -262,7 +262,14 @@ abstract class TreeCheckers extends Analyzer { checkedTyped(tree, mode, pt) ) private def checkedTyped(tree: Tree, mode: Mode, pt: Type): Tree = { - val typed = wrap(tree)(super.typed(tree, mode, pt)) + val typed = wrap(tree)(super.typed(tree.clearType(), mode, pt)) + + // Vlad: super.typed returns null for package defs, why is that? + if (typed eq null) + return tree + + if (typed.tpe ne null) + assert(!typed.tpe.isErroneous, "Tree has erroneous type: " + typed) if (tree ne typed) treesDiffer(tree, typed) -- cgit v1.2.3 From 37180d04657cc7bd074530726f186d10d0d4b1b4 Mon Sep 17 00:00:00 2001 From: "Frank S. Thomas" Date: Mon, 24 Aug 2015 19:21:21 +0200 Subject: Add link to online version of Programming in Scala --- src/library/scala/Equals.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/library/scala/Equals.scala b/src/library/scala/Equals.scala index f2f9ead44c..e06557ccdd 100644 --- a/src/library/scala/Equals.scala +++ b/src/library/scala/Equals.scala @@ -13,8 +13,9 @@ package scala */ trait Equals extends Any { /** A method that should be called from every well-designed equals method - * that is open to be overridden in a subclass. See Programming in Scala, - * Chapter 28 for discussion and design. + * that is open to be overridden in a subclass. See + * [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala, + * Chapter 28]] for discussion and design. * * @param that the value being probed for possible equality * @return true if this instance can possibly equal `that`, otherwise false -- cgit v1.2.3 From 0b121d1864a3db1b34e5102e8258984ad0e8fd53 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 27 Aug 2015 10:43:38 +1000 Subject: SI-9450 Fix triple quoted strings in REPL :power mode Some extra synthetic code generated under this mode failed to escape input before adding it to a literal string. It used to get away with this most of the time by triple quoting the literal. This commit reuses Scala string escaping logic buried in `Constant` to do this properly. Actually, the proper approach would be to build the synthetic code with trees and quasiquotes, and avoid the mess of stringly-genererated code. I threw in some defensive hygiene for the reference to `Nil` while I was in the neighbourhood. --- src/repl/scala/tools/nsc/interpreter/IMain.scala | 6 ++++-- test/files/run/repl-power.check | 3 +++ test/files/run/repl-power.scala | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala index 06ae179da9..3b54f5274e 100644 --- a/src/repl/scala/tools/nsc/interpreter/IMain.scala +++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala @@ -133,7 +133,6 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set } catch AbstractOrMissingHandler() } - private def tquoted(s: String) = "\"\"\"" + s + "\"\"\"" private val logScope = scala.sys.props contains "scala.repl.scope" private def scopelog(msg: String) = if (logScope) Console.err.println(msg) @@ -905,7 +904,10 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set def path = originalPath("$intp") def envLines = { if (!isReplPower) Nil // power mode only for now - else List("def %s = %s".format("$line", tquoted(originalLine)), "def %s = Nil".format("$trees")) + else { + val escapedLine = Constant(originalLine).escapedStringValue + List(s"""def $$line = $escapedLine """, """def $trees = _root_.scala.Nil""") + } } def preamble = s""" |$headerPreamble diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index 2a7b7783d9..4e030bd9fa 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -25,4 +25,7 @@ m: $r.treedsl.global.Literal = 10 scala> typed(m).tpe // typed is in scope res2: $r.treedsl.global.Type = Int(10) +scala> """escaping is hard, m'kah""" +res3: String = escaping is hard, m'kah + scala> :quit diff --git a/test/files/run/repl-power.scala b/test/files/run/repl-power.scala index 4dfeb37885..5ecaad8723 100644 --- a/test/files/run/repl-power.scala +++ b/test/files/run/repl-power.scala @@ -1,7 +1,9 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { - def code = """ + def tripleQuote(s: String) = "\"\"\"" + s + "\"\"\"" + + def code = s""" :power // guarding against "error: reference to global is ambiguous" global.emptyValDef // "it is imported twice in the same scope by ..." @@ -9,5 +11,6 @@ val tp = ArrayClass[scala.util.Random] // magic with tags tp.memberType(Array_apply) // evidence val m = LIT(10) // treedsl typed(m).tpe // typed is in scope +${tripleQuote("escaping is hard, m'kah")} """.trim } -- cgit v1.2.3 From 3cb9a4f8bfcc6b1b3e8a483dca4b033a99459e90 Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Sat, 22 Aug 2015 16:37:16 -0700 Subject: SI-8346 Re-established soundness of toSet (element type widening) toSet needs to rebuild some child classes, but not others, as toSet is allowed to widen element types (which the invariant Set normally cannot do), and some sets rely upon their invariance. Thus, sets that rely upon their invariance now rebuild themselves into a generic set upon toSet, while those that do not just sit there. Note: there was a similar patch previously that fixed the same problem, but this is a reimplementation to circumvent license issues. Note: the newBuilder method was benchmarked as (surprisingly!) the most efficient way to create small sets, so it is used where sets may need to be rebuild. --- .../scala/collection/immutable/HashSet.scala | 1 + .../scala/collection/immutable/ListSet.scala | 2 + .../scala/collection/immutable/MapLike.scala | 5 ++ src/library/scala/collection/immutable/Set.scala | 34 +++++++-- .../scala/collection/immutable/SortedMap.scala | 6 ++ .../scala/collection/immutable/SetTests.scala | 81 ++++++++++++++++++++++ 6 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 test/junit/scala/collection/immutable/SetTests.scala (limited to 'src') diff --git a/src/library/scala/collection/immutable/HashSet.scala b/src/library/scala/collection/immutable/HashSet.scala index 6851ab6bc7..27b2bfdde7 100644 --- a/src/library/scala/collection/immutable/HashSet.scala +++ b/src/library/scala/collection/immutable/HashSet.scala @@ -194,6 +194,7 @@ class HashSet[A] extends AbstractSet[A] protected def writeReplace(): AnyRef = new HashSet.SerializationProxy(this) + override def toSet[B >: A]: Set[B] = this.asInstanceOf[HashSet[B]] } /** $factoryInfo diff --git a/src/library/scala/collection/immutable/ListSet.scala b/src/library/scala/collection/immutable/ListSet.scala index 2e17677359..adc975479a 100644 --- a/src/library/scala/collection/immutable/ListSet.scala +++ b/src/library/scala/collection/immutable/ListSet.scala @@ -179,4 +179,6 @@ class ListSet[A] extends AbstractSet[A] override def tail: ListSet[A] = self } + + override def toSet[B >: A]: Set[B] = this.asInstanceOf[ListSet[B]] } diff --git a/src/library/scala/collection/immutable/MapLike.scala b/src/library/scala/collection/immutable/MapLike.scala index 94a5b7929a..bd5b9c9faf 100644 --- a/src/library/scala/collection/immutable/MapLike.scala +++ b/src/library/scala/collection/immutable/MapLike.scala @@ -113,6 +113,11 @@ self => override def - (elem: A): immutable.Set[A] = if (this(elem)) immutable.Set[A]() ++ this - elem else this + + // ImmutableDefaultKeySet is only protected, so we won't warn on override. + // Someone could override in a way that makes widening not okay + // (e.g. by overriding +, though the version in this class is fine) + override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]] } /** This function transforms all the values of mappings contained diff --git a/src/library/scala/collection/immutable/Set.scala b/src/library/scala/collection/immutable/Set.scala index 0fbf7942d4..a115469b83 100644 --- a/src/library/scala/collection/immutable/Set.scala +++ b/src/library/scala/collection/immutable/Set.scala @@ -35,12 +35,22 @@ trait Set[A] extends Iterable[A] override def companion: GenericCompanion[Set] = Set - /** Returns this $coll as an immutable map. - * - * A new map will not be built; lazy collections will stay lazy. + /** Returns this $coll as an immutable set, perhaps accepting a + * wider range of elements. Since it already is an + * immutable set, it will only be rebuilt if the underlying structure + * cannot be expanded to include arbitrary element types. + * For instance, `BitSet` and `SortedSet` will be rebuilt, as + * they require `Int` and sortable elements respectively. + * + * When in doubt, the set will be rebuilt. Rebuilt sets never + * need to be rebuilt again. */ - @deprecatedOverriding("Immutable sets should do nothing on toSet but return themselves cast as a Set.", "2.11.0") - override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]] + override def toSet[B >: A]: Set[B] = { + // This way of building sets typically has the best benchmarks, surprisingly! + val sb = Set.newBuilder[B] + foreach(sb += _) + sb.result() + } override def seq: Set[A] = this protected override def parCombiner = ParSet.newCombiner[A] // if `immutable.SetLike` gets introduced, please move this there! @@ -62,6 +72,7 @@ object Set extends ImmutableSetFactory[Set] { def - (elem: Any): Set[Any] = this def iterator: Iterator[Any] = Iterator.empty override def foreach[U](f: Any => U): Unit = {} + override def toSet[B >: Any]: Set[B] = this.asInstanceOf[Set[B]] } private[collection] def emptyInstance: Set[Any] = EmptySet @@ -92,6 +103,10 @@ object Set extends ImmutableSetFactory[Set] { if (f(elem1)) Some(elem1) else None } + // Why is Set1 non-final? Need to fix that! + @deprecatedOverriding("This immutable set should do nothing on toSet but cast itself to a Set with a wider element type.", "2.11.8") + override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set1[B]] + } /** An optimized representation for immutable sets of size 2 */ @@ -123,6 +138,9 @@ object Set extends ImmutableSetFactory[Set] { else if (f(elem2)) Some(elem2) else None } + // Why is Set2 non-final? Need to fix that! + @deprecatedOverriding("This immutable set should do nothing on toSet but cast itself to a Set with a wider element type.", "2.11.8") + override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set2[B]] } /** An optimized representation for immutable sets of size 3 */ @@ -156,6 +174,9 @@ object Set extends ImmutableSetFactory[Set] { else if (f(elem3)) Some(elem3) else None } + // Why is Set3 non-final? Need to fix that! + @deprecatedOverriding("This immutable set should do nothing on toSet but cast itself to a Set with a wider element type.", "2.11.8") + override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set3[B]] } /** An optimized representation for immutable sets of size 4 */ @@ -191,6 +212,9 @@ object Set extends ImmutableSetFactory[Set] { else if (f(elem4)) Some(elem4) else None } + // Why is Set4 non-final? Need to fix that! + @deprecatedOverriding("This immutable set should do nothing on toSet but cast itself to a Set with a wider element type.", "2.11.8") + override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set4[B]] } } diff --git a/src/library/scala/collection/immutable/SortedMap.scala b/src/library/scala/collection/immutable/SortedMap.scala index f1493551ab..682788e18e 100644 --- a/src/library/scala/collection/immutable/SortedMap.scala +++ b/src/library/scala/collection/immutable/SortedMap.scala @@ -53,6 +53,12 @@ self => val map = self.rangeImpl(from, until) new map.DefaultKeySortedSet } + override def toSet[C >: A]: Set[C] = { + // This way of building sets typically has the best benchmarks, surprisingly! + val sb = Set.newBuilder[C] + foreach(sb += _) + sb.result() + } } /** Add a key/value pair to this map. diff --git a/test/junit/scala/collection/immutable/SetTests.scala b/test/junit/scala/collection/immutable/SetTests.scala new file mode 100644 index 0000000000..28c7864359 --- /dev/null +++ b/test/junit/scala/collection/immutable/SetTests.scala @@ -0,0 +1,81 @@ +package scala.collection.immutable + +import org.junit.Assert._ +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(classOf[JUnit4]) +class SetTests { + @Test + def test_SI8346_toSet_soundness(): Unit = { + val any2stringadd = "Disabled string conversions so as not to get confused!" + + def any[A](set: Set[A]): Set[Any] = { + val anyset = set.toSet[Any] + assert((anyset + "fish") contains "fish") + anyset + } + + // Make sure default immutable Set does not rebuild itself on widening with toSet + // Need to cover 0, 1, 2, 3, 4 elements as special cases + var si = Set.empty[Int] + assert(si eq si.toSet[Any]) + for (i <- 1 to 5) { + val s1 = Set(Array.range(1, i+1): _*) + val s2 = si + i + val s1a = any(s1) + val s2a = any(s2) + assert(s1 eq s1a) + assert(s2 eq s2a) + si = s2 + } + + // Make sure BitSet correctly rebuilds itself on widening with toSet + // Need to cover empty, values 0-63, values 0-127 as special cases + val bitsets = Seq(BitSet.empty, BitSet(23), BitSet(23, 99), BitSet(23, 99, 141)) + bitsets.foreach{ b => + val ba = any(b) + assert(b ne ba) + assertEquals(b, ba) + } + + // Make sure HashSet (and by extension, its implementing class HashTrieSet) + // does not rebuild itself on widening by toSet + val hashset = HashSet(1, 3, 5, 7) + val hashseta = any(hashset) + assert(hashset eq hashseta) + + // Make sure ListSet does not rebuild itself on widening by toSet + // (Covers Node also, since it subclasses ListSet) + val listset = ListSet(1, 3, 5, 7) + val listseta = any(listset) + assert(listset eq listseta) + + // Make sure SortedSets correctly rebuild themselves on widening with toSet + // Covers TreeSet and keySet of SortedMap also + val sortedsets = Seq( + SortedSet.empty[Int], SortedSet(5), SortedSet(1,2,3,5,4), + SortedMap(1 -> "cod", 2 -> "herring").keySet + ) + sortedsets.foreach{ set => + val seta = any(set) + assert(set ne seta) + assertEquals(set, seta) + } + + // Make sure ValueSets correctly rebuild themselves on widening with toSet + object WeekDay extends Enumeration { + type WeekDay = Value + val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value + } + val valuesa = any(WeekDay.values) + assert(WeekDay.values ne valuesa) + assertEquals(WeekDay.values, valuesa) + + // Make sure regular Map keySets do not rebuild themselves on widening with toSet + val mapset = Map(1 -> "cod", 2 -> "herring").keySet + val mapseta = any(mapset) + assert(mapset eq mapseta) + } +} -- cgit v1.2.3 From fb4f9ad73890e91e103c34002121b05bd2de2910 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 28 Aug 2015 14:08:31 -0400 Subject: fix assorted typos --- scripts/jobs/integrate/bootstrap | 6 +++--- src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala | 4 ++-- src/compiler/scala/tools/nsc/transform/AddInterfaces.scala | 2 +- src/compiler/scala/tools/nsc/transform/Delambdafy.scala | 2 +- src/library/scala/reflect/ClassManifestDeprecatedApis.scala | 4 ++-- src/reflect/scala/reflect/internal/Trees.scala | 2 +- src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/scripts/jobs/integrate/bootstrap b/scripts/jobs/integrate/bootstrap index 5048f3fdb9..8d04e7fc79 100755 --- a/scripts/jobs/integrate/bootstrap +++ b/scripts/jobs/integrate/bootstrap @@ -33,7 +33,7 @@ # - Set _VER to override the default, e.g. XML_VER="1.0.4". # - The git revision is set to _REF="v$_VER". Make sure the tag exists (you can't override _REF). # -# - Otherwise (moduleVersioning has some other value): in this mode we use nightly version nubmers for modules. +# - Otherwise (moduleVersioning has some other value): in this mode we use nightly version numbers for modules. # - By default the script sets all _REF to "HEAD", override to build a specific revision. # - The _VER is set to a nightly version, for example "1.0.3-7-g14888a2-nightly" (you can't override _VER) @@ -348,7 +348,7 @@ scalaVerToBinary() { # - the suffix starts with "-bin": 2.12.0-bin-M1 # - the patch version is > 0 : 2.12.1-M1, 1.12.3-RC2, 2.12.1-sha-nightly, 2.12.2-SNAPSHOT # - # Othwersise, the binary version is the full version: 2.12.0-M1, 2.12.0-RC2, 2.12.0-sha-nightly, 2.12.0-SNAPSHOT + # Otherwise, the binary version is the full version: 2.12.0-M1, 2.12.0-RC2, 2.12.0-sha-nightly, 2.12.0-SNAPSHOT # # Adapted from sbt: https://github.com/sbt/sbt/blob/0.13.8/util/cross/src/main/input_sources/CrossVersionUtil.scala#L39 # @@ -564,7 +564,7 @@ bootstrap() { echo "### Bootstrapping Scala using locker" - # # TODO: close all open staging repos so that we can be reaonably sure the only open one we see after publishing below is ours + # # TODO: close all open staging repos so that we can be reasonably sure the only open one we see after publishing below is ours # # the ant call will create a new one # # Rebuild Scala with these modules so that all binary versions are consistent. diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala index 2c4a0ad3c3..6b2786c1a3 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala @@ -705,9 +705,9 @@ class Inliner[BT <: BTypes](val btypes: BT) { // - a method name+type // // execution [3] - // - resolve the CSP, yielding the boostrap method handle, the static args and the name+type + // - resolve the CSP, yielding the bootstrap method handle, the static args and the name+type // - resolution entails accessibility checking [4] - // - execute the `invoke` method of the boostrap method handle (which is signature polymorphic, check its javadoc) + // - execute the `invoke` method of the bootstrap method handle (which is signature polymorphic, check its javadoc) // - the descriptor for the call is made up from the actual arguments on the stack: // - the first parameters are "MethodHandles.Lookup, String, MethodType", then the types of the constant arguments, // - the return type is CallSite diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index 79776485de..82e7c76409 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -111,7 +111,7 @@ abstract class AddInterfaces extends InfoTransform { self: Erasure => impl setInfo new LazyImplClassType(iface) } - /** Return the implementation class of a trait; create a new one of one does not yet exist */ + /** Return the implementation class of a trait; create a new one if one does not yet exist */ def implClass(iface: Symbol): Symbol = { iface.info diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala index 5a7f6c52da..ea8c1cbaf6 100644 --- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala +++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala @@ -281,7 +281,7 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre val parents = addSerializable(abstractFunctionErasedType) val funOwner = originalFunction.symbol.owner - // TODO harmonize the naming of delamdafy anon-fun classes with those spun up by Uncurry + // TODO harmonize the naming of delambdafy anon-fun classes with those spun up by Uncurry // - make `anonClass.isAnonymousClass` true. // - use `newAnonymousClassSymbol` or push the required variations into a similar factory method // - reinstate the assertion in `Erasure.resolveAnonymousBridgeClash` diff --git a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala index ca7a3cddb8..82ec872806 100644 --- a/src/library/scala/reflect/ClassManifestDeprecatedApis.scala +++ b/src/library/scala/reflect/ClassManifestDeprecatedApis.scala @@ -218,7 +218,7 @@ object ClassManifestFactory { /** ClassManifest for the abstract type `prefix # name`. `upperBound` is not * strictly necessary as it could be obtained by reflection. It was * added so that erasure can be calculated without reflection. - * todo: remove after next boostrap + * todo: remove after next bootstrap */ def abstractType[T](prefix: OptManifest[_], name: String, upperbound: ClassManifest[_], args: OptManifest[_]*): ClassManifest[T] = new ClassManifest[T] { @@ -239,4 +239,4 @@ private class ClassTypeManifest[T]( (if (prefix.isEmpty) "" else prefix.get.toString+"#") + (if (runtimeClass.isArray) "Array" else runtimeClass.getName) + argString -} \ No newline at end of file +} diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index 498e7bddd0..bbd9df05d2 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -1418,7 +1418,7 @@ trait Trees extends api.Trees { transformTypeDefs(tparams), transform(rhs)) } case LabelDef(name, params, rhs) => - treeCopy.LabelDef(tree, name, transformIdents(params), transform(rhs)) //bq: Martin, once, atOwner(...) works, also change `LamdaLifter.proxy' + treeCopy.LabelDef(tree, name, transformIdents(params), transform(rhs)) //bq: Martin, once, atOwner(...) works, also change `LambdaLifter.proxy' case PackageDef(pid, stats) => treeCopy.PackageDef( tree, transform(pid).asInstanceOf[RefTree], diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala index 4bed106f43..9381cf3a35 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotRunner.scala @@ -145,7 +145,7 @@ class DotProcess(settings: doc.Settings) { // we shouldn't just sit there for 50s not reporting anything, no? settings.printMsg("Graphviz dot encountered an error when generating the diagram for:") settings.printMsg(templateName) - settings.printMsg("These are usually spurious errors, but if you notice a persistant error on") + settings.printMsg("These are usually spurious errors, but if you notice a persistent error on") settings.printMsg("a diagram, please use the " + settings.docDiagramsDebug.name + " flag and report a bug with the output.") } } -- cgit v1.2.3 From 60cdb31dfb10c1af4dd4bd477afd38b5c67f89d7 Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Sat, 29 Aug 2015 12:56:59 -0700 Subject: SI-9407 Vector implementation bit-shift bugfix Fixed logically incorrect or unnecessary code in Vector as reported by Dirk Toewe. No tests. Because of the size of the vectors, tests would be impractically slow. Also, the logic is quite clear: when you are recursing through a tree, using the wrong bit shift means you hit the wrong part of the tree, and when you create and then always overwrite a mutable var, you should just not do it to begin with. --- src/library/scala/collection/immutable/Vector.scala | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src') diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala index 46d5d0c69c..8bb581d44c 100644 --- a/src/library/scala/collection/immutable/Vector.scala +++ b/src/library/scala/collection/immutable/Vector.scala @@ -1156,8 +1156,6 @@ private[immutable] trait VectorPointer[T] { if (depth == 3) { display3 = new Array(32) display3((oldIndex >> 15) & 31) = display2 - display2 = new Array(32) - display1 = new Array(32) depth +=1 } display2 = display3((newIndex >> 15) & 31).asInstanceOf[Array[AnyRef]] @@ -1170,9 +1168,6 @@ private[immutable] trait VectorPointer[T] { if (depth == 4) { display4 = new Array(32) display4((oldIndex >> 20) & 31) = display3 - display3 = new Array(32) - display2 = new Array(32) - display1 = new Array(32) depth +=1 } display3 = display4((newIndex >> 20) & 31).asInstanceOf[Array[AnyRef]] @@ -1187,13 +1182,9 @@ private[immutable] trait VectorPointer[T] { if (depth == 5) { display5 = new Array(32) display5((oldIndex >> 25) & 31) = display4 - display4 = new Array(32) - display3 = new Array(32) - display2 = new Array(32) - display1 = new Array(32) depth +=1 } - display4 = display5((newIndex >> 20) & 31).asInstanceOf[Array[AnyRef]] + display4 = display5((newIndex >> 25) & 31).asInstanceOf[Array[AnyRef]] if (display4 == null) display4 = new Array(32) display3 = display4((newIndex >> 20) & 31).asInstanceOf[Array[AnyRef]] if (display3 == null) display3 = new Array(32) -- cgit v1.2.3 From 117ea7f5aaa42d19b67fc6d5bd4ec330af43f475 Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Sat, 29 Aug 2015 13:15:26 -0700 Subject: SI-9424 Clarify behavior of PriorityQueue toString Clarified that PriorityQueue will not print in order and gave an example of a workaround if one needs it. Documentation change only; no tests. --- src/library/scala/collection/mutable/PriorityQueue.scala | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index d3c4161e3b..2562f60355 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -18,8 +18,19 @@ import generic._ * * Only the `dequeue` and `dequeueAll` methods will return methods in priority * order (while removing elements from the heap). Standard collection methods - * including `drop` and `iterator` will remove or traverse the heap in whichever - * order seems most convenient. + * including `drop`, `iterator`, and `toString` will remove or traverse the heap + * in whichever order seems most convenient. + * + * Therefore, printing a `PriorityQueue` will not reveal the priority order of + * the elements, though the highest-priority element will be printed first. To + * print the elements in order, one must duplicate the `PriorityQueue` (by using + * `clone`, for instance) and then dequeue them: + * + * @example {{{ + * val pq = collection.mutable.PriorityQueue(1, 2, 5, 3, 7) + * println(pq) // elements probably not in order + * println(pq.clone.dequeueAll) // prints Vector(7, 5, 3, 2, 1) + * }}} * * @tparam A type of the elements in this priority queue. * @param ord implicit ordering used to compare the elements of type `A`. -- cgit v1.2.3 From 681cc075128de67279d8ce89423299da53e3e784 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Mon, 31 Aug 2015 21:42:11 +0100 Subject: Improve implementation comments in Option.collect example --- src/library/scala/Option.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala index f134f5ce3d..7282feebb6 100644 --- a/src/library/scala/Option.scala +++ b/src/library/scala/Option.scala @@ -270,7 +270,7 @@ sealed abstract class Option[+A] extends Product with Serializable { * // Returns None because the partial function doesn't cover the case. * Some("ftp") collect {case "http" => "HTTP"} * - * // Returns None because None is passed to the collect method. + * // Returns None because the option is empty. There is no value to pass to the partial function. * None collect {case value => value} * }}} * -- cgit v1.2.3 From 15c12377b4f047c02fa1af5300722ee1e5eb042a Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Tue, 1 Sep 2015 21:43:26 +0100 Subject: Link to completed value classes SIP page instead of pending version --- src/library-aux/scala/Any.scala | 2 +- src/library/scala/AnyVal.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/library-aux/scala/Any.scala b/src/library-aux/scala/Any.scala index 1be186d114..8caf0c5c0e 100644 --- a/src/library-aux/scala/Any.scala +++ b/src/library-aux/scala/Any.scala @@ -27,7 +27,7 @@ package scala * w.print() * }}} * - * See the [[http://docs.scala-lang.org/sips/pending/value-classes.html value classes guide]] for more + * See the [[http://docs.scala-lang.org/sips/completed/value-classes.html value classes guide]] for more * details on the interplay of universal traits and value classes. */ abstract class Any { diff --git a/src/library/scala/AnyVal.scala b/src/library/scala/AnyVal.scala index ff62948413..fb3d213e19 100644 --- a/src/library/scala/AnyVal.scala +++ b/src/library/scala/AnyVal.scala @@ -49,7 +49,7 @@ package scala * It's important to note that user-defined value classes are limited, and in some circumstances, * still must allocate a value class instance at runtime. These limitations and circumstances are * explained in greater detail in the [[http://docs.scala-lang.org/overviews/core/value-classes.html Value Classes Guide]] - * as well as in [[http://docs.scala-lang.org/sips/pending/value-classes.html SIP-15: Value Classes]], + * as well as in [[http://docs.scala-lang.org/sips/completed/value-classes.html SIP-15: Value Classes]], * the Scala Improvement Proposal. */ abstract class AnyVal extends Any { -- cgit v1.2.3 From 32da6dce10586f9ac54877ba776447b353293851 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 2 Sep 2015 10:27:47 +1000 Subject: Try harder to avoid reporting unpositioned errors Rather than issuing an error at NoPosition, which usually means an unpositioned tree is being typechecked, walk up the context chain for an enclosing positioned tree. I've tested this manually with ensime which was getting an unpositioned warning as a result of a unpositioned trees created by a macro in scalatest. ``` % ../scala-positioned-error/build/quick/bin/scalac @args.txt /Users/jason/code/ensime-server/core/src/it/scala/org/ensime/core/RichPresentationCompilerSpec.scala:216: warning: implicit numeric widening ) { (p, cc) => ^ ``` --- .../scala/tools/nsc/typechecker/Contexts.scala | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 43f2655311..c46bc7444a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -574,19 +574,23 @@ trait Contexts { self: Analyzer => /** Issue/buffer/throw the given implicit ambiguity error according to the current mode for error reporting. */ private[typechecker] def issueAmbiguousError(err: AbsAmbiguousTypeError) = reporter.issueAmbiguousError(err)(this) /** Issue/throw the given error message according to the current mode for error reporting. */ - def error(pos: Position, msg: String) = reporter.error(pos, msg) + def error(pos: Position, msg: String) = reporter.error(fixPosition(pos), msg) /** Issue/throw the given error message according to the current mode for error reporting. */ - def warning(pos: Position, msg: String) = reporter.warning(pos, msg) - def echo(pos: Position, msg: String) = reporter.echo(pos, msg) + def warning(pos: Position, msg: String) = reporter.warning(fixPosition(pos), msg) + def echo(pos: Position, msg: String) = reporter.echo(fixPosition(pos), msg) + def fixPosition(pos: Position): Position = pos match { + case NoPosition => nextEnclosing(_.tree.pos != NoPosition).tree.pos + case _ => pos + } def deprecationWarning(pos: Position, sym: Symbol, msg: String): Unit = - currentRun.reporting.deprecationWarning(pos, sym, msg) + currentRun.reporting.deprecationWarning(fixPosition(pos), sym, msg) def deprecationWarning(pos: Position, sym: Symbol): Unit = - currentRun.reporting.deprecationWarning(pos, sym) // TODO: allow this to escalate to an error, and implicit search will ignore deprecated implicits + currentRun.reporting.deprecationWarning(fixPosition(pos), sym) // TODO: allow this to escalate to an error, and implicit search will ignore deprecated implicits def featureWarning(pos: Position, featureName: String, featureDesc: String, featureTrait: Symbol, construct: => String = "", required: Boolean): Unit = - currentRun.reporting.featureWarning(pos, featureName, featureDesc, featureTrait, construct, required) + currentRun.reporting.featureWarning(fixPosition(pos), featureName, featureDesc, featureTrait, construct, required) // nextOuter determines which context is searched next for implicits @@ -1239,7 +1243,7 @@ trait Contexts { self: Analyzer => type Error = AbsTypeError type Warning = (Position, String) - def issue(err: AbsTypeError)(implicit context: Context): Unit = handleError(err.errPos, addDiagString(err.errMsg)) + def issue(err: AbsTypeError)(implicit context: Context): Unit = handleError(context.fixPosition(err.errPos), addDiagString(err.errMsg)) protected def handleError(pos: Position, msg: String): Unit protected def handleSuppressedAmbiguous(err: AbsAmbiguousTypeError): Unit = () @@ -1256,7 +1260,7 @@ trait Contexts { self: Analyzer => * - else, let this context reporter decide */ final def issueAmbiguousError(err: AbsAmbiguousTypeError)(implicit context: Context): Unit = - if (context.ambiguousErrors) reporter.error(err.errPos, addDiagString(err.errMsg)) // force reporting... see TODO above + if (context.ambiguousErrors) reporter.error(context.fixPosition(err.errPos), addDiagString(err.errMsg)) // force reporting... see TODO above else handleSuppressedAmbiguous(err) @inline final def withFreshErrorBuffer[T](expr: => T): T = { -- cgit v1.2.3 From 7f793751e2e794edd5af5badeb7c14fee0461831 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Wed, 2 Sep 2015 21:38:10 +0100 Subject: Update Java and Sun URLs to replacement Java and Oracle URLs For each URL - Where it redirected the target of the redirection was used - Where is no longer existed a replacement was selected --- src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 2 +- src/compiler/scala/tools/nsc/io/Jar.scala | 2 +- src/compiler/scala/tools/nsc/util/ClassPath.scala | 2 +- src/library/scala/concurrent/SyncVar.scala | 2 +- src/library/scala/io/Codec.scala | 2 +- src/library/scala/runtime/ScalaRunTime.scala | 2 +- src/reflect/scala/reflect/internal/ClassfileConstants.scala | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 618bf3b9b3..4768417c67 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -2700,7 +2700,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self => case CMPG => (kind: @unchecked) match { case FLOAT => emit(Opcodes.FCMPG) - case DOUBLE => emit(Opcodes.DCMPL) // TODO bug? why not DCMPG? http://docs.oracle.com/javase/specs/jvms/se5.0/html/Instructions2.doc3.html + case DOUBLE => emit(Opcodes.DCMPL) // TODO bug? why not DCMPG? http://docs.oracle.com/javase/specs/jvms/se6/html/Instructions2.doc3.html } } diff --git a/src/compiler/scala/tools/nsc/io/Jar.scala b/src/compiler/scala/tools/nsc/io/Jar.scala index 2967f67e9c..efb026cdff 100644 --- a/src/compiler/scala/tools/nsc/io/Jar.scala +++ b/src/compiler/scala/tools/nsc/io/Jar.scala @@ -154,7 +154,7 @@ object Jar { def update(key: Attributes.Name, value: String) = attrs.put(key, value) } - // See http://download.java.net/jdk7/docs/api/java/nio/file/Path.html + // See http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html // for some ideas. private val ZipMagicNumber = List[Byte](80, 75, 3, 4) private def magicNumberIsZip(f: Path) = f.isFile && (f.toFile.bytes().take(4).toList == ZipMagicNumber) diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index 8d4d07759f..2811520b67 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -22,7 +22,7 @@ import Jar.isJarOrZip /**

    * This module provides star expansion of '-classpath' option arguments, behaves the same as - * java, see [http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html] + * java, see [[http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html]] *

    * * @author Stepan Koltsov diff --git a/src/library/scala/concurrent/SyncVar.scala b/src/library/scala/concurrent/SyncVar.scala index 9634f6d900..1ee27b0f36 100644 --- a/src/library/scala/concurrent/SyncVar.scala +++ b/src/library/scala/concurrent/SyncVar.scala @@ -40,7 +40,7 @@ class SyncVar[A] { wait(timeout) val elapsed = System.nanoTime() - start // nanoTime should be monotonic, but it's not possible to rely on that. - // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6458294. + // See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6458294. if (elapsed < 0) 0 else TimeUnit.NANOSECONDS.toMillis(elapsed) } diff --git a/src/library/scala/io/Codec.scala b/src/library/scala/io/Codec.scala index 60f99199cb..2a41e25b01 100644 --- a/src/library/scala/io/Codec.scala +++ b/src/library/scala/io/Codec.scala @@ -22,7 +22,7 @@ import scala.language.implicitConversions // // // MacRoman vs. UTF-8: see http://jira.codehaus.org/browse/JRUBY-3576 -// -Dfile.encoding: see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4375816 +// -Dfile.encoding: see http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4375816 /** A class for character encoding/decoding preferences. * diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index 18fcbf8276..20f067f34f 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -155,7 +155,7 @@ object ScalaRunTime { arr } - // Java bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957 + // Java bug: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4071957 // More background at ticket #2318. def ensureAccessible(m: JMethod): JMethod = scala.reflect.ensureAccessible(m) diff --git a/src/reflect/scala/reflect/internal/ClassfileConstants.scala b/src/reflect/scala/reflect/internal/ClassfileConstants.scala index e5d97e8959..a4223c1cb5 100644 --- a/src/reflect/scala/reflect/internal/ClassfileConstants.scala +++ b/src/reflect/scala/reflect/internal/ClassfileConstants.scala @@ -14,7 +14,7 @@ object ClassfileConstants { final val JAVA_MAJOR_VERSION = 45 final val JAVA_MINOR_VERSION = 3 - /** (see http://java.sun.com/docs/books/jvms/second_edition/jvms-clarify.html) + /** (see http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.1) * * If the `ACC_INTERFACE` flag is set, the `ACC_ABSTRACT` flag must also * be set (ch. 2.13.1). -- cgit v1.2.3 From 2374561288799a5d59d7f7bead9e3734ae956cc4 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Wed, 2 Sep 2015 18:21:16 -0400 Subject: unset inappropriate execute bits I imagine these date back to old Subversion days and are probably the result of inadvertent commits from Windows users with vcs client configs. having the bit set isn't really harmful most of the time, but it's just not right, and it makes the files stand out in directory listings for no reason --- build.xml | 0 src/compiler/scala/tools/nsc/ast/DocComments.scala | 0 src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala | 0 src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala | 0 src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala | 0 src/compiler/scala/tools/nsc/util/DocStrings.scala | 0 src/library/scala/collection/IndexedSeqOptimized.scala | 0 src/library/scala/collection/JavaConverters.scala | 0 src/library/scala/collection/LinearSeqOptimized.scala | 0 src/library/scala/collection/generic/FilterMonadic.scala | 0 src/library/scala/collection/generic/HasNewBuilder.scala | 0 src/library/scala/collection/immutable/DefaultMap.scala | 0 src/library/scala/collection/mutable/IndexedSeqOptimized.scala | 0 src/library/scala/collection/readme-if-you-want-to-add-something.txt | 0 src/library/scala/reflect/NameTransformer.scala | 0 src/library/scala/runtime/TraitSetter.java | 0 src/library/scala/runtime/VolatileBooleanRef.java | 0 src/library/scala/runtime/VolatileByteRef.java | 0 src/library/scala/runtime/VolatileCharRef.java | 0 src/library/scala/runtime/VolatileDoubleRef.java | 0 src/library/scala/runtime/VolatileFloatRef.java | 0 src/library/scala/runtime/VolatileIntRef.java | 0 src/library/scala/runtime/VolatileLongRef.java | 0 src/library/scala/runtime/VolatileObjectRef.java | 0 src/library/scala/runtime/VolatileShortRef.java | 0 src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala | 0 src/scaladoc/scala/tools/nsc/doc/base/LinkTo.scala | 0 src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala | 0 src/scaladoc/scala/tools/nsc/doc/base/comment/Body.scala | 0 src/scaladoc/scala/tools/nsc/doc/html/page/DeprecatedIndex.scala | 0 src/scaladoc/scala/tools/nsc/doc/html/page/ReferenceIndex.scala | 0 src/scaladoc/scala/tools/nsc/doc/html/resource/lib/jquery-ui.js | 0 src/scaladoc/scala/tools/nsc/doc/html/resource/lib/ref-index.css | 0 src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala | 0 src/scaladoc/scala/tools/nsc/doc/model/TreeFactory.scala | 0 test/disabled/pos/t1545.scala | 0 test/files/bench/equality/eq.scala | 0 test/files/bench/equality/eqeq.scala | 0 test/files/neg/override.scala | 0 test/files/neg/t2336.scala | 0 test/files/neg/t2494.scala | 0 test/files/neg/t2773.scala | 0 test/files/neg/t2779.scala | 0 test/files/neg/t2870.scala | 0 test/files/neg/t2918.scala | 0 test/files/neg/t3006.scala | 0 test/files/neg/t3224.scala | 0 test/files/neg/t6446-additional.check | 0 test/files/neg/t6446-list.check | 0 test/files/neg/t6446-missing.check | 0 test/files/neg/t771.scala | 0 test/files/pos/lexical.scala | 0 test/files/pos/packageobjs.scala | 0 test/files/pos/spec-t6286.scala | 0 test/files/pos/t1459/AbstractBase.java | 0 test/files/pos/t1459/App.scala | 0 test/files/pos/t1459/Caller.java | 0 test/files/pos/t1722/Test.scala | 0 test/files/pos/t1722/Top.scala | 0 test/files/pos/t1756.scala | 0 test/files/pos/t2060.scala | 0 test/files/pos/t2082.scala | 0 test/files/pos/t2179.scala | 0 test/files/pos/t2425.scala | 0 test/files/pos/t2429.scala | 0 test/files/pos/t2433/A.java | 0 test/files/pos/t2433/B.java | 0 test/files/pos/t2433/Test.scala | 0 test/files/pos/t2484.scala | 0 test/files/pos/t2504.scala | 0 test/files/pos/t2545.scala | 0 test/files/pos/t2635.scala | 0 test/files/pos/t2683.scala | 0 test/files/pos/t2913.scala | 0 test/files/pos/t2956/t2956.scala | 0 test/files/pos/t3174.scala | 0 test/files/pos/t3174b.scala | 0 test/files/pos/t3568.scala | 0 test/files/pos/t4553.scala | 0 test/files/presentation/doc/doc.scala | 0 test/files/presentation/doc/src/Class.scala | 0 test/files/presentation/doc/src/p/Base.scala | 0 test/files/presentation/doc/src/p/Derived.scala | 0 test/files/run/list_map.scala | 0 test/files/run/t2127.scala | 0 test/files/run/t2503.scala | 0 test/files/run/t3026.scala | 0 test/files/run/t5699.check | 0 test/files/run/t5699.scala | 0 test/files/run/t5717.scala | 0 test/files/run/t7246.check | 0 test/files/run/t7246/Outer.java | 0 test/files/run/t7246/Test.scala | 0 test/files/run/t7246b.check | 0 test/files/run/t7246b/Base.scala | 0 test/files/run/t7246b/Outer.java | 0 test/files/run/t7246b/Test.scala | 0 test/files/run/t7341.flags | 0 test/files/run/t7341.scala | 0 test/files/run/viewtest.scala | 0 test/files/run/weakconform.scala | 0 test/pending/run/t3609.scala | 0 test/scaladoc/run/SI-191.check | 0 test/scaladoc/run/SI-191.scala | 0 test/scaladoc/run/SI-7367.check | 0 test/scaladoc/run/SI-7367.scala | 0 test/scaladoc/run/SI-8479.scala | 0 test/script-tests/README | 0 108 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 build.xml mode change 100755 => 100644 src/compiler/scala/tools/nsc/ast/DocComments.scala mode change 100755 => 100644 src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala mode change 100755 => 100644 src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala mode change 100755 => 100644 src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala mode change 100755 => 100644 src/compiler/scala/tools/nsc/util/DocStrings.scala mode change 100755 => 100644 src/library/scala/collection/IndexedSeqOptimized.scala mode change 100755 => 100644 src/library/scala/collection/JavaConverters.scala mode change 100755 => 100644 src/library/scala/collection/LinearSeqOptimized.scala mode change 100755 => 100644 src/library/scala/collection/generic/FilterMonadic.scala mode change 100755 => 100644 src/library/scala/collection/generic/HasNewBuilder.scala mode change 100755 => 100644 src/library/scala/collection/immutable/DefaultMap.scala mode change 100755 => 100644 src/library/scala/collection/mutable/IndexedSeqOptimized.scala mode change 100755 => 100644 src/library/scala/collection/readme-if-you-want-to-add-something.txt mode change 100755 => 100644 src/library/scala/reflect/NameTransformer.scala mode change 100755 => 100644 src/library/scala/runtime/TraitSetter.java mode change 100755 => 100644 src/library/scala/runtime/VolatileBooleanRef.java mode change 100755 => 100644 src/library/scala/runtime/VolatileByteRef.java mode change 100755 => 100644 src/library/scala/runtime/VolatileCharRef.java mode change 100755 => 100644 src/library/scala/runtime/VolatileDoubleRef.java mode change 100755 => 100644 src/library/scala/runtime/VolatileFloatRef.java mode change 100755 => 100644 src/library/scala/runtime/VolatileIntRef.java mode change 100755 => 100644 src/library/scala/runtime/VolatileLongRef.java mode change 100755 => 100644 src/library/scala/runtime/VolatileObjectRef.java mode change 100755 => 100644 src/library/scala/runtime/VolatileShortRef.java mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/base/LinkTo.scala mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/base/comment/Body.scala mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/html/page/DeprecatedIndex.scala mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/html/page/ReferenceIndex.scala mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/html/resource/lib/jquery-ui.js mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/html/resource/lib/ref-index.css mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala mode change 100755 => 100644 src/scaladoc/scala/tools/nsc/doc/model/TreeFactory.scala mode change 100755 => 100644 test/disabled/pos/t1545.scala mode change 100755 => 100644 test/files/bench/equality/eq.scala mode change 100755 => 100644 test/files/bench/equality/eqeq.scala mode change 100755 => 100644 test/files/neg/override.scala mode change 100755 => 100644 test/files/neg/t2336.scala mode change 100755 => 100644 test/files/neg/t2494.scala mode change 100755 => 100644 test/files/neg/t2773.scala mode change 100755 => 100644 test/files/neg/t2779.scala mode change 100755 => 100644 test/files/neg/t2870.scala mode change 100755 => 100644 test/files/neg/t2918.scala mode change 100755 => 100644 test/files/neg/t3006.scala mode change 100755 => 100644 test/files/neg/t3224.scala mode change 100755 => 100644 test/files/neg/t6446-additional.check mode change 100755 => 100644 test/files/neg/t6446-list.check mode change 100755 => 100644 test/files/neg/t6446-missing.check mode change 100755 => 100644 test/files/neg/t771.scala mode change 100755 => 100644 test/files/pos/lexical.scala mode change 100755 => 100644 test/files/pos/packageobjs.scala mode change 100755 => 100644 test/files/pos/spec-t6286.scala mode change 100755 => 100644 test/files/pos/t1459/AbstractBase.java mode change 100755 => 100644 test/files/pos/t1459/App.scala mode change 100755 => 100644 test/files/pos/t1459/Caller.java mode change 100755 => 100644 test/files/pos/t1722/Test.scala mode change 100755 => 100644 test/files/pos/t1722/Top.scala mode change 100755 => 100644 test/files/pos/t1756.scala mode change 100755 => 100644 test/files/pos/t2060.scala mode change 100755 => 100644 test/files/pos/t2082.scala mode change 100755 => 100644 test/files/pos/t2179.scala mode change 100755 => 100644 test/files/pos/t2425.scala mode change 100755 => 100644 test/files/pos/t2429.scala mode change 100755 => 100644 test/files/pos/t2433/A.java mode change 100755 => 100644 test/files/pos/t2433/B.java mode change 100755 => 100644 test/files/pos/t2433/Test.scala mode change 100755 => 100644 test/files/pos/t2484.scala mode change 100755 => 100644 test/files/pos/t2504.scala mode change 100755 => 100644 test/files/pos/t2545.scala mode change 100755 => 100644 test/files/pos/t2635.scala mode change 100755 => 100644 test/files/pos/t2683.scala mode change 100755 => 100644 test/files/pos/t2913.scala mode change 100755 => 100644 test/files/pos/t2956/t2956.scala mode change 100755 => 100644 test/files/pos/t3174.scala mode change 100755 => 100644 test/files/pos/t3174b.scala mode change 100755 => 100644 test/files/pos/t3568.scala mode change 100755 => 100644 test/files/pos/t4553.scala mode change 100755 => 100644 test/files/presentation/doc/doc.scala mode change 100755 => 100644 test/files/presentation/doc/src/Class.scala mode change 100755 => 100644 test/files/presentation/doc/src/p/Base.scala mode change 100755 => 100644 test/files/presentation/doc/src/p/Derived.scala mode change 100755 => 100644 test/files/run/list_map.scala mode change 100755 => 100644 test/files/run/t2127.scala mode change 100755 => 100644 test/files/run/t2503.scala mode change 100755 => 100644 test/files/run/t3026.scala mode change 100755 => 100644 test/files/run/t5699.check mode change 100755 => 100644 test/files/run/t5699.scala mode change 100755 => 100644 test/files/run/t5717.scala mode change 100755 => 100644 test/files/run/t7246.check mode change 100755 => 100644 test/files/run/t7246/Outer.java mode change 100755 => 100644 test/files/run/t7246/Test.scala mode change 100755 => 100644 test/files/run/t7246b.check mode change 100755 => 100644 test/files/run/t7246b/Base.scala mode change 100755 => 100644 test/files/run/t7246b/Outer.java mode change 100755 => 100644 test/files/run/t7246b/Test.scala mode change 100755 => 100644 test/files/run/t7341.flags mode change 100755 => 100644 test/files/run/t7341.scala mode change 100755 => 100644 test/files/run/viewtest.scala mode change 100755 => 100644 test/files/run/weakconform.scala mode change 100755 => 100644 test/pending/run/t3609.scala mode change 100755 => 100644 test/scaladoc/run/SI-191.check mode change 100755 => 100644 test/scaladoc/run/SI-191.scala mode change 100755 => 100644 test/scaladoc/run/SI-7367.check mode change 100755 => 100644 test/scaladoc/run/SI-7367.scala mode change 100755 => 100644 test/scaladoc/run/SI-8479.scala mode change 100755 => 100644 test/script-tests/README (limited to 'src') diff --git a/build.xml b/build.xml old mode 100755 new mode 100644 diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala old mode 100755 new mode 100644 diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala old mode 100755 new mode 100644 diff --git a/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala old mode 100755 new mode 100644 diff --git a/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala b/src/compiler/scala/tools/nsc/ast/parser/xml/Utility.scala old mode 100755 new mode 100644 diff --git a/src/compiler/scala/tools/nsc/util/DocStrings.scala b/src/compiler/scala/tools/nsc/util/DocStrings.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/collection/IndexedSeqOptimized.scala b/src/library/scala/collection/IndexedSeqOptimized.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/collection/JavaConverters.scala b/src/library/scala/collection/JavaConverters.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/collection/LinearSeqOptimized.scala b/src/library/scala/collection/LinearSeqOptimized.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/collection/generic/FilterMonadic.scala b/src/library/scala/collection/generic/FilterMonadic.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/collection/generic/HasNewBuilder.scala b/src/library/scala/collection/generic/HasNewBuilder.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/collection/immutable/DefaultMap.scala b/src/library/scala/collection/immutable/DefaultMap.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/collection/mutable/IndexedSeqOptimized.scala b/src/library/scala/collection/mutable/IndexedSeqOptimized.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/collection/readme-if-you-want-to-add-something.txt b/src/library/scala/collection/readme-if-you-want-to-add-something.txt old mode 100755 new mode 100644 diff --git a/src/library/scala/reflect/NameTransformer.scala b/src/library/scala/reflect/NameTransformer.scala old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/TraitSetter.java b/src/library/scala/runtime/TraitSetter.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileBooleanRef.java b/src/library/scala/runtime/VolatileBooleanRef.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileByteRef.java b/src/library/scala/runtime/VolatileByteRef.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileCharRef.java b/src/library/scala/runtime/VolatileCharRef.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileDoubleRef.java b/src/library/scala/runtime/VolatileDoubleRef.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileFloatRef.java b/src/library/scala/runtime/VolatileFloatRef.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileIntRef.java b/src/library/scala/runtime/VolatileIntRef.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileLongRef.java b/src/library/scala/runtime/VolatileLongRef.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileObjectRef.java b/src/library/scala/runtime/VolatileObjectRef.java old mode 100755 new mode 100644 diff --git a/src/library/scala/runtime/VolatileShortRef.java b/src/library/scala/runtime/VolatileShortRef.java old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/base/LinkTo.scala b/src/scaladoc/scala/tools/nsc/doc/base/LinkTo.scala old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/MemberLookupBase.scala old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/base/comment/Body.scala b/src/scaladoc/scala/tools/nsc/doc/base/comment/Body.scala old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/DeprecatedIndex.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/DeprecatedIndex.scala old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/ReferenceIndex.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/ReferenceIndex.scala old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/jquery-ui.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/jquery-ui.js old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/ref-index.css b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/ref-index.css old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala old mode 100755 new mode 100644 diff --git a/src/scaladoc/scala/tools/nsc/doc/model/TreeFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/TreeFactory.scala old mode 100755 new mode 100644 diff --git a/test/disabled/pos/t1545.scala b/test/disabled/pos/t1545.scala old mode 100755 new mode 100644 diff --git a/test/files/bench/equality/eq.scala b/test/files/bench/equality/eq.scala old mode 100755 new mode 100644 diff --git a/test/files/bench/equality/eqeq.scala b/test/files/bench/equality/eqeq.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/override.scala b/test/files/neg/override.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t2336.scala b/test/files/neg/t2336.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t2494.scala b/test/files/neg/t2494.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t2773.scala b/test/files/neg/t2773.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t2779.scala b/test/files/neg/t2779.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t2870.scala b/test/files/neg/t2870.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t2918.scala b/test/files/neg/t2918.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t3006.scala b/test/files/neg/t3006.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t3224.scala b/test/files/neg/t3224.scala old mode 100755 new mode 100644 diff --git a/test/files/neg/t6446-additional.check b/test/files/neg/t6446-additional.check old mode 100755 new mode 100644 diff --git a/test/files/neg/t6446-list.check b/test/files/neg/t6446-list.check old mode 100755 new mode 100644 diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check old mode 100755 new mode 100644 diff --git a/test/files/neg/t771.scala b/test/files/neg/t771.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/lexical.scala b/test/files/pos/lexical.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/packageobjs.scala b/test/files/pos/packageobjs.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/spec-t6286.scala b/test/files/pos/spec-t6286.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t1459/AbstractBase.java b/test/files/pos/t1459/AbstractBase.java old mode 100755 new mode 100644 diff --git a/test/files/pos/t1459/App.scala b/test/files/pos/t1459/App.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t1459/Caller.java b/test/files/pos/t1459/Caller.java old mode 100755 new mode 100644 diff --git a/test/files/pos/t1722/Test.scala b/test/files/pos/t1722/Test.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t1722/Top.scala b/test/files/pos/t1722/Top.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t1756.scala b/test/files/pos/t1756.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2060.scala b/test/files/pos/t2060.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2082.scala b/test/files/pos/t2082.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2179.scala b/test/files/pos/t2179.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2425.scala b/test/files/pos/t2425.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2429.scala b/test/files/pos/t2429.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2433/A.java b/test/files/pos/t2433/A.java old mode 100755 new mode 100644 diff --git a/test/files/pos/t2433/B.java b/test/files/pos/t2433/B.java old mode 100755 new mode 100644 diff --git a/test/files/pos/t2433/Test.scala b/test/files/pos/t2433/Test.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2484.scala b/test/files/pos/t2484.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2504.scala b/test/files/pos/t2504.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2545.scala b/test/files/pos/t2545.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2635.scala b/test/files/pos/t2635.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2683.scala b/test/files/pos/t2683.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2913.scala b/test/files/pos/t2913.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t2956/t2956.scala b/test/files/pos/t2956/t2956.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t3174.scala b/test/files/pos/t3174.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t3174b.scala b/test/files/pos/t3174b.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t3568.scala b/test/files/pos/t3568.scala old mode 100755 new mode 100644 diff --git a/test/files/pos/t4553.scala b/test/files/pos/t4553.scala old mode 100755 new mode 100644 diff --git a/test/files/presentation/doc/doc.scala b/test/files/presentation/doc/doc.scala old mode 100755 new mode 100644 diff --git a/test/files/presentation/doc/src/Class.scala b/test/files/presentation/doc/src/Class.scala old mode 100755 new mode 100644 diff --git a/test/files/presentation/doc/src/p/Base.scala b/test/files/presentation/doc/src/p/Base.scala old mode 100755 new mode 100644 diff --git a/test/files/presentation/doc/src/p/Derived.scala b/test/files/presentation/doc/src/p/Derived.scala old mode 100755 new mode 100644 diff --git a/test/files/run/list_map.scala b/test/files/run/list_map.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t2127.scala b/test/files/run/t2127.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t2503.scala b/test/files/run/t2503.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t3026.scala b/test/files/run/t3026.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t5699.check b/test/files/run/t5699.check old mode 100755 new mode 100644 diff --git a/test/files/run/t5699.scala b/test/files/run/t5699.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t5717.scala b/test/files/run/t5717.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t7246.check b/test/files/run/t7246.check old mode 100755 new mode 100644 diff --git a/test/files/run/t7246/Outer.java b/test/files/run/t7246/Outer.java old mode 100755 new mode 100644 diff --git a/test/files/run/t7246/Test.scala b/test/files/run/t7246/Test.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t7246b.check b/test/files/run/t7246b.check old mode 100755 new mode 100644 diff --git a/test/files/run/t7246b/Base.scala b/test/files/run/t7246b/Base.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t7246b/Outer.java b/test/files/run/t7246b/Outer.java old mode 100755 new mode 100644 diff --git a/test/files/run/t7246b/Test.scala b/test/files/run/t7246b/Test.scala old mode 100755 new mode 100644 diff --git a/test/files/run/t7341.flags b/test/files/run/t7341.flags old mode 100755 new mode 100644 diff --git a/test/files/run/t7341.scala b/test/files/run/t7341.scala old mode 100755 new mode 100644 diff --git a/test/files/run/viewtest.scala b/test/files/run/viewtest.scala old mode 100755 new mode 100644 diff --git a/test/files/run/weakconform.scala b/test/files/run/weakconform.scala old mode 100755 new mode 100644 diff --git a/test/pending/run/t3609.scala b/test/pending/run/t3609.scala old mode 100755 new mode 100644 diff --git a/test/scaladoc/run/SI-191.check b/test/scaladoc/run/SI-191.check old mode 100755 new mode 100644 diff --git a/test/scaladoc/run/SI-191.scala b/test/scaladoc/run/SI-191.scala old mode 100755 new mode 100644 diff --git a/test/scaladoc/run/SI-7367.check b/test/scaladoc/run/SI-7367.check old mode 100755 new mode 100644 diff --git a/test/scaladoc/run/SI-7367.scala b/test/scaladoc/run/SI-7367.scala old mode 100755 new mode 100644 diff --git a/test/scaladoc/run/SI-8479.scala b/test/scaladoc/run/SI-8479.scala old mode 100755 new mode 100644 diff --git a/test/script-tests/README b/test/script-tests/README old mode 100755 new mode 100644 -- cgit v1.2.3 From 097e25b303f11d70f79c1e109d1e6b3669fe45a5 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Fri, 4 Sep 2015 21:51:21 +0100 Subject: Update links to docs, codehaus and citeseer docs.scala-lang.org - Align some links to new layout for docs.scala-lang.org - Include link to concrete parallel collection performance characteristics codehaus - Subsitute a link to a JIRA email for the 404 JRUBY-3576 JIRA link in Codec.scala. jira.codehaus.org is not redirecting this. citeseer - Replace the citeseer link with a direct link to a PDF which is not behind a login challenge. --- src/library/scala/collection/immutable/IntMap.scala | 2 +- src/library/scala/collection/mutable/Queue.scala | 2 +- src/library/scala/collection/package.scala | 3 +++ src/library/scala/io/Codec.scala | 2 +- src/reflect/scala/reflect/internal/pickling/UnPickler.scala | 2 +- src/reflect/scala/reflect/macros/blackbox/Context.scala | 2 +- src/reflect/scala/reflect/macros/package.scala | 4 ++-- src/reflect/scala/reflect/macros/whitebox/Context.scala | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/library/scala/collection/immutable/IntMap.scala b/src/library/scala/collection/immutable/IntMap.scala index 8991d0b75a..cb6196e130 100644 --- a/src/library/scala/collection/immutable/IntMap.scala +++ b/src/library/scala/collection/immutable/IntMap.scala @@ -146,7 +146,7 @@ private[immutable] class IntMapKeyIterator[V](it: IntMap[V]) extends IntMapItera import IntMap._ /** Specialised immutable map structure for integer keys, based on - * Fast Mergeable Integer Maps + * [[http://ittc.ku.edu/~andygill/papers/IntMap98.pdf Fast Mergeable Integer Maps]] * by Okasaki and Gill. Essentially a trie based on binary digits of the integers. * * '''Note:''' This class is as of 2.8 largely superseded by HashMap. diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala index 03d387a535..ad60173b64 100644 --- a/src/library/scala/collection/mutable/Queue.scala +++ b/src/library/scala/collection/mutable/Queue.scala @@ -21,7 +21,7 @@ import generic._ * @author Martin Odersky * @version 2.8 * @since 1 - * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#mutable_queues "Scala's Collection Library overview"]] + * @see [[http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#queues "Scala's Collection Library overview"]] * section on `Queues` for more information. * * @define Coll `mutable.Queue` diff --git a/src/library/scala/collection/package.scala b/src/library/scala/collection/package.scala index 6a2b6de75a..13fe7a79c4 100644 --- a/src/library/scala/collection/package.scala +++ b/src/library/scala/collection/package.scala @@ -69,6 +69,9 @@ package scala * characteristics which are described * in [[http://docs.scala-lang.org/overviews/collections/performance-characteristics.html the guide]]. * + * The concrete parallel collections also have specific performance characteristics which are + * described in [[http://docs.scala-lang.org/overviews/parallel-collections/concrete-parallel-collections.html#performance-characteristics the parallel collections guide]] + * * === Converting between Java Collections === * * The `JavaConversions` object provides implicit defs that will allow mostly seamless integration diff --git a/src/library/scala/io/Codec.scala b/src/library/scala/io/Codec.scala index 2a41e25b01..7cb7858b36 100644 --- a/src/library/scala/io/Codec.scala +++ b/src/library/scala/io/Codec.scala @@ -21,7 +21,7 @@ import scala.language.implicitConversions // XML: optional encoding parameter. // // -// MacRoman vs. UTF-8: see http://jira.codehaus.org/browse/JRUBY-3576 +// MacRoman vs. UTF-8: see http://osdir.com/ml/lang-jruby-devel/2009-04/msg00071.html // -Dfile.encoding: see http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4375816 /** A class for character encoding/decoding preferences. diff --git a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala index c40f5be476..a9020a3d4c 100644 --- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala +++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala @@ -244,7 +244,7 @@ abstract class UnPickler { (module map { case (group, art) => s"""\n(NOTE: It looks like the $art module is missing; try adding a dependency on "$group" : "$art". - | See http://docs.scala-lang.org/overviews/core/scala-2.11.html for more information.)""".stripMargin + | See http://docs.scala-lang.org/overviews/ for more information.)""".stripMargin } getOrElse "") } diff --git a/src/reflect/scala/reflect/macros/blackbox/Context.scala b/src/reflect/scala/reflect/macros/blackbox/Context.scala index 2f9c512efa..ce28b5911e 100644 --- a/src/reflect/scala/reflect/macros/blackbox/Context.scala +++ b/src/reflect/scala/reflect/macros/blackbox/Context.scala @@ -29,7 +29,7 @@ package blackbox * which means that its expansion will be upcast to its return type, enforcing faithfullness of that macro to its * type signature. Whitebox macros, i.e. the ones defined with `whitebox.Context`, aren't bound by this restriction, * which enables a number of important use cases, but they are also going to enjoy less support than blackbox macros, - * so choose wisely. See the [[http://docs.scala-lang.org/overviews/macros.html Macros Guide]] for more information. + * so choose wisely. See the [[http://docs.scala-lang.org/overviews/macros/overview.html Macros Guide]] for more information. * * @see `scala.reflect.macros.whitebox.Context` */ diff --git a/src/reflect/scala/reflect/macros/package.scala b/src/reflect/scala/reflect/macros/package.scala index cc7111d794..b63d419d61 100644 --- a/src/reflect/scala/reflect/macros/package.scala +++ b/src/reflect/scala/reflect/macros/package.scala @@ -10,14 +10,14 @@ package reflect * Within these functions the programmer has access to compiler APIs. * For example, it is possible to generate, analyze and typecheck code. * - * See the [[http://docs.scala-lang.org/overviews/macros.html Macros Guide]] on how to get started with Scala macros. + * See the [[http://docs.scala-lang.org/overviews/macros/overview.html Macros Guide]] on how to get started with Scala macros. */ package object macros { /** The Scala macros context. * * In Scala 2.11, macros that were once the one are split into blackbox and whitebox macros, * with the former being better supported and the latter being more powerful. You can read about - * the details of the split and the associated trade-offs in the [[http://docs.scala-lang.org/overviews/macros.html Macros Guide]]. + * the details of the split and the associated trade-offs in the [[http://docs.scala-lang.org/overviews/macros/overview.html Macros Guide]]. * * `scala.reflect.macros.Context` follows this tendency and turns into `scala.reflect.macros.blackbox.Context` * and `scala.reflect.macros.whitebox.Context`. The original `Context` is left in place for compatibility reasons, diff --git a/src/reflect/scala/reflect/macros/whitebox/Context.scala b/src/reflect/scala/reflect/macros/whitebox/Context.scala index bd48df46cc..272991cba9 100644 --- a/src/reflect/scala/reflect/macros/whitebox/Context.scala +++ b/src/reflect/scala/reflect/macros/whitebox/Context.scala @@ -29,7 +29,7 @@ package whitebox * gaining the ability to refine the type of its expansion beyond its official return type, which enables a number of important use cases. * Blackbox macros, i.e. the ones defined with `blackbox.Context`, can't do that, so they are less powerful. * However blackbox macros are also going to enjoy better support than whitebox macros, so choose wisely. - * See the [[http://docs.scala-lang.org/overviews/macros.html Macros Guide]] for more information. + * See the [[http://docs.scala-lang.org/overviews/macros/overview.html Macros Guide]] for more information. * * @see `scala.reflect.macros.blackbox.Context` */ -- cgit v1.2.3 From 5482294bd8bf743766f114188cfab209ff6274cf Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Wed, 9 Sep 2015 21:05:08 +0100 Subject: Improve drifted URLs - Any.scala: Link to the guide instead of the SIP. - AnyVal.scala: Remove SIP link and align guide link to Any.scala. - Commands.scala: Use a less out of date team link. - Logic.scala: Link was broken. Substitute found. - Process.scala: Links were 403 & 404. Fixed as this is a code sample. - TypeMaps.scala: Move old EPFL Trac to JIRA. - RedBlackTree.scala: Replaced broken link with substitutes based on site maintainer input [1]. [1] When asked where Data-Set-RBTree.html had gone Don@UNSW advised "I think it's on the Haskell wiki now. It was Chris Okazaki's version". The closest I could find to what this document probably was is this paper by Hinze edited by Okasaki, http://www.cs.ox.ac.uk/ralf.hinze/publications/WAAAPL99b.ps.gz The paper cites the Okasaki document so I included a link to that as well. The Haskell Wiki does have a link to a RB document but that's broken too, https://wiki.haskell.org/Research_papers/Data_structures > Constructing red-black trees --- src/compiler/scala/tools/nsc/transform/patmat/Logic.scala | 2 +- src/library-aux/scala/Any.scala | 2 +- src/library/scala/AnyVal.scala | 4 +--- src/library/scala/collection/immutable/RedBlackTree.scala | 3 ++- src/library/scala/sys/process/Process.scala | 4 ++-- src/manual/scala/man1/Command.scala | 2 +- src/reflect/scala/reflect/internal/tpe/TypeMaps.scala | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala index 49a4990722..62d9c497ba 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala @@ -38,7 +38,7 @@ trait Logic extends Debugging { padded.transpose.map(alignedColumns).transpose map (_.mkString(sep)) mkString(lineSep) } - // http://www.cis.upenn.edu/~cis510/tcl/chap3.pdf + // ftp://ftp.cis.upenn.edu/pub/cis511/public_html/Spring04/chap3.pdf // http://users.encs.concordia.ca/~ta_ahmed/ms_thesis.pdf // propositional logic with constants and equality trait PropositionalLogic { diff --git a/src/library-aux/scala/Any.scala b/src/library-aux/scala/Any.scala index 8caf0c5c0e..e6ed46740e 100644 --- a/src/library-aux/scala/Any.scala +++ b/src/library-aux/scala/Any.scala @@ -27,7 +27,7 @@ package scala * w.print() * }}} * - * See the [[http://docs.scala-lang.org/sips/completed/value-classes.html value classes guide]] for more + * See the [[http://docs.scala-lang.org/overviews/core/value-classes.html Value Classes and Universal Traits]] for more * details on the interplay of universal traits and value classes. */ abstract class Any { diff --git a/src/library/scala/AnyVal.scala b/src/library/scala/AnyVal.scala index fb3d213e19..e861860196 100644 --- a/src/library/scala/AnyVal.scala +++ b/src/library/scala/AnyVal.scala @@ -48,9 +48,7 @@ package scala * * It's important to note that user-defined value classes are limited, and in some circumstances, * still must allocate a value class instance at runtime. These limitations and circumstances are - * explained in greater detail in the [[http://docs.scala-lang.org/overviews/core/value-classes.html Value Classes Guide]] - * as well as in [[http://docs.scala-lang.org/sips/completed/value-classes.html SIP-15: Value Classes]], - * the Scala Improvement Proposal. + * explained in greater detail in the [[http://docs.scala-lang.org/overviews/core/value-classes.html Value Classes and Universal Traits]]. */ abstract class AnyVal extends Any { def getClass(): Class[_ <: AnyVal] = null diff --git a/src/library/scala/collection/immutable/RedBlackTree.scala b/src/library/scala/collection/immutable/RedBlackTree.scala index 0dad106b29..7e8cfcc902 100644 --- a/src/library/scala/collection/immutable/RedBlackTree.scala +++ b/src/library/scala/collection/immutable/RedBlackTree.scala @@ -168,7 +168,8 @@ object RedBlackTree { } /* Based on Stefan Kahrs' Haskell version of Okasaki's Red&Black Trees - * http://www.cse.unsw.edu.au/~dons/data/RedBlackTree.html */ + * Constructing Red-Black Trees, Ralf Hinze: http://www.cs.ox.ac.uk/ralf.hinze/publications/WAAAPL99b.ps.gz + * Red-Black Trees in a Functional Setting, Chris Okasaki: https://wiki.rice.edu/confluence/download/attachments/2761212/Okasaki-Red-Black.pdf */ private[this] def del[A, B](tree: Tree[A, B], k: A)(implicit ordering: Ordering[A]): Tree[A, B] = if (tree eq null) null else { def balance(x: A, xv: B, tl: Tree[A, B], tr: Tree[A, B]) = if (isRedTree(tl)) { if (isRedTree(tr)) { diff --git a/src/library/scala/sys/process/Process.scala b/src/library/scala/sys/process/Process.scala index dcd06c89e9..c40838bb06 100644 --- a/src/library/scala/sys/process/Process.scala +++ b/src/library/scala/sys/process/Process.scala @@ -155,8 +155,8 @@ trait ProcessCreation { * import java.net.URL * import java.io.File * - * val spde = new URL("http://technically.us/spde/About") - * val dispatch = new URL("http://databinder.net/dispatch/About") + * val spde = new URL("http://technically.us/spde.html") + * val dispatch = new URL("http://dispatch.databinder.net/Dispatch.html") * val build = new File("project/build.properties") * cat(spde, dispatch, build) #| "grep -i scala" ! * }}} diff --git a/src/manual/scala/man1/Command.scala b/src/manual/scala/man1/Command.scala index 8f811f950e..13e21757c0 100644 --- a/src/manual/scala/man1/Command.scala +++ b/src/manual/scala/man1/Command.scala @@ -42,7 +42,7 @@ trait Command { def authors = Section("AUTHOR", "Written by Martin Odersky and other members of the " & - Link("Scala team", "http://www.scala-lang.org/node/89") & ".") + Link("Scala team", "http://www.scala-lang.org/news/2014/01/22/10-years-of-scala.html") & ".") def copyright = Section("COPYRIGHT", diff --git a/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala b/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala index 817c9706b4..b8d4050d7d 100644 --- a/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala +++ b/src/reflect/scala/reflect/internal/tpe/TypeMaps.scala @@ -343,7 +343,7 @@ private[internal] trait TypeMaps { object rawToExistentialInJava extends TypeMap { def apply(tp: Type): Type = tp match { // any symbol that occurs in a java sig, not just java symbols - // see http://lampsvn.epfl.ch/trac/scala/ticket/2454#comment:14 + // see https://issues.scala-lang.org/browse/SI-2454?focusedCommentId=46618 case TypeRef(pre, sym, List()) if !sym.typeParams.isEmpty => val eparams = typeParamsToExistentials(sym, sym.typeParams) existentialAbstraction(eparams, TypeRef(pre, sym, eparams map (_.tpe))) -- cgit v1.2.3 From 340e44e9e6f954de127ee73a2ff3683e3b4b02e0 Mon Sep 17 00:00:00 2001 From: Janek Bogucki Date: Fri, 11 Sep 2015 22:03:14 +0100 Subject: Restore missing element type to List class documentation See line 18, git show cb1c0c src/library/scala/collection/immutable/List.scala|head -20|cat -n This shows the type reference prior to removal. --- src/library/scala/collection/immutable/List.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index 82e38d3549..53146bd66d 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -16,7 +16,7 @@ import scala.annotation.tailrec import java.io._ /** A class for immutable linked lists representing ordered collections - * of elements of type. + * of elements of type `A`. * * This class comes with two implementing case classes `scala.Nil` * and `scala.::` that implement the abstract members `isEmpty`, -- cgit v1.2.3 From bdba16f5de91c4a8ac345c345a674f4ba56b542b Mon Sep 17 00:00:00 2001 From: Gerard Basler Date: Sat, 12 Sep 2015 19:38:22 +0200 Subject: SI-9369 Fix pattern matcher warnings for diamond shaped inheritance. A previous optimization (d44a86f432a7f9ca250b014acdeab02ac9f2c304) for pattern matcher exhaustivity checks used a smarter encoding to ensure that the scrutinee can be equal to one child only. However, in case of traits between the root and leave type, a child can be of several types and these types should not be in a mutually exclusive group. A simple solution (hat tip to retronym) is to just put traits and classes into separate groups. --- .../tools/nsc/transform/patmat/MatchAnalysis.scala | 6 +++++- test/files/pos/t9369.flags | 1 + test/files/pos/t9369.scala | 24 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/files/pos/t9369.flags create mode 100644 test/files/pos/t9369.scala (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala index a11906ace1..1331eb6993 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala @@ -150,7 +150,11 @@ trait TreeAndTypeAnalysis extends Debugging { acc: List[List[Type]]): List[List[Type]] = wl match { case hd :: tl => val children = enumerateChildren(hd) - groupChildren(tl ++ children, acc :+ filterChildren(children)) + // put each trait in a new group, since traits could belong to the same + // group as a derived class + val (traits, nonTraits) = children.partition(_.isTrait) + val filtered = (traits.map(List(_)) ++ List(nonTraits)).map(filterChildren) + groupChildren(tl ++ children, acc ++ filtered) case Nil => acc } diff --git a/test/files/pos/t9369.flags b/test/files/pos/t9369.flags new file mode 100644 index 0000000000..b5a8748652 --- /dev/null +++ b/test/files/pos/t9369.flags @@ -0,0 +1 @@ +-Xfatal-warnings -unchecked diff --git a/test/files/pos/t9369.scala b/test/files/pos/t9369.scala new file mode 100644 index 0000000000..94be2ea4e7 --- /dev/null +++ b/test/files/pos/t9369.scala @@ -0,0 +1,24 @@ +object Test { + + trait Tree + + sealed abstract class Prop + + trait Simple extends Prop + + case class Atom(tree: Tree) extends Prop with Simple + + case class Not(prop: Prop) extends Prop with Simple + + def simplify1(prop: Prop): Prop = prop match { + case Atom(tree) => ??? + case Not(prop) => ??? + case _ => ??? + } + + def simplify2(prop: Prop): Prop = prop match { + case Not(Atom(tree)) => ??? + case Not(Not(prop)) => ??? + case _ => ??? + } +} \ No newline at end of file -- cgit v1.2.3 From fe45005fe9e4fa9db8e76dd5ba0c660028ec0509 Mon Sep 17 00:00:00 2001 From: Vlad Ureche Date: Thu, 17 Sep 2015 06:30:56 +0200 Subject: SI-9475 Dependent PolyTypes are dependent types Such that uncurry can correctly un-dependify them. --- src/reflect/scala/reflect/internal/Types.scala | 3 +++ test/files/pos/t9475.scala | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/files/pos/t9475.scala (limited to 'src') diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index adc2362e88..9697e16da7 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -2510,6 +2510,9 @@ trait Types override def baseType(clazz: Symbol): Type = resultType.baseType(clazz) override def narrow: Type = resultType.narrow + // SI-9475: PolyTypes with dependent method types are still dependent + override def isDependentMethodType = resultType.isDependentMethodType + /** @M: typeDefSig wraps a TypeBounds in a PolyType * to represent a higher-kinded type parameter * wrap lo&hi in polytypes to bind variables diff --git a/test/files/pos/t9475.scala b/test/files/pos/t9475.scala new file mode 100644 index 0000000000..ce9c250ace --- /dev/null +++ b/test/files/pos/t9475.scala @@ -0,0 +1,19 @@ +trait Ctx { + trait Tree +} + +trait Lst[+A] { + def zip[A1 >: A, B](that: Lst[B]): Nothing +} + +object Test { + + // both of these methods should be transformed by uncurry + // such that List[c.Tree] becomes List[Ctx#Tree]: + def foo1(c: Ctx)(l: Lst[c.Tree]) = l zip l + def foo2[@specialized T](c: Ctx)(l: Lst[c.Tree], t: T) = l zip l + + // if this doesn't happen for the 2nd method, the specialization + // transformation fails +} + -- cgit v1.2.3 From 9bfd9f6910b50690e27bdad04cf13143ffef101e Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 18 Sep 2015 20:35:17 -0400 Subject: use latest partest (1.0.9) the new version should be no different, from this repo's perspective, since the changes made between 1.0.7 and 1.0.9 had only to do with build and packaging. nonetheless, we should be using the latest latest to help guard against regressions. (my other motive is that I'm contemplating fixing a partest issue that would result in a 1.0.10 release, so I'd like to have the upgrade to 1.0.9 in place first, so if anything goes wrong there is less searching to do for the cause) --- src/eclipse/partest/.classpath | 2 +- versions.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/eclipse/partest/.classpath b/src/eclipse/partest/.classpath index 50757ad2ba..65848ea439 100644 --- a/src/eclipse/partest/.classpath +++ b/src/eclipse/partest/.classpath @@ -5,7 +5,7 @@ - + diff --git a/versions.properties b/versions.properties index a2f74bbd08..2253921940 100644 --- a/versions.properties +++ b/versions.properties @@ -36,7 +36,7 @@ jline.version=2.12.1 scala-asm.version=5.0.4-scala-3 # external modules, used internally (not shipped) -partest.version.number=1.0.7 +partest.version.number=1.0.9 scalacheck.version.number=1.11.6 # TODO: modularize the compiler -- cgit v1.2.3