diff options
1168 files changed, 4645 insertions, 4820 deletions
diff --git a/build.number.maven b/build.number.maven deleted file mode 100644 index a8da54397d..0000000000 --- a/build.number.maven +++ /dev/null @@ -1,3 +0,0 @@ -version.major=2 -version.minor=11 -version.patch=0 @@ -211,6 +211,11 @@ TODO: <!-- Set up Ant contrib tasks so we can use <if><then><else> instead of the clunky `unless` attribute --> <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${lib-ant.dir}/ant-contrib.jar"/> + <property name="scala.ant.min.version" value="1.8.2"/> + <if><not><antversion atleast="${scala.ant.min.version}"/></not> + <then><fail message="Ant version ${scala.ant.min.version} is required. You are running ${ant.version}"/></then> + </if> + <!-- Add our maven ant tasks --> <path id="maven-ant-tasks.classpath" path="${lib-ant.dir}/maven-ant-tasks-2.1.1.jar" /> <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" /> @@ -1961,6 +1966,30 @@ TODO: </copy> </target> + <!-- + A jar-like task that creates an OSGi source bundle. It adds the required MANIFEST.MF headers that allow + Eclipse to match sources with the corresponding binaries. + --> + <macrodef name="osgi.source.bundle"> + <attribute name="destfile" description="The jar file name"/> + <attribute name="symbolicName" description="The original bundle symbolic name (without .source at the end)"/> + <attribute name="bundleName" description="A value for Bundle-Name, usually a textual description"/> + <element name="file-sets" description="A sequence of fileset elements to be included in the jar" optional="true" implicit="true"/> + + <sequential> + <jar whenmanifestonly="fail" destfile="@{destFile}"> + <file-sets/> + <manifest> + <attribute name="Manifest-Version" value="1.0"/> + <attribute name="Bundle-Name" value="@{bundleName}"/> + <attribute name="Bundle-SymbolicName" value="@{symbolicName}.source"/> + <attribute name="Bundle-Version" value="${osgi.version.number}"/> + <attribute name="Eclipse-SourceBundle" value="@{symbolicName};version="${osgi.version.number}";roots:="."" /> + </manifest> + </jar> + </sequential> + </macrodef> + <target name="dist.src" depends="dist.base"> <mkdir dir="${dist.dir}/src"/> <copy toDir="${dist.dir}/src"> @@ -1968,20 +1997,36 @@ TODO: <file file="${scala-parser-combinators-sources}"/> </copy> - <jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-library-src.jar"> + <osgi.source.bundle destfile="${dist.dir}/src/scala-library-src.jar" + symbolicName="org.scala-lang.scala-library" + bundleName="Scala Library Sources"> <fileset dir="${src.dir}/library"/> <fileset dir="${src.dir}/continuations/library"/> - </jar> - <jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-actors-src.jar" basedir="${src.dir}/actors"/> - <jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-compiler-src.jar"> + </osgi.source.bundle> + <osgi.source.bundle destfile="${dist.dir}/src/scala-actors-src.jar" + symbolicName="org.scala-lang.scala-actors" + bundleName="Scala Actors Sources"> + <fileset dir="${src.dir}/actors"/> + </osgi.source.bundle> + <osgi.source.bundle destfile="${dist.dir}/src/scala-compiler-src.jar" + symbolicName="org.scala-lang.scala-compiler" + bundleName="Scala Compiler Sources"> <fileset dir="${src.dir}/compiler"/> <fileset dir="${src.dir}/repl"/> <fileset dir="${src.dir}/scaladoc"/> <fileset dir="${src.dir}/interactive"/> <fileset dir="${src.dir}/continuations/plugin"/> - </jar> - <jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-swing-src.jar" basedir="${src.dir}/swing"/> - <jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-reflect-src.jar" basedir="${src.dir}/reflect"/> + </osgi.source.bundle> + <osgi.source.bundle destfile="${dist.dir}/src/scala-swing-src.jar" + symbolicName="org.scala-lang.scala-swing" + bundleName="Scala Swing Sources"> + <fileset dir="${src.dir}/swing"/> + </osgi.source.bundle> + <osgi.source.bundle destfile="${dist.dir}/src/scala-reflect-src.jar" + symbolicName="org.scala-lang.scala-reflect" + bundleName="Scala Reflect Sources"> + <fileset dir="${src.dir}/reflect"/> + </osgi.source.bundle> <jar whenmanifestonly="fail" destfile="${dist.dir}/src/scalap-src.jar" basedir="${src.dir}/scalap"/> </target> diff --git a/src/actors/scala/actors/AbstractActor.scala b/src/actors/scala/actors/AbstractActor.scala index 3c6299aab4..28fe689e91 100644 --- a/src/actors/scala/actors/AbstractActor.scala +++ b/src/actors/scala/actors/AbstractActor.scala @@ -27,5 +27,4 @@ trait AbstractActor extends OutputChannel[Any] with CanReply[Any, Any] { private[actors] def unlinkFrom(from: AbstractActor): Unit private[actors] def exit(from: AbstractActor, reason: AnyRef): Unit - } diff --git a/src/actors/scala/actors/KillActorControl.scala b/src/actors/scala/actors/KillActorControl.scala index 2f1f08e949..0f94bbc8dc 100644 --- a/src/actors/scala/actors/KillActorControl.scala +++ b/src/actors/scala/actors/KillActorControl.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala.actors import scala.util.control.ControlThrowable diff --git a/src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala b/src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala index 15ce60566a..37710ec037 100644 --- a/src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala +++ b/src/actors/scala/actors/scheduler/DrainableForkJoinPool.scala @@ -8,5 +8,4 @@ private class DrainableForkJoinPool(parallelism: Int, maxPoolSize: Int) extends override def drainTasksTo(c: Collection[ _ >: ForkJoinTask[_]]): Int = super.drainTasksTo(c) - } diff --git a/src/build/genprod.scala b/src/build/genprod.scala index cd01363cb6..ed436fe2e4 100644 --- a/src/build/genprod.scala +++ b/src/build/genprod.scala @@ -113,8 +113,8 @@ object FunctionZero extends Function(0) { object FunctionOne extends Function(1) { override def classAnnotation = "@annotation.implicitNotFound(msg = \"No implicit view available from ${T1} => ${R}.\")\n" - override def contravariantSpecs = "@specialized(scala.Int, scala.Long, scala.Float, scala.Double/*, scala.AnyRef*/) " - override def covariantSpecs = "@specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double/*, scala.AnyRef*/) " + override def contravariantSpecs = "@specialized(scala.Int, scala.Long, scala.Float, scala.Double) " + override def covariantSpecs = "@specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double) " override def descriptiveComment = " " + functionNTemplate.format("succ", "anonfun1", """ diff --git a/src/build/pack.xml b/src/build/pack.xml index 8e2d2f19fa..ed628726fb 100644 --- a/src/build/pack.xml +++ b/src/build/pack.xml @@ -12,7 +12,7 @@ PROPERTIES <!-- the maven stuff requires version.major, version.minor and version.patch properties. the "get-scala-revision" script only returns "version.number" --> - <property file="${basedir}/build.number.maven"/> + <property file="${basedir}/build.number"/> <!-- also need to know scala binary version and versions for xml and parsers --> <property file="${basedir}/versions.properties"/> diff --git a/src/compiler/scala/reflect/macros/util/Helpers.scala b/src/compiler/scala/reflect/macros/util/Helpers.scala index f12582a3a1..f40c6bb7e6 100644 --- a/src/compiler/scala/reflect/macros/util/Helpers.scala +++ b/src/compiler/scala/reflect/macros/util/Helpers.scala @@ -23,25 +23,27 @@ trait Helpers { * or to streamline creation of the list of macro arguments. */ def transformTypeTagEvidenceParams(macroImplRef: Tree, transform: (Symbol, Symbol) => Symbol): List[List[Symbol]] = { + val MacroContextUniverse = definitions.MacroContextUniverse val treeInfo.MacroImplReference(isBundle, _, macroImpl, _) = macroImplRef val paramss = macroImpl.paramss - if (paramss.isEmpty || paramss.last.isEmpty) return paramss // no implicit parameters in the signature => nothing to do - val rc = - if (isBundle) macroImpl.owner.tpe.member(nme.c) - else { - def cparam = paramss.head.head - if (paramss.head.isEmpty || !(cparam.tpe <:< MacroContextClass.tpe)) return paramss // no context parameter in the signature => nothing to do - cparam - } + val ContextParam = paramss match { + case Nil | _ :+ Nil => NoSymbol // no implicit parameters in the signature => nothing to do + case _ if isBundle => macroImpl.owner.tpe member nme.c + case (cparam :: _) :: _ if cparam.tpe <:< MacroContextClass.tpe => cparam + case _ => NoSymbol // no context parameter in the signature => nothing to do + } def transformTag(param: Symbol): Symbol = param.tpe.dealias match { - case TypeRef(SingleType(SingleType(_, ac), universe), WeakTypeTagClass, targ :: Nil) - if ac == rc && universe == MacroContextUniverse => - transform(param, targ.typeSymbol) - case _ => - param + case TypeRef(SingleType(SingleType(_, ContextParam), MacroContextUniverse), WeakTypeTagClass, targ :: Nil) => transform(param, targ.typeSymbol) + case _ => param + } + ContextParam match { + case NoSymbol => paramss + case _ => + paramss.last map transformTag filter (_.exists) match { + case Nil => paramss.init + case transformed => paramss.init :+ transformed + } } - val transformed = paramss.last map transformTag filter (_ ne NoSymbol) - if (transformed.isEmpty) paramss.init else paramss.init :+ transformed } /** Increases metalevel of the type, i.e. transforms: diff --git a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala index 2ce2fb3eaa..899aa93a3b 100644 --- a/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala +++ b/src/compiler/scala/tools/nsc/OfflineCompilerCommand.scala @@ -27,7 +27,7 @@ class OfflineCompilerCommand(arguments: List[String], settings: FscSettings) ext val baseDirectory = { val pwd = System.getenv("PWD") if (pwd == null || isWin) Directory.Current getOrElse Directory("/") - else Directory(pwd) + else Directory(pwd) } currentDir.value = baseDirectory.path } diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index f2e5c9b1eb..7cf2f8559b 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -18,8 +18,14 @@ trait DocComments { self: Global => val cookedDocComments = mutable.HashMap[Symbol, String]() - /** The raw doc comment map */ - val docComments = mutable.HashMap[Symbol, DocComment]() + /** The raw doc comment map + * + * In IDE, background compilation runs get interrupted by + * reloading new sourcefiles. This is weak to avoid + * memleaks due to the doc of their cached symbols + * (e.g. in baseTypeSeq) between periodic doc reloads. + */ + val docComments = mutable.WeakHashMap[Symbol, DocComment]() def clearDocComments() { cookedDocComments.clear() diff --git a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala index caab299635..9c8e13a1a9 100644 --- a/src/compiler/scala/tools/nsc/ast/NodePrinters.scala +++ b/src/compiler/scala/tools/nsc/ast/NodePrinters.scala @@ -282,7 +282,7 @@ abstract class NodePrinters { traverseList("[]", "type parameter")(tparams) vparamss match { case Nil => println("Nil") - case Nil :: Nil => println("List(Nil)") + case ListOfNil => println("List(Nil)") case ps :: Nil => printLine("", "1 parameter list") ps foreach traverse diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 07e24900e9..50aad8e043 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -303,6 +303,15 @@ self => def o2p(offset: Int): Position def r2p(start: Int, mid: Int, end: Int): Position + /** Creates a range position from the given start offset to + * the value of in.lastOffset. + */ + def rangeSince(start: Int): Position = r2p(start, start, in.lastOffset) + + /** Like in.skipToken, but returns a range position surrounding the skipped token. + */ + def skipTokenRange(): Position = rangeSince(in.skipToken()) + /** whether a non-continuable syntax error has been seen */ private var lastErrorOffset : Int = -1 @@ -568,8 +577,9 @@ self => and } - def expectedMsgTemplate(exp: String, fnd: String) = s"$exp expected but $fnd found." - def expectedMsg(token: Int): String = expectedMsgTemplate(token2string(token), token2string(in.token)) + def expectedMsgTemplate(expected: String, found: String): String = s"$expected expected but $found found." + def expectedMsg(expected: Int, found: Int): String = expectedMsgTemplate(token2string(expected), token2string(found)) + def expectedMsg(token: Int): String = expectedMsg(token, in.token) /** Consume one token of the specified type, or signal an error if it is not there. */ def accept(token: Int): Int = { @@ -587,6 +597,10 @@ self => if (in.token == token) in.nextToken() offset } + /** If the given token is available for consumption, consume it and return true. + * Otherwise, do nothing and return false. + */ + def acceptIfPresent(token: Int) = (in.token == token) && { accept(token) ; true } /** {{{ * semi = nl {nl} | `;` @@ -703,14 +717,24 @@ self => /* ---------- TREE CONSTRUCTION ------------------------------------------- */ - def atPos[T <: Tree](offset: Int)(t: T): T = atPos(r2p(offset, offset, in.lastOffset max offset))(t) - def atPos[T <: Tree](start: Int, point: Int)(t: T): T = atPos(r2p(start, point, in.lastOffset max start))(t) + def atPos[T <: Tree](start: Int)(t: T): T = atPos[T](start, start)(t) + def atPos[T <: Tree](start: Int, point: Int)(t: T): T = atPos[T](start, point, in.lastOffset max start)(t) def atPos[T <: Tree](start: Int, point: Int, end: Int)(t: T): T = atPos(r2p(start, point, end))(t) def atPos[T <: Tree](pos: Position)(t: T): T = global.atPos(pos)(t) def atInPos[T <: Tree](t: T): T = atPos(o2p(in.offset))(t) def setInPos[T <: Tree](t: T): T = t setPos o2p(in.offset) + /** Use with caution. */ + def peekahead(): Unit = { + in.prev copyFrom in + in.nextToken() + } + def pushback(): Unit = { + in.next copyFrom in + in copyFrom in.prev + } + /** Convert tree to formal parameter list. */ def convertToParams(tree: Tree): List[ValDef] = tree match { case Parens(ts) => ts map convertToParam @@ -749,10 +773,9 @@ self => if (!sepFirst) ts += part - while (in.token == separator) { - in.nextToken() + while (acceptIfPresent(separator)) ts += part - } + ts.toList } @inline final def commaSeparated[T](part: => T): List[T] = tokenSeparated(COMMA, sepFirst = false, part) @@ -829,10 +852,8 @@ self => private def tupleInfixType(start: Int) = { in.nextToken() - if (in.token == RPAREN) { - in.nextToken() + if (acceptIfPresent(RPAREN)) atPos(start, accept(ARROW)) { makeFunctionTypeTree(Nil, typ()) } - } else { val ts = functionTypes() accept(RPAREN) @@ -936,13 +957,8 @@ self => ) def compoundTypeRest(t: Tree): Tree = { - val ts = new ListBuffer[Tree] += t - while (in.token == WITH) { - in.nextToken() - ts += annotType() - } + val types = t :: tokenSeparated(WITH, sepFirst = true, annotType()) newLineOptWhenFollowedBy(LBRACE) - val types = ts.toList val braceOffset = in.offset val hasRefinement = in.token == LBRACE val refinements = if (hasRefinement) refinement() else Nil @@ -956,7 +972,7 @@ self => } // The second case includes an empty refinement - refinements is empty, but // it still gets a CompoundTypeTree. - ts.toList match { + types match { case tp :: Nil if !hasRefinement => tp // single type, no refinement, already positioned case tps => atPos(t.pos.startOrPoint)(CompoundTypeTree(Template(tps, emptyValDef, refinements))) } @@ -1024,19 +1040,19 @@ self => def path(thisOK: Boolean, typeOK: Boolean): Tree = { val start = in.offset var t: Tree = null - if (in.token == THIS) { - in.nextToken() + if (acceptIfPresent(THIS)) { t = atPos(start) { This(tpnme.EMPTY) } if (!thisOK || in.token == DOT) { t = selectors(t, typeOK, accept(DOT)) } - } else if (in.token == SUPER) { - in.nextToken() + } + else if (acceptIfPresent(SUPER)) { t = atPos(start) { Super(This(tpnme.EMPTY), mixinQualifierOpt()) } accept(DOT) t = selector(t) if (in.token == DOT) t = selectors(t, typeOK, in.skipToken()) - } else { + } + else { val tok = in.token val name = ident() t = atPos(start) { @@ -1045,18 +1061,18 @@ self => } if (in.token == DOT) { val dotOffset = in.skipToken() - if (in.token == THIS) { - in.nextToken() + if (acceptIfPresent(THIS)) { t = atPos(start) { This(name.toTypeName) } if (!thisOK || in.token == DOT) t = selectors(t, typeOK, accept(DOT)) - } else if (in.token == SUPER) { - in.nextToken() + } + else if (acceptIfPresent(SUPER)) { t = atPos(start) { Super(This(name.toTypeName), mixinQualifierOpt()) } accept(DOT) t = selector(t) if (in.token == DOT) t = selectors(t, typeOK, in.skipToken()) - } else { + } + else { t = selectors(t, typeOK, dotOffset) } } @@ -1065,10 +1081,8 @@ self => } def selectors(t: Tree, typeOK: Boolean, dotOffset: Int): Tree = - if (typeOK && in.token == TYPE) { - in.nextToken() + if (typeOK && acceptIfPresent(TYPE)) atPos(t.pos.startOrPoint, dotOffset) { SingletonTypeTree(t) } - } else { val t1 = selector(t) if (in.token == DOT) { selectors(t1, typeOK, in.skipToken()) } @@ -1165,10 +1179,10 @@ self => private def freshPlaceholder(): Tree = { val start = in.offset val pname = freshName("x$") - in.nextToken() + accept(USCORE) val id = atPos(start)(Ident(pname)) val param = atPos(id.pos.focus)(gen.mkSyntheticParam(pname.toTermName)) - placeholderParams = param :: placeholderParams + placeholderParams ::= param id } @@ -1211,7 +1225,7 @@ self => /* ------------- NEW LINES ------------------------------------------------- */ def newLineOpt() { - if (in.token == NEWLINE) in.nextToken() + acceptIfPresent(NEWLINE) } def newLinesOpt() { @@ -1235,9 +1249,7 @@ self => * TypedOpt ::= [`:' Type] * }}} */ - def typedOpt(): Tree = - if (in.token == COLON) { in.nextToken(); typ() } - else TypeTree() + def typedOpt(): Tree = if (acceptIfPresent(COLON)) typ() else TypeTree() def typeOrInfixType(location: Int): Tree = if (location == Local) typ() @@ -1261,16 +1273,9 @@ self => /* ----------- EXPRESSIONS ------------------------------------------------ */ - def condExpr(): Tree = { - if (in.token == LPAREN) { - in.nextToken() - val r = expr() - accept(RPAREN) - r - } else { - accept(LPAREN) - newLiteral(true) - } + def condExpr(): Tree = in.token match { + case LPAREN => inParens(expr()) + case _ => syntaxErrorOrIncompleteAnd("parenthesized conditional expression expected", skipIt = false)(newLiteral(true)) } /* hook for IDE, unlike expression can be stubbed @@ -1311,8 +1316,7 @@ self => val cond = condExpr() newLinesOpt() val thenp = expr() - val elsep = if (in.token == ELSE) { in.nextToken(); expr() } - else literalUnit + val elsep = if (acceptIfPresent(ELSE)) expr() else literalUnit If(cond, thenp, elsep) } parseIf @@ -1321,23 +1325,19 @@ self => val body = in.token match { case LBRACE => inBracesOrUnit(block()) case LPAREN => inParensOrUnit(expr()) - case _ => expr() + case _ => expr() } def catchFromExpr() = List(makeCatchFromExpr(expr())) - val catches: List[CaseDef] = - if (in.token != CATCH) Nil - else { - in.nextToken() + val catches: List[CaseDef] = ( + if (!acceptIfPresent(CATCH)) Nil else { if (in.token != LBRACE) catchFromExpr() else inBracesOrNil { if (isCaseDefStart) caseClauses() else catchFromExpr() } } - val finalizer = in.token match { - case FINALLY => in.nextToken(); expr() - case _ => EmptyTree - } + ) + val finalizer = if (acceptIfPresent(FINALLY)) expr() else EmptyTree Try(body, catches, finalizer) } parseTry @@ -1348,7 +1348,7 @@ self => val cond = condExpr() newLinesOpt() val body = expr() - makeWhile(start, cond, body) + makeWhile(cond, body) } } parseWhile @@ -1367,16 +1367,15 @@ self => case FOR => val start = in.skipToken() def parseFor = atPos(start) { - val enums = + val enums = ( if (in.token == LBRACE) inBracesOrNil(enumerators()) else inParensOrNil(enumerators()) + ) newLinesOpt() - if (in.token == YIELD) { - in.nextToken() + if (acceptIfPresent(YIELD)) makeForYield(enums, expr()) - } else { + else makeFor(enums, expr()) - } } def adjustStart(tree: Tree) = if (tree.pos.isRange && start < tree.pos.start) @@ -1403,7 +1402,7 @@ self => if (in.token == EQUALS) { t match { case Ident(_) | Select(_, _) | Apply(_, _) => - t = atPos(t.pos.startOrPoint, in.skipToken()) { makeAssign(t, expr()) } + t = atPos(t.pos.startOrPoint, in.skipToken()) { gen.mkAssign(t, expr()) } case _ => } } else if (in.token == COLON) { @@ -1467,9 +1466,8 @@ self => val param0 = convertToParam { atPos(in.offset) { Ident(ident()) match { - case expr if in.token == COLON => - in.nextToken() ; Typed(expr, typeOrInfixType(location)) - case expr => expr + case expr if acceptIfPresent(COLON) => Typed(expr, typeOrInfixType(location)) + case expr => expr } } } @@ -1545,32 +1543,28 @@ self => * }}} */ def simpleExpr(): Tree = { - var canApply = true - val t = - if (isLiteral) literal() - else in.token match { - case XMLSTART => - xmlLiteral() - case IDENTIFIER | BACKQUOTED_IDENT | THIS | SUPER => - path(thisOK = true, typeOK = false) - case USCORE => - freshPlaceholder() - case LPAREN => - atPos(in.offset)(makeParens(commaSeparated(expr()))) - case LBRACE => - canApply = false - blockExpr() - case NEW => - canApply = false - val nstart = in.skipToken() - val npos = r2p(nstart, nstart, in.lastOffset) - val tstart = in.offset - val (parents, self, stats) = template() - val cpos = r2p(tstart, tstart, in.lastOffset max tstart) - gen.mkNew(parents, self, stats, npos, cpos) - case _ => - syntaxErrorOrIncompleteAnd("illegal start of simple expression", skipIt = true)(errorTermTree) - } + val canApply = in.token match { + case LBRACE | NEW => false + case _ => true + } + def mkNew(): Tree = { + val npos = skipTokenRange() + val tstart = in.offset + val (parents, self, stats) = template() + val cpos = rangeSince(tstart) + + gen.mkNew(parents, self, stats, npos, cpos) + } + val t = in.token match { + case _ if isLiteral => literal() + case XMLSTART => xmlLiteral() + case IDENTIFIER | BACKQUOTED_IDENT | THIS | SUPER => path(thisOK = true, typeOK = false) + case USCORE => freshPlaceholder() + case LPAREN => atPos(in.offset)(makeParens(commaSeparated(expr()))) + case LBRACE => blockExpr() + case NEW => mkNew() + case _ => syntaxErrorOrIncompleteAnd("illegal start of simple expression", skipIt = true)(errorTermTree) + } simpleExprRest(t, canApply = canApply) } @@ -1677,9 +1671,9 @@ self => * Guard ::= if PostfixExpr * }}} */ - def guard(): Tree = - if (in.token == IF) { in.nextToken(); stripParens(postfixExpr()) } - else EmptyTree + def guard(): Tree = if (acceptIfPresent(IF)) guardExpr() else EmptyTree + + def guardExpr(): Tree = stripParens(postfixExpr()) /** {{{ * Enumerators ::= Generator {semi Enumerator} @@ -1704,27 +1698,26 @@ self => * }}} */ def generator(enums: ListBuffer[Enumerator], eqOK: Boolean) { - val start = in.offset - val hasVal = in.token == VAL - if (hasVal) - in.nextToken() + val start = in.offset + val hasVal = acceptIfPresent(VAL) + val pat = noSeq.pattern1() + val point = in.offset + val equalsBody = equalsExprOpt() + val hasEq = !equalsBody.isEmpty + + if (hasVal && !hasEq) + syntaxError(in.offset, "val in for comprehension must be followed by assignment") + else if (hasEq && !eqOK) + syntaxError(point, "for comprehension must start with generator: " + expectedMsg(expected = LARROW, found = EQUALS)) + else if (hasVal) + deprecationWarning(start, "val keyword in for comprehension is deprecated") + + val rhs = equalsBody orElse { accept(LARROW) ; expr() } - val pat = noSeq.pattern1() - val point = in.offset - val hasEq = in.token == EQUALS - - if (hasVal) { - if (hasEq) deprecationWarning(in.offset, "val keyword in for comprehension is deprecated") - else syntaxError(in.offset, "val in for comprehension must be followed by assignment") - } - - if (hasEq && eqOK) in.nextToken() - else accept(LARROW) - val rhs = expr() enums += makeGenerator(r2p(start, point, in.lastOffset max start), pat, hasEq, rhs) // why max above? IDE stress tests have shown that lastOffset could be less than start, // I guess this happens if instead if a for-expression we sit on a closing paren. - while (in.token == IF) enums += makeFilter(in.offset, guard()) + enums ++= tokenSeparated(IF, sepFirst = true, makeFilter(in.offset, guardExpr())) } def makeFilter(start: Int, tree: Tree) = Filter(r2p(start, tree.pos.point, tree.pos.endOrPoint), tree) @@ -1832,14 +1825,6 @@ self => var top = simplePattern(badPattern3) // after peekahead def acceptWildStar() = atPos(top.pos.startOrPoint, in.prev.offset)(Star(stripParens(top))) - def peekahead() = { - in.prev copyFrom in - in.nextToken() - } - def pushback() = { - in.next copyFrom in - in copyFrom in.prev - } // See SI-3189, SI-4832 for motivation. Cf SI-3480 for counter-motivation. // TODO: dredge out the remnants of regexp patterns. // /{/ peek for _*) or _*} (for xml escape) @@ -2013,16 +1998,15 @@ self => * }}} */ def accessQualifierOpt(mods: Modifiers): Modifiers = { - var result = mods - if (in.token == LBRACKET) { - in.nextToken() - if (mods.hasAccessBoundary) - syntaxError("duplicate private/protected qualifier", skipIt = false) - result = if (in.token == THIS) { in.nextToken(); mods | Flags.LOCAL } - else Modifiers(mods.flags, identForType()) - accept(RBRACKET) + def newModifiers(): Modifiers = ( + if (acceptIfPresent(THIS)) mods | Flags.LOCAL // private/protected[this] + else Modifiers(mods.flags, identForType()) // private/protected[foo] + ) + in.token match { + case LBRACKET if mods.hasAccessBoundary => syntaxError("duplicate private/protected qualifier", skipIt = false) ; mods + case LBRACKET => inBrackets(newModifiers()) + case _ => mods } - result } private val flagTokens: Map[Int, Long] = Map( @@ -2160,25 +2144,24 @@ self => } paramType() } - val default = - if (in.token == EQUALS) { - in.nextToken() + val default = ( + if (acceptIfPresent(EQUALS)) { mods |= Flags.DEFAULTPARAM expr() - } else EmptyTree + } + else EmptyTree + ) atPos(start, if (name == nme.ERROR) start else nameOffset) { ValDef((mods | implicitmod.toLong | bynamemod) withAnnotations annots, name.toTermName, tpt, default) } } - def paramClause(): List[ValDef] = { - if (in.token == RPAREN) - return Nil + def paramClause(): List[ValDef] = in.token match { + case RPAREN => Nil + case _ => + if (acceptIfPresent(IMPLICIT)) + implicitmod = Flags.IMPLICIT - if (in.token == IMPLICIT) { - in.nextToken() - implicitmod = Flags.IMPLICIT - } - commaSeparated(param()) + commaSeparated(param()) } val vds = new ListBuffer[List[ValDef]] val start = in.offset @@ -2186,8 +2169,7 @@ self => if (ofCaseClass && in.token != LPAREN) syntaxError(in.lastOffset, "case classes without a parameter list are not allowed;\n"+ "use either case objects or case classes with an explicit `()' as a parameter list.") - while (implicitmod == 0 && in.token == LPAREN) { - in.nextToken() + while (implicitmod == 0 && acceptIfPresent(LPAREN)) { vds += paramClause() accept(RPAREN) caseParam = false @@ -2211,18 +2193,16 @@ self => def paramType(): Tree = paramType(useStartAsPosition = false) def paramType(useStartAsPosition: Boolean): Tree = { val start = in.offset - in.token match { - case ARROW => + if (acceptIfPresent(ARROW)) + atPos(start)(byNameApplication(typ())) + else { + val t = typ() + if (isRawStar) { in.nextToken() - atPos(start)(byNameApplication(typ())) - case _ => - val t = typ() - if (isRawStar) { - in.nextToken() - if (useStartAsPosition) atPos(start)(repeatedApplication(t)) - else atPos(t.pos.startOrPoint, t.pos.point)(repeatedApplication(t)) - } - else t + if (useStartAsPosition) atPos(start)(repeatedApplication(t)) + else atPos(t.pos.startOrPoint, t.pos.point)(repeatedApplication(t)) + } + else t } } @@ -2257,14 +2237,13 @@ self => } if (contextBoundBuf ne null) { while (in.token == VIEWBOUND) { - contextBoundBuf += atPos(in.skipToken()) { - makeFunctionTypeTree(List(Ident(pname)), typ()) - } + contextBoundBuf += atPos(in.skipToken())(makeFunctionTypeTree(List(Ident(pname)), typ())) } while (in.token == COLON) { - contextBoundBuf += atPos(in.skipToken()) { - AppliedTypeTree(typ(), List(Ident(pname))) - } + val start = in.skipToken() + val tycon = typ() + val applied = atPos(tycon.pos withStart start)(AppliedTypeTree(tycon, Ident(pname) :: Nil)) + contextBoundBuf += applied } } param @@ -2290,7 +2269,7 @@ self => t setPos o2p(in.offset) } - def bound(tok: Int): Tree = if (in.token == tok) { in.nextToken(); typ() } else EmptyTree + def bound(tok: Int): Tree = if (acceptIfPresent(tok)) typ() else EmptyTree /* -------- DEFS ------------------------------------------- */ @@ -2302,11 +2281,10 @@ self => def importClause(): List[Tree] = { val offset = accept(IMPORT) commaSeparated(importExpr()) match { - case Nil => Nil + case Nil => Nil case t :: rest => // The first import should start at the position of the keyword. - t.setPos(t.pos.withStart(offset)) - t :: rest + (t setPos (t.pos withStart offset)) :: rest } } @@ -2335,12 +2313,9 @@ self => case _ => val nameOffset = in.offset val name = ident() - if (in.token == DOT) { + if (acceptIfPresent(DOT)) // import foo.bar.ident.<unknown> and so create a select node and recurse. - val t = atPos(start, if (name == nme.ERROR) in.offset else nameOffset)(Select(expr, name)) - in.nextToken() - return loop(t) - } + return loop(atPos(start, if (name == nme.ERROR) in.offset else nameOffset)(Select(expr, name))) // import foo.bar.Baz; else List(makeImportSelector(name, nameOffset)) } @@ -2371,30 +2346,27 @@ self => selectors } - def wildcardOrIdent() = { - if (in.token == USCORE) { in.nextToken() ; nme.WILDCARD } - else ident() - } + def wildcardOrIdent() = if (acceptIfPresent(USCORE)) nme.WILDCARD else ident() /** {{{ * ImportSelector ::= Id [`=>' Id | `=>' `_'] * }}} */ def importSelector(): ImportSelector = { - val start = in.offset - val name = wildcardOrIdent() - var renameOffset = -1 - val rename = in.token match { - case ARROW => - in.nextToken() - renameOffset = in.offset - wildcardOrIdent() - case _ if name == nme.WILDCARD => null - case _ => - renameOffset = start - name - } - ImportSelector(name, start, rename, renameOffset) + val start = in.offset + val name = wildcardOrIdent() + + // The first case is overly cleverly using named arguments to reverse the + // positions of the last two parameters, because reading the rename will + // move the value of in.offset. Hey, I didn't invent side effects, I too am + // a victim here. I can't find a single place where the rename position + // is used anyway. + if (acceptIfPresent(ARROW)) + ImportSelector(name, start, renamePos = in.offset, rename = wildcardOrIdent()) + else if (name == nme.WILDCARD) + ImportSelector(name, start, null, -1) + else + ImportSelector(name, start, name, start) } /** {{{ @@ -2433,6 +2405,8 @@ self => defOrDcl(caseAwareTokenOffset, modifiers() withAnnotations annots) } + def equalsExprOpt(): Tree = if (acceptIfPresent(EQUALS)) expr() else EmptyTree + /** {{{ * PatDef ::= Pattern2 {`,' Pattern2} [`:' Type] `=' Expr * ValDcl ::= Id {`,' Id} `:' Type @@ -2440,45 +2414,55 @@ self => * }}} */ def patDefOrDcl(pos : Int, mods: Modifiers): List[Tree] = { - var newmods = mods in.nextToken() - val lhs = commaSeparated(stripParens(noSeq.pattern2())) - val tp = typedOpt() - val rhs = - if (tp.isEmpty || in.token == EQUALS) { - accept(EQUALS) - if (!tp.isEmpty && newmods.isMutable && - (lhs.toList forall (_.isInstanceOf[Ident])) && in.token == USCORE) { - in.nextToken() - newmods = newmods | Flags.DEFAULTINIT - EmptyTree - } else { - expr() - } - } else { - newmods = newmods | Flags.DEFERRED - EmptyTree - } - def mkDefs(p: Tree, tp: Tree, rhs: Tree): List[Tree] = { - //Console.println("DEBUG: p = "+p.toString()); // DEBUG - val trees = - makePatDef(newmods, - if (tp.isEmpty) p - else Typed(p, tp) setPos (p.pos union tp.pos), - rhs) - if (newmods.isDeferred) { - trees match { - case List(ValDef(_, _, _, EmptyTree)) => - if (mods.isLazy) syntaxError(p.pos, "lazy values may not be abstract", skipIt = false) - case _ => syntaxError(p.pos, "pattern definition may not be abstract", skipIt = false) - } + + val lhses = commaSeparated(stripParens(noSeq.pattern2())) + val lhs = lhses.last + val tpt = typedOpt() + val ascriptedLhs = if (tpt.isEmpty) lhs else atPos(lhs.pos union tpt.pos)(Typed(lhs, tpt)) + val hasEq = acceptIfPresent(EQUALS) + // SI-7854 an underscore following the equals doesn't necessarily mean default initialization. + val isDefaultInit = hasEq && in.token == USCORE && { + peekahead() + isStatSep || isStatSeqEnd || { pushback() ; false } + } + val rhs = if (hasEq && !isDefaultInit) expr() else EmptyTree + def allIdents = lhses forall (_.isInstanceOf[Ident]) + + def defaultInitFlag(): Long = { + if (!allIdents) + syntaxError(lhs.pos, "pattern definition is ineligible for default initialization", skipIt = false) + else if (!mods.isMutable) + syntaxError(lhs.pos, "only vars are eligible for default initialization", skipIt = false) + else if (tpt.isEmpty) + syntaxError(lhs.pos, "an explicit type is required for default initialization", skipIt = false) + + Flags.DEFAULTINIT + } + def deferredFlag(): Long = { + if (mods.isLazy) // e.g. lazy val foo: Int + syntaxError(lhs.pos, "lazy values may not be abstract", skipIt = false) + else if (!allIdents) // e.g. val Some(x) + syntaxError(lhs.pos, "pattern definition may not be abstract", skipIt = false) + + Flags.DEFERRED + } + val newmods = mods | ( + if (isDefaultInit) defaultInitFlag() + else if (rhs.isEmpty) deferredFlag() + else 0L + ) + + def makeValDefs(decl: Tree): List[Tree] = { + val newTpt = if (tpt.isEmpty) decl else Typed(decl, tpt.duplicate setPos tpt.pos.focus) setPos decl.pos.focus + makePatDef(newmods, newTpt, rhs.duplicate setPos rhs.pos.focus) match { + case tree :: Nil => (tree setPos decl.pos) :: Nil + case trees => trees map (_ setPos decl.pos.focus) } - trees } - val trees = (lhs.toList.init flatMap (mkDefs(_, tp.duplicate, rhs.duplicate))) ::: mkDefs(lhs.last, tp, rhs) - val hd = trees.head - hd setPos hd.pos.withStart(pos) - ensureNonOverlapping(hd, trees.tail) + + val trees = (lhses.init flatMap makeValDefs) ::: makePatDef(newmods, ascriptedLhs, rhs) + ensureNonOverlapping(trees.last, trees.init) trees } @@ -2523,7 +2507,8 @@ self => in.nextToken() if (in.token == THIS) { atPos(start, in.skipToken()) { - val vparamss = paramClauses(nme.CONSTRUCTOR, classContextBounds map (_.duplicate), ofCaseClass = false) + val cbounds = classContextBounds map (_.duplicate) + val vparamss = paramClauses(nme.CONSTRUCTOR, cbounds, ofCaseClass = false) newLineOptWhenFollowedBy(LBRACE) val rhs = in.token match { case LBRACE => atPos(in.offset) { constrBlock(vparamss) } @@ -2547,7 +2532,8 @@ self => // i.e. (B[T] or T => B) val contextBoundBuf = new ListBuffer[Tree] val tparams = typeParamClauseOpt(name, contextBoundBuf) - val vparamss = paramClauses(name, contextBoundBuf.toList, ofCaseClass = false) + val cbounds = contextBoundBuf.toList + val vparamss = paramClauses(name, cbounds, ofCaseClass = false) newLineOptWhenFollowedBy(LBRACE) var restype = fromWithinReturnType(typedOpt()) val rhs = @@ -2707,8 +2693,9 @@ self => val result = gen.mkClassDef(mods1, name, tparams, template) // Context bounds generate implicit parameters (part of the template) with types // from tparams: we need to ensure these don't overlap - if (!classContextBounds.isEmpty) + if (classContextBounds.nonEmpty) ensureNonOverlapping(template, tparams) + result } } @@ -2770,18 +2757,15 @@ self => * }}} */ def templateParents(): List[Tree] = { - val parents = new ListBuffer[Tree] - def readAppliedParent() = { + def readAppliedParent(): Tree = { val start = in.offset val parent = startAnnotType() - parents += (in.token match { + in.token match { case LPAREN => atPos(start)((parent /: multipleArgumentExprs())(Apply.apply)) case _ => parent - }) + } } - readAppliedParent() - while (in.token == WITH) { in.nextToken(); readAppliedParent() } - parents.toList + tokenSeparated(WITH, sepFirst = false, readAppliedParent()) } /** {{{ @@ -2815,9 +2799,9 @@ self => def ensureEarlyDef(tree: Tree): Tree = tree match { case vdef @ ValDef(mods, _, _, _) if !mods.isDeferred => copyValDef(vdef)(mods = mods | Flags.PRESUPER) - case tdef @ TypeDef(mods, name, tparams, rhs) => + case tdef @ TypeDef(mods, _, _, _) => deprecationWarning(tdef.pos.point, "early type members are deprecated. Move them to the regular body: the semantics are the same.") - treeCopy.TypeDef(tdef, mods | Flags.PRESUPER, name, tparams, rhs) + copyTypeDef(tdef)(mods = mods | Flags.PRESUPER) case docdef @ DocDef(comm, rhs) => treeCopy.DocDef(docdef, comm, rhs) case stat if !stat.isEmpty => @@ -2852,7 +2836,6 @@ self => ) val parentPos = o2p(in.offset) val tstart1 = if (body.isEmpty && in.lastOffset < tstart) in.lastOffset else tstart - atPos(tstart1) { // Exclude only the 9 primitives plus AnyVal. if (inScalaRootPackage && ScalaValueClassNames.contains(name)) @@ -3103,10 +3086,9 @@ self => def compilationUnit(): PackageDef = checkNoEscapingPlaceholders { def topstats(): List[Tree] = { val ts = new ListBuffer[Tree] - while (in.token == SEMI) in.nextToken() + while (acceptIfPresent(SEMI)) () val start = in.offset - if (in.token == PACKAGE) { - in.nextToken() + if (acceptIfPresent(PACKAGE)) { if (in.token == OBJECT) { // TODO - this next line is supposed to be // ts += packageObjectDef(start) diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala index 6957f85689..5ef40923b4 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala @@ -52,6 +52,15 @@ trait Scanners extends ScannersCommon { type Offset = Int trait TokenData extends CommonTokenData { + override def toString = s""" + |TokenData( + | token $token ${token2string(token)} + | offset $offset + | last $lastOffset + | name $name + | strVal $strVal + | base $base + |)""".stripMargin.trim /** the next token */ var token: Int = EMPTY diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index 91ff530e05..fba74330a6 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -191,14 +191,6 @@ abstract class TreeBuilder { } } - /** Create a tree representing an assignment <lhs = rhs> */ - def makeAssign(lhs: Tree, rhs: Tree): Tree = lhs match { - case Apply(fn, args) => - Apply(atPos(fn.pos) { Select(fn, nme.update) }, args ::: List(rhs)) - case _ => - Assign(lhs, rhs) - } - /** Tree for `od op`, start is start0 if od.pos is borked. */ def makePostfixSelect(start0: Int, end: Int, od: Tree, op: Name): Tree = { val start = if (od.pos.isDefined) od.pos.startOrPoint else start0 @@ -206,22 +198,21 @@ abstract class TreeBuilder { } /** Create tree representing a while loop */ - def makeWhile(startPos: Int, cond: Tree, body: Tree): Tree = { - val lname = freshTermName(nme.WHILE_PREFIX) - def default = wrappingPos(List(cond, body)) match { - case p if p.isDefined => p.endOrPoint - case _ => startPos - } - val continu = atPos(o2p(body.pos pointOrElse default)) { Apply(Ident(lname), Nil) } - val rhs = If(cond, Block(List(body), continu), Literal(Constant(()))) - LabelDef(lname, Nil, rhs) + def makeWhile(cond: Tree, body: Tree): Tree = { + val lname = freshTermName(nme.WHILE_PREFIX) + val continu = atPos(cond.pos.focus)(Apply(Ident(lname), Nil)) + val rhs = atPos(cond.pos union body.pos)(If(cond, atPos(body.pos)(Block(body :: Nil, continu)), Literal(Constant(())))) + + atPos(rhs.pos)(LabelDef(lname, Nil, rhs)) } /** Create tree representing a do-while loop */ def makeDoWhile(lname: TermName, body: Tree, cond: Tree): Tree = { - val continu = Apply(Ident(lname), Nil) - val rhs = Block(List(body), If(cond, continu, Literal(Constant(())))) - LabelDef(lname, Nil, rhs) + val continu = atPos(cond.pos.focus)(Apply(Ident(lname), Nil)) + val condition = atPos(cond.pos)(If(cond, continu, Literal(Constant(())))) + val rhs = atPos(cond.pos union body.pos)(Block(body :: Nil, condition)) + + atPos(rhs.pos)(LabelDef(lname, Nil, rhs)) } /** Create block of statements `stats` */ @@ -313,19 +304,13 @@ abstract class TreeBuilder { * The closure is assigned a transparent position with the point at pos.point and * the limits given by pat and body. */ - def makeClosure(pos: Position, pat: Tree, body: Tree): Tree = { - def splitpos = wrappingPos(List(pat, body)).withPoint(pos.point).makeTransparent - matchVarPattern(pat) match { - case Some((name, tpt)) => - Function( - List(atPos(pat.pos) { ValDef(Modifiers(PARAM), name.toTermName, tpt, EmptyTree) }), - body) setPos splitpos - case None => - atPos(splitpos) { - makeVisitor(List(CaseDef(pat, EmptyTree, body)), checkExhaustive = false) - } + def makeClosure(pos: Position, pat: Tree, body: Tree): Tree = + atPos((pos union pat.pos union body.pos).makeTransparent) { + matchVarPattern(pat) match { + case Some((name, tpt)) => Function(atPos(pat.pos)(ValDef(Modifiers(PARAM), name.toTermName, tpt, EmptyTree)) :: Nil, body) + case None => makeVisitor(CaseDef(pat, body) :: Nil, checkExhaustive = false) + } } - } /* Make an application qual.meth(pat => body) positioned at `pos`. */ @@ -503,7 +488,7 @@ abstract class TreeBuilder { tmp, TypeTree(), matchExpr) } var cnt = 0 - val restDefs = for ((vname, tpt, pos) <- vars) yield atPos(pos) { + val restDefs = for ((vname, tpt, pos) <- vars) yield atPos(pos.focus) { cnt += 1 ValDef(mods, vname.toTermName, tpt, Select(Ident(tmp), newTermName("_" + cnt))) } diff --git a/src/compiler/scala/tools/nsc/backend/icode/CheckerException.scala b/src/compiler/scala/tools/nsc/backend/icode/CheckerException.scala index 0856f2f09d..8bcdb6dbd2 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/CheckerException.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/CheckerException.scala @@ -3,10 +3,8 @@ * @author Martin Odersky */ - package scala.tools.nsc package backend package icode class CheckerException(s: String) extends Exception(s) - diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 843299398b..a80fee876e 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -1319,6 +1319,8 @@ abstract class GenICode extends SubComponent { /** Some useful equality helpers. */ def isNull(t: Tree) = cond(t) { case Literal(Constant(null)) => true } + def isLiteral(t: Tree) = cond(t) { case Literal(_) => true } + def isNonNullExpr(t: Tree) = isLiteral(t) || ((t.symbol ne null) && t.symbol.isModule) /* If l or r is constant null, returns the other ; otherwise null */ def ifOneIsNull(l: Tree, r: Tree) = if (isNull(l)) r else if (isNull(r)) l else null @@ -1514,6 +1516,23 @@ abstract class GenICode extends SubComponent { val branchesReachable = !ctx1.bb.ignore ctx1.bb emitOnly CZJUMP(thenCtx.bb, elseCtx.bb, EQ, ObjectReference) branchesReachable + } else if (isNonNullExpr(l)) { + // Avoid null check if L is statically non-null. + // + // "" == expr -> "".equals(expr) + // Nil == expr -> Nil.equals(expr) + // + // Common enough (through pattern matching) to treat this specially here rather than + // hoping that -Yconst-opt is enabled. The impossible branches for null checks lead + // to spurious "branch not covered" warnings in Jacoco code coverage. + var ctx1 = genLoad(l, ctx, ObjectReference) + val branchesReachable = !ctx1.bb.ignore + ctx1 = genLoad(r, ctx1, ObjectReference) + ctx1.bb emitOnly( + CALL_METHOD(Object_equals, Dynamic), + CZJUMP(thenCtx.bb, elseCtx.bb, NE, BOOL) + ) + branchesReachable } else { val eqEqTempLocal = getTempLocal var ctx1 = genLoad(l, ctx, ObjectReference) diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala index 2c8fda85f4..633e71a756 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala @@ -93,7 +93,7 @@ trait TypeKinds { self: ICodes => /** * this is directly assignable to other if no coercion or * casting is needed to convert this to other. It's a distinct - * relationship from <:< because on the JVM, BOOL, BYTE, CHAR, + * relationship from <:< because on the JVM, BOOL, BYTE, CHAR, * SHORT need no coercion to INT even though JVM arrays * are covariant, ARRAY[SHORT] is not a subtype of ARRAY[INT] */ @@ -101,7 +101,7 @@ trait TypeKinds { self: ICodes => case INT => this.isIntSizedType case _ => this <:< other } - + /** Is this type a category 2 type in JVM terms? (ie, is it LONG or DOUBLE?) */ def isWideType: Boolean = false diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala index 182209dfe6..eff7d3211e 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala @@ -866,11 +866,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters { // a plain class lacking companion module, for details see `isCandidateForForwarders`). // ----------------------------------------------------------------------------------------- - val ExcludedForwarderFlags = { - import symtab.Flags._ - // Should include DEFERRED but this breaks findMember. - ( CASE | SPECIALIZED | LIFTED | PROTECTED | STATIC | EXPANDEDNAME | BridgeAndPrivateFlags | MACRO ) - } + val ExcludedForwarderFlags = genASM.ExcludedForwarderFlags /* Adds a @remote annotation, actual use unknown. * diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala index 2c3bf26958..01c4ff5a52 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVMASM.scala @@ -18,10 +18,10 @@ trait GenJVMASM { import icodes._ import definitions._ - protected val ExcludedForwarderFlags = { + val ExcludedForwarderFlags = { import Flags._ // Should include DEFERRED but this breaks findMember. - ( CASE | SPECIALIZED | LIFTED | PROTECTED | STATIC | EXPANDEDNAME | BridgeAndPrivateFlags | MACRO ) + ( SPECIALIZED | LIFTED | PROTECTED | STATIC | EXPANDEDNAME | BridgeAndPrivateFlags | MACRO ) } protected def isJavaEntryPoint(icls: IClass) = { diff --git a/src/compiler/scala/tools/nsc/package.scala b/src/compiler/scala/tools/nsc/package.scala index 761fd79358..817a4a5c88 100644 --- a/src/compiler/scala/tools/nsc/package.scala +++ b/src/compiler/scala/tools/nsc/package.scala @@ -23,5 +23,6 @@ package object nsc { type MissingRequirementError = scala.reflect.internal.MissingRequirementError val MissingRequirementError = scala.reflect.internal.MissingRequirementError - val ListOfNil = List(Nil) + @deprecated("Use scala.reflect.internal.util.ListOfNil", "2.11.0") + lazy val ListOfNil = scala.reflect.internal.util.ListOfNil } diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala index fdb5c72c3d..52c6ddc6ee 100644 --- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala @@ -9,6 +9,7 @@ package reporters import java.io.{ BufferedReader, IOException, PrintWriter } import scala.reflect.internal.util._ +import StringOps._ /** * This class implements a Reporter that displays messages on a text @@ -40,7 +41,10 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr StringOps.countElementsAsString((severity).count, label(severity)) /** Prints the message. */ - def printMessage(msg: String) { writer.print(msg + "\n"); writer.flush() } + def printMessage(msg: String) { + writer print trimAllTrailingSpace(msg) + "\n" + writer.flush() + } /** Prints the message with the given position indication. */ def printMessage(posIn: Position, msg: String) { diff --git a/src/compiler/scala/tools/nsc/settings/FscSettings.scala b/src/compiler/scala/tools/nsc/settings/FscSettings.scala index 34c8e8df9a..8c2b510bfd 100644 --- a/src/compiler/scala/tools/nsc/settings/FscSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/FscSettings.scala @@ -44,7 +44,7 @@ class FscSettings(error: String => Unit) extends Settings(error) { // we need to ensure the files specified with relative locations are absolutized based on the currentDir (r, args map {a => absolutizePath(a)}) } - + /** * Take an individual path and if it's not absolute turns it into an absolute path based on currentDir. * If it's already absolute then it's left alone. diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index a2bf5bf9e5..b2e071579e 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -90,7 +90,7 @@ abstract class ExplicitOuter extends InfoTransform sym expandName clazz sym.referenced = clazz - sym setInfo MethodType(Nil, restpe.widen) + sym setInfo MethodType(Nil, restpe) } def newOuterField(clazz: Symbol) = { val accFlags = SYNTHETIC | ARTIFACT | PARAMACCESSOR | ( if (clazz.isEffectivelyFinal) PrivateLocal else PROTECTED ) @@ -276,18 +276,16 @@ abstract class ExplicitOuter extends InfoTransform else outerPath(outerSelect(base), from.outerClass, to) } - override def transform(tree: Tree): Tree = { + def sym = tree.symbol val savedOuterParam = outerParam try { tree match { case Template(_, _, _) => outerParam = NoSymbol - case DefDef(_, _, _, vparamss, _, _) => - if (tree.symbol.isClassConstructor && isInner(tree.symbol.owner)) { - outerParam = vparamss.head.head.symbol - assert(outerParam.name startsWith nme.OUTER, outerParam.name) - } + case DefDef(_, _, _, (param :: _) :: _, _, _) if sym.isClassConstructor && isInner(sym.owner) => + outerParam = param.symbol + assert(outerParam.name startsWith nme.OUTER, outerParam.name) case _ => } super.transform(tree) @@ -361,10 +359,9 @@ abstract class ExplicitOuter extends InfoTransform /** The definition tree of the outer accessor of current class */ def outerAccessorDef: Tree = localTyper typed { - outerAccessor(currentClass) match { - case acc if acc.isDeferred => DefDef(acc, EmptyTree) - case acc => DefDef(acc, Select(This(currentClass), outerField(currentClass))) - } + val acc = outerAccessor(currentClass) + val rhs = if (acc.isDeferred) EmptyTree else Select(This(currentClass), outerField(currentClass)) + DefDef(acc, rhs) } /** The definition tree of the outer accessor for class mixinClass. diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala index 45aa1106f0..f7b194a6ca 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala @@ -292,6 +292,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis { trait TreesAndTypesDomain extends PropositionalLogic with CheckableTreeAndTypeAnalysis { type Type = global.Type type Tree = global.Tree + import global.definitions.ConstantNull // resets hash consing -- only supposed to be called by TreeMakersToProps def prepareNewAnalysis(): Unit = { Var.resetUniques(); Const.resetUniques() } @@ -320,7 +321,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis { val staticTpCheckable: Type = checkableType(staticTp) private[this] var _mayBeNull = false - def registerNull(): Unit = { ensureCanModify(); if (NullTp <:< staticTpCheckable) _mayBeNull = true } + def registerNull(): Unit = { ensureCanModify(); if (ConstantNull <:< staticTpCheckable) _mayBeNull = true } def mayBeNull: Boolean = _mayBeNull // case None => domain is unknown, @@ -568,7 +569,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis { object TypeConst extends TypeConstExtractor { def apply(tp: Type) = { - if (tp =:= NullTp) NullConst + if (tp =:= ConstantNull) NullConst else if (tp.isInstanceOf[SingletonType]) ValueConst.fromType(tp) else Const.unique(tp, new TypeConst(tp)) } @@ -577,7 +578,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis { // corresponds to a type test that does not imply any value-equality (well, except for outer checks, which we don't model yet) sealed class TypeConst(val tp: Type) extends Const { - assert(!(tp =:= NullTp)) + assert(!(tp =:= ConstantNull)) /*private[this] val id: Int = */ Const.nextTypeId val wideTp = widenToClass(tp) @@ -598,7 +599,7 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis { } def apply(p: Tree) = { val tp = p.tpe.normalize - if (tp =:= NullTp) NullConst + if (tp =:= ConstantNull) NullConst else { val wideTp = widenToClass(tp) @@ -626,16 +627,14 @@ trait ScalaLogic extends Interface with Logic with TreeAndTypeAnalysis { } sealed class ValueConst(val tp: Type, val wideTp: Type, override val toString: String) extends Const { // debug.patmat("VC"+(tp, wideTp, toString)) - assert(!(tp =:= NullTp)) // TODO: assert(!tp.isStable) + assert(!(tp =:= ConstantNull)) // TODO: assert(!tp.isStable) /*private[this] val id: Int = */Const.nextValueId def isValue = true } - - lazy val NullTp = ConstantType(Constant(null)) case object NullConst extends Const { - def tp = NullTp - def wideTp = NullTp + def tp = ConstantNull + def wideTp = ConstantNull def isValue = true override def toString = "null" diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala index 8feb87210e..7eb899d9d7 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchAnalysis.scala @@ -50,7 +50,7 @@ trait TreeAndTypeAnalysis extends Debugging { case UnitClass => Some(List(UnitTpe)) case BooleanClass => - Some((List(ConstantType(Constant(true)), ConstantType(Constant(false))))) + Some(ConstantTrue :: ConstantFalse :: Nil) // TODO case _ if tp.isTupleType => // recurse into component types case modSym: ModuleClassSymbol => Some(List(tp)) @@ -271,9 +271,9 @@ trait MatchApproximation extends TreeAndTypeAnalysis with ScalaLogic with MatchT case SubstOnlyTreeMaker(_, _) => True case GuardTreeMaker(guard) => guard.tpe match { - case ConstantType(Constant(true)) => True - case ConstantType(Constant(false)) => False - case _ => handleUnknown(tm) + case ConstantTrue => True + case ConstantFalse => False + case _ => handleUnknown(tm) } case ExtractorTreeMaker(_, _, _) | ProductExtractorTreeMaker(_, _) | diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala index ba78438b66..8a04c67582 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala @@ -402,23 +402,15 @@ trait MatchOptimization extends MatchTreeMaking with MatchAnalysis { private def noGuards(cs: List[CaseDef]): Boolean = !cs.exists(isGuardedCase) // must do this before removing guards from cases and collapsing (SI-6011, SI-6048) - private def unreachableCase(cs: List[CaseDef]): Option[CaseDef] = { - var cases = cs - var unreachable: Option[CaseDef] = None - - while (cases.nonEmpty && unreachable.isEmpty) { - val currCase = cases.head - if (isDefault(currCase) && cases.tail.nonEmpty) // subsumed by the `else if` that follows, but faster - unreachable = Some(cases.tail.head) - else if (!isGuardedCase(currCase) || currCase.guard.tpe =:= ConstantType(Constant(true))) - unreachable = cases.tail.find(caseImplies(currCase)) - else if (currCase.guard.tpe =:= ConstantType(Constant(false))) - unreachable = Some(currCase) - - cases = cases.tail + private def unreachableCase(cases: List[CaseDef]): Option[CaseDef] = { + def loop(cases: List[CaseDef]): Option[CaseDef] = cases match { + case head :: next :: _ if isDefault(head) => Some(next) // subsumed by the next case, but faster + case head :: rest if !isGuardedCase(head) || head.guard.tpe =:= ConstantTrue => rest find caseImplies(head) orElse loop(rest) + case head :: _ if head.guard.tpe =:= ConstantFalse => Some(head) + case _ :: rest => loop(rest) + case _ => None } - - unreachable + loop(cases) } // empty list ==> failure diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala index cf26ec3398..317685682d 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTreeMaking.scala @@ -288,8 +288,8 @@ trait MatchTreeMaking extends MatchCodeGen with Debugging { def irrefutableExtractorType(tp: Type): Boolean = tp.resultType.dealias match { case TypeRef(_, SomeClass, _) => true // probably not useful since this type won't be inferred nor can it be written down (yet) - case ConstantType(Constant(true)) => true - case _ => false + case ConstantTrue => true + case _ => false } def unapply(xtm: ExtractorTreeMaker): Option[(Tree, Symbol)] = xtm match { diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Solving.scala b/src/compiler/scala/tools/nsc/transform/patmat/Solving.scala index 114bcba5df..6267585ea8 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/Solving.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/Solving.scala @@ -9,6 +9,7 @@ package scala.tools.nsc.transform.patmat import scala.collection.mutable import scala.reflect.internal.util.Statistics import scala.language.postfixOps +import scala.reflect.internal.util.Collections._ // naive CNF translation and simple DPLL solver trait Solving extends Logic { @@ -205,9 +206,8 @@ trait Solving extends Logic { // SI-7020 Linked- for deterministic counter examples. val pos = new mutable.LinkedHashSet[Sym]() val neg = new mutable.LinkedHashSet[Sym]() - f.foreach{_.foreach{ lit => - if (lit.pos) pos += lit.sym else neg += lit.sym - }} + mforeach(f)(lit => if (lit.pos) pos += lit.sym else neg += lit.sym) + // appearing in both positive and negative val impures: mutable.LinkedHashSet[Sym] = pos intersect neg // appearing only in either positive/negative positions diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 9ac0b0835a..347426d42a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1183,8 +1183,8 @@ trait Namers extends MethodSynthesis { // value parameters of the base class (whose defaults might be overridden) var baseParamss = (vparamss, overridden.tpe.paramss) match { // match empty and missing parameter list - case (Nil, List(Nil)) => Nil - case (List(Nil), Nil) => ListOfNil + case (Nil, ListOfNil) => Nil + case (ListOfNil, Nil) => ListOfNil case (_, paramss) => paramss } assert( diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala index 3a188c0044..e44c83aa56 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala @@ -171,8 +171,8 @@ abstract class TreeCheckers extends Analyzer { ) - def errorFn(msg: Any): Unit = Console.err println "[check: %s] %s".format(phase.prev, msg) - def errorFn(pos: Position, msg: Any): Unit = errorFn(posstr(pos) + ": " + msg) + def errorFn(pos: Position, msg: Any): Unit = currentUnit.warning(pos, "[check: %s] %s".format(phase.prev, msg)) + def errorFn(msg: Any): Unit = errorFn(NoPosition, msg) def informFn(msg: Any) { if (settings.verbose || settings.debug) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 3343ee2bcc..157c6ba4de 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -43,12 +43,17 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper final val shortenImports = false + // allows override of the behavior of the resetTyper method w.r.t comments + def resetDocComments() = { + clearDocComments() + } + def resetTyper() { //println("resetTyper called") resetContexts() resetImplicits() transformed.clear() - clearDocComments() + resetDocComments() } object UnTyper extends Traverser { @@ -2606,7 +2611,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper } val rhs = methodBodyTyper.virtualizedMatch(match_, mode, B1.tpe) - val defdef = newDefDef(methodSym, rhs)(vparamss = mapParamss(methodSym)(newParam)) + val defdef = newDefDef(methodSym, rhs)(vparamss = mapParamss(methodSym)(newParam), tpt = TypeTree(B1.tpe)) (defdef, matchResTp) } @@ -4873,7 +4878,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper // Unfortunately implicit not found strings looks for all the world like // missing interpolators. def isArgToImplicitNotFound = context.enclosingApply.tree match { - case Apply(fn, _) => fn.symbol.enclClass == ImplicitNotFoundClass + case Apply(fn, _) => fn.symbol != null && fn.symbol.enclClass == ImplicitNotFoundClass case _ => false } def warnAbout(s: String) = { diff --git a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala index b77a536caf..2d905d5436 100644 --- a/src/compiler/scala/tools/reflect/ToolBoxFactory.scala +++ b/src/compiler/scala/tools/reflect/ToolBoxFactory.scala @@ -297,7 +297,7 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => // reporter doesn't accumulate errors, but the front-end does def throwIfErrors() = { if (frontEnd.hasErrors) throw ToolBoxError( - "reflective compilation has failed: " + EOL + EOL + (frontEnd.infos map (_.msg) mkString EOL) + "reflective compilation has failed:" + EOL + EOL + (frontEnd.infos map (_.msg) mkString EOL) ) } } @@ -319,7 +319,7 @@ abstract class ToolBoxFactory[U <: JavaUniverse](val u: U) { factorySelf => val instance = new ToolBoxGlobal(command.settings, frontEndToReporter(frontEnd, command.settings)) if (frontEnd.hasErrors) { throw ToolBoxError( - "reflective compilation has failed: cannot initialize the compiler: " + EOL + EOL + + "reflective compilation has failed: cannot initialize the compiler:" + EOL + EOL + (frontEnd.infos map (_.msg) mkString EOL) ) } diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala b/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala index c2d8bcdcd6..0d1fb6be07 100644 --- a/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala +++ b/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala @@ -10,7 +10,7 @@ trait Reifiers { self: Quasiquotes => import global.build.{SyntacticClassDef, SyntacticTraitDef, SyntacticModuleDef, SyntacticDefDef, SyntacticValDef, SyntacticVarDef, SyntacticBlock, SyntacticApplied, SyntacticTypeApplied, - SyntacticFunction, SyntacticNew} + SyntacticFunction, SyntacticNew, SyntacticAssign} import global.treeInfo._ import global.definitions._ import Cardinality._ @@ -71,9 +71,9 @@ trait Reifiers { self: Quasiquotes => reifyBuildCall(nme.SyntacticValDef, mods, name, tpt, rhs) case SyntacticVarDef(mods, name, tpt, rhs) => reifyBuildCall(nme.SyntacticVarDef, mods, name, tpt, rhs) - case SyntacticApplied(fun, argss) if argss.length > 1 => - reifyBuildCall(nme.SyntacticApplied, fun, argss) - case SyntacticApplied(fun, argss @ (_ :+ (_ :+ Placeholder(_, _, DotDotDot)))) => + case SyntacticAssign(lhs, rhs) => + reifyBuildCall(nme.SyntacticAssign, lhs, rhs) + case SyntacticApplied(fun, argss) if argss.nonEmpty => reifyBuildCall(nme.SyntacticApplied, fun, argss) case SyntacticTypeApplied(fun, targs) if targs.nonEmpty => reifyBuildCall(nme.SyntacticTypeApplied, fun, targs) diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala index bc6df9eb25..736a1e68c4 100644 --- a/src/interactive/scala/tools/nsc/interactive/Global.scala +++ b/src/interactive/scala/tools/nsc/interactive/Global.scala @@ -18,6 +18,19 @@ import scala.tools.nsc.typechecker.Analyzer import symtab.Flags.{ACCESSOR, PARAMACCESSOR} import scala.annotation.{ elidable, tailrec } import scala.language.implicitConversions +import scala.tools.nsc.typechecker.Typers + +/** + * This trait allows the IDE to have an instance of the PC that + * does not clear the comments table at every new typer run (those + * being many and close between in this context). + */ + +trait CommentPreservingTypers extends Typers { + self: Analyzer => + + override def resetDocComments() = {} +} trait InteractiveScaladocAnalyzer extends InteractiveAnalyzer with ScaladocAnalyzer { val global : Global diff --git a/src/interactive/scala/tools/nsc/interactive/Response.scala b/src/interactive/scala/tools/nsc/interactive/Response.scala index f36f769ec9..3e84c83e55 100644 --- a/src/interactive/scala/tools/nsc/interactive/Response.scala +++ b/src/interactive/scala/tools/nsc/interactive/Response.scala @@ -55,7 +55,10 @@ class Response[T] { try { wait() } catch { - case exc: InterruptedException => raise(exc) + case exc: InterruptedException => { + Thread.currentThread().interrupt() + raise(exc) + } } } data.get @@ -73,7 +76,10 @@ class Response[T] { try { wait(timeout - (current - start)) } catch { - case exc: InterruptedException => raise(exc) + case exc: InterruptedException => { + Thread.currentThread().interrupt() + raise(exc) + } } current = System.currentTimeMillis } @@ -99,7 +105,3 @@ class Response[T] { cancelled = false } } - - - - diff --git a/src/library/scala/DelayedInit.scala b/src/library/scala/DelayedInit.scala index 12793e6aa1..cfbbf30793 100644 --- a/src/library/scala/DelayedInit.scala +++ b/src/library/scala/DelayedInit.scala @@ -8,7 +8,7 @@ package scala -/** Classes and objects (but note, not traits) inheriting the `DelayedInit` +/** Classes and objects (but note, not traits) inheriting the `DelayedInit` * marker trait will have their initialization code rewritten as follows: * `code` becomes `delayedInit(code)`. * @@ -32,7 +32,7 @@ package scala * val c = new C * } * }}} - * + * * Should result in the following being printed: * {{{ * dummy text, printed before initialization of C diff --git a/src/library/scala/Function0.scala b/src/library/scala/Function0.scala index 54cba021e0..e13aaad7bc 100644 --- a/src/library/scala/Function0.scala +++ b/src/library/scala/Function0.scala @@ -6,7 +6,7 @@ ** |/ ** \* */ // GENERATED CODE: DO NOT EDIT. -// genprod generated these sources at: Sun Mar 24 14:14:12 CET 2013 +// genprod generated these sources at: Sun Sep 15 20:42:00 CEST 2013 package scala diff --git a/src/library/scala/Function1.scala b/src/library/scala/Function1.scala index 2e3de54c5a..620dcc19aa 100644 --- a/src/library/scala/Function1.scala +++ b/src/library/scala/Function1.scala @@ -32,7 +32,7 @@ package scala */ @annotation.implicitNotFound(msg = "No implicit view available from ${T1} => ${R}.") -trait Function1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double/*, scala.AnyRef*/) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double/*, scala.AnyRef*/) +R] extends AnyRef { self => +trait Function1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double) +R] extends AnyRef { self => /** Apply the body of this function to the argument. * @return the result of function application. */ diff --git a/src/library/scala/Proxy.scala b/src/library/scala/Proxy.scala index 07fa6e2e8d..7c28e6ea28 100644 --- a/src/library/scala/Proxy.scala +++ b/src/library/scala/Proxy.scala @@ -28,7 +28,7 @@ trait Proxy extends Any { override def hashCode: Int = self.hashCode override def equals(that: Any): Boolean = that match { case null => false - case _ => + case _ => val x = that.asInstanceOf[AnyRef] (x eq this.asInstanceOf[AnyRef]) || (x eq self.asInstanceOf[AnyRef]) || (x equals self) } diff --git a/src/library/scala/annotation/migration.scala b/src/library/scala/annotation/migration.scala index adb6de6afd..65bee4c2cb 100644 --- a/src/library/scala/annotation/migration.scala +++ b/src/library/scala/annotation/migration.scala @@ -17,7 +17,7 @@ package scala.annotation * order between Scala 2.7 and 2.8. * * @param message A message describing the change, which is emitted - * by the compiler if the flag `-Xmigration` indicates a version + * by the compiler if the flag `-Xmigration` indicates a version * prior to the changedIn version. * * @param changedIn The version, in which the behaviour change was diff --git a/src/library/scala/collection/BitSetLike.scala b/src/library/scala/collection/BitSetLike.scala index 6592e49429..8a8af79151 100644 --- a/src/library/scala/collection/BitSetLike.scala +++ b/src/library/scala/collection/BitSetLike.scala @@ -102,7 +102,7 @@ trait BitSetLike[+This <: BitSetLike[This] with SortedSet[Int]] extends SortedSe } def iterator: Iterator[Int] = iteratorFrom(0) - + override def keysIteratorFrom(start: Int) = new AbstractIterator[Int] { private var current = start private val end = nwords * WordLength diff --git a/src/library/scala/collection/GenMap.scala b/src/library/scala/collection/GenMap.scala index 3d7427981d..d17a2de179 100644 --- a/src/library/scala/collection/GenMap.scala +++ b/src/library/scala/collection/GenMap.scala @@ -11,7 +11,6 @@ package collection import generic._ - /** A trait for all traversable collections which may possibly * have their operations implemented in parallel. * @@ -28,12 +27,9 @@ extends GenMapLike[A, B, GenMap[A, B]] def updated [B1 >: B](key: A, value: B1): GenMap[A, B1] } - object GenMap extends GenMapFactory[GenMap] { def empty[A, B]: immutable.Map[A, B] = immutable.Map.empty /** $mapCanBuildFromInfo */ implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), GenMap[A, B]] = new MapCanBuildFrom[A, B] } - - diff --git a/src/library/scala/collection/GenTraversable.scala b/src/library/scala/collection/GenTraversable.scala index b700f49cf6..8705965992 100644 --- a/src/library/scala/collection/GenTraversable.scala +++ b/src/library/scala/collection/GenTraversable.scala @@ -6,15 +6,11 @@ ** |/ ** \* */ - - package scala package collection - import generic._ - /** A trait for all traversable collections which may possibly * have their operations implemented in parallel. * @@ -31,10 +27,7 @@ extends GenTraversableLike[A, GenTraversable[A]] def companion: GenericCompanion[GenTraversable] = GenTraversable } - object GenTraversable extends GenTraversableFactory[GenTraversable] { implicit def canBuildFrom[A] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]] def newBuilder[A] = Traversable.newBuilder } - - diff --git a/src/library/scala/collection/GenTraversableOnce.scala b/src/library/scala/collection/GenTraversableOnce.scala index e4976d8f2c..a52f43bade 100644 --- a/src/library/scala/collection/GenTraversableOnce.scala +++ b/src/library/scala/collection/GenTraversableOnce.scala @@ -368,7 +368,7 @@ trait GenTraversableOnce[+A] extends Any { * @param cmp An ordering to be used for comparing elements. * @tparam B The result type of the function f. * @param f The measuring function. - * @return the first element of this $coll with the largest value measured by function f + * @return the first element of this $coll with the largest value measured by function f * with respect to the ordering `cmp`. * * @usecase def maxBy[B](f: A => B): A @@ -383,7 +383,7 @@ trait GenTraversableOnce[+A] extends Any { * @param cmp An ordering to be used for comparing elements. * @tparam B The result type of the function f. * @param f The measuring function. - * @return the first element of this $coll with the smallest value measured by function f + * @return the first element of this $coll with the smallest value measured by function f * with respect to the ordering `cmp`. * * @usecase def minBy[B](f: A => B): A diff --git a/src/library/scala/collection/IterableLike.scala b/src/library/scala/collection/IterableLike.scala index b043d1f2a6..f79b5afce9 100644 --- a/src/library/scala/collection/IterableLike.scala +++ b/src/library/scala/collection/IterableLike.scala @@ -171,7 +171,7 @@ self => * fewer elements than size. */ def sliding(size: Int): Iterator[Repr] = sliding(size, 1) - + /** Groups elements in fixed size blocks by passing a "sliding window" * over them (as opposed to partitioning them, as is done in grouped.) * @see [[scala.collection.Iterator]], method `sliding` diff --git a/src/library/scala/collection/LinearSeqOptimized.scala b/src/library/scala/collection/LinearSeqOptimized.scala index 21bfedf5de..8635b090b9 100755 --- a/src/library/scala/collection/LinearSeqOptimized.scala +++ b/src/library/scala/collection/LinearSeqOptimized.scala @@ -91,7 +91,7 @@ trait LinearSeqOptimized[+A, +Repr <: LinearSeqOptimized[A, Repr]] extends Linea } false } - + override /*IterableLike*/ def find(p: A => Boolean): Option[A] = { var these = this @@ -112,7 +112,7 @@ trait LinearSeqOptimized[+A, +Repr <: LinearSeqOptimized[A, Repr]] extends Linea } acc } - + override /*IterableLike*/ def foldRight[B](z: B)(f: (A, B) => B): B = if (this.isEmpty) z diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala index f37c0993d4..761b65723c 100644 --- a/src/library/scala/collection/Map.scala +++ b/src/library/scala/collection/Map.scala @@ -52,7 +52,7 @@ object Map extends MapFactory[Map] { def iterator = underlying.iterator override def default(key: A): B = d(key) } - + } /** Explicit instantiation of the `Map` trait to reduce class file size in subclasses. */ diff --git a/src/library/scala/collection/SortedMap.scala b/src/library/scala/collection/SortedMap.scala index 0705a1e9e0..36e7eae79c 100644 --- a/src/library/scala/collection/SortedMap.scala +++ b/src/library/scala/collection/SortedMap.scala @@ -34,7 +34,7 @@ object SortedMap extends SortedMapFactory[SortedMap] { def empty[A, B](implicit ord: Ordering[A]): SortedMap[A, B] = immutable.SortedMap.empty[A, B](ord) implicit def canBuildFrom[A, B](implicit ord: Ordering[A]): CanBuildFrom[Coll, (A, B), SortedMap[A, B]] = new SortedMapCanBuildFrom[A, B] - + private[collection] trait Default[A, +B] extends SortedMap[A, B] { self => override def +[B1 >: B](kv: (A, B1)): SortedMap[A, B1] = { @@ -43,15 +43,11 @@ object SortedMap extends SortedMapFactory[SortedMap] { b += ((kv._1, kv._2)) b.result() } - + override def - (key: A): SortedMap[A, B] = { val b = newBuilder for (kv <- this; if kv._1 != key) b += kv b.result() } } - } - - - diff --git a/src/library/scala/collection/SortedMapLike.scala b/src/library/scala/collection/SortedMapLike.scala index 3fc8b0dadc..cf5e9c36c7 100644 --- a/src/library/scala/collection/SortedMapLike.scala +++ b/src/library/scala/collection/SortedMapLike.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala package collection @@ -74,7 +72,7 @@ self => for (e <- elems) m = m + e m } - + override def filterKeys(p: A => Boolean): SortedMap[A, B] = new FilteredKeys(p) with SortedMap.Default[A, B] { implicit def ordering: Ordering[A] = self.ordering override def rangeImpl(from : Option[A], until : Option[A]): SortedMap[A, B] = self.rangeImpl(from, until).filterKeys(p) @@ -82,7 +80,7 @@ self => override def keysIteratorFrom(start: A) = self keysIteratorFrom start filter p override def valuesIteratorFrom(start: A) = self iteratorFrom start collect {case (k,v) if p(k) => v} } - + override def mapValues[C](f: B => C): SortedMap[A, C] = new MappedValues(f) with SortedMap.Default[A, C] { implicit def ordering: Ordering[A] = self.ordering override def rangeImpl(from : Option[A], until : Option[A]): SortedMap[A, C] = self.rangeImpl(from, until).mapValues(f) @@ -90,7 +88,7 @@ self => override def keysIteratorFrom(start: A) = self keysIteratorFrom start override def valuesIteratorFrom(start: A) = self valuesIteratorFrom start map f } - + /** Adds a number of elements provided by a traversable object * and returns a new collection with the added elements. * @@ -98,14 +96,14 @@ self => */ override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): SortedMap[A, B1] = ((repr: SortedMap[A, B1]) /: xs.seq) (_ + _) - + /** * Creates an iterator over all the key/value pairs * contained in this map having a key greater than or * equal to `start` according to the ordering of * this map. x.iteratorFrom(y) is equivalent * to but often more efficient than x.from(y).iterator. - * + * * @param start The lower bound (inclusive) * on the keys to be returned */ @@ -114,15 +112,11 @@ self => * Creates an iterator over all the values contained in this * map that are associated with a key greater than or equal to `start` * according to the ordering of this map. x.valuesIteratorFrom(y) is - * equivalent to but often more efficient than + * equivalent to but often more efficient than * x.from(y).valuesIterator. - * + * * @param start The lower bound (inclusive) * on the keys to be returned */ def valuesIteratorFrom(start: A): Iterator[B] } - - - - diff --git a/src/library/scala/collection/SortedSetLike.scala b/src/library/scala/collection/SortedSetLike.scala index eb2ac38c59..c38ea1f3ce 100644 --- a/src/library/scala/collection/SortedSetLike.scala +++ b/src/library/scala/collection/SortedSetLike.scala @@ -47,7 +47,7 @@ self => * greater than or equal to `start` according to the ordering of * this collection. x.iteratorFrom(y) is equivalent to but will usually * be more efficient than x.from(y).iterator - * + * * @param start The lower-bound (inclusive) of the iterator */ def iteratorFrom(start: A): Iterator[A] = keysIteratorFrom(start) diff --git a/src/library/scala/collection/TraversableOnce.scala b/src/library/scala/collection/TraversableOnce.scala index 634807b29f..2fdad0f8f9 100644 --- a/src/library/scala/collection/TraversableOnce.scala +++ b/src/library/scala/collection/TraversableOnce.scala @@ -242,7 +242,7 @@ trait TraversableOnce[+A] extends Any with GenTraversableOnce[A] { var minF: B = null.asInstanceOf[B] var minElem: A = null.asInstanceOf[A] var first = true - + for (elem <- self) { val fx = f(elem) if (first || cmp.lt(fx, minF)) { diff --git a/src/library/scala/collection/TraversableViewLike.scala b/src/library/scala/collection/TraversableViewLike.scala index c507e000ee..ca1c450e3f 100644 --- a/src/library/scala/collection/TraversableViewLike.scala +++ b/src/library/scala/collection/TraversableViewLike.scala @@ -211,5 +211,3 @@ trait TraversableViewLike[+A, override def toString = viewToString } - - diff --git a/src/library/scala/collection/convert/WrapAsJava.scala b/src/library/scala/collection/convert/WrapAsJava.scala index e75a0e2981..b6ebf2ff06 100644 --- a/src/library/scala/collection/convert/WrapAsJava.scala +++ b/src/library/scala/collection/convert/WrapAsJava.scala @@ -257,11 +257,3 @@ trait WrapAsJava { } object WrapAsJava extends WrapAsJava { } - - - - - - - - diff --git a/src/library/scala/collection/generic/GenericSeqCompanion.scala b/src/library/scala/collection/generic/GenericSeqCompanion.scala index 34b20f23a2..fd1e18a029 100644 --- a/src/library/scala/collection/generic/GenericSeqCompanion.scala +++ b/src/library/scala/collection/generic/GenericSeqCompanion.scala @@ -6,7 +6,6 @@ ** |/ ** \* */ - package scala package collection package generic diff --git a/src/library/scala/collection/generic/IsSeqLike.scala b/src/library/scala/collection/generic/IsSeqLike.scala index 189aea4632..4c857ad1bb 100644 --- a/src/library/scala/collection/generic/IsSeqLike.scala +++ b/src/library/scala/collection/generic/IsSeqLike.scala @@ -50,7 +50,7 @@ object IsSeqLike { val conversion = implicitly[String => SeqLike[Char, String]] } - implicit def seqLikeRepr[C[_], A0](implicit conv: C[A0] => SeqLike[A0,C[A0]]): IsSeqLike[C[A0]] { type A = A0 } = + implicit def seqLikeRepr[C[_], A0](implicit conv: C[A0] => SeqLike[A0,C[A0]]): IsSeqLike[C[A0]] { type A = A0 } = new IsSeqLike[C[A0]] { type A = A0 val conversion = conv diff --git a/src/library/scala/collection/generic/ParFactory.scala b/src/library/scala/collection/generic/ParFactory.scala index 486e2a115e..4486cea419 100644 --- a/src/library/scala/collection/generic/ParFactory.scala +++ b/src/library/scala/collection/generic/ParFactory.scala @@ -37,8 +37,3 @@ extends GenTraversableFactory[CC] override def apply() = newBuilder[A] } } - - - - - diff --git a/src/library/scala/collection/generic/Shrinkable.scala b/src/library/scala/collection/generic/Shrinkable.scala index b7412afde0..b5ec568667 100644 --- a/src/library/scala/collection/generic/Shrinkable.scala +++ b/src/library/scala/collection/generic/Shrinkable.scala @@ -6,7 +6,6 @@ ** |/ ** \* */ - package scala package collection package generic @@ -49,7 +48,3 @@ trait Shrinkable[-A] { */ def --=(xs: TraversableOnce[A]): this.type = { xs.seq foreach -= ; this } } - - - - diff --git a/src/library/scala/collection/generic/Signalling.scala b/src/library/scala/collection/generic/Signalling.scala index e62eb6ff09..021d289c9d 100644 --- a/src/library/scala/collection/generic/Signalling.scala +++ b/src/library/scala/collection/generic/Signalling.scala @@ -10,13 +10,8 @@ package scala package collection package generic - import java.util.concurrent.atomic.AtomicInteger - - - - /** * A message interface serves as a unique interface to the * part of the collection capable of receiving messages from @@ -97,7 +92,6 @@ trait Signalling { def tag: Int } - /** * This signalling implementation returns default values and ignores received signals. */ @@ -110,13 +104,11 @@ class DefaultSignalling extends Signalling with VolatileAbort { def tag = -1 } - /** * An object that returns default values and ignores received signals. */ object IdleSignalling extends DefaultSignalling - /** * A mixin trait that implements abort flag behaviour using volatile variables. */ @@ -126,7 +118,6 @@ trait VolatileAbort extends Signalling { override def abort() = abortflag = true } - /** * A mixin trait that implements index flag behaviour using atomic integers. * The `setIndex` operation is wait-free, while conditional set operations `setIndexIfGreater` @@ -154,7 +145,6 @@ trait AtomicIndexFlag extends Signalling { } } - /** * An implementation of the signalling interface using delegates. */ @@ -175,25 +165,12 @@ trait DelegatedSignalling extends Signalling { def tag = signalDelegate.tag } - /** * Class implementing delegated signalling. */ class DelegatedContext(var signalDelegate: Signalling) extends DelegatedSignalling - /** * Class implementing delegated signalling, but having its own distinct `tag`. */ class TaggedDelegatedContext(deleg: Signalling, override val tag: Int) extends DelegatedContext(deleg) - - - - - - - - - - - diff --git a/src/library/scala/collection/generic/Sorted.scala b/src/library/scala/collection/generic/Sorted.scala index 3876da3275..ab0d443a03 100644 --- a/src/library/scala/collection/generic/Sorted.scala +++ b/src/library/scala/collection/generic/Sorted.scala @@ -79,14 +79,14 @@ trait Sorted[K, +This <: Sorted[K, This]] { else until(next) } - + /** * Creates an iterator over all the keys(or elements) contained in this * collection greater than or equal to `start` - * according to the ordering of this collection. x.keysIteratorFrom(y) - * is equivalent to but often more efficient than + * according to the ordering of this collection. x.keysIteratorFrom(y) + * is equivalent to but often more efficient than * x.from(y).keysIterator. - * + * * @param start The lower bound (inclusive) * on the keys to be returned */ diff --git a/src/library/scala/collection/immutable/DefaultMap.scala b/src/library/scala/collection/immutable/DefaultMap.scala index 42a03e90ee..ce34b84486 100755 --- a/src/library/scala/collection/immutable/DefaultMap.scala +++ b/src/library/scala/collection/immutable/DefaultMap.scala @@ -50,13 +50,3 @@ trait DefaultMap[A, +B] extends Map[A, B] { self => b.result() } } - - - - - - - - - - diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index b11368acdf..57618d64a5 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala package collection package immutable @@ -402,4 +400,3 @@ object List extends SeqFactory[List] { /** Only used for list serialization */ @SerialVersionUID(0L - 8476791151975527571L) private[scala] case object ListSerializeEnd - diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala index 49295d92dd..59468a3186 100644 --- a/src/library/scala/collection/immutable/ListMap.scala +++ b/src/library/scala/collection/immutable/ListMap.scala @@ -157,12 +157,12 @@ extends AbstractMap[A, B] * @return the value associated with the given key. */ override def apply(k: A): B1 = apply0(this, k) - - - @tailrec private def apply0(cur: ListMap[A, B1], k: A): B1 = + + + @tailrec private def apply0(cur: ListMap[A, B1], k: A): B1 = if (cur.isEmpty) throw new NoSuchElementException("key not found: "+k) else if (k == cur.key) cur.value - else apply0(cur.tail, k) + else apply0(cur.tail, k) /** Checks if this map maps `key` to a value and return the * value if it exists. diff --git a/src/library/scala/collection/immutable/MapLike.scala b/src/library/scala/collection/immutable/MapLike.scala index f6041464e7..94a5b7929a 100644 --- a/src/library/scala/collection/immutable/MapLike.scala +++ b/src/library/scala/collection/immutable/MapLike.scala @@ -86,14 +86,14 @@ self => */ override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): immutable.Map[A, B1] = ((repr: immutable.Map[A, B1]) /: xs.seq) (_ + _) - + /** Filters this map by retaining only keys satisfying a predicate. * @param p the predicate used to test keys * @return an immutable map consisting only of those key value pairs of this map where the key satisfies * the predicate `p`. The resulting map wraps the original map without copying any elements. */ override def filterKeys(p: A => Boolean): Map[A, B] = new FilteredKeys(p) with DefaultMap[A, B] - + /** Transforms this map by applying a function to every retrieved value. * @param f the function used to transform values of this map. * @return a map view which maps every key of this map diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala index 72c40e889f..c234d35756 100644 --- a/src/library/scala/collection/immutable/Range.scala +++ b/src/library/scala/collection/immutable/Range.scala @@ -65,7 +65,7 @@ extends scala.collection.AbstractSeq[Int] || (start < end && step < 0) || (start == end && !isInclusive) ) - @deprecated("This method will be made private, use `length` instead.", "2.11") + @deprecated("This method will be made private, use `length` instead.", "2.11") final val numRangeElements: Int = { if (step == 0) throw new IllegalArgumentException("step cannot be 0.") else if (isEmpty) 0 @@ -77,7 +77,7 @@ extends scala.collection.AbstractSeq[Int] } @deprecated("This method will be made private, use `last` instead.", "2.11") final val lastElement = start + (numRangeElements - 1) * step - @deprecated("This method will be made private.", "2.11") + @deprecated("This method will be made private.", "2.11") final val terminalElement = start + numRangeElements * step override def last = if (isEmpty) Nil.last else lastElement diff --git a/src/library/scala/collection/immutable/RedBlackTree.scala b/src/library/scala/collection/immutable/RedBlackTree.scala index 48bccde0e8..0dad106b29 100644 --- a/src/library/scala/collection/immutable/RedBlackTree.scala +++ b/src/library/scala/collection/immutable/RedBlackTree.scala @@ -367,7 +367,7 @@ object RedBlackTree { private[this] def rebalance[A, B](tree: Tree[A, B], newLeft: Tree[A, B], newRight: Tree[A, B]) = { // This is like drop(n-1), but only counting black nodes @tailrec - def findDepth(zipper: NList[Tree[A, B]], depth: Int): NList[Tree[A, B]] = + def findDepth(zipper: NList[Tree[A, B]], depth: Int): NList[Tree[A, B]] = if (zipper eq null) { sys.error("Defect: unexpected empty zipper while computing range") } else if (isBlackTree(zipper.head)) { @@ -400,14 +400,14 @@ object RedBlackTree { zippedTree } } - + // Null optimized list implementation for tree rebalancing. null presents Nil. private[this] final class NList[A](val head: A, val tail: NList[A]) private[this] final object NList { - + def cons[B](x: B, xs: NList[B]): NList[B] = new NList(x, xs) - + def foldLeft[A, B](xs: NList[A], z: B)(f: (B, A) => B): B = { var acc = z var these = xs @@ -417,7 +417,7 @@ object RedBlackTree { } acc } - + } /* diff --git a/src/library/scala/collection/immutable/SortedMap.scala b/src/library/scala/collection/immutable/SortedMap.scala index 4b9fa81a8c..f1493551ab 100644 --- a/src/library/scala/collection/immutable/SortedMap.scala +++ b/src/library/scala/collection/immutable/SortedMap.scala @@ -83,7 +83,7 @@ self => override def filterKeys(p: A => Boolean): SortedMap[A, B] = new FilteredKeys(p) with SortedMap.Default[A, B] { implicit def ordering: Ordering[A] = self.ordering override def rangeImpl(from : Option[A], until : Option[A]): SortedMap[A, B] = self.rangeImpl(from, until).filterKeys(p) - override def iteratorFrom(start: A) = self iteratorFrom start filter {case (k, _) => p(k)} + override def iteratorFrom(start: A) = self iteratorFrom start filter {case (k, _) => p(k)} override def keysIteratorFrom(start : A) = self keysIteratorFrom start filter p override def valuesIteratorFrom(start : A) = self iteratorFrom start collect {case (k,v) if p(k) => v} } @@ -91,7 +91,7 @@ self => override def mapValues[C](f: B => C): SortedMap[A, C] = new MappedValues(f) with SortedMap.Default[A, C] { implicit def ordering: Ordering[A] = self.ordering override def rangeImpl(from : Option[A], until : Option[A]): SortedMap[A, C] = self.rangeImpl(from, until).mapValues(f) - override def iteratorFrom(start: A) = self iteratorFrom start map {case (k, v) => (k, f(v))} + override def iteratorFrom(start: A) = self iteratorFrom start map {case (k, v) => (k, f(v))} override def keysIteratorFrom(start : A) = self keysIteratorFrom start override def valuesIteratorFrom(start : A) = self valuesIteratorFrom start map f } diff --git a/src/library/scala/collection/immutable/StreamViewLike.scala b/src/library/scala/collection/immutable/StreamViewLike.scala index ccab032cfd..c2eb85815d 100644 --- a/src/library/scala/collection/immutable/StreamViewLike.scala +++ b/src/library/scala/collection/immutable/StreamViewLike.scala @@ -71,9 +71,3 @@ extends SeqView[A, Coll] override def stringPrefix = "StreamView" } - - - - - - diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala index 4d2ec579db..8416b72ede 100644 --- a/src/library/scala/collection/immutable/TreeMap.scala +++ b/src/library/scala/collection/immutable/TreeMap.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala package collection package immutable @@ -194,7 +192,7 @@ class TreeMap[A, +B] private (tree: RB.Tree[A, B])(implicit val ordering: Orderi override def keysIterator: Iterator[A] = RB.keysIterator(tree) override def keysIteratorFrom(start: A): Iterator[A] = RB.keysIterator(tree, Some(start)) - + override def valuesIterator: Iterator[B] = RB.valuesIterator(tree) override def valuesIteratorFrom(start: A): Iterator[B] = RB.valuesIterator(tree, Some(start)) @@ -203,7 +201,3 @@ class TreeMap[A, +B] private (tree: RB.Tree[A, B])(implicit val ordering: Orderi override def foreach[U](f : ((A,B)) => U) = RB.foreach(tree, f) } - - - - diff --git a/src/library/scala/collection/mutable/FlatHashTable.scala b/src/library/scala/collection/mutable/FlatHashTable.scala index 1cdf150cb8..293faeca2d 100644 --- a/src/library/scala/collection/mutable/FlatHashTable.scala +++ b/src/library/scala/collection/mutable/FlatHashTable.scala @@ -107,7 +107,7 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] { } /** Finds an entry in the hash table if such an element exists. */ - protected def findEntry(elem: A): Option[A] = + protected def findEntry(elem: A): Option[A] = findElemImpl(elem) match { case null => None case entry => Some(entryToElem(entry)) @@ -136,10 +136,10 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] { protected def addElem(elem: A) : Boolean = { addEntry(elemToEntry(elem)) } - + /** * Add an entry (an elem converted to an entry via elemToEntry) if not yet in - * table. + * table. * @return Returns `true` if a new elem was added, `false` otherwise. */ protected def addEntry(newEntry : AnyRef) : Boolean = { @@ -156,10 +156,10 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] { nnSizeMapAdd(h) if (tableSize >= threshold) growTable() true - + } - /** + /** * Removes an elem from the hash table returning true if the element was found (and thus removed) * or false if it didn't exist. */ @@ -231,7 +231,7 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] { if (table(i) != null && !containsElem(entryToElem(table(i)))) assert(assertion = false, i+" "+table(i)+" "+table.mkString) } - + /* Size map handling code */ @@ -374,7 +374,7 @@ private[collection] object FlatHashTable { final def seedGenerator = new ThreadLocal[scala.util.Random] { override def initialValue = new scala.util.Random } - + private object NullSentinel { override def hashCode = 0 override def toString = "NullSentinel" @@ -421,18 +421,18 @@ private[collection] object FlatHashTable { val rotated = (improved >>> rotation) | (improved << (32 - rotation)) rotated } - + /** * Elems have type A, but we store AnyRef in the table. Plus we need to deal with * null elems, which need to be stored as NullSentinel */ - protected final def elemToEntry(elem : A) : AnyRef = + protected final def elemToEntry(elem : A) : AnyRef = if (null == elem) NullSentinel else elem.asInstanceOf[AnyRef] - + /** * Does the inverse translation of elemToEntry */ - protected final def entryToElem(entry : AnyRef) : A = + protected final def entryToElem(entry : AnyRef) : A = (if (entry.isInstanceOf[NullSentinel.type]) null else entry).asInstanceOf[A] } diff --git a/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala b/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala index 3e64747832..dc6d319b45 100644 --- a/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala +++ b/src/library/scala/collection/mutable/ImmutableSetAdaptor.scala @@ -6,13 +6,10 @@ ** |/ ** \* */ - - package scala package collection package mutable - /** This class can be used as an adaptor to create mutable sets from * immutable set implementations. Only method `empty` has * to be redefined if the immutable set on which this mutable set is @@ -49,6 +46,4 @@ extends AbstractSet[A] def -=(elem: A): this.type = { set = set - elem; this } override def clear(): Unit = { set = set.empty } - } - diff --git a/src/library/scala/collection/mutable/LinkedHashMap.scala b/src/library/scala/collection/mutable/LinkedHashMap.scala index 536f320402..b54f11be6e 100644 --- a/src/library/scala/collection/mutable/LinkedHashMap.scala +++ b/src/library/scala/collection/mutable/LinkedHashMap.scala @@ -95,25 +95,25 @@ class LinkedHashMap[A, B] extends AbstractMap[A, B] if (hasNext) { val res = (cur.key, cur.value); cur = cur.later; res } else Iterator.empty.next() } - + protected class FilteredKeys(p: A => Boolean) extends super.FilteredKeys(p) { override def empty = LinkedHashMap.empty } - + override def filterKeys(p: A => Boolean): scala.collection.Map[A, B] = new FilteredKeys(p) protected class MappedValues[C](f: B => C) extends super.MappedValues[C](f) { override def empty = LinkedHashMap.empty } - + override def mapValues[C](f: B => C): scala.collection.Map[A, C] = new MappedValues(f) - + protected class DefaultKeySet extends super.DefaultKeySet { override def empty = LinkedHashSet.empty } - + override def keySet: scala.collection.Set[A] = new DefaultKeySet - + override def keysIterator: Iterator[A] = new AbstractIterator[A] { private var cur = firstEntry def hasNext = cur ne null diff --git a/src/library/scala/collection/mutable/LinkedHashSet.scala b/src/library/scala/collection/mutable/LinkedHashSet.scala index d89566793f..cd51b79b65 100644 --- a/src/library/scala/collection/mutable/LinkedHashSet.scala +++ b/src/library/scala/collection/mutable/LinkedHashSet.scala @@ -81,7 +81,7 @@ class LinkedHashSet[A] extends AbstractSet[A] if (hasNext) { val res = cur.key; cur = cur.later; res } else Iterator.empty.next() } - + override def foreach[U](f: A => U) { var cur = firstEntry while (cur ne null) { diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala index 5727b12975..a0d3ee0ef0 100644 --- a/src/library/scala/collection/mutable/MutableList.scala +++ b/src/library/scala/collection/mutable/MutableList.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala package collection package mutable @@ -151,10 +149,8 @@ extends AbstractSeq[A] bf ++= seq bf.result() } - } - object MutableList extends SeqFactory[MutableList] { implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, MutableList[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]] diff --git a/src/library/scala/collection/mutable/StackProxy.scala b/src/library/scala/collection/mutable/StackProxy.scala index 7d776b99c3..15b3a6ceca 100644 --- a/src/library/scala/collection/mutable/StackProxy.scala +++ b/src/library/scala/collection/mutable/StackProxy.scala @@ -59,7 +59,7 @@ trait StackProxy[A] extends Stack[A] with Proxy { self.push(elem) this } - + /** Returns the top element of the stack. This method will not remove * the element from the stack. An error is signaled if there is no * element on the stack. diff --git a/src/library/scala/collection/parallel/Combiner.scala b/src/library/scala/collection/parallel/Combiner.scala index 68df572517..abccf5d402 100644 --- a/src/library/scala/collection/parallel/Combiner.scala +++ b/src/library/scala/collection/parallel/Combiner.scala @@ -6,17 +6,13 @@ ** |/ ** \* */ - package scala package collection.parallel - import scala.collection.Parallel import scala.collection.mutable.Builder import scala.collection.generic.Sizing - - /** The base trait for all combiners. * A combiner incremental collection construction just like * a regular builder, but also implements an efficient merge operation of two builders @@ -90,10 +86,8 @@ trait Combiner[-Elem, +To] extends Builder[Elem, To] with Sizing with Parallel { val res = result() setTaskSupport(res, combinerTaskSupport) } - } - /* private[collection] trait EnvironmentPassingCombiner[-Elem, +To] extends Combiner[Elem, To] { abstract override def result = { @@ -102,12 +96,3 @@ private[collection] trait EnvironmentPassingCombiner[-Elem, +To] extends Combine } } */ - - - - - - - - - diff --git a/src/library/scala/collection/parallel/ParIterableViewLike.scala b/src/library/scala/collection/parallel/ParIterableViewLike.scala index 1ec0ff9c32..5a7a5f5601 100644 --- a/src/library/scala/collection/parallel/ParIterableViewLike.scala +++ b/src/library/scala/collection/parallel/ParIterableViewLike.scala @@ -21,8 +21,6 @@ import scala.collection.generic.CanCombineFrom import scala.collection.parallel.immutable.ParRange import scala.language.implicitConversions - - /** A template view of a non-strict view of parallel iterable collection. * * '''Note:''' Regular view traits have type parameters used to carry information @@ -190,16 +188,4 @@ self => protected[this] def newSubtask(p: IterableSplitter[T]) = new Force(cbf, p) override def merge(that: Force[U, That]) = result = result combine that.result } - } - - - - - - - - - - - diff --git a/src/library/scala/collection/parallel/ParMapLike.scala b/src/library/scala/collection/parallel/ParMapLike.scala index ee14324c41..d2b15c727a 100644 --- a/src/library/scala/collection/parallel/ParMapLike.scala +++ b/src/library/scala/collection/parallel/ParMapLike.scala @@ -6,13 +6,9 @@ ** |/ ** \* */ - package scala package collection.parallel - - - import scala.collection.MapLike import scala.collection.GenMapLike import scala.collection.Map @@ -21,10 +17,6 @@ import scala.annotation.unchecked.uncheckedVariance import scala.collection.generic.IdleSignalling import scala.collection.generic.Signalling - - - - /** A template trait for mutable parallel maps. This trait is to be mixed in * with concrete parallel maps to override the representation type. * @@ -147,15 +139,3 @@ self => // note - should not override toMap (could be mutable) } - - - - - - - - - - - - diff --git a/src/library/scala/collection/parallel/ParSeq.scala b/src/library/scala/collection/parallel/ParSeq.scala index b4a30e5dc2..2c883ba8fe 100644 --- a/src/library/scala/collection/parallel/ParSeq.scala +++ b/src/library/scala/collection/parallel/ParSeq.scala @@ -42,12 +42,9 @@ trait ParSeq[+T] extends GenSeq[T] override def stringPrefix = getClass.getSimpleName } - object ParSeq extends ParFactory[ParSeq] { implicit def canBuildFrom[T]: CanCombineFrom[Coll, T, ParSeq[T]] = new GenericCanCombineFrom[T] def newBuilder[T]: Combiner[T, ParSeq[T]] = ParArrayCombiner[T] - def newCombiner[T]: Combiner[T, ParSeq[T]] = ParArrayCombiner[T] - } diff --git a/src/library/scala/collection/parallel/ParSetLike.scala b/src/library/scala/collection/parallel/ParSetLike.scala index a50d2ae430..4e9a2e5751 100644 --- a/src/library/scala/collection/parallel/ParSetLike.scala +++ b/src/library/scala/collection/parallel/ParSetLike.scala @@ -6,12 +6,9 @@ ** |/ ** \* */ - package scala package collection.parallel - - import scala.collection.SetLike import scala.collection.GenSetLike import scala.collection.GenSet @@ -45,26 +42,4 @@ extends GenSetLike[T, Repr] def diff(that: GenSet[T]): Repr = sequentially { _ diff that } - } - - - - - - - - - - - - - - - - - - - - - diff --git a/src/library/scala/collection/parallel/PreciseSplitter.scala b/src/library/scala/collection/parallel/PreciseSplitter.scala index 2eb202ce05..4b22934a29 100644 --- a/src/library/scala/collection/parallel/PreciseSplitter.scala +++ b/src/library/scala/collection/parallel/PreciseSplitter.scala @@ -9,10 +9,8 @@ package scala package collection.parallel - import scala.collection.Seq - /** A precise splitter (or a precise split iterator) can be split into arbitrary number of splitters * that traverse disjoint subsets of arbitrary sizes. * @@ -56,10 +54,4 @@ trait PreciseSplitter[+T] extends Splitter[T] { def psplit(sizes: Int*): Seq[PreciseSplitter[T]] def split: Seq[PreciseSplitter[T]] - } - - - - - diff --git a/src/library/scala/collection/parallel/TaskSupport.scala b/src/library/scala/collection/parallel/TaskSupport.scala index 84bb5e425b..9064018d46 100644 --- a/src/library/scala/collection/parallel/TaskSupport.scala +++ b/src/library/scala/collection/parallel/TaskSupport.scala @@ -6,18 +6,13 @@ ** |/ ** \* */ - package scala package collection.parallel - - import java.util.concurrent.ThreadPoolExecutor import scala.concurrent.forkjoin.ForkJoinPool import scala.concurrent.ExecutionContext - - /** A trait implementing the scheduling of a parallel collection operation. * * Parallel collections are modular in the way operations are scheduled. Each @@ -54,7 +49,6 @@ import scala.concurrent.ExecutionContext */ trait TaskSupport extends Tasks - /** A task support that uses a fork join pool to schedule tasks. * * @see [[scala.collection.parallel.TaskSupport]] for more information. @@ -70,7 +64,6 @@ extends TaskSupport with AdaptiveWorkStealingForkJoinTasks class ThreadPoolTaskSupport(val environment: ThreadPoolExecutor = ThreadPoolTasks.defaultThreadPool) extends TaskSupport with AdaptiveWorkStealingThreadPoolTasks - /** A task support that uses an execution context to schedule tasks. * * It can be used with the default execution context implementation in the @@ -86,22 +79,3 @@ extends TaskSupport with AdaptiveWorkStealingThreadPoolTasks */ class ExecutionContextTaskSupport(val environment: ExecutionContext = scala.concurrent.ExecutionContext.global) extends TaskSupport with ExecutionContextTasks - - - - - - - - - - - - - - - - - - - diff --git a/src/library/scala/collection/parallel/Tasks.scala b/src/library/scala/collection/parallel/Tasks.scala index 4aa11b25da..f8d0c6043a 100644 --- a/src/library/scala/collection/parallel/Tasks.scala +++ b/src/library/scala/collection/parallel/Tasks.scala @@ -9,18 +9,12 @@ package scala package collection.parallel - - import java.util.concurrent.ThreadPoolExecutor - import scala.concurrent.forkjoin._ import scala.concurrent.ExecutionContext import scala.util.control.Breaks._ - import scala.annotation.unchecked.uncheckedVariance - - trait Task[R, +Tp] { type Result = R @@ -436,17 +430,14 @@ trait ForkJoinTasks extends Tasks with HavingForkJoinPool { } def parallelismLevel = forkJoinPool.getParallelism - } - object ForkJoinTasks { val defaultForkJoinPool: ForkJoinPool = new ForkJoinPool() // scala.parallel.forkjoinpool // defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors) // defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors) } - /* Some boilerplate due to no deep mixin composition. Not sure if it can be done differently without them. */ trait AdaptiveWorkStealingForkJoinTasks extends ForkJoinTasks with AdaptiveWorkStealingTasks { @@ -457,7 +448,6 @@ trait AdaptiveWorkStealingForkJoinTasks extends ForkJoinTasks with AdaptiveWorkS } def newWrappedTask[R, Tp](b: Task[R, Tp]) = new WrappedTask[R, Tp](b) - } @deprecated("Use `AdaptiveWorkStealingForkJoinTasks` instead.", "2.11.0") @@ -469,12 +459,9 @@ trait AdaptiveWorkStealingThreadPoolTasks extends ThreadPoolTasks with AdaptiveW } def newWrappedTask[R, Tp](b: Task[R, Tp]) = new WrappedTask[R, Tp](b) - } - trait ExecutionContextTasks extends Tasks { - def executionContext = environment val environment: ExecutionContext @@ -494,16 +481,4 @@ trait ExecutionContextTasks extends Tasks { def executeAndWaitResult[R, Tp](task: Task[R, Tp]): R = driver executeAndWaitResult task def parallelismLevel = driver.parallelismLevel - } - - - - - - - - - - - diff --git a/src/library/scala/collection/parallel/immutable/ParHashMap.scala b/src/library/scala/collection/parallel/immutable/ParHashMap.scala index 854d0ba918..06455ba006 100644 --- a/src/library/scala/collection/parallel/immutable/ParHashMap.scala +++ b/src/library/scala/collection/parallel/immutable/ParHashMap.scala @@ -9,8 +9,6 @@ package scala package collection.parallel.immutable - - import scala.collection.parallel.ParMapLike import scala.collection.parallel.Combiner import scala.collection.parallel.IterableSplitter @@ -24,8 +22,6 @@ import scala.collection.immutable.{ HashMap, TrieIterator } import scala.annotation.unchecked.uncheckedVariance import scala.collection.parallel.Task - - /** Immutable parallel hash map, based on hash tries. * * $paralleliterableinfo @@ -136,10 +132,8 @@ self => println("other kind of node") } } - } - /** $factoryInfo * @define Coll `immutable.ParHashMap` * @define coll immutable parallel hash map @@ -158,7 +152,6 @@ object ParHashMap extends ParMapFactory[ParHashMap] { var totalcombines = new java.util.concurrent.atomic.AtomicInteger(0) } - private[parallel] abstract class HashMapCombiner[K, V] extends scala.collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], (K, V), HashMapCombiner[K, V]](HashMapCombiner.rootsize) { //self: EnvironmentPassingCombiner[(K, V), ParHashMap[K, V]] => @@ -331,30 +324,11 @@ extends scala.collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], (K, V } def shouldSplitFurther = howmany > scala.collection.parallel.thresholdFromSize(root.length, combinerTaskSupport.parallelismLevel) } - } - private[parallel] object HashMapCombiner { def apply[K, V] = new HashMapCombiner[K, V] {} // was: with EnvironmentPassingCombiner[(K, V), ParHashMap[K, V]] private[immutable] val rootbits = 5 private[immutable] val rootsize = 1 << 5 } - - - - - - - - - - - - - - - - - diff --git a/src/library/scala/collection/parallel/immutable/ParSeq.scala b/src/library/scala/collection/parallel/immutable/ParSeq.scala index 6e98b3102d..f0502fbbcb 100644 --- a/src/library/scala/collection/parallel/immutable/ParSeq.scala +++ b/src/library/scala/collection/parallel/immutable/ParSeq.scala @@ -6,12 +6,10 @@ ** |/ ** \* */ - package scala package collection package parallel.immutable - import scala.collection.generic.GenericParTemplate import scala.collection.generic.GenericCompanion import scala.collection.generic.GenericParCompanion @@ -36,7 +34,6 @@ extends scala.collection/*.immutable*/.GenSeq[T] override def toSeq: ParSeq[T] = this } - /** $factoryInfo * @define Coll `mutable.ParSeq` * @define coll mutable parallel sequence @@ -45,9 +42,5 @@ object ParSeq extends ParFactory[ParSeq] { implicit def canBuildFrom[T]: CanCombineFrom[Coll, T, ParSeq[T]] = new GenericCanCombineFrom[T] def newBuilder[T]: Combiner[T, ParSeq[T]] = ParVector.newBuilder[T] - def newCombiner[T]: Combiner[T, ParSeq[T]] = ParVector.newCombiner[T] } - - - diff --git a/src/library/scala/collection/parallel/immutable/ParVector.scala b/src/library/scala/collection/parallel/immutable/ParVector.scala index 548e7112c7..c2c1d042e1 100644 --- a/src/library/scala/collection/parallel/immutable/ParVector.scala +++ b/src/library/scala/collection/parallel/immutable/ParVector.scala @@ -6,14 +6,10 @@ ** |/ ** \* */ - package scala package collection package parallel.immutable - - - import scala.collection.generic.{GenericParTemplate, CanCombineFrom, ParFactory} import scala.collection.parallel.ParSeqLike import scala.collection.parallel.Combiner @@ -23,8 +19,6 @@ import immutable.Vector import immutable.VectorBuilder import immutable.VectorIterator - - /** Immutable parallel vectors, based on vectors. * * $paralleliterableinfo @@ -83,11 +77,8 @@ extends ParSeq[T] splitted.map(v => new ParVector(v).splitter.asInstanceOf[ParVectorIterator]) } } - } - - /** $factoryInfo * @define Coll `immutable.ParVector` * @define coll immutable parallel vector @@ -101,8 +92,6 @@ object ParVector extends ParFactory[ParVector] { def newCombiner[T]: Combiner[T, ParVector[T]] = new LazyParVectorCombiner[T] // was: with EPC[T, ParVector[T]] } - - private[immutable] class LazyParVectorCombiner[T] extends Combiner[T, ParVector[T]] { //self: EnvironmentPassingCombiner[T, ParVector[T]] => var sz = 0 @@ -136,11 +125,4 @@ private[immutable] class LazyParVectorCombiner[T] extends Combiner[T, ParVector[ vectors ++= that.vectors this } - } - - - - - - diff --git a/src/library/scala/collection/parallel/mutable/ParHashMap.scala b/src/library/scala/collection/parallel/mutable/ParHashMap.scala index 42a3302c91..bb3737f18e 100644 --- a/src/library/scala/collection/parallel/mutable/ParHashMap.scala +++ b/src/library/scala/collection/parallel/mutable/ParHashMap.scala @@ -6,13 +6,10 @@ ** |/ ** \* */ - package scala package collection.parallel package mutable - - import scala.collection.generic._ import scala.collection.mutable.DefaultEntry import scala.collection.mutable.HashEntry @@ -20,8 +17,6 @@ import scala.collection.mutable.HashTable import scala.collection.mutable.UnrolledBuffer import scala.collection.parallel.Task - - /** A parallel hash map. * * `ParHashMap` is a parallel map which internally keeps elements within a hash table. @@ -145,10 +140,8 @@ self => else ("Element " + e.key + " at " + i + " with " + elemHashCode(e.key) + " maps to " + index(elemHashCode(e.key))) :: check(e.next) check(table(i)) } - } - /** $factoryInfo * @define Coll `mutable.ParHashMap` * @define coll parallel hash map @@ -163,7 +156,6 @@ object ParHashMap extends ParMapFactory[ParHashMap] { implicit def canBuildFrom[K, V]: CanCombineFrom[Coll, (K, V), ParHashMap[K, V]] = new CanCombineFromMap[K, V] } - private[mutable] abstract class ParHashMapCombiner[K, V](private val tableLoadFactor: Int) extends scala.collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], DefaultEntry[K, V], ParHashMapCombiner[K, V]](ParHashMapCombiner.numblocks) with scala.collection.mutable.HashTable.HashUtils[K] @@ -298,10 +290,8 @@ extends scala.collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], Defau } def shouldSplitFurther = howmany > scala.collection.parallel.thresholdFromSize(ParHashMapCombiner.numblocks, combinerTaskSupport.parallelismLevel) } - } - private[parallel] object ParHashMapCombiner { private[mutable] val discriminantbits = 5 private[mutable] val numblocks = 1 << discriminantbits @@ -310,17 +300,3 @@ private[parallel] object ParHashMapCombiner { def apply[K, V] = new ParHashMapCombiner[K, V](HashTable.defaultLoadFactor) {} // was: with EnvironmentPassingCombiner[(K, V), ParHashMap[K, V]] } - - - - - - - - - - - - - - diff --git a/src/library/scala/collection/parallel/mutable/ParHashTable.scala b/src/library/scala/collection/parallel/mutable/ParHashTable.scala index a6fada3d42..423b891d48 100644 --- a/src/library/scala/collection/parallel/mutable/ParHashTable.scala +++ b/src/library/scala/collection/parallel/mutable/ParHashTable.scala @@ -6,19 +6,13 @@ ** |/ ** \* */ - package scala package collection package parallel.mutable - - - import scala.collection.mutable.HashEntry import scala.collection.parallel.IterableSplitter - - /** Provides functionality for hash tables with linked list buckets, * enriching the data structure by fulfilling certain requirements * for their parallel construction and iteration. @@ -146,11 +140,4 @@ trait ParHashTable[K, Entry >: Null <: HashEntry[K, Entry]] extends scala.collec c } } - } - - - - - - diff --git a/src/library/scala/collection/parallel/mutable/ParMapLike.scala b/src/library/scala/collection/parallel/mutable/ParMapLike.scala index d96b5482fe..42027f5bac 100644 --- a/src/library/scala/collection/parallel/mutable/ParMapLike.scala +++ b/src/library/scala/collection/parallel/mutable/ParMapLike.scala @@ -10,8 +10,6 @@ package scala package collection.parallel package mutable - - import scala.collection.generic._ import scala.collection.mutable.Cloneable import scala.collection.generic.Growable @@ -51,6 +49,4 @@ extends scala.collection.GenMapLike[K, V, Repr] def -(key: K) = this.clone() -= key def clear(): Unit - } - diff --git a/src/library/scala/collection/parallel/mutable/ParSetLike.scala b/src/library/scala/collection/parallel/mutable/ParSetLike.scala index 1cfc14b094..13af5ed649 100644 --- a/src/library/scala/collection/parallel/mutable/ParSetLike.scala +++ b/src/library/scala/collection/parallel/mutable/ParSetLike.scala @@ -6,7 +6,6 @@ ** |/ ** \* */ - package scala package collection package parallel.mutable @@ -49,43 +48,3 @@ self => // note: should not override toSet } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/library/scala/collection/parallel/mutable/ParTrieMap.scala b/src/library/scala/collection/parallel/mutable/ParTrieMap.scala index 82f2717132..a1dc37cec9 100644 --- a/src/library/scala/collection/parallel/mutable/ParTrieMap.scala +++ b/src/library/scala/collection/parallel/mutable/ParTrieMap.scala @@ -9,8 +9,6 @@ package scala package collection.parallel.mutable - - import scala.collection.generic._ import scala.collection.parallel.Combiner import scala.collection.parallel.IterableSplitter @@ -24,8 +22,6 @@ import scala.collection.concurrent.INode import scala.collection.concurrent.TrieMap import scala.collection.concurrent.TrieMapIterator - - /** Parallel TrieMap collection. * * It has its bulk operations parallelized, but uses the snapshot operation @@ -117,10 +113,8 @@ extends ParMap[K, V] def shouldSplitFurther = howmany > 1 override def merge(that: Size) = result = result + that.result } - } - private[collection] class ParTrieMapSplitter[K, V](lev: Int, ct: TrieMap[K, V], mustInit: Boolean) extends TrieMapIterator[K, V](lev, ct, mustInit) with IterableSplitter[(K, V)] @@ -155,7 +149,6 @@ extends TrieMapIterator[K, V](lev, ct, mustInit) def remaining: Int = totalsize - iterated } - /** Only used within the `ParTrieMap`. */ private[mutable] trait ParTrieMapCombiner[K, V] extends Combiner[(K, V), ParTrieMap[K, V]] { @@ -173,24 +166,11 @@ private[mutable] trait ParTrieMapCombiner[K, V] extends Combiner[(K, V), ParTrie } override def canBeShared = true - } - object ParTrieMap extends ParMapFactory[ParTrieMap] { - def empty[K, V]: ParTrieMap[K, V] = new ParTrieMap[K, V] - def newCombiner[K, V]: Combiner[(K, V), ParTrieMap[K, V]] = new ParTrieMap[K, V] implicit def canBuildFrom[K, V]: CanCombineFrom[Coll, (K, V), ParTrieMap[K, V]] = new CanCombineFromMap[K, V] - } - - - - - - - - diff --git a/src/library/scala/concurrent/Awaitable.scala b/src/library/scala/concurrent/Awaitable.scala index 652a23471f..dff83874ba 100644 --- a/src/library/scala/concurrent/Awaitable.scala +++ b/src/library/scala/concurrent/Awaitable.scala @@ -17,7 +17,7 @@ import scala.concurrent.duration.Duration /** * An object that may eventually be completed with a result value of type `T` which may be * awaited using blocking methods. - * + * * The [[Await]] object provides methods that allow accessing the result of an `Awaitable` * by blocking the current thread until the `Awaitable` has been completed or a timeout has * occurred. @@ -26,9 +26,9 @@ trait Awaitable[+T] { /** * Await the "completed" state of this `Awaitable`. - * + * * '''''This method should not be called directly; use [[Await.ready]] instead.''''' - * + * * @param atMost * maximum wait time, which may be negative (no waiting is done), * [[scala.concurrent.duration.Duration.Inf Duration.Inf]] for unbounded waiting, or a finite positive @@ -41,12 +41,12 @@ trait Awaitable[+T] { @throws(classOf[TimeoutException]) @throws(classOf[InterruptedException]) def ready(atMost: Duration)(implicit permit: CanAwait): this.type - + /** * Await and return the result (of type `T`) of this `Awaitable`. - * + * * '''''This method should not be called directly; use [[Await.result]] instead.''''' - * + * * @param atMost * maximum wait time, which may be negative (no waiting is done), * [[scala.concurrent.duration.Duration.Inf Duration.Inf]] for unbounded waiting, or a finite positive diff --git a/src/library/scala/concurrent/ExecutionContext.scala b/src/library/scala/concurrent/ExecutionContext.scala index 68513f9c80..fa264e5d7f 100644 --- a/src/library/scala/concurrent/ExecutionContext.scala +++ b/src/library/scala/concurrent/ExecutionContext.scala @@ -18,15 +18,15 @@ import scala.util.Try */ @implicitNotFound("Cannot find an implicit ExecutionContext, either require one yourself or import ExecutionContext.Implicits.global") trait ExecutionContext { - + /** Runs a block of code on this execution context. */ def execute(runnable: Runnable): Unit - + /** Reports that an asynchronous computation failed. */ def reportFailure(@deprecatedName('t) cause: Throwable): Unit - + /** Prepares for the execution of a task. Returns the prepared * execution context. A valid implementation of `prepare` is one * that simply returns `this`. @@ -62,7 +62,7 @@ object ExecutionContext { */ implicit lazy val global: ExecutionContextExecutor = impl.ExecutionContextImpl.fromExecutor(null: Executor) } - + /** Creates an `ExecutionContext` from the given `ExecutorService`. */ def fromExecutorService(e: ExecutorService, reporter: Throwable => Unit): ExecutionContextExecutorService = @@ -71,7 +71,7 @@ object ExecutionContext { /** Creates an `ExecutionContext` from the given `ExecutorService` with the default Reporter. */ def fromExecutorService(e: ExecutorService): ExecutionContextExecutorService = fromExecutorService(e, defaultReporter) - + /** Creates an `ExecutionContext` from the given `Executor`. */ def fromExecutor(e: Executor, reporter: Throwable => Unit): ExecutionContextExecutor = @@ -80,7 +80,7 @@ object ExecutionContext { /** Creates an `ExecutionContext` from the given `Executor` with the default Reporter. */ def fromExecutor(e: Executor): ExecutionContextExecutor = fromExecutor(e, defaultReporter) - + /** The default reporter simply prints the stack trace of the `Throwable` to System.err. */ def defaultReporter: Throwable => Unit = _.printStackTrace() diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala index 411b89701b..4e3f3c6c81 100644 --- a/src/library/scala/concurrent/Future.scala +++ b/src/library/scala/concurrent/Future.scala @@ -254,7 +254,7 @@ trait Future[+T] extends Awaitable[T] { case Success(v) => try f(v) match { // If possible, link DefaultPromises to avoid space leaks case dp: DefaultPromise[_] => dp.asInstanceOf[DefaultPromise[S]].linkRootOf(p) - case fut => fut onComplete p.complete + case fut => fut onComplete p.complete } catch { case NonFatal(t) => p failure t } } p.future @@ -473,6 +473,13 @@ object Future { */ def successful[T](result: T): Future[T] = Promise.successful(result).future + /** Creates an already completed Future with the specified result or exception. + * + * @tparam T the type of the value in the promise + * @return the newly created `Future` object + */ + def fromTry[T](result: Try[T]): Future[T] = Promise.fromTry(result).future + /** Starts an asynchronous computation and returns a `Future` object with the result of that computation. * * The result becomes available once the asynchronous computation is completed. diff --git a/src/library/scala/concurrent/Promise.scala b/src/library/scala/concurrent/Promise.scala index cdde019cd0..eb8044ed3b 100644 --- a/src/library/scala/concurrent/Promise.scala +++ b/src/library/scala/concurrent/Promise.scala @@ -70,7 +70,7 @@ trait Promise[T] { other onComplete { this complete _ } this } - + /** Attempts to complete this promise with the specified future, once that future is completed. * * @return This promise @@ -115,38 +115,32 @@ trait Promise[T] { def tryFailure(@deprecatedName('t) cause: Throwable): Boolean = tryComplete(Failure(cause)) } - - object Promise { - /** Creates a promise object which can be completed with a value. - * + * * @tparam T the type of the value in the promise * @return the newly created `Promise` object */ def apply[T](): Promise[T] = new impl.Promise.DefaultPromise[T]() /** Creates an already completed Promise with the specified exception. - * + * * @tparam T the type of the value in the promise * @return the newly created `Promise` object */ - def failed[T](exception: Throwable): Promise[T] = new impl.Promise.KeptPromise[T](Failure(exception)) + def failed[T](exception: Throwable): Promise[T] = fromTry(Failure(exception)) /** Creates an already completed Promise with the specified result. - * + * * @tparam T the type of the value in the promise * @return the newly created `Promise` object */ - def successful[T](result: T): Promise[T] = new impl.Promise.KeptPromise[T](Success(result)) - -} - - - - - - - - + def successful[T](result: T): Promise[T] = fromTry(Success(result)) + /** Creates an already completed Promise with the specified result or exception. + * + * @tparam T the type of the value in the promise + * @return the newly created `Promise` object + */ + def fromTry[T](result: Try[T]): Promise[T] = new impl.Promise.KeptPromise[T](result) +} diff --git a/src/library/scala/concurrent/TaskRunner.scala b/src/library/scala/concurrent/TaskRunner.scala index 98c212d9fa..1ea23b35e8 100644 --- a/src/library/scala/concurrent/TaskRunner.scala +++ b/src/library/scala/concurrent/TaskRunner.scala @@ -24,5 +24,4 @@ private[scala] trait TaskRunner { def execute[S](task: Task[S]): Unit def shutdown(): Unit - } diff --git a/src/library/scala/concurrent/duration/Duration.scala b/src/library/scala/concurrent/duration/Duration.scala index 9a8844b489..1b50b7fa56 100644 --- a/src/library/scala/concurrent/duration/Duration.scala +++ b/src/library/scala/concurrent/duration/Duration.scala @@ -221,7 +221,7 @@ object Duration { final def toMinutes: Long = fail("toMinutes") final def toHours: Long = fail("toHours") final def toDays: Long = fail("toDays") - + final def toCoarsest: Duration = this } @@ -532,7 +532,7 @@ sealed abstract class Duration extends Serializable with Ordered[Duration] { * Duration(48, HOURS).toCoarsest // Duration(2, DAYS) * Duration(5, SECONDS).toCoarsest // Duration(5, SECONDS) * }}} - */ + */ def toCoarsest: Duration } diff --git a/src/library/scala/concurrent/impl/Promise.scala b/src/library/scala/concurrent/impl/Promise.scala index 35511856ee..418d859d79 100644 --- a/src/library/scala/concurrent/impl/Promise.scala +++ b/src/library/scala/concurrent/impl/Promise.scala @@ -155,7 +155,7 @@ private[concurrent] object Promise { /** Get the root promise for this promise, compressing the link chain to that * promise if necessary. - * + * * For promises that are not linked, the result of calling * `compressedRoot()` will the promise itself. However for linked promises, * this method will traverse each link until it locates the root promise at diff --git a/src/library/scala/concurrent/package.scala b/src/library/scala/concurrent/package.scala index 50a66a622a..2fe14a9c1a 100644 --- a/src/library/scala/concurrent/package.scala +++ b/src/library/scala/concurrent/package.scala @@ -19,9 +19,9 @@ package object concurrent { type TimeoutException = java.util.concurrent.TimeoutException /** Starts an asynchronous computation and returns a `Future` object with the result of that computation. - * + * * The result becomes available once the asynchronous computation is completed. - * + * * @tparam T the type of the result * @param body the asynchronous computation * @param executor the execution context on which the future is run @@ -30,7 +30,7 @@ package object concurrent { def future[T](body: =>T)(implicit @deprecatedName('execctx) executor: ExecutionContext): Future[T] = Future[T](body) /** Creates a promise object which can be completed with a value or an exception. - * + * * @tparam T the type of the value in the promise * @return the newly created `Promise` object */ @@ -38,7 +38,7 @@ package object concurrent { /** Used to designate a piece of code which potentially blocks, allowing the current [[BlockContext]] to adjust * the runtime's behavior. - * Properly marking blocking code may improve performance or avoid deadlocks. + * Properly marking blocking code may improve performance or avoid deadlocks. * * Blocking on an [[Awaitable]] should be done using [[Await.result]] instead of `blocking`. * @@ -53,22 +53,22 @@ package object concurrent { package concurrent { @implicitNotFound("Don't call `Awaitable` methods directly, use the `Await` object.") sealed trait CanAwait - + /** * Internal usage only, implementation detail. */ private[concurrent] object AwaitPermission extends CanAwait - + /** * `Await` is what is used to ensure proper handling of blocking for `Awaitable` instances. */ object Await { /** * Await the "completed" state of an `Awaitable`. - * + * * Although this method is blocking, the internal use of [[scala.concurrent.blocking blocking]] ensures that * the underlying [[ExecutionContext]] is prepared to properly manage the blocking. - * + * * @param awaitable * the `Awaitable` to be awaited * @param atMost @@ -84,13 +84,13 @@ package concurrent { @throws(classOf[InterruptedException]) def ready[T](awaitable: Awaitable[T], atMost: Duration): awaitable.type = blocking(awaitable.ready(atMost)(AwaitPermission)) - + /** * Await and return the result (of type `T`) of an `Awaitable`. - * + * * Although this method is blocking, the internal use of [[scala.concurrent.blocking blocking]] ensures that * the underlying [[ExecutionContext]] to properly detect blocking and ensure that there are no deadlocks. - * + * * @param awaitable * the `Awaitable` to be awaited * @param atMost diff --git a/src/library/scala/io/BufferedSource.scala b/src/library/scala/io/BufferedSource.scala index 832c7b23f9..1c87a1f421 100644 --- a/src/library/scala/io/BufferedSource.scala +++ b/src/library/scala/io/BufferedSource.scala @@ -41,7 +41,7 @@ class BufferedSource(inputStream: InputStream, bufferSize: Int)(implicit val cod takeWhile (_ != -1) map (_.toChar) ) - + private def decachedReader: BufferedReader = { // Don't want to lose a buffered char sitting in iter either. Yes, // this is ridiculous, but if I can't get rid of Source, and all the @@ -61,7 +61,7 @@ class BufferedSource(inputStream: InputStream, bufferSize: Int)(implicit val cod } else charReader } - + class BufferedLineIterator extends AbstractIterator[String] with Iterator[String] { private val lineReader = decachedReader @@ -84,7 +84,7 @@ class BufferedSource(inputStream: InputStream, bufferSize: Int)(implicit val cod } override def getLines(): Iterator[String] = new BufferedLineIterator - + /** Efficiently converts the entire remaining input into a string. */ override def mkString = { // Speed up slurping of whole data set in the simplest cases. diff --git a/src/library/scala/ref/WeakReference.scala b/src/library/scala/ref/WeakReference.scala index 6eb4899e3f..c8fb262a08 100644 --- a/src/library/scala/ref/WeakReference.scala +++ b/src/library/scala/ref/WeakReference.scala @@ -29,7 +29,7 @@ object WeakReference { /** Optionally returns the referenced value, or `None` if that value no longer exists */ def unapply[T <: AnyRef](wr: WeakReference[T]): Option[T] = { - val x = wr.underlying.get + val x = wr.underlying.get if (x != null) Some(x) else None } } diff --git a/src/library/scala/reflect/ClassTag.scala b/src/library/scala/reflect/ClassTag.scala index d699e34ffc..33c5cee783 100644 --- a/src/library/scala/reflect/ClassTag.scala +++ b/src/library/scala/reflect/ClassTag.scala @@ -28,7 +28,7 @@ import scala.runtime.ScalaRunTime.{ arrayClass, arrayElementClass } * scala> mkArray("Japan","Brazil","Germany") * res1: Array[String] = Array(Japan, Brazil, Germany) * }}} - * + * * See [[scala.reflect.api.TypeTags]] for more examples, or the * [[http://docs.scala-lang.org/overviews/reflection/typetags-manifests.html Reflection Guide: TypeTags]] * for more details. diff --git a/src/library/scala/runtime/AbstractFunction1.scala b/src/library/scala/runtime/AbstractFunction1.scala index 8d68017a6f..178280cb46 100644 --- a/src/library/scala/runtime/AbstractFunction1.scala +++ b/src/library/scala/runtime/AbstractFunction1.scala @@ -9,6 +9,6 @@ package scala.runtime -abstract class AbstractFunction1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double/*, scala.AnyRef*/) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double/*, scala.AnyRef*/) +R] extends Function1[T1, R] { +abstract class AbstractFunction1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double) +R] extends Function1[T1, R] { } diff --git a/src/library/scala/runtime/AbstractPartialFunction.scala b/src/library/scala/runtime/AbstractPartialFunction.scala index e3516bc4d9..7129f22f60 100644 --- a/src/library/scala/runtime/AbstractPartialFunction.scala +++ b/src/library/scala/runtime/AbstractPartialFunction.scala @@ -25,7 +25,7 @@ import scala.annotation.unspecialized * @author Pavel Pavlov * @since 2.10 */ -abstract class AbstractPartialFunction[@specialized(scala.Int, scala.Long, scala.Float, scala.Double, scala.AnyRef) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double, scala.AnyRef) +R] extends Function1[T1, R] with PartialFunction[T1, R] { self => +abstract class AbstractPartialFunction[@specialized(scala.Int, scala.Long, scala.Float, scala.Double) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double) +R] extends Function1[T1, R] with PartialFunction[T1, R] { self => // this method must be overridden for better performance, // for backwards compatibility, fall back to the one inherited from PartialFunction // this assumes the old-school partial functions override the apply method, though @@ -35,3 +35,15 @@ abstract class AbstractPartialFunction[@specialized(scala.Int, scala.Long, scala // let's not make it final so as not to confuse anyone /*final*/ def apply(x: T1): R = applyOrElse(x, PartialFunction.empty) } + +// Manual stand-ins for formerly specialized variations. +// Not comprehensive, only sufficent to run scala-check built scala 2.11.0-M5 +// TODO Scala 2.10.0.M6 Remove this once scalacheck is published against M6. +private[runtime] abstract class AbstractPartialFunction$mcIL$sp extends scala.runtime.AbstractPartialFunction[Any, Int] { + override def apply(x: Any): Int = apply$mcIL$sp(x) + def apply$mcIL$sp(x: Any): Int = applyOrElse(x, PartialFunction.empty) +} +private[runtime] abstract class AbstractPartialFunction$mcFL$sp extends scala.runtime.AbstractPartialFunction[Any, Float] { + override def apply(x: Any): Float = apply$mcIL$sp(x) + def apply$mcIL$sp(x: Any): Float = applyOrElse(x, PartialFunction.empty) +} diff --git a/src/library/scala/runtime/Boxed.scala b/src/library/scala/runtime/Boxed.scala index 855f0ff41a..933444773d 100644 --- a/src/library/scala/runtime/Boxed.scala +++ b/src/library/scala/runtime/Boxed.scala @@ -6,14 +6,7 @@ ** |/ ** \* */ - - package scala package runtime - -trait Boxed { - -} - - +trait Boxed { } diff --git a/src/library/scala/runtime/NonLocalReturnControl.scala b/src/library/scala/runtime/NonLocalReturnControl.scala index 16b2fec6d7..a926956acf 100644 --- a/src/library/scala/runtime/NonLocalReturnControl.scala +++ b/src/library/scala/runtime/NonLocalReturnControl.scala @@ -9,7 +9,6 @@ package scala package runtime - import scala.util.control.ControlThrowable class NonLocalReturnControl[@specialized T](val key: AnyRef, val value: T) extends ControlThrowable { diff --git a/src/library/scala/runtime/WorksheetSupport.scala b/src/library/scala/runtime/WorksheetSupport.scala index 2a0064494b..d86f8873aa 100644 --- a/src/library/scala/runtime/WorksheetSupport.scala +++ b/src/library/scala/runtime/WorksheetSupport.scala @@ -91,4 +91,3 @@ object WorksheetSupport { } class StopException extends Exception - diff --git a/src/library/scala/sys/process/ProcessBuilder.scala b/src/library/scala/sys/process/ProcessBuilder.scala index a144d51609..feced71dae 100644 --- a/src/library/scala/sys/process/ProcessBuilder.scala +++ b/src/library/scala/sys/process/ProcessBuilder.scala @@ -123,7 +123,7 @@ import ProcessBuilder._ * 1. `#&&` conditionally executes the second command if the previous one finished with * exit value 0. It mirrors shell's `&&`. * 1. `#||` conditionally executes the third command if the exit value of the previous - * command is different than zero. It mirrors shell's `&&`. + * command is different than zero. It mirrors shell's `||`. * * Finally, `!` at the end executes the commands, and returns the exit value. * Whatever is printed will be sent to the Scala process standard output. If diff --git a/src/library/scala/transient.scala b/src/library/scala/transient.scala index 8ff7c582b4..ec87439093 100644 --- a/src/library/scala/transient.scala +++ b/src/library/scala/transient.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala import scala.annotation.meta._ diff --git a/src/library/scala/util/Properties.scala b/src/library/scala/util/Properties.scala index 8b63a73638..13f2362d00 100644 --- a/src/library/scala/util/Properties.scala +++ b/src/library/scala/util/Properties.scala @@ -147,7 +147,7 @@ private[scala] trait PropertiesTrait { // See http://mail.openjdk.java.net/pipermail/macosx-port-dev/2012-November/005148.html for // the reason why we don't follow developer.apple.com/library/mac/#technotes/tn2002/tn2110. /** Returns `true` iff the underlying operating system is a version of Apple Mac OSX. */ - def isMac = osName startsWith "Mac OS X" + def isMac = osName startsWith "Mac OS X" /* Some runtime values. */ private[scala] def isAvian = javaVmName contains "Avian" diff --git a/src/library/scala/volatile.scala b/src/library/scala/volatile.scala index bea216eb17..c612732329 100644 --- a/src/library/scala/volatile.scala +++ b/src/library/scala/volatile.scala @@ -6,8 +6,6 @@ ** |/ ** \* */ - - package scala import scala.annotation.meta._ diff --git a/src/partest-extras/scala/tools/partest/IcodeComparison.scala b/src/partest-extras/scala/tools/partest/IcodeComparison.scala index 5da51c9d58..7122703918 100644 --- a/src/partest-extras/scala/tools/partest/IcodeComparison.scala +++ b/src/partest-extras/scala/tools/partest/IcodeComparison.scala @@ -6,7 +6,6 @@ package scala.tools.partest import scala.tools.partest.nest.FileManager.compareContents -import scala.compat.Platform.EOL /** A class for testing icode. All you need is this in a * partest source file -- @@ -41,7 +40,7 @@ abstract class IcodeComparison extends DirectTest { override def extraSettings: String = "-usejavacp" /** Compile the test code and return the contents of all - * (sorted) .icode files, which are immediately deleted. + * (sorted) .icode files, which are immediately deleted. * @param arg0 at least one arg is required * @param args must include -Xprint-icode:phase */ diff --git a/src/reflect/scala/reflect/api/BuildUtils.scala b/src/reflect/scala/reflect/api/BuildUtils.scala index 60c2a81947..551c27bf9c 100644 --- a/src/reflect/scala/reflect/api/BuildUtils.scala +++ b/src/reflect/scala/reflect/api/BuildUtils.scala @@ -193,5 +193,12 @@ private[reflect] trait BuildUtils { self: Universe => def apply(mods: Modifiers, name: TermName, tpt: Tree, rhs: Tree): ValDef def unapply(tree: Tree): Option[(Modifiers, TermName, Tree, Tree)] } + + val SyntacticAssign: SyntacticAssignExtractor + + trait SyntacticAssignExtractor { + def apply(lhs: Tree, rhs: Tree): Tree + def unapply(tree: Tree): Option[(Tree, Tree)] + } } } diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala index 2584dcb117..e5c7dc44af 100644 --- a/src/reflect/scala/reflect/internal/BuildUtils.scala +++ b/src/reflect/scala/reflect/internal/BuildUtils.scala @@ -3,6 +3,7 @@ package reflect package internal import Flags._ +import util._ trait BuildUtils { self: SymbolTable => import definitions.{TupleClass, FunctionClass, ScalaPackage, UnitClass} @@ -139,7 +140,7 @@ trait BuildUtils { self: SymbolTable => object SyntacticApplied extends SyntacticAppliedExtractor { def apply(tree: Tree, argss: List[List[Tree]]): Tree = - argss.foldLeft(tree) { Apply(_, _) } + argss.foldLeft(tree) { (f, args) => Apply(f, args.map(treeInfo.assignmentToMaybeNamedArg)) } def unapply(tree: Tree): Some[(Tree, List[List[Tree]])] = { val treeInfo.Applied(fun, targs, argss) = tree @@ -364,7 +365,7 @@ trait BuildUtils { self: SymbolTable => def unapply(tree: Tree): Option[(List[Tree], List[Tree], ValDef, List[Tree])] = tree match { case SyntacticApplied(Select(New(SyntacticTypeApplied(ident, targs)), nme.CONSTRUCTOR), argss) => Some((Nil, SyntacticApplied(SyntacticTypeApplied(ident, targs), argss) :: Nil, emptyValDef, Nil)) - case SyntacticBlock(SyntacticClassDef(_, tpnme.ANON_CLASS_NAME, Nil, _, List(Nil), earlyDefs, parents, selfdef, body) :: + case SyntacticBlock(SyntacticClassDef(_, tpnme.ANON_CLASS_NAME, Nil, _, ListOfNil, earlyDefs, parents, selfdef, body) :: Apply(Select(New(Ident(tpnme.ANON_CLASS_NAME)), nme.CONSTRUCTOR), Nil) :: Nil) => Some((earlyDefs, parents, selfdef, body)) case _ => @@ -400,6 +401,16 @@ trait BuildUtils { self: SymbolTable => object SyntacticValDef extends SyntacticValDefBase { val isMutable = false } object SyntacticVarDef extends SyntacticValDefBase { val isMutable = true } + + object SyntacticAssign extends SyntacticAssignExtractor { + def apply(lhs: Tree, rhs: Tree): Tree = gen.mkAssign(lhs, rhs) + def unapply(tree: Tree): Option[(Tree, Tree)] = tree match { + case Assign(lhs, rhs) => Some((lhs, rhs)) + case AssignOrNamedArg(lhs, rhs) => Some((lhs, rhs)) + case Apply(Select(fn, nme.update), args :+ rhs) => Some((atPos(fn.pos)(Apply(fn, args)), rhs)) + case _ => None + } + } } val build: BuildApi = new BuildImpl diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala index ed1c3f1044..f8af4f155d 100644 --- a/src/reflect/scala/reflect/internal/Definitions.scala +++ b/src/reflect/scala/reflect/internal/Definitions.scala @@ -285,6 +285,10 @@ trait Definitions extends api.StandardDefinitions { lazy val StringTpe = StringClass.tpe lazy val ThrowableTpe = ThrowableClass.tpe + lazy val ConstantTrue = ConstantType(Constant(true)) + lazy val ConstantFalse = ConstantType(Constant(false)) + lazy val ConstantNull = ConstantType(Constant(null)) + // Note: this is not the type alias AnyRef, it's a companion-like // object used by the @specialize annotation. lazy val AnyRefModule = getMemberModule(ScalaPackageClass, nme.AnyRef) diff --git a/src/reflect/scala/reflect/internal/Flags.scala b/src/reflect/scala/reflect/internal/Flags.scala index b8e3407824..c286ea53c6 100644 --- a/src/reflect/scala/reflect/internal/Flags.scala +++ b/src/reflect/scala/reflect/internal/Flags.scala @@ -118,7 +118,7 @@ class ModifierFlags { final val PRESUPER = 1L << 37 // value is evaluated before super call final val DEFAULTINIT = 1L << 41 // symbol is initialized to the default value: used by -Xcheckinit final val ARTIFACT = 1L << 46 // symbol should be ignored when typechecking; will be marked ACC_SYNTHETIC in bytecode - final val DEFAULTMETHOD = 1L << 47 // symbol is a java default method + final val DEFAULTMETHOD = 1L << 47 // symbol is a java default method /** Symbols which are marked ARTIFACT. (Expand this list?) * @@ -440,7 +440,7 @@ class Flags extends ModifierFlags { case TRIEDCOOKING => "<triedcooking>" // (1L << 44) case SYNCHRONIZED => "<synchronized>" // (1L << 45) case ARTIFACT => "<artifact>" // (1L << 46) - case DEFAULTMETHOD => "<defaultmethod>" // (1L << 47) + case DEFAULTMETHOD => "<defaultmethod>" // (1L << 47) case 0x1000000000000L => "" // (1L << 48) case 0x2000000000000L => "" // (1L << 49) case 0x4000000000000L => "" // (1L << 50) diff --git a/src/reflect/scala/reflect/internal/Names.scala b/src/reflect/scala/reflect/internal/Names.scala index ed248d6e1e..f998d95349 100644 --- a/src/reflect/scala/reflect/internal/Names.scala +++ b/src/reflect/scala/reflect/internal/Names.scala @@ -90,6 +90,8 @@ trait Names extends api.Names { */ final def newTermName(cs: Array[Char], offset: Int, len: Int, cachedString: String): TermName = { def body = { + require(offset >= 0, "offset must be non-negative, got " + offset) + require(len >= 0, "length must be non-negative, got " + len) val h = hashValue(cs, offset, len) & HASH_MASK var n = termHashtable(h) while ((n ne null) && (n.length != len || !equals(n.start, cs, offset, len))) diff --git a/src/reflect/scala/reflect/internal/Scopes.scala b/src/reflect/scala/reflect/internal/Scopes.scala index 8d20c8e546..485d4d5ddd 100644 --- a/src/reflect/scala/reflect/internal/Scopes.scala +++ b/src/reflect/scala/reflect/internal/Scopes.scala @@ -460,6 +460,4 @@ trait Scopes extends api.Scopes { self: SymbolTable => class ErrorScope(owner: Symbol) extends Scope private final val maxRecursions = 1000 - } - diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala index 686ebf5a1e..f4eae5590a 100644 --- a/src/reflect/scala/reflect/internal/StdNames.scala +++ b/src/reflect/scala/reflect/internal/StdNames.scala @@ -413,32 +413,43 @@ trait StdNames { @deprecated("Use Name#getterName", "2.11.0") def getterName(name: TermName): TermName = name.getterName @deprecated("Use Name#getterName", "2.11.0") def setterToGetter(name: TermName): TermName = name.getterName + /** + * Convert `Tuple2$mcII` to `Tuple2`, or `T1$sp` to `T1`. + */ def unspecializedName(name: Name): Name = ( - if (name endsWith SPECIALIZED_SUFFIX) - name.subName(0, name.lastIndexOf('m') - 1) + // DUPLICATED LOGIC WITH `splitSpecializedName` + if (name endsWith SPECIALIZED_SUFFIX) { + val idxM = name.lastIndexOf('m') + val to = (if (idxM > 0) idxM - 1 else name.length - SPECIALIZED_SUFFIX.length) + name.subName(0, to) + } else name ) /** Return the original name and the types on which this name * is specialized. For example, * {{{ - * splitSpecializedName("foo$mIcD$sp") == ('foo', "I", "D") + * splitSpecializedName("foo$mIcD$sp") == ('foo', "D", "I") * }}} * `foo$mIcD$sp` is the name of a method specialized on two type * parameters, the first one belonging to the method itself, on Int, * and another one belonging to the enclosing class, on Double. + * + * @return (unspecializedName, class tparam specializations, method tparam specializations) */ - def splitSpecializedName(name: Name): (Name, String, String) = - if (name endsWith SPECIALIZED_SUFFIX) { - val name1 = name dropRight SPECIALIZED_SUFFIX.length - val idxC = name1 lastIndexOf 'c' - val idxM = name1 lastIndexOf 'm' - - (name1.subName(0, idxM - 1), - name1.subName(idxC + 1, name1.length).toString, - name1.subName(idxM + 1, idxC).toString) - } else - (name, "", "") + def splitSpecializedName(name: Name): (Name, String, String) = { + // DUPLICATED LOGIC WITH `unspecializedName` + if (name endsWith SPECIALIZED_SUFFIX) { + val name1 = name dropRight SPECIALIZED_SUFFIX.length + val idxC = name1 lastIndexOf 'c' + val idxM = name1 lastIndexOf 'm' + if (idxC > idxM && idxM > 0) + (name1.subName(0, idxM - 1), name1.subName(idxC + 1, name1.length).toString, name1.subName(idxM + 1, idxC).toString) + else + (name.subName(0, name.length - SPECIALIZED_SUFFIX.length), "", "") + } + else (name, "", "") + } // Nominally, name$default$N, encoded for <init> def defaultGetterName(name: Name, pos: Int): TermName = ( @@ -591,6 +602,7 @@ trait StdNames { val SelectFromTypeTree: NameType = "SelectFromTypeTree" val StringContext: NameType = "StringContext" val SyntacticApplied: NameType = "SyntacticApplied" + val SyntacticAssign: NameType = "SyntacticAssign" val SyntacticBlock: NameType = "SyntacticBlock" val SyntacticClassDef: NameType = "SyntacticClassDef" val SyntacticDefDef: NameType = "SyntacticDefDef" diff --git a/src/reflect/scala/reflect/internal/TreeGen.scala b/src/reflect/scala/reflect/internal/TreeGen.scala index 26adf20c52..a9f2807e9f 100644 --- a/src/reflect/scala/reflect/internal/TreeGen.scala +++ b/src/reflect/scala/reflect/internal/TreeGen.scala @@ -3,6 +3,7 @@ package reflect package internal import Flags._ +import util._ abstract class TreeGen extends macros.TreeBuilder { val global: SymbolTable @@ -279,7 +280,7 @@ abstract class TreeGen extends macros.TreeBuilder { /** Builds a tuple */ def mkTuple(elems: List[Tree]): Tree = - if (elems.isEmpty) Literal(Constant(())) + if (elems.isEmpty) mkUnit() else Apply( Select(mkAttributedRef(TupleClass(elems.length).caseModule), nme.apply), elems) @@ -325,8 +326,7 @@ abstract class TreeGen extends macros.TreeBuilder { * body * } */ - def mkTemplate(parents: List[Tree], self: ValDef, constrMods: Modifiers, - vparamss: List[List[ValDef]], body: List[Tree], superPos: Position = NoPosition): Template = { + def mkTemplate(parents: List[Tree], self: ValDef, constrMods: Modifiers, vparamss: List[List[ValDef]], body: List[Tree], superPos: Position = NoPosition): Template = { /* Add constructor to template */ // create parameters for <init> as synthetic trees. @@ -355,8 +355,9 @@ abstract class TreeGen extends macros.TreeBuilder { if (body forall treeInfo.isInterfaceMember) None else Some( atPos(wrappingPos(superPos, lvdefs)) ( - DefDef(NoMods, nme.MIXIN_CONSTRUCTOR, List(), List(Nil), TypeTree(), Block(lvdefs, Literal(Constant()))))) - } else { + DefDef(NoMods, nme.MIXIN_CONSTRUCTOR, Nil, ListOfNil, TypeTree(), Block(lvdefs, Literal(Constant()))))) + } + else { // convert (implicit ... ) to ()(implicit ... ) if its the only parameter section if (vparamss1.isEmpty || !vparamss1.head.isEmpty && vparamss1.head.head.mods.isImplicit) vparamss1 = List() :: vparamss1 @@ -396,51 +397,49 @@ abstract class TreeGen extends macros.TreeBuilder { * @param npos the position of the new * @param cpos the position of the anonymous class starting with parents */ - def mkNew(parents: List[Tree], self: ValDef, stats: List[Tree], - npos: Position, cpos: Position): Tree = - if (parents.isEmpty) - mkNew(List(scalaAnyRefConstr), self, stats, npos, cpos) - else if (parents.tail.isEmpty && stats.isEmpty) { - // `Parsers.template` no longer differentiates tpts and their argss - // e.g. `C()` will be represented as a single tree Apply(Ident(C), Nil) - // instead of parents = Ident(C), argss = Nil as before - // this change works great for things that are actually templates - // but in this degenerate case we need to perform postprocessing - val app = treeInfo.dissectApplied(parents.head) - atPos(npos union cpos) { New(app.callee, app.argss) } - } else { - val x = tpnme.ANON_CLASS_NAME - atPos(npos union cpos) { - Block( - List( - atPos(cpos) { - ClassDef( - Modifiers(FINAL), x, Nil, - mkTemplate(parents, self, NoMods, List(Nil), stats, cpos.focus)) - }), - atPos(npos) { - New( - Ident(x) setPos npos.focus, - Nil) - } - ) - } + def mkNew(parents: List[Tree], self: ValDef, stats: List[Tree], npos: Position, cpos: Position): Tree = { + def enclosingPos = wrappingPos(cpos, parents ::: List(self) ::: stats) + def upos = cpos union npos + def anonTemplate = atPos(cpos)(mkTemplate(parents, self, NoMods, ListOfNil, stats, cpos)) + def anonClass = atPos(anonTemplate.pos.makeTransparent)(ClassDef(Modifiers(FINAL), tpnme.ANON_CLASS_NAME, Nil, anonTemplate)) + def anonNew = atPos(npos)(New(Ident(tpnme.ANON_CLASS_NAME) setPos cpos.focus, Nil)) + + // `Parsers.template` no longer differentiates tpts and their argss + // e.g. `C()` will be represented as a single tree Apply(Ident(C), Nil) + // instead of parents = Ident(C), argss = Nil as before + // this change works great for things that are actually templates + // but in this degenerate case we need to perform postprocessing + parents match { + case Nil => mkNew(List(scalaAnyRefConstr), self, stats, npos, cpos) + case treeInfo.AppliedArgs(callee, argss) :: Nil if stats.isEmpty => atPos(upos)(New(callee, argss)) + case _ => atPos(upos)(mkBlock(anonClass :: anonNew :: Nil)) } + } /** Create a tree representing the function type (argtpes) => restpe */ def mkFunctionTypeTree(argtpes: List[Tree], restpe: Tree): Tree = AppliedTypeTree(rootScalaDot(newTypeName("Function" + argtpes.length)), argtpes ::: List(restpe)) + def mkUnit() = Literal(Constant(())) + /** Create block of statements `stats` */ - def mkBlock(stats: List[Tree]): Tree = - if (stats.isEmpty) Literal(Constant(())) - else if (!stats.last.isTerm) Block(stats, Literal(Constant(()))) - else if (stats.length == 1) stats.head - else Block(stats.init, stats.last) + def mkBlock(stats: List[Tree]): Tree = stats match { + case stats if stats.isEmpty || !stats.last.isTerm => mkBlock(stats :+ mkUnit()) + case stat :: Nil => stat + case stats => Block(stats.init, stats.last) + } def mkTreeOrBlock(stats: List[Tree]) = stats match { - case Nil => EmptyTree + case Nil => EmptyTree case head :: Nil => head - case _ => gen.mkBlock(stats) + case _ => gen.mkBlock(stats) + } + + /** Create a tree representing an assignment <lhs = rhs> */ + def mkAssign(lhs: Tree, rhs: Tree): Tree = lhs match { + case Apply(fn, args) => + Apply(atPos(fn.pos)(Select(fn, nme.update)), args :+ rhs) + case _ => + Assign(lhs, rhs) } } diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala index 34fe0afb1a..1b763b8632 100644 --- a/src/reflect/scala/reflect/internal/TreeInfo.scala +++ b/src/reflect/scala/reflect/internal/TreeInfo.scala @@ -773,6 +773,13 @@ abstract class TreeInfo { unapply(dissectApplied(tree)) } + object AppliedArgs { + def unapply(tree: Tree): Some[(Tree, List[List[Tree]])] = tree match { + case Apply(AppliedArgs(fn, argss), args) => Some((fn, argss :+ args)) + case _ => Some((tree, Nil)) + } + } + /** Locates the synthetic Apply node corresponding to an extractor's call to * unapply (unwrapping nested Applies) and returns the fun part of that Apply. */ diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala index 38f1f0f725..2163a26b84 100644 --- a/src/reflect/scala/reflect/internal/Trees.scala +++ b/src/reflect/scala/reflect/internal/Trees.scala @@ -589,7 +589,11 @@ trait Trees extends api.Trees { self: SymbolTable => object TypeTree extends TypeTreeExtractor def TypeTree(tp: Type): TypeTree = TypeTree() setType tp - def TypeTree(sym: Symbol): TypeTree = atPos(sym.pos.focus)(TypeTree(sym.tpe_*.finalResultType)) + private def TypeTreeMemberType(sym: Symbol): TypeTree = { + // Needed for pos/t4970*.scala. See SI-7853 + val resType = (sym.owner.thisType memberType sym).finalResultType + atPos(sym.pos.focus)(TypeTree(resType)) + } def TypeBoundsTree(bounds: TypeBounds): TypeBoundsTree = TypeBoundsTree(TypeTree(bounds.lo), TypeTree(bounds.hi)) def TypeBoundsTree(sym: Symbol): TypeBoundsTree = atPos(sym.pos)(TypeBoundsTree(sym.info.bounds)) @@ -1039,7 +1043,7 @@ trait Trees extends api.Trees { self: SymbolTable => def newValDef(sym: Symbol, rhs: Tree)( mods: Modifiers = Modifiers(sym.flags), name: TermName = sym.name.toTermName, - tpt: Tree = TypeTree(sym) + tpt: Tree = TypeTreeMemberType(sym) ): ValDef = ( atPos(sym.pos)(ValDef(mods, name, tpt, rhs)) setSymbol sym ) @@ -1049,7 +1053,7 @@ trait Trees extends api.Trees { self: SymbolTable => name: TermName = sym.name.toTermName, tparams: List[TypeDef] = sym.typeParams map TypeDef, vparamss: List[List[ValDef]] = mapParamss(sym)(ValDef), - tpt: Tree = TypeTree(sym) + tpt: Tree = TypeTreeMemberType(sym) ): DefDef = ( atPos(sym.pos)(DefDef(mods, name, tparams, vparamss, tpt, rhs)) setSymbol sym ) diff --git a/src/reflect/scala/reflect/internal/TypeDebugging.scala b/src/reflect/scala/reflect/internal/TypeDebugging.scala index fd64d98ca2..b70d3bd970 100644 --- a/src/reflect/scala/reflect/internal/TypeDebugging.scala +++ b/src/reflect/scala/reflect/internal/TypeDebugging.scala @@ -7,7 +7,7 @@ package scala package reflect package internal -import util.shortClassOfInstance +import util._ trait TypeDebugging { self: SymbolTable => @@ -39,17 +39,17 @@ trait TypeDebugging { def skipType(tpe: Type): Boolean = (tpe eq null) || skipSym(tpe.typeSymbolDirect) def skip(t: Tree): Boolean = t match { - case EmptyTree => true - case PackageDef(_, _) => true - case t: RefTree => skipRefTree(t) - case TypeBoundsTree(lo, hi) => skip(lo) && skip(hi) - case Block(Nil, expr) => skip(expr) - case Apply(fn, Nil) => skip(fn) - case Block(stmt :: Nil, expr) => skip(stmt) && skip(expr) - case DefDef(_, nme.CONSTRUCTOR, Nil, Nil :: Nil, _, rhs) => skip(rhs) - case Literal(Constant(())) => true - case tt @ TypeTree() => skipType(tt.tpe) - case _ => skipSym(t.symbol) + case EmptyTree => true + case PackageDef(_, _) => true + case t: RefTree => skipRefTree(t) + case TypeBoundsTree(lo, hi) => skip(lo) && skip(hi) + case Block(Nil, expr) => skip(expr) + case Apply(fn, Nil) => skip(fn) + case Block(stmt :: Nil, expr) => skip(stmt) && skip(expr) + case DefDef(_, nme.CONSTRUCTOR, Nil, ListOfNil, _, rhs) => skip(rhs) + case Literal(Constant(())) => true + case tt @ TypeTree() => skipType(tt.tpe) + case _ => skipSym(t.symbol) } def apply(t: Tree) = skip(t) } diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala index 3adbbf13fc..dd6917814e 100644 --- a/src/reflect/scala/reflect/internal/Types.scala +++ b/src/reflect/scala/reflect/internal/Types.scala @@ -2835,9 +2835,6 @@ trait Types // but pattern-matching returned the original constr0 (a bug) // now, pattern-matching returns the most recent constr object TypeVar { - private val ConstantTrue = ConstantType(Constant(true)) - private val ConstantFalse = ConstantType(Constant(false)) - @inline final def trace[T](action: String, msg: => String)(value: T): T = { if (traceTypeVars) { val s = msg match { @@ -3059,13 +3056,13 @@ trait Types // ignore subtyping&equality checks while true -- see findMember // OPT: This could be Either[TypeVar, Boolean], but this encoding was chosen instead to save allocations. - private var _suspended: Type = TypeVar.ConstantFalse + private var _suspended: Type = ConstantFalse private[Types] def suspended: Boolean = (_suspended: @unchecked) match { - case TypeVar.ConstantFalse => false - case TypeVar.ConstantTrue => true - case tv: TypeVar => tv.suspended + case ConstantFalse => false + case ConstantTrue => true + case tv: TypeVar => tv.suspended } - private[Types] def suspended_=(b: Boolean): Unit = _suspended = if (b) TypeVar.ConstantTrue else TypeVar.ConstantFalse + private[Types] def suspended_=(b: Boolean): Unit = _suspended = if (b) ConstantTrue else ConstantFalse // SI-7785 Link the suspended attribute of a TypeVar created in, say, a TypeMap (e.g. AsSeenFrom) to its originator private[Types] def linkSuspended(origin: TypeVar): Unit = _suspended = origin diff --git a/src/reflect/scala/reflect/internal/pickling/ByteCodecs.scala b/src/reflect/scala/reflect/internal/pickling/ByteCodecs.scala index eb266e8125..8615e34fad 100644 --- a/src/reflect/scala/reflect/internal/pickling/ByteCodecs.scala +++ b/src/reflect/scala/reflect/internal/pickling/ByteCodecs.scala @@ -212,11 +212,3 @@ object ByteCodecs { decode7to8(xs, len) } } - - - - - - - - diff --git a/src/reflect/scala/reflect/internal/util/Collections.scala b/src/reflect/scala/reflect/internal/util/Collections.scala index 59af819dad..738baddc08 100644 --- a/src/reflect/scala/reflect/internal/util/Collections.scala +++ b/src/reflect/scala/reflect/internal/util/Collections.scala @@ -34,14 +34,19 @@ trait Collections { xss forall (_ forall p) final def mmap[A, B](xss: List[List[A]])(f: A => B) = xss map (_ map f) - final def mforeach[A](xss: List[List[A]])(f: A => Unit) = - xss foreach (_ foreach f) final def mfind[A](xss: List[List[A]])(p: A => Boolean): Option[A] = { var res: Option[A] = null mforeach(xss)(x => if ((res eq null) && p(x)) res = Some(x)) if (res eq null) None else res } + /** These are all written in terms of List because we're trying to wring all + * the performance we can and List is used almost exclusively in the compiler, + * but people are branching out in their collections so here's an overload. + */ + final def mforeach[A](xss: List[List[A]])(f: A => Unit) = xss foreach (_ foreach f) + final def mforeach[A](xss: Traversable[Traversable[A]])(f: A => Unit) = xss foreach (_ foreach f) + final def map2[A, B, C](xs1: List[A], xs2: List[B])(f: (A, B) => C): List[C] = { val lb = new ListBuffer[C] var ys1 = xs1 diff --git a/src/reflect/scala/reflect/internal/util/Position.scala b/src/reflect/scala/reflect/internal/util/Position.scala index 8e7df28167..d62ab40a9d 100644 --- a/src/reflect/scala/reflect/internal/util/Position.scala +++ b/src/reflect/scala/reflect/internal/util/Position.scala @@ -197,10 +197,11 @@ private[util] trait InternalPositionImpl { } def showDebug: String = toString def show = ( - if (isOpaqueRange) s"[$start:$end]" + if (isOpaqueRange && start != point) s"[$point/$start:$end]" + else if (isOpaqueRange) s"[$start:$end]" else if (isTransparent) s"<$start:$end>" else if (isDefined) s"[$point]" - else "[NoPosition]" + else "[X]" ) private def asOffset(point: Int): Position = Position.offset(source, point) diff --git a/src/reflect/scala/reflect/internal/util/Set.scala b/src/reflect/scala/reflect/internal/util/Set.scala index 75dcfaa59b..635bfb05e4 100644 --- a/src/reflect/scala/reflect/internal/util/Set.scala +++ b/src/reflect/scala/reflect/internal/util/Set.scala @@ -23,5 +23,4 @@ abstract class Set[T <: AnyRef] { findEntry(x) ne null def toList = iterator.toList - } diff --git a/src/reflect/scala/reflect/internal/util/StringOps.scala b/src/reflect/scala/reflect/internal/util/StringOps.scala index 4d98a344d8..14f349f502 100644 --- a/src/reflect/scala/reflect/internal/util/StringOps.scala +++ b/src/reflect/scala/reflect/internal/util/StringOps.scala @@ -7,7 +7,11 @@ \* */ package scala -package reflect.internal.util +package reflect +package internal +package util + +import scala.compat.Platform.EOL /** This object provides utility methods to extract elements * from Strings. @@ -18,14 +22,26 @@ package reflect.internal.util trait StringOps { def oempty(xs: String*) = xs filterNot (x => x == null || x == "") def ojoin(xs: String*): String = oempty(xs: _*) mkString " " - def longestCommonPrefix(xs: List[String]): String = { - if (xs.isEmpty || xs.contains("")) "" - else xs.head.head match { - case ch => - if (xs.tail forall (_.head == ch)) "" + ch + longestCommonPrefix(xs map (_.tail)) - else "" - } + def longestCommonPrefix(xs: List[String]): String = xs match { + case Nil => "" + case xs if xs contains "" => "" + case x :: xs => + val ch = x charAt 0 + if (xs exists (_.head != ch)) "" + else "" + ch + longestCommonPrefix(xs map (_ substring 1)) + } + /** Like String#trim, but trailing whitespace only. + */ + def trimTrailingSpace(s: String): String = { + var end = s.length + while (end > 0 && s.charAt(end - 1).isWhitespace) + end -= 1 + + if (end == s.length) s + else s.substring(0, end) } + /** Breaks the string into lines and strips each line before reassembling. */ + def trimAllTrailingSpace(s: String): String = s.lines map trimTrailingSpace mkString EOL def decompose(str: String, sep: Char): List[String] = { def ws(start: Int): List[String] = diff --git a/src/reflect/scala/reflect/internal/util/package.scala b/src/reflect/scala/reflect/internal/util/package.scala index df63a55090..3618c150ca 100644 --- a/src/reflect/scala/reflect/internal/util/package.scala +++ b/src/reflect/scala/reflect/internal/util/package.scala @@ -7,6 +7,9 @@ import scala.language.existentials // SI-6541 package object util { import StringOps.longestCommonPrefix + // An allocation-avoiding reusable instance of the so-common List(Nil). + val ListOfNil: List[List[Nothing]] = Nil :: Nil + def andFalse(body: Unit): Boolean = false // Shorten a name like Symbols$FooSymbol to FooSymbol. diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala index ed56016bce..984a752964 100644 --- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala @@ -23,6 +23,7 @@ import scala.collection.generic.Clearable import scala.concurrent.{ ExecutionContext, Await, Future, future } import ExecutionContext.Implicits._ import java.io.{ BufferedReader, FileReader } +import scala.reflect.internal.util.StringOps._ /** The Scala interactive shell. It provides a read-eval-print loop * around the Interpreter class. @@ -548,7 +549,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) } else try { val s = what // line 123, 120+3, -3, 120-123, 120-, note -3 is not 0-3 but (cur-3,cur) - val (start, len) = + val (start, len) = if ((s indexOf '+') > 0) { val (a,b) = s splitAt (s indexOf '+') (a.toInt, b.drop(1).toInt) @@ -885,12 +886,10 @@ object ILoop { override def write(str: String) = { // completely skip continuation lines if (str forall (ch => ch.isWhitespace || ch == '|')) () - // print a newline on empty scala prompts - else if ((str contains '\n') && (str.trim == "scala> ")) super.write("\n") else super.write(str) } } - val input = new BufferedReader(new StringReader(code)) { + val input = new BufferedReader(new StringReader(code.trim + "\n")) { override def readLine(): String = { val s = super.readLine() // helping out by printing the line being interpreted. diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala index ee4ff59498..a60de01673 100644 --- a/src/repl/scala/tools/nsc/interpreter/IMain.scala +++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala @@ -8,23 +8,17 @@ package tools.nsc package interpreter import PartialFunction.cond - import scala.language.implicitConversions - import scala.collection.mutable - import scala.concurrent.{ Future, ExecutionContext } - import scala.reflect.runtime.{ universe => ru } import scala.reflect.{ BeanProperty, ClassTag, classTag } import scala.reflect.internal.util.{ BatchSourceFile, SourceFile } - import scala.tools.util.PathResolver import scala.tools.nsc.io.AbstractFile import scala.tools.nsc.typechecker.{ TypeStrings, StructuredTypeStrings } import scala.tools.nsc.util.{ ScalaClassLoader, stringFromWriter, StackTraceOps } import scala.tools.nsc.util.Exceptional.unwrap - import javax.script.{AbstractScriptEngine, Bindings, ScriptContext, ScriptEngine, ScriptEngineFactory, ScriptException, CompiledScript, Compilable} /** An interpreter for Scala code. diff --git a/src/scaladoc/scala/tools/nsc/doc/Index.scala b/src/scaladoc/scala/tools/nsc/doc/Index.scala index f9b9eecdb3..84545e9201 100644 --- a/src/scaladoc/scala/tools/nsc/doc/Index.scala +++ b/src/scaladoc/scala/tools/nsc/doc/Index.scala @@ -7,11 +7,8 @@ package scala.tools.nsc.doc import scala.collection._ - trait Index { - type SymbolMap = SortedMap[String, SortedSet[model.MemberEntity]] def firstLetterIndex: Map[Char, SymbolMap] - } diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala index cd1d604843..a933c35c99 100755 --- a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala +++ b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala @@ -925,11 +925,8 @@ trait CommentFactoryBase { this: MemberLookupBase => buffer.substring(start, offset) } - /* CHARS CLASSES */ def isWhitespace(c: Char) = c == ' ' || c == '\t' - } - } diff --git a/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala b/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala index 53410fd4ad..643a089aae 100755 --- a/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala +++ b/src/scaladoc/scala/tools/nsc/doc/model/IndexModelFactory.scala @@ -51,9 +51,6 @@ object IndexModelFactory { gather(universe.rootPackage) result.toMap - } - } - } diff --git a/src/scalap/scala/tools/scalap/Arguments.scala b/src/scalap/scala/tools/scalap/Arguments.scala index 123516bb2d..41346d13c0 100644 --- a/src/scalap/scala/tools/scalap/Arguments.scala +++ b/src/scalap/scala/tools/scalap/Arguments.scala @@ -163,5 +163,4 @@ class Arguments { bindings get option flatMap (_ get key) def getOthers: List[String] = others.toList - } diff --git a/test/files/continuations-neg/function0.scala b/test/files/continuations-neg/function0.scala index 6ef0d98b90..4112ee3835 100644 --- a/test/files/continuations-neg/function0.scala +++ b/test/files/continuations-neg/function0.scala @@ -4,13 +4,13 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Any = { - + val f = () => shift { k: (Int=>Int) => k(7) } val g: () => Int = f - + println(reset(g())) } - + }
\ No newline at end of file diff --git a/test/files/continuations-neg/function2.scala b/test/files/continuations-neg/function2.scala index 402c6dcad8..ae0fda509d 100644 --- a/test/files/continuations-neg/function2.scala +++ b/test/files/continuations-neg/function2.scala @@ -4,13 +4,13 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Any = { - + val f = () => 7 val g: () => Int @cps[Int] = f - + println(reset(g())) } - + }
\ No newline at end of file diff --git a/test/files/continuations-neg/function3.scala b/test/files/continuations-neg/function3.scala index c4acc4c2e9..0c3f1667e5 100644 --- a/test/files/continuations-neg/function3.scala +++ b/test/files/continuations-neg/function3.scala @@ -4,12 +4,12 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Any = { - + val g: () => Int = () => shift { k: (Int=>Int) => k(7) } - + println(reset(g())) } - + }
\ No newline at end of file diff --git a/test/files/continuations-neg/infer2.check b/test/files/continuations-neg/infer2.check index 59eb670bc3..d92bc9c572 100644 --- a/test/files/continuations-neg/infer2.check +++ b/test/files/continuations-neg/infer2.check @@ -1,4 +1,4 @@ infer2.scala:14: error: illegal answer type modification: scala.util.continuations.cpsParam[String,Int] andThen scala.util.continuations.cpsParam[String,Int] - test { sym(); sym() } + test { sym(); sym() } ^ one error found diff --git a/test/files/continuations-neg/infer2.scala b/test/files/continuations-neg/infer2.scala index eaffbc17fc..a890ac1fc4 100644 --- a/test/files/continuations-neg/infer2.scala +++ b/test/files/continuations-neg/infer2.scala @@ -4,16 +4,16 @@ import scala.util.continuations._ object Test { - + def test(x: => Int @cpsParam[String,Int]) = 7 - + def sym() = shift { k: (Int => String) => 9 } - - + + def main(args: Array[String]): Any = { - test { sym(); sym() } + test { sym(); sym() } } - + } diff --git a/test/files/continuations-neg/lazy.scala b/test/files/continuations-neg/lazy.scala index a2fad83be8..3c8169dd46 100644 --- a/test/files/continuations-neg/lazy.scala +++ b/test/files/continuations-neg/lazy.scala @@ -1,16 +1,16 @@ -import scala.util.continuations._ - -object Test { +import scala.util.continuations._ + +object Test { def foo() = { lazy val x = shift((k:Unit=>Unit)=>k()) println(x) } - - def main(args: Array[String]) { + + def main(args: Array[String]) { reset { foo() } - } - + } + }
\ No newline at end of file diff --git a/test/files/continuations-neg/t2285.scala b/test/files/continuations-neg/t2285.scala index b906dc455a..f3c7f4c89c 100644 --- a/test/files/continuations-neg/t2285.scala +++ b/test/files/continuations-neg/t2285.scala @@ -5,7 +5,7 @@ import scala.util.continuations._ object Test { def bar() = shift { k: (String => String) => k("1") } - + def foo() = reset { bar(); 7 } - + } diff --git a/test/files/continuations-neg/t2949.scala b/test/files/continuations-neg/t2949.scala index 2d426a4d89..ce27c7c0e8 100644 --- a/test/files/continuations-neg/t2949.scala +++ b/test/files/continuations-neg/t2949.scala @@ -8,7 +8,7 @@ object Test { def reify[A, B](x : A @cpsParam[List[A], B]) = reset{ List(x) } def main(args: Array[String]): Unit = println(reify { - val x = reflect[Int, Int](List(1,2,3)) + val x = reflect[Int, Int](List(1,2,3)) val y = reflect[Int, Int](List(2,4,8)) x * y }) diff --git a/test/files/continuations-neg/t3628.scala b/test/files/continuations-neg/t3628.scala index 3fdd32a034..c56e7752c4 100644 --- a/test/files/continuations-neg/t3628.scala +++ b/test/files/continuations-neg/t3628.scala @@ -3,7 +3,7 @@ import scala.actors.Actor._ object Test { val impl: Actor = actor { loop { - react { + react { case 1 => impl ! 2 } } diff --git a/test/files/continuations-neg/trycatch2.scala b/test/files/continuations-neg/trycatch2.scala index d329a3b530..ee0a180ed6 100644 --- a/test/files/continuations-neg/trycatch2.scala +++ b/test/files/continuations-neg/trycatch2.scala @@ -7,7 +7,7 @@ object Test { def fatal[T]: T = throw new Exception def cpsIntStringInt = shift { k:(Int=>String) => k(3); 7 } def cpsIntIntString = shift { k:(Int=>Int) => k(3); "7" } - + def foo1 = try { fatal[Int] cpsIntStringInt diff --git a/test/files/continuations-run/basics.scala b/test/files/continuations-run/basics.scala index ed1782d77a..07b3de5194 100755 --- a/test/files/continuations-run/basics.scala +++ b/test/files/continuations-run/basics.scala @@ -14,10 +14,10 @@ object Test { } def main(args: Array[String]) { - + println(reset(m0())) println(reset(m1())) - + } - + } diff --git a/test/files/continuations-run/function1.scala b/test/files/continuations-run/function1.scala index ec7ebb66a5..82dfe46c08 100644 --- a/test/files/continuations-run/function1.scala +++ b/test/files/continuations-run/function1.scala @@ -4,13 +4,13 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Unit = { - + val f = () => shift { k: (Int=>Int) => k(7) } val g: () => Int @cps[Int] = f - + println(reset(g())) } - + } diff --git a/test/files/continuations-run/function4.scala b/test/files/continuations-run/function4.scala index 232b1ec3a6..ccb432fe93 100644 --- a/test/files/continuations-run/function4.scala +++ b/test/files/continuations-run/function4.scala @@ -4,12 +4,12 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Unit = { - + val g: () => Int @cps[Int] = () => shift { k: (Int=>Int) => k(7) } - + println(reset(g())) } - + } diff --git a/test/files/continuations-run/function5.scala b/test/files/continuations-run/function5.scala index 17ae08c98e..a83eb80d08 100644 --- a/test/files/continuations-run/function5.scala +++ b/test/files/continuations-run/function5.scala @@ -4,12 +4,12 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Unit = { - + val g: () => Int @cps[Int] = () => 7 - + println(reset(g())) } - + } diff --git a/test/files/continuations-run/function6.scala b/test/files/continuations-run/function6.scala index 6b4c5adc41..13ef88bd9f 100644 --- a/test/files/continuations-run/function6.scala +++ b/test/files/continuations-run/function6.scala @@ -4,13 +4,13 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Unit = { - + val g: PartialFunction[Int, Int @cps[Int]] = { case x => 7 } - + println(reset(g(2))) - + } - + } diff --git a/test/files/continuations-run/ifelse0.scala b/test/files/continuations-run/ifelse0.scala index 2c40f64959..cbff72c77c 100644 --- a/test/files/continuations-run/ifelse0.scala +++ b/test/files/continuations-run/ifelse0.scala @@ -4,15 +4,15 @@ import scala.util.continuations._ object Test { - + def test(x:Int) = if (x <= 7) shift { k: (Int=>Int) => k(k(k(x))) } else shift { k: (Int=>Int) => k(x) } - + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } - + } diff --git a/test/files/continuations-run/ifelse1.scala b/test/files/continuations-run/ifelse1.scala index 6f52a8c1e3..f8e3cf2ca3 100644 --- a/test/files/continuations-run/ifelse1.scala +++ b/test/files/continuations-run/ifelse1.scala @@ -4,12 +4,12 @@ import scala.util.continuations._ object Test { - + def test1(x:Int) = if (x <= 7) shift { k: (Int=>Int) => k(k(k(x))) } else x - + def test2(x:Int) = if (x <= 7) x else @@ -21,5 +21,5 @@ object Test { println(reset(1 + test2(7))) println(reset(1 + test2(8))) } - + } diff --git a/test/files/continuations-run/ifelse2.scala b/test/files/continuations-run/ifelse2.scala index f7f8328703..f5ec864a06 100644 --- a/test/files/continuations-run/ifelse2.scala +++ b/test/files/continuations-run/ifelse2.scala @@ -4,13 +4,13 @@ import scala.util.continuations._ object Test { - + def test(x:Int) = if (x <= 7) shift { k: (Unit=>Unit) => println("abort") } - + def main(args: Array[String]): Unit = { println(reset{ test(7); println("alive") }) println(reset{ test(8); println("alive") }) } - + } diff --git a/test/files/continuations-run/ifelse3.scala b/test/files/continuations-run/ifelse3.scala index 7b85770be9..2c5b5765db 100644 --- a/test/files/continuations-run/ifelse3.scala +++ b/test/files/continuations-run/ifelse3.scala @@ -4,18 +4,18 @@ import scala.util.continuations._ object Test { - + def util(x: Boolean) = shift { k: (Boolean=>Int) => k(x) } - + def test(x:Int) = if (util(x <= 7)) x - 1 else x + 1 - - + + def main(args: Array[String]): Unit = { println(reset(test(7))) println(reset(test(8))) } - + } diff --git a/test/files/continuations-run/ifelse4.scala b/test/files/continuations-run/ifelse4.scala index a0dbcafc57..46ec15365e 100644 --- a/test/files/continuations-run/ifelse4.scala +++ b/test/files/continuations-run/ifelse4.scala @@ -2,7 +2,7 @@ import scala.util.continuations._ object Test { def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1)))) - + def testA(x1: Int): Int @cps[Int] = { sh(x1) if (x1==42) x1 else sh(x1) @@ -11,7 +11,7 @@ object Test { def testB(x1: Int): Int @cps[Int] = { if (sh(x1)==43) x1 else x1 } - + def testC(x1: Int): Int @cps[Int] = { sh(x1) if (sh(x1)==44) x1 else x1 diff --git a/test/files/continuations-run/infer1.scala b/test/files/continuations-run/infer1.scala index 1196bd40a8..76f746da57 100644 --- a/test/files/continuations-run/infer1.scala +++ b/test/files/continuations-run/infer1.scala @@ -4,9 +4,9 @@ import scala.util.continuations._ object Test { - + def test(x: => Int @cpsParam[String,Int]) = 7 - + def test2() = { val x = shift { k: (Int => String) => 9 } x @@ -14,9 +14,9 @@ object Test { def test3(x: => Int @cpsParam[Int,Int]) = 7 - + def util() = shift { k: (String => String) => "7" } - + def main(args: Array[String]): Unit = { test { shift { k: (Int => String) => 9 } } test { shift { k: (Int => String) => 9 }; 2 } @@ -29,5 +29,5 @@ object Test { test3 { { test3(0); 2 } } } - + } diff --git a/test/files/continuations-run/match0.scala b/test/files/continuations-run/match0.scala index 63b73bf21e..8769ed9fcb 100644 --- a/test/files/continuations-run/match0.scala +++ b/test/files/continuations-run/match0.scala @@ -4,15 +4,15 @@ import scala.util.continuations._ object Test { - + def test(x:Int) = x match { case 7 => shift { k: (Int=>Int) => k(k(k(x))) } case 8 => shift { k: (Int=>Int) => k(x) } } - + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } - + } diff --git a/test/files/continuations-run/match1.scala b/test/files/continuations-run/match1.scala index 62d639ee72..b89fb706b0 100644 --- a/test/files/continuations-run/match1.scala +++ b/test/files/continuations-run/match1.scala @@ -4,15 +4,15 @@ import scala.util.continuations._ object Test { - + def test(x:Int) = x match { case 7 => shift { k: (Int=>Int) => k(k(k(x))) } case _ => x } - + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } - + } diff --git a/test/files/continuations-run/match2.scala b/test/files/continuations-run/match2.scala index 5092ce3abe..002d9b52dd 100644 --- a/test/files/continuations-run/match2.scala +++ b/test/files/continuations-run/match2.scala @@ -4,23 +4,23 @@ import scala.util.continuations._ object Test { - + def test1() = { val (a, b) = shift { k: (((String,String)) => String) => k("A","B") } b } case class Elem[T,U](a: T, b: U) - + def test2() = { val Elem(a,b) = shift { k: (Elem[String,String] => String) => k(Elem("A","B")) } b } - + def main(args: Array[String]): Unit = { println(reset(test1())) println(reset(test2())) } - + }
\ No newline at end of file diff --git a/test/files/continuations-run/patvirt.scala b/test/files/continuations-run/patvirt.scala index 7d769d46fe..cfbdda538d 100644 --- a/test/files/continuations-run/patvirt.scala +++ b/test/files/continuations-run/patvirt.scala @@ -2,11 +2,11 @@ import scala.util.continuations._ object Test { def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1)))) - + def test(x1: Int) = { val o7 = { val o6 = { - val o3 = + val o3 = if (7 == x1) Some(x1) else None diff --git a/test/files/continuations-run/t3199.scala b/test/files/continuations-run/t3199.scala index 7b54793e05..2cb73c005a 100644 --- a/test/files/continuations-run/t3199.scala +++ b/test/files/continuations-run/t3199.scala @@ -1,20 +1,20 @@ -import _root_.scala.collection.Seq -import _root_.scala.util.control.Exception -import _root_.scala.util.continuations._ - -object Test { - - trait AbstractResource[+R <: AnyRef] { - def reflect[B] : R @cpsParam[B,Either[Throwable, B]] = shift(acquireFor) - def acquireFor[B](f : R => B) : Either[Throwable, B] = { - import Exception._ - catching(List(classOf[Throwable]) : _*) either (f(null.asInstanceOf[R])) - } - } - - def main(args: Array[String]) : Unit = { - val x = new AbstractResource[String] { } - val result = x.acquireFor( x => 7 ) - println(result) - } - } +import _root_.scala.collection.Seq +import _root_.scala.util.control.Exception +import _root_.scala.util.continuations._ + +object Test { + + trait AbstractResource[+R <: AnyRef] { + def reflect[B] : R @cpsParam[B,Either[Throwable, B]] = shift(acquireFor) + def acquireFor[B](f : R => B) : Either[Throwable, B] = { + import Exception._ + catching(List(classOf[Throwable]) : _*) either (f(null.asInstanceOf[R])) + } + } + + def main(args: Array[String]) : Unit = { + val x = new AbstractResource[String] { } + val result = x.acquireFor( x => 7 ) + println(result) + } + } diff --git a/test/files/continuations-run/t3199b.scala b/test/files/continuations-run/t3199b.scala index fe1ecafe72..5010f2b085 100644 --- a/test/files/continuations-run/t3199b.scala +++ b/test/files/continuations-run/t3199b.scala @@ -1,11 +1,11 @@ object Test { - + def test() = { java.util.Arrays.asList(Array(1,2,3):_*) } - + def main(args: Array[String]) { println(test()) } - + } diff --git a/test/files/continuations-run/t3223.scala b/test/files/continuations-run/t3223.scala index fda61f41ea..75613fe5c7 100644 --- a/test/files/continuations-run/t3223.scala +++ b/test/files/continuations-run/t3223.scala @@ -2,16 +2,16 @@ import scala.util.continuations._ object Test { def foo(x:Int) = { - try { + try { throw new Exception shiftUnit0[Int,Int](7) } catch { - case ex: Throwable => + case ex: Throwable => val g = (a:Int)=>a 9 } } - + def main(args: Array[String]) { println(reset(foo(0))) } diff --git a/test/files/continuations-run/t3225.scala b/test/files/continuations-run/t3225.scala index bc6d635c88..a0c9c91985 100644 --- a/test/files/continuations-run/t3225.scala +++ b/test/files/continuations-run/t3225.scala @@ -31,10 +31,10 @@ object Test { } def blaX[A] = shift { k:(Bla=>A) => k(new Bla) } - + def fooX[A] = blaX[A].x def fooY[A] = blaX[A].y[A] - + def testPoly() = { println(reset(blaX[Bla]).x) println(reset(blaX[Int].x)) @@ -52,5 +52,5 @@ object Test { testMono() testPoly() } - + } diff --git a/test/files/continuations-run/t5314-2.scala b/test/files/continuations-run/t5314-2.scala index 8a896dec2c..e7e5d46f03 100644 --- a/test/files/continuations-run/t5314-2.scala +++ b/test/files/continuations-run/t5314-2.scala @@ -1,15 +1,15 @@ import scala.util.continuations._ -class ReturnRepro { - def s1: Int @cps[Any] = shift { k => k(5) } +class ReturnRepro { + def s1: Int @cps[Any] = shift { k => k(5) } def caller = reset { println(p(3)) } def caller2 = reset { println(p2(3)) } def caller3 = reset { println(p3(3)) } - def p(i: Int): Int @cps[Any] = { - val v= s1 + 3 - return v - } + def p(i: Int): Int @cps[Any] = { + val v= s1 + 3 + return v + } def p2(i: Int): Int @cps[Any] = { val v = s1 + 3 diff --git a/test/files/continuations-run/t5314-3.scala b/test/files/continuations-run/t5314-3.scala index 62c547f5a2..c2fe8f6f87 100644 --- a/test/files/continuations-run/t5314-3.scala +++ b/test/files/continuations-run/t5314-3.scala @@ -1,14 +1,14 @@ import scala.util.continuations._ -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } +class ReturnRepro { + def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } def caller = reset { println(p(3)) } def caller2 = reset { println(p2(3)) } - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 + def p(i: Int): Int @cpsParam[Unit, Any] = { + val v= s1 + 3 return { println("enter return expr"); v } - } + } def p2(i: Int): Int @cpsParam[Unit, Any] = { val v = s1 + 3 diff --git a/test/files/continuations-run/t5314.scala b/test/files/continuations-run/t5314.scala index d611016ce4..e448d8558d 100644 --- a/test/files/continuations-run/t5314.scala +++ b/test/files/continuations-run/t5314.scala @@ -1,14 +1,14 @@ import scala.util.continuations._ -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } +class ReturnRepro { + def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } def caller = reset { println(p(3)) } def caller2 = reset { println(p2(3)) } - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - return v - } + def p(i: Int): Int @cpsParam[Unit, Any] = { + val v= s1 + 3 + return v + } def p2(i: Int): Int @cpsParam[Unit, Any] = { val v = s1 + 3 @@ -38,7 +38,7 @@ object Test extends App { println(reset { bar3(10) }) println(reset { bar4(10) }) println(reset { bar5(10) }) - + /* original test case */ val repro = new ReturnRepro repro.caller diff --git a/test/files/continuations-run/t5472.check b/test/files/continuations-run/t5472.check index 3192c746eb..1af7767f6d 100644 --- a/test/files/continuations-run/t5472.check +++ b/test/files/continuations-run/t5472.check @@ -5,7 +5,7 @@ t5472.scala:12: warning: expression case4(){ case5() } is cps-transformed unexpectedly (location, accessors) <- new ContinuationizedParallelIterable(map) - ^ + ^ t5472.scala:12: warning: expression matchEnd3(x: Int){ x } is cps-transformed unexpectedly diff --git a/test/files/continuations-run/t5506.scala b/test/files/continuations-run/t5506.scala index 4b3703c725..08f64c9db1 100644 --- a/test/files/continuations-run/t5506.scala +++ b/test/files/continuations-run/t5506.scala @@ -4,11 +4,11 @@ object Test { def g: List[Int] @suspendable = List(1,2,3) -def fp10: List[Int] @suspendable = { +def fp10: List[Int] @suspendable = { g.map(x => x) } -def fp11: List[Int] @suspendable = { +def fp11: List[Int] @suspendable = { val z = g.map(x => x) z } @@ -47,7 +47,7 @@ def main(args: Array[String]) { println(fp10) println(fp11) println(fp12) - + println(fp20) println(fp21) println(fp22) diff --git a/test/files/continuations-run/t5538.scala b/test/files/continuations-run/t5538.scala index 6713cecf2f..9f01624da1 100644 --- a/test/files/continuations-run/t5538.scala +++ b/test/files/continuations-run/t5538.scala @@ -16,13 +16,13 @@ object Test { class PromiseStream[A] { override def toString = xs.toString - + var xs: List[A] = Nil - + final def +=(elem: A): this.type = { xs :+= elem; this } final def ++=(elem: Traversable[A]): this.type = { xs ++= elem; this } - + final def <<(elem: Future[A]): PromiseStream[A] @cps[Future[Any]] = shift { cont: (PromiseStream[A] => Future[Any]) => elem map (a => cont(this += a)) } @@ -40,7 +40,7 @@ object Test { def sequence[A, M[_] <: Traversable[_]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]] = new Future(in.asInstanceOf[Traversable[Future[A]]].map((f:Future[A])=>f.x)(cbf.asInstanceOf[CanBuildFrom[Traversable[Future[A]], A, M[A]]])) - + def flow[A](body: => A @cps[Future[Any]])(implicit executor: ExecutionContext): Future[A] = reset(Future(body)).asInstanceOf[Future[A]] } diff --git a/test/files/continuations-run/trycatch0.scala b/test/files/continuations-run/trycatch0.scala index feb7f7182b..d0b4a52a30 100644 --- a/test/files/continuations-run/trycatch0.scala +++ b/test/files/continuations-run/trycatch0.scala @@ -3,7 +3,7 @@ import scala.util.continuations._ object Test { - + def foo = try { shift((k: Int=>Int) => k(7)) } catch { @@ -17,7 +17,7 @@ object Test { case ex: Throwable => shiftUnit0[Int,Int](9) } - + def main(args: Array[String]): Unit = { println(reset { foo + 3 }) println(reset { bar + 3 }) diff --git a/test/files/continuations-run/trycatch1.scala b/test/files/continuations-run/trycatch1.scala index b00a87d059..2a8db72a8b 100644 --- a/test/files/continuations-run/trycatch1.scala +++ b/test/files/continuations-run/trycatch1.scala @@ -5,7 +5,7 @@ import scala.util.continuations._ object Test { def fatal: Int = throw new Exception() - + def foo1 = try { fatal shift((k: Int=>Int) => k(7)) diff --git a/test/files/continuations-run/while0.scala b/test/files/continuations-run/while0.scala index 542408fb24..e21745374e 100644 --- a/test/files/continuations-run/while0.scala +++ b/test/files/continuations-run/while0.scala @@ -4,9 +4,9 @@ import scala.util.continuations._ object Test { - + def foo(): Int @cps[Unit] = 2 - + def test(): Unit @cps[Unit] = { var x = 0 while (x < 9000) { // pick number large enough to require tail-call opt @@ -18,5 +18,5 @@ object Test { def main(args: Array[String]): Unit = { reset(test()) } - + } diff --git a/test/files/continuations-run/while1.scala b/test/files/continuations-run/while1.scala index 351d52c27a..7ba9f94881 100644 --- a/test/files/continuations-run/while1.scala +++ b/test/files/continuations-run/while1.scala @@ -4,9 +4,9 @@ import scala.util.continuations._ object Test { - + def foo(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") } - + def test(): Unit @cps[Unit] = { var x = 0 while (x < 9) { @@ -18,5 +18,5 @@ object Test { def main(args: Array[String]): Unit = { reset(test()) } - + } diff --git a/test/files/continuations-run/while2.scala b/test/files/continuations-run/while2.scala index f4991dea61..3dbf2ad2fe 100644 --- a/test/files/continuations-run/while2.scala +++ b/test/files/continuations-run/while2.scala @@ -4,10 +4,10 @@ import scala.util.continuations._ object Test { - + def foo1(): Int @cps[Unit] = 2 def foo2(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") } - + def test(): Unit @cps[Unit] = { var x = 0 while (x < 9000) { // pick number large enough to require tail-call opt @@ -19,5 +19,5 @@ object Test { def main(args: Array[String]): Unit = { reset(test()) } - + } diff --git a/test/files/disabled/run/t4602.scala b/test/files/disabled/run/t4602.scala index 73ba231ccf..655c350497 100644 --- a/test/files/disabled/run/t4602.scala +++ b/test/files/disabled/run/t4602.scala @@ -4,7 +4,7 @@ import java.util.concurrent.{CountDownLatch, TimeUnit} object Test extends App { val startupLatch = new CountDownLatch(1) - // we have to explicitly launch our server because when the client launches a server it uses + // we have to explicitly launch our server because when the client launches a server it uses // the "scala" shell command meaning whatever version of scala (and whatever version of libraries) // happens to be in the path gets used val t = new Thread(new Runnable { @@ -18,10 +18,10 @@ object Test extends App { sys error "Timeout waiting for server to start" val baos = new ByteArrayOutputStream() - val ps = new PrintStream(baos) + val ps = new PrintStream(baos) val outdir = scala.reflect.io.Directory(sys.props("partest.output")) - + val dirNameAndPath = (1 to 2).toList map {number => val name = s"Hello${number}" val dir = outdir / number.toString @@ -32,9 +32,9 @@ object Test extends App { dir.createDirectory() val file = path.jfile val out = new FileWriter(file) - try + try out.write(s"object ${name}\n") - finally + finally out.close } @@ -50,7 +50,7 @@ object Test extends App { val msg = baos.toString() assert(success, s"got a failure. Full results were: \n${msg}") - dirNameAndPath foreach {case (_, _, path) => + dirNameAndPath foreach {case (_, _, path) => val expected = s"Input files after normalizing paths: ${path}" assert(msg contains expected, s"could not find '${expected}' in output. Full results were: \n${msg}") } diff --git a/test/files/jvm/actor-sync-send-timeout.scala b/test/files/jvm/actor-sync-send-timeout.scala index 42e0be4a8c..66a0b0a6ff 100644 --- a/test/files/jvm/actor-sync-send-timeout.scala +++ b/test/files/jvm/actor-sync-send-timeout.scala @@ -5,7 +5,7 @@ import scala.actors.Actor /* This test is a regression test for SI-4759. */ val Runs = 5 - + def main(args: Array[String]) = { var i = 0 while (i < Runs) { diff --git a/test/files/jvm/actor-uncaught-exception.scala b/test/files/jvm/actor-uncaught-exception.scala index 5285b7519f..c28ad2fa3c 100644 --- a/test/files/jvm/actor-uncaught-exception.scala +++ b/test/files/jvm/actor-uncaught-exception.scala @@ -7,58 +7,58 @@ class MyException(msg: String) extends Exception(msg) { } - case object StartError extends Actor { - def act() { + case object StartError extends Actor { + def act() { try { - throw new MyException("I don't want to run!") + throw new MyException("I don't want to run!") } catch { case e: Throwable if (!e.isInstanceOf[scala.util.control.ControlThrowable] && !e.isInstanceOf[MyException]) => e.printStackTrace() } - } - } + } + } - case object MessageError extends Actor { - def act() { + case object MessageError extends Actor { + def act() { try { - react { - case _ => throw new MyException("No message for me!") - } + react { + case _ => throw new MyException("No message for me!") + } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } - } + } + } - case object Supervisor extends Actor { - def act() { + case object Supervisor extends Actor { + def act() { try { - trapExit = true + trapExit = true link(StartError) link(MessageError) - StartError.start() + StartError.start() MessageError.start() - Actor.loop { - react { + Actor.loop { + react { case Exit(actor, reason) => println("OK") if (actor == StartError) MessageError ! 'ping else exit() - } - } + } + } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } - } + } + } - def main(args: Array[String]) { - Supervisor.start() - } -} + def main(args: Array[String]) { + Supervisor.start() + } +} diff --git a/test/files/jvm/actor-uncaught-exception2.scala b/test/files/jvm/actor-uncaught-exception2.scala index f56217c187..8327b4e19d 100644 --- a/test/files/jvm/actor-uncaught-exception2.scala +++ b/test/files/jvm/actor-uncaught-exception2.scala @@ -6,58 +6,58 @@ class MyException(msg: String) extends Exception(msg) { override def fillInStackTrace() = this } - case object StartError extends Actor { - def act() { + case object StartError extends Actor { + def act() { try { - throw new MyException("I don't want to run!") + throw new MyException("I don't want to run!") } catch { case e: Throwable if (!e.isInstanceOf[scala.util.control.ControlThrowable] && !e.isInstanceOf[MyException]) => e.printStackTrace() } - } - } + } + } - case object MessageError extends Actor { - def act() { + case object MessageError extends Actor { + def act() { try { - react { - case _ => throw new MyException("No message for me!") - } + react { + case _ => throw new MyException("No message for me!") + } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } - } + } + } - case object Supervisor extends Actor { - def act() { + case object Supervisor extends Actor { + def act() { try { - trapExit = true + trapExit = true link(StartError) link(MessageError) - StartError.start() + StartError.start() MessageError.start() - Actor.loop { - react { + Actor.loop { + react { case Exit(actor, reason) => println(reason) if (actor == StartError) MessageError ! 'ping else exit() - } - } + } + } } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } - } + } + } - def main(args: Array[String]) { - Supervisor.start() - } -} + def main(args: Array[String]) { + Supervisor.start() + } +} diff --git a/test/files/jvm/console.scala b/test/files/jvm/console.scala index 75449416aa..0ac43f2d26 100644 --- a/test/files/jvm/console.scala +++ b/test/files/jvm/console.scala @@ -9,6 +9,6 @@ object Test extends App { flush println("..") println(1) - printf("Argument nr. %d has value %1.2f\n", + printf("Argument nr. %d has value %1.2f\n", 1, 10.0/3) } diff --git a/test/files/jvm/constant-optimization/Test.scala b/test/files/jvm/constant-optimization/Test.scala index 283aa6f47a..dc0f8f6103 100644 --- a/test/files/jvm/constant-optimization/Test.scala +++ b/test/files/jvm/constant-optimization/Test.scala @@ -6,7 +6,7 @@ import scala.collection.JavaConverters._ object Test extends BytecodeTest { val comparisons = Set(asm.Opcodes.IF_ACMPEQ, asm.Opcodes.IF_ACMPNE, asm.Opcodes.IF_ICMPEQ, asm.Opcodes.IF_ICMPGE, asm.Opcodes.IF_ICMPGT, asm.Opcodes.IF_ICMPLE, - asm.Opcodes.IF_ICMPLT, asm.Opcodes.IF_ICMPNE, asm.Opcodes.IFEQ, asm.Opcodes.IFGE, asm.Opcodes.IFGT, asm.Opcodes.IFLE, asm.Opcodes.IFLT, + asm.Opcodes.IF_ICMPLT, asm.Opcodes.IF_ICMPNE, asm.Opcodes.IFEQ, asm.Opcodes.IFGE, asm.Opcodes.IFGT, asm.Opcodes.IFLE, asm.Opcodes.IFLT, asm.Opcodes.IFNE, asm.Opcodes.IFNONNULL, asm.Opcodes.IFNULL) def show: Unit = { diff --git a/test/files/jvm/deprecation/Test_1.scala b/test/files/jvm/deprecation/Test_1.scala index b68a40c94b..0a5b607037 100644 --- a/test/files/jvm/deprecation/Test_1.scala +++ b/test/files/jvm/deprecation/Test_1.scala @@ -7,7 +7,7 @@ class Test { val i = new d.Inner val w = i.buz() } - + @deprecated("no longer!", "") class Inner { @deprecated("uncool", "") def f: Int = 1 @deprecated("this one as well!", "") var g = -1 diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala index 7deb4929d4..5d213691df 100644 --- a/test/files/jvm/future-spec/FutureTests.scala +++ b/test/files/jvm/future-spec/FutureTests.scala @@ -13,15 +13,15 @@ import scala.util.{Try,Success,Failure} object FutureTests extends MinimalScalaTest { /* some utils */ - + def testAsync(s: String)(implicit ec: ExecutionContext): Future[String] = s match { case "Hello" => future { "World" } case "Failure" => Future.failed(new RuntimeException("Expected exception; to test fault-tolerance")) case "NoReply" => Promise[String]().future } - + val defaultTimeout = 5 seconds - + /* future specification */ "A future with custom ExecutionContext" should { @@ -31,41 +31,41 @@ object FutureTests extends MinimalScalaTest { t => ms += t }) - + class ThrowableTest(m: String) extends Throwable(m) - + val f1 = future[Any] { throw new ThrowableTest("test") } - + intercept[ThrowableTest] { Await.result(f1, defaultTimeout) } - + val latch = new TestLatch val f2 = future { Await.ready(latch, 5 seconds) "success" } val f3 = f2 map { s => s.toUpperCase } - + f2 foreach { _ => throw new ThrowableTest("dispatcher foreach") } f2 onSuccess { case _ => throw new ThrowableTest("dispatcher receive") } - + latch.open() - + Await.result(f2, defaultTimeout) mustBe ("success") - + f2 foreach { _ => throw new ThrowableTest("current thread foreach") } f2 onSuccess { case _ => throw new ThrowableTest("current thread receive") } - + Await.result(f3, defaultTimeout) mustBe ("SUCCESS") - + val waiting = future { Thread.sleep(1000) } Await.ready(waiting, 2000 millis) - + ms.size mustBe (4) //FIXME should check } @@ -110,24 +110,24 @@ object FutureTests extends MinimalScalaTest { val future0 = future[Any] { "five!".length } - + val future1 = for { a <- future0.mapTo[Int] // returns 5 b <- async(a) // returns "10" c <- async(7) // returns "14" } yield b + "-" + c - + val future2 = for { a <- future0.mapTo[Int] b <- (future { (a * 2).toString }).mapTo[Int] - c <- future { (7 * 2).toString } + c <- future { (7 * 2).toString } } yield b + "-" + c - + Await.result(future1, defaultTimeout) mustBe ("10-14") assert(checkType(future1, manifest[String])) intercept[ClassCastException] { Await.result(future2, defaultTimeout) } } - + "support pattern matching within a for-comprehension" in { case class Req[T](req: T) case class Res[T](res: T) @@ -135,44 +135,44 @@ object FutureTests extends MinimalScalaTest { case Req(s: String) => future { Res(s.length) } case Req(i: Int) => future { Res((i * 2).toString) } } - + val future1 = for { Res(a: Int) <- async(Req("Hello")) Res(b: String) <- async(Req(a)) Res(c: String) <- async(Req(7)) } yield b + "-" + c - + val future2 = for { Res(a: Int) <- async(Req("Hello")) Res(b: Int) <- async(Req(a)) Res(c: Int) <- async(Req(7)) } yield b + "-" + c - + Await.result(future1, defaultTimeout) mustBe ("10-14") intercept[NoSuchElementException] { Await.result(future2, defaultTimeout) } } - + "recover from exceptions" in { val future1 = Future(5) val future2 = future1 map (_ / 0) val future3 = future2 map (_.toString) - + val future4 = future1 recover { case e: ArithmeticException => 0 } map (_.toString) - + val future5 = future2 recover { case e: ArithmeticException => 0 } map (_.toString) - + val future6 = future2 recover { case e: MatchError => 0 } map (_.toString) - + val future7 = future3 recover { case e: ArithmeticException => "You got ERROR" } - + val future8 = testAsync("Failure") val future9 = testAsync("Failure") recover { case e: RuntimeException => "FAIL!" @@ -183,7 +183,7 @@ object FutureTests extends MinimalScalaTest { val future11 = testAsync("Failure") recover { case _ => "Oops!" } - + Await.result(future1, defaultTimeout) mustBe (5) intercept[ArithmeticException] { Await.result(future2, defaultTimeout) } intercept[ArithmeticException] { Await.result(future3, defaultTimeout) } @@ -196,23 +196,23 @@ object FutureTests extends MinimalScalaTest { Await.result(future10, defaultTimeout) mustBe ("World") Await.result(future11, defaultTimeout) mustBe ("Oops!") } - + "recoverWith from exceptions" in { val o = new IllegalStateException("original") val r = new IllegalStateException("recovered") - + intercept[IllegalStateException] { val failed = Future.failed[String](o) recoverWith { case _ if false == true => Future.successful("yay!") } Await.result(failed, defaultTimeout) } mustBe (o) - + val recovered = Future.failed[String](o) recoverWith { case _ => Future.successful("yay!") } Await.result(recovered, defaultTimeout) mustBe ("yay!") - + intercept[IllegalStateException] { val refailed = Future.failed[String](o) recoverWith { case _ => Future.failed[String](r) @@ -220,7 +220,7 @@ object FutureTests extends MinimalScalaTest { Await.result(refailed, defaultTimeout) } mustBe (r) } - + "andThen like a boss" in { val q = new java.util.concurrent.LinkedBlockingQueue[Int] for (i <- 1 to 1000) { @@ -240,28 +240,28 @@ object FutureTests extends MinimalScalaTest { q.clear() } } - + "firstCompletedOf" in { def futures = Vector.fill[Future[Int]](10) { Promise[Int]().future } :+ Future.successful[Int](5) - + Await.result(Future.firstCompletedOf(futures), defaultTimeout) mustBe (5) Await.result(Future.firstCompletedOf(futures.iterator), defaultTimeout) mustBe (5) } - + "find" in { val futures = for (i <- 1 to 10) yield future { i } - + val result = Future.find[Int](futures)(_ == 3) Await.result(result, defaultTimeout) mustBe (Some(3)) val notFound = Future.find[Int](futures.iterator)(_ == 11) Await.result(notFound, defaultTimeout) mustBe (None) } - + "zip" in { val timeout = 10000 millis val f = new IllegalStateException("test") @@ -269,48 +269,48 @@ object FutureTests extends MinimalScalaTest { val failed = Future.failed[String](f) zip Future.successful("foo") Await.result(failed, timeout) } mustBe (f) - + intercept[IllegalStateException] { val failed = Future.successful("foo") zip Future.failed[String](f) Await.result(failed, timeout) } mustBe (f) - + intercept[IllegalStateException] { val failed = Future.failed[String](f) zip Future.failed[String](f) Await.result(failed, timeout) } mustBe (f) - + val successful = Future.successful("foo") zip Future.successful("foo") Await.result(successful, timeout) mustBe (("foo", "foo")) } - + "fold" in { val timeout = 10000 millis def async(add: Int, wait: Int) = future { Thread.sleep(wait) add } - + val futures = (0 to 9) map { idx => async(idx, idx * 20) } val folded = Future.fold(futures)(0)(_ + _) Await.result(folded, timeout) mustBe (45) - + val futuresit = (0 to 9) map { idx => async(idx, idx * 20) } val foldedit = Future.fold(futures)(0)(_ + _) Await.result(foldedit, timeout) mustBe (45) } - + "fold by composing" in { val timeout = 10000 millis def async(add: Int, wait: Int) = future { Thread.sleep(wait) add } - def futures = (0 to 9) map { + def futures = (0 to 9) map { idx => async(idx, idx * 20) } val folded = futures.foldLeft(Future(0)) { @@ -318,7 +318,7 @@ object FutureTests extends MinimalScalaTest { } Await.result(folded, timeout) mustBe (45) } - + "fold with an exception" in { val timeout = 10000 millis def async(add: Int, wait: Int) = future { @@ -334,7 +334,7 @@ object FutureTests extends MinimalScalaTest { Await.result(folded, timeout) }.getMessage mustBe ("shouldFoldResultsWithException: expected") } - + "fold mutable zeroes safely" in { import scala.collection.mutable.ArrayBuffer def test(testNumber: Int) { @@ -344,34 +344,34 @@ object FutureTests extends MinimalScalaTest { case (l, _) => l } val result = Await.result(f.mapTo[ArrayBuffer[Int]], 10000 millis).sum - + assert(result == 250500) } (1 to 100) foreach test //Make sure it tries to provoke the problem } - + "return zero value if folding empty list" in { val zero = Future.fold(List[Future[Int]]())(0)(_ + _) Await.result(zero, defaultTimeout) mustBe (0) } - + "shouldReduceResults" in { def async(idx: Int) = future { Thread.sleep(idx * 20) idx } val timeout = 10000 millis - + val futures = (0 to 9) map { async } val reduced = Future.reduce(futures)(_ + _) Await.result(reduced, timeout) mustBe (45) - + val futuresit = (0 to 9) map { async } val reducedit = Future.reduce(futuresit)(_ + _) Await.result(reducedit, timeout) mustBe (45) } - + "shouldReduceResultsWithException" in { def async(add: Int, wait: Int) = future { Thread.sleep(wait) @@ -387,14 +387,14 @@ object FutureTests extends MinimalScalaTest { Await.result(failed, timeout) }.getMessage mustBe ("shouldFoldResultsWithException: expected") } - + "shouldReduceThrowNSEEOnEmptyInput" in { intercept[java.util.NoSuchElementException] { val emptyreduced = Future.reduce(List[Future[Int]]())(_ + _) Await.result(emptyreduced, defaultTimeout) } } - + "shouldTraverseFutures" in { object counter { var count = -1 @@ -403,23 +403,23 @@ object FutureTests extends MinimalScalaTest { count } } - + val oddFutures = List.fill(100)(future { counter.incAndGet() }).iterator val traversed = Future.sequence(oddFutures) Await.result(traversed, defaultTimeout).sum mustBe (10000) - + val list = (1 to 100).toList val traversedList = Future.traverse(list)(x => Future(x * 2 - 1)) Await.result(traversedList, defaultTimeout).sum mustBe (10000) - + val iterator = (1 to 100).toList.iterator val traversedIterator = Future.traverse(iterator)(x => Future(x * 2 - 1)) Await.result(traversedIterator, defaultTimeout).sum mustBe (10000) } - + "shouldBlockUntilResult" in { val latch = new TestLatch - + val f = future { Await.ready(latch, 5 seconds) 5 @@ -428,28 +428,28 @@ object FutureTests extends MinimalScalaTest { val res = Await.result(f, Inf) res + 9 } - + intercept[TimeoutException] { Await.ready(f2, 100 millis) } - + latch.open() - + Await.result(f2, defaultTimeout) mustBe (14) - + val f3 = future { Thread.sleep(100) 5 } - + intercept[TimeoutException] { Await.ready(f3, 0 millis) } } - + "run callbacks async" in { val latch = Vector.fill(10)(new TestLatch) - + val f1 = future { latch(0).open() Await.ready(latch(1), TestLatch.DefaultTimeout) @@ -462,18 +462,18 @@ object FutureTests extends MinimalScalaTest { s.length } for (_ <- f2) latch(4).open() - + Await.ready(latch(0), TestLatch.DefaultTimeout) - + f1.isCompleted mustBe (false) f2.isCompleted mustBe (false) - + latch(1).open() Await.ready(latch(2), TestLatch.DefaultTimeout) - + f1.isCompleted mustBe (true) f2.isCompleted mustBe (false) - + val f3 = f1 map { s => latch(5).open() @@ -481,17 +481,17 @@ object FutureTests extends MinimalScalaTest { s.length * 2 } for (_ <- f3) latch(3).open() - + Await.ready(latch(5), TestLatch.DefaultTimeout) - + f3.isCompleted mustBe (false) - + latch(6).open() Await.ready(latch(4), TestLatch.DefaultTimeout) - + f2.isCompleted mustBe (true) f3.isCompleted mustBe (true) - + val p1 = Promise[String]() val f4 = p1.future map { s => @@ -500,23 +500,23 @@ object FutureTests extends MinimalScalaTest { s.length } for (_ <- f4) latch(9).open() - + p1.future.isCompleted mustBe (false) f4.isCompleted mustBe (false) - + p1 complete Success("Hello") - + Await.ready(latch(7), TestLatch.DefaultTimeout) - + p1.future.isCompleted mustBe (true) f4.isCompleted mustBe (false) - + latch(8).open() Await.ready(latch(9), TestLatch.DefaultTimeout) - + Await.ready(f4, defaultTimeout).isCompleted mustBe (true) } - + "should not deadlock with nested await (ticket 1313)" in { val simple = Future() map { _ => @@ -525,7 +525,7 @@ object FutureTests extends MinimalScalaTest { Await.result(umap, Inf) } Await.ready(simple, Inf).isCompleted mustBe (true) - + val l1, l2 = new TestLatch val complex = Future() map { _ => @@ -545,9 +545,9 @@ object FutureTests extends MinimalScalaTest { val f = future(5).map(_ / 0) Await.ready(f, defaultTimeout).value.get.toString mustBe expected.toString } - + } - + } diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala index 8e07393900..6e613bf3ec 100644 --- a/test/files/jvm/future-spec/PromiseTests.scala +++ b/test/files/jvm/future-spec/PromiseTests.scala @@ -13,29 +13,29 @@ object PromiseTests extends MinimalScalaTest { import ExecutionContext.Implicits._ val defaultTimeout = Inf - + /* promise specification */ - + "An empty Promise" should { - + "not be completed" in { val p = Promise() p.future.isCompleted mustBe (false) p.isCompleted mustBe (false) } - + "have no value" in { val p = Promise() p.future.value mustBe (None) p.isCompleted mustBe (false) } - + "return supplied value on timeout" in { val failure = Promise.failed[String](new RuntimeException("br0ken")).future val otherFailure = Promise.failed[String](new RuntimeException("last")).future val empty = Promise[String]().future val timedOut = Promise.successful[String]("Timedout").future - + Await.result(failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout") Await.result(timedOut fallbackTo empty, defaultTimeout) mustBe ("Timedout") Await.result(failure fallbackTo failure fallbackTo timedOut, defaultTimeout) mustBe ("Timedout") @@ -43,47 +43,47 @@ object PromiseTests extends MinimalScalaTest { Await.result(failure fallbackTo otherFailure, defaultTimeout) }.getMessage mustBe ("last") } - + } - + "A successful Promise" should { val result = "test value" val promise = Promise[String]().complete(Success(result)) promise.isCompleted mustBe (true) futureWithResult(_(promise.future, result)) } - + "A failed Promise" should { val message = "Expected Exception" val promise = Promise[String]().complete(Failure(new RuntimeException(message))) promise.isCompleted mustBe (true) futureWithException[RuntimeException](_(promise.future, message)) } - + "An interrupted Promise" should { val message = "Boxed InterruptedException" val future = Promise[String]().complete(Failure(new InterruptedException(message))).future futureWithException[ExecutionException](_(future, message)) } - + "A NonLocalReturnControl failed Promise" should { val result = "test value" val future = Promise[String]().complete(Failure(new NonLocalReturnControl[String]("test", result))).future futureWithResult(_(future, result)) } - + def futureWithResult(f: ((Future[Any], Any) => Unit) => Unit) { - + "be completed" in { f((future, _) => future.isCompleted mustBe (true)) } - + "contain a value" in { f((future, result) => future.value mustBe (Some(Success(result)))) } - + "return when ready with 'Await.ready'" in { f((future, result) => Await.ready(future, defaultTimeout).isCompleted mustBe (true)) } - + "return result with 'Await.result'" in { f((future, result) => Await.result(future, defaultTimeout) mustBe (result)) } - + "not timeout" in { f((future, _) => Await.ready(future, 0 millis)) } - + "filter result" in { f { (future, result) => @@ -93,16 +93,16 @@ object PromiseTests extends MinimalScalaTest { } } } - + "transform result with map" in { f((future, result) => Await.result((future map (_.toString.length)), defaultTimeout) mustBe (result.toString.length)) } - + "compose result with flatMap" in { f { (future, result) => val r = for (r <- future; p <- Promise.successful("foo").future) yield r.toString + p Await.result(r, defaultTimeout) mustBe (result.toString + "foo") } } - + "perform action with foreach" in { f { (future, result) => @@ -111,7 +111,7 @@ object PromiseTests extends MinimalScalaTest { Await.result(p.future, defaultTimeout) mustBe (result) } } - + "zip properly" in { f { (future, result) => @@ -121,9 +121,9 @@ object PromiseTests extends MinimalScalaTest { }.getMessage mustBe ("ohnoes") } } - + "not recover from exception" in { f((future, result) => Await.result(future.recover({ case _ => "pigdog" }), defaultTimeout) mustBe (result)) } - + "perform action on result" in { f { (future, result) => @@ -132,7 +132,7 @@ object PromiseTests extends MinimalScalaTest { Await.result(p.future, defaultTimeout) mustBe (result) } } - + "not project a failure" in { f { (future, result) => @@ -141,34 +141,34 @@ object PromiseTests extends MinimalScalaTest { }.getMessage mustBe ("Future.failed not completed with a throwable.") } } - + "cast using mapTo" in { f { (future, result) => Await.result(future.mapTo[Boolean].recover({ case _: ClassCastException ⇒ false }), defaultTimeout) mustBe (false) } } - + } def futureWithException[E <: Throwable: Manifest](f: ((Future[Any], String) => Unit) => Unit) { - + "be completed" in { f((future, _) => future.isCompleted mustBe (true)) } - + "contain a value" in { f((future, message) => { future.value.get.failed.get.getMessage mustBe (message) }) } - + "throw not throw exception with 'Await.ready'" in { f { (future, message) => Await.ready(future, defaultTimeout).isCompleted mustBe (true) } } - + "throw exception with 'Await.result'" in { f { (future, message) => @@ -177,7 +177,7 @@ object PromiseTests extends MinimalScalaTest { }.getMessage mustBe (message) } } - + "retain exception with filter" in { f { (future, message) => @@ -185,21 +185,21 @@ object PromiseTests extends MinimalScalaTest { intercept[E] { Await.result(future filter (_ => false), defaultTimeout) }.getMessage mustBe (message) } } - + "retain exception with map" in { f { (future, message) => intercept[E] { Await.result(future map (_.toString.length), defaultTimeout) }.getMessage mustBe (message) } } - + "retain exception with flatMap" in { f { (future, message) => intercept[E] { Await.result(future flatMap (_ => Promise.successful("foo").future), defaultTimeout) }.getMessage mustBe (message) } } - + "zip properly" in { f { (future, message) => @@ -208,18 +208,18 @@ object PromiseTests extends MinimalScalaTest { }.getMessage mustBe (message) } } - + "recover from exception" in { f { (future, message) => Await.result(future.recover({ case e if e.getMessage == message ⇒ "pigdog" }), defaultTimeout) mustBe ("pigdog") } } - + "project a failure" in { f((future, message) => Await.result(future.failed, defaultTimeout).getMessage mustBe (message)) } - + "perform action on exception" in { f { (future, message) => @@ -228,7 +228,7 @@ object PromiseTests extends MinimalScalaTest { Await.result(p.future, defaultTimeout) mustBe (message) } } - + "always cast successfully using mapTo" in { f { (future, message) => diff --git a/test/files/jvm/future-spec/main.scala b/test/files/jvm/future-spec/main.scala index e000431dda..132263e2e8 100644 --- a/test/files/jvm/future-spec/main.scala +++ b/test/files/jvm/future-spec/main.scala @@ -8,13 +8,13 @@ import java.util.concurrent.{ TimeoutException, CountDownLatch, TimeUnit } object Test { - + def main(args: Array[String]) { FutureTests.check() PromiseTests.check() TryTests.check() } - + } trait Features { @@ -26,7 +26,7 @@ trait Features { trait Output { val buffer = new StringBuilder - + def bufferPrintln(a: Any) = buffer.synchronized { buffer.append(a.toString + "\n") } @@ -34,20 +34,20 @@ trait Output { trait MinimalScalaTest extends Output with Features { - + val throwables = mutable.ArrayBuffer[Throwable]() - + def check() { if (throwables.nonEmpty) println(buffer.toString) } - + implicit def stringops(s: String) = new { - + def should[U](snippets: =>U) = { bufferPrintln(s + " should:") snippets } - + def in[U](snippet: =>U) = { try { bufferPrintln("- " + s) @@ -60,16 +60,16 @@ trait MinimalScalaTest extends Output with Features { throwables += e } } - + } - + implicit def objectops(obj: Any) = new { - + def mustBe(other: Any) = assert(obj == other, obj + " is not " + other) def mustEqual(other: Any) = mustBe(other) - + } - + def intercept[T <: Throwable: Manifest](body: =>Any): T = { try { body @@ -80,7 +80,7 @@ trait MinimalScalaTest extends Output with Features { else t.asInstanceOf[T] } } - + def checkType[T: Manifest, S](in: Future[T], refmanifest: Manifest[S]): Boolean = manifest[T] == refmanifest } @@ -94,23 +94,23 @@ object TestLatch { class TestLatch(count: Int = 1) extends Awaitable[Unit] { private var latch = new CountDownLatch(count) - + def countDown() = latch.countDown() def isOpen: Boolean = latch.getCount == 0 def open() = while (!isOpen) countDown() def reset() = latch = new CountDownLatch(count) - + @throws(classOf[TimeoutException]) def ready(atMost: Duration)(implicit permit: CanAwait) = { val opened = latch.await(atMost.toNanos, TimeUnit.NANOSECONDS) if (!opened) throw new TimeoutException("Timeout of %s." format (atMost.toString)) this } - + @throws(classOf[Exception]) def result(atMost: Duration)(implicit permit: CanAwait): Unit = { ready(atMost) } - + } diff --git a/test/files/jvm/future-termination.scala b/test/files/jvm/future-termination.scala index 668b3f74ba..90ea336ce8 100644 --- a/test/files/jvm/future-termination.scala +++ b/test/files/jvm/future-termination.scala @@ -1,21 +1,21 @@ - -/* Test that unevaluated futures do not prevent program termination */ - + +/* Test that unevaluated futures do not prevent program termination */ + @deprecated("Suppress warnings", since="2.11") -object Test { - import scala.actors.Futures - def main(args: Array[String]) { +object Test { + import scala.actors.Futures + def main(args: Array[String]) { try { - val meaningOfLife = Futures.future { - Thread.sleep(5000) // pretend this is a harder problem than it is - println("I have the answer!") - 42 - } - println("I can't wait that long, bye.") + val meaningOfLife = Futures.future { + Thread.sleep(5000) // pretend this is a harder problem than it is + println("I have the answer!") + 42 + } + println("I can't wait that long, bye.") } catch { case e: Throwable if !e.isInstanceOf[scala.util.control.ControlThrowable] => e.printStackTrace() } - } + } } diff --git a/test/files/jvm/inner.scala b/test/files/jvm/inner.scala index 009d52e5bc..c05e803449 100644 --- a/test/files/jvm/inner.scala +++ b/test/files/jvm/inner.scala @@ -14,7 +14,7 @@ class A { trait Itf { def method1(x: Int): Int - + trait Itf2 extends Itf { def method2: Unit } diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 44930c2932..6e5fada381 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> // basics scala> 3+4 @@ -301,7 +299,7 @@ scala> <a> c="c" d="dd" /></a> -res8: scala.xml.Elem = +res8: scala.xml.Elem = <a> <b c="c" d="dd"/></a> @@ -324,7 +322,7 @@ scala> """ hello there """ -res12: String = +res12: String = " hello there @@ -364,8 +362,6 @@ It would fail on the following inputs: Exp(), Term() f: (e: Exp)Int scala> - -scala> plusOne: (x: Int)Int res0: Int = 6 res0: String = after reset diff --git a/test/files/jvm/methvsfield.java b/test/files/jvm/methvsfield.java index c1b2b87b48..dadc98669a 100644 --- a/test/files/jvm/methvsfield.java +++ b/test/files/jvm/methvsfield.java @@ -1,11 +1,11 @@ // This should be compiled with javac and saved // in ../lib/methvsfield.jar . -class MethVsField +class MethVsField { int three = 3; - int three() - { + int three() + { return 3; } } diff --git a/test/files/jvm/natives.scala b/test/files/jvm/natives.scala index ba868dc85e..14ee4e1c1b 100644 --- a/test/files/jvm/natives.scala +++ b/test/files/jvm/natives.scala @@ -1,16 +1,16 @@ object Test { //println("java.library.path=" + System.getProperty("java.library.path")) - + val sysWordSize = System.getProperty("sun.arch.data.model", "32") val sysType = System.getProperty("os.name") - + val libName = if (sysType == "Mac OS X") "natives" else "natives-" + sysWordSize - + System.loadLibrary(libName) @native diff --git a/test/files/jvm/non-fatal-tests.scala b/test/files/jvm/non-fatal-tests.scala index 22c7cba51f..791b1d3100 100644 --- a/test/files/jvm/non-fatal-tests.scala +++ b/test/files/jvm/non-fatal-tests.scala @@ -9,7 +9,7 @@ trait NonFatalTests { new Exception, new Throwable, new NotImplementedError) - + //Fatals val fatals: Seq[Throwable] = Seq(new InterruptedException, diff --git a/test/files/jvm/nooptimise/Foo_1.scala b/test/files/jvm/nooptimise/Foo_1.scala index c6f1b06c8e..896d5695de 100644 --- a/test/files/jvm/nooptimise/Foo_1.scala +++ b/test/files/jvm/nooptimise/Foo_1.scala @@ -3,6 +3,6 @@ class Foo_1 { // optimization will remove this magic 3 from appearing in the source // so -Ynooptimize should prevent that val x = 3 - + } } diff --git a/test/files/jvm/nooptimise/Test.scala b/test/files/jvm/nooptimise/Test.scala index ec8daa6e16..7b7ecd6dbd 100644 --- a/test/files/jvm/nooptimise/Test.scala +++ b/test/files/jvm/nooptimise/Test.scala @@ -8,7 +8,7 @@ object Test extends BytecodeTest { val classNode = loadClassNode("Foo_1") val methodNode = getMethod(classNode, "foo") // if optimization didn't run then - // there should be some useless instructions + // there should be some useless instructions // with the magic constant 3 val expected = 1 val got = countMagicThrees(methodNode.instructions) diff --git a/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala b/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala index fa3639380d..b0506018f6 100644 --- a/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala +++ b/test/files/jvm/patmat_opt_ignore_underscore/Analyzed_1.scala @@ -6,7 +6,7 @@ class SameBytecode { case class Foo(x: Any, y: String) - def a = + def a = Foo(1, "a") match { case Foo(_: String, y) => y } diff --git a/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala b/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala index 3a594c401e..1e4d564cdf 100644 --- a/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala +++ b/test/files/jvm/patmat_opt_no_nullcheck/Analyzed_1.scala @@ -3,7 +3,7 @@ case class Foo(x: Any) class SameBytecode { - def a = + def a = (Foo(1): Any) match { case Foo(_: String) => } diff --git a/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala b/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala index e5db6c4dd0..c961082fa7 100644 --- a/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala +++ b/test/files/jvm/patmat_opt_primitive_typetest/Analyzed_1.scala @@ -3,7 +3,7 @@ class SameBytecode { case class Foo(x: Int, y: String) - def a = + def a = Foo(1, "a") match { case Foo(_: Int, y) => y } diff --git a/test/files/jvm/protectedacc.scala b/test/files/jvm/protectedacc.scala index f213e0da19..89e70b90d8 100644 --- a/test/files/jvm/protectedacc.scala +++ b/test/files/jvm/protectedacc.scala @@ -16,7 +16,7 @@ object Test { val ji = new p.b.JavaInteraction(Array('a', 'b', 'c')); (new ji.Inner).m; - + (new p.b.OuterObj.Inner).m } } @@ -36,13 +36,13 @@ package p { def getA: this.type = this; } - + /** Test type members */ trait HighlighterXXX { type Node; protected def highlight(node : Node) : Unit; } - + /** Test type parameters */ abstract class PolyA[a] { protected def m(x: a): Unit; @@ -119,22 +119,22 @@ package p { val inc = meth2(1)_; Console.println("100 = " + inc("10")); - + getA.x; } } } - + trait ScalaAutoEditXXX extends HighlighterXXX { - trait NodeImpl { + trait NodeImpl { def self : Node; highlight(self); } } - + abstract class X[T] extends PolyA[T] { - trait Inner extends B { + trait Inner extends B { def self: T; def self2: Node; def getB: Inner; diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala index 6e2b8ca033..5006793084 100644 --- a/test/files/jvm/scala-concurrent-tck.scala +++ b/test/files/jvm/scala-concurrent-tck.scala @@ -38,12 +38,12 @@ trait FutureCallbacks extends TestBase { val f = future { x = 1 } f onSuccess { case _ => done(x == 1) } } - + def testOnSuccessWhenCompleted(): Unit = once { done => var x = 0 val f = future { x = 1 } - f onSuccess { + f onSuccess { case _ if x == 1 => x = 2 f onSuccess { case _ => done(x == 2) } @@ -56,7 +56,7 @@ trait FutureCallbacks extends TestBase { f onSuccess { case _ => done(false) } f onFailure { case _ => done(true) } } - + def testOnFailure(): Unit = once { done => val f = future[Unit] { throw new Exception } @@ -73,7 +73,7 @@ trait FutureCallbacks extends TestBase { case _ => done(false) } } - + def testOnFailureWhenTimeoutException(): Unit = once { done => val f = future[Unit] { throw new TimeoutException() } @@ -89,7 +89,7 @@ trait FutureCallbacks extends TestBase { (0 to 10000).map(Future(_)).foldLeft(promise.future)((f1, f2) => f2.flatMap(i => f1)) promise.success(-1) } - + testOnSuccess() testOnSuccessWhenCompleted() testOnSuccessWhenFailed() @@ -236,7 +236,7 @@ def testTransformFailure(): Unit = once { val f = future[Int] { 5 } f foreach { x => p.success(x * 2) } val g = p.future - + g.onSuccess { case res: Int => done(res == 10) } g.onFailure { case _ => done(false) } } @@ -248,7 +248,7 @@ def testTransformFailure(): Unit = once { f foreach { x => p.success(x * 2) } f onFailure { case _ => p.failure(new Exception) } val g = p.future - + g.onSuccess { case _ => done(false) } g.onFailure { case _ => done(true) } } @@ -276,7 +276,7 @@ def testTransformFailure(): Unit = once { f onSuccess { case _ => done(false) } f onFailure { case any => done(any == cause) } } - + def testRecoverWithSuccess(): Unit = once { done => val cause = new RuntimeException @@ -302,7 +302,7 @@ def testTransformFailure(): Unit = once { f onSuccess { case x => done(false) } f onFailure { case any => done(any == cause) } } - + def testZipSuccess(): Unit = once { done => val f = future { 5 } @@ -388,14 +388,14 @@ trait FutureProjections extends TestBase { case Failure(t) => done(false) } } - + def testFailedFailureOnSuccess(): Unit = once { done => val cause = new RuntimeException val f = future { throw cause } f.failed onSuccess { case t => done(t == cause) } } - + def testFailedSuccessOnComplete(): Unit = once { done => val f = future { 0 } @@ -404,7 +404,7 @@ trait FutureProjections extends TestBase { case _ => done(false) } } - + def testFailedSuccessOnFailure(): Unit = once { done => val f = future { 0 } @@ -414,14 +414,14 @@ trait FutureProjections extends TestBase { } f.failed onSuccess { case _ => done(false) } } - + def testFailedFailureAwait(): Unit = once { done => val cause = new RuntimeException val f = future { throw cause } done(Await.result(f.failed, Duration(500, "ms")) == cause) } - + def testFailedSuccessAwait(): Unit = once { done => val f = future { 0 } @@ -456,7 +456,7 @@ trait FutureProjections extends TestBase { done(true) } onFailure { case x => done(throw x) } } - + testFailedFailureOnComplete() testFailedFailureOnSuccess() testFailedSuccessOnComplete() @@ -476,7 +476,7 @@ trait Blocking extends TestBase { val f = future { 0 } done(Await.result(f, Duration(500, "ms")) == 0) } - + def testAwaitFailure(): Unit = once { done => val cause = new RuntimeException @@ -488,13 +488,13 @@ trait Blocking extends TestBase { case t: Throwable => done(t == cause) } } - + def testFQCNForAwaitAPI(): Unit = once { done => - done(classOf[CanAwait].getName == "scala.concurrent.CanAwait" && + done(classOf[CanAwait].getName == "scala.concurrent.CanAwait" && Await.getClass.getName == "scala.concurrent.Await") } - + testAwaitSuccess() testAwaitFailure() testFQCNForAwaitAPI() @@ -564,10 +564,10 @@ trait Promises extends TestBase { done => val p = promise[Int]() val f = p.future - + f onSuccess { case x => done(x == 5) } f onFailure { case any => done(false) } - + p.success(5) } @@ -576,10 +576,10 @@ trait Promises extends TestBase { val e = new Exception("expected") val p = promise[Int]() val f = p.future - + f onSuccess { case x => done(false) } f onFailure { case any => done(any eq e) } - + p.failure(e) } @@ -715,13 +715,13 @@ trait ExecutionContextPrepare extends TestBase { val theLocal = new ThreadLocal[String] { override protected def initialValue(): String = "" } - + class PreparingExecutionContext extends ExecutionContext { def delegate = ExecutionContext.global - + override def execute(runnable: Runnable): Unit = delegate.execute(runnable) - + override def prepare(): ExecutionContext = { // save object stored in ThreadLocal storage val localData = theLocal.get @@ -739,27 +739,27 @@ trait ExecutionContextPrepare extends TestBase { } } } - + override def reportFailure(t: Throwable): Unit = delegate.reportFailure(t) } - + implicit val ec = new PreparingExecutionContext - + def testOnComplete(): Unit = once { done => theLocal.set("secret") val fut = future { 42 } fut onComplete { case _ => done(theLocal.get == "secret") } } - + def testMap(): Unit = once { done => theLocal.set("secret2") val fut = future { 42 } fut map { x => done(theLocal.get == "secret2") } } - + testOnComplete() testMap() } diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala index 2bb9db3f72..bc61235267 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization.scala @@ -297,7 +297,7 @@ object Test3_mutable { ab1 ++= List("one", "two") val _ab1: ArrayBuffer[String] = read(write(ab1)) check(ab1, _ab1) - + // ArrayBuilder val abu1 = ArrayBuilder.make[Long] val _abu1: ArrayBuilder[ClassManifest[Long]] = read(write(abu1)) @@ -306,12 +306,12 @@ object Test3_mutable { val abu2 = ArrayBuilder.make[Float] val _abu2: ArrayBuilder[ClassManifest[Float]] = read(write(abu2)) check(abu2, _abu2) - + // ArraySeq val aq1 = ArraySeq(1, 2, 3) val _aq1: ArraySeq[Int] = read(write(aq1)) check(aq1, _aq1) - + // ArrayStack val as1 = new ArrayStack[Int] as1 ++= List(20, 2, 3).iterator @@ -402,12 +402,12 @@ object Test3_mutable { val wa1 = WrappedArray.make(Array(1, 2, 3)) val _wa1: WrappedArray[Int] = read(write(wa1)) check(wa1, _wa1) - + // TreeSet val ts1 = TreeSet[Int]() ++= Array(1, 2, 3) val _ts1: TreeSet[Int] = read(write(ts1)) check(ts1, _ts1) - + // concurrent.TrieMap val ct1 = TrieMap[Int, String]() ++= Array(1 -> "one", 2 -> "two", 3 -> "three") val _ct1: TrieMap[Int, String] = read(write(ct1)) @@ -505,7 +505,7 @@ class WithTransient extends Serializable { @transient private lazy val a2 = 2 @transient object B extends Serializable @transient private object C extends Serializable - + def test = { println(a1) println(a2) @@ -552,55 +552,55 @@ object Test { // Test classes in package "scala.collection.parallel" and subpackages object Test9_parallel { import scala.collection.parallel._ - + try { println() - + // UnrolledBuffer val ub = new collection.mutable.UnrolledBuffer[String] ub ++= List("one", "two") val _ub: collection.mutable.UnrolledBuffer[String] = read(write(ub)) check(ub, _ub) - + // mutable.ParArray val pa = mutable.ParArray("abc", "def", "etc") val _pa: mutable.ParArray[String] = read(write(pa)) check(pa, _pa) - + // mutable.ParHashMap val mpm = mutable.ParHashMap(1 -> 2, 2 -> 4) val _mpm: mutable.ParHashMap[Int, Int] = read(write(mpm)) check(mpm, _mpm) - + // mutable.ParTrieMap val mpc = mutable.ParTrieMap(1 -> 2, 2 -> 4) val _mpc: mutable.ParTrieMap[Int, Int] = read(write(mpc)) check(mpc, _mpc) - + // mutable.ParHashSet val mps = mutable.ParHashSet(1, 2, 3) val _mps: mutable.ParHashSet[Int] = read(write(mps)) check(mps, _mps) - + // immutable.ParRange val pr1 = immutable.ParRange(0, 4, 1, true) val _pr1: immutable.ParRange = read(write(pr1)) check(pr1, _pr1) - + val pr2 = immutable.ParRange(0, 4, 1, false) val _pr2: immutable.ParRange = read(write(pr2)) check(pr2, _pr2) - + // immutable.ParHashMap val ipm = immutable.ParHashMap(5 -> 1, 10 -> 2) val _ipm: immutable.ParHashMap[Int, Int] = read(write(ipm)) check(ipm, _ipm) - + // immutable.ParHashSet val ips = immutable.ParHashSet("one", "two") val _ips: immutable.ParHashSet[String] = read(write(ips)) check(ips, _ips) - + } catch { case e: Exception => println("Error in Test5_parallel: " + e) diff --git a/test/files/jvm/si5471.scala b/test/files/jvm/si5471.scala index 2c8c4205c5..2efd869b61 100644 --- a/test/files/jvm/si5471.scala +++ b/test/files/jvm/si5471.scala @@ -4,12 +4,12 @@ object Test { def main(args: Array[String]) { import scala.math.Numeric import scala.math.Numeric.Implicits._ - + val b = BigInt(Long.MaxValue) + 1 def dbl[N :Numeric](n: N) = n.toDouble def flt[N :Numeric](n: N) = n.toFloat - + println(dbl(b) == b.toDouble) println(flt(b) == b.toFloat) } diff --git a/test/files/jvm/t1461.scala b/test/files/jvm/t1461.scala index a963ec6a12..f0e3cea6cd 100644 --- a/test/files/jvm/t1461.scala +++ b/test/files/jvm/t1461.scala @@ -3,7 +3,7 @@ object Test { def main(args: Array[String]) { val jl = classOf[Foo].getMethod("jl", classOf[Baz[_]]) jl.getGenericParameterTypes // works fine - + val l = classOf[Foo].getMethod("l", classOf[Baz[_]]) // By debugger inspection l.signature is (Ltest/Baz<J>;)V l.getGenericParameterTypes // throws GenericSignatureFormatError diff --git a/test/files/jvm/t1464/MyTrait.scala b/test/files/jvm/t1464/MyTrait.scala index 014ddf86c3..0b8ccc412b 100644 --- a/test/files/jvm/t1464/MyTrait.scala +++ b/test/files/jvm/t1464/MyTrait.scala @@ -1,5 +1,5 @@ trait MyTrait { type K def findChildByClass[T <: K with MyTrait]: Unit - + } diff --git a/test/files/jvm/t1600.scala b/test/files/jvm/t1600.scala index 69179c1ba4..5a1b2900c5 100644 --- a/test/files/jvm/t1600.scala +++ b/test/files/jvm/t1600.scala @@ -4,23 +4,23 @@ * changes on deserialization. */ object Test { - + import collection._ def main(args: Array[String]) { for (i <- Seq(0, 1, 2, 10, 100)) { def entries = (0 until i).map(i => (new Foo, i)).toList def elements = entries.map(_._1) - + val maps = Seq[Map[Foo, Int]](new mutable.HashMap, new mutable.LinkedHashMap, immutable.HashMap.empty).map(_ ++ entries) test[Map[Foo, Int]](maps, entries.size, assertMap _) - + val sets = Seq[Set[Foo]](new mutable.HashSet, new mutable.LinkedHashSet, immutable.HashSet.empty).map(_ ++ elements) test[Set[Foo]](sets, entries.size, assertSet _) } } - + private def test[A <: AnyRef](collections: Seq[A], expectedSize: Int, assertFunction: (A, Int) => Unit) { for (collection <- collections) { assertFunction(collection, expectedSize) @@ -28,19 +28,19 @@ object Test { val bytes = toBytes(collection) Foo.hashCodeModifier = 1 val deserializedCollection = toObject[A](bytes) - + assertFunction(deserializedCollection, expectedSize) assert(deserializedCollection.getClass == collection.getClass, "collection class should remain the same after deserialization ("+deserializedCollection.getClass+" != "+collection.getClass+")") Foo.hashCodeModifier = 0 } } - + private def toObject[A](bytes: Array[Byte]): A = { val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bytes)) in.readObject.asInstanceOf[A] } - + private def toBytes(o: AnyRef): Array[Byte] = { val bos = new java.io.ByteArrayOutputStream val out = new java.io.ObjectOutputStream(bos) @@ -48,7 +48,7 @@ object Test { out.close bos.toByteArray } - + private def assertMap[A, B](map: Map[A, B], expectedSize: Int) { assert(expectedSize == map.size, "expected map size: " + expectedSize + ", actual size: " + map.size) map.foreach { case (k, v) => @@ -56,19 +56,19 @@ object Test { assert(map(k) == v) } } - + private def assertSet[A](set: Set[A], expectedSize: Int) { assert(expectedSize == set.size, "expected set size: " + expectedSize + ", actual size: " + set.size) set.foreach { e => assert(set.contains(e), "contains should return true for element in the set, element: " + e) } } - + object Foo { - /* Used to simulate a hashCode change caused by deserializing an instance with an + /* Used to simulate a hashCode change caused by deserializing an instance with an * identity-based hashCode in another JVM. */ var hashCodeModifier = 0 } - + class Foo extends Serializable { override def hashCode = System.identityHashCode(this) + Foo.hashCodeModifier } diff --git a/test/files/jvm/t2570/Test.scala b/test/files/jvm/t2570/Test.scala index f1cba53546..ad4d29dd7f 100644 --- a/test/files/jvm/t2570/Test.scala +++ b/test/files/jvm/t2570/Test.scala @@ -1,3 +1,3 @@ class Test2 extends Test1[Test3[Test4]] class Test4 -object Test extends App {}
\ No newline at end of file +object Test extends App {}
\ No newline at end of file diff --git a/test/files/jvm/t3003/Test_1.scala b/test/files/jvm/t3003/Test_1.scala index 38af66a25a..8ec08bebc6 100644 --- a/test/files/jvm/t3003/Test_1.scala +++ b/test/files/jvm/t3003/Test_1.scala @@ -9,7 +9,7 @@ object Test { . map(f => f.getAnnotations.toList) . filterNot (_.isEmpty) // there are extra fields under -Xcheckinit ) - + println(xs) } } diff --git a/test/files/jvm/throws-annot.scala b/test/files/jvm/throws-annot.scala index b679b6c121..90b58b9976 100644 --- a/test/files/jvm/throws-annot.scala +++ b/test/files/jvm/throws-annot.scala @@ -43,24 +43,24 @@ object TestThrows { /** Test the top-level mirror that is has the annotations. */ object TL { - + @throws(classOf[IOException]) def read(): Int = 0 - + @throws(classOf[ClassCastException]) @throws(classOf[IOException]) def readWith2(): Int = 0 - + @throws(classOf[IOException]) @Deprecated @throws(classOf[NullPointerException]) def readMixed(): Int = 0 - + @Deprecated @throws(classOf[IOException]) @throws(classOf[NullPointerException]) def readMixed2(): Int = 0 - + @Deprecated def readNoEx(): Int = 0 } diff --git a/test/files/jvm/typerep.scala b/test/files/jvm/typerep.scala index 47bd16a467..1d6f0b7907 100644 --- a/test/files/jvm/typerep.scala +++ b/test/files/jvm/typerep.scala @@ -109,7 +109,7 @@ object testFuncs { def f5(f: Int => Int, x: Int) = f(x) println(getType(f5 _)) println(getType(f5(f1, 1))) - println + println } class Foo { diff --git a/test/files/jvm/unittest_io_Jvm.check b/test/files/jvm/unittest_io_Jvm.check index d6e855f939..bcfce8cbdb 100644 --- a/test/files/jvm/unittest_io_Jvm.check +++ b/test/files/jvm/unittest_io_Jvm.check @@ -1,5 +1,5 @@ lines.size = 5 - + This is a file it is split on several lines. diff --git a/test/files/jvm/unittest_io_Jvm.scala b/test/files/jvm/unittest_io_Jvm.scala index 1484774fb3..7c8ef131bc 100644 --- a/test/files/jvm/unittest_io_Jvm.scala +++ b/test/files/jvm/unittest_io_Jvm.scala @@ -3,7 +3,7 @@ import scala.io.Source object Test { def main(args: Array[String]) { val lines = Source.fromString( - """| + """| |This is a file |it is split on several lines. | diff --git a/test/files/jvm/unreachable/Foo_1.scala b/test/files/jvm/unreachable/Foo_1.scala index c223718097..600b96bb18 100644 --- a/test/files/jvm/unreachable/Foo_1.scala +++ b/test/files/jvm/unreachable/Foo_1.scala @@ -65,7 +65,7 @@ class Foo_1 { return 42 } catch { case x: Throwable => return 2 - } + } return 3 } @@ -74,7 +74,7 @@ class Foo_1 { error("haha") } catch { case x: Throwable => return 42 - } + } return 3 } diff --git a/test/files/jvm/varargs/JavaClass.java b/test/files/jvm/varargs/JavaClass.java index 536e9a38fb..9851e1b78b 100644 --- a/test/files/jvm/varargs/JavaClass.java +++ b/test/files/jvm/varargs/JavaClass.java @@ -4,7 +4,7 @@ public class JavaClass { public static <T> void varargz(int i, T... v) { } - + public static void callSomeAnnotations() { VaClass va = new VaClass(); va.vs(4, "", "", ""); diff --git a/test/files/jvm/varargs/VaClass.scala b/test/files/jvm/varargs/VaClass.scala index 8e9cbdbb3f..6343f9c6f6 100644 --- a/test/files/jvm/varargs/VaClass.scala +++ b/test/files/jvm/varargs/VaClass.scala @@ -5,9 +5,9 @@ import annotation.varargs class VaClass { - + @varargs def vs(a: Int, b: String*) = println(a + b.length) @varargs def vi(a: Int, b: Int*) = println(a + b.sum) @varargs def vt[T](a: Int, b: T*) = println(a + b.length) - + } diff --git a/test/files/jvm/xml05.check b/test/files/jvm/xml05.check index 8d3e803bc8..92ea995350 100644 --- a/test/files/jvm/xml05.check +++ b/test/files/jvm/xml05.check @@ -1,11 +1,7 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> <city name="San José"/> res0: scala.xml.Elem = <city name="San José"/> scala> - -scala> diff --git a/test/files/neg/abstract-class-2.scala b/test/files/neg/abstract-class-2.scala index be45a09343..19f74f3da6 100644 --- a/test/files/neg/abstract-class-2.scala +++ b/test/files/neg/abstract-class-2.scala @@ -1,7 +1,7 @@ class P { trait S1 val p = new P - + trait S2 { def f(x: p.S1): Int } @@ -10,5 +10,5 @@ class P { class P2 extends P { object O2 extends S2 { def f(x: S1) = 5 - } + } } diff --git a/test/files/neg/abstract-inaccessible.scala b/test/files/neg/abstract-inaccessible.scala index 7eaaf2d620..3c80f30522 100644 --- a/test/files/neg/abstract-inaccessible.scala +++ b/test/files/neg/abstract-inaccessible.scala @@ -1,6 +1,6 @@ package foo { private[foo] trait Bippy { } - + trait YourTrait { def implementMe(f: Int => (String, Bippy)): Unit def overrideMe[T <: Bippy](x: T): T = x diff --git a/test/files/neg/abstract-report.check b/test/files/neg/abstract-report.check index bd550f39f4..1ffeac060b 100644 --- a/test/files/neg/abstract-report.check +++ b/test/files/neg/abstract-report.check @@ -7,7 +7,7 @@ it has 12 unimplemented members. def isTraversableAgain: Boolean = ??? def toIterator: Iterator[String] = ??? def toStream: Stream[String] = ??? - + // Members declared in scala.collection.TraversableOnce def copyToArray[B >: String](xs: Array[B],start: Int,len: Int): Unit = ??? def exists(p: String => Boolean): Boolean = ??? diff --git a/test/files/neg/abstract-report2.check b/test/files/neg/abstract-report2.check index 35a99bdd25..6ea949353a 100644 --- a/test/files/neg/abstract-report2.check +++ b/test/files/neg/abstract-report2.check @@ -78,15 +78,15 @@ it has 24 unimplemented members. def retainAll(x$1: java.util.Collection[_]): Boolean = ??? def toArray[T](x$1: Array[T with Object]): Array[T with Object] = ??? def toArray(): Array[Object] = ??? - + // Members declared in scala.collection.GenTraversableOnce def isTraversableAgain: Boolean = ??? def toIterator: Iterator[(Set[Int], String)] = ??? def toStream: Stream[(Set[Int], String)] = ??? - + // Members declared in scala.math.Ordering def compare(x: List[Int],y: List[Int]): Int = ??? - + // Members declared in scala.collection.TraversableOnce def copyToArray[B >: (Set[Int], String)](xs: Array[B],start: Int,len: Int): Unit = ??? def exists(p: ((Set[Int], String)) => Boolean): Boolean = ??? diff --git a/test/files/neg/accesses.scala b/test/files/neg/accesses.scala index 290291586c..b1df6c0e6c 100644 --- a/test/files/neg/accesses.scala +++ b/test/files/neg/accesses.scala @@ -6,7 +6,7 @@ abstract class A { private[p1] def f4(): Unit protected[p1] def f5(): Unit } - + abstract class OK1 extends A { private[p1] def f2(): Unit protected[p2] def f3(): Unit diff --git a/test/files/neg/anytrait.scala b/test/files/neg/anytrait.scala index 1501486105..e76164f63d 100644 --- a/test/files/neg/anytrait.scala +++ b/test/files/neg/anytrait.scala @@ -1,7 +1,7 @@ trait T extends Any { var x = 1 - + { x += 1 } type T = Int diff --git a/test/files/neg/check-dead.scala b/test/files/neg/check-dead.scala index aadd788814..2d5bccb21d 100644 --- a/test/files/neg/check-dead.scala +++ b/test/files/neg/check-dead.scala @@ -5,11 +5,11 @@ object Other { class NoDeads { def y1(arg: Any) = println("foo") def z1 = y1(throw new Exception) // should warn - + def y2[T](arg: T) = println("foo") def z2 = y2(throw new Exception) // should warn - - def y3[T](arg: => T) = println("foo") + + def y3[T](arg: => T) = println("foo") def z3 = y3(throw new Exception) // should not warn: by name arg def nowarn1 = synchronized { throw new Exception } // should not warn: synchronized should be by name @@ -22,9 +22,9 @@ class NoDeads { val i = 10 + 2 i } - + def nowarn4: String = Other.oops("don't warn about me") // should not warn - + def yeswarn1 = synchronized { throw new Exception // should warn 5 * 5 @@ -32,6 +32,6 @@ class NoDeads { def yeswarn2: Int = synchronized { throw new Exception // should warn return 5 - } + } } diff --git a/test/files/neg/checksensible.scala b/test/files/neg/checksensible.scala index 27ee908153..b6083f75e4 100644 --- a/test/files/neg/checksensible.scala +++ b/test/files/neg/checksensible.scala @@ -9,7 +9,7 @@ final class Zing { // 7 warnings class RefEqTest { object Shmoopie - + (new AnyRef) eq (new AnyRef) (new AnyRef) ne (new AnyRef) Shmoopie eq (new AnyRef) @@ -22,10 +22,10 @@ class RefEqTest { // 13 warnings class EqEqValTest { var c = 0 - + (c = 1) == 0 0 == (c = 1) - + 1 == "abc" 1 == ("abc": Any) // doesn't warn because an Any may be a boxed Int 1 == (1: Any) // as above @@ -34,12 +34,12 @@ class EqEqValTest { true == new java.lang.Boolean(true) // none of these should warn new java.lang.Boolean(true) == true - + new AnyRef == 1 1 == new AnyRef // doesn't warn because it could be... 1 == (new java.lang.Integer(1)) // ...something like this 1 == (new java.lang.Boolean(true)) - + 1 != true () == true () == () @@ -47,13 +47,13 @@ class EqEqValTest { () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false scala.runtime.BoxedUnit.UNIT != () (scala.runtime.BoxedUnit.UNIT: java.io.Serializable) != () // shouldn't warn - + (1 != println) (1 != 'sym) } // 12 warnings -class EqEqRefTest { +class EqEqRefTest { val ref = new Bop ((x: Int) => x + 1) == null Bep == ((_: Int) + 1) @@ -67,9 +67,9 @@ class EqEqRefTest { // final classes with default equals val x1 = new Bip - val x2 = new Bop + val x2 = new Bop (x1 == x2) - + class C1 { } class C2 extends C1 { } final class Z1 extends C2 { } @@ -84,14 +84,14 @@ class EqEqRefTest { c3 != "abc" // this should warn when feeling chatty c3 != z1 - + // non-warners (null: AnyRef) == (null: AnyRef) (x1 <= x2) - + def main(args: Array[String]) = { val in = new java.io.FileInputStream(args(0)) - var c = 0 + var c = 0 while ((c = in.read) != -1) print(c.toChar) diff --git a/test/files/neg/choices.scala b/test/files/neg/choices.scala index fe9236f10f..8827494874 100644 --- a/test/files/neg/choices.scala +++ b/test/files/neg/choices.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = { - + } } diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check index fd1e2728c3..39b6bf216c 100644 --- a/test/files/neg/classmanifests_new_deprecations.check +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -1,6 +1,6 @@ classmanifests_new_deprecations.scala:2: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead def cm1[T: ClassManifest] = ??? - ^ + ^ classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead def cm2[T](implicit evidence$1: ClassManifest[T]) = ??? ^ @@ -9,7 +9,7 @@ classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object P ^ classmanifests_new_deprecations.scala:6: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead def rcm1[T: scala.reflect.ClassManifest] = ??? - ^ + ^ classmanifests_new_deprecations.scala:7: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ??? ^ diff --git a/test/files/neg/divergent-implicit.check b/test/files/neg/divergent-implicit.check index 5f20df1b91..b5c607cf59 100644 --- a/test/files/neg/divergent-implicit.check +++ b/test/files/neg/divergent-implicit.check @@ -10,9 +10,9 @@ starting with method cast in object Test1 divergent-implicit.scala:14: error: diverging implicit expansion for type Test2.Baz => Test2.Bar starting with method baz2bar in object Test2 val x: Bar = new Foo - ^ + ^ divergent-implicit.scala:15: error: diverging implicit expansion for type Test2.Foo => Test2.Bar starting with method foo2bar in object Test2 val y: Bar = new Baz - ^ + ^ four errors found diff --git a/test/files/neg/exhausting.scala b/test/files/neg/exhausting.scala index 01c34f7039..c00569c91d 100644 --- a/test/files/neg/exhausting.scala +++ b/test/files/neg/exhausting.scala @@ -3,7 +3,7 @@ object Test { case object Bar1 extends Foo[Int] case object Bar2 extends Foo[String] case object Bar3 extends Foo[Any] - + def ex1[T](xs: List[T]) = xs match { case ys: List[_] => "ok" } diff --git a/test/files/neg/for-comprehension-old.check b/test/files/neg/for-comprehension-old.check index 1ecaf12af4..fc04beca53 100644 --- a/test/files/neg/for-comprehension-old.check +++ b/test/files/neg/for-comprehension-old.check @@ -1,15 +1,15 @@ for-comprehension-old.scala:3: warning: val keyword in for comprehension is deprecated for (x <- 1 to 5 ; val y = x) yield x+y // fail - ^ + ^ for-comprehension-old.scala:5: warning: val keyword in for comprehension is deprecated for (val x <- 1 to 5 ; val y = x) yield x+y // fail - ^ + ^ for-comprehension-old.scala:8: warning: val keyword in for comprehension is deprecated for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // fail - ^ + ^ for-comprehension-old.scala:10: warning: val keyword in for comprehension is deprecated for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail - ^ + ^ for-comprehension-old.scala:4: error: val in for comprehension must be followed by assignment for (val x <- 1 to 5 ; y = x) yield x+y // fail ^ diff --git a/test/files/neg/forward.scala b/test/files/neg/forward.scala index 3774fa838f..d5c0851f09 100644 --- a/test/files/neg/forward.scala +++ b/test/files/neg/forward.scala @@ -5,20 +5,20 @@ object Test { { def f: Int = x; val x: Int = f; - } + } { def f: Int = g; val x: Int = f; def g: Int = x; - } + } { def f: Int = g; var x: Int = f; def g: Int = x; - } + } { def f: Int = g; Console.println("foo"); def g: Int = f; - } + } } diff --git a/test/files/neg/found-req-variance.check b/test/files/neg/found-req-variance.check index cc26458ac5..55a01012a9 100644 --- a/test/files/neg/found-req-variance.check +++ b/test/files/neg/found-req-variance.check @@ -4,56 +4,56 @@ found-req-variance.scala:22: error: type mismatch; Note: B <: A, but class Inv is invariant in type T. You may wish to define T as +T instead. (SLS 4.5) def f2 = Set[Inv[A]]() + new Inv[B] - ^ + ^ found-req-variance.scala:23: error: type mismatch; found : Inv[C] required: Inv[A] Note: C <: A, but class Inv is invariant in type T. You may wish to define T as +T instead. (SLS 4.5) def f3 = Set[Inv[A]]() + new Inv[C] - ^ + ^ found-req-variance.scala:24: error: type mismatch; found : Inv[A] required: Inv[B] Note: A >: B, but class Inv is invariant in type T. You may wish to define T as -T instead. (SLS 4.5) def f4 = Set[Inv[B]]() + new Inv[A] - ^ + ^ found-req-variance.scala:26: error: type mismatch; found : Inv[C] required: Inv[B] Note: C <: B, but class Inv is invariant in type T. You may wish to define T as +T instead. (SLS 4.5) def f6 = Set[Inv[B]]() + new Inv[C] - ^ + ^ found-req-variance.scala:27: error: type mismatch; found : Inv[A] required: Inv[C] Note: A >: C, but class Inv is invariant in type T. You may wish to define T as -T instead. (SLS 4.5) def f7 = Set[Inv[C]]() + new Inv[A] - ^ + ^ found-req-variance.scala:28: error: type mismatch; found : Inv[B] required: Inv[C] Note: B >: C, but class Inv is invariant in type T. You may wish to define T as -T instead. (SLS 4.5) def f8 = Set[Inv[C]]() + new Inv[B] - ^ + ^ found-req-variance.scala:34: error: type mismatch; found : MultiInv[A] required: Multi[A,B,C] Note: A >: B (and MultiInv[A] <: Multi[A,A,C]), but class Multi is invariant in type Inv. You may wish to define Inv as -Inv instead. (SLS 4.5) def g4 = Set[Multi[A, B, C]]() + new MultiInv[A] - ^ + ^ found-req-variance.scala:36: error: type mismatch; found : MultiInv[C] required: Multi[A,B,C] Note: C <: B (and MultiInv[C] <: Multi[A,C,C]), but class Multi is invariant in type Inv. You may wish to define Inv as +Inv instead. (SLS 4.5) def g6 = Set[Multi[A, B, C]]() + new MultiInv[C] - ^ + ^ found-req-variance.scala:47: error: type mismatch; found : FF1[A,A] required: FF1[B,B] @@ -160,7 +160,7 @@ found-req-variance.scala:94: error: type mismatch; Note: Int <: AnyVal (and Misc.MyData <: Misc.Data[Int]), but class Data is invariant in type A. You may wish to define A as +A instead. (SLS 4.5) def f1 = Set[Data[AnyVal]]() + new MyData - ^ + ^ found-req-variance.scala:100: error: type mismatch; found : Set[String] required: Set[CharSequence] @@ -174,7 +174,7 @@ found-req-variance.scala:104: error: type mismatch; Note: String <: Object, but class Trippy is invariant in type T2. You may wish to define T2 as +T2 instead. (SLS 4.5) def g1 = Set[Trippy[AnyRef, AnyRef, AnyRef]]() + new Trippy[String, String, String] - ^ + ^ found-req-variance.scala:105: error: type mismatch; found : scala.collection.immutable.Map[AnyRef,String] required: Map[String,String] diff --git a/test/files/neg/found-req-variance.scala b/test/files/neg/found-req-variance.scala index fd3b11160e..024b24c367 100644 --- a/test/files/neg/found-req-variance.scala +++ b/test/files/neg/found-req-variance.scala @@ -27,7 +27,7 @@ object Test { def f7 = Set[Inv[C]]() + new Inv[A] def f8 = Set[Inv[C]]() + new Inv[B] def f9 = Set[Inv[C]]() + new Inv[C] - + def g1 = Set[Multi[A, B, C]]() + new MultiCov[A] def g2 = Set[Multi[A, B, C]]() + new MultiCov[B] def g3 = Set[Multi[A, B, C]]() + new MultiCov[C] @@ -43,12 +43,12 @@ object Functions { object Set1 { def f[T, R](x: FF1[T, R]) = () def h[T, R] : FF1[T, R] = sys.error("") - + def ff1 = f[B, B](h[A, A]) // fail def ff2 = f[B, B](h[B, A]) // fail def ff3 = f[B, B](h[C, A]) // fail def ff4 = f[B, B](h[A, B]) // suggest - def ff5 = f[B, B](h[B, B]) // ok + def ff5 = f[B, B](h[B, B]) // ok def ff6 = f[B, B](h[C, B]) // suggest def ff7 = f[B, B](h[A, C]) // suggest def ff8 = f[B, B](h[B, C]) // ok @@ -57,7 +57,7 @@ object Functions { object Set2 { def f[T, R](x: FF2[T, R]) = () def h[T, R] : FF2[T, R] = sys.error("") - + def ff1 = f[B, B](h[A, A]) // suggest def ff2 = f[B, B](h[B, A]) // suggest def ff3 = f[B, B](h[C, A]) // fail @@ -74,7 +74,7 @@ object Functions { // object TypeAlias { // type LL[T] = List[T] // val LL = List -// +// // def f1 = Set[LL[B]]() + LL[A](new A) // def f2 = Set[LL[B]]() + LL[C](new C) // } @@ -82,12 +82,12 @@ object Functions { object Javas { def f[T](x: java.util.List[T]) = () def g[T](x: java.util.Comparator[T]) = () - + def g1 = f[AnyRef](new java.util.ArrayList[String] { }) def g2 = g[String](Ordering.fromLessThan[AnyRef](_.toString < _.toString)) } -object Misc { +object Misc { // original motivation class Data[A <: AnyVal] class MyData extends Data[Int] { } diff --git a/test/files/neg/gadts1.scala b/test/files/neg/gadts1.scala index 1fb6e57e2d..08403e6eec 100644 --- a/test/files/neg/gadts1.scala +++ b/test/files/neg/gadts1.scala @@ -11,8 +11,8 @@ class IntTerm(n: Int) extends NumTerm(n) with Term[Int] def f[a](t:Term[a], c:Cell[a]): Unit = { - t match { - case NumTerm(n) => c.x = Double(1.0) + t match { + case NumTerm(n) => c.x = Double(1.0) } t match { // presently testing that this gets past the parser: eventually diff --git a/test/files/neg/implicits.scala b/test/files/neg/implicits.scala index 878d3a7c99..22633a1f35 100644 --- a/test/files/neg/implicits.scala +++ b/test/files/neg/implicits.scala @@ -4,14 +4,14 @@ class Super object Super { implicit def pos2int(p: Pos): Int = 0 -} +} object Sub extends Super { class Plus(x: Any) { def +(y: String): String = x.toString + y } implicit def any2plus(x: Any): Plus = new Plus(x) -} +} object Test { import Super._ @@ -33,7 +33,7 @@ object test2 { val set = HEmpty + 3 + "3" implicit def select[T](t: HSome[T,_]) = t.head implicit def selectTail[L](t: HSome[_,L]) = t.tail - + def foo(x: Int) = 3 foo(set) } @@ -55,7 +55,7 @@ class Mxml { } -} +} // SI-5316 class Test3 { diff --git a/test/files/neg/java-access-neg/J.java b/test/files/neg/java-access-neg/J.java index 4f2024673c..b6bc3363a1 100644 --- a/test/files/neg/java-access-neg/J.java +++ b/test/files/neg/java-access-neg/J.java @@ -4,11 +4,11 @@ public abstract class J { public J() { } J(int x1) { } protected J(int x1, int x2) { } - + abstract void packageAbstract(); protected abstract void protectedAbstract(); public abstract void publicAbstract(); - + void packageConcrete() { return; } protected void protectedConcrete() { return; } public void publicConcrete() { return; } diff --git a/test/files/neg/java-access-neg/S2.scala b/test/files/neg/java-access-neg/S2.scala index dd0af8d39d..b082bb7174 100644 --- a/test/files/neg/java-access-neg/S2.scala +++ b/test/files/neg/java-access-neg/S2.scala @@ -12,7 +12,7 @@ class S1 extends J { override private[b] def packageAbstract() = () // fail override protected[b] def protectedAbstract() = () override def publicAbstract() = () - + override private[b] def packageConcrete() = () // fail override protected[b] def protectedConcrete() = () override def publicConcrete() = () @@ -32,7 +32,7 @@ class S3 extends J { protected[b] def packageAbstract() = () // fail protected[b] def protectedAbstract() = () def publicAbstract() = () - + override protected[b] def packageConcrete() = () // fail override protected[b] def protectedConcrete() = () override def publicConcrete() = () @@ -43,7 +43,7 @@ class S4 extends J { private[a] def packageAbstract() = () // fail protected[a] def protectedAbstract() = () def publicAbstract() = () - + override private[a] def packageConcrete() = () // fail override protected[a] def protectedConcrete() = () override def publicConcrete() = () @@ -54,7 +54,7 @@ class S5 extends J { def packageAbstract() = () // fail def protectedAbstract() = () def publicAbstract() = () - + override def packageConcrete() = () // fail override def protectedConcrete() = () override def publicConcrete() = () diff --git a/test/files/neg/lazy-override.scala b/test/files/neg/lazy-override.scala index a0f6e3bd73..f41d7f038b 100644 --- a/test/files/neg/lazy-override.scala +++ b/test/files/neg/lazy-override.scala @@ -5,7 +5,7 @@ lazy val y: Int = { print("/*A.y*/"); 2 } } - + class B extends A { // lazy overrides strict val override lazy val x: Int = { print("/*B.x*/"); 3 } diff --git a/test/files/neg/lazyvals.check b/test/files/neg/lazyvals.check index c4daf9d842..1ae8b13d92 100644 --- a/test/files/neg/lazyvals.check +++ b/test/files/neg/lazyvals.check @@ -7,9 +7,9 @@ lazyvals.scala:9: error: lazy not allowed here. Only vals can be lazy lazyvals.scala:12: error: lazy not allowed here. Only vals can be lazy lazy def q: Double = 0.0 ^ -lazyvals.scala:15: error: '=' expected but ';' found. +lazyvals.scala:15: error: lazy values may not be abstract lazy val t; - ^ + ^ lazyvals.scala:20: error: lazy not allowed here. Only vals can be lazy lazy trait T {} ^ diff --git a/test/files/neg/lazyvals.scala b/test/files/neg/lazyvals.scala index bbc4fe114a..f92534f506 100644 --- a/test/files/neg/lazyvals.scala +++ b/test/files/neg/lazyvals.scala @@ -1,7 +1,7 @@ /** Test which should fail compilation */ class Lazy { - + // no abstract lazy values lazy val t: Int @@ -31,7 +31,7 @@ object T2 { lazy val y: Int = { print("/*A.y*/"); 2 } } - + class B extends A { // lazy overrides strict val override lazy val x: Int = { print("/*B.x*/"); 3 } diff --git a/test/files/neg/logImplicits.scala b/test/files/neg/logImplicits.scala index fb5dd8a025..caf827163c 100644 --- a/test/files/neg/logImplicits.scala +++ b/test/files/neg/logImplicits.scala @@ -9,9 +9,9 @@ class B { object C { final val x = "abc" - + implicit def convert(p: x.type): Int = 123 - + math.max(122, x: Int) } diff --git a/test/files/neg/lubs.scala b/test/files/neg/lubs.scala index 639117f7bf..3524fa4d87 100644 --- a/test/files/neg/lubs.scala +++ b/test/files/neg/lubs.scala @@ -18,7 +18,7 @@ object test2 { class D extends A { type T = D } def f = if (1 == 2) new C else new D - + val x1: A { type T } = f val x2: A { type T >: Null <: A } = f val x3: A { type T >: Null <: A { type T >: Null <: A } } = f diff --git a/test/files/neg/macro-exception.check b/test/files/neg/macro-exception.check index cee8b32ebd..dca97aebce 100644 --- a/test/files/neg/macro-exception.check +++ b/test/files/neg/macro-exception.check @@ -1,4 +1,4 @@ -Test_2.scala:2: error: exception during macro expansion: +Test_2.scala:2: error: exception during macro expansion: java.lang.Exception at Macros$.impl(Macros_1.scala:6) diff --git a/test/files/neg/macro-quasiquotes.check b/test/files/neg/macro-quasiquotes.check index a2d48723b5..96ef75dd32 100644 --- a/test/files/neg/macro-quasiquotes.check +++ b/test/files/neg/macro-quasiquotes.check @@ -1,6 +1,6 @@ Macros_1.scala:14: error: macro implementation has wrong shape: required: (x: Impls.this.c.Expr[Int]): Impls.this.c.Expr[Any] - found : (x: Impls.this.c.universe.Block): Impls.this.c.universe.Apply + found : (x: Impls.this.c.universe.Block): Impls.this.c.universe.Tree type mismatch for parameter x: Impls.this.c.Expr[Int] does not conform to Impls.this.c.universe.Block def m3(x: Int) = macro Impls.impl3 ^ diff --git a/test/files/neg/migration28.scala b/test/files/neg/migration28.scala index ba73eea436..facc9b36d2 100644 --- a/test/files/neg/migration28.scala +++ b/test/files/neg/migration28.scala @@ -1,9 +1,9 @@ object Test { import scala.collection.mutable._ - + List(1,2,3,4,5).scanRight(0)(_+_) - + def main(args: Array[String]): Unit = { - + } } diff --git a/test/files/neg/multi-array.check b/test/files/neg/multi-array.check index 511caa126f..6bdeb34c9e 100644 --- a/test/files/neg/multi-array.check +++ b/test/files/neg/multi-array.check @@ -1,4 +1,4 @@ multi-array.scala:7: error: too many arguments for constructor Array: (_length: Int)Array[T] val a: Array[Int] = new Array(10, 10) - ^ + ^ one error found diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index cdc12c2490..4966779cc3 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -97,7 +97,7 @@ names-defaults-neg.scala:82: error: type mismatch; required: String Error occurred in an application involving default arguments. new A2[String]() - ^ + ^ names-defaults-neg.scala:86: error: module extending its companion class cannot use default constructor arguments object C extends C() ^ diff --git a/test/files/neg/nested-annotation.check b/test/files/neg/nested-annotation.check index ca263943fe..c077d35a29 100644 --- a/test/files/neg/nested-annotation.check +++ b/test/files/neg/nested-annotation.check @@ -5,6 +5,6 @@ class ComplexAnnotation(val value: Annotation) extends ClassfileAnnotation ^ nested-annotation.scala:8: error: nested classfile annotations must be defined in java; found: inline @ComplexAnnotation(new inline) def bippy(): Int = 1 - ^ + ^ one warning found one error found diff --git a/test/files/neg/nested-fn-print.scala b/test/files/neg/nested-fn-print.scala index 9a4bd162c0..c599a235ab 100644 --- a/test/files/neg/nested-fn-print.scala +++ b/test/files/neg/nested-fn-print.scala @@ -2,7 +2,7 @@ object Test { var x1: Int => Float => Double = _ var x2: (Int => Float) => Double = _ var x3: Int => Double - + def main(args: Array[String]): Unit = { x1 = "a" x2 = "b" diff --git a/test/files/neg/no-implicit-to-anyref.check b/test/files/neg/no-implicit-to-anyref.check index fe417ad8b0..5ab5fd12a1 100644 --- a/test/files/neg/no-implicit-to-anyref.check +++ b/test/files/neg/no-implicit-to-anyref.check @@ -18,5 +18,5 @@ Note that AV extends Any, not AnyRef. Such types can participate in value classes, but instances cannot appear in singleton types or in reference comparisons. new AV(0): AnyRef - ^ + ^ four errors found diff --git a/test/files/neg/no-predef.check b/test/files/neg/no-predef.check index a63d8c5ba5..fc538892ef 100644 --- a/test/files/neg/no-predef.check +++ b/test/files/neg/no-predef.check @@ -7,7 +7,7 @@ no-predef.scala:3: error: type mismatch; found : java.lang.Long required: scala.Long def f2 = new java.lang.Long(5) : Long - ^ + ^ no-predef.scala:4: error: value map is not a member of String def f3 = "abc" map (_ + 1) ^ diff --git a/test/files/neg/null-unsoundness.scala b/test/files/neg/null-unsoundness.scala index 3f7e42fe17..0f8ed5e314 100644 --- a/test/files/neg/null-unsoundness.scala +++ b/test/files/neg/null-unsoundness.scala @@ -12,4 +12,3 @@ object Test extends A with App { type A = C y = 42 } - diff --git a/test/files/neg/object-not-a-value.scala b/test/files/neg/object-not-a-value.scala index 2f894a33df..207b271df2 100644 --- a/test/files/neg/object-not-a-value.scala +++ b/test/files/neg/object-not-a-value.scala @@ -1,6 +1,6 @@ object Test { import java.util._ - + def main(args: Array[String]): Unit = { List(1) map (_ + 1) } diff --git a/test/files/neg/overload-msg.scala b/test/files/neg/overload-msg.scala index 896722262d..8715c156a2 100644 --- a/test/files/neg/overload-msg.scala +++ b/test/files/neg/overload-msg.scala @@ -1,4 +1,4 @@ // type parameter shadows actual type, massive overload error confuses. -class A(x: Int) { +class A(x: Int) { def f[Int](y: Int) = x + y } diff --git a/test/files/neg/overloaded-implicit.scala b/test/files/neg/overloaded-implicit.scala index 9ab66cf560..68b1ceaa30 100644 --- a/test/files/neg/overloaded-implicit.scala +++ b/test/files/neg/overloaded-implicit.scala @@ -1,15 +1,15 @@ object Test { implicit def imp1[T](x: List[T]): Map[T, T] = Map() implicit def imp1[T](x: Set[T]): Map[T, T] = Map() - + def f[T <% Map[Int, Int]](x: T): Double = 1.0d // not parameterized, no warning - implicit def imp2(x: List[Int]): String = "a" + implicit def imp2(x: List[Int]): String = "a" implicit def imp2(x: Set[Int]): String = "b" - + def g[T <% String](x: T): Double = 2.0d - + def main(args: Array[String]): Unit = { // println(f(List(1))) println(g(List(1))) diff --git a/test/files/neg/override-object-no.scala b/test/files/neg/override-object-no.scala index 45961e4fa6..745cdb2332 100644 --- a/test/files/neg/override-object-no.scala +++ b/test/files/neg/override-object-no.scala @@ -25,7 +25,7 @@ package case1 { trait Quux4 extends Quux3 { override object Bar } // err } -// type parameter as-seen-from business +// type parameter as-seen-from business package case2 { // invariance (see pos for the covariant case) class Bar[T] diff --git a/test/files/neg/parser-errors.check b/test/files/neg/parser-errors.check new file mode 100644 index 0000000000..0ab3331c0c --- /dev/null +++ b/test/files/neg/parser-errors.check @@ -0,0 +1,16 @@ +parser-errors.scala:1: error: lazy values may not be abstract +abstract class A1 { lazy val foo: Int } + ^ +parser-errors.scala:2: error: pattern definition may not be abstract +abstract class A2 { val Some(x) } + ^ +parser-errors.scala:3: error: an explicit type is required for default initialization +abstract class A3 { var x = _ } + ^ +parser-errors.scala:4: error: only vars are eligible for default initialization +abstract class A4 { val x: Int = _ } + ^ +parser-errors.scala:5: error: pattern definition is ineligible for default initialization +abstract class A5 { var Some(x) = _ } + ^ +5 errors found diff --git a/test/files/neg/parser-errors.scala b/test/files/neg/parser-errors.scala new file mode 100644 index 0000000000..7b1a290629 --- /dev/null +++ b/test/files/neg/parser-errors.scala @@ -0,0 +1,5 @@ +abstract class A1 { lazy val foo: Int } +abstract class A2 { val Some(x) } +abstract class A3 { var x = _ } +abstract class A4 { val x: Int = _ } +abstract class A5 { var Some(x) = _ } diff --git a/test/files/neg/parser-import-errors.check b/test/files/neg/parser-import-errors.check new file mode 100644 index 0000000000..e211c275a6 --- /dev/null +++ b/test/files/neg/parser-import-errors.check @@ -0,0 +1,28 @@ +parser-import-errors.scala:12: error: not found: type B1 + new B1 + ^ +parser-import-errors.scala:13: error: not found: type C1 + new C1 + ^ +parser-import-errors.scala:19: error: object X1 is not a member of package p1 + import p1.{ A1 => X1, X1 => A1 } + ^ +parser-import-errors.scala:21: error: not found: type A1 + new A1 + ^ +parser-import-errors.scala:22: error: not found: type B1 + new B1 + ^ +parser-import-errors.scala:23: error: not found: type C1 + new C1 + ^ +parser-import-errors.scala:33: error: not found: type C1 + new C1 + ^ +parser-import-errors.scala:38: error: A1 appears twice as a target of a renaming + import p1.{ A1, B1 => A1 } + ^ +parser-import-errors.scala:45: error: object Z1 is not a member of package p1 + import p1.{ Z1, B1 => Z1 } + ^ +9 errors found diff --git a/test/files/neg/parser-import-errors.scala b/test/files/neg/parser-import-errors.scala new file mode 100644 index 0000000000..010bb95a1e --- /dev/null +++ b/test/files/neg/parser-import-errors.scala @@ -0,0 +1,49 @@ +package p1 { + class A1 + class B1 + class C1 +} + +package p2 { + import p1.{ A1, B1 => Q1, C1 => _ } + + class X { + new A1 + new B1 + new C1 + new Q1 + } +} + +package p3 { + import p1.{ A1 => X1, X1 => A1 } + class X { + new A1 + new B1 + new C1 + new X1 + } +} + +package p4 { + import p1.{ A1 => B1, B1 => A1 } + class X { + new A1 + new B1 + new C1 + } +} + +package p5 { + import p1.{ A1, B1 => A1 } + class X { + new A1 + } +} + +package p6 { + import p1.{ Z1, B1 => Z1 } + class X { + new Z1 + } +} diff --git a/test/files/neg/patmat-type-check.scala b/test/files/neg/patmat-type-check.scala index cc35089430..26d0409fa0 100644 --- a/test/files/neg/patmat-type-check.scala +++ b/test/files/neg/patmat-type-check.scala @@ -1,15 +1,15 @@ object Test { def s1 = "bob".toList match { case Seq('b', 'o', 'b') => true } // list ok - + // not final, allowed - class Bop + class Bop def s2(x: Bop) = x match { case Seq('b', 'o', 'b') => true } - + // covariance, allowed final class Bop4[+T] def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true } - + // contravariance, allowed final class Bop5[T, U, -V] def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true } @@ -17,7 +17,7 @@ object Test // free type parameter, allowed final class Bop3[T] def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true } - + // String and Array are final/invariant, disallowed def f1 = "bob".reverse match { case Seq('b', 'o', 'b') => true } // fail def f2 = "bob".toArray match { case Seq('b', 'o', 'b') => true } // fail @@ -25,7 +25,7 @@ object Test // final, no type parameters, should be disallowed final class Bop2 def f3(x: Bop2) = x match { case Seq('b', 'o', 'b') => true } // fail - + // final, invariant type parameter, should be disallowed def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail } diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 6069dfdaab..2dad608451 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -15,7 +15,7 @@ It would fail on the following inputs: Gp(), Gu def ma4(x:Deep) = x match { // missing cases: Gu, Gp ^ patmatexhaust.scala:55: warning: unreachable code - case _ if 1 == 0 => + case _ if 1 == 0 => ^ patmatexhaust.scala:53: warning: match may not be exhaustive. It would fail on the following input: Gp() diff --git a/test/files/neg/patmatexhaust.scala b/test/files/neg/patmatexhaust.scala index ceb960ee97..aa7dac7d7d 100644 --- a/test/files/neg/patmatexhaust.scala +++ b/test/files/neg/patmatexhaust.scala @@ -22,14 +22,14 @@ class TestSealedExhaustive { // compile only def ma3(x:Mult) = (x,x) match { // not exhaustive case (Kult(_), Qult()) => // Kult missing - //case Pair(Kult(_), Kult(_)) => + //case Pair(Kult(_), Kult(_)) => case (Qult(), Kult(_)) => // Qult missing - //case Pair(Qult(), Qult()) => + //case Pair(Qult(), Qult()) => } def ma3u(x:Mult) = ((x,x) : @unchecked) match { // not exhaustive, but not checked! - case (Kult(_), Qult()) => - case (Qult(), Kult(_)) => + case (Kult(_), Qult()) => + case (Qult(), Kult(_)) => } sealed abstract class Deep @@ -37,22 +37,22 @@ class TestSealedExhaustive { // compile only case object Ga extends Deep sealed class Gp extends Deep case object Gu extends Gp - + def zma3(x:Deep) = x match { // exhaustive! case _ => } def zma4(x:Deep) = x match { // exhaustive! - case Ga => + case Ga => case _ => } def ma4(x:Deep) = x match { // missing cases: Gu, Gp - case Ga => + case Ga => } def ma5(x:Deep) = x match { case Gu => - case _ if 1 == 0 => + case _ if 1 == 0 => case Ga => } @@ -65,7 +65,7 @@ class TestSealedExhaustive { // compile only case 1::2::Nil => case _ => } - + sealed class B case class B1() extends B case object B2 extends B @@ -76,7 +76,7 @@ class TestSealedExhaustive { // compile only case B1() => true // missing B, which is not abstract so must be included case B2 => true } - + object ob1 { sealed abstract class C sealed abstract class C1 extends C @@ -89,7 +89,7 @@ class TestSealedExhaustive { // compile only case C2 | C4 => true } } - + object ob2 { sealed abstract class C abstract class C1 extends C diff --git a/test/files/neg/patternalts.scala b/test/files/neg/patternalts.scala index 56b682b0ec..539df43201 100644 --- a/test/files/neg/patternalts.scala +++ b/test/files/neg/patternalts.scala @@ -1,5 +1,5 @@ object Test { List(1) match { case List(x) | List() => Console.println(x) - } + } } diff --git a/test/files/neg/primitive-sigs-1.check b/test/files/neg/primitive-sigs-1.check index 77dc457a49..d0619fa1d3 100644 --- a/test/files/neg/primitive-sigs-1.check +++ b/test/files/neg/primitive-sigs-1.check @@ -2,5 +2,5 @@ B.scala:3: error: type mismatch; found : Bippy required: AC[Integer] J.f(new Bippy()) - ^ + ^ one error found diff --git a/test/files/neg/protected-constructors.check b/test/files/neg/protected-constructors.check index e295917050..b636d076e4 100644 --- a/test/files/neg/protected-constructors.check +++ b/test/files/neg/protected-constructors.check @@ -1,21 +1,21 @@ protected-constructors.scala:17: error: too many arguments for constructor Foo1: ()dingus.Foo1 val foo1 = new Foo1("abc") - ^ + ^ protected-constructors.scala:18: error: constructor Foo2 in class Foo2 cannot be accessed in object P Access to protected constructor Foo2 not permitted because - enclosing object P in package hungus is not a subclass of + enclosing object P in package hungus is not a subclass of class Foo2 in package dingus where target is defined val foo2 = new Foo2("abc") - ^ + ^ protected-constructors.scala:19: error: class Foo3 in object Ding cannot be accessed in object dingus.Ding Access to protected class Foo3 not permitted because - enclosing object P in package hungus is not a subclass of + enclosing object P in package hungus is not a subclass of object Ding in package dingus where target is defined val foo3 = new Ding.Foo3("abc") ^ protected-constructors.scala:15: error: class Foo3 in object Ding cannot be accessed in object dingus.Ding Access to protected class Foo3 not permitted because - enclosing object P in package hungus is not a subclass of + enclosing object P in package hungus is not a subclass of object Ding in package dingus where target is defined class Bar3 extends Ding.Foo3("abc") ^ diff --git a/test/files/neg/protected-constructors.scala b/test/files/neg/protected-constructors.scala index f2662ee67c..2838caf09c 100644 --- a/test/files/neg/protected-constructors.scala +++ b/test/files/neg/protected-constructors.scala @@ -8,7 +8,7 @@ package dingus { package hungus { import dingus._ - + object P { class Bar1 extends Foo1("abc") class Bar2 extends Foo2("abc") diff --git a/test/files/neg/protected-static-fail.check b/test/files/neg/protected-static-fail.check index e149bc016f..9f0bc92e7d 100644 --- a/test/files/neg/protected-static-fail.check +++ b/test/files/neg/protected-static-fail.check @@ -3,13 +3,13 @@ S.scala:5: error: method f in object J cannot be accessed in object bippy.J ^ S.scala:6: error: method f1 in object S1 cannot be accessed in object bippy.S1 Access to protected method f1 not permitted because - enclosing object Test in package bippy is not a subclass of + enclosing object Test in package bippy is not a subclass of object S1 in package bippy where target is defined S1.f1() ^ S.scala:8: error: method f2 in class S2 cannot be accessed in bippy.S2 Access to protected method f2 not permitted because - enclosing object Test in package bippy is not a subclass of + enclosing object Test in package bippy is not a subclass of class S2 in package bippy where target is defined x.f2() ^ diff --git a/test/files/neg/saito.check b/test/files/neg/saito.check index 061a45b76e..f78b300b4c 100644 --- a/test/files/neg/saito.check +++ b/test/files/neg/saito.check @@ -1,4 +1,4 @@ saito.scala:10: error: class A cannot be instantiated because it does not conform to its self-type A with B val a: A = new A; // should not be allowed - ^ + ^ one error found diff --git a/test/files/neg/saito.scala b/test/files/neg/saito.scala index bfabb4edf4..b4fcd598e4 100644 --- a/test/files/neg/saito.scala +++ b/test/files/neg/saito.scala @@ -2,13 +2,13 @@ class B {} class A { self: B => def m(): B = { this - } + } } object Exec{ def main(args: Array[String]): Unit = { val a: A = new A; // should not be allowed - val b: B = a.m(); + val b: B = a.m(); } } diff --git a/test/files/neg/sensitive.check b/test/files/neg/sensitive.check index 32d988ec97..9270e639c3 100644 --- a/test/files/neg/sensitive.check +++ b/test/files/neg/sensitive.check @@ -1,4 +1,4 @@ sensitive.scala:17: error: constructor Sensitive in class Sensitive cannot be accessed in object Attacker val y = new Sensitive() - ^ + ^ one error found diff --git a/test/files/neg/sensitive.scala b/test/files/neg/sensitive.scala index fa1b940844..a084a0a8ca 100644 --- a/test/files/neg/sensitive.scala +++ b/test/files/neg/sensitive.scala @@ -5,8 +5,8 @@ object Admin extends Certificate; class SecurityViolationException extends Exception object Sensitive { - def makeSensitive(credentials: Certificate): Sensitive = - if (credentials == Admin) new Sensitive() + def makeSensitive(credentials: Certificate): Sensitive = + if (credentials == Admin) new Sensitive() else throw new SecurityViolationException } class Sensitive private () { @@ -16,4 +16,3 @@ object Attacker { val x = Sensitive.makeSensitive(null) val y = new Sensitive() } - diff --git a/test/files/neg/spec-overrides.scala b/test/files/neg/spec-overrides.scala index f77dadea5d..713ce27bd3 100644 --- a/test/files/neg/spec-overrides.scala +++ b/test/files/neg/spec-overrides.scala @@ -15,7 +15,7 @@ class FX2 extends P { object Test extends App { val fx = new FX val p = new P - + println(fx.a(3)) println((fx: P).a(3)) println((fx: P).a(3.0)) diff --git a/test/files/neg/specification-scopes.check b/test/files/neg/specification-scopes.check index 7af9842379..ab986135e5 100644 --- a/test/files/neg/specification-scopes.check +++ b/test/files/neg/specification-scopes.check @@ -1,5 +1,5 @@ P_2.scala:14: error: reference to x is ambiguous; -it is both defined in object C and imported subsequently by +it is both defined in object C and imported subsequently by import Q.X._ println("L14: "+x) // reference to 'x' is ambiguous here ^ diff --git a/test/files/neg/stringinterpolation_macro-neg.check b/test/files/neg/stringinterpolation_macro-neg.check index 457f497f2f..fa4f2c9472 100644 --- a/test/files/neg/stringinterpolation_macro-neg.check +++ b/test/files/neg/stringinterpolation_macro-neg.check @@ -1,6 +1,6 @@ stringinterpolation_macro-neg.scala:8: error: too few parts new StringContext().f() - ^ + ^ stringinterpolation_macro-neg.scala:9: error: too few arguments for interpolated string new StringContext("", " is ", "%2d years old").f(s) ^ diff --git a/test/files/neg/structural.scala b/test/files/neg/structural.scala index bfca37b22a..d783399317 100644 --- a/test/files/neg/structural.scala +++ b/test/files/neg/structural.scala @@ -1,54 +1,54 @@ object Test extends App { - + def f(x: { type D; def m: D }): Null = null - + class Tata - + abstract class Toto[A <: Object] { type B <: Object - + def f1[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: A): Object; val x: A }) = x.m[Tata](x.x) //fail def f2[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: B): Object; val x: B }) = x.m[Tata](x.x) //fail def f3[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: C): Object; val x: C }) = x.m[Tata](x.x) //fail def f4[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: D): Object; val x: D }) = x.m[Tata](x.x) //fail def f5[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: E): Object; val x: Tata }) = x.m[Tata](x.x) //suceed - + def f6[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): A }) = x.m[Tata](null) //suceed def f7[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): B }) = x.m[Tata](null) //suceed def f8[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): C }) = x.m[Tata](null) //suceed def f9[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): D }) = x.m[Tata](null) //fail def f0[C <: Object](x: Object{ type D <: Object; def m[E >: Null <: Object](x: Object): E }) = x.m[Tata](null) //suceed - + } - + val tata = new Tata val toto = new Toto[Tata] { type B = Tata } - + //toto.f1[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Tata): Object = null; val x = tata }) //toto.f2[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Tata): Object = null; val x = tata }) //toto.f3[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Tata): Object = null; val x = tata }) //toto.f4[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: D): Object = null; val x = tata }) toto.f5[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: E): Object = null; val x: Test.Tata = tata }) - + toto.f6[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): Tata = null }) toto.f7[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): Tata = null }) toto.f8[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): Tata = null }) //toto.f9[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): D = null }) toto.f0[Tata](new Object{ type D = Tata; def m[E >: Null <: Object](x: Object): E = null }) - + /* Bug #1246 */ type Summable[T] = { def +(v : T) : T } def sum[T <: Summable[T]](xs : List[T]) = xs.reduceLeft[T](_ + _) - + /* Bug #1004 & #967 */ type S1 = { def f(p: this.type): Unit } val s1 = new { def f(p: this.type): Unit = () } - + type S2 = { type T; def f(p: T): Unit } //val s2: S2 = new { type T = A; def f(p: T): Unit = () } - + def s3[U >: Null <: Object](p: { def f(p: U): Unit; def u: U }) = () - + } diff --git a/test/files/neg/switch.scala b/test/files/neg/switch.scala index 198583fe41..a66ed768fa 100644 --- a/test/files/neg/switch.scala +++ b/test/files/neg/switch.scala @@ -16,44 +16,44 @@ object Main { case 'f' | 'g' => true case _ => false } - + def succ2(c: Char) = (c: @switch) match { case 'A' | 'B' | 'C' => true case Other.C2 => true case Other.C4 => true case _ => false } - + // has a guard, but since SI-5830 that's ok def succ_guard(c: Char) = (c: @switch) match { case 'A' | 'B' | 'C' => true case x if x == 'A' => true case _ => false } - + // throwing in @unchecked on the next two to make sure // multiple annotations are processed correctly - + // thinks a val in an object is constant... so naive def fail2(c: Char) = (c: @switch @unchecked) match { case 'A' => true case Other.C1 => true case _ => false } - + // more naivete def fail3(c: Char) = (c: @unchecked @switch) match { case 'A' => true case Other.C3 => true case _ => false } - + // guard case done correctly def succ3(c: Char) = (c: @switch) match { case 'A' | 'B' | 'C' => true case x => x == 'A' } - + // some ints just to mix it up a bit def succ4(x: Int, y: Int) = ((x+y): @switch) match { case 1 => 5 @@ -62,5 +62,5 @@ object Main { case 4 => 50 case 5|6|7|8 => 100 case _ => -1 - } + } } diff --git a/test/files/neg/t0117.scala b/test/files/neg/t0117.scala index c73227d26d..4cd9ad6ef1 100644 --- a/test/files/neg/t0117.scala +++ b/test/files/neg/t0117.scala @@ -3,4 +3,3 @@ trait B extends A { println(super[A].a) } object Test extends App { new B {} } - diff --git a/test/files/neg/t0152.scala b/test/files/neg/t0152.scala index dc77ac31a3..d86d59e974 100644 --- a/test/files/neg/t0152.scala +++ b/test/files/neg/t0152.scala @@ -8,6 +8,6 @@ trait PlusOne extends Value[Int] { object Test extends App { object boom extends Value[java.lang.String]("foo") with PlusOne - + println(boom.value) // class cast exception! } diff --git a/test/files/neg/t0209.check b/test/files/neg/t0209.check index 1904e58e7a..4ba5fef4e9 100644 --- a/test/files/neg/t0209.check +++ b/test/files/neg/t0209.check @@ -2,5 +2,5 @@ t0209.scala:15: error: type mismatch; found : C required: _1.type where val _1: A (new B: A).f(new C) - ^ + ^ one error found diff --git a/test/files/neg/t0218.check b/test/files/neg/t0218.check index 6bb759156f..a22583d23b 100644 --- a/test/files/neg/t0218.check +++ b/test/files/neg/t0218.check @@ -1,4 +1,4 @@ t0218.scala:10: error: class type required but APQ.this.P found - List(new PP) + List(new PP) ^ one error found diff --git a/test/files/neg/t0218.scala b/test/files/neg/t0218.scala index 3d1f52e39a..319be82a7a 100644 --- a/test/files/neg/t0218.scala +++ b/test/files/neg/t0218.scala @@ -1,4 +1,4 @@ -trait APQ { +trait APQ { class Placement { } @@ -7,6 +7,6 @@ trait APQ { type PP = P def pq(numQueens: Int, numRows: Int) : List[Placement] = { - List(new PP) + List(new PP) } } diff --git a/test/files/neg/t0503.scala b/test/files/neg/t0503.scala index a9b5dcb1dd..322e1ad132 100644 --- a/test/files/neg/t0503.scala +++ b/test/files/neg/t0503.scala @@ -1,3 +1,3 @@ val x = new { } with { } -trait A +trait A val y = new { } with A diff --git a/test/files/neg/t0816.scala b/test/files/neg/t0816.scala index 738a634166..0128a0ad72 100644 --- a/test/files/neg/t0816.scala +++ b/test/files/neg/t0816.scala @@ -6,7 +6,7 @@ case class Ctest(override val data: String) extends Btest(data, true) class testCaseClass { def test(x: Atest) = x match { - case Ctest(data) => Console.println("C") + case Ctest(data) => Console.println("C") case Btest(data, b) => Console.println("B") } } diff --git a/test/files/neg/t1038.check b/test/files/neg/t1038.check index b191b89ad1..c74d8b338f 100644 --- a/test/files/neg/t1038.check +++ b/test/files/neg/t1038.check @@ -1,5 +1,5 @@ t1038.scala:4: error: not enough arguments for constructor X: (x: Int)X. Unspecified value parameter x. val a = new X - ^ + ^ one error found diff --git a/test/files/neg/t1112.scala b/test/files/neg/t1112.scala index b2a374c785..1a88629faf 100644 --- a/test/files/neg/t1112.scala +++ b/test/files/neg/t1112.scala @@ -1,13 +1,13 @@ // checks that error doesn't crash the compiler -// (due to isFunctionType normalizing Type1 to a function type, +// (due to isFunctionType normalizing Type1 to a function type, // but then the code that used that test not using the normalized type for further operations) class Test { type Type1 = () => Unit - + def call(p: Int)(f: => Type1) = { f() } - + def run = { call(0,() => System.out.println("here we are")) } diff --git a/test/files/neg/t112706A.check b/test/files/neg/t112706A.check index 30d0c3ec91..ad403ab134 100644 --- a/test/files/neg/t112706A.check +++ b/test/files/neg/t112706A.check @@ -1,6 +1,6 @@ t112706A.scala:5: error: constructor cannot be instantiated to expected type; found : (T1, T2) required: String - case Tuple2(node,_) => + case Tuple2(node,_) => ^ one error found diff --git a/test/files/neg/t112706A.scala b/test/files/neg/t112706A.scala index b7799af96d..11304720bc 100644 --- a/test/files/neg/t112706A.scala +++ b/test/files/neg/t112706A.scala @@ -2,7 +2,7 @@ package test; trait Test { def foo(p : List[Tuple2[String,String]]) = { for (t <- p) t._1 match { - case Tuple2(node,_) => + case Tuple2(node,_) => } } } diff --git a/test/files/neg/t1183.scala b/test/files/neg/t1183.scala index 024c4abd54..23868ab401 100644 --- a/test/files/neg/t1183.scala +++ b/test/files/neg/t1183.scala @@ -9,7 +9,7 @@ object Test { case class Bar(i:Int) } - + class Test717 { val foo1 = new Foo(1) @@ -27,7 +27,7 @@ object Test { class Baz object Bam object Bar - + def unapply(s : String) : Option[Bar] = Some(new Bar(s)) } diff --git a/test/files/neg/t1477.scala b/test/files/neg/t1477.scala index ab13f14b06..a9a6d678ca 100644 --- a/test/files/neg/t1477.scala +++ b/test/files/neg/t1477.scala @@ -8,7 +8,7 @@ object Test extends App { type V <: D val y: V#T = new B { } } - + trait Middle extends C { type V <: (D with U) } diff --git a/test/files/neg/t1523.scala b/test/files/neg/t1523.scala index b8754f4e15..219fb0c060 100644 --- a/test/files/neg/t1523.scala +++ b/test/files/neg/t1523.scala @@ -1,5 +1,5 @@ -object test { +object test { def bug(x: Any) = x - + def go() = bug("a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a") } diff --git a/test/files/neg/t1623.check b/test/files/neg/t1623.check index 251039ad30..e30db5cddd 100644 --- a/test/files/neg/t1623.check +++ b/test/files/neg/t1623.check @@ -1,4 +1,4 @@ t1623.scala:11: error: class BImpl cannot be instantiated because it does not conform to its self-type test.BImpl with test.A val b = new BImpl - ^ + ^ one error found diff --git a/test/files/neg/t1623.scala b/test/files/neg/t1623.scala index d02fc2ed9e..f5189aa4ca 100644 --- a/test/files/neg/t1623.scala +++ b/test/files/neg/t1623.scala @@ -1,7 +1,7 @@ package test -trait A -trait B +trait A +trait B class BImpl extends B { this: A => diff --git a/test/files/neg/t1705.check b/test/files/neg/t1705.check index 7f75bd0fb5..12f5c27de6 100644 --- a/test/files/neg/t1705.check +++ b/test/files/neg/t1705.check @@ -1,6 +1,6 @@ t1705.scala:9: error: can't existentially abstract over parameterized type this.T[Z] val c = new C{ - ^ + ^ t1705.scala:14: error: can't existentially abstract over parameterized type C[String] val x1 = { ^ diff --git a/test/files/neg/t1705.scala b/test/files/neg/t1705.scala index bf1fcea815..fabdca0ec6 100644 --- a/test/files/neg/t1705.scala +++ b/test/files/neg/t1705.scala @@ -17,7 +17,7 @@ object crashing { } } } -/* +/* Infinite loop in Typer.addLocals. Printing all calls to it: diff --git a/test/files/neg/t1878.scala b/test/files/neg/t1878.scala index 99fee48a96..b29186afc0 100644 --- a/test/files/neg/t1878.scala +++ b/test/files/neg/t1878.scala @@ -1,13 +1,13 @@ object Test extends App { - // illegal + // illegal val err1 = "" match { case Seq(f @ _*, ',') => f } - + // no error val List(List(arg1, _*), _) = List(List(1,2,3), List(4,5,6)) - + // illegal val List(List(_*, arg2), _) = List(List(1,2,3), List(4,5,6)) - + /* see t1878-typer.scala // illegal - bug #1764 null match { diff --git a/test/files/neg/t2148.scala b/test/files/neg/t2148.scala index c0521d9864..25788be84a 100644 --- a/test/files/neg/t2148.scala +++ b/test/files/neg/t2148.scala @@ -1,6 +1,6 @@ -class A { +class A { var i = 0 - trait A1 extends A { + trait A1 extends A { i += 1 } } diff --git a/test/files/neg/t2421b.scala b/test/files/neg/t2421b.scala index a8d22f285e..d8159a8c37 100644 --- a/test/files/neg/t2421b.scala +++ b/test/files/neg/t2421b.scala @@ -12,6 +12,6 @@ object Test { f } -/* bug: +/* bug: error: type arguments [Test2.A] do not conform to method b's type parameter bounds [X <: Test2.B] */
\ No newline at end of file diff --git a/test/files/neg/t2441.scala b/test/files/neg/t2441.scala index a8c9e728a2..6784ebb333 100644 --- a/test/files/neg/t2441.scala +++ b/test/files/neg/t2441.scala @@ -1,5 +1,5 @@ trait X -trait A { +trait A { def f: Option[X] def g: Option[X] } @@ -8,7 +8,7 @@ object B { } class B extends A { private class Bippy - + override def f = Some(new B.Y) override def g: Option[X] = Some(new B.Y) } diff --git a/test/files/neg/t2641.scala b/test/files/neg/t2641.scala index 626d5d7852..bc048e039e 100644 --- a/test/files/neg/t2641.scala +++ b/test/files/neg/t2641.scala @@ -8,7 +8,7 @@ abstract class ManagedSeqStrict[+A] with GenericTraversableTemplate[A, ManagedSeqStrict] { override def companion: GenericCompanion[ManagedSeqStrict] = null - + override def foreach[U](f: A => U): Unit = () } @@ -17,9 +17,9 @@ trait ManagedSeq[+A, +Coll] with TraversableView[A, ManagedSeqStrict[A]] with TraversableViewLike[A, ManagedSeqStrict[A], ManagedSeq[A]] { self => - + override def underlying = throw new Exception("no underlying") - + //trait Transformed[+B] extends ManagedSeq[B] with super.Transformed[B] trait Transformed[+B] extends ManagedSeq[B, Coll] with super.Transformed[B] diff --git a/test/files/neg/t2775.check b/test/files/neg/t2775.check index 934a970f2e..2c901665d6 100644 --- a/test/files/neg/t2775.check +++ b/test/files/neg/t2775.check @@ -1,4 +1,4 @@ t2775.scala:1: error: cannot find class tag for element type B.this.T trait B[S] { type T = S; val c = new Array[T](1) } - ^ + ^ one error found diff --git a/test/files/neg/t2870.scala b/test/files/neg/t2870.scala index 59fba3e76d..4de19242e3 100755 --- a/test/files/neg/t2870.scala +++ b/test/files/neg/t2870.scala @@ -1,9 +1,9 @@ class Jars(jar: Jar) -object Jars { +object Jars { import scala.util.Properties.javaClassPath - val scala = fromClasspathString(javaClassPath) - + val scala = fromClasspathString(javaClassPath) + def fromClasspathString(s: String): Jars = null } diff --git a/test/files/neg/t2910.scala b/test/files/neg/t2910.scala index fa51038dcd..d9a781032c 100644 --- a/test/files/neg/t2910.scala +++ b/test/files/neg/t2910.scala @@ -10,7 +10,7 @@ object Junk { val z = 0 lazy val s = "abc" } - + def test4() { lazy val x = { x @@ -35,5 +35,5 @@ object Test { lazy val f: Int = g var x: Int = f lazy val g: Int = x - } + } } diff --git a/test/files/neg/t3015.check b/test/files/neg/t3015.check index 6948392bb0..729db844e7 100644 --- a/test/files/neg/t3015.check +++ b/test/files/neg/t3015.check @@ -1,6 +1,6 @@ t3015.scala:7: error: scrutinee is incompatible with pattern type; found : _$1 required: String - val b(foo) = "foo" + val b(foo) = "foo" ^ one error found diff --git a/test/files/neg/t3015.scala b/test/files/neg/t3015.scala index 9af8f30c65..adfa15b388 100644 --- a/test/files/neg/t3015.scala +++ b/test/files/neg/t3015.scala @@ -4,5 +4,5 @@ class UnApp[P] { object Test extends App { val b: UnApp[_] = new UnApp[String] - val b(foo) = "foo" + val b(foo) = "foo" } diff --git a/test/files/neg/t3118.scala b/test/files/neg/t3118.scala index 75f3b8f50c..9be24c1ed4 100644 --- a/test/files/neg/t3118.scala +++ b/test/files/neg/t3118.scala @@ -1,8 +1,8 @@ class O1 { private[this] case class C() - + val x = new O1 - + println(x.C()) // should not be accessible println(new x.C) // is correctly not accessible } diff --git a/test/files/neg/t3234.scala b/test/files/neg/t3234.scala index 443d0467f0..1553f1fa05 100644 --- a/test/files/neg/t3234.scala +++ b/test/files/neg/t3234.scala @@ -1,6 +1,6 @@ trait Trait1 { // need more work before this one works - // @inline + // @inline def foo2(n: Int) = n*n } diff --git a/test/files/neg/t3399.scala b/test/files/neg/t3399.scala index b1fe4e5ee2..3edaa0724f 100644 --- a/test/files/neg/t3399.scala +++ b/test/files/neg/t3399.scala @@ -10,7 +10,7 @@ object Nats { type FoldR[Init <: Type, Type, F <: Fold[Nat, Type]] = F#Apply[Succ[N], N#FoldR[Init, Type, F]] } - + type Add[A <: Nat, B <: Nat] = A#FoldR[B, Nat, Inc] trait Fold[-Elem, Value] { type Apply[N <: Elem, Acc <: Value] <: Value @@ -18,7 +18,7 @@ object Nats { type Inc = Fold[Any, Nat] { type Apply[N <: Any, Acc <: Nat] = Succ[Acc] } - + type _1 = Succ[_0] implicitly[ Add[_1, _1] =:= _1] }
\ No newline at end of file diff --git a/test/files/neg/t3453.check b/test/files/neg/t3453.check index 52c948128c..2472e8b212 100644 --- a/test/files/neg/t3453.check +++ b/test/files/neg/t3453.check @@ -2,20 +2,20 @@ t3453.scala:18: error: type mismatch; found : A required: B new A - ^ + ^ t3453.scala:36: error: type mismatch; found : A required: B new A - ^ + ^ t3453.scala:50: error: type mismatch; found : A required: B new A - ^ + ^ t3453.scala:64: error: type mismatch; found : A required: B new A - ^ + ^ four errors found diff --git a/test/files/neg/t3453.scala b/test/files/neg/t3453.scala index 0f1c6e0282..090b777151 100644 --- a/test/files/neg/t3453.scala +++ b/test/files/neg/t3453.scala @@ -25,7 +25,7 @@ object O { class T2a { import O._ - + def x: B = { val aToB = 3 // ok: doesn't compile, because aToB method requires 'T.this.' prefix @@ -39,7 +39,7 @@ class T2a { class T2b { import O.aToB - + def x: B = { val aToB = 3 // ok: doesn't compile, because aToB method requires 'T.this.' prefix @@ -53,7 +53,7 @@ class T2b { class T3 { implicit def aToB(a: A): B = new B - + def x: B = { val aToB = 3 // ok: doesn't compile, because aToB method requires 'T.this.' prefix diff --git a/test/files/neg/t3507-old.scala b/test/files/neg/t3507-old.scala index 32688d3934..9a8c7c5462 100644 --- a/test/files/neg/t3507-old.scala +++ b/test/files/neg/t3507-old.scala @@ -8,7 +8,7 @@ class A { object Test { var a: A = new A // mutable val c /*: object _1.b.c forSome { val _1: A } */ = a.m // widening using existential - + def mani[T: Manifest](x: T) = () mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier // --> _1 is not in scope here diff --git a/test/files/neg/t3683b.scala b/test/files/neg/t3683b.scala index fbf75b6856..646e418121 100644 --- a/test/files/neg/t3683b.scala +++ b/test/files/neg/t3683b.scala @@ -8,7 +8,7 @@ case class Z[T >: Bar <: Foo]( z1: W[T] ) extends W[T] -object Main { +object Main { // should fail for including X() def f1(w: W[Bar]): Int = { w match { diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check index 9b96449930..358eaed41e 100644 --- a/test/files/neg/t3692-new.check +++ b/test/files/neg/t3692-new.check @@ -9,7 +9,7 @@ t3692-new.scala:16: warning: non-variable type argument Int in type pattern Map[ ^ t3692-new.scala:15: warning: unreachable code case m1: Map[Int, V] => new java.util.HashMap[Integer, V] - ^ + ^ t3692-new.scala:4: warning: Tester has a main method with parameter type Array[String], but Tester will not be a runnable program. Reason: main method must have exact signature (Array[String])Unit object Tester { diff --git a/test/files/neg/t3714-neg.check b/test/files/neg/t3714-neg.check index 2db0655502..4f29716968 100644 --- a/test/files/neg/t3714-neg.check +++ b/test/files/neg/t3714-neg.check @@ -1,12 +1,12 @@ t3714-neg.scala:17: error: value break in class BreakImpl cannot be accessed in BreakImpl Access to protected value break not permitted because - enclosing object Test is not a subclass of + enclosing object Test is not a subclass of class BreakImpl where target is defined case b: BreakImpl => b.break ^ t3714-neg.scala:25: error: value break in class BreakImpl cannot be accessed in BreakImpl Access to protected value break not permitted because - enclosing object Test is not a subclass of + enclosing object Test is not a subclass of class BreakImpl where target is defined case b: BreakImpl => b.break ^ diff --git a/test/files/neg/t3714-neg.scala b/test/files/neg/t3714-neg.scala index 4b56f9348c..753b367ec0 100644 --- a/test/files/neg/t3714-neg.scala +++ b/test/files/neg/t3714-neg.scala @@ -29,7 +29,7 @@ object Test { case BreakImpl(x) => x case _ => -1 } - + def main(args: Array[String]) { val break = BreakImpl(22) assert(f1(break) == 22) diff --git a/test/files/neg/t3736.scala b/test/files/neg/t3736.scala index 1efa397928..cf0920912a 100644 --- a/test/files/neg/t3736.scala +++ b/test/files/neg/t3736.scala @@ -7,14 +7,14 @@ object Test { def f5 = super.!=(new AnyRef) def f6 = super.## } - + // Ill-advised overloads to be sure... class B { def ##(x: String) = true def ==(x1: String, xs: List[_]) = true def !=(x1: String, xs: List[_]) = true } - + class C extends B { override def ##(x: String) = super.##(x) override def ==(x1: String, xs: List[_]) = super.==(x1, xs) diff --git a/test/files/neg/t3757/B.scala b/test/files/neg/t3757/B.scala index 68766a9f6e..7c78fb634e 100644 --- a/test/files/neg/t3757/B.scala +++ b/test/files/neg/t3757/B.scala @@ -1,5 +1,5 @@ package b -class B extends a.A { +class B extends a.A { override def foo = "B" }
\ No newline at end of file diff --git a/test/files/neg/t3776.check b/test/files/neg/t3776.check index 4a5284cf0f..0dfe129596 100644 --- a/test/files/neg/t3776.check +++ b/test/files/neg/t3776.check @@ -1,4 +1,4 @@ t3776.scala:8: error: value someOperation is not a member of _$1 - def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v + def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v ^ one error found diff --git a/test/files/neg/t3776.scala b/test/files/neg/t3776.scala index 1075816511..e24b2fea63 100644 --- a/test/files/neg/t3776.scala +++ b/test/files/neg/t3776.scala @@ -5,6 +5,6 @@ object MyParser { } object Test { class ParsedAs(a: String) (implicit pattern: MyParser.Parser[_]) { - def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v + def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v } } diff --git a/test/files/neg/t3816.scala b/test/files/neg/t3816.scala index b7f3fde699..31b0825f1d 100644 --- a/test/files/neg/t3816.scala +++ b/test/files/neg/t3816.scala @@ -1,7 +1,7 @@ class B { def ::(a: List[Int]) { a match { - case x::xs => + case x::xs => case _ => } } @@ -32,11 +32,11 @@ object Test { } } - var foo = 0 + var foo = 0 def testFail2( x: Any ) = { x match { case Some( `foo` ) => case _ => } - } + } } diff --git a/test/files/neg/t3934.check b/test/files/neg/t3934.check index 405ed2e879..8b06799f0d 100644 --- a/test/files/neg/t3934.check +++ b/test/files/neg/t3934.check @@ -1,6 +1,6 @@ t3934.scala:15: error: method f2 in class J cannot be accessed in test.J Access to protected method f2 not permitted because - enclosing class S1 in package nest is not a subclass of + enclosing class S1 in package nest is not a subclass of class J in package test where target is defined def g2(x: J) = x.f2() ^ diff --git a/test/files/neg/t3977.check b/test/files/neg/t3977.check index 72335a0926..4242059463 100644 --- a/test/files/neg/t3977.check +++ b/test/files/neg/t3977.check @@ -1,4 +1,4 @@ t3977.scala:12: error: could not find implicit value for parameter w: False#If[E] new NoNull - ^ + ^ one error found diff --git a/test/files/neg/t3987.scala b/test/files/neg/t3987.scala index c97d57b38f..1226d80228 100644 --- a/test/files/neg/t3987.scala +++ b/test/files/neg/t3987.scala @@ -1,7 +1,7 @@ class Gox { object Zed { } class Zed { } -} +} object Test { type GoxZed = t#Zed forSome { type t <: Gox } diff --git a/test/files/neg/t4079/t4079_1.scala b/test/files/neg/t4079/t4079_1.scala index 8dc73556c7..cbae864788 100644 --- a/test/files/neg/t4079/t4079_1.scala +++ b/test/files/neg/t4079/t4079_1.scala @@ -9,7 +9,7 @@ trait ComposeT[F[_],G[_]] { case class Compose[F[_],G[_]]() { def Functor(implicit f: Functor[F], g: Functor[G]): Functor[ComposeT[F,G]#Apply] = new Functor[ComposeT[F,G]#Apply] { - def map[A,B](c: ComposeT[F,G]#Apply[A], h: A => B) = + def map[A,B](c: ComposeT[F,G]#Apply[A], h: A => B) = f.map(c, (x:G[A]) => g.map(x,h)) } } @@ -19,10 +19,10 @@ object Cat { } object Functors { - implicit val List = new Functor[List] { + implicit val List = new Functor[List] { def map[A,B](fa: List[A], f: A => B): List[B] = fa map f } - implicit val Option = new Functor[Option] { + implicit val Option = new Functor[Option] { def map[A,B](fa: Option[A], f: A => B): Option[B] = fa map f } } diff --git a/test/files/neg/t4098.check b/test/files/neg/t4098.check index 7d69cf151c..232c082ec9 100644 --- a/test/files/neg/t4098.check +++ b/test/files/neg/t4098.check @@ -1,5 +1,5 @@ t4098.scala:3: error: forward reference not allowed from self constructor invocation - this(b) + this(b) ^ t4098.scala:8: error: forward reference not allowed from self constructor invocation this(b) diff --git a/test/files/neg/t4098.scala b/test/files/neg/t4098.scala index 744d6191b5..2e6d167646 100644 --- a/test/files/neg/t4098.scala +++ b/test/files/neg/t4098.scala @@ -1,6 +1,6 @@ -class A(a: Any) { - def this() = { - this(b) +class A(a: Any) { + def this() = { + this(b) def b = new {} } diff --git a/test/files/neg/t4134.scala b/test/files/neg/t4134.scala index 678e4806ef..18f813dd1d 100644 --- a/test/files/neg/t4134.scala +++ b/test/files/neg/t4134.scala @@ -3,16 +3,16 @@ trait T1 { def f: String -} +} trait T2 extends T1 { abstract override def f: String = "goo" def something = super.f // So the "abstract override" is needed -} +} trait Q1 { def f: String = "bippy" -} +} //trait T3 extends Q1 with T2 { trait T3 extends T2 with Q1 { diff --git a/test/files/neg/t4163.check b/test/files/neg/t4163.check index 47bc78d31c..a09a522e3a 100644 --- a/test/files/neg/t4163.check +++ b/test/files/neg/t4163.check @@ -1,7 +1,4 @@ -t4163.scala:4: error: '<-' expected but '=' found. +t4163.scala:4: error: for comprehension must start with generator: '<-' expected but '=' found. x = 3 ^ -t4163.scala:5: error: illegal start of simple expression - y <- 0 to 100 -^ -two errors found +one error found diff --git a/test/files/neg/t4174.scala b/test/files/neg/t4174.scala index f5242950c2..b4a5ab29da 100644 --- a/test/files/neg/t4174.scala +++ b/test/files/neg/t4174.scala @@ -2,7 +2,7 @@ class C object Test { def foo(c: C) = 0 - + def main(args: Array[String]): Unit = { foo(new C { override def bar = 1 }) } diff --git a/test/files/neg/t4196.scala b/test/files/neg/t4196.scala index ac00b19bee..06e1f28d54 100644 --- a/test/files/neg/t4196.scala +++ b/test/files/neg/t4196.scala @@ -1,6 +1,6 @@ object Weird { - { (s: String) => + { (s: String) => val foo = Some(s); // to illustrate that vals are printed in the error - foo + foo }.apply("first param") ("spurious param") }
\ No newline at end of file diff --git a/test/files/neg/t4217.check b/test/files/neg/t4217.check index e8cd5fd69e..6c49ec3354 100644 --- a/test/files/neg/t4217.check +++ b/test/files/neg/t4217.check @@ -1,4 +1,4 @@ t4217.scala:2: error: 'case' expected but '}' found. - 42 match { } + 42 match { } ^ one error found diff --git a/test/files/neg/t4217.scala b/test/files/neg/t4217.scala index 9343a9be54..0817df2cb7 100644 --- a/test/files/neg/t4217.scala +++ b/test/files/neg/t4217.scala @@ -1,3 +1,3 @@ object A extends App { - 42 match { } + 42 match { } } diff --git a/test/files/neg/t4221.scala b/test/files/neg/t4221.scala index c979f7936e..0a8b8add18 100644 --- a/test/files/neg/t4221.scala +++ b/test/files/neg/t4221.scala @@ -1,5 +1,5 @@ class Cl { - class Sub[TheSub <: Sub[TheSub]] + class Sub[TheSub <: Sub[TheSub]] } case class Wrapper[T](v: T) diff --git a/test/files/neg/t4417.check b/test/files/neg/t4417.check index 4e3f6c0b10..dfc9feca24 100644 --- a/test/files/neg/t4417.check +++ b/test/files/neg/t4417.check @@ -1,7 +1,7 @@ t4417.scala:11: error: constructor Pixel$mcD$sp in class Pixel$mcD$sp cannot be accessed in object Pixel Access to protected constructor Pixel$mcD$sp not permitted because - enclosing object Pixel is not a subclass of + enclosing object Pixel is not a subclass of class Pixel$mcD$sp where target is defined def apply(v: Double): Pixel1d = new Pixel1d(v) - ^ + ^ one error found diff --git a/test/files/neg/t4417.scala b/test/files/neg/t4417.scala index 7f104e58bf..3f6ddc8153 100644 --- a/test/files/neg/t4417.scala +++ b/test/files/neg/t4417.scala @@ -2,12 +2,12 @@ -class Pixel[@specialized T] protected (var v: T) +class Pixel[@specialized T] protected (var v: T) object Pixel { type Pixel1d = Pixel[Double] - + def apply(v: Double): Pixel1d = new Pixel1d(v) } diff --git a/test/files/neg/t4431.scala b/test/files/neg/t4431.scala index 91e4abfe36..5fbb239e04 100644 --- a/test/files/neg/t4431.scala +++ b/test/files/neg/t4431.scala @@ -7,7 +7,7 @@ object Test { // this earns a VerifyError. trait C { def wait (): Unit } class D { } - + def main(args: Array[String]): Unit = { new B with A { } new BB diff --git a/test/files/neg/t4457_1.scala b/test/files/neg/t4457_1.scala index 91d9bc9f51..11f12379f6 100644 --- a/test/files/neg/t4457_1.scala +++ b/test/files/neg/t4457_1.scala @@ -22,7 +22,7 @@ object ImplicitConvAmbiguity2 { def aFunc[A](a: NQ[A]) = new BB[A] def bFunc[T](e1: N[T]) = {} - + def typeMe1 { val x = aFunc(4F) bFunc(x) diff --git a/test/files/neg/t4457_2.scala b/test/files/neg/t4457_2.scala index b2e7505cf2..f3a170f1f2 100644 --- a/test/files/neg/t4457_2.scala +++ b/test/files/neg/t4457_2.scala @@ -22,7 +22,7 @@ object ImplicitConvAmbiguity2 { def aFunc[A](a: NQ[A]) = new BB[A] def bFunc[T](e1: N[T]) = {} - + def typeMe2 { val x = aFunc(4F) bFunc(x) diff --git a/test/files/neg/t4515.scala b/test/files/neg/t4515.scala index 63049f201d..4efe45f4fb 100644 --- a/test/files/neg/t4515.scala +++ b/test/files/neg/t4515.scala @@ -16,7 +16,7 @@ object Main { ctx: PushEventContext[EventType]): Unit } val handlers = new HashMap[DerivedPushNode[_], HandlerBase[_]] - + object TimerPushService { private val INSTANCE: TimerPushService = new TimerPushService def get: TimerPushService = INSTANCE diff --git a/test/files/neg/t4541b.scala b/test/files/neg/t4541b.scala index 7a21ffc156..ba406cad6d 100644 --- a/test/files/neg/t4541b.scala +++ b/test/files/neg/t4541b.scala @@ -8,7 +8,7 @@ final class SparseArray[@specialized(Int) T](private var data: Array[T]) extends def use(inData: Array[T]) = { data = inData; } - + def set(that: SparseArray[T]) = { use(that.data.clone) } diff --git a/test/files/neg/t4727.check b/test/files/neg/t4727.check index a17cdde044..55d4d01b97 100644 --- a/test/files/neg/t4727.check +++ b/test/files/neg/t4727.check @@ -1,5 +1,5 @@ t4727.scala:5: error: an expression of type Null is ineligible for implicit conversion Error occurred in an application involving default arguments. new C[Int] - ^ + ^ one error found diff --git a/test/files/neg/t4749.check b/test/files/neg/t4749.check index 34eed6e433..63d5c21532 100644 --- a/test/files/neg/t4749.check +++ b/test/files/neg/t4749.check @@ -18,7 +18,7 @@ t4749.scala:16: warning: Fail4 has a main method with parameter type Array[Strin t4749.scala:21: warning: Fail5 has a main method with parameter type Array[String], but bippy.Fail5 will not be a runnable program. Reason: companion contains its own main method, which means no static forwarder can be generated. - object Fail5 extends Fail5 { } + object Fail5 extends Fail5 { } ^ t4749.scala:26: warning: Fail6 has a main method with parameter type Array[String], but bippy.Fail6 will not be a runnable program. Reason: companion contains its own main method (implementation restriction: no main is allowed, regardless of signature), which means no static forwarder can be generated. diff --git a/test/files/neg/t4749.scala b/test/files/neg/t4749.scala index 0973c36097..2c67e2ea96 100644 --- a/test/files/neg/t4749.scala +++ b/test/files/neg/t4749.scala @@ -18,7 +18,7 @@ package bippy { } trait Fail4 { } - object Fail5 extends Fail5 { } + object Fail5 extends Fail5 { } class Fail5 { def main(args: Array[String]): Unit = () } diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check index 4f2919807e..6d0f424e82 100644 --- a/test/files/neg/t4851.check +++ b/test/files/neg/t4851.check @@ -3,19 +3,19 @@ S.scala:2: warning: Adapting argument list by inserting (): leaky (Object-receiv given arguments: <none> after adaptation: new J((): Unit) val x1 = new J - ^ + ^ S.scala:3: warning: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. signature: J(x: Any): J given arguments: <none> after adaptation: new J((): Unit) val x2 = new J() - ^ + ^ S.scala:4: warning: Adapting argument list by creating a 5-tuple: this may not be what you want. signature: J(x: Any): J given arguments: 1, 2, 3, 4, 5 after adaptation: new J((1, 2, 3, 4, 5): (Int, Int, Int, Int, Int)) val x3 = new J(1, 2, 3, 4, 5) - ^ + ^ S.scala:6: warning: Adapting argument list by creating a 3-tuple: this may not be what you want. signature: Some.apply[A](x: A): Some[A] given arguments: 1, 2, 3 @@ -27,19 +27,19 @@ S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not b given arguments: 1, 2, 3 after adaptation: new Some((1, 2, 3): (Int, Int, Int)) val y2 = new Some(1, 2, 3) - ^ + ^ S.scala:9: warning: Adapting argument list by inserting (): this is unlikely to be what you want. signature: J2[T](x: T): J2[T] given arguments: <none> after adaptation: new J2((): Unit) val z1 = new J2 - ^ + ^ S.scala:10: warning: Adapting argument list by inserting (): this is unlikely to be what you want. signature: J2[T](x: T): J2[T] given arguments: <none> after adaptation: new J2((): Unit) val z2 = new J2() - ^ + ^ S.scala:14: warning: Adapting argument list by creating a 3-tuple: this may not be what you want. signature: Test.anyId(a: Any): Any given arguments: 1, 2, 3 diff --git a/test/files/neg/t4851/J.java b/test/files/neg/t4851/J.java index dbf8b8288e..9c35b8a16e 100644 --- a/test/files/neg/t4851/J.java +++ b/test/files/neg/t4851/J.java @@ -1,14 +1,14 @@ public class J { Object x; - + public J(Object x) { this.x = x; } - + public J(int x1, int x2, int x3, int x4, int x5, int x6) { this.x = null; } - + public String toString() { return "J:" + x.getClass(); } diff --git a/test/files/neg/t4851/J2.java b/test/files/neg/t4851/J2.java index c3a7231315..82954d9489 100644 --- a/test/files/neg/t4851/J2.java +++ b/test/files/neg/t4851/J2.java @@ -1,10 +1,10 @@ public class J2<T> { T x; - + public <T> J(T x) { this.x = x; } - + public String toString() { return "J2:" + x.getClass(); } diff --git a/test/files/neg/t4851/S.scala b/test/files/neg/t4851/S.scala index 0a442ac7a9..779ba376b0 100644 --- a/test/files/neg/t4851/S.scala +++ b/test/files/neg/t4851/S.scala @@ -5,7 +5,7 @@ object Test { val y1 = Some(1, 2, 3) val y2 = new Some(1, 2, 3) - + val z1 = new J2 val z2 = new J2() val z3 = new J2(()) @@ -18,7 +18,7 @@ object Test { println(x2) println(x3) println(y1) - + println(z1) println(z2) println(z3) diff --git a/test/files/neg/t4877.scala b/test/files/neg/t4877.scala index 9cad156f84..5d97877518 100644 --- a/test/files/neg/t4877.scala +++ b/test/files/neg/t4877.scala @@ -13,7 +13,7 @@ class B { def bar(x: Int): Mom def bippy(): List[Mom] } - + val x: Bippy = new AnyRef { type Mom = String def bar(x: Int) = 55 diff --git a/test/files/neg/t4987.check b/test/files/neg/t4987.check index 8d7344d27b..ee058f0ac1 100644 --- a/test/files/neg/t4987.check +++ b/test/files/neg/t4987.check @@ -1,4 +1,4 @@ t4987.scala:2: error: constructor Foo2 in class Foo2 cannot be accessed in object Bar2 object Bar2 { new Foo2(0, 0) } - ^ + ^ one error found diff --git a/test/files/neg/t5120.check b/test/files/neg/t5120.check index 34d4ebde31..fc65ca16a5 100644 --- a/test/files/neg/t5120.check +++ b/test/files/neg/t5120.check @@ -2,11 +2,11 @@ t5120.scala:11: error: type mismatch; found : Object required: _1 List(str, other) foreach (_.x1 = new AnyRef) - ^ + ^ t5120.scala:25: error: type mismatch; found : Thread required: h.T (which expands to) _2 List(str, num).foreach(h => h.f1 = new Thread()) - ^ + ^ two errors found diff --git a/test/files/neg/t5120.scala b/test/files/neg/t5120.scala index c7063b7d15..f28b2cfb4f 100644 --- a/test/files/neg/t5120.scala +++ b/test/files/neg/t5120.scala @@ -6,7 +6,7 @@ class Cell[T](x0: T) { object Test { val str: Cell[String] = new Cell("a") val other: Cell[Int] = new Cell(0) - + def main(args: Array[String]): Unit = { List(str, other) foreach (_.x1 = new AnyRef) str.x1.length diff --git a/test/files/neg/t5152.scala b/test/files/neg/t5152.scala index 5efc76af24..56df31ed41 100644 --- a/test/files/neg/t5152.scala +++ b/test/files/neg/t5152.scala @@ -2,16 +2,16 @@ object Test { new C new C1 new C2 - + class A[E[_]] { } class B[E[_]] extends A[B] { } // B is depth 2 but A requires 1 - class C extends B { } - + class C extends B { } + class A1[E[F[G[_]]]] { } class B1[E[_]] extends A1[B1] // B1 is depth 2 but A1 requires 3 class C1 extends B1 { } - + class A2[E[_]] { } class B2[E] extends A2[B2] { } // this one is correct - class C2 extends B2 { } + class C2 extends B2 { } } diff --git a/test/files/neg/t520.scala b/test/files/neg/t520.scala index 949a509518..076aca3122 100644 --- a/test/files/neg/t520.scala +++ b/test/files/neg/t520.scala @@ -4,6 +4,6 @@ object test { assert(keyword != null); } - def verifyKeyword(source : java.io.File, pos : Int) = + def verifyKeyword(source : java.io.File, pos : Int) = verifyKeyword("", source, pos); } diff --git a/test/files/neg/t5352.check b/test/files/neg/t5352.check index d24b0e8ee1..1675da9e9a 100644 --- a/test/files/neg/t5352.check +++ b/test/files/neg/t5352.check @@ -6,7 +6,7 @@ t5352.scala:11: error: type mismatch; ^ t5352.scala:14: error: method f in class Bar1 cannot be accessed in boop.Bar1 Access to protected method f not permitted because - enclosing object boop is not a subclass of + enclosing object boop is not a subclass of class Bar1 in object boop where target is defined (new Bar1).f ^ diff --git a/test/files/neg/t5352.scala b/test/files/neg/t5352.scala index 6ee41f5680..ed74a840f0 100644 --- a/test/files/neg/t5352.scala +++ b/test/files/neg/t5352.scala @@ -2,7 +2,7 @@ object boop { abstract class Bar { protected def f(): Any } class Bar1 extends Bar { protected def f(): Int = 5 } class Bar2 extends Bar { protected def f(): Int = 5 } - + val xs = List(new Bar1, new Bar2) type BarF = { def f(): Int } diff --git a/test/files/neg/t5357.scala b/test/files/neg/t5357.scala index 369a5568a4..6a52283dd6 100644 --- a/test/files/neg/t5357.scala +++ b/test/files/neg/t5357.scala @@ -1,7 +1,7 @@ trait M case class N() extends M { - def mytest(x: M) = x match { + def mytest(x: M) = x match { case A: N => 1 case _ => 0 } diff --git a/test/files/neg/t5426.scala b/test/files/neg/t5426.scala index f2fb5cc12c..af0f981969 100644 --- a/test/files/neg/t5426.scala +++ b/test/files/neg/t5426.scala @@ -1,10 +1,10 @@ class A { def f1 = Some(5) == 5 def f2 = 5 == Some(5) - + val x1 = 5 val x2 = Some(5) - + (x1 == x2) (x2 == x1) } diff --git a/test/files/neg/t5455.scala b/test/files/neg/t5455.scala index 22d6c442c9..6e54335787 100644 --- a/test/files/neg/t5455.scala +++ b/test/files/neg/t5455.scala @@ -1,13 +1,13 @@ trait Test { def root: Test - + @annotation.tailrec final lazy val bar: Thing[Int] = { if (this eq root) Thing(() => System.identityHashCode(bar)) else root.bar } - + def f = bar.f() } diff --git a/test/files/neg/t5497.check b/test/files/neg/t5497.check index fef6d38da0..4d6d52b519 100644 --- a/test/files/neg/t5497.check +++ b/test/files/neg/t5497.check @@ -1,4 +1,4 @@ t5497.scala:3: error: not found: value sq - case other => println(null.asInstanceOf[sq.Filter].tableName) + case other => println(null.asInstanceOf[sq.Filter].tableName) ^ one error found diff --git a/test/files/neg/t5497.scala b/test/files/neg/t5497.scala index 40d47de12d..c846b1ba57 100644 --- a/test/files/neg/t5497.scala +++ b/test/files/neg/t5497.scala @@ -1,5 +1,5 @@ object TestQueryable extends App{ ({ - case other => println(null.asInstanceOf[sq.Filter].tableName) + case other => println(null.asInstanceOf[sq.Filter].tableName) } : Any => Unit)(null) } diff --git a/test/files/neg/t5572.scala b/test/files/neg/t5572.scala index 2da1209c61..4169df4216 100644 --- a/test/files/neg/t5572.scala +++ b/test/files/neg/t5572.scala @@ -16,7 +16,7 @@ class Test { Z.transf(a, b) match { case sth => run(sth, b) - } + } } def run(x: X, z: B): Unit = () diff --git a/test/files/neg/t558.scala b/test/files/neg/t558.scala index 4941a06c3b..58b030347c 100644 --- a/test/files/neg/t558.scala +++ b/test/files/neg/t558.scala @@ -11,7 +11,7 @@ abstract class NewModel { val parent : SymbolURL; final val top = parent.top; final val source = top.file; - + } abstract class RootURL extends SymbolURL { final val top : RootURL = this; diff --git a/test/files/neg/t563.scala b/test/files/neg/t563.scala index d367e2a73c..204ad3cbdd 100644 --- a/test/files/neg/t563.scala +++ b/test/files/neg/t563.scala @@ -1,6 +1,6 @@ object Test { def map[A,R](a : List[A], f : A => R) : List[R] = a.map(f); - + def split(sn : Iterable[List[Option[Int]]]) : Unit = for (n <- sn) map(n,ptr => Option(ptr.get)); diff --git a/test/files/neg/t5666.check b/test/files/neg/t5666.check index 1c714796ba..da6b9d73e7 100644 --- a/test/files/neg/t5666.check +++ b/test/files/neg/t5666.check @@ -1,37 +1,37 @@ t5666.scala:2: error: class Any is abstract; cannot be instantiated new Any - ^ + ^ t5666.scala:3: error: class AnyVal is abstract; cannot be instantiated new AnyVal - ^ + ^ t5666.scala:4: error: class Double is abstract; cannot be instantiated new Double - ^ + ^ t5666.scala:5: error: class Float is abstract; cannot be instantiated new Float - ^ + ^ t5666.scala:6: error: class Long is abstract; cannot be instantiated new Long - ^ + ^ t5666.scala:7: error: class Int is abstract; cannot be instantiated new Int - ^ + ^ t5666.scala:8: error: class Char is abstract; cannot be instantiated new Char - ^ + ^ t5666.scala:9: error: class Short is abstract; cannot be instantiated new Short - ^ + ^ t5666.scala:10: error: class Byte is abstract; cannot be instantiated new Byte - ^ + ^ t5666.scala:11: error: class Boolean is abstract; cannot be instantiated new Boolean - ^ + ^ t5666.scala:12: error: class Unit is abstract; cannot be instantiated new Unit - ^ + ^ t5666.scala:13: error: class Nothing is abstract; cannot be instantiated new Nothing - ^ + ^ 12 errors found diff --git a/test/files/neg/t576.scala b/test/files/neg/t576.scala index fa7ee6019f..fd83217a45 100644 --- a/test/files/neg/t576.scala +++ b/test/files/neg/t576.scala @@ -4,16 +4,16 @@ abstract class BaseListXXX { type Node <: BaseNode; abstract class BaseNode { } -} +} trait PriorityTreeXXX extends BaseListXXX { type Node <: BasicTreeNode; - + trait BasicTreeNode extends BaseNode { - def sibling: Node; + def sibling: Node; def insert(dir : Int, node : Node) = { if (true) sibling.insert(node); //else insert(node); - + } def insert(node : Node) : Unit = {} } diff --git a/test/files/neg/t5761.check b/test/files/neg/t5761.check index 89d766fe34..8086af2fcf 100644 --- a/test/files/neg/t5761.check +++ b/test/files/neg/t5761.check @@ -5,7 +5,7 @@ Unspecified value parameter x. t5761.scala:8: error: not enough arguments for constructor D: (x: Int)D[Int]. Unspecified value parameter x. println(new D[Int]()) // no crash - ^ + ^ t5761.scala:9: error: not enough arguments for constructor D: (x: Int)D[Int]. Unspecified value parameter x. println(new D[Int]{}) // crash diff --git a/test/files/neg/t5803.check b/test/files/neg/t5803.check index 6a2de2e1df..c4f901e511 100644 --- a/test/files/neg/t5803.check +++ b/test/files/neg/t5803.check @@ -1,4 +1,4 @@ t5803.scala:3: error: could not find implicit value for parameter ev: Nothing new Foo(): String - ^ + ^ one error found diff --git a/test/files/neg/t588.scala b/test/files/neg/t588.scala index 1bc6d2680f..f30937377e 100644 --- a/test/files/neg/t588.scala +++ b/test/files/neg/t588.scala @@ -1,15 +1,15 @@ abstract class Test0 { - def visit(f: Int => Unit): Boolean + def visit(f: Int => Unit): Boolean def visit(f: Int => String): Boolean } trait Test { type TypeA <: TraitA; type TypeB <: TypeA with TraitB; - + def f(node : TypeA) : Unit; def f(brac : TypeB) : Unit; - + trait TraitA; trait TraitB; - + } diff --git a/test/files/neg/t591.scala b/test/files/neg/t591.scala index 5f2397e6a9..0f0b02395c 100644 --- a/test/files/neg/t591.scala +++ b/test/files/neg/t591.scala @@ -1,17 +1,17 @@ abstract class BaseList { type Node <: BaseNode; - - + + abstract class BaseNode { protected def self : Node; private[BaseList] def self00 = self; def dirty : Unit = {} def replaceWith(node : Node) = {} } - + implicit def baseNode2Node(bnode : BaseNode): Node = bnode.self00; - + } @@ -20,22 +20,22 @@ trait BaseFlow extends BaseList { type Flow <: FlowBase; type Output <: OutputBase; type Input <: InputBase; - + abstract class FlowBase { - + } trait OutputBase extends FlowBase { - + } trait InputBase extends FlowBase { - + } - + trait BFNode extends BaseNode { private var input : Input = _; private var output : Output = _; - + def input_=(in : Input) = {} - + } } diff --git a/test/files/neg/t5969.scala b/test/files/neg/t5969.scala index 62f87fd7ab..d010cacd1b 100644 --- a/test/files/neg/t5969.scala +++ b/test/files/neg/t5969.scala @@ -4,7 +4,7 @@ class A { def f(x: Any) = x def g(x: C1): String = "A" def g(x: C2): String = "B" - + def crash() = f(List[String]() flatMap { x => if (false) List(g(x)) else List[C1]() map g }) diff --git a/test/files/neg/t6074.check b/test/files/neg/t6074.check index 38670e5b3d..6abf5e2906 100644 --- a/test/files/neg/t6074.check +++ b/test/files/neg/t6074.check @@ -1,4 +1,4 @@ t6074.scala:5: error: constructor A in class A cannot be accessed in object T def t = new A() - ^ + ^ one error found diff --git a/test/files/neg/t608.scala b/test/files/neg/t608.scala index 1f12764dd1..34dc4c0352 100644 --- a/test/files/neg/t608.scala +++ b/test/files/neg/t608.scala @@ -2,7 +2,7 @@ trait CrashDueToTypeError { def id[a](x :a) :a = x trait Bifunctor { - type a; // content + type a; // content type s <: Bifunctor // uncomment this-vvvvvvvvvvvvvvvvvvvvvvvvvvvv, and it compiles diff --git a/test/files/neg/t6323a.check b/test/files/neg/t6323a.check index 4d682e5422..b649cfc86f 100644 --- a/test/files/neg/t6323a.check +++ b/test/files/neg/t6323a.check @@ -5,7 +5,7 @@ t6323a.scala:11: materializing requested reflect.runtime.universe.type.TypeTag[T val value = u.typeOf[Test] ^ t6323a.scala:11: `package`.this.materializeTypeTag[Test](scala.reflect.runtime.`package`.universe) is not a valid implicit value for reflect.runtime.universe.TypeTag[Test] because: -failed to typecheck the materialized tag: +failed to typecheck the materialized tag: cannot create a TypeTag referring to local class Test.Test: use WeakTypeTag instead val value = u.typeOf[Test] ^ diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check index d4afa9b630..ba5e30dc05 100755 --- a/test/files/neg/t6446-missing.check +++ b/test/files/neg/t6446-missing.check @@ -34,4 +34,4 @@ inlinehandlers 24 optimization: inline exception handlers dce 27 optimization: eliminate dead code jvm 28 generate JVM bytecode terminal 29 the last phase during a compilation run -#partest +#partest diff --git a/test/files/neg/t6601.check b/test/files/neg/t6601.check index 1410e1b11a..b05c67ad9a 100644 --- a/test/files/neg/t6601.check +++ b/test/files/neg/t6601.check @@ -1,4 +1,4 @@ AccessPrivateConstructor_2.scala:2: error: constructor PrivateConstructor in class PrivateConstructor cannot be accessed in class AccessPrivateConstructor new PrivateConstructor("") // Scalac should forbid accessing to the private constructor! - ^ + ^ one error found diff --git a/test/files/neg/t6666.scala b/test/files/neg/t6666.scala index 1919ea3ca9..58c5be5405 100644 --- a/test/files/neg/t6666.scala +++ b/test/files/neg/t6666.scala @@ -118,4 +118,4 @@ class CEarly(a: Any) extends { object Nested { def xx = x} Nested.xx } -} with AnyRef
\ No newline at end of file +} with AnyRef
\ No newline at end of file diff --git a/test/files/neg/t6667b.check b/test/files/neg/t6667b.check index 99cea9a47c..a8705fa1c2 100644 --- a/test/files/neg/t6667b.check +++ b/test/files/neg/t6667b.check @@ -3,11 +3,11 @@ t6667b.scala:16: error: ambiguous implicit values: and value b of type Test.Box match expected type Test.Box new Test() - ^ + ^ t6667b.scala:19: error: ambiguous implicit values: both value a in object Test of type => Test.Box and value b of type Test.Box match expected type Test.Box new Test() - ^ + ^ two errors found diff --git a/test/files/neg/t692.check b/test/files/neg/t692.check index 4149366309..0ca99717d6 100644 --- a/test/files/neg/t692.check +++ b/test/files/neg/t692.check @@ -11,7 +11,7 @@ t692.scala:13: error: class Foo takes type parameters case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType); ^ t692.scala:14: error: class Foo takes type parameters - implicit def typeOfBar[T4 <: Foo](implicit elem : RefType[T4]) : RefType[Bar[T4]] = + implicit def typeOfBar[T4 <: Foo](implicit elem : RefType[T4]) : RefType[Bar[T4]] = ^ t692.scala:19: error: class Foo takes type parameters class Bar[A <: Foo](implicit tpeA : Type[A]) extends Foo; diff --git a/test/files/neg/t692.scala b/test/files/neg/t692.scala index f230a6bacf..24e1d2fea3 100644 --- a/test/files/neg/t692.scala +++ b/test/files/neg/t692.scala @@ -5,15 +5,15 @@ abstract class test3 { abstract class RefType[C <: AnyRef] extends Type[C]; case class ObjectType() extends RefType[AnyRef]; abstract class ClassType[C <: Z, Z <: AnyRef](zuper : RefType[Z]) extends RefType[C]; - + case class FooType() extends ClassType[Foo,AnyRef](ObjectType()); implicit def typeOfFoo = FooType(); case class BarType[T3 <: Foo](tpeT : RefType[T3]) extends ClassType[Bar[T3],Foo](FooType); - implicit def typeOfBar[T4 <: Foo](implicit elem : RefType[T4]) : RefType[Bar[T4]] = + implicit def typeOfBar[T4 <: Foo](implicit elem : RefType[T4]) : RefType[Bar[T4]] = BarType(elem); - + class Foo[A <: AnyRef]; class Bar[A <: Foo](implicit tpeA : Type[A]) extends Foo; diff --git a/test/files/neg/t693.check b/test/files/neg/t693.check index 62325b5c60..25bd141501 100644 --- a/test/files/neg/t693.check +++ b/test/files/neg/t693.check @@ -1,4 +1,4 @@ t693.scala:4: error: x is already defined as value x - val x : Int = 10; + val x : Int = 10; ^ one error found diff --git a/test/files/neg/t693.scala b/test/files/neg/t693.scala index d2074bee38..3a9e6247a8 100644 --- a/test/files/neg/t693.scala +++ b/test/files/neg/t693.scala @@ -1,5 +1,5 @@ abstract class test4 { trait Type; val x : Type = null; - val x : Int = 10; + val x : Int = 10; } diff --git a/test/files/neg/t6963a.scala b/test/files/neg/t6963a.scala index b3366b2557..6808e541bb 100644 --- a/test/files/neg/t6963a.scala +++ b/test/files/neg/t6963a.scala @@ -1,5 +1,5 @@ object Test { import scala.collection.mutable._ - + List(1,2,3,4,5).scanRight(0)(_+_) } diff --git a/test/files/neg/t715.scala b/test/files/neg/t715.scala index a5ccd567f9..87b2525a63 100644 --- a/test/files/neg/t715.scala +++ b/test/files/neg/t715.scala @@ -1,4 +1,4 @@ -package test; +package test; trait B { type Node <: NodeImpl; trait NodeImpl { diff --git a/test/files/neg/t7385.check b/test/files/neg/t7385.check index 70d3c3fb61..c196ec0b4f 100644 --- a/test/files/neg/t7385.check +++ b/test/files/neg/t7385.check @@ -1,10 +1,7 @@ -t7385.scala:2: error: '(' expected but identifier found. +t7385.scala:2: error: parenthesized conditional expression expected do { println("bippy") } while i<10 ^ -t7385.scala:6: error: '(' expected but identifier found. +t7385.scala:6: error: parenthesized conditional expression expected while i<10 { () } ^ -t7385.scala:7: error: illegal start of simple expression -} -^ -three errors found +two errors found diff --git a/test/files/neg/t7473.check b/test/files/neg/t7473.check index bc8c29d463..c686466a44 100644 --- a/test/files/neg/t7473.check +++ b/test/files/neg/t7473.check @@ -1,7 +1,7 @@ -t7473.scala:6: error: '<-' expected but '=' found. +t7473.scala:5: error: for comprehension must start with generator: '<-' expected but '=' found. + for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found. + ^ +t7473.scala:8: error: for comprehension must start with generator: '<-' expected but '=' found. (for (x = Option(i); if x == j) yield 42) toList ^ -t7473.scala:6: error: illegal start of simple expression - (for (x = Option(i); if x == j) yield 42) toList - ^ two errors found diff --git a/test/files/neg/t7473.scala b/test/files/neg/t7473.scala index 593231d5f2..1eb9e6cb7a 100644 --- a/test/files/neg/t7473.scala +++ b/test/files/neg/t7473.scala @@ -1,7 +1,9 @@ object Foo { val i,j = 3 - //for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found. + + for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found. + // evil postfix! (for (x = Option(i); if x == j) yield 42) toList } diff --git a/test/files/neg/t7494-after-terminal/ThePlugin.scala b/test/files/neg/t7494-after-terminal/ThePlugin.scala index 2a4607392f..f3c913086e 100644 --- a/test/files/neg/t7494-after-terminal/ThePlugin.scala +++ b/test/files/neg/t7494-after-terminal/ThePlugin.scala @@ -12,7 +12,7 @@ class ThePlugin(val global: Global) extends Plugin { val name = "afterterminal" val description = "Declares one plugin that wants to be after the terminal phase" val components = List[PluginComponent](thePhase) - + private object thePhase extends PluginComponent { val global = ThePlugin.this.global @@ -20,9 +20,9 @@ class ThePlugin(val global: Global) extends Plugin { val phaseName = ThePlugin.this.name - def newPhase(prev: Phase) = new ThePhase(prev) + def newPhase(prev: Phase) = new ThePhase(prev) } - + private class ThePhase(prev: Phase) extends Phase(prev) { def name = ThePlugin.this.name def run {} diff --git a/test/files/neg/t7494-before-parser/ThePlugin.scala b/test/files/neg/t7494-before-parser/ThePlugin.scala index 7ca896650d..8714a55dc4 100644 --- a/test/files/neg/t7494-before-parser/ThePlugin.scala +++ b/test/files/neg/t7494-before-parser/ThePlugin.scala @@ -12,7 +12,7 @@ class ThePlugin(val global: Global) extends Plugin { val name = "beforeparser" val description = "Declares one plugin that wants to be before the parser phase" val components = List[PluginComponent](thePhase) - + private object thePhase extends PluginComponent { val global = ThePlugin.this.global @@ -21,9 +21,9 @@ class ThePlugin(val global: Global) extends Plugin { val phaseName = ThePlugin.this.name - def newPhase(prev: Phase) = new ThePhase(prev) + def newPhase(prev: Phase) = new ThePhase(prev) } - + private class ThePhase(prev: Phase) extends Phase(prev) { def name = ThePlugin.this.name def run {} diff --git a/test/files/neg/t7494-multi-right-after/ThePlugin.scala b/test/files/neg/t7494-multi-right-after/ThePlugin.scala index 819176fa88..4c761517c1 100644 --- a/test/files/neg/t7494-multi-right-after/ThePlugin.scala +++ b/test/files/neg/t7494-multi-right-after/ThePlugin.scala @@ -12,7 +12,7 @@ class ThePlugin(val global: Global) extends Plugin { val name = "multi-rafter" val description = "" val components = List[PluginComponent](thePhase) - + private object thePhase extends PluginComponent { val global = ThePlugin.this.global @@ -20,9 +20,9 @@ class ThePlugin(val global: Global) extends Plugin { override val runsRightAfter = Some("explicitouter") val phaseName = ThePlugin.this.name - def newPhase(prev: Phase) = new ThePhase(prev) + def newPhase(prev: Phase) = new ThePhase(prev) } - + private class ThePhase(prev: Phase) extends Phase(prev) { def name = ThePlugin.this.name def run {} diff --git a/test/files/neg/t7494-right-after-before/ThePlugin.scala b/test/files/neg/t7494-right-after-before/ThePlugin.scala index 81ba85ae80..c42a914066 100644 --- a/test/files/neg/t7494-right-after-before/ThePlugin.scala +++ b/test/files/neg/t7494-right-after-before/ThePlugin.scala @@ -12,7 +12,7 @@ class ThePlugin(val global: Global) extends Plugin { val name = "rafter-before-1" val description = "" val components = List[PluginComponent](thePhase1) - + private object thePhase1 extends PluginComponent { val global = ThePlugin.this.global @@ -20,9 +20,9 @@ class ThePlugin(val global: Global) extends Plugin { override val runsBefore = List[String]("erasure") val phaseName = ThePlugin.this.name - def newPhase(prev: Phase) = new ThePhase(prev) + def newPhase(prev: Phase) = new ThePhase(prev) } - + private class ThePhase(prev: Phase) extends Phase(prev) { def name = ThePlugin.this.name def run {} diff --git a/test/files/neg/t7494-right-after-terminal/ThePlugin.scala b/test/files/neg/t7494-right-after-terminal/ThePlugin.scala index 9d6d30b327..47dd06ec8a 100644 --- a/test/files/neg/t7494-right-after-terminal/ThePlugin.scala +++ b/test/files/neg/t7494-right-after-terminal/ThePlugin.scala @@ -12,18 +12,18 @@ class ThePlugin(val global: Global) extends Plugin { val name = "rightafterterminal" val description = "Declares one plugin that wants to be right after the terminal phase" val components = List[PluginComponent](thePhase) - + private object thePhase extends PluginComponent { val global = ThePlugin.this.global val runsAfter = List[String]() override val runsRightAfter = Some("terminal") - + val phaseName = ThePlugin.this.name - def newPhase(prev: Phase) = new ThePhase(prev) + def newPhase(prev: Phase) = new ThePhase(prev) } - + private class ThePhase(prev: Phase) extends Phase(prev) { def name = ThePlugin.this.name def run {} diff --git a/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala index 7a905ae32d..35c0ff8f53 100644 --- a/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala +++ b/test/files/neg/t7622-cyclic-dependency/ThePlugin.scala @@ -12,7 +12,7 @@ class ThePlugin(val global: Global) extends Plugin { val name = "cyclicdependency" val description = "Declares two phases that have a cyclic dependency" val components = List[PluginComponent](thePhase1,thePhase2) - + private object thePhase1 extends PluginComponent { val global = ThePlugin.this.global @@ -22,7 +22,7 @@ class ThePlugin(val global: Global) extends Plugin { def newPhase(prev: Phase) = new ThePhase(prev, phaseName) } - + private object thePhase2 extends PluginComponent { val global = ThePlugin.this.global @@ -32,7 +32,7 @@ class ThePlugin(val global: Global) extends Plugin { def newPhase(prev: Phase) = new ThePhase(prev, phaseName) } - + private class ThePhase(prev: Phase, val name: String) extends Phase(prev) { def run {} } diff --git a/test/files/neg/t7622-missing-dependency/ThePlugin.scala b/test/files/neg/t7622-missing-dependency/ThePlugin.scala index a87cbb8e45..fa634a64c1 100644 --- a/test/files/neg/t7622-missing-dependency/ThePlugin.scala +++ b/test/files/neg/t7622-missing-dependency/ThePlugin.scala @@ -12,7 +12,7 @@ class ThePlugin(val global: Global) extends Plugin { val name = "myplugin" val description = "Declares one plugin with a missing requirement" val components = List[PluginComponent](thePhase) - + private object thePhase extends PluginComponent { val global = ThePlugin.this.global @@ -22,9 +22,9 @@ class ThePlugin(val global: Global) extends Plugin { override val requires = List("missing") - def newPhase(prev: Phase) = new ThePhase(prev) + def newPhase(prev: Phase) = new ThePhase(prev) } - + private class ThePhase(prev: Phase) extends Phase(prev) { def name = thePhase.phaseName def run {} diff --git a/test/files/neg/t7622-multi-followers/ThePlugin.scala b/test/files/neg/t7622-multi-followers/ThePlugin.scala index e7a49a9be6..cbd28d0c23 100644 --- a/test/files/neg/t7622-multi-followers/ThePlugin.scala +++ b/test/files/neg/t7622-multi-followers/ThePlugin.scala @@ -12,7 +12,7 @@ class ThePlugin(val global: Global) extends Plugin { val name = "multi" val description = "Declares two phases that both follow parser" val components = List[PluginComponent](thePhase1,thePhase2) - + private object thePhase1 extends PluginComponent { val global = ThePlugin.this.global @@ -24,7 +24,7 @@ class ThePlugin(val global: Global) extends Plugin { def newPhase(prev: Phase) = new ThePhase(prev, phaseName) } - + private object thePhase2 extends PluginComponent { val global = ThePlugin.this.global @@ -36,7 +36,7 @@ class ThePlugin(val global: Global) extends Plugin { def newPhase(prev: Phase) = new ThePhase(prev, phaseName) } - + private class ThePhase(prev: Phase, val name: String) extends Phase(prev) { def run {} } diff --git a/test/files/neg/t771.check b/test/files/neg/t771.check index c0d1e002f8..51b0c97f8c 100644 --- a/test/files/neg/t771.check +++ b/test/files/neg/t771.check @@ -1,4 +1,4 @@ t771.scala:4: error: trait Iterator is abstract; cannot be instantiated def c[A](it:java.util.Iterator[A]) = new scala.Iterator[A] - ^ + ^ one error found diff --git a/test/files/neg/t783.scala b/test/files/neg/t783.scala index 5d20bc6d24..59f7c7f97d 100644 --- a/test/files/neg/t783.scala +++ b/test/files/neg/t783.scala @@ -18,7 +18,7 @@ object Main extends App { def globalInit : Global; final def globalInit0 = globalInit.asInstanceOf[global.type]; } - + object global0 extends Global { object analyzer extends Analyzer { type Global = global0.type; diff --git a/test/files/neg/t798.scala b/test/files/neg/t798.scala index b4a1939444..a2bf66d19b 100644 --- a/test/files/neg/t798.scala +++ b/test/files/neg/t798.scala @@ -4,5 +4,5 @@ trait Test[Bracks <: Bracks] { class C[T] val bracks : Bracks; val singletons = f(bracks); - + } diff --git a/test/files/neg/t836.scala b/test/files/neg/t836.scala index de23cf5387..3633b816c6 100644 --- a/test/files/neg/t836.scala +++ b/test/files/neg/t836.scala @@ -10,7 +10,7 @@ abstract class A { } class B extends A { - type MyObj = ObjImpl + type MyObj = ObjImpl val myString: S = "hello" val realString: String = myString // error: type missmatch } diff --git a/test/files/neg/t856.check b/test/files/neg/t856.check index 02978e1622..fb93f96d9f 100644 --- a/test/files/neg/t856.check +++ b/test/files/neg/t856.check @@ -5,7 +5,7 @@ it has 2 unimplemented members. */ // Members declared in scala.Equals def canEqual(that: Any): Boolean = ??? - + // Members declared in scala.Product2 def _2: Double = ??? diff --git a/test/files/neg/t856.scala b/test/files/neg/t856.scala index e50084b6bd..fea216bfad 100644 --- a/test/files/neg/t856.scala +++ b/test/files/neg/t856.scala @@ -1,4 +1,4 @@ -trait Complex extends Product2[Double,Double] +trait Complex extends Product2[Double,Double] class ComplexRect(val _1:Double, _2:Double) extends Complex { override def toString = "ComplexRect("+_1+","+_2+")" diff --git a/test/files/neg/t876.scala b/test/files/neg/t876.scala index fb1461a7d3..1f6a90dff3 100644 --- a/test/files/neg/t876.scala +++ b/test/files/neg/t876.scala @@ -11,11 +11,11 @@ object AssertionError extends AnyRef with App class Manager { final class B {} - + val map = new HashMap[A, B] } - - + + def test[T](f: => T) { f } test { diff --git a/test/files/neg/t877.scala b/test/files/neg/t877.scala index 8cb98279db..5e132a1dd4 100644 --- a/test/files/neg/t877.scala +++ b/test/files/neg/t877.scala @@ -1,3 +1,3 @@ -class A +class A trait Foo extends A(22A, Bug!) {} diff --git a/test/files/neg/t944.scala b/test/files/neg/t944.scala index 352269a80b..dc80e5f49f 100644 --- a/test/files/neg/t944.scala +++ b/test/files/neg/t944.scala @@ -1,6 +1,6 @@ object TooManyArgsFunction { - val f = (a1:Int, a2:Int, a3:Int, a4:Int, a5:Int, a6:Int, a7:Int, a8:Int, - a9:Int, a10:Int, a11:Int, a12:Int, a13:Int, a14:Int, a15:Int, - a16:Int, a17:Int, a18:Int, a19:Int, a20:Int, a21:Int, a22:Int, + val f = (a1:Int, a2:Int, a3:Int, a4:Int, a5:Int, a6:Int, a7:Int, a8:Int, + a9:Int, a10:Int, a11:Int, a12:Int, a13:Int, a14:Int, a15:Int, + a16:Int, a17:Int, a18:Int, a19:Int, a20:Int, a21:Int, a22:Int, a23:Int) => 1 } diff --git a/test/files/neg/tailrec.scala b/test/files/neg/tailrec.scala index 5b9018ae89..e0ebde9863 100644 --- a/test/files/neg/tailrec.scala +++ b/test/files/neg/tailrec.scala @@ -9,21 +9,21 @@ object Winners { @tailrec def loopsucc1(x: Int): Int = loopsucc1(x - 1) @tailrec def loopsucc2[T](x: Int): Int = loopsucc2[T](x - 1) - + def ding() { object dong { @tailrec def loopsucc3(x: Int): Int = loopsucc3(x) } () } - + def inner(q: Int) = { @tailrec def loopsucc4(x: Int): Int = loopsucc4(x + 1) - + loopsucc4(q) } - + object innerBob { @tailrec def loopsucc5(x: Int): Int = loopsucc5(x) } @@ -45,19 +45,19 @@ object Failures { else n * facfail(n - 1) } -class Failures { +class Failures { // not private, not final @tailrec def fail1(x: Int): Int = fail1(x) - + // a typical between-chair-and-keyboard error @tailrec final def fail2[T](xs: List[T]): List[T] = xs match { case Nil => Nil case x :: xs => x :: fail2[T](xs) } - + // unsafe @tailrec final def fail3[T](x: Int): Int = fail3(x - 1) - + // unsafe class Tom[T](x: Int) { @tailrec final def fail4[U](other: Tom[U], x: Int): Int = other.fail4[U](other, x - 1) diff --git a/test/files/neg/tcpoly_infer_ticket1162.scala b/test/files/neg/tcpoly_infer_ticket1162.scala index b88bd358d9..0552b42a22 100644 --- a/test/files/neg/tcpoly_infer_ticket1162.scala +++ b/test/files/neg/tcpoly_infer_ticket1162.scala @@ -1,8 +1,8 @@ object Test { - trait Expression[A,B] + trait Expression[A,B] case class Lift[A,B,F[_]]() extends Expression[F[A],F[B]] - + def simplify[A,B]: Expression[A,B] = Lift[A,B]() } diff --git a/test/files/neg/tcpoly_ticket2101.scala b/test/files/neg/tcpoly_ticket2101.scala index 3af07acfac..68f061ce70 100644 --- a/test/files/neg/tcpoly_ticket2101.scala +++ b/test/files/neg/tcpoly_ticket2101.scala @@ -4,10 +4,10 @@ class T2[X] extends T[T2, X] // ill-typed // Forall Y. T2[Y] <: T[T2, X] // debugging before fix: -// def isSubType0 --> +// def isSubType0 --> // case (PolyType(tparams1, res1), PolyType(tparams2, res2)) => println("<:<PT: "+((tparams1, res1), (tparams2, res2))) //@MDEBUG // (tparams1.length == tparams2.length && -// List.forall2(tparams1, tparams2) +// List.forall2(tparams1, tparams2) // ((p1, p2) => p2.info.substSym(tparams2, tparams1) <:< p1.info) && // res1 <:< res2.substSym(tparams2, tparams1)) @@ -22,7 +22,7 @@ class T2[X] extends T[T2, X] // ill-typed // (tparams1.length == tparams2.length && // { // val tpsFresh = cloneSymbols(tparams1) // @M cloneSymbols(tparams2) should be equivalent -- TODO: check -// List.forall2(tparams1, tparams2) +// List.forall2(tparams1, tparams2) // ((p1, p2) => p2.info.substSym(tparams2, tpsFresh) <:< p1.info.substSym(tparams1, tpsFresh)) && -// res1.substSym(tparams1, tpsFresh) <:< res2.substSym(tparams2, tpsFresh) +// res1.substSym(tparams1, tpsFresh) <:< res2.substSym(tparams2, tpsFresh) // }) diff --git a/test/files/neg/tcpoly_typealias.scala b/test/files/neg/tcpoly_typealias.scala index 96e9349298..6c7f80cc0b 100644 --- a/test/files/neg/tcpoly_typealias.scala +++ b/test/files/neg/tcpoly_typealias.scala @@ -12,7 +12,7 @@ trait A3 { trait FooCov[+x] trait FooCon[-x] -trait FooBound[+x <: String] +trait FooBound[+x <: String] trait BOk1 extends A { type m[+x] = FooCov[x] @@ -30,8 +30,8 @@ trait BOk4 extends A3 { type m[+x] = FooCov[x] // weaker variance } -// there are two aspects to check: - // does type alias signature (not considering RHS) correspond to abstract type member in super class +// there are two aspects to check: + // does type alias signature (not considering RHS) correspond to abstract type member in super class // does RHS correspond to the type alias sig trait BInv extends A{ type m[x] = FooCov[x] // error: invariant x in alias def diff --git a/test/files/neg/tcpoly_variance_enforce.scala b/test/files/neg/tcpoly_variance_enforce.scala index 0db7b692f8..ddff0e9f94 100644 --- a/test/files/neg/tcpoly_variance_enforce.scala +++ b/test/files/neg/tcpoly_variance_enforce.scala @@ -6,7 +6,7 @@ trait coll3[m[x]] trait coll4[m[x <: y], y] -class FooInvar[x] +class FooInvar[x] class FooContra[-x] class FooCov[+x] class FooString[+x <: String] @@ -15,15 +15,15 @@ object fcollok extends coll[FooCov] object fcollinv extends coll[FooInvar] // error object fcollcon extends coll[FooContra] // error object fcollwb extends coll[FooString] // error - + object fcoll2ok extends coll2[FooCov] // error object fcoll2inv extends coll2[FooInvar] // error -object fcoll2con extends coll2[FooContra] +object fcoll2con extends coll2[FooContra] object fcoll2wb extends coll2[FooString] // error - -object fcoll3ok extends coll3[FooCov] -object fcoll3inv extends coll3[FooInvar] -object fcoll3con extends coll3[FooContra] + +object fcoll3ok extends coll3[FooCov] +object fcoll3inv extends coll3[FooInvar] +object fcoll3con extends coll3[FooContra] object fcoll3wb extends coll3[FooString] // error object fcoll4ok extends coll4[FooString, String] @@ -33,7 +33,7 @@ object fcoll4_2 extends coll4[FooString, Any] // error object test { var ok: coll[FooCov] = _ - + def x: coll[FooInvar] = sys.error("foo") // error def y: coll[FooContra] = sys.error("foo") // error } diff --git a/test/files/neg/type-diagnostics.scala b/test/files/neg/type-diagnostics.scala index de7e7adc3c..c4171328de 100644 --- a/test/files/neg/type-diagnostics.scala +++ b/test/files/neg/type-diagnostics.scala @@ -6,14 +6,14 @@ object SetVsSet { object TParamConfusion { def strings(xs: List[String]) = xs - + def f1[a <% Ordered[a]](x: List[a]) = { def f2[b >: List[a] <% Ordered[b]](x: List[a], y: b): Int = { def f3(xs: List[a], ys: List[a]) = -1 y match { case y1: List[a] => f3(x, y1) } } } - + def f2[String](s: String) = strings(List(s)) } diff --git a/test/files/neg/varargs.scala b/test/files/neg/varargs.scala index 657750ec8f..be75e9b0a7 100644 --- a/test/files/neg/varargs.scala +++ b/test/files/neg/varargs.scala @@ -7,21 +7,21 @@ import annotation.varargs // Failing varargs annotation object Test { - + trait A { def v1(a: Int, b: Array[String]) = a } - + trait B extends A { @varargs def v1(a: Int, b: String*) = a + b.length } - + @varargs def nov(a: Int) = 0 @varargs def v(a: Int, b: String*) = a + b.length @varargs def v2(a: Int, b: String*) = 0 def v2(a: Int, b: Array[String]) = 0 - - def main(args: Array[String]) { + + def main(args: Array[String]) { } - + } diff --git a/test/files/neg/viewtest.scala b/test/files/neg/viewtest.scala index ddb7fa4a3b..5e7d624d23 100644 --- a/test/files/neg/viewtest.scala +++ b/test/files/neg/viewtest.scala @@ -37,7 +37,7 @@ object O { } } - implicit def view3[a <% Ordered[a]](x: List[a]): Ordered[List[a]] = + implicit def view3[a <% Ordered[a]](x: List[a]): Ordered[List[a]] = new Ordered[List[a]] { def compareTo [b >: List[a] <% Ordered[b]](y: b): Int = y match { case y1: List[a] => compareLists(x, y1) @@ -72,7 +72,7 @@ class Node[a <% Ordered[a]](elem: a, l: Tree[a], r: Tree[a]) extends Tree[a] { if (x == elem) this else if (x < elem) new Node(elem, l insert x, r) else new Node(elem, l, r insert x) - def elements: List[a] = + def elements: List[a] = l.elements ::: List(elem) ::: r.elements } @@ -86,7 +86,7 @@ case class Str(elem: String) extends Ordered[Str] { object Test { import O._ - private def toCharList(s: String): List[Char] = + private def toCharList(s: String): List[Char] = if (s.length() == 0) List() else s.charAt(0) :: toCharList(s.substring(1)) diff --git a/test/files/pos/MailBox.scala b/test/files/pos/MailBox.scala index 2a3f02df0b..8e27bd362d 100644 --- a/test/files/pos/MailBox.scala +++ b/test/files/pos/MailBox.scala @@ -24,7 +24,7 @@ class MailBox { private val sent = new LinkedList[Any]; private var lastSent = sent; private val receivers = new LinkedList[Receiver]; - private var lastReceiver = receivers; + private var lastReceiver = receivers; def send(msg: Any): Unit = synchronized { var r = receivers; @@ -59,7 +59,7 @@ class MailBox { } f(msg) } - + def receiveWithin[a](msec: Long)(f: PartialFunction[Any, a]): a = { val msg: Any = synchronized { var s = sent; diff --git a/test/files/pos/SI-7638.scala b/test/files/pos/SI-7638.scala index da16e0bd2c..831475d005 100644 --- a/test/files/pos/SI-7638.scala +++ b/test/files/pos/SI-7638.scala @@ -9,7 +9,7 @@ trait ArrayVectorOrder[@specialized(Int) A] extends Ordering[A] { } object vectorOrder { - implicit def arrayOrder[@specialized(Int) A]() = + implicit def arrayOrder[@specialized(Int) A]() = /* * Before applying patch: * @@ -17,8 +17,8 @@ object vectorOrder { * during phase: mixin * library version: version 2.10.3-20130625-164027-d22e8d282c * compiler version: version 2.10.3-20130627-153946-54cb6af7db - * reconstructed args: - * + * reconstructed args: + * * last tree to typer: TypeTree(class Array) * symbol: class Array in package scala (flags: final) * symbol definition: final class Array[T >: ? <: ?] extends Object @@ -27,12 +27,12 @@ object vectorOrder { * context owners: anonymous class anon$1 -> package compile * * == Expanded type of tree == - * + * * TypeRef( * TypeSymbol(final class Array[T >: ? <: ?] extends Object) * args = List(TypeRef(TypeSymbol(final abstract class Int extends ))) * ) - * + * * unhandled exception while transforming SI-7638.scala * error: uncaught exception during compilation: java.lang.UnsupportedOperationException * error: java.lang.UnsupportedOperationException: tail of empty list diff --git a/test/files/pos/Transactions.scala b/test/files/pos/Transactions.scala index 525eff7514..32889f8180 100644 --- a/test/files/pos/Transactions.scala +++ b/test/files/pos/Transactions.scala @@ -28,7 +28,7 @@ class Transaction { var next: Transaction = null def this(hd: Transaction, tl: Transaction) = { this(); this.head = head; this.next = next } - + def makeAbort() = synchronized { while (status != Transaction.Aborted && status != Transaction.Committed) { status = Transaction.Abortable @@ -48,7 +48,7 @@ class Transaction { case ex: AbortException => abort(); None case ex: Throwable => abort(); throw ex } - + } trait Transactional { @@ -58,7 +58,7 @@ trait Transactional { /** copy back snapshot */ def rollBack(): Unit - + var readers: Transaction var writer: Transaction @@ -66,11 +66,11 @@ trait Transactional { if (writer == null) null else if (writer.status == Transaction.Running) writer else { - if (writer.status != Transaction.Committed) rollBack(); - writer = null; - null + if (writer.status != Transaction.Committed) rollBack(); + writer = null; + null } - + def getter(thisTrans: Transaction) { if (writer == thisTrans) return var r = readers @@ -96,7 +96,7 @@ trait Transactional { synchronized { val w = currentWriter() if (w != null) - if (thisTrans.id < w.id) { w.makeAbort(); rollBack() } + if (thisTrans.id < w.id) { w.makeAbort(); rollBack() } else throw new AbortException var r = readers while (r != null && r.head.status != Transaction.Running) { r = r.next; readers = r } @@ -111,4 +111,3 @@ trait Transactional { } } } - diff --git a/test/files/pos/array-interfaces.scala b/test/files/pos/array-interfaces.scala index 4955911078..70cafd2bb1 100644 --- a/test/files/pos/array-interfaces.scala +++ b/test/files/pos/array-interfaces.scala @@ -1,7 +1,7 @@ object s { def f(x: Cloneable) = () def g(x: java.io.Serializable) = () - + def main(args: Array[String]): Unit = { f(args) g(args) diff --git a/test/files/pos/arrays2.scala b/test/files/pos/arrays2.scala index 2d5409cbb8..795c486e37 100644 --- a/test/files/pos/arrays2.scala +++ b/test/files/pos/arrays2.scala @@ -11,8 +11,8 @@ object arrays2 { // #2422 object arrays4 { - val args = Array[String]("World") - "Hello %1$s".format(args: _*) + val args = Array[String]("World") + "Hello %1$s".format(args: _*) } // #2461 diff --git a/test/files/pos/builders.scala b/test/files/pos/builders.scala index 51d8af88f8..0b620769c0 100644 --- a/test/files/pos/builders.scala +++ b/test/files/pos/builders.scala @@ -18,16 +18,16 @@ object builders { def += (elem: B) { buf += elem } def result: List[B] = buf.toList } -/* +/* def fill[A, Dim1, Dim2, Coll](n1: Int, n2: Int, elem: A)(implicit b1: Builder[Coll, Dim1, A], b2: Builder[Coll, Dim2, Dim1]) = { for (i <- 0 until n1) { for (j <- 0 until n2) { b1 += elem - } + } b2 += b1.result } b2.result - } + } */ /* implicit def arrayBuilder[A, B] = new Builder[Array[A], Array[B], B] { @@ -35,7 +35,7 @@ object builders { private val buf = new scala.collection.mutable.ListBuffer[B] def += (elem: B) { buf += elem } def result: Array[B] = buf.toArray - } + } */ class Iter[A, C](elems: List[A]) { def ++ [B >: A, D](xs: Iterable[B])(implicit b: Builder[C, D, B]): D = { @@ -48,7 +48,7 @@ object builders { b.result } } - + def main(args : Array[String]) : Unit = { val x1 = new Iter[Int, List[Int]](List(1, 2, 3)) // val x2 = new Iter[Int, Array[Int]](List(1, 2, 3)) diff --git a/test/files/pos/channels.scala b/test/files/pos/channels.scala index 0a2274c47a..b2f0cdc321 100644 --- a/test/files/pos/channels.scala +++ b/test/files/pos/channels.scala @@ -6,7 +6,7 @@ case class ![a](chan: Channel[a], data: a) /* object Bang { - def unapply[a](x: ![a]): Option[{Channel[a], a}] = + def unapply[a](x: ![a]): Option[{Channel[a], a}] = Some(x.chan, x.data) } @@ -14,7 +14,7 @@ object Bang { object Test extends App { object IC extends Channel[Int] def f[b](x: ![b]): Int = x match { - case send: ![c] => + case send: ![c] => send.chan match { case IC => send.data } @@ -27,4 +27,3 @@ object Test2 extends App { case IC ! x => x } } - diff --git a/test/files/pos/clsrefine.scala b/test/files/pos/clsrefine.scala index b29c01db8b..0a016dec07 100644 --- a/test/files/pos/clsrefine.scala +++ b/test/files/pos/clsrefine.scala @@ -25,9 +25,9 @@ object test { val y1, y2 = 1; } val a: A { type X1 = Int; type X2 = Int } = b; - val a1 = new A { + val a1 = new A { type X1 = Int; - type X2 = String; + type X2 = String; val x1 = 1; val x2 = "hello" } diff --git a/test/files/pos/collectGenericCC.scala b/test/files/pos/collectGenericCC.scala index 8201c6a271..5c51a50d71 100644 --- a/test/files/pos/collectGenericCC.scala +++ b/test/files/pos/collectGenericCC.scala @@ -7,8 +7,8 @@ object Test { r foreach ((a: A) => b += a) b.result } - - collect[Int, Vector[Int]](List(1,2,3,4)) + + collect[Int, Vector[Int]](List(1,2,3,4)) collect[Char, String](List('1','2','3','4')) - collect[Char, Array[Char]](List('1','2','3','4')) + collect[Char, Array[Char]](List('1','2','3','4')) }
\ No newline at end of file diff --git a/test/files/pos/context.scala b/test/files/pos/context.scala index 13f6bb43c5..4e11d07eb4 100644 --- a/test/files/pos/context.scala +++ b/test/files/pos/context.scala @@ -12,10 +12,10 @@ class Context { abstract class SymbolWrapper { val context: Context; import context._; - + class Symbols { self: context.symbols.type => - + abstract class Symbol { def typ: types.Type; def sym: Symbol = typ.sym; @@ -29,7 +29,7 @@ abstract class TypeWrapper { class Types { self: context.types.type => - + abstract class Type { def sym: symbols.Symbol; def typ: Type = sym.typ; diff --git a/test/files/pos/cyclics-pos.scala b/test/files/pos/cyclics-pos.scala index 051bdd6ed8..395e88815a 100644 --- a/test/files/pos/cyclics-pos.scala +++ b/test/files/pos/cyclics-pos.scala @@ -1,26 +1,26 @@ trait Param[T] trait Abs { type T } trait Cyclic1[A <: Param[A]] // works -trait Cyclic2[A <: Abs { type T <: A }] -trait Cyclic3 { type A <: Abs { type T = A } } +trait Cyclic2[A <: Abs { type T <: A }] +trait Cyclic3 { type A <: Abs { type T = A } } trait Cyclic4 { type A <: Param[A] } // works -trait Cyclic5 { type AA <: Abs; type A <: AA { type T = A } } +trait Cyclic5 { type AA <: Abs; type A <: AA { type T = A } } trait IterableTemplate { type Elem type Constr <: IterableTemplate type ConstrOf[A] = Constr { type Elem = A } - + def iterator: Iterator[Elem] - + def map [B] (f: Elem => B): ConstrOf[B] - + def foreach(f: Elem => Unit) = iterator.foreach(f) } trait Iterable[A] extends IterableTemplate { self => - type Elem + type Elem type Constr <: Iterable[A] { type Constr <: Iterable.this.Constr } } diff --git a/test/files/pos/depmet_implicit_oopsla_session.scala b/test/files/pos/depmet_implicit_oopsla_session.scala index e2c67d7c32..21588a56ad 100644 --- a/test/files/pos/depmet_implicit_oopsla_session.scala +++ b/test/files/pos/depmet_implicit_oopsla_session.scala @@ -11,19 +11,19 @@ object Sessions { def run(p: Stop, dp: Stop): Unit = {} } - implicit def InDual[A, B](implicit sessionDIn: Session[B]) = + implicit def InDual[A, B](implicit sessionDIn: Session[B]) = new Session[In[A, B]] { type Dual = Out[A, sessionDIn.Dual] - def run(p: In[A, B], dp: Dual): Unit = + def run(p: In[A, B], dp: Dual): Unit = sessionDIn.run(p.func(dp.x), dp.y) } - implicit def OutDual[A, B](implicit sessionDOut: Session[B]) = + implicit def OutDual[A, B](implicit sessionDOut: Session[B]) = new Session[Out[A, B]] { type Dual = In[A, sessionDOut.Dual] - def run(p: Out[A, B], dp: Dual): Unit = + def run(p: Out[A, B], dp: Dual): Unit = sessionDOut.run(p.y, dp.func(p.x)) } @@ -32,7 +32,7 @@ object Sessions { sealed case class Out[+A, +B](x: A, y: B) def addServer = - In{x: Int => + In{x: Int => In{y: Int => System.out.println("Thinking") Out(x+y, Stop())}} @@ -48,7 +48,7 @@ object Sessions { // def runSession[S, D](p: S, dp: D)(implicit s: Session[S]#HasDual[D]) = // s.run(p, dp) - // + // // def runSession[S, D](p: S, dp: D)(implicit s: Session[S]{type Dual=D}) = // s.run(p, dp) diff --git a/test/files/pos/depmet_implicit_oopsla_session_2.scala b/test/files/pos/depmet_implicit_oopsla_session_2.scala index 8d7daa6dc6..5c3b78e3f5 100644 --- a/test/files/pos/depmet_implicit_oopsla_session_2.scala +++ b/test/files/pos/depmet_implicit_oopsla_session_2.scala @@ -36,7 +36,7 @@ object Sessions { implicit def InDual[Data, Cont](implicit cont: Session[Cont]) = new Session[In[Data, Cont]] { type Dual = Out[Data, cont.Dual] - def run(self: Self, dual: Dual): Unit = + def run(self: Self, dual: Dual): Unit = cont.run(self.recv(dual.data), dual.cont) } @@ -46,13 +46,13 @@ object Sessions { implicit def OutDual[Data, Cont](implicit cont: Session[Cont]) = new Session[Out[Data, Cont]] { type Dual = In[Data, cont.Dual] - def run(self: Self, dual: Dual): Unit = + def run(self: Self, dual: Dual): Unit = cont.run(self.cont, dual.recv(self.data)) } // a concrete session def addServer = - In{x: Int => + In{x: Int => In{y: Int => System.out.println("Thinking") Out(x+y, Stop())}} @@ -71,7 +71,7 @@ object Sessions { // def runSession[S, D](p: S, dp: D)(implicit s: Session[S]#HasDual[D]) = // s.run(p, dp) - // + // // def runSession[S, D](p: S, dp: D)(implicit s: Session[S]{type Dual=D}) = // s.run(p, dp) diff --git a/test/files/pos/depmet_implicit_oopsla_session_simpler.scala b/test/files/pos/depmet_implicit_oopsla_session_simpler.scala index 7c9af66611..04b8f94e64 100644 --- a/test/files/pos/depmet_implicit_oopsla_session_simpler.scala +++ b/test/files/pos/depmet_implicit_oopsla_session_simpler.scala @@ -14,7 +14,7 @@ object Sessions { // can't write B <: Session{type Dual = BDual} due to limitations in type inference algorithm // (type variables cannot occur on both sides of <:) // using B#Dual instead of BDual is too imprecise, since it is disconnected from the actual argument that is passed for B - // would be nice if we could introduce a universal quantification over BDual that is not part of the + // would be nice if we could introduce a universal quantification over BDual that is not part of the // type parameter list sealed case class In[A, B <: Session, BDual <: Session](recv: A => B)(implicit dual: B <:< Session{type Dual=BDual}) extends Session { type Dual = Out[A, BDual] @@ -29,7 +29,7 @@ object Sessions { } def addServer = - In{x: Int => + In{x: Int => In{y: Int => System.out.println("Thinking") Out(x+y, Stop())}} diff --git a/test/files/pos/depmet_implicit_oopsla_zipwith.scala b/test/files/pos/depmet_implicit_oopsla_zipwith.scala index fe69802d26..c76d02c1ae 100644 --- a/test/files/pos/depmet_implicit_oopsla_zipwith.scala +++ b/test/files/pos/depmet_implicit_oopsla_zipwith.scala @@ -15,7 +15,7 @@ object ZipWith { def manyApp = n => xs => xs } - implicit def SuccZipWith[N, S, R](implicit zw: ZipWith[N, R]) = + implicit def SuccZipWith[N, S, R](implicit zw: ZipWith[N, R]) = new ZipWith[Succ[N],S => R] { type T = Stream[S] => zw.T @@ -33,12 +33,12 @@ object ZipWith { object Test { def zWith[N, S](n: N, s: S)(implicit zw: ZipWith[N, S]): zw.T = zw.zipWith(n)(s) - def zipWith0: Stream[Int] = zWith(Zero(),0) + def zipWith0: Stream[Int] = zWith(Zero(),0) // (Stream[A]) => java.lang.Object with ZipWith[Zero,B]{type T = Stream[B]}#T // should normalise to: Stream[A] => Stream[B] def map[A, B](f: A => B) = zWith(Succ(Zero()),f) - + def zipWith3[A, B, C, D](f: A => B => C => D) = //: Stream[A] => Stream[B] => Stream[C] => Stream[D] = // BUG why do we need a return type? zWith(Succ(Succ(Succ(Zero()))),f) }
\ No newline at end of file diff --git a/test/files/pos/depmet_implicit_tpbetareduce.scala b/test/files/pos/depmet_implicit_tpbetareduce.scala index c0b9b4e8e4..35d260683b 100644 --- a/test/files/pos/depmet_implicit_tpbetareduce.scala +++ b/test/files/pos/depmet_implicit_tpbetareduce.scala @@ -1,10 +1,10 @@ trait HOSeq { trait Accumulator[+coll[x], elT] trait Iterable[+t] { - type m[+x] + type m[+x] def accumulator[t]: Accumulator[m, t] } - implicit def listAccumulator[elT]: Accumulator[List, elT] = new Accumulator[List, elT] {} + implicit def listAccumulator[elT]: Accumulator[List, elT] = new Accumulator[List, elT] {} trait List[+t] extends Iterable[t] { type m[+x] = List[x] def accumulator[t]: Accumulator[List, t] = listAccumulator[t] diff --git a/test/files/pos/elidable-tparams.scala b/test/files/pos/elidable-tparams.scala index e47951f61d..23b1cba615 100644 --- a/test/files/pos/elidable-tparams.scala +++ b/test/files/pos/elidable-tparams.scala @@ -3,7 +3,7 @@ import elidable._ class ElidableCrashTest { trait My - + @elidable(MINIMUM) def foo[a >: My <: My]: scala.Unit = () foo[My] // crash diff --git a/test/files/pos/existentials.scala b/test/files/pos/existentials.scala index 0adbc701a6..9ca86d13d8 100644 --- a/test/files/pos/existentials.scala +++ b/test/files/pos/existentials.scala @@ -11,7 +11,7 @@ class A { // lazy val quux3a = f() // quux3a // } - + val bippy0 = f _ def bippy1 = f _ // lazy val bippy2 = f _ diff --git a/test/files/pos/exponential-spec.scala b/test/files/pos/exponential-spec.scala index 83aef58f7e..54515c1d21 100644 --- a/test/files/pos/exponential-spec.scala +++ b/test/files/pos/exponential-spec.scala @@ -5,7 +5,7 @@ trait Exp[T] object Test { def f[T](exp: Exp[T]): Exp[T] = ( - f[T] _ + f[T] _ compose f[T] compose f[T] compose f[T] @@ -42,6 +42,6 @@ object Test { compose f[T] compose f[T] compose f[T] - compose f[T] + compose f[T] )(exp) } diff --git a/test/files/pos/gadt-gilles.scala b/test/files/pos/gadt-gilles.scala index 309168c1e0..662be9017d 100644 --- a/test/files/pos/gadt-gilles.scala +++ b/test/files/pos/gadt-gilles.scala @@ -6,7 +6,7 @@ object Test { val x: A[C with D] = new B[C, D] {} val y: A[C with D] = x match { case b: B[u, v] => (new B[u, v] {}): A[u with v] } // OK - + def f[T, U](p: A[T with U]): A[T with U] = p match { case b: B[u, v] => new A[u with v] {} } // Not OK } diff --git a/test/files/pos/gadts2.scala b/test/files/pos/gadts2.scala index 2263cf13a6..fc2a7e4333 100644 --- a/test/files/pos/gadts2.scala +++ b/test/files/pos/gadts2.scala @@ -9,8 +9,8 @@ object Test { final case class NumTerm(val n: Number) extends Term[Number] def f[a](t: Term[a], c: Cell[a]) { - t match { - case NumTerm(n) => c.x = MyDouble(1.0) + t match { + case NumTerm(n) => c.x = MyDouble(1.0) } } diff --git a/test/files/pos/gen-traversable-methods.scala b/test/files/pos/gen-traversable-methods.scala index 2604a09f11..bc720742cf 100644 --- a/test/files/pos/gen-traversable-methods.scala +++ b/test/files/pos/gen-traversable-methods.scala @@ -6,7 +6,7 @@ import collection._ object Test { - + def main(args: Array[String]) { val gen: GenTraversable[Int] = List(1, 2, 3) gen.head @@ -16,5 +16,5 @@ object Test { gen.lastOption gen.init } - + } diff --git a/test/files/pos/generic-sigs.scala b/test/files/pos/generic-sigs.scala index b112766056..98c50b8e82 100644 --- a/test/files/pos/generic-sigs.scala +++ b/test/files/pos/generic-sigs.scala @@ -6,7 +6,7 @@ object A { def f3(x: Class[_ <: Int]) = x def f4(x: Class[_ <: String with Int]) = x def f5(x: Class[_ <: Int with String]) = x - + class Bippy[T] def f6(x: Int) = new Bippy[t forSome { type t <: Int }] def f7(x: T forSome { type T <: Float }) = x @@ -14,7 +14,7 @@ object A { def f9(x: T forSome { type T <: runtime.BoxedUnit }) = x def f10(x: Int) = new Bippy[t forSome { type t <: Unit }] def f11(x: Int) = new Bippy[t forSome { type t >: Null }] - + class Boppy[+T1,-T2] def g1 = new Boppy[t forSome { type t <: Int }, u forSome { type u <: String }] } diff --git a/test/files/pos/gosh.scala b/test/files/pos/gosh.scala index 427df4d33c..98fae8a31e 100644 --- a/test/files/pos/gosh.scala +++ b/test/files/pos/gosh.scala @@ -7,35 +7,35 @@ object ShapeTest extends App { abstract class Shape { def draw(): Unit } - + class Line(s: Point, e: Point) extends Shape { def draw() { Console.println("draw line " + s + "," + e) } } - + abstract class Foo { type T <: Object - + def show(o: T): Unit def print() { Console.println("in Foo") } } - + abstract class ShapeFoo extends Foo { type T <: Shape def show(o: T) { o.draw() } override def print() { Console.println("in ShapeFoo") } } - + class LineFoo extends ShapeFoo { type T = Line override def print() { Console.println("in LineFoo") } } - + val p1 = new Point(1,4) val p2 = new Point(12, 28) - + val l1 = new Line(p1, p2) - + val l = new ShapeFoo { // ** // type T = Line // ** // override def print() { Console.println("in LineFoo") } // ** // diff --git a/test/files/pos/gui.scala b/test/files/pos/gui.scala index 322e0a6e22..3b4f49cf55 100644 --- a/test/files/pos/gui.scala +++ b/test/files/pos/gui.scala @@ -2,7 +2,7 @@ object Geom { trait Shape case class Point(x: Int, y: Int) extends Shape case class Rectangle(ll: Point, ur: Point) extends Shape { - def inset(delta: Int) = + def inset(delta: Int) = Rectangle(Point(ll.x - delta, ll.y - delta), Point(ur.x + delta, ur.y + delta)); } } @@ -20,7 +20,7 @@ trait Screen { } object DummyScreen extends Screen { - def drawRect(r: Geom.Rectangle, c: Color) { + def drawRect(r: Geom.Rectangle, c: Color) { Console.println("draw " + r + " with " + c) } def fillRect(r: Geom.Rectangle, c: Color) { @@ -55,7 +55,7 @@ object GUI { def mouseDown(p: Geom.Point): Unit } - abstract class Button(scr: Screen, p: Geom.Point, name: String) + abstract class Button(scr: Screen, p: Geom.Point, name: String) extends Glyph with MouseCtl { var enabled: Boolean = false val label = new Label(scr, p, name) @@ -86,7 +86,7 @@ object GUIClient { def quit() { Console.println("application exited") } } - class QuitButton (scr: Screen, p: Geom.Point, name: String, a: App) + class QuitButton (scr: Screen, p: Geom.Point, name: String, a: App) extends GUI.Button(scr, p, name) { def doit() { a.quit() } } diff --git a/test/files/pos/hk-infer.scala b/test/files/pos/hk-infer.scala index 7834282bf2..30e3476404 100644 --- a/test/files/pos/hk-infer.scala +++ b/test/files/pos/hk-infer.scala @@ -31,7 +31,7 @@ object DoesWorkHK { def BOOP(ys: Seq[M[_]]) = new Booper[M](xs ++ ys) } implicit def mkBoop[M[_]](xs: Seq[M[_]]) = new Booper[M](xs) - + def f1 = x BOOP y BOOP x1 BOOP x2 } diff --git a/test/files/pos/hkarray.scala b/test/files/pos/hkarray.scala index 3faae180f4..af1160300a 100644 --- a/test/files/pos/hkarray.scala +++ b/test/files/pos/hkarray.scala @@ -1,5 +1,5 @@ trait Foo[CC[_]] { } class Bip { - val x = new Foo[Array] { } + val x = new Foo[Array] { } }
\ No newline at end of file diff --git a/test/files/pos/hkrange.scala b/test/files/pos/hkrange.scala index 8d61167ad8..a6803230ed 100644 --- a/test/files/pos/hkrange.scala +++ b/test/files/pos/hkrange.scala @@ -1,5 +1,5 @@ class A { def f[CC[X] <: Traversable[X]](x: CC[Int]) = () - + f(1 to 5) } diff --git a/test/files/pos/imp2-pos.scala b/test/files/pos/imp2-pos.scala index 407b07f3fd..5460c60015 100644 --- a/test/files/pos/imp2-pos.scala +++ b/test/files/pos/imp2-pos.scala @@ -1,5 +1,5 @@ object Test { - import collection.mutable._ + import collection.mutable._ import collection.mutable._ val x = new HashMap } diff --git a/test/files/pos/implicit-infix-ops.scala b/test/files/pos/implicit-infix-ops.scala index d7519e6340..66f3718e86 100644 --- a/test/files/pos/implicit-infix-ops.scala +++ b/test/files/pos/implicit-infix-ops.scala @@ -1,7 +1,7 @@ object Test { import Ordering.Implicits._ import Numeric.Implicits._ - + def f1[T: Numeric](x: T, y: T, z: T) = x + y + z def f2[T: Ordering](x: T, y: T, z: T) = if (x < y) (z > y) else (x < z) } @@ -9,7 +9,7 @@ object Test { object Int { import Ordering.Implicits._ import math.Integral.Implicits._ - + def f1[T: Integral](x: T, y: T, z: T) = (x + y + z) / z def f2[T: Ordering](x: T, y: T, z: T) = if (x < y) (z > y) else (x < z) } @@ -17,7 +17,7 @@ object Int { object Frac { import Ordering.Implicits._ import math.Fractional.Implicits._ - + def f1[T: Fractional](x: T, y: T, z: T) = (x + y + z) / z def f2[T: Ordering](x: T, y: T, z: T) = if (x < y) (z > y) else (x < z) }
\ No newline at end of file diff --git a/test/files/pos/imports-pos.scala b/test/files/pos/imports-pos.scala index 5f70a5d2da..f6a55e5e07 100644 --- a/test/files/pos/imports-pos.scala +++ b/test/files/pos/imports-pos.scala @@ -7,10 +7,10 @@ object test { val foo = 1; - p("hello"); print("world"); S.out.println("!"); + p("hello"); print("world"); S.out.println("!"); S.out.flush(); } object test1 { import test._; foo -} +} diff --git a/test/files/pos/infer2-pos.scala b/test/files/pos/infer2-pos.scala index 0ed9666f40..2ce88be544 100644 --- a/test/files/pos/infer2-pos.scala +++ b/test/files/pos/infer2-pos.scala @@ -5,4 +5,3 @@ case class nil[T]() extends Lst[T] object test { Console.println(cons(1, nil())) } - diff --git a/test/files/pos/inferbroadtype.scala b/test/files/pos/inferbroadtype.scala index 467bd0f186..de8f7aa184 100644 --- a/test/files/pos/inferbroadtype.scala +++ b/test/files/pos/inferbroadtype.scala @@ -2,7 +2,7 @@ object Test { abstract class Base { val changesBaseClasses: Boolean } class Concrete extends Base { val changesBaseClasses = true } def getBase : Base = new Concrete - + var c = new Base { val changesBaseClasses = true } c = getBase } diff --git a/test/files/pos/inliner2.scala b/test/files/pos/inliner2.scala index fe231ec3c4..bc83e04312 100644 --- a/test/files/pos/inliner2.scala +++ b/test/files/pos/inliner2.scala @@ -10,7 +10,7 @@ class A { final def bob2() = if (debug) 1 else 2 } // Cool: -// +// // % ls -1 /tmp/2901/ // A$$anonfun$bob1$1.class // A$$anonfun$bob1$2.class @@ -20,7 +20,7 @@ class A { // A.class // // Observations: -// +// // (1) The inlined version accesses the field: the explicit one calls the accessor. // (2) The inlined version fails to eliminate boxing. With reference types it emits // an unneeded checkcast. @@ -30,7 +30,7 @@ class A { // inlined at all sites. // // Generated bytecode for the above: -// +// // public final int bob1(); // Code: // Stack=1, Locals=1, Args_size=1 @@ -44,7 +44,7 @@ class A { // 15: invokestatic #41; //Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; // 18: invokestatic #45; //Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I // 21: ireturn -// +// // public final int bob2(); // Code: // Stack=1, Locals=1, Args_size=1 diff --git a/test/files/pos/java-access-pos/J.java b/test/files/pos/java-access-pos/J.java index 4f2024673c..b6bc3363a1 100644 --- a/test/files/pos/java-access-pos/J.java +++ b/test/files/pos/java-access-pos/J.java @@ -4,11 +4,11 @@ public abstract class J { public J() { } J(int x1) { } protected J(int x1, int x2) { } - + abstract void packageAbstract(); protected abstract void protectedAbstract(); public abstract void publicAbstract(); - + void packageConcrete() { return; } protected void protectedConcrete() { return; } public void publicConcrete() { return; } diff --git a/test/files/pos/java-access-pos/S1.scala b/test/files/pos/java-access-pos/S1.scala index cc739d9555..10730e3a70 100644 --- a/test/files/pos/java-access-pos/S1.scala +++ b/test/files/pos/java-access-pos/S1.scala @@ -6,7 +6,7 @@ class S1 extends J { override private[b] def packageAbstract() = () override protected[b] def protectedAbstract() = () override def publicAbstract() = () - + override private[b] def packageConcrete() = () override protected[b] def protectedConcrete() = () override def publicConcrete() = () @@ -26,7 +26,7 @@ class S3 extends J { protected[b] def packageAbstract() = () protected[b] def protectedAbstract() = () def publicAbstract() = () - + override protected[b] def packageConcrete() = () override protected[b] def protectedConcrete() = () override def publicConcrete() = () @@ -37,7 +37,7 @@ class S4 extends J { private[a] def packageAbstract() = () protected[a] def protectedAbstract() = () def publicAbstract() = () - + override private[a] def packageConcrete() = () override protected[a] def protectedConcrete() = () override def publicConcrete() = () @@ -48,14 +48,14 @@ class S5 extends J { def packageAbstract() = () def protectedAbstract() = () def publicAbstract() = () - + override def packageConcrete() = () override def protectedConcrete() = () override def publicConcrete() = () } /** Constructors. */ -class S6 extends J(1) { +class S6 extends J(1) { def packageAbstract() = () def protectedAbstract() = () def publicAbstract() = () diff --git a/test/files/pos/javaReadsSigs/fromjava.java b/test/files/pos/javaReadsSigs/fromjava.java index eca63961d5..92441b0c6b 100644 --- a/test/files/pos/javaReadsSigs/fromjava.java +++ b/test/files/pos/javaReadsSigs/fromjava.java @@ -22,11 +22,11 @@ class B { }; class Contra { // Not an Ordering<Character>. static Ordering<Object> charOrd = scala.math.Ordering.Char$.MODULE$; - + public boolean useCharOrd() { return charOrd.compare(new Object(), new Object()) == 0; } - + static Numeric<?> intNum = scala.math.Numeric.IntIsIntegral$.MODULE$; } @@ -36,13 +36,13 @@ public class fromjava { return null; } }; - + public static Function1<Tuple2<? extends Object, B>, B> f2 = new scala.runtime.AbstractFunction1<Tuple2<? extends Object, B>, B>() { public B apply(Tuple2<? extends Object, B> tup) { return tup._2(); } }; - + public static String vector(Vector<String> x) { Vector<String> y = x.take(2); return y.head(); diff --git a/test/files/pos/lambdalift.scala b/test/files/pos/lambdalift.scala index 10bbf3ac12..bc997d6f81 100644 --- a/test/files/pos/lambdalift.scala +++ b/test/files/pos/lambdalift.scala @@ -11,5 +11,5 @@ object test { def h() = x; } g() + new inner().g(); - } + } } diff --git a/test/files/pos/listpattern.scala b/test/files/pos/listpattern.scala index b64068474c..47145bf037 100644 --- a/test/files/pos/listpattern.scala +++ b/test/files/pos/listpattern.scala @@ -1,7 +1,7 @@ trait Value {} case class FloatValue(x: Double) extends Value object Test { - def applyNumeric(op: (Double, Double) => Double): + def applyNumeric(op: (Double, Double) => Double): PartialFunction[List[Value], Value] = { case List(FloatValue(x), FloatValue(y)) => FloatValue(op(x, y)) } diff --git a/test/files/pos/lookupswitch.scala b/test/files/pos/lookupswitch.scala index 33594c0ea6..5d48251240 100644 --- a/test/files/pos/lookupswitch.scala +++ b/test/files/pos/lookupswitch.scala @@ -34,4 +34,3 @@ class A { case 20 => "20" } } -
\ No newline at end of file diff --git a/test/files/pos/looping-jsig.scala b/test/files/pos/looping-jsig.scala index e2d9e76229..6e3313c463 100644 --- a/test/files/pos/looping-jsig.scala +++ b/test/files/pos/looping-jsig.scala @@ -1,15 +1,15 @@ import scala.collection.mutable._ trait BugTrack { - trait B[+T] + trait B[+T] val cache : HashMap[A[_], B[_]] = HashMap.empty - def A[T](f: Int => B[T]): A[T] + def A[T](f: Int => B[T]): A[T] = new A[T]{def apply(in: Int) = f(in)} - + abstract class A[+T] extends (Int => B[T]) { def giveMeSame = this - } + } def amethod[T](p: =>A[T]): A[T] = A(in => cache.get(p) match { case Some(res) => res diff --git a/test/files/pos/lub-dealias-widen.scala b/test/files/pos/lub-dealias-widen.scala index 38854fbc5c..8d26708d65 100644 --- a/test/files/pos/lub-dealias-widen.scala +++ b/test/files/pos/lub-dealias-widen.scala @@ -27,7 +27,7 @@ object Test { = p2 >> { (xs: List[String]) => 0 } // This works after https://github.com/scala/scala/commit/a06d31f6a - // Before: error: inferred type arguments [List[String] => String,List[String] => String] + // Before: error: inferred type arguments [List[String] => String,List[String] => String] // do not conform to method &'s type parameter bounds // [G <: H,H >: Int => (Int => String)] val s = r & r2 diff --git a/test/files/pos/michel6.scala b/test/files/pos/michel6.scala index f312bf1796..b32e8bed75 100644 --- a/test/files/pos/michel6.scala +++ b/test/files/pos/michel6.scala @@ -1,6 +1,6 @@ object M { def f(x: Int): Unit = {} - + def g(): Int => Unit = if (0 == 0) f else g() } diff --git a/test/files/pos/needstypeearly.scala b/test/files/pos/needstypeearly.scala index bd93b5c45d..a90c2575f2 100644 --- a/test/files/pos/needstypeearly.scala +++ b/test/files/pos/needstypeearly.scala @@ -1,4 +1,4 @@ -abstract class NeedsXEarly { - val x: Int +abstract class NeedsXEarly { + val x: Int } class Foo extends { val x = 1 } with NeedsXEarly diff --git a/test/files/pos/nothing_manifest_disambig-old.scala b/test/files/pos/nothing_manifest_disambig-old.scala index 076742033f..9a3db0c6d4 100644 --- a/test/files/pos/nothing_manifest_disambig-old.scala +++ b/test/files/pos/nothing_manifest_disambig-old.scala @@ -1,10 +1,10 @@ object Test { def mani[T: Manifest](xs: T) = xs mani(List()) - + def listElMani[T: Manifest](xs: List[T]) = xs listElMani(List()) - + def foo[A, C](m : C)(implicit ev: C <:< Traversable[A], mani: Manifest[A]): (C, A, Manifest[A]) = (m, m.head, mani) - foo(List(1,2,3)) + foo(List(1,2,3)) }
\ No newline at end of file diff --git a/test/files/pos/nullary.scala b/test/files/pos/nullary.scala index 8e5a834012..614fcdf480 100644 --- a/test/files/pos/nullary.scala +++ b/test/files/pos/nullary.scala @@ -2,7 +2,7 @@ abstract class NullaryTest[T, m[s]] { def nullary: String = "a" val x = nullary - def nullary2: T + def nullary2: T val x2 = nullary2 def nullary3: m[T] @@ -16,5 +16,5 @@ class Concrete extends NullaryTest[Int, List] { object test { (new Concrete).nullary2 - (new Concrete).nullary3 + (new Concrete).nullary3 } diff --git a/test/files/pos/nullary_poly.scala b/test/files/pos/nullary_poly.scala index 4de7235a1c..d2e1e127a1 100644 --- a/test/files/pos/nullary_poly.scala +++ b/test/files/pos/nullary_poly.scala @@ -2,9 +2,9 @@ class A { // built-in synchronized {} - + val x: String = "a".asInstanceOf[String] - + // user-defined: def polyNullary[T]: List[T] = Nil } diff --git a/test/files/pos/override-object-yes.scala b/test/files/pos/override-object-yes.scala index b0563df0a3..858f9b21fc 100644 --- a/test/files/pos/override-object-yes.scala +++ b/test/files/pos/override-object-yes.scala @@ -14,8 +14,8 @@ package case1 { override def f = 3 } } - - trait Foo3 { + + trait Foo3 { object Bar { def g: Traversable[Int] = Nil } diff --git a/test/files/pos/partialfun.scala b/test/files/pos/partialfun.scala index d8971e56fb..9f32a22023 100644 --- a/test/files/pos/partialfun.scala +++ b/test/files/pos/partialfun.scala @@ -1,6 +1,6 @@ object partialfun { - def applyPartial[b](f: PartialFunction[Option[String], b])(x: Option[String]) = + def applyPartial[b](f: PartialFunction[Option[String], b])(x: Option[String]) = if (f.isDefinedAt(x)) f(x) else "<undefined>"; applyPartial { diff --git a/test/files/pos/pat_gilles.scala b/test/files/pos/pat_gilles.scala index 567d700eba..704d5b9c00 100644 --- a/test/files/pos/pat_gilles.scala +++ b/test/files/pos/pat_gilles.scala @@ -1,7 +1,7 @@ abstract class Table2 { - val x: Any => Unit = { zz:Any => + val x: Any => Unit = { zz:Any => zz match { case Table2.CellUpdated(row, column) => val foo = Table2.CellUpdated(2,2) diff --git a/test/files/pos/propagate.scala b/test/files/pos/propagate.scala index a7f9d6ce6d..5881920798 100644 --- a/test/files/pos/propagate.scala +++ b/test/files/pos/propagate.scala @@ -14,4 +14,3 @@ class C { - diff --git a/test/files/pos/return_thistype.scala b/test/files/pos/return_thistype.scala index f164e06cc0..c0736c0ad9 100644 --- a/test/files/pos/return_thistype.scala +++ b/test/files/pos/return_thistype.scala @@ -1,8 +1,8 @@ // tests transformation of return type in typedTypeApply (see also tcpoly_gm.scala) -class As { - class A { +class As { + class A { def foo: A.this.type = bar.asInstanceOf[A.this.type] def foo2: this.type = bar.asInstanceOf[this.type] - def bar: A = null + def bar: A = null } } diff --git a/test/files/pos/scala-singleton.scala b/test/files/pos/scala-singleton.scala index 5e0baa0cb2..08038db93b 100644 --- a/test/files/pos/scala-singleton.scala +++ b/test/files/pos/scala-singleton.scala @@ -3,12 +3,12 @@ object Test { def f1(x: AnyRef with Singleton): AnyRef with Singleton = x def f2[T <: AnyRef with Singleton](x: T): T = x - + val x1: AnyRef with Singleton = "abc" val x2 = "def" final val x3 = "ghi" val x4: String = "jkl" - + // compiles... def narrow1(x: AnyRef): AnyRef with Singleton = x @@ -17,26 +17,26 @@ object Test { // fails, wait, what? This fails and narrow1 compiles? def narrow3(x: AnyRef): AnyRef with Singleton = x.asInstanceOf[AnyRef with Singleton] - + // ok def narrow4[T <: AnyRef](x: T): AnyRef with Singleton = x - + object imp { implicit def narrow4[T <: AnyRef](x: T): AnyRef with Singleton = x val x5: String = "mno" def imp1 = f1(x5) - + // f2(x5) // doesn't work but I think it should def imp2 = f2(narrow4(x5)) } - + def main(args: Array[String]): Unit = { // compiles f1(x1) f1(x2) f1(x3) f1(x4) - + f2(x1) // f2(x2) // f2(x3) // maybe this one should work diff --git a/test/files/pos/scoping1.scala b/test/files/pos/scoping1.scala index 548f154b6b..9fe1b5f3e5 100644 --- a/test/files/pos/scoping1.scala +++ b/test/files/pos/scoping1.scala @@ -9,4 +9,4 @@ object This extends App { def foo() = () } val c: C = new D -} +} diff --git a/test/files/pos/selftails.scala b/test/files/pos/selftails.scala index 7c58543747..a4253b80c7 100644 --- a/test/files/pos/selftails.scala +++ b/test/files/pos/selftails.scala @@ -1,10 +1,10 @@ package net.liftweb.util - + /** * This trait adds functionality to Scala standard types */ trait BasicTypesHelpers { self: StringHelpers with ControlHelpers => - + /** * Compare two arrays of Byte for byte equality. * @return true if two Byte arrays contain the same bytes @@ -19,5 +19,5 @@ trait BasicTypesHelpers { self: StringHelpers with ControlHelpers => } } -trait StringHelpers +trait StringHelpers trait ControlHelpers diff --git a/test/files/pos/seq-ordering.scala b/test/files/pos/seq-ordering.scala index 8f1d293c40..517d8ae8aa 100644 --- a/test/files/pos/seq-ordering.scala +++ b/test/files/pos/seq-ordering.scala @@ -2,7 +2,7 @@ import Ordering.Implicits._ class A { import Predef.{ implicitly => ? } - + ?[Ordering[List[Int]]] ?[Ordering[IndexedSeq[(Int, String)]]] ?[Ordering[Seq[Seq[Int]]]] diff --git a/test/files/pos/signatures/Test.java b/test/files/pos/signatures/Test.java index 78c196526b..3d1e3756a7 100644 --- a/test/files/pos/signatures/Test.java +++ b/test/files/pos/signatures/Test.java @@ -3,7 +3,7 @@ import test.Outer; /* Test correct generation of java signatures. The Outer class should not * have a Java signature attribute for the inner method definition. Trait - * Mutable should have one, even though it is also a nested definition. + * Mutable should have one, even though it is also a nested definition. * (but for classes there is a way to tell about nesting to the JVM). */ class Test { diff --git a/test/files/pos/signatures/sig.scala b/test/files/pos/signatures/sig.scala index 3feb9c456a..4236f27bed 100644 --- a/test/files/pos/signatures/sig.scala +++ b/test/files/pos/signatures/sig.scala @@ -1,7 +1,7 @@ package test /* Tests correct generation of Java signatures. The local method 'bar' should - * not get a generic signature, as it may refer to type parameters of the enclosing + * not get a generic signature, as it may refer to type parameters of the enclosing * method, and the JVM does not know about nested methods. */ class Outer { diff --git a/test/files/pos/spec-Function1.scala b/test/files/pos/spec-Function1.scala index 2a3074fd14..5a115501d8 100644 --- a/test/files/pos/spec-Function1.scala +++ b/test/files/pos/spec-Function1.scala @@ -35,11 +35,11 @@ package scalabip trait Function1[@specialized -T1, @specialized +R] extends AnyRef { self => def apply(v1:T1): R override def toString() = "<function>" - + /** (f compose g)(x) == f(g(x)) */ def compose[A](g: A => T1): A => R = { x => apply(g(x)) } - + /** (f andThen g)(x) == g(f(x)) */ def andThen[A](g: R => A): T1 => A = { x => g(apply(x)) } diff --git a/test/files/pos/spec-arrays.scala b/test/files/pos/spec-arrays.scala index 7ae2cb1efb..883bc2fe62 100644 --- a/test/files/pos/spec-arrays.scala +++ b/test/files/pos/spec-arrays.scala @@ -20,7 +20,7 @@ abstract class AbsArray[T] { def updateBoolean(idx: Int, elem: Boolean) = update(idx, elem.asInstanceOf[T]) def applyObject(idx: Int): Object = apply(idx).asInstanceOf[Object] def updateObject(idx: Int, elem: Object) = update(idx, elem.asInstanceOf[T]) -} +} final class IntArray(arr: Array[Int]) extends AbsArray[Int] { def apply(idx: Int): Int = applyInt(idx) @@ -64,7 +64,7 @@ class ScalaSpecTest extends Test { while (i < arr.length) { acc = acc + arr.applyInt(i); i += 1 } acc } - + def modify(j: Int) = { val base = j * 100 % 1000 var i = 0 @@ -74,7 +74,7 @@ class ScalaSpecTest extends Test { } } } - + class ScalaSpec2Test extends Test { val arr: AbsArray[Int] = new IntArray(new Array[Int](1000)) @@ -84,7 +84,7 @@ class ScalaSpec2Test extends Test { while (i < arr.length) { acc = acc + arr.applyInt(i); i += 1 } acc } - + def modify(j: Int) = { val base = j * 100 % 1000 var i = 0 @@ -94,7 +94,7 @@ class ScalaSpec2Test extends Test { } } } - + class ScalaWrapTest extends Test { val arr: AbsArray[Int] = new ArraySeq(new Array[Int](1000)) @@ -104,7 +104,7 @@ class ScalaWrapTest extends Test { while (i < arr.length) { acc = acc + arr.applyInt(i); i += 1 } acc } - + def modify(j: Int) = { val base = j * 100 % 1000 var i = 0 @@ -114,7 +114,7 @@ class ScalaWrapTest extends Test { } } } - + class ScalaGenTest extends Test { val arr: AbsArray[Integer] = new ArraySeq(new Array[Integer](1000)) for (i <- 0 until arr.length) arr(i) = new Integer(0) @@ -125,7 +125,7 @@ class ScalaGenTest extends Test { while (i < arr.length) { acc = acc + arr.apply(i).intValue; i += 1 } acc } - + def modify(j: Int) = { val base = j * 100 % 1000 var i = 0 @@ -135,7 +135,7 @@ class ScalaGenTest extends Test { } } } - + class JavaTest extends Test { val arr = new Array[Int](1000) @@ -145,7 +145,7 @@ class JavaTest extends Test { while (i < arr.length) { acc = acc + arr(i); i += 1 } acc } - + def modify(j: Int) = { val base = j * 100 % 1000 var i = 0 @@ -166,7 +166,7 @@ class ScalaSpec3Test extends Test { while (i < arr.length) { acc = acc + arr(i); i += 1 } acc } - + def modify(j: Int) = { val base = j * 100 % 1000 var i = 0 diff --git a/test/files/pos/spec-funs.scala b/test/files/pos/spec-funs.scala index b9acbe171a..f92ae9899d 100644 --- a/test/files/pos/spec-funs.scala +++ b/test/files/pos/spec-funs.scala @@ -19,7 +19,7 @@ final class IntTest { val xs = new Array[Int](10000) val f = new AbsFunction1[Int, Int] { def apply(x: Int): Int = x * x - } + } for (j <- 0 until niters) { transF(xs, f) } diff --git a/test/files/pos/spec-params-old.scala b/test/files/pos/spec-params-old.scala index f522512846..33a252120c 100644 --- a/test/files/pos/spec-params-old.scala +++ b/test/files/pos/spec-params-old.scala @@ -10,7 +10,7 @@ class Foo[@specialized A: ClassManifest] { def m2[@specialized B <: String](x: B) = x.concat("a") // conflicting in bounds, no mention of other spec members - // expect an overload here plus implementation in + // expect an overload here plus implementation in // compatible specialized subclasses def m3[@specialized B >: A](x: B) = () @@ -19,10 +19,10 @@ class Foo[@specialized A: ClassManifest] { // non-conflicting, expect a normalized overload implementation here def m5[@specialized B](x: B) = x - + // non-conflicting, expect a normalized implementation here // and specialized implementations for all expansions in specialized subclasses - def m6[@specialized B](x: B, y: A) = + def m6[@specialized B](x: B, y: A) = goal(y) def goal(x: A) = { diff --git a/test/files/pos/spec-short.scala b/test/files/pos/spec-short.scala index 94a8007c6e..71e56a485a 100644 --- a/test/files/pos/spec-short.scala +++ b/test/files/pos/spec-short.scala @@ -5,7 +5,7 @@ abstract class AbsFun[@specialized T, @specialized U] { // abstract function, specialized def sum(xs: List[T]): Int - def prod(xs: List[T], mul: (Int, T) => Int): Int = + def prod(xs: List[T], mul: (Int, T) => Int): Int = (1 /: xs)(mul) // concrete function, not specialized @@ -18,9 +18,9 @@ abstract class AbsFun[@specialized T, @specialized U] { class Square extends AbsFun[Int, Int] { def apply(x: Int): Int = x * x - def sum(xs: List[Int]): Int = + def sum(xs: List[Int]): Int = (0 /: xs) (_ + _) - def abs(m: Int): Int = + def abs(m: Int): Int = sum(List(1, 2, 3)) } diff --git a/test/files/pos/spec-t3497.scala b/test/files/pos/spec-t3497.scala index 6cc0e24f89..ff054aa7de 100644 --- a/test/files/pos/spec-t3497.scala +++ b/test/files/pos/spec-t3497.scala @@ -10,7 +10,7 @@ object B extends A[ Array[Byte], Int ] { return -1 } } - + return 0 } } diff --git a/test/files/pos/spec-tailcall.scala b/test/files/pos/spec-tailcall.scala index d91e2f59ce..703ec011ad 100644 --- a/test/files/pos/spec-tailcall.scala +++ b/test/files/pos/spec-tailcall.scala @@ -1,5 +1,5 @@ class TailCall[@specialized T] { - final def dropLeft(n: Int, xs: List[T]): List[T] = + final def dropLeft(n: Int, xs: List[T]): List[T] = if (n == 0) xs else dropLeft(n - 1, xs.tail) /* @@ -7,7 +7,7 @@ class TailCall[@specialized T] { def crash(o: Option[String]) = filter { case None if { - def dropLeft[T](n: Int, xs: List[T]): List[T] = + def dropLeft[T](n: Int, xs: List[T]): List[T] = if (n == 0) xs else dropLeft(n - 1, xs.tail) dropLeft(2, List(1, 2, 3)).isEmpty diff --git a/test/files/pos/spec-vector.scala b/test/files/pos/spec-vector.scala index 06e49b521f..392949c669 100644 --- a/test/files/pos/spec-vector.scala +++ b/test/files/pos/spec-vector.scala @@ -1,4 +1,4 @@ // ticket #3379, abstract overrides trait Vector extends (Int=>Double) { - override def apply(i: Int): Double + override def apply(i: Int): Double } diff --git a/test/files/pos/spec.scala b/test/files/pos/spec.scala index 093d3cded4..cc060ffe84 100644 --- a/test/files/pos/spec.scala +++ b/test/files/pos/spec.scala @@ -7,7 +7,7 @@ class Bar[@specialized(Int, AnyRef) A](a: A) { } -class WithInner[@specialized(Int, AnyRef) A](a: A) { +class WithInner[@specialized(Int, AnyRef) A](a: A) { class Inner { def meth = a } @@ -42,7 +42,7 @@ class Qux[@specialized(AnyRef) A] { class Foo[@specialized(Int, AnyRef) A](val a: Array[A]) { a(0) - + def id(elem: A) = a(0) = elem } @@ -52,13 +52,13 @@ object Test { def main(arg: Array[String]) { val f = new Foo(new Array[String](5)) f.id("") - + val z = new Baz[Int, Double] z.ab(1, 1.0) - + testspec(new Array[String](5)) testspec(new Array[Int](5)) } - + def testspec[@specialized(Int, AnyRef) T](arr: Array[T]) = arr(0) } diff --git a/test/files/pos/strings.scala b/test/files/pos/strings.scala index 83b8179706..9fe8cfd94b 100644 --- a/test/files/pos/strings.scala +++ b/test/files/pos/strings.scala @@ -6,5 +6,5 @@ object test { } // #1000 object A { - println("""This a "raw" string ending with a "double quote"""") + println("""This a "raw" string ending with a "double quote"""") } diff --git a/test/files/pos/sudoku.scala b/test/files/pos/sudoku.scala index 336dc756a9..9435f504d6 100644 --- a/test/files/pos/sudoku.scala +++ b/test/files/pos/sudoku.scala @@ -3,22 +3,22 @@ object SudokuSolver extends App { // held in a global variable m. The program begins by reading 9 lines // of input to fill the board var m: Array[Array[Char]] = Array.tabulate(9)((x: Int) => readLine.toArray) - + // For printing m, a method print is defined def print = { println(""); m map (carr => println(new String(carr))) } - + // The test for validity is performed by looping over i=0..8 and // testing the row, column and 3x3 square containing the given // coordinate def invalid(i: Int, x: Int, y: Int, n: Char): Boolean = i<9 && (m(y)(i) == n || m(i)(x) == n || m(y/3*3 + i/3)(x/3*3 + i % 3) == n || invalid(i+1, x, y, n)) - + // Looping over a half-closed range of consecutive integers [l..u) // is factored out into a higher-order function def fold(f: (Int, Int) => Int, accu: Int, l: Int, u: Int): Int = if(l==u) accu else fold(f, f(accu, l), l+1, u) - + // The search function examines each position on the board in turn, // trying the numbers 1..9 in each unfilled position // The function is itself a higher-order fold, accumulating the value @@ -34,7 +34,7 @@ object SudokuSolver extends App { val newaccu = search(x+1, y, f, accu); m(y)(x) = '0'; newaccu}, accu, 1, 10)} - + // The main part of the program uses the search function to accumulate // the total number of solutions println("\n"+search(0,0,i => {print; i+1},0)+" solution(s)") diff --git a/test/files/pos/super/Super_1.java b/test/files/pos/super/Super_1.java index 418ae96bc0..9acbba0ec4 100644 --- a/test/files/pos/super/Super_1.java +++ b/test/files/pos/super/Super_1.java @@ -1,6 +1,6 @@ // A.java interface Inter<T> { } -class Super implements Inter<Super.Inner> { +class Super implements Inter<Super.Inner> { public class Inner { }; } diff --git a/test/files/pos/t0066.scala b/test/files/pos/t0066.scala index 9317da7165..2153264e7a 100644 --- a/test/files/pos/t0066.scala +++ b/test/files/pos/t0066.scala @@ -3,5 +3,5 @@ class GBTree[A, B] /*with Map[A, B, GBTree[A,B]]*/ { case class Node[A,B](key:A,value:B,smaller:Node[A,B],bigger:Node[A,B]) extends Tree[A,B]; case class Nil[A,B]() extends Tree[A,B]; - + } diff --git a/test/files/pos/t0069.scala b/test/files/pos/t0069.scala index 5a8c15cd5a..e4c242c0ee 100644 --- a/test/files/pos/t0069.scala +++ b/test/files/pos/t0069.scala @@ -8,4 +8,3 @@ object testCQ { */ } - diff --git a/test/files/pos/t0288/Foo.scala b/test/files/pos/t0288/Foo.scala index 1f7d81327d..778ba65f58 100644 --- a/test/files/pos/t0288/Foo.scala +++ b/test/files/pos/t0288/Foo.scala @@ -6,4 +6,4 @@ class Foo extends Outer{ val bar = new Inner(); // Shouldn't this work? -} +} diff --git a/test/files/pos/t0288/Outer.java b/test/files/pos/t0288/Outer.java index 7a3754fb5d..bea3e3f8d0 100644 --- a/test/files/pos/t0288/Outer.java +++ b/test/files/pos/t0288/Outer.java @@ -6,4 +6,4 @@ public class Outer{ } -} +} diff --git a/test/files/pos/t0305.scala b/test/files/pos/t0305.scala index 4d37a02eb3..4838b1fcf8 100644 --- a/test/files/pos/t0305.scala +++ b/test/files/pos/t0305.scala @@ -1,5 +1,5 @@ object Test extends App { - + def foo(is:Int*) = 1; def foo(i:Int) = 2; diff --git a/test/files/pos/t0438.scala b/test/files/pos/t0438.scala index 33b7efeaac..fa5b7711ff 100644 --- a/test/files/pos/t0438.scala +++ b/test/files/pos/t0438.scala @@ -1,9 +1,9 @@ class Foo { - implicit def pair2fun2[A, B, C](f: (A, B) => C) = + implicit def pair2fun2[A, B, C](f: (A, B) => C) = {p: (A, B) => f(p._1, p._2) } def foo(f: ((Int, Int)) => Int) = f - def bar(x: Int, y: Int) = x + y + def bar(x: Int, y: Int) = x + y foo({ (x: Int, y: Int) => x + y }) // works foo(pair2fun2(bar _)) // works diff --git a/test/files/pos/t0453.scala b/test/files/pos/t0453.scala index d59a3d22f2..dfacc5eed7 100644 --- a/test/files/pos/t0453.scala +++ b/test/files/pos/t0453.scala @@ -1,5 +1,5 @@ object Test { - val foo = new { + val foo = new { trait Bar def l () : Bar = { new Bar {} } } diff --git a/test/files/pos/t0599.scala b/test/files/pos/t0599.scala index 6125b99ce2..885159af66 100644 --- a/test/files/pos/t0599.scala +++ b/test/files/pos/t0599.scala @@ -15,4 +15,4 @@ abstract class FooA { a.xxx; doB.xxx; } - } + } diff --git a/test/files/pos/t0625.scala b/test/files/pos/t0625.scala index bda463d6a6..5614542599 100644 --- a/test/files/pos/t0625.scala +++ b/test/files/pos/t0625.scala @@ -1,6 +1,6 @@ object Test { def idMap[C[_],T](m: { def map[U](f: T => U): C[U] }): C[T] = m.map(t => t) - + def main(args: Array[String]): Unit = { idMap(Some(5)) idMap(Responder.constant(5)) diff --git a/test/files/pos/t0770.scala b/test/files/pos/t0770.scala index bb438f1918..7a0a2bf9bb 100644 --- a/test/files/pos/t0770.scala +++ b/test/files/pos/t0770.scala @@ -1,7 +1,7 @@ trait A { private[this] val p = 5 - + def f = (b: Byte) => p } diff --git a/test/files/pos/t0774/unrelated.scala b/test/files/pos/t0774/unrelated.scala index 483f836d0c..1efdb2505e 100644 --- a/test/files/pos/t0774/unrelated.scala +++ b/test/files/pos/t0774/unrelated.scala @@ -1,8 +1,8 @@ object Outer { import Inner._ - + deathname - + object Inner { def deathname: Int = 1 } diff --git a/test/files/pos/t0786.scala b/test/files/pos/t0786.scala index 4d9f1d0dc9..f40cf7d2e1 100644 --- a/test/files/pos/t0786.scala +++ b/test/files/pos/t0786.scala @@ -2,15 +2,15 @@ object ImplicitProblem { class M[T] def nullval[T] = null.asInstanceOf[T]; - + trait Rep[T] { def eval: Int } - + implicit def toRep0(n: Int) = new Rep[Int] { def eval = 0 } - + implicit def toRepN[T](n: M[T])(implicit f: T => Rep[T]) = new Rep[M[T]] { def eval = f(nullval[T]).eval + 1 } @@ -18,11 +18,11 @@ object ImplicitProblem { def depth[T <% Rep[T]](n: T) = n.eval def main(args: Array[String]) { - println(depth(nullval[M[Int]])) // (1) this works + println(depth(nullval[M[Int]])) // (1) this works println(nullval[M[Int]].eval) // (2) this works - + type m = M[Int] - println(depth(nullval[m])) // (3) this doesn't compile on 2.7.RC1 + println(depth(nullval[m])) // (3) this doesn't compile on 2.7.RC1 println(nullval[m].eval) // (4) this works } diff --git a/test/files/pos/t1000.scala b/test/files/pos/t1000.scala index fabef94fff..613af76b94 100644 --- a/test/files/pos/t1000.scala +++ b/test/files/pos/t1000.scala @@ -1,5 +1,5 @@ object A { - println("""This a "raw" string ending with a "double quote"""") + println("""This a "raw" string ending with a "double quote"""") } object Test extends App { diff --git a/test/files/pos/t1035.scala b/test/files/pos/t1035.scala index bd693d9e68..e0a9379c7e 100644 --- a/test/files/pos/t1035.scala +++ b/test/files/pos/t1035.scala @@ -7,7 +7,7 @@ class A { var name:String = _ def getName() = name def this(name:String, age:Int){this();this.name=name} - + } class B(name:String) extends A(name,0){ @@ -18,15 +18,15 @@ class D { object A { def unapply(p:A) = Some(p.getName) } - + object B { def unapply(p:B) = Some(p.getName) } def foo(p:Any) = p match { - case B(n) => println("B") - case A(n) => println("A") - - + case B(n) => println("B") + case A(n) => println("A") + + } } diff --git a/test/files/pos/t1048.scala b/test/files/pos/t1048.scala index ce57e72391..cd16db5b60 100644 --- a/test/files/pos/t1048.scala +++ b/test/files/pos/t1048.scala @@ -1,7 +1,7 @@ trait T[U] { def x: T[V] forSome { type V <: U } } - + object T { def unapply[U](t: T[U]): Option[T[V] forSome { type V <: U }] = Some(t.x) } @@ -12,4 +12,3 @@ object Test { } } - diff --git a/test/files/pos/t1071.scala b/test/files/pos/t1071.scala index 7fb802f8b0..59149a021b 100644 --- a/test/files/pos/t1071.scala +++ b/test/files/pos/t1071.scala @@ -12,6 +12,6 @@ object Test { val c = new C (c: D).a // works - c.a // error + c.a // error } diff --git a/test/files/pos/t1090.scala b/test/files/pos/t1090.scala index dca762af4f..a9bce90b00 100644 --- a/test/files/pos/t1090.scala +++ b/test/files/pos/t1090.scala @@ -10,7 +10,7 @@ object Test { type Node = Core.this.Node } def f(manager : Manager) = manager.iterator.foreach{ - case node : NodeImpl => + case node : NodeImpl => } } } diff --git a/test/files/pos/t1107b/O.scala b/test/files/pos/t1107b/O.scala index aa605a6d09..0198867704 100644 --- a/test/files/pos/t1107b/O.scala +++ b/test/files/pos/t1107b/O.scala @@ -4,10 +4,10 @@ object O case s: Sub => true case _ => false } - + def main(args: Array[String]): Unit = { val c = new AnyRef with C c.bob.toString + c.bob2.toString - } + } } diff --git a/test/files/pos/t1107b/T.scala b/test/files/pos/t1107b/T.scala index 1f3712d529..0dff0b94fd 100644 --- a/test/files/pos/t1107b/T.scala +++ b/test/files/pos/t1107b/T.scala @@ -1,6 +1,6 @@ sealed trait Top sealed trait Sub extends Top -trait C { +trait C { private object P extends Sub def bob() = P.getClass def bob2() = O.d(P) diff --git a/test/files/pos/t1123.scala b/test/files/pos/t1123.scala index a7b009cbbe..3812fa3eb3 100644 --- a/test/files/pos/t1123.scala +++ b/test/files/pos/t1123.scala @@ -7,5 +7,5 @@ object Test { } def f = extraListener.h } - def main(args : Array[String]) : Unit = (new Editor).f + def main(args : Array[String]) : Unit = (new Editor).f } diff --git a/test/files/pos/t1133.scala b/test/files/pos/t1133.scala index 4538de5f5f..562b528ea3 100644 --- a/test/files/pos/t1133.scala +++ b/test/files/pos/t1133.scala @@ -8,21 +8,21 @@ object Match case _ => println("fail") } } - + object Extractor1 { def unapply(x: Any) = x match { case x: String => Some(x, x+x, x+x+x, x+x, x) case _ => None } } - + object Extractor2 { def unapply(x: Any) = x match { case x: String => Some(x, x+x, x+x+x) case _ => None } } - + object Extractor3 { def unapply(x: Any) = x match { case x: String => Some(x, x, x) diff --git a/test/files/pos/t1164.scala b/test/files/pos/t1164.scala index 307ca92c85..ab58c1d6b4 100644 --- a/test/files/pos/t1164.scala +++ b/test/files/pos/t1164.scala @@ -1,29 +1,29 @@ -object test { +object test { - class Foo[a](val arg : a) + class Foo[a](val arg : a) + + object Foo { + def apply [a](arg : a, right :a) = new Foo[a](arg) + def unapply [a](m : Foo[a]) = Some (m.arg) + } - object Foo { - def apply [a](arg : a, right :a) = new Foo[a](arg) - def unapply [a](m : Foo[a]) = Some (m.arg) - } - def matchAndGetArgFromFoo[a]( e:Foo[a]):a = {e match { case Foo(x) => x }} - - + + // Try the same thing as above but use function as argument to Bar // constructor - + type FunIntToA [a] = (Int) => a - class Bar[a] (var f: FunIntToA[a]) - + class Bar[a] (var f: FunIntToA[a]) + object Bar { def apply[a](f: FunIntToA[a]) = new Bar[a](f) def unapply[a](m: Bar[a]) = Some (m.f) } - + def matchAndGetFunFromBar[a](b:Bar[a]) : FunIntToA[a] = { b match { case Bar(x) => x}} - + } diff --git a/test/files/pos/t1168.scala b/test/files/pos/t1168.scala index d9f38714b8..75638e792f 100644 --- a/test/files/pos/t1168.scala +++ b/test/files/pos/t1168.scala @@ -1,5 +1,5 @@ object Test extends App { - + trait SpecialException {} try { diff --git a/test/files/pos/t1210a.scala b/test/files/pos/t1210a.scala index fbb0a611d6..b3492f96e4 100644 --- a/test/files/pos/t1210a.scala +++ b/test/files/pos/t1210a.scala @@ -1,9 +1,9 @@ // both styles of abstraction should behave the same // related to 1210 because that bug broke the OO version below -trait OO { +trait OO { abstract class Test { self => type T - + val v: Test {type T = self.T} = self.v.v } } diff --git a/test/files/pos/t122.scala b/test/files/pos/t122.scala index e3daeef73e..630e24ce4a 100644 --- a/test/files/pos/t122.scala +++ b/test/files/pos/t122.scala @@ -1,4 +1,4 @@ class L { - val List(v:Int, 2) = List(2, v:Int) + val List(v:Int, 2) = List(2, v:Int) val (a:Int, b:Int) = (1, a) } diff --git a/test/files/pos/t1236.scala b/test/files/pos/t1236.scala index 7028162ee0..5e221ce411 100644 --- a/test/files/pos/t1236.scala +++ b/test/files/pos/t1236.scala @@ -1,5 +1,5 @@ trait Empty[E[_]] { - def e[A]: E[A] + def e[A]: E[A] } object T { diff --git a/test/files/pos/t1237.scala b/test/files/pos/t1237.scala index 0d1dd05d50..7777372138 100644 --- a/test/files/pos/t1237.scala +++ b/test/files/pos/t1237.scala @@ -1,11 +1,11 @@ -class HelloWorld { - def main(args: Array[String]) { +class HelloWorld { + def main(args: Array[String]) { object TypeBool; trait Fct { def g(x : Int) = TypeBool // breaks. - + // def g(x : Int) = 3 // fine. } diff --git a/test/files/pos/t1254/t1254.java b/test/files/pos/t1254/t1254.java index 17dc391672..17e1c60bf5 100644 --- a/test/files/pos/t1254/t1254.java +++ b/test/files/pos/t1254/t1254.java @@ -11,7 +11,7 @@ class NothingBug3 { scala.Option<?> o = scala.None$.MODULE$; test(o); - None.toLeft(new scala.runtime.AbstractFunction0<Integer>() { + None.toLeft(new scala.runtime.AbstractFunction0<Integer>() { public Integer apply() { return 0; } }); } diff --git a/test/files/pos/t1263/test.scala b/test/files/pos/t1263/test.scala index 7ced59083a..92d8c1cdfa 100644 --- a/test/files/pos/t1263/test.scala +++ b/test/files/pos/t1263/test.scala @@ -2,7 +2,7 @@ package test trait Map[A, +B] { def plus(key: A): MapTo = new MapTo(key) - + class MapTo(key: A) { def arrow [B1 >: B](value: B1) = null } diff --git a/test/files/pos/t1272.scala b/test/files/pos/t1272.scala index aab1a886c7..d86a909ae5 100644 --- a/test/files/pos/t1272.scala +++ b/test/files/pos/t1272.scala @@ -2,8 +2,8 @@ object ImplicitTest { implicit val i : Int = 10 implicit def a(implicit i : Int) : Array[Byte] = null implicit def b[T](implicit i : Int) : Array[T] = null - + def fn[T](implicit x : T) = 0 - + val x = fn[Array[Byte]] }
\ No newline at end of file diff --git a/test/files/pos/t1292.scala b/test/files/pos/t1292.scala index 3ed153abf2..83a996d530 100644 --- a/test/files/pos/t1292.scala +++ b/test/files/pos/t1292.scala @@ -1,5 +1,5 @@ trait Foo[T <: Foo[T, Enum], Enum <: Enumeration] { - type StV = Enum#Value + type StV = Enum#Value type Meta = MegaFoo[T, Enum] type Slog <: Enumeration diff --git a/test/files/pos/t1318.scala b/test/files/pos/t1318.scala index 3fc6e3060f..f3d2f7ab5a 100644 --- a/test/files/pos/t1318.scala +++ b/test/files/pos/t1318.scala @@ -19,7 +19,7 @@ object A extends A0 {} abstract class B0 extends M { type mType = B0 - def fs: List[fType] = Nil + def fs: List[fType] = Nil } object B extends B0 {} diff --git a/test/files/pos/t1357.scala b/test/files/pos/t1357.scala index 7bc6d45034..fcdecb3ad3 100644 --- a/test/files/pos/t1357.scala +++ b/test/files/pos/t1357.scala @@ -6,7 +6,7 @@ object NonEmptyCons { object Main { type BT[+H, +T <: Tuple2[Tuple2[H, T], Tuple2[H, T]]] = Tuple2[H, T] - + // type T = Tuple2[String,String] type BinaryTree[+E] = BT[E, T forSome { type T <: Tuple2[BT[E, T], BT[E, T]] }] diff --git a/test/files/pos/t1385.scala b/test/files/pos/t1385.scala index 6fe7308281..aefd9c35b3 100644 --- a/test/files/pos/t1385.scala +++ b/test/files/pos/t1385.scala @@ -1,3 +1,3 @@ -object Test extends Serializable { +object Test extends Serializable { private def readResolve: AnyRef = this } diff --git a/test/files/pos/t1480.scala b/test/files/pos/t1480.scala index 3dc3062ca0..1d9f94d2e9 100644 --- a/test/files/pos/t1480.scala +++ b/test/files/pos/t1480.scala @@ -1,6 +1,6 @@ class Foo{ def compare(newP : Any, oldP : Any) : Boolean = (newP,oldP) match { - case (newP : AnyRef, oldP : AnyRef) if newP == oldP => newP == oldP - case (newS : Symbol, oldS: Symbol) if newS == oldS => newS == oldS + case (newP : AnyRef, oldP : AnyRef) if newP == oldP => newP == oldP + case (newS : Symbol, oldS: Symbol) if newS == oldS => newS == oldS } } diff --git a/test/files/pos/t1560.scala b/test/files/pos/t1560.scala index fb5592016a..2af299af86 100644 --- a/test/files/pos/t1560.scala +++ b/test/files/pos/t1560.scala @@ -1,13 +1,13 @@ object Test extends App { - + trait C[T] { def t: T } - + def b: Option[C[x] forSome { type x }] = null - + def c = b match { case Some(b) => b.t } - + } diff --git a/test/files/pos/t1565.scala b/test/files/pos/t1565.scala index 030086c541..df333151d5 100644 --- a/test/files/pos/t1565.scala +++ b/test/files/pos/t1565.scala @@ -3,7 +3,7 @@ object Bug1565 { def x() = { 0; (a : Int, b : Int) => println(List(a, b)) ; 0 } (a : Int, b : Int) => println(List(a, b)) - + // various function syntaxes to exercise the parser val xs = List(1,2,3) xs.filter(x => x < 2) diff --git a/test/files/pos/t1591b.scala b/test/files/pos/t1591b.scala index 84372bb084..c671ad6472 100644 --- a/test/files/pos/t1591b.scala +++ b/test/files/pos/t1591b.scala @@ -1,10 +1,10 @@ import scala.tools.nsc._ -class SemanticTokens(val compiler: Global) { - import compiler._ +class SemanticTokens(val compiler: Global) { + import compiler._ def build() = ErrorType - + class Process { def f() = analyzer // or to crash the compiler instead of a nice message, diff --git a/test/files/pos/t1711/Seq.scala b/test/files/pos/t1711/Seq.scala index 5f426ea0f7..c18f05cd73 100644 --- a/test/files/pos/t1711/Seq.scala +++ b/test/files/pos/t1711/Seq.scala @@ -3,7 +3,7 @@ package com object Sequence { def filteringFunction[V](filter: V => Boolean): List[V] => List[V] = { - def include(v: V) = + def include(v: V) = filter(v) (l: List[V]) => l.filter(include) } diff --git a/test/files/pos/t1722-A.scala b/test/files/pos/t1722-A.scala index 9e522a5059..d059bf22f8 100644 --- a/test/files/pos/t1722-A.scala +++ b/test/files/pos/t1722-A.scala @@ -1,8 +1,8 @@ sealed trait Top trait C { private object P extends Top -} -/* +} +/* $ scala -e 'new AnyRef with C' error: error while loading Top, class file '/private/tmp/bobobo/./Top.class' is broken (error reading Scala signature of /private/tmp/bobobo/./Top.class: malformed Scala signature of Top at 185; reference value P of trait C refers to nonexisting symbol.) diff --git a/test/files/pos/t1722/Test.scala b/test/files/pos/t1722/Test.scala index 5685d8f40a..f236d3fdc4 100755 --- a/test/files/pos/t1722/Test.scala +++ b/test/files/pos/t1722/Test.scala @@ -1,5 +1,5 @@ package t1722 object Test { - val x = new AnyRef with C + val x = new AnyRef with C } diff --git a/test/files/pos/t1722/Top.scala b/test/files/pos/t1722/Top.scala index cec4c531f9..4ac52412aa 100755 --- a/test/files/pos/t1722/Top.scala +++ b/test/files/pos/t1722/Top.scala @@ -3,8 +3,8 @@ package t1722 sealed trait Top trait C { private object P extends Top -} -/* +} +/* $ scala -e 'new AnyRef with C' error: error while loading Top, class file '/private/tmp/bobobo/./Top.class' is broken (error reading Scala signature of /private/tmp/bobobo/./Top.class: malformed Scala signature of Top at 185; reference value P of trait C refers to nonexisting symbol.) diff --git a/test/files/pos/t1745/J.java b/test/files/pos/t1745/J.java index d95efe8e6f..8444eabb24 100644 --- a/test/files/pos/t1745/J.java +++ b/test/files/pos/t1745/J.java @@ -1,9 +1,9 @@ -class J { +class J { S1 s1; S2 s2; - + String s = bar(S3.foo(), S3.bar("def")); - + private String bar(String s1, String s2) { return s1 + s2; } diff --git a/test/files/pos/t1756.scala b/test/files/pos/t1756.scala index 2e09c8a94a..1d067c3b04 100755 --- a/test/files/pos/t1756.scala +++ b/test/files/pos/t1756.scala @@ -1,5 +1,5 @@ -/** +/** This is a tricky issue which has to do with the fact that too much conflicting type information is propagated into a single implicit search, where the intended solution applies two implicit searches. @@ -35,20 +35,20 @@ class Poly[C <: Ring[C]](val c: C) extends Ring[Poly[C]] { } object Test extends App { - + implicit def coef2poly[C <: Ring[C]](c: C): Poly[C] = new Poly(c) val a = new A val x = new Poly(new A) - + println(x+a) // works println(a+x) // works - + val y = new Poly(new Poly(new A)) - + println(x+y*x) // works println(x*y+x) // works println(y*x+x) // works - + println(x+x*y) // failed before } diff --git a/test/files/pos/t1798.scala b/test/files/pos/t1798.scala index 93df61e844..1624e3025e 100644 --- a/test/files/pos/t1798.scala +++ b/test/files/pos/t1798.scala @@ -2,7 +2,7 @@ object Foo { private def bar(): Int = 55 } class Foo(x: Int) { def this() = this(Foo.bar()) } /* - * scalac28 a.scala + * scalac28 a.scala a.scala:2: error: method bar cannot be accessed in object Foo class Foo(x: Int) { def this() = this(Foo.bar()) } ^ diff --git a/test/files/pos/t1832.scala b/test/files/pos/t1832.scala index c7b1ffb838..f3bb556e32 100644 --- a/test/files/pos/t1832.scala +++ b/test/files/pos/t1832.scala @@ -1,7 +1,7 @@ trait Cloning { trait Foo def fn(g: Any => Unit): Foo - + implicit def mkStar(i: Int) = new { def *(a: Foo): Foo = null } val pool = 4 * fn { case ghostSYMBOL: Int => ghostSYMBOL * 2 } diff --git a/test/files/pos/t1840/J.java b/test/files/pos/t1840/J.java index a697596fdd..fd98b6c4a5 100644 --- a/test/files/pos/t1840/J.java +++ b/test/files/pos/t1840/J.java @@ -1,4 +1,4 @@ package p; -class J { - J() {} +class J { + J() {} } diff --git a/test/files/pos/t1974.scala b/test/files/pos/t1974.scala index 3d28478177..a0daa13c21 100644 --- a/test/files/pos/t1974.scala +++ b/test/files/pos/t1974.scala @@ -1,20 +1,20 @@ object Broken { private var map = Map[Class[_], String]() - + def addToMap(c : Class[_], s : String) = map += (c -> s) def fetch(c : Class[_]) = map(c) } object Works { private var map = Map[Class[_], String]() - + def addToMap(c : Class[_], s : String) = map += ((c, s)) def fetch(c : Class[_]) = map(c) } object Works2 { private var map = Map[Class[_], String]() - + def addToMap(c : Class[_], s : String) = map += ((c : Class[_]) -> s) def fetch(c : Class[_]) = map(c) }
\ No newline at end of file diff --git a/test/files/pos/t2023.scala b/test/files/pos/t2023.scala index de3e848fbd..21c6fc96a6 100644 --- a/test/files/pos/t2023.scala +++ b/test/files/pos/t2023.scala @@ -3,11 +3,11 @@ trait C[A] object C { implicit def ipl[A](implicit from: A => Ordered[A]): C[A] = null } - + object P { def foo[A](i: A, j: A)(implicit c: C[A]): Unit = () } - + class ImplicitChainTest { def testTrivial: Unit = { P.foo('0', '9') diff --git a/test/files/pos/t2060.scala b/test/files/pos/t2060.scala index cf7250f545..2c701150e4 100755 --- a/test/files/pos/t2060.scala +++ b/test/files/pos/t2060.scala @@ -4,7 +4,7 @@ * line': * * val failure = 1.0 + new Op[Int] - * + * * we reduce the problem to finding a function from Double to * {+: _ >: Op[Int] <: Any}, that is, a method which takes * an argument which is an Op[Int] or a supertype thereof. diff --git a/test/files/pos/t2081.scala b/test/files/pos/t2081.scala index f4f21600c6..395134f71c 100644 --- a/test/files/pos/t2081.scala +++ b/test/files/pos/t2081.scala @@ -7,5 +7,5 @@ object ScalaForRubyists { val x = 10.days // a couple parser corner cases I wanted not to break - val y = 5.0e0 + 5e7 + val y = 5.0e0 + 5e7 } diff --git a/test/files/pos/t2082.scala b/test/files/pos/t2082.scala index 38937d78fb..3a160612fe 100755 --- a/test/files/pos/t2082.scala +++ b/test/files/pos/t2082.scala @@ -1,10 +1,10 @@ trait Mapper[T <: Mapper[T]] -trait KeyedMapper[KeyType, T <: KeyedMapper[KeyType, T]] extends Mapper[T] +trait KeyedMapper[KeyType, T <: KeyedMapper[KeyType, T]] extends Mapper[T] -trait KeyedMetaMapper[KeyType, T <: KeyedMapper[KeyType, T]] +trait KeyedMetaMapper[KeyType, T <: KeyedMapper[KeyType, T]] trait MappedForeignKey[KeyType, Owner <: Mapper[Owner], Other <: KeyedMapper[KeyType, Other]] @@ -19,19 +19,19 @@ class TestRun extends KeyedMapper[Long, TestRun] with IdPK { object TestRun extends TestRun with KeyedMetaMapper[Long, TestRun] class MetaTestSubject extends TestSubject with KeyedMetaMapper[Long, TestSubject] -object TestSubject extends MetaTestSubject +object TestSubject extends MetaTestSubject object Main { - + def oneToOneJoin[PType <: KeyedMapper[Long, PType] with IdPK, CType <: KeyedMapper[Long, CType] with IdPK, - CMetaType <: CType with KeyedMetaMapper[Long, CType], + CMetaType <: CType with KeyedMetaMapper[Long, CType], FKType <: MappedForeignKey[Long, PType, CType]] - (parents: List[PType], metaMapper: CMetaType, keyGetter: (PType) => FKType ): + (parents: List[PType], metaMapper: CMetaType, keyGetter: (PType) => FKType ): Map[Long, CType] = Map.empty - + def callIt { - oneToOneJoin[TestRun, TestSubject, MetaTestSubject, + oneToOneJoin[TestRun, TestSubject, MetaTestSubject, MappedForeignKey[Long, TestRun, TestSubject]]( List(), TestSubject, (tr: TestRun) => tr.testSubject) } diff --git a/test/files/pos/t2130-2.scala b/test/files/pos/t2130-2.scala index 464f5e0d8e..1d0b33c3e5 100644 --- a/test/files/pos/t2130-2.scala +++ b/test/files/pos/t2130-2.scala @@ -10,7 +10,7 @@ package object bar { class Dingus object Dingus case class Dongus(x: Float) - + def apply(xs: Int*) = new Bippy(xs.sum) def apply() = new Bippy(5) } diff --git a/test/files/pos/t2133.scala b/test/files/pos/t2133.scala index 99bac5c38b..c74d0a4bbf 100644 --- a/test/files/pos/t2133.scala +++ b/test/files/pos/t2133.scala @@ -13,6 +13,6 @@ trait Foo2 { class Bob extends AnyRef with Foo with Foo2 { import bip._ import bar._ - + def go() = fn() } diff --git a/test/files/pos/t2168.scala b/test/files/pos/t2168.scala index 845c5b7361..21afb239a0 100644 --- a/test/files/pos/t2168.scala +++ b/test/files/pos/t2168.scala @@ -2,5 +2,3 @@ object Test extends App { def foo1(x: AnyRef) = x match { case x: Function0[_] => x() } def foo2(x: AnyRef) = x match { case x: Function0[Any] => x() } } - - diff --git a/test/files/pos/t2171.scala b/test/files/pos/t2171.scala index a5663c96cd..6c754c76a6 100644 --- a/test/files/pos/t2171.scala +++ b/test/files/pos/t2171.scala @@ -3,5 +3,5 @@ final object test { try 0 catch { case ex => println(msg) } def main (args: Array[String]): Unit = - while (true) logIgnoredException ("...") + while (true) logIgnoredException ("...") } diff --git a/test/files/pos/t2261.scala b/test/files/pos/t2261.scala index af24234235..aac5c9e0fd 100644 --- a/test/files/pos/t2261.scala +++ b/test/files/pos/t2261.scala @@ -5,5 +5,5 @@ object Test { x = List(1,2,3) // the problem here was that somehow the type variable that was used to infer the type argument for List.apply // would accumulate several conflicting constraints - // can't reproduce with + // can't reproduce with }
\ No newline at end of file diff --git a/test/files/pos/t2305.scala b/test/files/pos/t2305.scala index d0b103fdba..6b66c5db13 100644 --- a/test/files/pos/t2305.scala +++ b/test/files/pos/t2305.scala @@ -1,6 +1,6 @@ import java.util.ArrayList -trait Bind[Z[_]] +trait Bind[Z[_]] class MySerializable[X] extends java.io.Serializable @@ -17,7 +17,7 @@ object works { object breaks { def runbind(implicit bind: Bind[ArrayList]) {} - runbind + runbind /*java.lang.AssertionError: assertion failed: java.io.Serializable at scala.Predef$.assert(Predef.scala:107) at scala.tools.nsc.symtab.Types$TypeRef.transform(Types.scala:1417) diff --git a/test/files/pos/t2310.scala b/test/files/pos/t2310.scala index e08411a3df..68912b4961 100644 --- a/test/files/pos/t2310.scala +++ b/test/files/pos/t2310.scala @@ -1,15 +1,15 @@ import scala.Stream._ object consistencyError { - /* this gives an error: + /* this gives an error: Consistency problem compiling (virtual file)! Trying to call method body%1(List(scala.collection.immutable.Stream[A])) with arguments (List(tp2, temp6, temp5)) case (l #:: ls, rs) => None ^ scala.tools.nsc.symtab.Types$TypeError: too many arguments for method body%1: (val rs: scala.collection.immutable.Stream[A])None.type - + two errors found - vss(0) = + vss(0) = args = List(tp2, temp6, temp5) vss(1) = value rs, value ls, value l args = List(tp2, temp6, temp5) @@ -18,19 +18,19 @@ object consistencyError { labels(1) = method body%1 labels(0) = method body%0 bx = 1 - label.tpe = (val rs: scala.collection.immutable.Stream[A])None.type + label.tpe = (val rs: scala.collection.immutable.Stream[A])None.type */ def crash[A](lefts: Stream[A], rights: Stream[A]) = (lefts, rights) match { case (Stream.Empty, Stream.Empty) => None case (l #:: ls, rs) => None } - + // These work // def works1[A](lefts: Stream[A]) = lefts match { // case Stream.Empty => None // case l #:: ls => None // } - // + // // def works2[A](lefts: Stream[A], rights: Stream[A]) = (lefts, rights) match { // case (Stream.Empty, Stream.Empty) => None // case (ls, rs) => None diff --git a/test/files/pos/t2399.scala b/test/files/pos/t2399.scala index b009f7856b..07882dd549 100644 --- a/test/files/pos/t2399.scala +++ b/test/files/pos/t2399.scala @@ -3,12 +3,12 @@ trait That2[A, R <: That2[A, R]] trait T[A, This >: Null <: That1[A] with T[A, This]] extends That2[A, This] { self: This => - + private var next: This = _ def isEmpty = next eq null - + def length: Int = { def loop(x: This, cnt: Int): Int = if (x.isEmpty) cnt else loop(x.next, cnt + 1) loop(self, 0) - } + } }
\ No newline at end of file diff --git a/test/files/pos/t2413/TestScalac.scala b/test/files/pos/t2413/TestScalac.scala index 6992a30f2c..098e852dd7 100644 --- a/test/files/pos/t2413/TestScalac.scala +++ b/test/files/pos/t2413/TestScalac.scala @@ -4,7 +4,7 @@ class Foo extends TestJava { // THIS METHOD YIELDS TO CRASH /* def foomethod : Option[String] => Unit = { - case None => + case None => val path = repeatParam("s","a","b","c") () case Some(error) => diff --git a/test/files/pos/t2421_delitedsl.scala b/test/files/pos/t2421_delitedsl.scala index ad6afa7bd8..a05887023a 100644 --- a/test/files/pos/t2421_delitedsl.scala +++ b/test/files/pos/t2421_delitedsl.scala @@ -1,10 +1,10 @@ trait DeliteDSL { abstract class <~<[-From, +To] extends (From => To) - implicit def trivial[A]: A <~< A = new (A <~< A) {def apply(x: A) = x} + implicit def trivial[A]: A <~< A = new (A <~< A) {def apply(x: A) = x} trait Forcible[T] object Forcible { - def factory[T](f: T => Forcible[T]) = new (T <~< Forcible[T]){def apply(x: T) = f(x)} + def factory[T](f: T => Forcible[T]) = new (T <~< Forcible[T]){def apply(x: T) = f(x)} } case class DeliteInt(x: Int) extends Forcible[Int] @@ -22,16 +22,16 @@ trait DeliteDSL { // If T is already a proxy (it is forcible), the compiler should use // forcibleIdentity to deduce that P=T. If T is Int, the compiler // should use intToForcible to deduce that P=DeliteInt. - // + // // Without this feature, the user must write 'xs.proxyOfFirst[DeliteInt]', // with the feature they can write 'xs.proxyOfFirst', which is shorter and // avoids exposing internal DELITE types to the world. object Test { - val x = new DeliteCollection(List(1,2,3)).headProxy + val x = new DeliteCollection(List(1,2,3)).headProxy // inferred: val x: Forcible[Int] = new DeliteCollection[Int](List.apply[Int](1, 2, 3)).headProxy[Forcible[Int]](forcibleInt); - val xAlready = new DeliteCollection(List(DeliteInt(1),DeliteInt(2),DeliteInt(3))).headProxy + val xAlready = new DeliteCollection(List(DeliteInt(1),DeliteInt(2),DeliteInt(3))).headProxy // inferred: val xAlready: DeliteInt = new DeliteCollection[DeliteInt](List.apply[DeliteInt](DeliteInt(1), DeliteInt(2), DeliteInt(3))).headProxy[DeliteInt](trivial[DeliteInt]); } }
\ No newline at end of file diff --git a/test/files/pos/t2435.scala b/test/files/pos/t2435.scala index 2db931b99f..697e9e1f2d 100644 --- a/test/files/pos/t2435.scala +++ b/test/files/pos/t2435.scala @@ -9,7 +9,7 @@ object Bug { case class FConstant[E <: FChain](constant:String, tail:E) extends FChain { type T = tail.T } - + object FNil extends FChain { type T = Unit } diff --git a/test/files/pos/t2444.scala b/test/files/pos/t2444.scala index a052270196..fac1e95d0f 100644 --- a/test/files/pos/t2444.scala +++ b/test/files/pos/t2444.scala @@ -2,14 +2,14 @@ object Test { trait Foo - class Bar { + class Bar { object baz extends Foo } - def frob[P1, P2<:Foo](f:P1 => P2) = () + def frob[P1, P2<:Foo](f:P1 => P2) = () def main(args:Array[String]) : Unit = { - frob((p:Bar) => p.baz) + frob((p:Bar) => p.baz) } } diff --git a/test/files/pos/t2464/ScalaOne_1.scala b/test/files/pos/t2464/ScalaOne_1.scala index 0271b9ce72..1caf8ecae4 100644 --- a/test/files/pos/t2464/ScalaOne_1.scala +++ b/test/files/pos/t2464/ScalaOne_1.scala @@ -1,6 +1,6 @@ class ScalaClassOne extends ClassTwo.Child { def func4() = { func2 - } + } } diff --git a/test/files/pos/t247.scala b/test/files/pos/t247.scala index 983b7998a9..e976404e61 100644 --- a/test/files/pos/t247.scala +++ b/test/files/pos/t247.scala @@ -12,7 +12,7 @@ class TreeMapFactory[KEY](newOrder:Order[KEY]) extends MapFactory[KEY] { def Empty[V] = new TreeMap[KEY,V](new TreeMapFactory[KEY](order)); } -class Tree[KEY,Entry](order:Order[KEY]) { +class Tree[KEY,Entry](order:Order[KEY]) { def size =0; } diff --git a/test/files/pos/t2504.scala b/test/files/pos/t2504.scala index 0abe7dd13e..67f8226852 100755 --- a/test/files/pos/t2504.scala +++ b/test/files/pos/t2504.scala @@ -1,5 +1,5 @@ object Test { val ys: Iterable[_] = Array("abc") - val xs = Array("abc") + val xs = Array("abc") xs sameElements Array("abc") } diff --git a/test/files/pos/t2545.scala b/test/files/pos/t2545.scala index b4238fb718..6ad994223c 100755 --- a/test/files/pos/t2545.scala +++ b/test/files/pos/t2545.scala @@ -1,6 +1,6 @@ trait Frog[T] { - def hello: T - def size: Int + def hello: T + def size: Int } trait OnlyWithFrogs { diff --git a/test/files/pos/t2569/Child.scala b/test/files/pos/t2569/Child.scala index 3d7f4248b5..64f4dc172f 100644 --- a/test/files/pos/t2569/Child.scala +++ b/test/files/pos/t2569/Child.scala @@ -1,9 +1,9 @@ package varargs - + class Child extends Parent { - + override def concatenate(strings: String*): String = strings map("\"" + _ + "\"") mkString("(", ", ", ")") - + } diff --git a/test/files/pos/t2569/Parent.java b/test/files/pos/t2569/Parent.java index 133f2ee567..89421becbd 100644 --- a/test/files/pos/t2569/Parent.java +++ b/test/files/pos/t2569/Parent.java @@ -1,7 +1,7 @@ package varargs; - + public class Parent { - + public String concatenate(String... strings) { StringBuilder builder = new StringBuilder(); for (String s : strings) { @@ -9,5 +9,5 @@ package varargs; } return builder.toString(); } - + } diff --git a/test/files/pos/t262.scala b/test/files/pos/t262.scala index b81490977c..ec6187b36b 100644 --- a/test/files/pos/t262.scala +++ b/test/files/pos/t262.scala @@ -1,11 +1,11 @@ object O { abstract class A { - def f:A; + def f:A; } class B extends A { def f = if(1 == 2) new C else new D; } - class C extends A { + class C extends A { def f = this; } class D extends A { diff --git a/test/files/pos/t2665.scala b/test/files/pos/t2665.scala index 108daf509a..3163e31326 100644 --- a/test/files/pos/t2665.scala +++ b/test/files/pos/t2665.scala @@ -1,3 +1,3 @@ object Test { - val x: Unit = Array("") + val x: Unit = Array("") }
\ No newline at end of file diff --git a/test/files/pos/t2669.scala b/test/files/pos/t2669.scala index e34f08f0f5..72e931178c 100644 --- a/test/files/pos/t2669.scala +++ b/test/files/pos/t2669.scala @@ -23,6 +23,6 @@ import java.util.Vector // scalac cannot detect lack of type params, but then throws AssertionError later: class TVector2639 { - val b = new Vector // this line passed without error detected + val b = new Vector // this line passed without error detected val a = new Vector(1) // this line caused throwing AssertionError when scalac } diff --git a/test/files/pos/t2691.scala b/test/files/pos/t2691.scala index 94012a8177..5f0ddd122f 100644 --- a/test/files/pos/t2691.scala +++ b/test/files/pos/t2691.scala @@ -1,5 +1,5 @@ object Breakdown { - def unapplySeq(x: Int): Some[List[String]] = Some(List("", "there")) + def unapplySeq(x: Int): Some[List[String]] = Some(List("", "there")) } object Test { 42 match { diff --git a/test/files/pos/t2726/SQLBuilder_1.scala b/test/files/pos/t2726/SQLBuilder_1.scala index 7b3e3d8322..8d07a88265 100644 --- a/test/files/pos/t2726/SQLBuilder_1.scala +++ b/test/files/pos/t2726/SQLBuilder_1.scala @@ -1,7 +1,7 @@ class SQLBuilder extends SQLBuilder.Segment -object SQLBuilder { - trait Segment +object SQLBuilder { + trait Segment } diff --git a/test/files/pos/t2910.scala b/test/files/pos/t2910.scala index 17a6a64809..d4d92fa765 100644 --- a/test/files/pos/t2910.scala +++ b/test/files/pos/t2910.scala @@ -9,9 +9,9 @@ object Test { lazy val s = "abc" } - def test3 { + def test3 { lazy val lazyBar = bar - object bar { + object bar { val foo = 12 } lazy val lazyBar2 = bar @@ -29,5 +29,5 @@ object Test { lazy val f: Int = g Console.println("foo") lazy val g: Int = f - } + } }
\ No newline at end of file diff --git a/test/files/pos/t2913.scala b/test/files/pos/t2913.scala index ee86b9e402..11d8b92053 100755 --- a/test/files/pos/t2913.scala +++ b/test/files/pos/t2913.scala @@ -11,13 +11,13 @@ class RichA { object Test { implicit def AToRichA(a: A) = new RichA - + val a = new A a.foo() a.foo(1) a.foo("") // Without implicits, a type error regarding invalid argument types is generated at `""`. This is - // the same position as an argument, so the 'second try' typing with an Implicit View is tried, + // the same position as an argument, so the 'second try' typing with an Implicit View is tried, // and AToRichA(a).foo("") is found. // // My reading of the spec "7.3 Views" is that `a.foo` denotes a member of `a`, so the view should @@ -48,6 +48,6 @@ object Main { val fn = (a : Int, str : String) => "a: " + a + ", str: " + str implicit def fx[T](f : (T,String) => String) = (x:T) => f(x,null) println(fn(1)) - () + () } } diff --git a/test/files/pos/t2939.scala b/test/files/pos/t2939.scala index 67677f2f18..3be4d4d561 100644 --- a/test/files/pos/t2939.scala +++ b/test/files/pos/t2939.scala @@ -4,10 +4,10 @@ object Proxies { class C1 extends MapProxy[Int,Int] { def self = Map[Int,Int]() } class C2 extends mutable.MapProxy[Int,Int] { def self = mutable.Map[Int,Int]() } class C3 extends immutable.MapProxy[Int,Int] { def self = immutable.Map[Int,Int]() } - + class C4 extends SetProxy[Int] { def self = Set[Int]() } class C5 extends mutable.SetProxy[Int] { def self = mutable.Set[Int]() } class C6 extends immutable.SetProxy[Int] { def self = immutable.Set[Int]() } - + class C7 extends SeqProxy[Int] { def self = Seq[Int]() } }
\ No newline at end of file diff --git a/test/files/pos/t2940/Error.scala b/test/files/pos/t2940/Error.scala index 7c600667f3..bf5a6bd0df 100644 --- a/test/files/pos/t2940/Error.scala +++ b/test/files/pos/t2940/Error.scala @@ -5,8 +5,8 @@ abstract class Error { object Test { trait Quux[T] extends Cycle[Quux[T]] val x = new Quux[Int] { def doStuff() { } } - + def main(args: Array[String]): Unit = { - + } } diff --git a/test/files/pos/t2994a.scala b/test/files/pos/t2994a.scala index f2d57c34ca..cb4a389e2f 100644 --- a/test/files/pos/t2994a.scala +++ b/test/files/pos/t2994a.scala @@ -17,8 +17,8 @@ object Naturals { type _5 = SUCC[_4] type _6 = SUCC[_5] - - // crashes scala-2.8.0 beta1 + + // crashes scala-2.8.0 beta1 trait MUL[n <: NAT, m <: NAT] extends NAT { trait curry[n[_[_], _], s[_]] { type f[z <: NAT] = n[s, z] } type a[s[_ <: NAT] <: NAT, z <: NAT] = n#a[curry[m#a, s]#f, z] diff --git a/test/files/pos/t3020.scala b/test/files/pos/t3020.scala index cb429cd94f..016563e27f 100644 --- a/test/files/pos/t3020.scala +++ b/test/files/pos/t3020.scala @@ -1,7 +1,7 @@ object Test { def main(args: Array[String]): Unit = { var x = true - + ( { if (x) new scala.util.Random() } .asInstanceOf[Runnable] ) } } diff --git a/test/files/pos/t3079.scala b/test/files/pos/t3079.scala index 4bead34ff3..fa732ea516 100644 --- a/test/files/pos/t3079.scala +++ b/test/files/pos/t3079.scala @@ -10,8 +10,8 @@ object Coerce { def IdentityCoerce[B] = new Coerce[Identity[B], B] { // java.lang.Error: A in trait Identity cannot be instantiated from ?x$1.type def unwrap = _.value - + // Providing the type of _ works around the problem. - //def unwrap = (_: Identity[B]).value + //def unwrap = (_: Identity[B]).value } }
\ No newline at end of file diff --git a/test/files/pos/t3106.scala b/test/files/pos/t3106.scala index cf7b507126..162e93366f 100644 --- a/test/files/pos/t3106.scala +++ b/test/files/pos/t3106.scala @@ -3,5 +3,5 @@ class Sample[A] (val d0: ((A,A)) => A) {} object Sample { implicit def apply[A] (x:A): Sample[A] = { new Sample(p => p._1) - } + } }
\ No newline at end of file diff --git a/test/files/pos/t3136.scala b/test/files/pos/t3136.scala index 6a5850aeb0..33d42c2f3c 100644 --- a/test/files/pos/t3136.scala +++ b/test/files/pos/t3136.scala @@ -11,7 +11,7 @@ object NullaryMethodType { } object Test { - def TEST(tp: Type): String = + def TEST(tp: Type): String = tp match { case PolyType(ps1, PolyType(ps2, res @ PolyType(a, b))) => "1"+tp // couldn't find a simpler version that still crashes case NullaryMethodType(meh) => "2"+meh diff --git a/test/files/pos/t3174b.scala b/test/files/pos/t3174b.scala index 002c4f090f..4df1bfe837 100755 --- a/test/files/pos/t3174b.scala +++ b/test/files/pos/t3174b.scala @@ -2,9 +2,9 @@ trait Foo[X] { def foo : Map[String,Foo[X]] } object Test { def f[T]() : Foo[T] = { - class Anon extends Foo[T] { - var foo: Map[String, Foo[T]] = Map[String,Foo[T]]() - //def foo = Map[String,Foo[T]]() + class Anon extends Foo[T] { + var foo: Map[String, Foo[T]] = Map[String,Foo[T]]() + //def foo = Map[String,Foo[T]]() //def foo_=(x: Map[String,Foo[T]]) {} } new Anon diff --git a/test/files/pos/t3175-pos.scala b/test/files/pos/t3175-pos.scala index 497ff8255c..89bbf8b5fc 100644 --- a/test/files/pos/t3175-pos.scala +++ b/test/files/pos/t3175-pos.scala @@ -1,7 +1,7 @@ object Test { - def f(g:{val update:Unit}) = g.update - + def f(g:{val update:Unit}) = g.update + def main(args: Array[String]): Unit = { - + } } diff --git a/test/files/pos/t3177.scala b/test/files/pos/t3177.scala index 21893c9422..9f9528faec 100644 --- a/test/files/pos/t3177.scala +++ b/test/files/pos/t3177.scala @@ -1,17 +1,17 @@ trait InvariantFunctor[F[_]] { def xmap[A, B](ma: F[A], f: A => B, g: B => A): F[B] } - + object InvariantFunctor { import Endo._ - + implicit val EndoInvariantFunctor = new InvariantFunctor[Endo] { - def xmap[A, B](ma: Endo[A], f: A => B, g: B => A): Endo[B] = (b: B) => f(ma(g(b))) + def xmap[A, B](ma: Endo[A], f: A => B, g: B => A): Endo[B] = (b: B) => f(ma(g(b))) } - + // The definition about fails with: // anon-type.scala:9: error: not found: value b - // def xmap[A, B](ma: Endo[A], f: A => B, g: B => A): Endo[B] = (b: B) => f(ma(g(b))) + // def xmap[A, B](ma: Endo[A], f: A => B, g: B => A): Endo[B] = (b: B) => f(ma(g(b))) // ^ // anon-type.scala:8: error: not found: type $anon // implicit val EndoInvariantFunctor = new InvariantFunctor[Endo] { @@ -20,9 +20,9 @@ object InvariantFunctor { // These both work: // implicit val EndoInvariantFunctorAscribed: InvariantFunctor[Endo] = new InvariantFunctor[Endo] { - // def xmap[A, B](ma: Endo[A], f: A => B, g: B => A): Endo[B] = (b: B) => f(ma(g(b))) + // def xmap[A, B](ma: Endo[A], f: A => B, g: B => A): Endo[B] = (b: B) => f(ma(g(b))) // } - // + // // implicit val EndoInvariantFunctorStubbed = new InvariantFunctor[Endo] { // def xmap[A, B](ma: Endo[A], f: A => B, g: B => A): Endo[B] = error("stub") // } diff --git a/test/files/pos/t3274.scala b/test/files/pos/t3274.scala index dfa6a4ec01..15723184bb 100644 --- a/test/files/pos/t3274.scala +++ b/test/files/pos/t3274.scala @@ -1,7 +1,7 @@ -trait A { this: B => - trait X { +trait A { this: B => + trait X { class Y1 extends Y - } + } } trait B extends A { diff --git a/test/files/pos/t3312.scala b/test/files/pos/t3312.scala index 9bf3e23ed3..aef965d2e7 100644 --- a/test/files/pos/t3312.scala +++ b/test/files/pos/t3312.scala @@ -12,6 +12,6 @@ trait B extends Root { object Foo extends A with B { override def say: String = foo(super[A].say) - + def foo(p: => String): String = p } diff --git a/test/files/pos/t3349/AbstractTupleSet.java b/test/files/pos/t3349/AbstractTupleSet.java index 47b440a589..38e4743ef4 100644 --- a/test/files/pos/t3349/AbstractTupleSet.java +++ b/test/files/pos/t3349/AbstractTupleSet.java @@ -5,5 +5,5 @@ public abstract class AbstractTupleSet implements TupleSet { public void addColumn(String name, String expr) { throw new UnsupportedOperationException(); - } + } } diff --git a/test/files/pos/t3411.scala b/test/files/pos/t3411.scala index b76fec66a6..b58e52db8d 100644 --- a/test/files/pos/t3411.scala +++ b/test/files/pos/t3411.scala @@ -1,6 +1,6 @@ object A { def g(c: PartialFunction[Any,Unit]) {} - + def f { lazy val x = 0 g { case `x` => } diff --git a/test/files/pos/t3429/A.scala b/test/files/pos/t3429/A.scala index 4b705808c1..80785db51d 100644 --- a/test/files/pos/t3429/A.scala +++ b/test/files/pos/t3429/A.scala @@ -2,8 +2,8 @@ class A { @Test(exc = classOf[Exception]) def myTestMethod = 0 } -// rytz@chara:~/scala/trunk/sandbox$ javac Test.java -// rytz@chara:~/scala/trunk/sandbox$ ../build/pack/bin/scalac A.scala +// rytz@chara:~/scala/trunk/sandbox$ javac Test.java +// rytz@chara:~/scala/trunk/sandbox$ ../build/pack/bin/scalac A.scala // A.scala:2: error: type mismatch; // found : java.lang.Class[Exception](classOf[java.lang.Exception]) // required: java.lang.Class diff --git a/test/files/pos/t3430.scala b/test/files/pos/t3430.scala index 4990abb2a1..3129c6276a 100644 --- a/test/files/pos/t3430.scala +++ b/test/files/pos/t3430.scala @@ -1,6 +1,6 @@ // package com.example -object A { +object A { def f1(f: String => Boolean) = f("a") def f2(): Boolean = diff --git a/test/files/pos/t3521/DoubleValue.java b/test/files/pos/t3521/DoubleValue.java index 28f05cd972..e8c093890b 100644 --- a/test/files/pos/t3521/DoubleValue.java +++ b/test/files/pos/t3521/DoubleValue.java @@ -4,4 +4,4 @@ import java.lang.annotation.*; @Target(ElementType.FIELD) public @interface DoubleValue { double value(); -}
\ No newline at end of file +}
\ No newline at end of file diff --git a/test/files/pos/t3528.scala b/test/files/pos/t3528.scala index b1c4344731..ff49b3e929 100644 --- a/test/files/pos/t3528.scala +++ b/test/files/pos/t3528.scala @@ -4,5 +4,5 @@ class A { // 3528 comments def f2 = List(Set(1,2,3), List(1,2,3)) // 2322 - def f3 = List(null: Range, null: List[Int]) + def f3 = List(null: Range, null: List[Int]) } diff --git a/test/files/pos/t3568.scala b/test/files/pos/t3568.scala index 0f26e2fad3..c8e3fcc4be 100755 --- a/test/files/pos/t3568.scala +++ b/test/files/pos/t3568.scala @@ -14,7 +14,7 @@ package buffer { // ArrayVec2 can be compiled, instantiated and used. def main(args: Array[String]) { println(works) } } - + trait ElemType { type Element; type Component <: ElemType } trait Float1 extends ElemType { type Element = Float; type Component = Float1} class Vec2 extends ElemType { type Element = Vec2; type Component = Float1 } diff --git a/test/files/pos/t3578.scala b/test/files/pos/t3578.scala index 306cde811b..d984118208 100644 --- a/test/files/pos/t3578.scala +++ b/test/files/pos/t3578.scala @@ -24,7 +24,7 @@ object Test { case class JInt(num: BigInt) extends JValue case class JBool(value: Boolean) extends JValue case class JField(name: String, value: JValue) extends JValue - case class JObject(obj: List[JField]) extends JValue + case class JObject(obj: List[JField]) extends JValue case class JArray(arr: List[JValue]) extends JValue } diff --git a/test/files/pos/t3582.scala b/test/files/pos/t3582.scala index e20af5e61d..0ac112efbf 100644 --- a/test/files/pos/t3582.scala +++ b/test/files/pos/t3582.scala @@ -6,7 +6,7 @@ object Test { // [[syntax trees at end of typer]] // abstract trait C#5[A#9116 >: Nothing#5832 <: Any#52] extends scala#33.AnyRef#2780; // final object Test#15 extends java.lang.Object#2485 with ScalaObject#1913 { -// def ImplicitParamCA#9123[CC#9124[A#10858 >: Nothing#5832 <: Any#52] >: [A#10858]Nothing#5832 <: [A#10858]Any#52, +// def ImplicitParamCA#9123[CC#9124[A#10858 >: Nothing#5832 <: Any#52] >: [A#10858]Nothing#5832 <: [A#10858]Any#52, // A#9125 >: Nothing#5832 <: Any#52](implicit ev#10856: C#5[A#9127]): Unit#3818 // = scala#34.this.Predef#1683.implicitly#8816[C#5[A#10858]]() // } diff --git a/test/files/pos/t3636.scala b/test/files/pos/t3636.scala index dbfc7a2c94..24d18c653d 100644 --- a/test/files/pos/t3636.scala +++ b/test/files/pos/t3636.scala @@ -5,11 +5,11 @@ class CTxnLocal[ T ] { } trait Txn - + trait ProcTxn { def ccstm: Txn } - + trait TxnLocal[ @specialized T ] { def apply()( implicit tx: ProcTxn ) : T def set( v: T )( implicit tx: ProcTxn ) : Unit diff --git a/test/files/pos/t3670.scala b/test/files/pos/t3670.scala index 19959f910f..ec4fbe5b4f 100644 --- a/test/files/pos/t3670.scala +++ b/test/files/pos/t3670.scala @@ -1,4 +1,4 @@ -class A { +class A { val n = { val z = { lazy val bb = 1 diff --git a/test/files/pos/t3671.scala b/test/files/pos/t3671.scala index 75559f84e2..1ca9327bb7 100644 --- a/test/files/pos/t3671.scala +++ b/test/files/pos/t3671.scala @@ -2,6 +2,6 @@ object Crash { def crash(value: Int): Unit = value match { case java.lang.Integer.MAX_VALUE => println("MAX_VALUE") - case java.lang.Integer.MIN_VALUE => println("MIN_VALUE") + case java.lang.Integer.MIN_VALUE => println("MIN_VALUE") } }
\ No newline at end of file diff --git a/test/files/pos/t3837.scala b/test/files/pos/t3837.scala index e1797dba77..bcaf63cc8d 100644 --- a/test/files/pos/t3837.scala +++ b/test/files/pos/t3837.scala @@ -1,8 +1,8 @@ class BipClass { } trait BipTrait { self: BipClass => - - private[this] def foo() = 5 + + private[this] def foo() = 5 def bar() = this.foo() } // error: value foo is not a member of BipTrait with BipClass diff --git a/test/files/pos/t3856.scala b/test/files/pos/t3856.scala index 5ea4b84e2c..132c95c5e6 100644 --- a/test/files/pos/t3856.scala +++ b/test/files/pos/t3856.scala @@ -1,4 +1,4 @@ -case class C[T](x: T) +case class C[T](x: T) case class CS(xs: C[_]*) diff --git a/test/files/pos/t3866.scala b/test/files/pos/t3866.scala index 5fe7e3f50e..5d366ccf13 100644 --- a/test/files/pos/t3866.scala +++ b/test/files/pos/t3866.scala @@ -13,5 +13,5 @@ abstract class ImplicitRepeated { f("A", 1, 2) // should be implicitly resolved to alternative b) f( 1, 2 ) // should be implicitly resolved to alternative a) // ImplicitRepeated.this.f[Int, Nothing]("A", ImplicitRepeated.this.anyToN[Int](1), ImplicitRepeated.this.anyToN[Int](2)); - // ImplicitRepeated.this.f[Int, Nothing](ImplicitRepeated.this.anyToN[Int](1), ImplicitRepeated.this.anyToN[Int](2)) + // ImplicitRepeated.this.f[Int, Nothing](ImplicitRepeated.this.anyToN[Int](1), ImplicitRepeated.this.anyToN[Int](2)) }
\ No newline at end of file diff --git a/test/files/pos/t3880.scala b/test/files/pos/t3880.scala index b6f06c43a3..cd5f3c0125 100644 --- a/test/files/pos/t3880.scala +++ b/test/files/pos/t3880.scala @@ -1,6 +1,6 @@ abstract class Bar[+B] { } -abstract class C1[+B] extends Bar[B] { +abstract class C1[+B] extends Bar[B] { private[this] def g(x: C1[B]): Unit = () // this method is fine: notice that it allows the call to g, diff --git a/test/files/pos/t3898.scala b/test/files/pos/t3898.scala index 075692e5a8..ab47bbd877 100644 --- a/test/files/pos/t3898.scala +++ b/test/files/pos/t3898.scala @@ -2,5 +2,5 @@ trait Atomic[@specialized(Boolean) T] { def x: T def f(fn: T => T): Boolean = f(fn(x), true) - def f[R](a: T, b: R): R = b + def f[R](a: T, b: R): R = b } diff --git a/test/files/pos/t3938/Parent.java b/test/files/pos/t3938/Parent.java index a35f435030..08fae330bb 100644 --- a/test/files/pos/t3938/Parent.java +++ b/test/files/pos/t3938/Parent.java @@ -1,7 +1,7 @@ public class Parent<A>{ class I1 {} class I2 extends Parent.I1 {} - + // OKAY: class I3 extends I1 {} static class I4 {} diff --git a/test/files/pos/t3938/UseParent.scala b/test/files/pos/t3938/UseParent.scala index 3f4c2298d5..685d1a03a8 100644 --- a/test/files/pos/t3938/UseParent.scala +++ b/test/files/pos/t3938/UseParent.scala @@ -1,6 +1,6 @@ object UseParent { classOf[Parent[AnyRef]#I2] - + // OKAY classOf[Parent[AnyRef]#I3] classOf[Parent.I5] diff --git a/test/files/pos/t3972.scala b/test/files/pos/t3972.scala index d6cbb3dfb7..5dfc10fcef 100644 --- a/test/files/pos/t3972.scala +++ b/test/files/pos/t3972.scala @@ -2,7 +2,7 @@ object CompilerCrash { def main(args: Array[String]) { args match { case Array("a", a @ _*) => { } // The code compiles fine if this line is commented out or "@ _*" is deleted or this line is swapped for the next line - case Array("b") => { } // The code compiles fine if this line is commented out + case Array("b") => { } // The code compiles fine if this line is commented out case Array("c", c) => { 0 // The code compiles fine if this line is commented out } diff --git a/test/files/pos/t4020.scala b/test/files/pos/t4020.scala index 8a758d53f7..f976460191 100644 --- a/test/files/pos/t4020.scala +++ b/test/files/pos/t4020.scala @@ -14,11 +14,11 @@ class B { def mthd(foo: a2.Foo) = { foo match { case a2.Foo2(i) => i - - // Note: This case is impossible. In fact, scalac + + // Note: This case is impossible. In fact, scalac // will (correctly) report an error if it is uncommented, // but a warning if it is commented. - + // case a1.Foo1(i) => i } } diff --git a/test/files/pos/t4070.scala b/test/files/pos/t4070.scala index 29c8d16e30..a9777f02ed 100644 --- a/test/files/pos/t4070.scala +++ b/test/files/pos/t4070.scala @@ -21,14 +21,14 @@ package b { /* // With crash below the clasess: -% scalac -Dscalac.debug.tvar ./a.scala +% scalac -Dscalac.debug.tvar ./a.scala [ create] ?_$1 ( In Foo#crash ) [ setInst] tv[Int] ( In Foo#crash, _$1=tv[Int] ) [ create] tv[Int] ( In Foo#crash ) [ clone] tv[Int] ( Foo#crash ) // With crash above the classes: -% scalac -Dscalac.debug.tvar ./a.scala +% scalac -Dscalac.debug.tvar ./a.scala [ create] ?tv ( In Foo#crash ) ./a.scala:2: error: Invalid type application in TypeVar: List(), List(Int) def crash(x: Dingus[_]): Unit = x match { case m: Bippy[tv] => () } diff --git a/test/files/pos/t4202.scala b/test/files/pos/t4202.scala index aca7d503ee..b2a0c0120a 100644 --- a/test/files/pos/t4202.scala +++ b/test/files/pos/t4202.scala @@ -2,7 +2,7 @@ object t4202_1 { () => { trait T { def t = () - } + } } } diff --git a/test/files/pos/t4220.scala b/test/files/pos/t4220.scala index 8fb999e345..98f2649767 100644 --- a/test/files/pos/t4220.scala +++ b/test/files/pos/t4220.scala @@ -1,4 +1,4 @@ -// don't know if our half-working sbt build is meaningfully +// don't know if our half-working sbt build is meaningfully // tested for #4220 with this, but it can't hurt. class Boo(a: Int = 0) diff --git a/test/files/pos/t4243.scala b/test/files/pos/t4243.scala index 5fa8665918..e6c66faff0 100644 --- a/test/files/pos/t4243.scala +++ b/test/files/pos/t4243.scala @@ -3,16 +3,16 @@ object wrap { - + trait DomainLike[@specialized(Int) A, +This <: Domain[A]] - + trait Domain[@specialized(Int) B] extends DomainLike[B, Domain[B]] - + trait IterableDomainLike[@specialized(Int) C, +This <: IterableDomain[C]] extends DomainLike[C, This] - + trait IterableDomain[@specialized(Int) D] extends Domain[D] with IterableDomainLike[D, IterableDomain[D]] - + } diff --git a/test/files/pos/t4266.scala b/test/files/pos/t4266.scala index 301cc264bc..222f65e970 100644 --- a/test/files/pos/t4266.scala +++ b/test/files/pos/t4266.scala @@ -1,21 +1,21 @@ object Test { - + trait Tensor2Like[ - @specialized(Int) A1, - +D1 <: DomainLike[A1], + @specialized(Int) A1, + +D1 <: DomainLike[A1], +D <: Product2DomainLike[D1] ] { def domain: D; - + def checkKey(k1: A1) { domain._1.contains(k1) } } - + trait DomainLike[A] { def contains(key: A): Boolean; } - + // trait DomainLike[@specialized(Int) A] { // def contains(key: A): Boolean; // } diff --git a/test/files/pos/t4269.scala b/test/files/pos/t4269.scala index 70f0471a9a..99a30785b4 100644 --- a/test/files/pos/t4269.scala +++ b/test/files/pos/t4269.scala @@ -1,5 +1,5 @@ -class A { - PartialFunction.condOpt(Nil) { - case items@List(_*) if true => +class A { + PartialFunction.condOpt(Nil) { + case items@List(_*) if true => } } diff --git a/test/files/pos/t4273.scala b/test/files/pos/t4273.scala index 9a942e8325..a4d37174ad 100644 --- a/test/files/pos/t4273.scala +++ b/test/files/pos/t4273.scala @@ -1,8 +1,8 @@ class A { implicit def compareComparables[T](x: T)(implicit ord: Ordering[T]) = new ord.Ops(x) - + class Bippy implicit val bippyOrdering = new Ordering[Bippy] { def compare(x: Bippy, y: Bippy) = util.Random.nextInt } - + (new Bippy) < (new Bippy) }
\ No newline at end of file diff --git a/test/files/pos/t4275.scala b/test/files/pos/t4275.scala index 183cb5155e..1938aceadc 100644 --- a/test/files/pos/t4275.scala +++ b/test/files/pos/t4275.scala @@ -1,6 +1,6 @@ object Test { def f = "abc".count(_ > 'a') - + class A { private val count: Int = 0 } diff --git a/test/files/pos/t430-feb09.scala b/test/files/pos/t430-feb09.scala index bba8996e4e..1499f32b7a 100644 --- a/test/files/pos/t430-feb09.scala +++ b/test/files/pos/t430-feb09.scala @@ -13,12 +13,12 @@ package c.scala { case class C[T]() } -// Doesn't compile: type Nothing is not a member of d.scala +// Doesn't compile: type Nothing is not a member of d.scala package d.scala.d { case class D[T]() } -// Doesn't compile: type Any is not a member of e.scala +// Doesn't compile: type Any is not a member of e.scala package e.scala { case class E[T >: Nothing]() } diff --git a/test/files/pos/t4432.scala b/test/files/pos/t4432.scala index 09f4c2ab34..106312311a 100644 --- a/test/files/pos/t4432.scala +++ b/test/files/pos/t4432.scala @@ -9,7 +9,7 @@ object Main { } new A } - + def foo2 = { class B { val x = { @@ -38,5 +38,5 @@ object Main { } new D } - + } diff --git a/test/files/pos/t4457_1.scala b/test/files/pos/t4457_1.scala index 4442f28e4a..32edd6cfdc 100644 --- a/test/files/pos/t4457_1.scala +++ b/test/files/pos/t4457_1.scala @@ -15,7 +15,7 @@ object ImplicitConvAmbiguity2 { def aFunc[A](a: NN[A]) = new BB[A] def bFunc[T](e1: N[T]) = {} - + def typeMe1 { val x = aFunc(4F) bFunc(x) diff --git a/test/files/pos/t4501.scala b/test/files/pos/t4501.scala index dac2524024..40628f1a4b 100644 --- a/test/files/pos/t4501.scala +++ b/test/files/pos/t4501.scala @@ -6,7 +6,7 @@ class A { def f1 = foo(ListBuffer(), List()) def f2 = foo(ListBuffer(), ListBuffer()) def f3 = foo(List(), List()) - + // scalap // def f1 : scala.collection.Seq[scala.Nothing] = { /* compiled code */ } // def f2 : scala.collection.mutable.ListBuffer[scala.Nothing] = { /* compiled code */ } diff --git a/test/files/pos/t460.scala b/test/files/pos/t460.scala index 466d06c2ad..3fc13e4dd0 100644 --- a/test/files/pos/t460.scala +++ b/test/files/pos/t460.scala @@ -1,8 +1,8 @@ object Bug460 { def testFun(x : Int, y : Int) = x + y - val fn = testFun _ - - fn(1, 2) // Ok + val fn = testFun _ + + fn(1, 2) // Ok (testFun(_, _))(1, 2) // Ok (testFun _).apply(1, 2) (testFun _)(1, 2) // Error! (but no longer) diff --git a/test/files/pos/t4603/S.scala b/test/files/pos/t4603/S.scala index 9e228195a4..c7d809d9f7 100644 --- a/test/files/pos/t4603/S.scala +++ b/test/files/pos/t4603/S.scala @@ -1,7 +1,7 @@ // S.scala class S extends J[AnyRef] -object Test { +object Test { def main(args:Array[String]) { J.f(classOf[S]) } diff --git a/test/files/pos/t4716.scala b/test/files/pos/t4716.scala index d4bd55c55b..ec29e8d2cb 100644 --- a/test/files/pos/t4716.scala +++ b/test/files/pos/t4716.scala @@ -2,7 +2,7 @@ -trait Bug2[@specialized(Int) +A] extends TraversableOnce[A] { +trait Bug2[@specialized(Int) +A] extends TraversableOnce[A] { def ++[B >: A](that: TraversableOnce[B]) = { lazy val it = that.toIterator it diff --git a/test/files/pos/t4717.scala b/test/files/pos/t4717.scala index 4acfe489cc..ed35a8ad87 100644 --- a/test/files/pos/t4717.scala +++ b/test/files/pos/t4717.scala @@ -6,13 +6,13 @@ trait Bug1[@specialized(Boolean) A] extends TraversableOnce[A] { - + def ++[B >: A](that: TraversableOnce[B]): Iterator[B] = new Iterator[B] { lazy val it = that.toIterator def hasNext = it.hasNext def next = it.next } - + } diff --git a/test/files/pos/t4760.scala b/test/files/pos/t4760.scala index 767e3847f4..d4407a86b4 100644 --- a/test/files/pos/t4760.scala +++ b/test/files/pos/t4760.scala @@ -19,7 +19,7 @@ class Test { import scala.util.Properties.lineSeparator } } - + // parses def f3 = { import scala._ diff --git a/test/files/pos/t4840.scala b/test/files/pos/t4840.scala index eefa3b2dee..bf44f71d7a 100644 --- a/test/files/pos/t4840.scala +++ b/test/files/pos/t4840.scala @@ -1,6 +1,6 @@ class Crashy { def g(): Option[Any] = None - + def crashy() = { for (_ <- g()) { (null: Any) match { diff --git a/test/files/pos/t4853.scala b/test/files/pos/t4853.scala index ed9b320434..c91f2d6b05 100644 --- a/test/files/pos/t4853.scala +++ b/test/files/pos/t4853.scala @@ -3,7 +3,7 @@ object Animal { } class Animal[A <: AwakeOrAsleep] { - def goToSleep[B >: A <: Awake]: Animal[Asleep] = new Animal[Asleep] + def goToSleep[B >: A <: Awake]: Animal[Asleep] = new Animal[Asleep] def wakeUp[B >: A <: Asleep]: Animal[Awake] = new Animal[Awake] } diff --git a/test/files/pos/t4970b.scala b/test/files/pos/t4970b.scala new file mode 100644 index 0000000000..cf9a6a6ae9 --- /dev/null +++ b/test/files/pos/t4970b.scala @@ -0,0 +1,32 @@ +object Traits { + trait OuterClass[V <: OuterClass[V]#InnerClass] { + trait InnerClass {self: V => + def method = () + } + } + + trait SubOuterClass[T <: SubOuterClass[T]#SubInnerClass] extends OuterClass[T] { + trait SubInnerClass extends super.InnerClass {self: T => } + } + + trait SubOuterClass2[T <: SubOuterClass2[T]#SubInnerClass2] extends OuterClass[T] { + trait SubInnerClass2 extends super.InnerClass {self: InnerClass with T => } + } + +} + +// object Classes { +// class OuterClass[V <: OuterClass[V]#InnerClass] { +// class InnerClass {self: V => +// def method = () +// } +// } + +// class SubOuterClass[T <: SubOuterClass[T]#SubInnerClass] extends OuterClass[T] { +// class SubInnerClass extends super.InnerClass {self: T => } +// } + +// class SubOuterClass2[T <: SubOuterClass2[T]#SubInnerClass2] extends OuterClass[T] { +// class SubInnerClass2 extends super.InnerClass {self: InnerClass with T => } +// } +// } diff --git a/test/files/pos/t5031_2.scala b/test/files/pos/t5031_2.scala index ded3e82301..e51215db84 100644 --- a/test/files/pos/t5031_2.scala +++ b/test/files/pos/t5031_2.scala @@ -1,4 +1,4 @@ -package object t5031 { +package object t5031 { class ID } diff --git a/test/files/pos/t5120.scala b/test/files/pos/t5120.scala index 2c193d129d..6731af14e4 100644 --- a/test/files/pos/t5120.scala +++ b/test/files/pos/t5120.scala @@ -1,12 +1,12 @@ -// An example extracted from SBT by Iulian -// that showed that the previous fix to t5120 +// An example extracted from SBT by Iulian +// that showed that the previous fix to t5120 // was too strict. class Test { class ScopedKey[T] class Value[T] class Compiled[T](val settings: Seq[Pair[T]]) - + case class Pair[T](k: ScopedKey[T], v: ScopedKey[T]) def transform[T](x: T) = x diff --git a/test/files/pos/t5127.scala b/test/files/pos/t5127.scala index e90b8d00a0..c562025302 100644 --- a/test/files/pos/t5127.scala +++ b/test/files/pos/t5127.scala @@ -4,5 +4,5 @@ package foo { class Parametrized1[T] extends Abstract1[Parametrized2[T]] { def bar(a: AnyRef) { a match { case d: Parametrized1[_] => println("ok") } } } - class Parametrized2[T] extends Parametrized1[T] with Abstract2[Parametrized2[T]] + class Parametrized2[T] extends Parametrized1[T] with Abstract2[Parametrized2[T]] } diff --git a/test/files/pos/t5156.scala b/test/files/pos/t5156.scala index e7912ef35c..52412ad4c1 100644 --- a/test/files/pos/t5156.scala +++ b/test/files/pos/t5156.scala @@ -1,6 +1,6 @@ sealed trait HList -final case class HCons[H, T <: HList](head : H, tail : T) extends HList -case object HNil extends HList +final case class HCons[H, T <: HList](head : H, tail : T) extends HList +case object HNil extends HList object HList { type ::[H, T <: HList] = HCons[H, T] diff --git a/test/files/pos/t516.scala b/test/files/pos/t516.scala index 735b259436..5561b7610c 100644 --- a/test/files/pos/t516.scala +++ b/test/files/pos/t516.scala @@ -4,7 +4,7 @@ import scala.collection.script._; class Members; object subscriber extends Subscriber[Message[String] with Undoable, Members] { - def notify(pub: Members, event: Message[String] with Undoable): Unit = + def notify(pub: Members, event: Message[String] with Undoable): Unit = (event: Message[String]) match { case Include(l, elem) => Console.println("ADD: " + elem); case Remove(l, elem) => Console.println("REM: " + elem); @@ -12,4 +12,3 @@ object subscriber extends Subscriber[Message[String] with Undoable, Members] { //case r : Remove [HasTree] with Undoable => } } - diff --git a/test/files/pos/t5178.scala b/test/files/pos/t5178.scala index 26c008d66f..ed0f814ec5 100644 --- a/test/files/pos/t5178.scala +++ b/test/files/pos/t5178.scala @@ -4,7 +4,7 @@ abstract class FileOps { trait DefaultFileOps { self: DefaultPath => - + override def withLock[R](start: Long = 5): Option[R] = None } diff --git a/test/files/pos/t5240.scala b/test/files/pos/t5240.scala index 2db689c27d..065d175f2f 100644 --- a/test/files/pos/t5240.scala +++ b/test/files/pos/t5240.scala @@ -5,7 +5,7 @@ package object foo { - + var labels: Array[_ <: String] = null - + } diff --git a/test/files/pos/t5317.scala b/test/files/pos/t5317.scala index 8c9c9d8222..052e84438c 100644 --- a/test/files/pos/t5317.scala +++ b/test/files/pos/t5317.scala @@ -2,11 +2,11 @@ object Test { trait S { type T; val x: AnyRef } trait A extends S { type T <: A; val x: A = null } trait B extends S { type T <: B; val x: B = null } - + val a = new A{} val b = new B{} val y = if (true) a else b - + // lub of y should allow for this println(y.x.x) } diff --git a/test/files/pos/t5541.scala b/test/files/pos/t5541.scala index 39682a2fff..90e5e4130b 100644 --- a/test/files/pos/t5541.scala +++ b/test/files/pos/t5541.scala @@ -27,7 +27,7 @@ object HASkipList { def asBranch : Branch[ S, A ] = this } } -sealed trait HASkipList[ S <: Sys[ S ], @specialized( Int ) A ] +sealed trait HASkipList[ S <: Sys[ S ], @specialized( Int ) A ] class HASkipListView[ S <: Sys[ S ], A ]( private val l: HASkipList[ S, A ])( implicit system: S ) { import HASkipList.Node diff --git a/test/files/pos/t5639/Foo.scala b/test/files/pos/t5639/Foo.scala index 6602150661..1a07734a8e 100644 --- a/test/files/pos/t5639/Foo.scala +++ b/test/files/pos/t5639/Foo.scala @@ -1,6 +1,6 @@ package pack.age -class Baz +class Baz object Implicits { implicit def Baz(n: Int): Baz = new Baz diff --git a/test/files/pos/t573.scala b/test/files/pos/t573.scala index 7b9d377cd1..694d001e3c 100644 --- a/test/files/pos/t573.scala +++ b/test/files/pos/t573.scala @@ -16,15 +16,15 @@ import DirX._; abstract class Linked { type Node <: Node0; - + abstract class Node0 { self: Node => - + var next : Node = _; var prev : Node = _; - + def get(dir : Dir) = if (dir == BEFORE) prev; else next; - private def set(dir : Dir, node : Node) = + private def set(dir : Dir, node : Node) = if (dir == BEFORE) prev = node; else next = node; def link(dir : Dir, node : Node) = { @@ -34,7 +34,7 @@ abstract class Linked { node.set(dir.reverse, self); } - + def end(dir : Dir) : Node = { if (get(dir) == null) this; else get(dir).end(dir); diff --git a/test/files/pos/t577.scala b/test/files/pos/t577.scala index 236c1395e2..ede45399a0 100644 --- a/test/files/pos/t577.scala +++ b/test/files/pos/t577.scala @@ -1,15 +1,15 @@ trait PriorityTree { type Node <: BasicTreeNode; - + val top = initTree; top.next = (initTree); top.next.prev = (top); - + def initTree : Node; - - - + + + trait BasicTreeNode { private[PriorityTree] var next : Node = _; private[PriorityTree] var prev : Node = _; diff --git a/test/files/pos/t5846.scala b/test/files/pos/t5846.scala index b06f5ac39c..05cabed6a0 100644 --- a/test/files/pos/t5846.scala +++ b/test/files/pos/t5846.scala @@ -4,7 +4,7 @@ /** Return the most general sorted map type. */ object Test extends App { - + val empty: collection.SortedMap[String, String] = collection.SortedMap.empty[String, String] - + } diff --git a/test/files/pos/t5853.scala b/test/files/pos/t5853.scala index 21d80206ab..2ebb6667dc 100644 --- a/test/files/pos/t5853.scala +++ b/test/files/pos/t5853.scala @@ -41,7 +41,7 @@ object Arrow { implicit final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal { @inline def ->>[B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y) } - + def foo = 1 ->> 2 } @@ -50,6 +50,6 @@ object SpecArrow { implicit final class ArrowAssoc[A](val __leftOfArrow: A) extends AnyVal { @inline def ->> [@specialized(Int) B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y) } - + def foo = 1 ->> 2 } diff --git a/test/files/pos/t599.scala b/test/files/pos/t599.scala index 53f205a26b..968e2deaee 100644 --- a/test/files/pos/t599.scala +++ b/test/files/pos/t599.scala @@ -16,4 +16,4 @@ abstract class FooA { val aaa: InnerB.this.B = doB aaa.xxx; } - } + } diff --git a/test/files/pos/t602.scala b/test/files/pos/t602.scala index 6062b976b6..18dd405645 100644 --- a/test/files/pos/t602.scala +++ b/test/files/pos/t602.scala @@ -10,5 +10,5 @@ case class Span[K <: Ordered[K]](low: Option[K], high: Option[K]) extends Functi case Span(Some(low), None) => (k >= low) case Span(None, Some(high)) => (k <= high) case _ => false - } + } } diff --git a/test/files/pos/t613.scala b/test/files/pos/t613.scala index 6e3841dada..e140833106 100644 --- a/test/files/pos/t613.scala +++ b/test/files/pos/t613.scala @@ -3,9 +3,9 @@ class Outer extends App { abstract class C { val x: Int } - val foo = new C { + val foo = new C { class I { - val z = y + val z = y } val x = (new I).z } diff --git a/test/files/pos/t616.scala b/test/files/pos/t616.scala index 074ad190da..bb91c732a6 100644 --- a/test/files/pos/t616.scala +++ b/test/files/pos/t616.scala @@ -1,7 +1,7 @@ object testImplicit { implicit def foo2bar(foo: Foo): Bar = foo.bar class Foo(val bar: Bar) { - def testCoercion = {val a = this; a.baz} // here, foo2bar is inferred by the compiler, as expected + def testCoercion = {val a = this; a.baz} // here, foo2bar is inferred by the compiler, as expected //def testCoercionThisImplicit = baz // --> error: not found: value baz def testCoercionThisExplicit: Any = this.baz // --> error: value baz is not a member of Foo } diff --git a/test/files/pos/t6210.scala b/test/files/pos/t6210.scala index 1ce8493872..855c621b8e 100644 --- a/test/files/pos/t6210.scala +++ b/test/files/pos/t6210.scala @@ -10,9 +10,9 @@ case class TBool() extends Ty object Foo { def checkExpr(ast: AExpr): Ty = { var astTy:Ty = ast match { - case AAssign(nm: String, v:AExpr) => TBool() + case AAssign(nm: String, v:AExpr) => TBool() - case AConstBool(v: Boolean) => TBool() + case AConstBool(v: Boolean) => TBool() case _ => throw new Exception(s"Unhandled case check(ast: ${ast.getClass})") } diff --git a/test/files/pos/t651.scala b/test/files/pos/t651.scala index 44d20ad580..c146446af9 100644 --- a/test/files/pos/t651.scala +++ b/test/files/pos/t651.scala @@ -4,12 +4,12 @@ trait Test3 { trait MatchableImpl { trait MatchImpl; } - + trait BracePairImpl { trait BraceImpl extends MatchableImpl { private object MyMatch1 extends MatchImpl; protected def match0 : MatchImpl = MyMatch1; - + } } } diff --git a/test/files/pos/t6624.scala b/test/files/pos/t6624.scala index 1a92b92d53..44554c59c7 100644 --- a/test/files/pos/t6624.scala +++ b/test/files/pos/t6624.scala @@ -10,7 +10,7 @@ object Test { val klist: KCons[Option, KCons[Option, KCons[Option, KNil[Nothing]]]] = ??? // crashes with - // "Exception in thread "main" scala.reflect.internal.Types$TypeError: value _1 is not a member + // "Exception in thread "main" scala.reflect.internal.Types$TypeError: value _1 is not a member // of KCons[Option,KCons[Option,KNil[Nothing]]]" klist match { case KCons(KCons(KCons(_))) => diff --git a/test/files/pos/t675.scala b/test/files/pos/t675.scala index c284c0e202..905d29d44a 100644 --- a/test/files/pos/t675.scala +++ b/test/files/pos/t675.scala @@ -7,7 +7,7 @@ trait T { } trait X { def foo : Foo = FOO_0; - } + } } object Test extends App { @@ -15,5 +15,3 @@ object Test extends App { val x = new t.X{} Console.println(x.foo) } - - diff --git a/test/files/pos/t690.scala b/test/files/pos/t690.scala index 3fcdca785d..a93c54f007 100644 --- a/test/files/pos/t690.scala +++ b/test/files/pos/t690.scala @@ -10,5 +10,5 @@ trait test { override def foo(t : T) = super.foo(t); } def t : T; - M0.foo(t); + M0.foo(t); } diff --git a/test/files/pos/t6963c.scala b/test/files/pos/t6963c.scala index 0b6b5c757f..d3c3616eb2 100644 --- a/test/files/pos/t6963c.scala +++ b/test/files/pos/t6963c.scala @@ -9,9 +9,9 @@ object Test { case _: Array[_] => true case _ => false } - + def f4(x: Any) = x.isInstanceOf[Traversable[_]] - + def f5(x1: Any, x2: Any, x3: AnyRef) = (x1, x2, x3) match { case (Some(_: Seq[_]), Nil, _) => 1 case (None, List(_: List[_], _), _) => 2 diff --git a/test/files/pos/t6976/ImplicitBug_1.scala b/test/files/pos/t6976/ImplicitBug_1.scala index c9031bab2e..50bc247acc 100644 --- a/test/files/pos/t6976/ImplicitBug_1.scala +++ b/test/files/pos/t6976/ImplicitBug_1.scala @@ -1,4 +1,4 @@ -// This one is weird and nasty. Not sure if this is scalac or sbt +// This one is weird and nasty. Not sure if this is scalac or sbt // (tried with 0.12 & 0.12.2-RC2) bug. // // A level of indirection is required to trigger this bug. @@ -11,12 +11,12 @@ // 4. sbt run (it fails) // 5. Switch it back & sbt run. It still fails. // -// In this project sbt clean helps. However in a large project where this +// In this project sbt clean helps. However in a large project where this // bug was found compiler crashed even after doing sbt clean. The only -// way to work around this was to reference Exts object explicitly (C) in +// way to work around this was to reference Exts object explicitly (C) in // the source file using its implicit classes. -// Lets suppose this is a mega-trait combining all sorts of helper +// Lets suppose this is a mega-trait combining all sorts of helper // functionality. trait Support extends Exts diff --git a/test/files/pos/t7014/t7014.scala b/test/files/pos/t7014/t7014.scala index faec4c7740..7c73f700be 100644 --- a/test/files/pos/t7014/t7014.scala +++ b/test/files/pos/t7014/t7014.scala @@ -1,4 +1,3 @@ package t7014 import ThreadSafetyLevel.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed -
\ No newline at end of file diff --git a/test/files/pos/t711.scala b/test/files/pos/t711.scala index 10b410e54e..4dd6040969 100644 --- a/test/files/pos/t711.scala +++ b/test/files/pos/t711.scala @@ -2,7 +2,7 @@ abstract class Component class Button extends Component { def sayHey: Unit = Console.println("Hey, I'm a button") } - + abstract class Origin { val delegate: Component } diff --git a/test/files/pos/t7264/B_2.scala b/test/files/pos/t7264/B_2.scala index 869c51481d..a8af2e727e 100644 --- a/test/files/pos/t7264/B_2.scala +++ b/test/files/pos/t7264/B_2.scala @@ -1,7 +1,7 @@ object Test { // if the following line is uncommented, things compile // type X = Foo.Values - + def foo(f: Foo) = f.bar(0 /* : Foo.Values */) } diff --git a/test/files/pos/t757.scala b/test/files/pos/t757.scala index 7513910d8d..fd7624cee7 100644 --- a/test/files/pos/t757.scala +++ b/test/files/pos/t757.scala @@ -1,4 +1,4 @@ -package foo { +package foo { object C { def foo { Console.println("foo") @@ -6,7 +6,7 @@ package foo { } } -package bar { +package bar { object Main extends App { foo.C.foo } diff --git a/test/files/pos/t758.scala b/test/files/pos/t758.scala index 44769d54f1..160bf37172 100644 --- a/test/files/pos/t758.scala +++ b/test/files/pos/t758.scala @@ -1,7 +1,7 @@ trait A { type T; type M >: T } -trait B extends A { - val x : String; - val u : A { type T = B.this.T } ; - type T = x.type; - type M = u.M +trait B extends A { + val x : String; + val u : A { type T = B.this.T } ; + type T = x.type; + type M = u.M } diff --git a/test/files/pos/t767.scala b/test/files/pos/t767.scala index d4d7eae870..0c4067f022 100644 --- a/test/files/pos/t767.scala +++ b/test/files/pos/t767.scala @@ -4,7 +4,7 @@ abstract class AbsCell { private var value: T = init def get: T = value def set (x: T) { value = x } - + class Node { val foo = 1 } diff --git a/test/files/pos/t7847/A.scala b/test/files/pos/t7847/A.scala new file mode 100644 index 0000000000..b6cce6ee79 --- /dev/null +++ b/test/files/pos/t7847/A.scala @@ -0,0 +1,5 @@ +case class Blah(a: Int) + +object Blah { + def apply2(a: Int) = apply(a) +} diff --git a/test/files/pos/t7847/B.java b/test/files/pos/t7847/B.java new file mode 100644 index 0000000000..c214f2dcab --- /dev/null +++ b/test/files/pos/t7847/B.java @@ -0,0 +1,10 @@ +public final class B { + void blah() { + Blah x = Blah.apply2(1); + Blah y = Blah.apply(1); + Blah z = Blah$.MODULE$.apply(1); + + scala.Option un1 = Blah.unapply(null); + scala.Option un2 = Blah$.MODULE$.unapply(null); + } +} diff --git a/test/files/pos/t7853-partial-function.scala b/test/files/pos/t7853-partial-function.scala new file mode 100644 index 0000000000..b09254e99a --- /dev/null +++ b/test/files/pos/t7853-partial-function.scala @@ -0,0 +1,7 @@ +object Test { + + def testCons: Unit = { + def x[A](a: PartialFunction[Any, A]): A = a(0) + val eval0 = x { case list: List[Int @unchecked] => list } + } +} diff --git a/test/files/pos/t7853.scala b/test/files/pos/t7853.scala new file mode 100644 index 0000000000..b0e9221e22 --- /dev/null +++ b/test/files/pos/t7853.scala @@ -0,0 +1,11 @@ +trait S { + trait T { + this: Any => + + trait U { + trait V { + S.this + } + } + } +} diff --git a/test/files/pos/t7854.scala b/test/files/pos/t7854.scala new file mode 100644 index 0000000000..d4de7dfe38 --- /dev/null +++ b/test/files/pos/t7854.scala @@ -0,0 +1,5 @@ +class A { + var f: Int => Unit = _ => () + + f = null +} diff --git a/test/files/pos/t7864.flags b/test/files/pos/t7864.flags new file mode 100644 index 0000000000..7ccd56103a --- /dev/null +++ b/test/files/pos/t7864.flags @@ -0,0 +1 @@ +-Xlint
\ No newline at end of file diff --git a/test/files/pos/t7864.scala b/test/files/pos/t7864.scala new file mode 100644 index 0000000000..b2d8911a17 --- /dev/null +++ b/test/files/pos/t7864.scala @@ -0,0 +1,5 @@ +object Test { + val f = 0; + ({ toString; (x: Any) => x})("$f ") +} + diff --git a/test/files/pos/t788.scala b/test/files/pos/t788.scala index 3da88a2d26..19638dd170 100644 --- a/test/files/pos/t788.scala +++ b/test/files/pos/t788.scala @@ -4,7 +4,7 @@ trait Test { type Node <: NodeImpl; trait NodeImpl; type Expression <: Node with ExpressionImpl; - trait ExpressionImpl extends NodeImpl { + trait ExpressionImpl extends NodeImpl { def self : Expression; } type Named <: Node with NamedImpl; diff --git a/test/files/pos/t802.scala b/test/files/pos/t802.scala index 124d4915bc..2dea7036d6 100644 --- a/test/files/pos/t802.scala +++ b/test/files/pos/t802.scala @@ -1,17 +1,17 @@ package test; trait Test { - abstract class BracesImpl { + abstract class BracesImpl { type Singleton; type Brace <: Singleton with BraceImpl; - trait BraceImpl; + trait BraceImpl; trait ForFile; } - abstract class ParensImpl extends BracesImpl { + abstract class ParensImpl extends BracesImpl { type Brace <: Singleton with BraceImpl; trait BraceImpl extends super.BraceImpl; } val parens : ParensImpl; - abstract class BracksImpl extends BracesImpl { + abstract class BracksImpl extends BracesImpl { type Brace <: Singleton with BraceImpl; trait BraceImpl extends super.BraceImpl; } diff --git a/test/files/pos/t807.scala b/test/files/pos/t807.scala index ed73fe3f97..0eeb92ea24 100644 --- a/test/files/pos/t807.scala +++ b/test/files/pos/t807.scala @@ -6,7 +6,7 @@ trait Matcher { trait HasLinks { def link(b : Boolean) : Link = null; } - + } trait BraceMatcher extends Matcher { trait BracePair { diff --git a/test/files/pos/t927.scala b/test/files/pos/t927.scala index 534f355045..c903f19867 100644 --- a/test/files/pos/t927.scala +++ b/test/files/pos/t927.scala @@ -7,5 +7,5 @@ object Test { } val str: Stream[Int] = List(1,2,3).iterator.toStream assert(sum(str) == 6) - + } diff --git a/test/files/pos/t946.scala b/test/files/pos/t946.scala index 9f4cdbc043..c4bd6e9ba4 100644 --- a/test/files/pos/t946.scala +++ b/test/files/pos/t946.scala @@ -1,7 +1,7 @@ object pmbugbounds { trait Bar class Foo[t <: Bar] {} - + (new Foo[Bar]) match { case _ : Foo[x] => null } diff --git a/test/files/pos/tcpoly_bounds1.scala b/test/files/pos/tcpoly_bounds1.scala index 142c0b7b7f..5874cc664d 100644 --- a/test/files/pos/tcpoly_bounds1.scala +++ b/test/files/pos/tcpoly_bounds1.scala @@ -1,6 +1,6 @@ -class Foo[t[x]<: Pair[Int, x]] +class Foo[t[x]<: Pair[Int, x]] -// +// class MyPair[z](a: Int, b: z) extends Pair[Int, z](a,b) object foo extends Foo[MyPair] diff --git a/test/files/pos/tcpoly_checkkinds_mix.scala b/test/files/pos/tcpoly_checkkinds_mix.scala index 2d265da6b9..3734405f8b 100644 --- a/test/files/pos/tcpoly_checkkinds_mix.scala +++ b/test/files/pos/tcpoly_checkkinds_mix.scala @@ -2,9 +2,9 @@ trait Iterable[A <: Bound[A], Bound[_]] { type MyType[x <: Bound[x]] <: Iterable[x, Bound] def map[B <: Bound[B]](f: A => B): MyType[B] def flatMap[B <: Bound[B]](f: A => MyType[B]): MyType[B] - def filter(p: A => Boolean): MyType[A] + def filter(p: A => Boolean): MyType[A] } -trait OrderedSet[T <: Ordered[T]] extends Iterable[T, Ordered] { +trait OrderedSet[T <: Ordered[T]] extends Iterable[T, Ordered] { type MyType[x <: Ordered[x]] = OrderedSet[x] -} +} diff --git a/test/files/pos/tcpoly_gm.scala b/test/files/pos/tcpoly_gm.scala index ecaeef9679..89b66cfba6 100644 --- a/test/files/pos/tcpoly_gm.scala +++ b/test/files/pos/tcpoly_gm.scala @@ -1,4 +1,4 @@ -trait Rep[a] { +trait Rep[a] { def rep[m[x]]: m[a] // typedTypeApply must use asSeenFrom to adapt the return type // since rep is called on x: Rep[t] // a must become t @@ -9,7 +9,6 @@ case class ShowBin[b](app: b => String) object foo { def showBin[t](x: Rep[t], y: t): String = { val r: ShowBin[t] = x.rep[ShowBin] - r.app(y) + r.app(y) } } - diff --git a/test/files/pos/tcpoly_higherorder_bound_method.scala b/test/files/pos/tcpoly_higherorder_bound_method.scala index 090bb8fcf3..3905b3b96d 100644 --- a/test/files/pos/tcpoly_higherorder_bound_method.scala +++ b/test/files/pos/tcpoly_higherorder_bound_method.scala @@ -1,3 +1,3 @@ trait SkolemisationOfHigherOrderBoundInMethod { def method[A, N[X <: A], M[X <: N[A]]]: Unit -} +} diff --git a/test/files/pos/tcpoly_late_method_params.scala b/test/files/pos/tcpoly_late_method_params.scala index c9298918a0..e2f0bcffb3 100644 --- a/test/files/pos/tcpoly_late_method_params.scala +++ b/test/files/pos/tcpoly_late_method_params.scala @@ -1,5 +1,5 @@ trait Foo { - def flatMap[RT <: RBound[RT], RBound[_], Result[x <: RBound[x]]]: Result[RT] + def flatMap[RT <: RBound[RT], RBound[_], Result[x <: RBound[x]]]: Result[RT] // bounds for RT& = >: scala.this.Nothing <: RBound&[RT&] // bounds for x = >: scala.this.Nothing <: RBound&[x] } diff --git a/test/files/pos/tcpoly_method.scala b/test/files/pos/tcpoly_method.scala index 80dc0482fd..294b53b915 100644 --- a/test/files/pos/tcpoly_method.scala +++ b/test/files/pos/tcpoly_method.scala @@ -1,6 +1,6 @@ trait Iterable[m[+x], +t] { def flatMap[resColl[+x] <: Iterable[resColl, x], s](f: t => resColl[s]): resColl[s] - + def foo[a[x]] = "a" val x = foo[List] } diff --git a/test/files/pos/tcpoly_poly.scala b/test/files/pos/tcpoly_poly.scala index 50ffc7837f..1ba04e29df 100644 --- a/test/files/pos/tcpoly_poly.scala +++ b/test/files/pos/tcpoly_poly.scala @@ -1,3 +1,3 @@ -class Monad[m[x]] +class Monad[m[x]] object ml extends Monad[List] diff --git a/test/files/pos/tcpoly_return_overriding.scala b/test/files/pos/tcpoly_return_overriding.scala index 0814e73fa4..57ec8da76c 100644 --- a/test/files/pos/tcpoly_return_overriding.scala +++ b/test/files/pos/tcpoly_return_overriding.scala @@ -2,7 +2,7 @@ trait Generic[g[x]] { def unit: g[Unit] } -trait Rep[t] { +trait Rep[t] { def rep[m[x]](implicit gen: Generic[m]): m[t] } diff --git a/test/files/pos/tcpoly_seq.scala b/test/files/pos/tcpoly_seq.scala index b5f46f6b6b..48b3e1ce52 100644 --- a/test/files/pos/tcpoly_seq.scala +++ b/test/files/pos/tcpoly_seq.scala @@ -6,40 +6,40 @@ trait HOSeq { // values implementing this interface, in order to provide more performant ways of building that structure trait Accumulator[+coll[x], elT] { def += (el: elT): Unit - def result: coll[elT] + def result: coll[elT] } - - + + // Iterable abstracts over the type of its structure as well as its elements (see PolyP's Bifunctor) - // m[x] is intentionally unbounded: fold can then be defined nicely - // variance: if we write m[+x] instead of +m[+x], x is an invariant position because its enclosing type + // m[x] is intentionally unbounded: fold can then be defined nicely + // variance: if we write m[+x] instead of +m[+x], x is an invariant position because its enclosing type // is an invariant position -- should probably rule that out? trait Iterable[+m[+x], +t] { //def unit[a](orig: a): m[a] def iterator: Iterator[t] - + // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t def accumulator[t]: Accumulator[m, t] - + def filter(p: t => Boolean): m[t] = { val buf = accumulator[t] val elems = iterator while (elems.hasNext) { val x = elems.next; if (p(x)) buf += x } buf.result } - + def map[s](f: t => s): m[s] = { val buf = accumulator[s] val elems = iterator while (elems.hasNext) buf += f(elems.next) buf.result } - + // flatMap is a more specialized map, it only works if the mapped function produces Iterable values, // which are then added to the result one by one // the compiler should be able to find the right accumulator (implicit buf) to build the result // to get concat, resColl = SingletonIterable, f = unit for SingletonIterable - def flatMap[resColl[+x] <: Iterable[resColl, x], s](f: t => resColl[s])(implicit buf: Accumulator[resColl, s]): resColl[s] = { + def flatMap[resColl[+x] <: Iterable[resColl, x], s](f: t => resColl[s])(implicit buf: Accumulator[resColl, s]): resColl[s] = { // TODO: would a viewbound for resColl[x] be better? // -- 2nd-order type params are not yet in scope in view bound val elems = iterator @@ -48,9 +48,9 @@ trait HOSeq { while (elemss.hasNext) buf += elemss.next } buf.result - } + } } - + final class ListBuffer[A] { private var start: List[A] = Nil private var last: ::[A] = _ @@ -78,7 +78,7 @@ trait HOSeq { exported = !start.isEmpty start } - + /** Clears the buffer contents. */ def clear { @@ -97,13 +97,13 @@ trait HOSeq { } } } - + implicit def listAccumulator[elT]: Accumulator[List, elT] = new Accumulator[List, elT] { private[this] val buff = new ListBuffer[elT] def += (el: elT): Unit = buff += el def result: List[elT] = buff.toList } - + trait List[+t] extends Iterable[List, t] { def head: t def tail: List[t] @@ -121,14 +121,14 @@ trait HOSeq { // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t def accumulator[t]: Accumulator[List, t] = listAccumulator[t] } - + // TODO: the var tl approach does not seem to work because subtyping isn't fully working yet final case class ::[+b](hd: b, private val tl: List[b]) extends List[b] { def head = hd def tail = if(tl==null) this else tl // hack override def isEmpty: Boolean = false } - + case object Nil extends List[Nothing] { def isEmpty = true def head: Nothing = @@ -157,18 +157,18 @@ trait HOSeq { def filter(f: T=>Boolean): FilterResult def subseq(from: Int, to: Int): Subseq def flatMap[S <: Seq[K], K](f: T => S): S#Concat // legal? - def concat(others: Seq[T]): Concat + def concat(others: Seq[T]): Concat */ - + /*trait Iterator[t] { // @post hasAdvanced implies hasNext // model def hasAdvanced: Boolean - + def hasNext: Boolean // pure - + // @pre hasAdvanced def current: t // pure - + // @pre hasNext // @post hasAdvanced def advance: Unit diff --git a/test/files/pos/tcpoly_seq_typealias.scala b/test/files/pos/tcpoly_seq_typealias.scala index 0651ad9760..fb48126ce6 100644 --- a/test/files/pos/tcpoly_seq_typealias.scala +++ b/test/files/pos/tcpoly_seq_typealias.scala @@ -6,42 +6,42 @@ trait HOSeq { // values implementing this interface, in order to provide more performant ways of building that structure trait Accumulator[+coll[x], elT] { def += (el: elT): Unit - def result: coll[elT] + def result: coll[elT] } - - + + // Iterable abstracts over the type of its structure as well as its elements (see PolyP's Bifunctor) - // m[x] is intentionally unbounded: fold can then be defined nicely - // variance: if we write m[+x] instead of +m[+x], x is an invariant position because its enclosing type + // m[x] is intentionally unbounded: fold can then be defined nicely + // variance: if we write m[+x] instead of +m[+x], x is an invariant position because its enclosing type // is an invariant position -- should probably rule that out? trait Iterable[+t] { - type m[+x] - + type m[+x] + //def unit[a](orig: a): m[a] def iterator: Iterator[t] - + // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t def accumulator[t]: Accumulator[m, t] - + def filter(p: t => Boolean): m[t] = { val buf = accumulator[t] val elems = iterator while (elems.hasNext) { val x = elems.next; if (p(x)) buf += x } buf.result } - + def map[s](f: t => s): m[s] = { val buf = accumulator[s] val elems = iterator while (elems.hasNext) buf += f(elems.next) buf.result } - + // flatMap is a more specialized map, it only works if the mapped function produces Iterable values, // which are then added to the result one by one // the compiler should be able to find the right accumulator (implicit buf) to build the result // to get concat, resColl = SingletonIterable, f = unit for SingletonIterable - def flatMap[resColl[+x] <: Iterable[x], s](f: t => resColl[s])(implicit buf: Accumulator[resColl, s]): resColl[s] = { + def flatMap[resColl[+x] <: Iterable[x], s](f: t => resColl[s])(implicit buf: Accumulator[resColl, s]): resColl[s] = { // TODO: would a viewbound for resColl[x] be better? // -- 2nd-order type params are not yet in scope in view bound val elems = iterator @@ -50,9 +50,9 @@ trait HOSeq { while (elemss.hasNext) buf += elemss.next } buf.result - } + } } - + final class ListBuffer[A] { private var start: List[A] = Nil private var last: ::[A] = _ @@ -80,7 +80,7 @@ trait HOSeq { exported = !start.isEmpty start } - + /** Clears the buffer contents. */ def clear { @@ -99,16 +99,16 @@ trait HOSeq { } } } - + implicit def listAccumulator[elT]: Accumulator[List, elT] = new Accumulator[List, elT] { private[this] val buff = new ListBuffer[elT] def += (el: elT): Unit = buff += el def result: List[elT] = buff.toList } - + trait List[+t] extends Iterable[t] { type m[+x] = List[x] - + def head: t def tail: List[t] def isEmpty: Boolean @@ -125,14 +125,14 @@ trait HOSeq { // construct an empty accumulator that will produce the same structure as this iterable, with elements of type t def accumulator[t]: Accumulator[List, t] = listAccumulator[t] } - + // TODO: the var tl approach does not seem to work because subtyping isn't fully working yet final case class ::[+b](hd: b, private val tl: List[b]) extends List[b] { def head = hd def tail = if(tl==null) this else tl // hack override def isEmpty: Boolean = false } - + case object Nil extends List[Nothing] { def isEmpty = true def head: Nothing = diff --git a/test/files/pos/ted.scala b/test/files/pos/ted.scala index d8ae64f29b..314f109328 100644 --- a/test/files/pos/ted.scala +++ b/test/files/pos/ted.scala @@ -9,7 +9,7 @@ object App case (b, e) => b * exponentiate(b, e - 1) } - + def main(args : Array[String]) = System.out.println(exponentiate(2, 2)) diff --git a/test/files/pos/test5.scala b/test/files/pos/test5.scala index b04de5d613..4dbafc9ac3 100644 --- a/test/files/pos/test5.scala +++ b/test/files/pos/test5.scala @@ -53,7 +53,7 @@ object test { // Check type j.P j.chk_ip(val_mp); - j.chk_ip(val_np); + j.chk_ip(val_np); // Check type i.X i.chk_ix(i.val_ix); @@ -63,6 +63,6 @@ object test { // Check j.X j.chk_ix(j.val_ix); j.chk_ix(j.val_jx); - j.chk_ix(val_njx); + j.chk_ix(val_njx); } } diff --git a/test/files/pos/test5refine.scala b/test/files/pos/test5refine.scala index 290449c3ed..5459b3b975 100644 --- a/test/files/pos/test5refine.scala +++ b/test/files/pos/test5refine.scala @@ -60,7 +60,7 @@ object test { // Check type j.P j.chk_ip(val_mp); - j.chk_ip(val_np); + j.chk_ip(val_np); // Check type i.X i.chk_ix(i.val_ix); @@ -70,6 +70,6 @@ object test { // Check j.X j.chk_ix(j.val_ix); j.chk_ix(j.val_jx); - j.chk_ix(val_njx); + j.chk_ix(val_njx); } } diff --git a/test/files/pos/testCoercionThis.scala b/test/files/pos/testCoercionThis.scala index 8bbfdcd684..5631b33306 100644 --- a/test/files/pos/testCoercionThis.scala +++ b/test/files/pos/testCoercionThis.scala @@ -11,9 +11,9 @@ object Test { // PP: is that something we really want to work? Seems like sketchville. // // These work, so I moved this out of pending. - def testCoercionThis1 = this.baz + def testCoercionThis1 = this.baz def testCoercionThis2 = (this: Foo).baz } - - class Bar { def baz = System.out.println("baz") } + + class Bar { def baz = System.out.println("baz") } } diff --git a/test/files/pos/thistypes.scala b/test/files/pos/thistypes.scala index 26339e07c4..7319cc1ecb 100644 --- a/test/files/pos/thistypes.scala +++ b/test/files/pos/thistypes.scala @@ -5,4 +5,4 @@ trait B { trait C extends B { def foo: C.this.I; -} +} diff --git a/test/files/pos/ticket0137.scala b/test/files/pos/ticket0137.scala index 72f955fe5e..94ef8e49fc 100644 --- a/test/files/pos/ticket0137.scala +++ b/test/files/pos/ticket0137.scala @@ -1,7 +1,7 @@ -trait AbsM { - abstract class MonadCompanion[M[_]] +trait AbsM { + abstract class MonadCompanion[M[_]] abstract class AbsMonadCompanion extends MonadCompanion[AM] { - def newTag: Int + def newTag: Int } type AM[_] // to trigger the bug, this must be an abstract type member that comes after the reference to it diff --git a/test/files/pos/trait-force-info.scala b/test/files/pos/trait-force-info.scala index e01d225c84..c2b33869c3 100644 --- a/test/files/pos/trait-force-info.scala +++ b/test/files/pos/trait-force-info.scala @@ -8,7 +8,7 @@ trait MyContextTrees { val self: Global val NoContext = self.analyzer.NoContext } -// +// // error: java.lang.AssertionError: assertion failed: trait Contexts.NoContext$ linkedModule: <none>List() // at scala.Predef$.assert(Predef.scala:160) // at scala.tools.nsc.symtab.classfile.ClassfileParser$innerClasses$.innerSymbol$1(ClassfileParser.scala:1211) diff --git a/test/files/pos/trait-parents.scala b/test/files/pos/trait-parents.scala index f6a2688751..c5908cdcd9 100644 --- a/test/files/pos/trait-parents.scala +++ b/test/files/pos/trait-parents.scala @@ -6,11 +6,11 @@ trait Quux object Test { def f(x: Bip) = 1 def g1(x: Foo with Bip) = f(x) - + def main(args: Array[String]): Unit = { - f(new Bip with Foo { }) + f(new Bip with Foo { }) f(new Foo with Bip { }) - g1(new Bip with Foo { }) + g1(new Bip with Foo { }) g1(new Foo with Bip { }) } } diff --git a/test/files/pos/traits.scala b/test/files/pos/traits.scala index bd64d7215a..3c6f9437a5 100644 --- a/test/files/pos/traits.scala +++ b/test/files/pos/traits.scala @@ -20,8 +20,8 @@ object Test { trait BorderedColoredShape extends Shape with Bordered with Colored { override def equals(other: Any) = other match { case that: BorderedColoredShape => ( - super.equals(that) && - super[Bordered].equals(that) && + super.equals(that) && + super[Bordered].equals(that) && super[Colored].equals(that)) case _ => false } diff --git a/test/files/pos/typealiases.scala b/test/files/pos/typealiases.scala index 5974921ed3..d03b521f77 100644 --- a/test/files/pos/typealiases.scala +++ b/test/files/pos/typealiases.scala @@ -3,18 +3,18 @@ package foo trait Test[T] { type Check[T] = Array[T] => Unit; type MyPair[S] = (T, S) - + val pair1: (T, Int) val pair: MyPair[Int] = pair1 - + def check(xs: Array[T], c: Check[T]) = c(xs) - def check2[S](xs: Array[S], c: Check[S]) = c(xs) -} + def check2[S](xs: Array[S], c: Check[S]) = c(xs) +} -object main extends Test[Int] { - val pair1 = (1,1) +object main extends Test[Int] { + val pair1 = (1,1) implicit def topair(x: Int): Pair[Int, Int] = (x,x) - val pair2: MyPair[Int] = 1 + val pair2: MyPair[Int] = 1 val x: Short = 1 } diff --git a/test/files/pos/unapplyNeedsMemberType.scala b/test/files/pos/unapplyNeedsMemberType.scala index 2581512a7b..b423257e04 100644 --- a/test/files/pos/unapplyNeedsMemberType.scala +++ b/test/files/pos/unapplyNeedsMemberType.scala @@ -8,7 +8,7 @@ trait Gunk[a] { def unapply(s: Seq) = unapply_Cons(s) } def unapply_Cons(s: Any): Option[Tuple2[a, Seq]] -} +} class Join[a] extends Gunk[a] { type Seq = JoinSeq diff --git a/test/files/pos/unapplySeq.scala b/test/files/pos/unapplySeq.scala index 4d5409c6f7..6d13cc8b52 100644 --- a/test/files/pos/unapplySeq.scala +++ b/test/files/pos/unapplySeq.scala @@ -4,7 +4,7 @@ object FooSeq { val y = x.asInstanceOf[Bar] Some(y.size, y.name) } else None - } + } def main(args:Array[String]) = { val b = new Bar diff --git a/test/files/pos/unapplyVal.scala b/test/files/pos/unapplyVal.scala index 0d6394a90f..368b9b9375 100644 --- a/test/files/pos/unapplyVal.scala +++ b/test/files/pos/unapplyVal.scala @@ -10,7 +10,7 @@ class Buffer { def joinPat(x: Any): Unit = { x match { - case Put => + case Put => case Put(y) => println("returning "+y) } @@ -29,7 +29,7 @@ object unapplyJoins extends App { // bug #1257 object Get extends Sync val jp: PartialFunction[Any, Any] = { - case Get() => + case Get() => } } diff --git a/test/files/pos/virtpatmat_castbinder.scala b/test/files/pos/virtpatmat_castbinder.scala index 53e937e866..be269638ce 100644 --- a/test/files/pos/virtpatmat_castbinder.scala +++ b/test/files/pos/virtpatmat_castbinder.scala @@ -6,7 +6,7 @@ trait IntMapIterator[V, T] { def valueOf(tip: Tip[V]): T def pop: IntMap[V] - def next: T = + def next: T = pop match { case Bin(t@Tip(_)) => { valueOf(t) diff --git a/test/files/pos/virtpatmat_exist1.scala b/test/files/pos/virtpatmat_exist1.scala index ccb91299db..6cad017b0b 100644 --- a/test/files/pos/virtpatmat_exist1.scala +++ b/test/files/pos/virtpatmat_exist1.scala @@ -13,7 +13,7 @@ object Test { // without type ascription for the one in the body of the last flatmap of each alternative, type inference borks on the existentials // def splitArray[T >: Nothing <: Any](ad: Array[Iterable[T]]): Any = { import OptionMatching._ // runOrElse(ad.apply(0))(((x1: Iterable[T]) => ( - // or(((x4: Iterable[T]) => one(null)), + // or(((x4: Iterable[T]) => one(null)), // guard(x1.isInstanceOf[Iterable[T] with Test.HashMapCollision1[_,_]], x1.asInstanceOf[Iterable[T] with Test.HashMapCollision1[_,_]]).flatMap(((x2: Iterable[T] with Test.HashMapCollision1[_,_]) => one(x2))), // guard(x1.isInstanceOf[Test.HashSetCollision1[_]], x1.asInstanceOf[Iterable[T] with Test.HashSetCollision1[_]]).flatMap(((x3: Iterable[T] with Test.HashSetCollision1[_]) => one(x3)))): Option[Any]).orElse( // (zero: Option[Any]))) diff --git a/test/files/pos/virtpatmat_exist2.scala b/test/files/pos/virtpatmat_exist2.scala index b0e4c667b7..ee186074ab 100644 --- a/test/files/pos/virtpatmat_exist2.scala +++ b/test/files/pos/virtpatmat_exist2.scala @@ -9,11 +9,11 @@ object Test { // what's the _$1 doing there? // def grow[T >: Nothing <: Any]: ParseResult[T] = { // import OptionMatching._ - // runOrElse[MemoEntry[T], ParseResult[T]]((null: MemoEntry[T]))(((x1: MemoEntry[T]) => - // (MemoEntry.unapply[T](x1).flatMap[ParseResult[T]](((x4: Either[Nothing,ParseResult[_]]) => - // guard[Right[Nothing,ParseResult[_]]](x4.isInstanceOf[Right[Nothing,ParseResult[_]]], x4.asInstanceOf[Right[Nothing,ParseResult[_]]]).flatMap[ParseResult[T]](((cp3: Right[Nothing,ParseResult[_]]) => - // scala.Right.unapply[Nothing, ParseResult[_]](cp3).flatMap[ParseResult[T]](((x5: ParseResult[_]) => - // guard[ParseResult[_$1]](x5.ne(null), x5.asInstanceOf[ParseResult[_]]).flatMap[ParseResult[T]](((x6: ParseResult[_]) => + // runOrElse[MemoEntry[T], ParseResult[T]]((null: MemoEntry[T]))(((x1: MemoEntry[T]) => + // (MemoEntry.unapply[T](x1).flatMap[ParseResult[T]](((x4: Either[Nothing,ParseResult[_]]) => + // guard[Right[Nothing,ParseResult[_]]](x4.isInstanceOf[Right[Nothing,ParseResult[_]]], x4.asInstanceOf[Right[Nothing,ParseResult[_]]]).flatMap[ParseResult[T]](((cp3: Right[Nothing,ParseResult[_]]) => + // scala.Right.unapply[Nothing, ParseResult[_]](cp3).flatMap[ParseResult[T]](((x5: ParseResult[_]) => + // guard[ParseResult[_$1]](x5.ne(null), x5.asInstanceOf[ParseResult[_]]).flatMap[ParseResult[T]](((x6: ParseResult[_]) => // one[ParseResult[T]](x6.asInstanceOf[ParseResult[T]]))))))))): Option[ParseResult[T]] // ).orElse[ParseResult[T]]((zero: Option[ParseResult[T]])))) // } diff --git a/test/files/pos/virtpatmat_exist3.scala b/test/files/pos/virtpatmat_exist3.scala index c8f873878f..94385f32c9 100644 --- a/test/files/pos/virtpatmat_exist3.scala +++ b/test/files/pos/virtpatmat_exist3.scala @@ -4,8 +4,8 @@ class ReferenceQueue[T] { case null => null } - // def wrapper(jref: ReferenceQueue[_]): ReferenceQueue[T] = OptionMatching.runOrElse(jref)(((x1: ReferenceQueue[_]) => - // (OptionMatching.guard(null.==(x1), x1.asInstanceOf[ReferenceQueue[_]]).flatMap(((x2: ReferenceQueue[_]) => + // def wrapper(jref: ReferenceQueue[_]): ReferenceQueue[T] = OptionMatching.runOrElse(jref)(((x1: ReferenceQueue[_]) => + // (OptionMatching.guard(null.==(x1), x1.asInstanceOf[ReferenceQueue[_]]).flatMap(((x2: ReferenceQueue[_]) => // OptionMatching.one(null))): Option[ReferenceQueue[T]]).orElse( // (OptionMatching.zero: Option[ReferenceQueue[T]]))) // ) diff --git a/test/files/pos/virtpatmat_gadt_array.scala b/test/files/pos/virtpatmat_gadt_array.scala index 27e72aa03e..f3332a897f 100644 --- a/test/files/pos/virtpatmat_gadt_array.scala +++ b/test/files/pos/virtpatmat_gadt_array.scala @@ -4,12 +4,12 @@ object Test { case x: Array[AnyRef] => refArrayOps[AnyRef](x).asInstanceOf[ArrayOps[T]] case null => null } - // def genericArrayOps[T >: Nothing <: Any](xs: Array[T]): scala.collection.mutable.ArrayOps[T] - // = OptionMatching.runOrElse(xs)(((x1: Array[T]) => - // ((OptionMatching.guard(x1.isInstanceOf[Array[AnyRef]], x1.asInstanceOf[Array[T] with Array[AnyRef]]).flatMap(((x2: Array[T] with Array[AnyRef]) => + // def genericArrayOps[T >: Nothing <: Any](xs: Array[T]): scala.collection.mutable.ArrayOps[T] + // = OptionMatching.runOrElse(xs)(((x1: Array[T]) => + // ((OptionMatching.guard(x1.isInstanceOf[Array[AnyRef]], x1.asInstanceOf[Array[T] with Array[AnyRef]]).flatMap(((x2: Array[T] with Array[AnyRef]) => // OptionMatching.one(Test.this.refArrayOps[AnyRef](x2).asInstanceOf[scala.collection.mutable.ArrayOps[T]]))): Option[scala.collection.mutable.ArrayOps[T]]).orElse( - // (OptionMatching.guard(null.==(x1), x1.asInstanceOf[Array[T]]).flatMap(((x3: Array[T]) => + // (OptionMatching.guard(null.==(x1), x1.asInstanceOf[Array[T]]).flatMap(((x3: Array[T]) => // OptionMatching.one(null))): Option[scala.collection.mutable.ArrayOps[T]])): Option[scala.collection.mutable.ArrayOps[T]]).orElse((OptionMatching.zero: Option[scala.collection.mutable.ArrayOps[T]])))) - + def refArrayOps[T <: AnyRef](xs: Array[T]): ArrayOps[T] = new ArrayOps.ofRef[T](xs) }
\ No newline at end of file diff --git a/test/files/positions/Anon.scala b/test/files/positions/Anon.scala index 65eb7ae477..940fff035a 100644 --- a/test/files/positions/Anon.scala +++ b/test/files/positions/Anon.scala @@ -2,7 +2,7 @@ object Anon { trait Foo { val bar : Int } - + def foo = new Foo { override val bar = 23 } diff --git a/test/files/positions/Enclosing1.scala b/test/files/positions/Enclosing1.scala index 7c8fbaf4a0..e170187d60 100644 --- a/test/files/positions/Enclosing1.scala +++ b/test/files/positions/Enclosing1.scala @@ -1,5 +1,5 @@ object Enclosing1 { do { - + } while (true) } diff --git a/test/files/positions/ExcludedPrefix1.scala b/test/files/positions/ExcludedPrefix1.scala index 72d9756b2a..f3562c37f0 100644 --- a/test/files/positions/ExcludedPrefix1.scala +++ b/test/files/positions/ExcludedPrefix1.scala @@ -5,16 +5,16 @@ object ExcludedPrefix1 { case object BLAH - + val a = 1 - + var b = 2 - + def c = 23 - + private def d = 23 @@ -22,19 +22,19 @@ object ExcludedPrefix1 { lazy val e = 23 - + private type f = Int - + val g, h = 23 - + val (i, j) = (0, 0) - + val Pair( k, l) = (0, 0) diff --git a/test/files/positions/Overlap3.scala b/test/files/positions/Overlap3.scala index 657c12d4fd..4c5f8af9d1 100644 --- a/test/files/positions/Overlap3.scala +++ b/test/files/positions/Overlap3.scala @@ -1,3 +1,3 @@ object Overlap3 { - val (a, b) = (0, 0) + val (a, b) = (0, 0) } diff --git a/test/files/positions/Scaladoc2.scala b/test/files/positions/Scaladoc2.scala index 78bc4acb28..e52263d86c 100644 --- a/test/files/positions/Scaladoc2.scala +++ b/test/files/positions/Scaladoc2.scala @@ -4,13 +4,13 @@ object Scaladoc2 { * Foo */ def g {} - + /* * Blah blah */ def h{} h } - + def h {} } diff --git a/test/files/positions/Scaladoc3.scala b/test/files/positions/Scaladoc3.scala index bb9d66fdb4..c331b7e396 100644 --- a/test/files/positions/Scaladoc3.scala +++ b/test/files/positions/Scaladoc3.scala @@ -3,6 +3,6 @@ object Scaladoc3 { * Foo */ import scala.collection.mutable.ArrayBuffer - + def f {} } diff --git a/test/files/positions/Scaladoc4.scala b/test/files/positions/Scaladoc4.scala index f613dda7f5..133cde1c85 100644 --- a/test/files/positions/Scaladoc4.scala +++ b/test/files/positions/Scaladoc4.scala @@ -3,6 +3,6 @@ object Scaladoc4 { * Foo */ 2+2 - + def f {} } diff --git a/test/files/positions/Scaladoc6.scala b/test/files/positions/Scaladoc6.scala index 5c230edeb2..8beda625ae 100644 --- a/test/files/positions/Scaladoc6.scala +++ b/test/files/positions/Scaladoc6.scala @@ -5,6 +5,6 @@ object Scaladoc6 { */ val i = 23 } - + def f {} } diff --git a/test/files/presentation/callcc-interpreter/src/CallccInterpreter.scala b/test/files/presentation/callcc-interpreter/src/CallccInterpreter.scala index 0e96dfaa05..ce3b996b96 100644 --- a/test/files/presentation/callcc-interpreter/src/CallccInterpreter.scala +++ b/test/files/presentation/callcc-interpreter/src/CallccInterpreter.scala @@ -2,8 +2,8 @@ object callccInterpreter { type Answer = Value - /** - * A continuation monad. + /** + * A continuation monad. */ case class M[A](in: (A => Answer) => Answer) { def bind[B](k: A => M[B]) = M[B](c => in (a => k(a) in c)) diff --git a/test/files/presentation/hyperlinks/Runner.scala b/test/files/presentation/hyperlinks/Runner.scala index 61da49a3d7..b78e13c23a 100644 --- a/test/files/presentation/hyperlinks/Runner.scala +++ b/test/files/presentation/hyperlinks/Runner.scala @@ -7,5 +7,5 @@ object Test extends InteractiveTest { sourceFiles foreach (src => askLoadedTyped(src).get) super.runDefaultTests() } - + }
\ No newline at end of file diff --git a/test/files/presentation/hyperlinks/src/NameDefaultTests.scala b/test/files/presentation/hyperlinks/src/NameDefaultTests.scala index b218040fe3..340d223d2e 100644 --- a/test/files/presentation/hyperlinks/src/NameDefaultTests.scala +++ b/test/files/presentation/hyperlinks/src/NameDefaultTests.scala @@ -2,11 +2,11 @@ class NameDefaults { val someString = "abc" val someInt = 42 - + def foo(x: String, y: Int)(implicit logger: Int): Int = y - + implicit val l = 42 - + def bar { println() val someOtherInt = 10 diff --git a/test/files/presentation/hyperlinks/src/PatMatTests.scala b/test/files/presentation/hyperlinks/src/PatMatTests.scala index bbd0f2e7ed..7184106357 100644 --- a/test/files/presentation/hyperlinks/src/PatMatTests.scala +++ b/test/files/presentation/hyperlinks/src/PatMatTests.scala @@ -6,22 +6,22 @@ case class CaseOne(x: Int, y: List[Int]) extends BaseType case class CaseTwo(str: String) extends BaseType class PatMatTests { - + def foo(x: BaseType) { x match { case CaseOne/*#*/(10, first :: second :: Nil) => val tmp = 23 println(first/*#*/) println(tmp/*#*/) - + case CaseTwo/*#*/(mystring) => println(mystring/*#*/) } } - + def multipleAssign() { val (x, y) = ("abc", "def") - + println(x/*#*/, y/*#*/) } diff --git a/test/files/presentation/ide-bug-1000475/src/Foo.scala b/test/files/presentation/ide-bug-1000475/src/Foo.scala index b963bb7a88..5dd6b7d00d 100644 --- a/test/files/presentation/ide-bug-1000475/src/Foo.scala +++ b/test/files/presentation/ide-bug-1000475/src/Foo.scala @@ -1,7 +1,7 @@ class Foo { val v = new Object v.toS/*!*/ - + val m = Map(1 -> new Object) m(1).toS/*!*/ m(1)./*!*/ diff --git a/test/files/presentation/ide-bug-1000531/src/CrashOnLoad.scala b/test/files/presentation/ide-bug-1000531/src/CrashOnLoad.scala index 21d39c8923..878bbfa19e 100644 --- a/test/files/presentation/ide-bug-1000531/src/CrashOnLoad.scala +++ b/test/files/presentation/ide-bug-1000531/src/CrashOnLoad.scala @@ -1,7 +1,7 @@ /** When this files is opened within the IDE, a typing error is reported. */ class A[B] extends java.lang.Iterable[B] { import scala.collection.JavaConversions._ - def iterator = Iterator.empty - + def iterator = Iterator.empty + iterator. /*!*/ }
\ No newline at end of file diff --git a/test/files/presentation/ide-t1001326/Test.scala b/test/files/presentation/ide-t1001326/Test.scala index 3091da4b40..ff63b9770a 100644 --- a/test/files/presentation/ide-t1001326/Test.scala +++ b/test/files/presentation/ide-t1001326/Test.scala @@ -3,7 +3,7 @@ import scala.reflect.internal.util.SourceFile import scala.tools.nsc.interactive.Response object Test extends InteractiveTest { - + override def execute(): Unit = { val sf = sourceFiles.find(_.file.name == "A.scala").head uniqueParseTree_t1001326(sf) @@ -11,7 +11,7 @@ object Test extends InteractiveTest { neverModifyParseTree_t1001326(sf) shouldAlwaysReturnParseTree_t1001326(sf) } - + /** * Asking twice for a parseTree on the same source should always return a new tree */ @@ -24,7 +24,7 @@ object Test extends InteractiveTest { reporter.println("Unique FAILED") } } - + /** * A parseTree should never contain any symbols or types */ @@ -35,10 +35,10 @@ object Test extends InteractiveTest { reporter.println("Unattributed FAILED") } } - + /** * Once you have obtained a parseTree it should never change - */ + */ private def neverModifyParseTree_t1001326(sf: SourceFile) { val parsedTree = compiler.parseTree(sf) loadSourceAndWaitUntilTypechecked(sf) @@ -48,7 +48,7 @@ object Test extends InteractiveTest { reporter.println("NeverModify FAILED") } } - + /** * Should always return a parse tree */ @@ -60,7 +60,7 @@ object Test extends InteractiveTest { reporter.println("AlwaysParseTree FAILED") } } - + /** * Load a source and block while it is type-checking. */ @@ -71,7 +71,7 @@ object Test extends InteractiveTest { res.get askLoadedTyped(sf).get } - + /** * Traverses a tree and makes sure that there are no types or symbols present in the tree with * the exception of the symbol for the package 'scala'. This is because that symbol will be @@ -79,13 +79,13 @@ object Test extends InteractiveTest { */ private def noSymbolsOrTypes(tree: compiler.Tree): Boolean = { tree.forAll { t => - (t.symbol == null || - t.symbol == compiler.NoSymbol || + (t.symbol == null || + t.symbol == compiler.NoSymbol || t.symbol == compiler.definitions.ScalaPackage // ignore the symbol for the scala package for now ) && ( - t.tpe == null || + t.tpe == null || t.tpe == compiler.NoType) } } - + }
\ No newline at end of file diff --git a/test/files/presentation/implicit-member/src/ImplicitMember.scala b/test/files/presentation/implicit-member/src/ImplicitMember.scala index 06732f6dc6..a547b65a8e 100644 --- a/test/files/presentation/implicit-member/src/ImplicitMember.scala +++ b/test/files/presentation/implicit-member/src/ImplicitMember.scala @@ -1,8 +1,8 @@ object Implicit { final class AppliedImplicit[A](val x: A) - + implicit def AppliedImplicit[A](x: A): AppliedImplicit[A] = new AppliedImplicit(x) - + this./*!*/x }
\ No newline at end of file diff --git a/test/files/presentation/ping-pong/src/PingPong.scala b/test/files/presentation/ping-pong/src/PingPong.scala index 08bb4e3f2d..94f52c4658 100644 --- a/test/files/presentation/ping-pong/src/PingPong.scala +++ b/test/files/presentation/ping-pong/src/PingPong.scala @@ -2,21 +2,21 @@ class Ping { val pong = new Pong(this) - + def name = "ping" - def loop/*?*/ { poke() } - + def loop/*?*/ { poke() } + def poke/*?*/ { pong./*!*/poke() } - - override def toString = name + + override def toString = name } class Pong(ping: Ping) { val name/*?*/ = "pong" - + def poke() { ping./*!*/poke() } - + override def toString = name }
\ No newline at end of file diff --git a/test/files/presentation/random/src/Random.scala b/test/files/presentation/random/src/Random.scala index 4fff783fa4..af76a28f47 100644 --- a/test/files/presentation/random/src/Random.scala +++ b/test/files/presentation/random/src/Random.scala @@ -4,16 +4,16 @@ import java.io._ import java.net.{InetAddress,ServerSocket,Socket,SocketException} import java.util.Random -/** - * Simple client/server application using Java sockets. - * - * The server simply generates random integer values and - * the clients provide a filter function to the server - * to get only values they interested in (eg. even or - * odd values, and so on). +/** + * Simple client/server application using Java sockets. + * + * The server simply generates random integer values and + * the clients provide a filter function to the server + * to get only values they interested in (eg. even or + * odd values, and so on). */ object randomclient { - + def main(args: Array[String]) { val filter/*?*/ = try { Integer.parseInt(args(0)/*?*/) match { diff --git a/test/files/presentation/visibility/src/Completions.scala b/test/files/presentation/visibility/src/Completions.scala index 098b98a0fd..8c07934915 100644 --- a/test/files/presentation/visibility/src/Completions.scala +++ b/test/files/presentation/visibility/src/Completions.scala @@ -22,7 +22,7 @@ package accessibility { this./*!*/ // should not list secretPrivate* } } - + class UnrelatedClass { def someTests(foo: Foo) { foo./*!*/ // should list public and protected[accessiblity] diff --git a/test/files/res/t597/Test.scala b/test/files/res/t597/Test.scala index 45b90bb17d..2f63f46c3d 100644 --- a/test/files/res/t597/Test.scala +++ b/test/files/res/t597/Test.scala @@ -2,7 +2,7 @@ package test; abstract class Base { type A <: Ax; - + abstract class Ax { def a = null; def string = "A"; diff --git a/test/files/res/t722/Parser.scala b/test/files/res/t722/Parser.scala index 9f54358920..5dfcd57367 100644 --- a/test/files/res/t722/Parser.scala +++ b/test/files/res/t722/Parser.scala @@ -2,7 +2,7 @@ package t722; trait Parser { trait Link { - def foo() = {} + def foo() = {} } } diff --git a/test/files/res/t735/ScalaExpressions.scala b/test/files/res/t735/ScalaExpressions.scala index 605ad51c08..f9c8ac733c 100644 --- a/test/files/res/t735/ScalaExpressions.scala +++ b/test/files/res/t735/ScalaExpressions.scala @@ -1,6 +1,6 @@ package t735; trait ScalaExpressions { - trait ExpressionFactory { + trait ExpressionFactory { def foo = 10; def bar : Int; } diff --git a/test/files/res/t743/BracesXXX.scala b/test/files/res/t743/BracesXXX.scala index d3f6e28fe9..ed7b386a88 100644 --- a/test/files/res/t743/BracesXXX.scala +++ b/test/files/res/t743/BracesXXX.scala @@ -1,6 +1,6 @@ package t743; trait BracesXXX extends ParserXXX { - trait Matchable extends IsLinked { + trait Matchable extends IsLinked { def foo : NodeImpl = null; } } diff --git a/test/files/res/t743/ParserXXX.scala b/test/files/res/t743/ParserXXX.scala index fd584b972a..d132bdbf1d 100644 --- a/test/files/res/t743/ParserXXX.scala +++ b/test/files/res/t743/ParserXXX.scala @@ -1,9 +1,9 @@ package t743; trait ParserXXX { - val foo = null; - trait NodeImpl { + val foo = null; + trait NodeImpl { trait Link extends ParserXXX.this.Link { - val from = null; + val from = null; } } trait Link { diff --git a/test/files/res/t785/ScalaNewTyper.scala b/test/files/res/t785/ScalaNewTyper.scala index 919e3b8d0e..acdba0f25d 100644 --- a/test/files/res/t785/ScalaNewTyper.scala +++ b/test/files/res/t785/ScalaNewTyper.scala @@ -1,7 +1,7 @@ package t785; trait ScalaNewTyper { private var typed : String = null; - trait HasSymbol { + trait HasSymbol { protected def foo() : Unit = {} } trait HasArgsTypeParametersImpl extends HasSymbol { diff --git a/test/files/res/t831/NewScalaParserXXX.scala b/test/files/res/t831/NewScalaParserXXX.scala index ed9b9d3b6f..958e4f99c1 100644 --- a/test/files/res/t831/NewScalaParserXXX.scala +++ b/test/files/res/t831/NewScalaParserXXX.scala @@ -10,33 +10,33 @@ trait ScalaNodeScannerXXX { //for (ns <-n; val i <- 0.until(ns)) yield f; -trait NewScalaScannerXXX extends ScalaNodeScannerXXX { +trait NewScalaScannerXXX extends ScalaNodeScannerXXX { type Unfixed <: Node with UnfixedImpl; trait UnfixedImpl extends super.UnfixedImpl with NodeImpl; type Statement <: Unfixed with StatementImpl; trait StatementImpl extends UnfixedImpl { def self : Statement; } type NewLine <: Statement with NewLineImpl; - trait NewLineImpl extends StatementImpl { - def self : NewLine; + trait NewLineImpl extends StatementImpl { + def self : NewLine; def isActive : Boolean = true; } object ArrowMode extends Enumeration { val Def, Case, Expr = Value } } -trait ScalaPrecedenceXXX extends NewScalaScannerXXX { +trait ScalaPrecedenceXXX extends NewScalaScannerXXX { type NewLine <: Statement with NewLineImpl; - trait NewLineImpl extends super.NewLineImpl with StatementImpl { - def self : NewLine; + trait NewLineImpl extends super.NewLineImpl with StatementImpl { + def self : NewLine; override def isActive = super[NewLineImpl].isActive; } } trait NewScalaParserXXX extends NewScalaScannerXXX with ScalaPrecedenceXXX { type NewLine <: Statement with NewLineImpl; trait MyNewLine extends super[NewScalaScannerXXX].NewLineImpl; - trait NewLineImpl extends MyNewLine with + trait NewLineImpl extends MyNewLine with super[ScalaPrecedenceXXX].NewLineImpl with - StatementImpl { - def self : NewLine; + StatementImpl { + def self : NewLine; override def isActive = super[MyNewLine].isActive; } } diff --git a/test/files/run/Course-2002-02.scala b/test/files/run/Course-2002-02.scala index 56d7298aaf..b8650108ed 100644 --- a/test/files/run/Course-2002-02.scala +++ b/test/files/run/Course-2002-02.scala @@ -100,7 +100,7 @@ object M4 { def sumInts = sum(x => x) def sumCubes = sum(x => x * x * x) - def sumReciprocals = sum(1.0/_) + def sumReciprocals = sum(1.0/_) def sumPi = { n: Int => 4 + sum(x => 4.0/(4*x+1) - 4.0/(4*x-1))(1, n) } Console.println(sumInts(1,4)) @@ -194,7 +194,7 @@ object M8 { //############################################################################ object M9 { - def accumulate[t](combiner: (t, t) => t, nullValue: t, f: Int => t, + def accumulate[t](combiner: (t, t) => t, nullValue: t, f: Int => t, next: Int => Int)(a: Int, b: Int): t = if (a > b) nullValue else combiner(f(a), accumulate(combiner, nullValue, f, next)(next(a), b)) @@ -328,9 +328,9 @@ object MD { iter(a, zero) } - def plus (x:Double,y:Double) = x+y; + def plus (x:Double,y:Double) = x+y; val sum: (Int => Double) => (Int, Int) => Double = reduce(plus , 0); - def times(x:Double,y:Double) = x*y; + def times(x:Double,y:Double) = x*y; val product: (Int => Double) => (Int, Int) => Double = reduce(times, 1); def factorial(n: Int) = product(x => x)(1 , n) diff --git a/test/files/run/Course-2002-05.scala b/test/files/run/Course-2002-05.scala index 9457fae147..e6764b92c8 100644 --- a/test/files/run/Course-2002-05.scala +++ b/test/files/run/Course-2002-05.scala @@ -129,7 +129,7 @@ object M3 { else { def isSafe(column: Int, placement: Placement): Boolean = placement forall { - pos => (pos._2 != column && + pos => (pos._2 != column && abs(pos._2 - column) != row - pos._1) } diff --git a/test/files/run/OrderingTest.scala b/test/files/run/OrderingTest.scala index 53448fbbce..8af18aaba5 100644 --- a/test/files/run/OrderingTest.scala +++ b/test/files/run/OrderingTest.scala @@ -6,7 +6,7 @@ object Test extends App { assert((cmp == 0) == (cmp2 == 0)) assert((cmp > 0) == (cmp2 < 0)) assert((cmp < 0) == (cmp2 > 0)) - } + } def testAll[T](t1 : T, t2 : T)(implicit ord : Ordering[T]) = { assert(ord.compare(t1, t2) < 0) @@ -16,8 +16,8 @@ object Test extends App { } assert(Ordering[String].compare("australopithecus", "brontausaurus") < 0) - // assert(Ordering[Unit].compare((), ()) == 0) - + // assert(Ordering[Unit].compare((), ()) == 0) + testAll("bar", "foo"); testAll[Byte](0, 1); testAll(false, true) @@ -28,7 +28,7 @@ object Test extends App { testAll[Iterable[Int]](List(1, 2), List(2)); testAll((1, "bar"), (1, "foo")) testAll((1, "foo"), (2, "bar")) - + // sortBy val words = "The quick brown fox jumped over the lazy dog".split(' ') val result = words.sortBy(x => (x.length, x.head)) diff --git a/test/files/run/ReplacementMatching.scala b/test/files/run/ReplacementMatching.scala index faa46419dc..05040d98a3 100644 --- a/test/files/run/ReplacementMatching.scala +++ b/test/files/run/ReplacementMatching.scala @@ -7,12 +7,12 @@ import util.matching._ object Test { - + def main(args: Array[String]) { replacementMatching groupsMatching } - + def replacementMatching { val regex = """\$\{(.+?)\}""".r val replaced = regex.replaceAllIn("Replacing: ${main}. And another method: ${foo}.", @@ -21,7 +21,7 @@ object Test { identifier }) assert(replaced == "Replacing: main. And another method: foo.") - + val regex3 = """\$\{(.+?)\}""".r val replaced3 = regex3.replaceSomeIn("Replacing: ${main}. And another: ${foo}.", (m: util.matching.Regex.Match) => { val id = m.group(1) @@ -29,7 +29,7 @@ object Test { }) assert(replaced3 == "Replacing: main. And another: ${foo}.") } - + def groupsMatching { val Date = """(\d+)/(\d+)/(\d+)""".r for (Regex.Groups(a, b, c) <- Date findFirstMatchIn "1/1/2001 marks the start of the millenium. 31/12/2000 doesn't.") { @@ -43,5 +43,5 @@ object Test { assert(c == "2001" || c == "2000") } } - + } diff --git a/test/files/run/ReverseSeqView.scala b/test/files/run/ReverseSeqView.scala index 517f1cc24c..2004791bff 100644 --- a/test/files/run/ReverseSeqView.scala +++ b/test/files/run/ReverseSeqView.scala @@ -5,14 +5,14 @@ object Test extends App { - + val lstv = List(1, 2, 3).view val lstvr = lstv.reverse assert(lstvr.iterator.toList == List(3, 2, 1)) assert(lstvr.reverse == List(1, 2, 3)) assert(lstvr.reverseIterator.toList == List(1, 2, 3)) assert(lstvr.reverseMap(_ + 1) == List(2, 3, 4)) - + } diff --git a/test/files/run/UnrolledBuffer.scala b/test/files/run/UnrolledBuffer.scala index fe08e812ac..62a1f7d083 100644 --- a/test/files/run/UnrolledBuffer.scala +++ b/test/files/run/UnrolledBuffer.scala @@ -7,12 +7,12 @@ import collection.mutable.UnrolledBuffer object Test { - + def main(args: Array[String]) { val u1 = new UnrolledBuffer[Int] assert(u1.isEmpty) assert(u1.size == 0) - + u1 += 1 u1 += 2 u1 += 3 @@ -20,11 +20,11 @@ object Test { assert(u1.toList == List(1, 2, 3)) assert(u1.nonEmpty) assert(u1.size == 3) - + u1.clear assert(u1.isEmpty) assert(u1.size == 0) - + u1 += 1 u1 += 2 u1 += 3 @@ -33,56 +33,56 @@ object Test { assert(u1.size == 2) assert(u1 == UnrolledBuffer(1, 3)) assert(u1.toList == List(1, 3)) - + u1 concat UnrolledBuffer(5, 7, 9) assert(u1 == UnrolledBuffer(1, 3, 5, 7, 9)) - + val u2 = u1 map { x => (x - 1) / 2 } assert(u2 == UnrolledBuffer(0, 1, 2, 3, 4)) - + u1.clear u2.clear assert(u1.size == 0) assert(u2.size == 0) - + for (i <- 0 until 500) u1 += i for (i <- 500 until 1000) u2 += i assert(u1.size == 500) assert(u2.size == 500) assert(u1.iterator.toList == (0 until 500).toList) assert((for (elem <- u1) yield elem) sameElements (0 until 500)) - + u1 concat u2 assert(u1.size == 1000) assert(u2.size == 0) assertCorrect(u1) - + u1 concat UnrolledBuffer() assertCorrect(u1) - + val u3 = u1 map { x => x } var i = 0 for (elem <- u1) { assert(elem == u3(i)) i += 1 } - + u1.remove(999) assert(u1.size == 999) assertCorrect(u1) - + u1.remove(500) assert(u1.size == 998) assertCorrect(u1) - + u1.remove(5) assert(u1.size == 997) assertCorrect(u1) - + u1.remove(0) assert(u1.size == 996) assertCorrect(u1) - + u1.insert(0, 0) assert(u1.size == 997) assertCorrect(u1) @@ -90,15 +90,15 @@ object Test { u1.insert(5, 5) assert(u1.size == 998) assertCorrect(u1) - + u1.insert(500, 500) assert(u1.size == 999) assertCorrect(u1) - + u1.insert(999, 999) assert(u1.size == 1000) assertCorrect(u1) - + for (i <- -100 until 0) { i +=: u1 assertCorrect(u1) @@ -106,7 +106,7 @@ object Test { assert(u1.size == 1100) assertCorrect(u1) } - + def assertCorrect(u1: UnrolledBuffer[Int]) { val sz = u1.size val store = new Array[Int](sz) @@ -117,9 +117,9 @@ object Test { for (i <- 0 until sz) assert(u1(i) == (sz - i)) for (i <- 0 until sz) u1(i) = store(i) for (i <- 0 until sz) assert(store(i) == u1(i)) - + assert((u1 map { x => x }) == u1) assert(u1.iterator.toSeq.size == u1.size) } - + } diff --git a/test/files/run/WeakHashSetTest.scala b/test/files/run/WeakHashSetTest.scala index 3c8f380150..8072aa9b84 100644 --- a/test/files/run/WeakHashSetTest.scala +++ b/test/files/run/WeakHashSetTest.scala @@ -33,7 +33,7 @@ package scala.reflect.internal.util { def checkEmpty { val hs = new WeakHashSet[String]() assert(hs.size == 0) - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate } // make sure += works @@ -85,7 +85,7 @@ package scala.reflect.internal.util { val hs = new WeakHashSet[Collider]() val elements = (0 until size).toList map {x => Collider("a" + x)} elements foreach (hs += _) - // don't throw the following into a retained collection so gc + // don't throw the following into a retained collection so gc // can remove them for (i <- 0 until size) { hs += Collider("b" + i) @@ -150,9 +150,9 @@ package scala.reflect.internal.util { hs.clear() assert(hs.size == 0) elements foreach {i => assert(!(hs contains i))} - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate } - + // check that the iterator covers all the contents def checkIterator { val hs = new WeakHashSet[String]() @@ -161,14 +161,14 @@ package scala.reflect.internal.util { assert(elements.iterator.toList.sorted == elements.sorted) hs.diagnostics.fullyValidate } - + // check that the iterator covers all the contents even when there is a collision def checkIteratorCollisions { val hs = new WeakHashSet[Collider] val elements = (0 until 20).toList map {x => Collider("a" + x)} elements foreach (hs += _) - assert(elements.iterator.toList.sorted == elements.sorted) + assert(elements.iterator.toList.sorted == elements.sorted) hs.diagnostics.fullyValidate } } -} +} diff --git a/test/files/run/absoverride.scala b/test/files/run/absoverride.scala index 8c6de09d2a..a3c03df0d7 100644 --- a/test/files/run/absoverride.scala +++ b/test/files/run/absoverride.scala @@ -26,16 +26,16 @@ trait SyncIterator extends AbsIterator { } } trait LoggedIterator extends AbsIterator { - abstract override def next: T = { - val x = super.next; println("log: " + x); x + abstract override def next: T = { + val x = super.next; println("log: " + x); x } } -class Iter2(s: String) extends StringIterator(s) - with SyncIterator with LoggedIterator; +class Iter2(s: String) extends StringIterator(s) + with SyncIterator with LoggedIterator; object Test { def main(args: Array[String]) { class Iter extends StringIterator(args(0)) with RichIterator with SyncIterator with LoggedIterator val iter = new Iter - iter foreach Console.println + iter foreach Console.println } } diff --git a/test/files/run/annotatedRetyping.scala b/test/files/run/annotatedRetyping.scala index cf1b0f27b5..9b9ebd5a1e 100644 --- a/test/files/run/annotatedRetyping.scala +++ b/test/files/run/annotatedRetyping.scala @@ -40,7 +40,7 @@ object Test extends DirectTest { defTree match { case impl: Template => templates += typer.context.owner -> (impl, typer) - + case dd: DefDef if dd.symbol.isPrimaryConstructor && templates.contains(dd.symbol.owner) => val (impl, templTyper) = templates(dd.symbol.owner) for (stat <- impl.body.filterNot(_.isDef)) { @@ -50,7 +50,7 @@ object Test extends DirectTest { tpr.typed(stat) } - case _ => + case _ => } tpe } diff --git a/test/files/run/array-existential-bound.scala b/test/files/run/array-existential-bound.scala index b397c98111..cc105d8fcd 100644 --- a/test/files/run/array-existential-bound.scala +++ b/test/files/run/array-existential-bound.scala @@ -7,7 +7,7 @@ object Test extends Fooz[Array[Int]] { val f2 = new Fooz[Array[Int]] { } val f3 = new Fooz[Array[Any]] { } val f4 = new Fooz[Array[_]] { } - + def main(args: Array[String]): Unit = { println(f1.f0(Array[String]("a", "b"))) println(f2.f0((1 to 1000).toArray)) diff --git a/test/files/run/arrayclone-old.scala b/test/files/run/arrayclone-old.scala index c9f7556b47..fbca38b42e 100644 --- a/test/files/run/arrayclone-old.scala +++ b/test/files/run/arrayclone-old.scala @@ -16,7 +16,7 @@ object BooleanArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = false; - assert(it(0) == true) + assert(it(0) == true) } object ByteArrayClone{ @@ -24,7 +24,7 @@ object ByteArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object ShortArrayClone{ @@ -32,7 +32,7 @@ object ShortArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object CharArrayClone{ @@ -40,7 +40,7 @@ object CharArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object IntArrayClone{ @@ -48,7 +48,7 @@ object IntArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object LongArrayClone{ @@ -56,7 +56,7 @@ object LongArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object FloatArrayClone{ @@ -64,7 +64,7 @@ object FloatArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object DoubleArrayClone{ @@ -72,7 +72,7 @@ object DoubleArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = 0; - assert(it(0) == 1) + assert(it(0) == 1) } object ObjectArrayClone{ @@ -80,7 +80,7 @@ object ObjectArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = "0"; - assert(it(0) == "1") + assert(it(0) == "1") } object PolymorphicArrayClone{ @@ -88,14 +88,14 @@ object PolymorphicArrayClone{ val cloned = it.clone(); assert(cloned.sameElements(it)); cloned(0) = zero; - assert(it(0) == one) - } + assert(it(0) == one) + } testIt(Array("one", "two"), "one", "two"); class Mangler[T: Manifest](ts : T*){ // this will always be a BoxedAnyArray even after we've unboxed its contents. - val it = ts.toArray[T]; + val it = ts.toArray[T]; } val mangled = new Mangler[Int](0, 1); diff --git a/test/files/run/arraycopy.scala b/test/files/run/arraycopy.scala index 82c34c23e7..bb06200dc7 100644 --- a/test/files/run/arraycopy.scala +++ b/test/files/run/arraycopy.scala @@ -5,7 +5,7 @@ object Test { val a = new Array[Int](10) val b = new Array[Any](10) for (i <- 0 until 10) b(i) = i - + Array.copy(b, 3, a, 3, 7) assert(a.toSeq == List(0, 0, 0, 3, 4, 5, 6, 7, 8, 9)) } diff --git a/test/files/run/arrayview.scala b/test/files/run/arrayview.scala index 42ced5e9ac..97e840f5e9 100644 --- a/test/files/run/arrayview.scala +++ b/test/files/run/arrayview.scala @@ -1,6 +1,6 @@ object Test { def f = (1 to 100).toArray.view - + def main(args: Array[String]): Unit = { val xs = (f filter (_ < 50)).reverse.filter(_ % 2 == 0).map(_ / 2).flatMap(x => Array(1, x)) assert(xs.size == 48) diff --git a/test/files/run/bigDecimalCache.scala b/test/files/run/bigDecimalCache.scala index e8ebefee78..c0c709a50f 100644 --- a/test/files/run/bigDecimalCache.scala +++ b/test/files/run/bigDecimalCache.scala @@ -1,9 +1,9 @@ -object Test { +object Test { def main(args: Array[String]): Unit = { val bd5a = BigDecimal(5) val mc = java.math.MathContext.DECIMAL32 val bd5b = BigDecimal(5,mc) - + assert(bd5b.mc == mc) } } diff --git a/test/files/run/bigDecimalTest.scala b/test/files/run/bigDecimalTest.scala index 07b524c017..480305d7d4 100644 --- a/test/files/run/bigDecimalTest.scala +++ b/test/files/run/bigDecimalTest.scala @@ -28,7 +28,7 @@ object Test { // SI-4547: implicit conversion assert(5 + BigDecimal(3) == BigDecimal(8)) - + // meaningless sanity check List[BigDecimal](a, b, c, d, e, f) map (_.scale) foreach println } diff --git a/test/files/run/boolexprs.scala b/test/files/run/boolexprs.scala index 4f1c4b161a..b9b4faea9c 100644 --- a/test/files/run/boolexprs.scala +++ b/test/files/run/boolexprs.scala @@ -10,7 +10,7 @@ class Counter { object Test1 { var flag = false; - def flip: Boolean = { val tmp = flag; flag = !flag; tmp } + def flip: Boolean = { val tmp = flag; flag = !flag; tmp } def run: Int = { val c = new Counter; c.incrThen(flip || flip); diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index 9d2be42fb7..ba8449c299 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -304,7 +304,7 @@ object Bug250Test { // Bug 257 object Bug257Test { - def sayhello(): Unit = { Console.println("I should come 1st and 2nd"); }; + def sayhello(): Unit = { Console.println("I should come 1st and 2nd"); }; def sayhi(): Unit = { Console.println("I should come last"); }; def f1(x: Unit): Unit = (); diff --git a/test/files/run/caseClassEquality.scala b/test/files/run/caseClassEquality.scala index 4940d80951..c11d7ad0d1 100644 --- a/test/files/run/caseClassEquality.scala +++ b/test/files/run/caseClassEquality.scala @@ -11,25 +11,25 @@ object Test { case _ => false } } - + case class CS1(xs: Any*) class CS2(xs: Seq[_]*) extends CS1(xs: _*) class CS3(xs: IndexedSeq[Int]*) extends CS2(xs: _*) - + case class H1(x: Int, y: Double) class H2(x: Double, y: Int) extends H1(y, x) - + def main(args: Array[String]): Unit = { assert(C1(5) == new C2(5)) assert(new C2(5) == C1(5)) assert(C1(5).hashCode == new C2(5).hashCode) assert(new C2(5).hashCode == C1(5).hashCode) - + assert(C1(5) != new C3(5)) assert(new C3(5) != C1(5)) - + assert(CS1(List(1d,2d), Seq[Float](3f, 4f)) == new CS3(IndexedSeq(1,2), IndexedSeq(3, 4))) - + assert(H1(5, 10d) == new H2(10d, 5)) assert(H1(5, 10d).hashCode == new H2(10d, 5).hashCode) } diff --git a/test/files/run/castsingleton.scala b/test/files/run/castsingleton.scala index 47bd613079..339f5e00cf 100644 --- a/test/files/run/castsingleton.scala +++ b/test/files/run/castsingleton.scala @@ -8,4 +8,4 @@ object Test extends App { } empty(L()) -} +} diff --git a/test/files/run/checked.scala b/test/files/run/checked.scala index 06bc0c05e5..e4db9c0916 100644 --- a/test/files/run/checked.scala +++ b/test/files/run/checked.scala @@ -23,9 +23,9 @@ trait T { // Should not throw class D extends B with T { val sum = x + y + z + b1 + b2 + t1 + t2 - override def toString = + override def toString = "sum = " + sum - + } abstract class NeedsXEarly { @@ -91,7 +91,7 @@ class TestInterference extends { object Test extends App { - + def shouldThrow(t: => Unit) = try { t println("[FAIL]: No UFE thrown") diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala index 378caa7936..f92382d89b 100644 --- a/test/files/run/classfile-format-51.scala +++ b/test/files/run/classfile-format-51.scala @@ -91,14 +91,14 @@ object Test extends DirectTest { val bytes = cw.toByteArray() val fos = new FileOutputStream(new File(s"${testOutput.path}/$invokerClassName.class")) - try + try fos write bytes finally fos.close() } - def code = + def code = """ object Driver { val invoker = new DynamicInvoker() @@ -112,14 +112,14 @@ object Driver { System.setErr(System.out) try { // this test is only valid under JDK 1.7+ - testUnderJavaAtLeast("1.7") { + testUnderJavaAtLeast("1.7") { generateClass() compile() () } otherwise { () } - } + } finally System.setErr(prevErr) } diff --git a/test/files/run/classfile-format-52.scala b/test/files/run/classfile-format-52.scala index 7afa09ae0b..e12c84124c 100644 --- a/test/files/run/classfile-format-52.scala +++ b/test/files/run/classfile-format-52.scala @@ -7,7 +7,7 @@ import asm.{AnnotationVisitor, ClassWriter, FieldVisitor, Handle, MethodVisitor, import Opcodes._ // This test ensures that we can read JDK 8 (classfile format 52) files, including those -// with default methods. To do that it first uses ASM to generate an interface called +// with default methods. To do that it first uses ASM to generate an interface called // HasDefaultMethod. Then it runs a normal compile on Scala source that extends that // interface. Any failure will be dumped to std out. // @@ -40,14 +40,14 @@ object Test extends DirectTest { val bytes = cw.toByteArray() val fos = new FileOutputStream(new File(s"${testOutput.path}/$interfaceName.class")) - try + try fos write bytes finally fos.close() } - def code = + def code = """ class Driver extends HasDefaultMethod { println(publicMethod()) @@ -65,12 +65,12 @@ class Driver extends HasDefaultMethod { generateInterface() compile() Class.forName("Driver").newInstance() - () + () } otherwise { println("hello from publicMethod") - println("hello from staticMethod") + println("hello from staticMethod") } - } + } finally System.setErr(prevErr) } diff --git a/test/files/run/classof.check b/test/files/run/classof.check index 0d650b87c0..83e292352d 100644 --- a/test/files/run/classof.check +++ b/test/files/run/classof.check @@ -17,6 +17,6 @@ class [Lscala.runtime.BoxedUnit; class [I class [D class [Lscala.collection.immutable.List; -Functions: +Functions: interface scala.Function2 interface scala.Function1 diff --git a/test/files/run/classof.scala b/test/files/run/classof.scala index 10c07d2e51..257829e976 100644 --- a/test/files/run/classof.scala +++ b/test/files/run/classof.scala @@ -13,19 +13,19 @@ object Test { println(classOf[Long]) println(classOf[Float]) println(classOf[Double]) - + println("Class types") println(classOf[SomeClass]) println(classOf[List[Array[Float]]]) println(classOf[(String, Map[Int, String])]) println("Arrays:") - println(classOf[Array[Unit]]) + println(classOf[Array[Unit]]) println(classOf[Array[Int]]) println(classOf[Array[Double]]) println(classOf[Array[List[String]]]) - println("Functions: ") + println("Functions:") println(classOf[(Int, Int) => Unit]) println(classOf[Int => Boolean]) } diff --git a/test/files/run/collection-conversions.scala b/test/files/run/collection-conversions.scala index d842742230..cd05f68e26 100644 --- a/test/files/run/collection-conversions.scala +++ b/test/files/run/collection-conversions.scala @@ -8,11 +8,11 @@ object Test { def printResult[A,B](msg: String, obj: A, expected: B)(implicit tag: ClassTag[A], tag2: ClassTag[B]) = { print(" :" + msg +": ") - val isArray = obj match { - case x: Array[Int] => true + val isArray = obj match { + case x: Array[Int] => true case _ => false } - val expectedEquals = + val expectedEquals = if(isArray) obj.asInstanceOf[Array[Int]].toSeq == expected.asInstanceOf[Array[Int]].toSeq else obj == expected val tagEquals = tag == tag2 @@ -49,7 +49,7 @@ object Test { printResult("[Copy] ParVector", col.to[ParVector], testParVector) printResult("[Copy] ParArray ", col.to[ParArray], testParArray) } - + def main(args: Array[String]): Unit = { testConversion("iterator", (1 to 3).iterator) testConversion("Vector", Vector(1,2,3)) diff --git a/test/files/run/collections-toSelf.scala b/test/files/run/collections-toSelf.scala index 2adbc22af7..02f1dd6a95 100644 --- a/test/files/run/collections-toSelf.scala +++ b/test/files/run/collections-toSelf.scala @@ -2,7 +2,7 @@ object Test { val map = Map(1 -> 2) val set = Set(1, 2) val seq = collection.immutable.Seq(1, 2) - + def main(args: Array[String]): Unit = { assert(map.toMap eq map) assert(set.toSet eq set) diff --git a/test/files/run/collections.scala b/test/files/run/collections.scala index 1e4e8791ac..2b19ff4e75 100644 --- a/test/files/run/collections.scala +++ b/test/files/run/collections.scala @@ -62,7 +62,7 @@ object Test extends App { } time { var x = 0 - for (i <- 0 to 10000) + for (i <- 0 to 10000) s get i match { case Some(i) => x += i case None => @@ -97,7 +97,7 @@ object Test extends App { } time { var x = 0 - for (i <- 0 to 10000) + for (i <- 0 to 10000) s get i match { case Some(i) => x += i case None => diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala index 9d77fc413a..8dce69afc9 100644 --- a/test/files/run/colltest1.scala +++ b/test/files/run/colltest1.scala @@ -65,7 +65,7 @@ object Test extends App { assert(ten.toStream == ten) assert(ten.toString endsWith "(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)") assert(ten.mkString("[", "; ", "]") endsWith "[1; 2; 3; 4; 5; 6; 7; 8; 9; 10]") - } + } def orderedIterableTest(empty: Iterable[Int]) { orderedTraversableTest(empty) @@ -88,7 +88,7 @@ object Test extends App { assert(ten(0) == 1 && ten(9) == 10) assert((ten lengthCompare 10) == 0 && (ten lengthCompare 1) > 0 && (ten lengthCompare 11) < 0) assert((ten isDefinedAt 0) && (ten isDefinedAt 9)) - assert(!(ten isDefinedAt -1)); + assert(!(ten isDefinedAt -1)); assert(!(ten isDefinedAt 10)) val tenten = ten zip ten assert((tenten map (_._1)) == ten) @@ -178,8 +178,8 @@ object Test extends App { m ++= ('J' to 'Z') map (x => (x.toString -> x.toString)) println(m.toList.sorted) assert(!m.isEmpty) - assert(m.keySet forall (k => (m get k) == Some(k))) - assert(m.keySet forall (k => (m apply k) == k)) + assert(m.keySet forall (k => (m get k) == Some(k))) + assert(m.keySet forall (k => (m apply k) == k)) assert(m.keySet forall (m contains)) assert(m.getOrElse("7", "@") == "@") assert(m.keySet.size == 26) diff --git a/test/files/run/comparable-comparator.scala b/test/files/run/comparable-comparator.scala index 1707fb6e61..f059cc52f3 100644 --- a/test/files/run/comparable-comparator.scala +++ b/test/files/run/comparable-comparator.scala @@ -1,7 +1,7 @@ object Test { import java.util.Comparator - + class C1(val s: String) extends Comparable[C1] { def compareTo(other: C1) = s compareTo other.s override def toString = s @@ -10,7 +10,7 @@ object Test { def compareTo(other: C2) = s compareTo other.s override def toString = s } - + implicit val cmp: Comparator[C2] = new Comparator[C2] { def compare(p1: C2, p2: C2) = p2.s compareTo p1.s } @@ -19,10 +19,10 @@ object Test { val strs = words.toList val c1s = strs map (x => new C1(x)) val c2s = strs map (x => new C2(x)) - + val sorted1 = c1s.sorted map (_.s) val sorted2 = c2s.sorted map (_.s) - + def main(args: Array[String]): Unit = { assert(sorted1 == sorted2.reverse) } diff --git a/test/files/run/compiler-asSeenFrom.check b/test/files/run/compiler-asSeenFrom.check index a1826c2784..7305504115 100644 --- a/test/files/run/compiler-asSeenFrom.check +++ b/test/files/run/compiler-asSeenFrom.check @@ -363,8 +363,8 @@ value jZ { // after parser value jZ { // after explicitouter protected val $outer: D.this.type - val $outer(): ll.D[T3] - val $outer(): ll.C[T1] + val $outer(): D.this.type + val $outer(): C.this.type def thisI(): I.this.type def thisC(): C.this.type def t2(): T2 diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala index bd3db0bf66..7020469bb2 100644 --- a/test/files/run/compiler-asSeenFrom.scala +++ b/test/files/run/compiler-asSeenFrom.scala @@ -51,10 +51,10 @@ package ll { for (p <- typeRefPrefixes ; c <- classes filter (isPossibleEnclosure(p.typeSymbol, _)) ; a <- targs) yield typeRef(p, c, List(a)) ) - + val wfmt = "%-" + 25 + "s" def to_s(x: Any): String = wfmt.format(x.toString.replaceAll("""\bll\.""", "")) - + def fmt(args: Any*): String = { (args map to_s mkString " ").replaceAll("""\s+$""", "") } @@ -65,7 +65,7 @@ package ll { } def permuteAsSeenFrom(targs: List[Type]) = ( - for { + for { tp <- typeRefs(targs filterNot (_ eq NoType)) prefix <- asSeenPrefixes if tp.prefix != prefix @@ -76,11 +76,11 @@ package ll { } yield ((site, tp, prefix, seen)) ) - + def block(label: Any)(lines: List[String]): List[String] = { val first = "" + label + " {" val last = "}" - + first +: lines.map(" " + _) :+ last } @@ -88,7 +88,7 @@ package ll { permuteAsSeenFrom(targs).groupBy(_._1).toList.sortBy(_._1.toString) flatMap { case (site, xs) => block(fmt(site)) { - fmt("type", "seen from prefix", "is") :: + fmt("type", "seen from prefix", "is") :: fmt("----", "----------------", "--") :: { xs.groupBy(_._2).toList.sortBy(_._1.toString) flatMap { case (tp, ys) => @@ -99,7 +99,7 @@ package ll { } } } - + def pretty(xs: List[_]) = if (xs.isEmpty) "" else xs.mkString("\n ", "\n ", "\n") def signaturesIn(info: Type): List[String] = ( @@ -107,7 +107,7 @@ package ll { filterNot (s => s.isType || s.owner == ObjectClass || s.owner == AnyClass || s.isConstructor) map (_.defString) ) - + def check(source: String, unit: global.CompilationUnit) = { import syms._ diff --git a/test/files/run/concat-two-strings.scala b/test/files/run/concat-two-strings.scala index ad796fe0ee..c8881aa146 100644 --- a/test/files/run/concat-two-strings.scala +++ b/test/files/run/concat-two-strings.scala @@ -8,7 +8,7 @@ object Test { def f4(x: List[Int]) = "" + x def f5(x: Any) = "" + x def f6(x: AnyVal) = "" + x - + def main(args: Array[String]): Unit = { List(f1("a"), f2(5), f3(null), f3(Array('a')), f4(List(1)), f5(null), f6(55d)) mkString "" } diff --git a/test/files/run/concurrent-map-conversions.scala b/test/files/run/concurrent-map-conversions.scala index 0350b69642..d23d5bbbe4 100644 --- a/test/files/run/concurrent-map-conversions.scala +++ b/test/files/run/concurrent-map-conversions.scala @@ -4,33 +4,33 @@ object Test { - + def main(args: Array[String]) { testConversions() testConverters() } - + def needPackageConcurrentMap(map: collection.concurrent.Map[Int, Int]) { } def needJavaConcurrent(map: java.util.concurrent.ConcurrentMap[Int, Int]) { } - + def testConversions() { import collection.JavaConversions._ val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int] val ctrie = new collection.concurrent.TrieMap[Int, Int] - + needPackageConcurrentMap(skiplist) needJavaConcurrent(ctrie) } - + def testConverters() { import collection.JavaConverters._ val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int] val ctrie = new collection.concurrent.TrieMap[Int, Int] - + needPackageConcurrentMap(skiplist.asScala) needJavaConcurrent(ctrie.asJava) } - + } diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check index 4eededb8ba..77bdf618e6 100644 --- a/test/files/run/constant-type.check +++ b/test/files/run/constant-type.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> :power ** Power User mode enabled - BEEP WHIR GYVE ** ** :phase has been set to 'typer'. ** @@ -26,5 +24,3 @@ scala> { ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(printl Class(classOf[java.lang.String]) scala> - -scala> diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index 8b53e2391d..f022aac1b2 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -1,10 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> - scala> class Annot(obj: Any) extends annotation.Annotation with annotation.TypeConstraint defined class Annot @@ -14,7 +10,7 @@ scala> class A { val x = "hello" val y: Int @Annot(x) = 10 override def toString = "an A" -} +} defined class A scala> @@ -22,7 +18,7 @@ scala> scala> val a = new A a: A = an A -scala> val y = a.y // should rewrite "this.x" to "a.x" +scala> val y = a.y // should rewrite "this.x" to "a.x" y: Int @Annot(a.x) = 10 scala> var a2 = new A @@ -154,5 +150,3 @@ scala> val x : Int @Where(self > 0 && self < 100) = 3 x: Int @Where(self.>(0).&&(self.<(100))) = 3 scala> - -scala> diff --git a/test/files/run/constrained-types.scala b/test/files/run/constrained-types.scala index 38ae076c06..91bd856d00 100644 --- a/test/files/run/constrained-types.scala +++ b/test/files/run/constrained-types.scala @@ -15,10 +15,10 @@ class A { val x = "hello" val y: Int @Annot(x) = 10 override def toString = "an A" -} +} val a = new A -val y = a.y // should rewrite "this.x" to "a.x" +val y = a.y // should rewrite "this.x" to "a.x" var a2 = new A val y2 = a2.y // should drop the annotation diff --git a/test/files/run/ctor-order.scala b/test/files/run/ctor-order.scala index a223ff77e8..5f5871691a 100644 --- a/test/files/run/ctor-order.scala +++ b/test/files/run/ctor-order.scala @@ -8,7 +8,7 @@ class Outer { class X extends { /* The constructor of X should set this.$outer to the outer instance - * *before* calling the super constructors. This is tested by + * *before* calling the super constructors. This is tested by * mixin M1, which tries to access global from the enclosing class. */ val outer = Outer.this diff --git a/test/files/run/ctries-new/concmap.scala b/test/files/run/ctries-new/concmap.scala index 3ec0256afb..76916564a7 100644 --- a/test/files/run/ctries-new/concmap.scala +++ b/test/files/run/ctries-new/concmap.scala @@ -5,17 +5,17 @@ import collection.concurrent.TrieMap object ConcurrentMapSpec extends Spec { - + val initsz = 500 val secondsz = 750 - + def test() { "support put" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) assert(ct.put(new Wrap(i), i) == None) for (i <- 0 until initsz) assert(ct.put(new Wrap(i), -i) == Some(i)) } - + "support put if absent" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -24,7 +24,7 @@ object ConcurrentMapSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), -i) == None) for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), i) == Some(-i)) } - + "support remove if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -32,7 +32,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == true) for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == false) } - + "support replace if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -41,7 +41,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i, -i - 2) == false) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i, 0) == false) } - + "support replace if present" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -49,17 +49,17 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i) == Some(-i)) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i) == None) } - + def assertEqual(a: Any, b: Any) = { if (a != b) println(a, b) assert(a == b) } - + "support replace if mapped to a specific value, using several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Updater(index: Int, offs: Int) extends Thread { override def run() { var repeats = 0 @@ -74,24 +74,24 @@ object ConcurrentMapSpec extends Spec { //println("Thread %d repeats: %d".format(index, repeats)) } } - + val threads = for (i <- 0 until 16) yield new Updater(i, sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), i) - + val threads2 = for (i <- 0 until 15) yield new Updater(i, sz / 32 * i) threads2.foreach(_.start()) threads2.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), -i) } - + "support put if absent, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 110000 - + class Updater(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -101,19 +101,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Updater(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct(new Wrap(i)) == i) } - + "support remove if mapped to a specific value, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Remover(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -123,19 +123,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Remover(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct.get(new Wrap(i)) == None) } - + "have all or none of the elements depending on the oddity" in { val ct = new TrieMap[Wrap, Int] val sz = 65000 for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Modifier(index: Int, offs: Int) extends Thread { override def run() { for (j <- 0 until sz) { @@ -151,38 +151,38 @@ object ConcurrentMapSpec extends Spec { } } } - + def modify(n: Int) = { val threads = for (i <- 0 until n) yield new Modifier(i, sz / n * i) threads.foreach(_.start()) threads.foreach(_.join()) } - + modify(16) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), Some(i)) modify(15) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), None) } - + "compute size correctly" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i - + assertEqual(ct.size, sz) assertEqual(ct.size, sz) } - + "compute size correctly in parallel" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i val pct = ct.par - + assertEqual(pct.size, sz) assertEqual(pct.size, sz) } - + } - + } diff --git a/test/files/run/ctries-new/lnode.scala b/test/files/run/ctries-new/lnode.scala index 92a31088e5..4cc97050e5 100644 --- a/test/files/run/ctries-new/lnode.scala +++ b/test/files/run/ctries-new/lnode.scala @@ -5,23 +5,23 @@ import collection.concurrent.TrieMap object LNodeSpec extends Spec { - + val initsz = 1500 val secondsz = 1750 - + def test() { "accept elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) } - + "lookup elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == Some(i)) for (i <- initsz until secondsz) assert(ct.get(new DumbHash(i)) == None) } - + "remove elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) @@ -31,7 +31,7 @@ object LNodeSpec extends Spec { } for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == None) } - + "put elements with the same hash codes if absent" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.put(new DumbHash(i), i) @@ -40,7 +40,7 @@ object LNodeSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new DumbHash(i), i) == None) for (i <- initsz until secondsz) assert(ct.lookup(new DumbHash(i)) == i) } - + "replace elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None) @@ -49,13 +49,13 @@ object LNodeSpec extends Spec { for (i <- 0 until initsz) assert(ct.lookup(new DumbHash(i)) == -i) for (i <- 0 until initsz) assert(ct.replace(new DumbHash(i), -i, i) == true) } - + "remove elements with the same hash codes if mapped to a specific value" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None) for (i <- 0 until initsz) assert(ct.remove(new DumbHash(i), i) == true) } - + } - + } diff --git a/test/files/run/ctries-new/snapshot.scala b/test/files/run/ctries-new/snapshot.scala index 5fe77d445b..57155d49c6 100644 --- a/test/files/run/ctries-new/snapshot.scala +++ b/test/files/run/ctries-new/snapshot.scala @@ -8,22 +8,22 @@ import collection.concurrent.TrieMap object SnapshotSpec extends Spec { - + def test() { "support snapshots" in { val ctn = new TrieMap ctn.snapshot() ctn.readOnlySnapshot() - + val ct = new TrieMap[Int, Int] for (i <- 0 until 100) ct.put(i, i) ct.snapshot() ct.readOnlySnapshot() } - + "empty 2 quiescent snapshots in isolation" in { val sz = 4000 - + class Worker(trie: TrieMap[Wrap, Int]) extends Thread { override def run() { for (i <- 0 until sz) { @@ -34,46 +34,46 @@ object SnapshotSpec extends Spec { } } } - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) val snapt = ct.snapshot() - + val original = new Worker(ct) val snapshot = new Worker(snapt) original.start() snapshot.start() original.join() snapshot.join() - + for (i <- 0 until sz) { assert(ct.get(new Wrap(i)) == None) assert(snapt.get(new Wrap(i)) == None) } } - + def consistentReadOnly(name: String, readonly: Map[Wrap, Int], sz: Int, N: Int) { @volatile var e: Exception = null - + // reads possible entries once and stores them // then reads all these N more times to check if the // state stayed the same class Reader(trie: Map[Wrap, Int]) extends Thread { setName("Reader " + name) - + override def run() = try check() catch { case ex: Exception => e = ex } - + def check() { val initial = mutable.Map[Wrap, Int]() for (i <- 0 until sz) trie.get(new Wrap(i)) match { case Some(i) => initial.put(new Wrap(i), i) case None => // do nothing } - + for (k <- 0 until N) { for (i <- 0 until sz) { val tres = trie.get(new Wrap(i)) @@ -84,21 +84,21 @@ object SnapshotSpec extends Spec { } } } - + val reader = new Reader(readonly) reader.start() reader.join() - + if (e ne null) { e.printStackTrace() throw e } } - + // traverses the trie `rep` times and modifies each entry class Modifier(trie: TrieMap[Wrap, Int], index: Int, rep: Int, sz: Int) extends Thread { setName("Modifier %d".format(index)) - + override def run() { for (k <- 0 until rep) { for (i <- 0 until sz) trie.putIfAbsent(new Wrap(i), i) match { @@ -108,85 +108,85 @@ object SnapshotSpec extends Spec { } } } - + // removes all the elements from the trie class Remover(trie: TrieMap[Wrap, Int], index: Int, totremovers: Int, sz: Int) extends Thread { setName("Remover %d".format(index)) - + override def run() { for (i <- 0 until sz) trie.remove(new Wrap((i + sz / totremovers * index) % sz)) } } - + "have a consistent quiescent read-only snapshot" in { val sz = 10000 val N = 100 val W = 10 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val readonly = ct.readOnlySnapshot() val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) consistentReadOnly("qm", readonly, sz, N) threads.foreach(_.join()) } - + // now, we check non-quiescent snapshots, as these permit situations // where a thread is caught in the middle of the update when a snapshot is taken - + "have a consistent non-quiescent read-only snapshot, concurrent with removes only" in { val sz = 1250 val W = 100 val S = 5000 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Remover(ct, i, W, sz) - + threads.foreach(_.start()) for (i <- 0 until S) consistentReadOnly("non-qr", ct.readOnlySnapshot(), sz, 5) threads.foreach(_.join()) } - + "have a consistent non-quiescent read-only snapshot, concurrent with modifications" in { val sz = 1000 val N = 7000 val W = 10 val S = 7000 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) for (i <- 0 until S) consistentReadOnly("non-qm", ct.readOnlySnapshot(), sz, 5) threads.foreach(_.join()) } - + def consistentNonReadOnly(name: String, trie: TrieMap[Wrap, Int], sz: Int, N: Int) { @volatile var e: Exception = null - + // reads possible entries once and stores them // then reads all these N more times to check if the // state stayed the same class Worker extends Thread { setName("Worker " + name) - + override def run() = try check() catch { case ex: Exception => e = ex } - + def check() { val initial = mutable.Map[Wrap, Int]() for (i <- 0 until sz) trie.get(new Wrap(i)) match { case Some(i) => initial.put(new Wrap(i), i) case None => // do nothing } - + for (k <- 0 until N) { // modify for ((key, value) <- initial) { @@ -194,7 +194,7 @@ object SnapshotSpec extends Spec { val newv = -oldv trie.replace(key, oldv, newv) } - + // check for (i <- 0 until sz) if (initial.contains(new Wrap(i))) { val expected = if (k % 2 == 0) -i else i @@ -206,27 +206,27 @@ object SnapshotSpec extends Spec { } } } - + val worker = new Worker worker.start() worker.join() - + if (e ne null) { e.printStackTrace() throw e } } - + "have a consistent non-quiescent snapshot, concurrent with modifications" in { val sz = 9000 val N = 1000 val W = 10 val S = 400 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) for (i <- 0 until S) { consistentReadOnly("non-qm", ct.snapshot(), sz, 5) @@ -234,7 +234,7 @@ object SnapshotSpec extends Spec { } threads.foreach(_.join()) } - + "work when many concurrent snapshots are taken, concurrent with modifications" in { val sz = 12000 val W = 10 @@ -243,7 +243,7 @@ object SnapshotSpec extends Spec { val snaptimes = 600 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Snapshooter extends Thread { setName("Snapshooter") override def run() { @@ -254,14 +254,14 @@ object SnapshotSpec extends Spec { } } } - + val mods = for (i <- 0 until W) yield new Modifier(ct, i, modifytimes, sz) val shooters = for (i <- 0 until S) yield new Snapshooter val threads = mods ++ shooters threads.foreach(_.start()) threads.foreach(_.join()) } - + } - + } diff --git a/test/files/run/ctries-old/concmap.scala b/test/files/run/ctries-old/concmap.scala index fccd4bed3e..affc6fe294 100644 --- a/test/files/run/ctries-old/concmap.scala +++ b/test/files/run/ctries-old/concmap.scala @@ -6,17 +6,17 @@ import Test.Spec object ConcurrentMapSpec extends Spec { - + val initsz = 500 val secondsz = 750 - + def test() { "support put" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) assert(ct.put(new Wrap(i), i) == None) for (i <- 0 until initsz) assert(ct.put(new Wrap(i), -i) == Some(i)) } - + "support put if absent" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -25,7 +25,7 @@ object ConcurrentMapSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), -i) == None) for (i <- initsz until secondsz) assert(ct.putIfAbsent(new Wrap(i), i) == Some(-i)) } - + "support remove if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -33,7 +33,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == true) for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == false) } - + "support replace if mapped to a specific value" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -42,7 +42,7 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i, -i - 2) == false) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i, 0) == false) } - + "support replace if present" in { val ct = new TrieMap[Wrap, Int] for (i <- 0 until initsz) ct.update(new Wrap(i), i) @@ -50,17 +50,17 @@ object ConcurrentMapSpec extends Spec { for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i) == Some(-i)) for (i <- initsz until secondsz) assert(ct.replace(new Wrap(i), i) == None) } - + def assertEqual(a: Any, b: Any) = { if (a != b) println(a, b) assert(a == b) } - + "support replace if mapped to a specific value, using several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Updater(index: Int, offs: Int) extends Thread { override def run() { var repeats = 0 @@ -75,24 +75,24 @@ object ConcurrentMapSpec extends Spec { //println("Thread %d repeats: %d".format(index, repeats)) } } - + val threads = for (i <- 0 until 16) yield new Updater(i, sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), i) - + val threads2 = for (i <- 0 until 15) yield new Updater(i, sz / 32 * i) threads2.foreach(_.start()) threads2.foreach(_.join()) - + for (i <- 0 until sz) assertEqual(ct(new Wrap(i)), -i) } - + "support put if absent, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 110000 - + class Updater(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -102,19 +102,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Updater(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct(new Wrap(i)) == i) } - + "support remove if mapped to a specific value, several threads" in { val ct = new TrieMap[Wrap, Int] val sz = 55000 for (i <- 0 until sz) ct.update(new Wrap(i), i) - + class Remover(offs: Int) extends Thread { override def run() { for (i <- 0 until sz) { @@ -124,19 +124,19 @@ object ConcurrentMapSpec extends Spec { } } } - + val threads = for (i <- 0 until 16) yield new Remover(sz / 32 * i) threads.foreach(_.start()) threads.foreach(_.join()) - + for (i <- 0 until sz) assert(ct.get(new Wrap(i)) == None) } - + "have all or none of the elements depending on the oddity" in { val ct = new TrieMap[Wrap, Int] val sz = 65000 for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Modifier(index: Int, offs: Int) extends Thread { override def run() { for (j <- 0 until sz) { @@ -152,38 +152,38 @@ object ConcurrentMapSpec extends Spec { } } } - + def modify(n: Int) = { val threads = for (i <- 0 until n) yield new Modifier(i, sz / n * i) threads.foreach(_.start()) threads.foreach(_.join()) } - + modify(16) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), Some(i)) modify(15) for (i <- 0 until sz) assertEqual(ct.get(new Wrap(i)), None) } - + "compute size correctly" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i - + assertEqual(ct.size, sz) assertEqual(ct.size, sz) } - + "compute size correctly in parallel" in { val ct = new TrieMap[Wrap, Int] val sz = 36450 for (i <- 0 until sz) ct(new Wrap(i)) = i val pct = ct.par - + assertEqual(pct.size, sz) assertEqual(pct.size, sz) } - + } - + } diff --git a/test/files/run/ctries-old/iterator.scala b/test/files/run/ctries-old/iterator.scala index 585bdc0e48..127f6c9f06 100644 --- a/test/files/run/ctries-old/iterator.scala +++ b/test/files/run/ctries-old/iterator.scala @@ -9,126 +9,126 @@ import Test.Spec object IteratorSpec extends Spec { - + def test() { "work for an empty trie" in { val ct = new TrieMap val it = ct.iterator - + it.hasNext shouldEqual (false) evaluating { it.next() }.shouldProduce [NoSuchElementException] } - + def nonEmptyIteratorCheck(sz: Int) { val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) - + val it = ct.iterator val tracker = mutable.Map[Wrap, Int]() for (i <- 0 until sz) { assert(it.hasNext == true) tracker += it.next } - + it.hasNext shouldEqual (false) evaluating { it.next() }.shouldProduce [NoSuchElementException] tracker.size shouldEqual (sz) tracker shouldEqual (ct) } - + "work for a 1 element trie" in { nonEmptyIteratorCheck(1) } - + "work for a 2 element trie" in { nonEmptyIteratorCheck(2) } - + "work for a 3 element trie" in { nonEmptyIteratorCheck(3) } - + "work for a 5 element trie" in { nonEmptyIteratorCheck(5) } - + "work for a 10 element trie" in { nonEmptyIteratorCheck(10) } - + "work for a 20 element trie" in { nonEmptyIteratorCheck(20) } - + "work for a 50 element trie" in { nonEmptyIteratorCheck(50) } - + "work for a 100 element trie" in { nonEmptyIteratorCheck(100) } - + "work for a 1k element trie" in { nonEmptyIteratorCheck(1000) } - + "work for a 5k element trie" in { nonEmptyIteratorCheck(5000) } - + "work for a 75k element trie" in { nonEmptyIteratorCheck(75000) } - + "work for a 250k element trie" in { nonEmptyIteratorCheck(500000) } - + def nonEmptyCollideCheck(sz: Int) { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until sz) ct.put(new DumbHash(i), i) - + val it = ct.iterator val tracker = mutable.Map[DumbHash, Int]() for (i <- 0 until sz) { assert(it.hasNext == true) tracker += it.next } - + it.hasNext shouldEqual (false) evaluating { it.next() }.shouldProduce [NoSuchElementException] tracker.size shouldEqual (sz) tracker shouldEqual (ct) } - + "work for colliding hashcodes, 2 element trie" in { nonEmptyCollideCheck(2) } - + "work for colliding hashcodes, 3 element trie" in { nonEmptyCollideCheck(3) } - + "work for colliding hashcodes, 5 element trie" in { nonEmptyCollideCheck(5) } - + "work for colliding hashcodes, 10 element trie" in { nonEmptyCollideCheck(10) } - + "work for colliding hashcodes, 100 element trie" in { nonEmptyCollideCheck(100) } - + "work for colliding hashcodes, 500 element trie" in { nonEmptyCollideCheck(500) } - + "work for colliding hashcodes, 5k element trie" in { nonEmptyCollideCheck(5000) } - + def assertEqual(a: Map[Wrap, Int], b: Map[Wrap, Int]) { if (a != b) { println(a.size + " vs " + b.size) @@ -139,7 +139,7 @@ object IteratorSpec extends Spec { } assert(a == b) } - + "be consistent when taken with concurrent modifications" in { val sz = 25000 val W = 15 @@ -147,40 +147,40 @@ object IteratorSpec extends Spec { val checks = 5 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) - + class Modifier extends Thread { override def run() { for (i <- 0 until sz) ct.putIfAbsent(new Wrap(i), i) match { case Some(_) => ct.remove(new Wrap(i)) - case None => + case None => } } } - + def consistentIteration(ct: TrieMap[Wrap, Int], checks: Int) { class Iter extends Thread { override def run() { val snap = ct.readOnlySnapshot() val initial = mutable.Map[Wrap, Int]() for (kv <- snap) initial += kv - + for (i <- 0 until checks) { assertEqual(snap.iterator.toMap, initial) } } } - + val iter = new Iter iter.start() iter.join() } - + val threads = for (_ <- 0 until W) yield new Modifier threads.foreach(_.start()) for (_ <- 0 until S) consistentIteration(ct, checks) threads.foreach(_.join()) } - + "be consistent with a concurrent removal with a well defined order" in { val sz = 150000 val sgroupsize = 10 @@ -188,7 +188,7 @@ object IteratorSpec extends Spec { val removerslowdown = 50 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) - + class Remover extends Thread { override def run() { for (i <- 0 until sz) { @@ -198,7 +198,7 @@ object IteratorSpec extends Spec { //println("done removing") } } - + def consistentIteration(it: Iterator[(Wrap, Int)]) = { class Iter extends Thread { override def run() { @@ -211,7 +211,7 @@ object IteratorSpec extends Spec { } new Iter } - + val remover = new Remover remover.start() for (_ <- 0 until sgroupnum) { @@ -222,14 +222,14 @@ object IteratorSpec extends Spec { //println("done with iterators") remover.join() } - + "be consistent with a concurrent insertion with a well defined order" in { val sz = 150000 val sgroupsize = 10 val sgroupnum = 10 val inserterslowdown = 50 val ct = new TrieMap[Wrap, Int] - + class Inserter extends Thread { override def run() { for (i <- 0 until sz) { @@ -239,7 +239,7 @@ object IteratorSpec extends Spec { //println("done inserting") } } - + def consistentIteration(it: Iterator[(Wrap, Int)]) = { class Iter extends Thread { override def run() { @@ -252,7 +252,7 @@ object IteratorSpec extends Spec { } new Iter } - + val inserter = new Inserter inserter.start() for (_ <- 0 until sgroupnum) { @@ -263,28 +263,28 @@ object IteratorSpec extends Spec { //println("done with iterators") inserter.join() } - + "work on a yet unevaluated snapshot" in { val sz = 50000 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.update(new Wrap(i), i) - + val snap = ct.snapshot() val it = snap.iterator - + while (it.hasNext) it.next() } - + "be duplicated" in { val sz = 50 val ct = collection.parallel.mutable.ParTrieMap((0 until sz) zip (0 until sz): _*) val it = ct.splitter for (_ <- 0 until (sz / 2)) it.next() val dupit = it.dup - + it.toList shouldEqual dupit.toList } - + } - + } diff --git a/test/files/run/ctries-old/lnode.scala b/test/files/run/ctries-old/lnode.scala index 3ff5414ac0..f9eb9ce877 100644 --- a/test/files/run/ctries-old/lnode.scala +++ b/test/files/run/ctries-old/lnode.scala @@ -6,23 +6,23 @@ import collection.concurrent.TrieMap import Test.Spec object LNodeSpec extends Spec { - + val initsz = 1500 val secondsz = 1750 - + def test() { "accept elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) } - + "lookup elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == Some(i)) for (i <- initsz until secondsz) assert(ct.get(new DumbHash(i)) == None) } - + "remove elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.update(new DumbHash(i), i) @@ -32,7 +32,7 @@ object LNodeSpec extends Spec { } for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == None) } - + "put elements with the same hash codes if absent" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) ct.put(new DumbHash(i), i) @@ -41,7 +41,7 @@ object LNodeSpec extends Spec { for (i <- initsz until secondsz) assert(ct.putIfAbsent(new DumbHash(i), i) == None) for (i <- initsz until secondsz) assert(ct.lookup(new DumbHash(i)) == i) } - + "replace elements with the same hash codes" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None) @@ -50,13 +50,13 @@ object LNodeSpec extends Spec { for (i <- 0 until initsz) assert(ct.lookup(new DumbHash(i)) == -i) for (i <- 0 until initsz) assert(ct.replace(new DumbHash(i), -i, i) == true) } - + "remove elements with the same hash codes if mapped to a specific value" in { val ct = new TrieMap[DumbHash, Int] for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None) for (i <- 0 until initsz) assert(ct.remove(new DumbHash(i), i) == true) } - + } - + } diff --git a/test/files/run/ctries-old/snapshot.scala b/test/files/run/ctries-old/snapshot.scala index 768b588f81..dfc2034e56 100644 --- a/test/files/run/ctries-old/snapshot.scala +++ b/test/files/run/ctries-old/snapshot.scala @@ -9,22 +9,22 @@ import Test.Spec object SnapshotSpec extends Spec { - + def test() { "support snapshots" in { val ctn = new TrieMap ctn.snapshot() ctn.readOnlySnapshot() - + val ct = new TrieMap[Int, Int] for (i <- 0 until 100) ct.put(i, i) ct.snapshot() ct.readOnlySnapshot() } - + "empty 2 quiescent snapshots in isolation" in { val sz = 4000 - + class Worker(trie: TrieMap[Wrap, Int]) extends Thread { override def run() { for (i <- 0 until sz) { @@ -35,46 +35,46 @@ object SnapshotSpec extends Spec { } } } - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct.put(new Wrap(i), i) val snapt = ct.snapshot() - + val original = new Worker(ct) val snapshot = new Worker(snapt) original.start() snapshot.start() original.join() snapshot.join() - + for (i <- 0 until sz) { assert(ct.get(new Wrap(i)) == None) assert(snapt.get(new Wrap(i)) == None) } } - + def consistentReadOnly(name: String, readonly: Map[Wrap, Int], sz: Int, N: Int) { @volatile var e: Exception = null - + // reads possible entries once and stores them // then reads all these N more times to check if the // state stayed the same class Reader(trie: Map[Wrap, Int]) extends Thread { setName("Reader " + name) - + override def run() = try check() catch { case ex: Exception => e = ex } - + def check() { val initial = mutable.Map[Wrap, Int]() for (i <- 0 until sz) trie.get(new Wrap(i)) match { case Some(i) => initial.put(new Wrap(i), i) case None => // do nothing } - + for (k <- 0 until N) { for (i <- 0 until sz) { val tres = trie.get(new Wrap(i)) @@ -85,21 +85,21 @@ object SnapshotSpec extends Spec { } } } - + val reader = new Reader(readonly) reader.start() reader.join() - + if (e ne null) { e.printStackTrace() throw e } } - + // traverses the trie `rep` times and modifies each entry class Modifier(trie: TrieMap[Wrap, Int], index: Int, rep: Int, sz: Int) extends Thread { setName("Modifier %d".format(index)) - + override def run() { for (k <- 0 until rep) { for (i <- 0 until sz) trie.putIfAbsent(new Wrap(i), i) match { @@ -109,85 +109,85 @@ object SnapshotSpec extends Spec { } } } - + // removes all the elements from the trie class Remover(trie: TrieMap[Wrap, Int], index: Int, totremovers: Int, sz: Int) extends Thread { setName("Remover %d".format(index)) - + override def run() { for (i <- 0 until sz) trie.remove(new Wrap((i + sz / totremovers * index) % sz)) } } - + "have a consistent quiescent read-only snapshot" in { val sz = 10000 val N = 100 val W = 10 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val readonly = ct.readOnlySnapshot() val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) consistentReadOnly("qm", readonly, sz, N) threads.foreach(_.join()) } - + // now, we check non-quiescent snapshots, as these permit situations // where a thread is caught in the middle of the update when a snapshot is taken - + "have a consistent non-quiescent read-only snapshot, concurrent with removes only" in { val sz = 1250 val W = 100 val S = 5000 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Remover(ct, i, W, sz) - + threads.foreach(_.start()) for (i <- 0 until S) consistentReadOnly("non-qr", ct.readOnlySnapshot(), sz, 5) threads.foreach(_.join()) } - + "have a consistent non-quiescent read-only snapshot, concurrent with modifications" in { val sz = 1000 val N = 7000 val W = 10 val S = 7000 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) for (i <- 0 until S) consistentReadOnly("non-qm", ct.readOnlySnapshot(), sz, 5) threads.foreach(_.join()) } - + def consistentNonReadOnly(name: String, trie: TrieMap[Wrap, Int], sz: Int, N: Int) { @volatile var e: Exception = null - + // reads possible entries once and stores them // then reads all these N more times to check if the // state stayed the same class Worker extends Thread { setName("Worker " + name) - + override def run() = try check() catch { case ex: Exception => e = ex } - + def check() { val initial = mutable.Map[Wrap, Int]() for (i <- 0 until sz) trie.get(new Wrap(i)) match { case Some(i) => initial.put(new Wrap(i), i) case None => // do nothing } - + for (k <- 0 until N) { // modify for ((key, value) <- initial) { @@ -195,7 +195,7 @@ object SnapshotSpec extends Spec { val newv = -oldv trie.replace(key, oldv, newv) } - + // check for (i <- 0 until sz) if (initial.contains(new Wrap(i))) { val expected = if (k % 2 == 0) -i else i @@ -207,27 +207,27 @@ object SnapshotSpec extends Spec { } } } - + val worker = new Worker worker.start() worker.join() - + if (e ne null) { e.printStackTrace() throw e } } - + "have a consistent non-quiescent snapshot, concurrent with modifications" in { val sz = 9000 val N = 1000 val W = 10 val S = 400 - + val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz) - + threads.foreach(_.start()) for (i <- 0 until S) { consistentReadOnly("non-qm", ct.snapshot(), sz, 5) @@ -235,7 +235,7 @@ object SnapshotSpec extends Spec { } threads.foreach(_.join()) } - + "work when many concurrent snapshots are taken, concurrent with modifications" in { val sz = 12000 val W = 10 @@ -244,7 +244,7 @@ object SnapshotSpec extends Spec { val snaptimes = 600 val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(new Wrap(i)) = i - + class Snapshooter extends Thread { setName("Snapshooter") override def run() { @@ -255,14 +255,14 @@ object SnapshotSpec extends Spec { } } } - + val mods = for (i <- 0 until W) yield new Modifier(ct, i, modifytimes, sz) val shooters = for (i <- 0 until S) yield new Snapshooter val threads = mods ++ shooters threads.foreach(_.start()) threads.foreach(_.join()) } - + } - + } diff --git a/test/files/run/dead-code-elimination.scala b/test/files/run/dead-code-elimination.scala index 1af17c936b..fd3f2a996a 100644 --- a/test/files/run/dead-code-elimination.scala +++ b/test/files/run/dead-code-elimination.scala @@ -1,9 +1,9 @@ -// This testcase is a snippet that did not compile correctly under -// pre-release 2.10.x. The relevant discussion around it can be +// This testcase is a snippet that did not compile correctly under +// pre-release 2.10.x. The relevant discussion around it can be // found at: // https://groups.google.com/forum/?fromgroups#!topic/scala-internals/qcyTjk8euUI[1-25] -// +// // The reason it did not compile is related to the fact that ICode // ops did not correctly define the stack entries they consumed and // the dead code elimination phase was unable to correctly reconstruct @@ -12,7 +12,7 @@ // Originally, this did not compile, but I included it in the run // tests because this was ASM-dependand and did not happen for GenJVM. // -// Thus, we run the code and force the loading of class B -- if the +// Thus, we run the code and force the loading of class B -- if the // bytecode is incorrect, it will fail the test. final class A { @@ -27,7 +27,7 @@ final class A { object Test { def main(args: Array[String]): Unit = { - // force the loading of B + // force the loading of B (new A).f } } diff --git a/test/files/run/distinct.scala b/test/files/run/distinct.scala index 37bbe7805a..0b8971e8a9 100644 --- a/test/files/run/distinct.scala +++ b/test/files/run/distinct.scala @@ -5,7 +5,7 @@ object Test { val alphabet = 'a' to 'z' mkString "" val alphaList = ('a' to 'z').toList def shuffled = util.Random.shuffle(alphaList) - + def main(args: Array[String]): Unit = { val longList = alphaList ++ (1 to 9 flatMap (_ => shuffled)) val result = longList.distinct mkString "" diff --git a/test/files/run/elidable-noflags.scala b/test/files/run/elidable-noflags.scala index 5192e34096..1b9c5118bb 100644 --- a/test/files/run/elidable-noflags.scala +++ b/test/files/run/elidable-noflags.scala @@ -9,7 +9,7 @@ object Test { @elidable(100000) def f5() = println("Good for me, I was not elided.") @elidable(OFF) def f6() = println("Good for me, I was not elided.") @elidable(ALL) def f7() = println("ESPECIALLY good for me, I was not elided.") - + def main(args: Array[String]): Unit = { f1() f2() diff --git a/test/files/run/emptypf.scala b/test/files/run/emptypf.scala index 8aa0906a1b..eb3e3e6380 100644 --- a/test/files/run/emptypf.scala +++ b/test/files/run/emptypf.scala @@ -5,10 +5,10 @@ object Test { case s => s.length } } - + def main(args: Array[String]): Unit = { println(f("abc")) - println(f("def")) + println(f("def")) println(PartialFunction.empty[String, Int] isDefinedAt "abc") } } diff --git a/test/files/run/enrich-gentraversable.scala b/test/files/run/enrich-gentraversable.scala index 0f79a47030..36412e650e 100644 --- a/test/files/run/enrich-gentraversable.scala +++ b/test/files/run/enrich-gentraversable.scala @@ -13,22 +13,22 @@ object Test extends App { } implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableLike[Repr]): FilterMapImpl[fr.A,Repr] = new FilterMapImpl[fr.A, Repr](fr.conversion(r)) - + val l = List(1, 2, 3, 4, 5) val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None) typed[List[Int]](fml) println(fml) - + val a = Array(1, 2, 3, 4, 5) val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None) typed[Array[Int]](fma) println(fma.deep) - + val s = "Hello World" val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None) typed[String](fms1) println(fms1) - + val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None) typed[IndexedSeq[Int]](fms2) println(fms2) @@ -38,28 +38,28 @@ object Test extends App { final def filterMap[B, That](f: A => Option[B])(implicit cbf: CanBuildFrom[Repr, B, That]): That = { val b = cbf() for(e <- r.seq) f(e) foreach (b +=) - + b.result } } implicit def filterMap[Repr, A](r: Repr)(implicit fr: IsTraversableOnce[Repr]): FilterMapImpl[fr.A,Repr] = new FilterMapImpl[fr.A, Repr](fr.conversion(r)) - + val l = List(1, 2, 3, 4, 5) val fml = l.filterMap(i => if(i % 2 == 0) Some(i) else None) typed[List[Int]](fml) println(fml) - + val a = Array(1, 2, 3, 4, 5) val fma = a.filterMap(i => if(i % 2 == 0) Some(i) else None) typed[Array[Int]](fma) println(fma.deep) - + val s = "Hello World" val fms1 = s.filterMap(c => if(c >= 'A' && c <= 'Z') Some(c) else None) typed[String](fms1) println(fms1) - + val fms2 = s.filterMap(c =>if(c % 2 == 0) Some(c.toInt) else None) typed[IndexedSeq[Int]](fms2) println(fms2) diff --git a/test/files/run/equality.scala b/test/files/run/equality.scala index 68055fd012..ff59898821 100644 --- a/test/files/run/equality.scala +++ b/test/files/run/equality.scala @@ -2,7 +2,7 @@ object Test { import scala.runtime.ScalaRunTime.hash - + def makeFromInt(x: Int) = List( x.toByte, x.toShort, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x), BigDecimal(x) ) ::: ( @@ -11,26 +11,26 @@ object Test def makeFromDouble(x: Double) = List( x.toShort, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x.toInt), BigDecimal(x) ) - + def main(args: Array[String]): Unit = { var xs = makeFromInt(5) for (x <- xs ; y <- xs) { assert(x == y, x + " == " + y) assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y)) } - + xs = makeFromInt(-5) for (x <- xs ; y <- xs) { assert(x == y, x + " == " + y) assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y)) } - + xs = makeFromDouble(500.0) for (x <- xs ; y <- xs) { assert(x == y, x + " == " + y) assert(hash(x) == hash(y), "hash(%s) == hash(%s)".format(x, y)) } - + // negatives val bigLong = new java.util.concurrent.atomic.AtomicLong(Long.MaxValue) assert(-1 != bigLong && bigLong != -1) // bigLong.intValue() == -1 diff --git a/test/files/run/existential-rangepos.check b/test/files/run/existential-rangepos.check index 1212b60bae..f426c6471f 100644 --- a/test/files/run/existential-rangepos.check +++ b/test/files/run/existential-rangepos.check @@ -1,13 +1,13 @@ [[syntax trees at end of patmat]] // newSource1.scala [0:76]package [0:0]<empty> { - [0:76]abstract class A[[17:18]T[17:18]] extends [20:76][76]scala.AnyRef { + [15/0:76]abstract class A[[17:18]T[17:18]] extends [20:76][76]scala.AnyRef { [76]def <init>(): [20]A[T] = [76]{ [76][76][76]A.super.<init>(); [20]() }; - [24:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null; + [28:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null; [28]<stable> <accessor> def foo: [28]Set[_ <: T] = [28][28]A.this.foo; - [54:74]<stable> <accessor> def bar: [58]Set[_ <: T] + [58:74]<stable> <accessor> def bar: [58]Set[_ <: T] } } diff --git a/test/files/run/existentials.scala b/test/files/run/existentials.scala index 65acfd2ac0..bdd6fb93ee 100644 --- a/test/files/run/existentials.scala +++ b/test/files/run/existentials.scala @@ -5,7 +5,7 @@ class Foo { class Line { case class Cell[T](var x: T) def f[T](x: Any): Cell[t1] forSome { type t1 } = x match { case y: Cell[t] => y } - + var x: Cell[T] forSome { type T } = new Cell(1) println({ x = new Cell("abc"); x }) } @@ -15,7 +15,7 @@ class FooW { class Line { case class Cell[T](var x: T) def f[T](x: Any): Cell[ _ ] = x match { case y: Cell[t] => y } - + var x: Cell[_] = new Cell(1) println({ x = new Cell("abc"); x }) } diff --git a/test/files/run/finally.scala b/test/files/run/finally.scala index 01180fd217..2c01edaaef 100644 --- a/test/files/run/finally.scala +++ b/test/files/run/finally.scala @@ -10,7 +10,7 @@ object Test extends App { case e: Throwable => println(e) } } - + // test that finally is not covered by any exception handlers. def bar { try { @@ -26,7 +26,7 @@ object Test extends App { } // return in catch (finally is executed) - def retCatch { + def retCatch { try { throw new Exception } catch { @@ -37,7 +37,7 @@ object Test extends App { } // throw in catch (finally is executed, exception propagated) - def throwCatch { + def throwCatch { try { throw new Exception } catch { @@ -48,7 +48,7 @@ object Test extends App { } // return inside body (finally is executed) - def retBody { + def retBody { try { return } catch { @@ -75,7 +75,7 @@ object Test extends App { finally { println("in finally 1") return - } + } } finally println("in finally 2") } @@ -94,7 +94,7 @@ object Test extends App { } // nested finallies with return value - def nestedFinalies: Int = + def nestedFinalies: Int = try { try { return 10 diff --git a/test/files/run/flat-flat-flat.scala b/test/files/run/flat-flat-flat.scala index d57696b3a3..80868b9c5e 100644 --- a/test/files/run/flat-flat-flat.scala +++ b/test/files/run/flat-flat-flat.scala @@ -2,7 +2,7 @@ object Test { def f1 = List(Iterator(Some(1), None, Some(2)), Iterator(Some(3), None)) def f2 = Iterator(List(Some(1), None, Some(2)), List(Some(3), None), Nil) def f3 = List(Some(Iterator(1)), None, Some(Iterator(2, 3))) - + def main(args: Array[String]): Unit = { assert(f1.flatten.flatten.toList == List(1, 2, 3)) assert(f2.flatten.flatten.toList == List(1, 2, 3)) diff --git a/test/files/run/forvaleq.scala b/test/files/run/forvaleq.scala index 2a958802b6..8c1824a769 100644 --- a/test/files/run/forvaleq.scala +++ b/test/files/run/forvaleq.scala @@ -2,7 +2,7 @@ import scala.collection.immutable.Queue import scala.{List=>L} - + object Test { // redefine some symbols to make it extra hard class List @@ -16,11 +16,11 @@ object Test { case _ if (x<10) => x case _ => firstDigit(x / 10) } - - + + { - // a basic test case - + // a basic test case + val input = L.range(0,20) val oddFirstTimesTwo = for {x <- input @@ -32,7 +32,7 @@ object Test { { // a test case with patterns - + val input = L.range(0, 20) val oddFirstTimesTwo = for {x <- input @@ -43,10 +43,10 @@ object Test { yield a + b println(oddFirstTimesTwo) } - + { // make sure it works on non-Ls - + // val input: Queue = Queue.Empty[int].incl(L.range(0,20)) val input = L.range(0, 20).iterator val oddFirstTimesTwo = @@ -54,36 +54,36 @@ object Test { xf = firstDigit(x) if xf % 2 == 1} yield x*2 - println(oddFirstTimesTwo.toList) + println(oddFirstTimesTwo.toList) } - + { // yield the computed value - + val input = L.range(0,20) val oddFirstTimesTwo = for {x <- input xf = firstDigit(x) if xf % 2 == 1} yield xf*2 - println(oddFirstTimesTwo) + println(oddFirstTimesTwo) } { // make sure the function is only called once var count: Int = 0 - + def fdct(x: Int) = { count += 1 firstDigit(x) } - + val input = L.range(0,20) for {x <- input xf = fdct(x) if xf % 2 == 1} yield xf - + println("called " + count + " times") } diff --git a/test/files/run/gadts.scala b/test/files/run/gadts.scala index 4ab3ef681a..57c7fc8af0 100644 --- a/test/files/run/gadts.scala +++ b/test/files/run/gadts.scala @@ -2,8 +2,8 @@ abstract class Term[T] case class Lit(x: Int) extends Term[Int] case class Succ(t: Term[Int]) extends Term[Int] case class IsZero(t: Term[Int]) extends Term[Boolean] -case class If[T](c: Term[Boolean], - t1: Term[T], +case class If[T](c: Term[Boolean], + t1: Term[T], t2: Term[T]) extends Term[T] object Test extends App { diff --git a/test/files/run/global-showdef.scala b/test/files/run/global-showdef.scala index 2a00ee51bd..0dbaba979d 100644 --- a/test/files/run/global-showdef.scala +++ b/test/files/run/global-showdef.scala @@ -40,8 +40,8 @@ object Bippy { new Global(settings) } - - def slurp(body: => Unit): String = stringFromStream { stream => + + def slurp(body: => Unit): String = stringFromStream { stream => Console.withOut(stream) { Console.withErr(stream) { body @@ -58,11 +58,11 @@ object Bippy { } def showClass(name: String) = lines("-Yshow:typer", "-Xshow-class", name) def showObject(name: String) = lines("-Yshow:typer", "-Xshow-object", name) - + def show(xs: List[String]) = { xs filter (x => (x contains "def showdefTestMember") || (x startsWith "<<-- ")) foreach println } - + def main(args: Array[String]) { show(List("Bippy", "Bippy#BippyType", "Bippy.BippyType", "Bippy#Boppity", "Bippy#Boppity#Boo") flatMap showClass) show(List("Bippy", "Bippy#Boppity#Boo") flatMap showObject) diff --git a/test/files/run/groupby.scala b/test/files/run/groupby.scala index fe08f52812..a751e65e80 100644 --- a/test/files/run/groupby.scala +++ b/test/files/run/groupby.scala @@ -3,8 +3,8 @@ // Fixes #3422 object Test { - - def main(args: Array[String]) { + + def main(args: Array[String]) { val arr = Array.range(0,10) val map = arr groupBy (_%2) val v1 = map(0) @@ -14,5 +14,5 @@ object Test { // hash map by default. assert(v1 eq v2) } - + } diff --git a/test/files/run/hashCodeBoxesRunTime.scala b/test/files/run/hashCodeBoxesRunTime.scala index 081a73376e..ba1a30f5fb 100644 --- a/test/files/run/hashCodeBoxesRunTime.scala +++ b/test/files/run/hashCodeBoxesRunTime.scala @@ -4,16 +4,16 @@ object Test { import java.{ lang => jl } import scala.runtime.BoxesRunTime.{ hashFromNumber, hashFromObject } - + def allSame[T](xs: List[T]) = assert(xs.distinct.size == 1, "failed: " + xs) - + def mkNumbers(x: Int): List[Number] = List(x.toByte, x.toShort, x, x.toLong, x.toFloat, x.toDouble) - + def testLDF(x: Long) = allSame(List[Number](x, x.toDouble, x.toFloat) map hashFromNumber) - + def main(args: Array[String]): Unit = { - List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n => + List(Byte.MinValue, -1, 0, 1, Byte.MaxValue) foreach { n => val hashes = mkNumbers(n) map hashFromNumber allSame(hashes) if (n >= 0) { @@ -21,7 +21,7 @@ object Test assert(charCode == hashes.head) } } - + testLDF(Short.MaxValue.toLong) testLDF(Short.MinValue.toLong) } diff --git a/test/files/run/hashhash.scala b/test/files/run/hashhash.scala index f9fc067398..3b9d1479cf 100644 --- a/test/files/run/hashhash.scala +++ b/test/files/run/hashhash.scala @@ -1,7 +1,7 @@ object Test { def confirmSame(x: Any) = assert(x.## == x.hashCode, "%s.## != %s.hashCode".format(x, x)) def confirmDifferent(x: Any) = assert(x.## != x.hashCode, "%s.## == %s.hashCode (but should not)".format(x, x)) - + def main(args: Array[String]): Unit = { /** Just a little sanity check, not to be confused with a unit test. */ List(5, 5.5f, "abc", new AnyRef, ()) foreach confirmSame diff --git a/test/files/run/hashset.scala b/test/files/run/hashset.scala index 299dce3aec..a4d49c142e 100644 --- a/test/files/run/hashset.scala +++ b/test/files/run/hashset.scala @@ -40,9 +40,9 @@ object Test extends App { println((for (i <- 0 until 20) yield i + " " + (h2 contains ("" + i))).toList.sorted mkString(",")) println } - + trait Creator { - def create[A] : GenSet[A] with Cloneable with FlatHashTable[A] with Growable[A] with Shrinkable[A] + def create[A] : GenSet[A] with Cloneable with FlatHashTable[A] with Growable[A] with Shrinkable[A] def hashSetType : String } }
\ No newline at end of file diff --git a/test/files/run/indexedSeq.scala b/test/files/run/indexedSeq.scala index 29a8be701d..b1a2b1bc60 100644 --- a/test/files/run/indexedSeq.scala +++ b/test/files/run/indexedSeq.scala @@ -1,8 +1,8 @@ object Test { import scala.collection.immutable - + def checkIdentity[A](xs: immutable.IndexedSeq[A]) = assert(xs.toIndexedSeq eq xs) - + def main(args: Array[String]): Unit = { def r = 1 to 10 checkIdentity(immutable.Vector(r: _*)) diff --git a/test/files/run/infix.scala b/test/files/run/infix.scala index 700e4347ac..a867d03ce8 100644 --- a/test/files/run/infix.scala +++ b/test/files/run/infix.scala @@ -9,4 +9,3 @@ object Test extends App { case null op (0, 0) op (1, 1) op (2, 2) => Console.println("OK") } } - diff --git a/test/files/run/inliner-infer.scala b/test/files/run/inliner-infer.scala index ea83966c52..e41d6ae5c7 100644 --- a/test/files/run/inliner-infer.scala +++ b/test/files/run/inliner-infer.scala @@ -7,8 +7,8 @@ object Test extends App { @annotation.tailrec def walk(xs: MyList): Unit = { - if (xs.isEmpty) - println("empty") + if (xs.isEmpty) + println("empty") else { println("non-empty") walk(MyNil) @@ -26,4 +26,3 @@ object MyNil extends MyList { override def isEmpty = true } - diff --git a/test/files/run/inner-obj-auto.scala b/test/files/run/inner-obj-auto.scala index 35ca56ba3e..00ea5119cc 100644 --- a/test/files/run/inner-obj-auto.scala +++ b/test/files/run/inner-obj-auto.scala @@ -3,15 +3,15 @@ /* ================================================================================ Automatically generated on 2011-05-11. Do Not Edit (unless you have to). (2-level nesting) - ================================================================================ */ + ================================================================================ */ class Class2_1 { - + class Class1_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -31,16 +31,16 @@ class Class2_1 { def run { runTest } } - + def run { (new Class1_2).run } } object Object3_1 { - + class Class1_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -60,16 +60,16 @@ object Object3_1 { def run { runTest } } - + def run { (new Class1_2).run } // trigger } trait Trait4_1 { - + class Class1_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -89,16 +89,16 @@ trait Trait4_1 { def run { runTest } } - + def run { (new Class1_2).run } } class Class6_1 { - + object Object5_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -118,16 +118,16 @@ class Class6_1 { def run { runTest } // trigger } - + def run { Object5_2.run } } object Object7_1 { - + object Object5_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -147,16 +147,16 @@ object Object7_1 { def run { runTest } // trigger } - + def run { Object5_2.run } // trigger } trait Trait8_1 { - + object Object5_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -176,16 +176,16 @@ trait Trait8_1 { def run { runTest } // trigger } - + def run { Object5_2.run } } class Class10_1 { - + trait Trait9_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -205,16 +205,16 @@ class Class10_1 { def run { runTest } } - + def run { (new Trait9_2 {}).run } } object Object11_1 { - + trait Trait9_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -234,16 +234,16 @@ object Object11_1 { def run { runTest } } - + def run { (new Trait9_2 {}).run } // trigger } trait Trait12_1 { - + trait Trait9_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -263,16 +263,16 @@ trait Trait12_1 { def run { runTest } } - + def run { (new Trait9_2 {}).run } } class Class14_1 { - + def method13_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -292,16 +292,16 @@ class Class14_1 { runTest // trigger } - + def run { method13_2 } } object Object15_1 { - + def method13_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -321,16 +321,16 @@ object Object15_1 { runTest // trigger } - + def run { method13_2 } // trigger } trait Trait16_1 { - + def method13_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -350,16 +350,16 @@ trait Trait16_1 { runTest // trigger } - + def run { method13_2 } } class Class18_1 { - + private def method17_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -379,16 +379,16 @@ class Class18_1 { runTest // trigger } - + def run { method17_2 } } object Object19_1 { - + private def method17_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -408,16 +408,16 @@ object Object19_1 { runTest // trigger } - + def run { method17_2 } // trigger } trait Trait20_1 { - + private def method17_2 { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -437,16 +437,16 @@ trait Trait20_1 { runTest // trigger } - + def run { method17_2 } } class Class22_1 { - + val fun21_2 = () => { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -466,16 +466,16 @@ class Class22_1 { runTest // trigger } - + def run { fun21_2() } } object Object23_1 { - + val fun21_2 = () => { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -495,16 +495,16 @@ object Object23_1 { runTest // trigger } - + def run { fun21_2() } // trigger } trait Trait24_1 { - + val fun21_2 = () => { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -524,17 +524,17 @@ trait Trait24_1 { runTest // trigger } - + def run { fun21_2() } } class Class26_1 { - + class Class25_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -553,19 +553,19 @@ class Class26_1 { } runTest // trigger - } + } } - + def run { (new Class25_2) } } object Object27_1 { - + class Class25_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -584,19 +584,19 @@ object Object27_1 { } runTest // trigger - } + } } - + def run { (new Class25_2) } // trigger } trait Trait28_1 { - + class Class25_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -615,19 +615,19 @@ trait Trait28_1 { } runTest // trigger - } + } } - + def run { (new Class25_2) } } class Class30_1 { - + trait Trait29_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -646,19 +646,19 @@ class Class30_1 { } runTest // trigger - } + } } - + def run { (new Trait29_2 {}) } } object Object31_1 { - + trait Trait29_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -677,19 +677,19 @@ object Object31_1 { } runTest // trigger - } + } } - + def run { (new Trait29_2 {}) } // trigger } trait Trait32_1 { - + trait Trait29_2 { - { // in primary constructor + { // in primary constructor var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -708,18 +708,18 @@ trait Trait32_1 { } runTest // trigger - } + } } - + def run { (new Trait29_2 {}) } } class Class34_1 { - + lazy val lzvalue33_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -739,16 +739,16 @@ class Class34_1 { runTest // trigger } - + def run { lzvalue33_2 } } object Object35_1 { - + lazy val lzvalue33_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -768,16 +768,16 @@ object Object35_1 { runTest // trigger } - + def run { lzvalue33_2 } // trigger } trait Trait36_1 { - + lazy val lzvalue33_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -797,16 +797,16 @@ trait Trait36_1 { runTest // trigger } - + def run { lzvalue33_2 } } class Class38_1 { - + val value37_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -826,16 +826,16 @@ class Class38_1 { runTest // trigger } - + def run { value37_2 } } object Object39_1 { - + val value37_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -855,16 +855,16 @@ object Object39_1 { runTest // trigger } - + def run { value37_2 } // trigger } trait Trait40_1 { - + val value37_2 = { var ObjCounter = 0 - + object Obj { ObjCounter += 1} Obj // one @@ -884,16 +884,16 @@ trait Trait40_1 { runTest // trigger } - + def run { value37_2 } } class Class42_1 { - + class Class41_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -913,16 +913,16 @@ class Class42_1 { def run { runTest } } - + def run { (new Class41_2).run } } object Object43_1 { - + class Class41_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -942,16 +942,16 @@ object Object43_1 { def run { runTest } } - + def run { (new Class41_2).run } // trigger } trait Trait44_1 { - + class Class41_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -971,16 +971,16 @@ trait Trait44_1 { def run { runTest } } - + def run { (new Class41_2).run } } class Class46_1 { - + object Object45_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1000,16 +1000,16 @@ class Class46_1 { def run { runTest } // trigger } - + def run { Object45_2.run } } object Object47_1 { - + object Object45_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1029,16 +1029,16 @@ object Object47_1 { def run { runTest } // trigger } - + def run { Object45_2.run } // trigger } trait Trait48_1 { - + object Object45_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1058,16 +1058,16 @@ trait Trait48_1 { def run { runTest } // trigger } - + def run { Object45_2.run } } class Class50_1 { - + trait Trait49_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1087,16 +1087,16 @@ class Class50_1 { def run { runTest } } - + def run { (new Trait49_2 {}).run } } object Object51_1 { - + trait Trait49_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1116,16 +1116,16 @@ object Object51_1 { def run { runTest } } - + def run { (new Trait49_2 {}).run } // trigger } trait Trait52_1 { - + trait Trait49_2 { var ObjCounter = 0 - + private object Obj { ObjCounter += 1} Obj // one @@ -1145,16 +1145,16 @@ trait Trait52_1 { def run { runTest } } - + def run { (new Trait49_2 {}).run } } class Class54_1 { - + class Class53_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1178,16 +1178,16 @@ class Class54_1 { def run { runTest } } - + def run { (new Class53_2).run } } object Object55_1 { - + class Class53_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1211,16 +1211,16 @@ object Object55_1 { def run { runTest } } - + def run { (new Class53_2).run } // trigger } trait Trait56_1 { - + class Class53_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1244,16 +1244,16 @@ trait Trait56_1 { def run { runTest } } - + def run { (new Class53_2).run } } class Class58_1 { - + object Object57_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1277,16 +1277,16 @@ class Class58_1 { def run { runTest } // trigger } - + def run { Object57_2.run } } object Object59_1 { - + object Object57_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1310,16 +1310,16 @@ object Object59_1 { def run { runTest } // trigger } - + def run { Object57_2.run } // trigger } trait Trait60_1 { - + object Object57_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1343,16 +1343,16 @@ trait Trait60_1 { def run { runTest } // trigger } - + def run { Object57_2.run } } class Class62_1 { - + trait Trait61_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1376,16 +1376,16 @@ class Class62_1 { def run { runTest } } - + def run { (new Trait61_2 {}).run } } object Object63_1 { - + trait Trait61_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1409,16 +1409,16 @@ object Object63_1 { def run { runTest } } - + def run { (new Trait61_2 {}).run } // trigger } trait Trait64_1 { - + trait Trait61_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1442,16 +1442,16 @@ trait Trait64_1 { def run { runTest } } - + def run { (new Trait61_2 {}).run } } class Class66_1 { - + def method65_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1475,16 +1475,16 @@ class Class66_1 { runTest // trigger } - + def run { method65_2 } } object Object67_1 { - + def method65_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1508,16 +1508,16 @@ object Object67_1 { runTest // trigger } - + def run { method65_2 } // trigger } trait Trait68_1 { - + def method65_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1541,16 +1541,16 @@ trait Trait68_1 { runTest // trigger } - + def run { method65_2 } } class Class70_1 { - + private def method69_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1574,16 +1574,16 @@ class Class70_1 { runTest // trigger } - + def run { method69_2 } } object Object71_1 { - + private def method69_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1607,16 +1607,16 @@ object Object71_1 { runTest // trigger } - + def run { method69_2 } // trigger } trait Trait72_1 { - + private def method69_2 { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1640,16 +1640,16 @@ trait Trait72_1 { runTest // trigger } - + def run { method69_2 } } class Class74_1 { - + val fun73_2 = () => { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1673,16 +1673,16 @@ class Class74_1 { runTest // trigger } - + def run { fun73_2() } } object Object75_1 { - + val fun73_2 = () => { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1706,16 +1706,16 @@ object Object75_1 { runTest // trigger } - + def run { fun73_2() } // trigger } trait Trait76_1 { - + val fun73_2 = () => { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1739,17 +1739,17 @@ trait Trait76_1 { runTest // trigger } - + def run { fun73_2() } } class Class78_1 { - + class Class77_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1772,19 +1772,19 @@ class Class78_1 { } runTest // trigger - } + } } - + def run { (new Class77_2) } } object Object79_1 { - + class Class77_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1807,19 +1807,19 @@ object Object79_1 { } runTest // trigger - } + } } - + def run { (new Class77_2) } // trigger } trait Trait80_1 { - + class Class77_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1842,19 +1842,19 @@ trait Trait80_1 { } runTest // trigger - } + } } - + def run { (new Class77_2) } } class Class82_1 { - + trait Trait81_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1877,19 +1877,19 @@ class Class82_1 { } runTest // trigger - } + } } - + def run { (new Trait81_2 {}) } } object Object83_1 { - + trait Trait81_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1912,19 +1912,19 @@ object Object83_1 { } runTest // trigger - } + } } - + def run { (new Trait81_2 {}) } // trigger } trait Trait84_1 { - + trait Trait81_2 { - { // in primary constructor + { // in primary constructor @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1947,18 +1947,18 @@ trait Trait84_1 { } runTest // trigger - } + } } - + def run { (new Trait81_2 {}) } } class Class90_1 { - + val value89_2 = { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -1982,16 +1982,16 @@ class Class90_1 { runTest // trigger } - + def run { value89_2 } } trait Trait92_1 { - + val value89_2 = { @volatile var ObjCounter = 0 - + object Obj { ObjCounter += 1} def multiThreadedAccess() { @@ -2015,7 +2015,7 @@ trait Trait92_1 { runTest // trigger } - + def run { value89_2 } } diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala index e5f9e4705a..31859cf867 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -9,8 +9,8 @@ object iq { /* Create an empty queue. */ val q: Queue[Int] = Queue.empty - /* Test isEmpty. - * Expected: Empty + /* Test isEmpty. + * Expected: Empty */ if (q.isEmpty) { Console.println("Empty") @@ -20,14 +20,14 @@ object iq { //val q2 = q + 42 + 0 // deprecated val q2 = q.enqueue(42).enqueue(0) - /* Test is empty and dequeue. + /* Test is empty and dequeue. * Expected: Head: 42 */ val q4 = if (q2.isEmpty) { Console.println("Empty") q2 - } + } else { val (head, q3) = q2.dequeue Console.println("Head: " + head) @@ -36,8 +36,8 @@ object iq { /* Test sequence enqueing. */ val q5: Queue[Any] = q4.enqueue(List(1,2,3,4,5,6,7,8,9)) - /* Test toString. - * Expected: Head: q5: Queue(0,1,2,3,4,5,6,7,8,9) + /* Test toString. + * Expected: Head: q5: Queue(0,1,2,3,4,5,6,7,8,9) */ Console.println("q5: " + q5) /* Test apply @@ -59,7 +59,7 @@ object iq { //val q8 = q7 + 10 + 11 //deprecated val q8 = q7.enqueue(10).enqueue(11) /* Test dequeu - * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11) + * Expected: q8: Queue(2,3,4,5,6,7,8,9,10,11) */ Console.println("q8: " + q8) val q9 = Queue(2,3,4,5,6,7,8,9,10,11) @@ -70,14 +70,14 @@ object iq { Console.println("q8 == q9: " + (q8 == q9)) /* Testing elements - * Expected: Elements: 1 2 3 4 5 6 7 8 9 + * Expected: Elements: 1 2 3 4 5 6 7 8 9 */ - Console.print("Elements: "); + Console.print("Elements: "); q6.iterator.foreach(e => Console.print(" "+ e + " ")) - Console.println; + Console.println; /* Testing mkString - * Expected: String: <1-2-3-4-5-6-7-8-9> + * Expected: String: <1-2-3-4-5-6-7-8-9> */ Console.println("String: " + q6.mkString("<","-",">")) @@ -89,7 +89,7 @@ object iq { /* Testing front * Expected: Front: 1 */ - Console.println("Front: " + q6.front); + Console.println("Front: " + q6.front); } } diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala index 19a3b9c7c0..d314015dd4 100644 --- a/test/files/run/is-valid-num.scala +++ b/test/files/run/is-valid-num.scala @@ -127,7 +127,7 @@ object Test { checkBigInt2(biExp2(128) - biExp2(128 - pf)) checkBigInt2(biExp2(128) - biExp2(128 - pf - 1)) checkBigInt2(biExp2(128)) - + checkBigInt2(biExp2(1023)) checkBigInt2(biExp2(1024) - biExp2(1024 - pd)) checkBigInt2(biExp2(1024) - biExp2(1024 - pd - 1)) diff --git a/test/files/run/issue192.scala b/test/files/run/issue192.scala index 3c3b44a8fb..8e6d13e5e1 100644 --- a/test/files/run/issue192.scala +++ b/test/files/run/issue192.scala @@ -1,18 +1,18 @@ import scala.language.reflectiveCalls object Test extends App { - + def f1(p: Any{def unary_+ : Int}) = +p def f2(p: Any{def unary_- : Int}) = -p def f3(p: Any{def unary_~ : Int}) = ~p def f4(p: Any{def unary_! : Boolean}) = !p - + def f5(p: Any{def +(q: Int): Int}) = p + 7 def f6(p: Any{def -(q: Int): Int}) = p - 7 def f7(p: Any{def *(q: Int): Int}) = p * 7 def f8(p: Any{def /(q: Int): Int}) = p / 7 def f9(p: Any{def %(q: Int): Int}) = p % 7 - + def f10(p: Any{def |(q: Int): Int}) = p | 7 def f11(p: Any{def |(q: Boolean): Boolean}) = p | true def f12(p: Any{def ^(q: Int): Int}) = p ^ 7 @@ -21,11 +21,11 @@ object Test extends App { def f15(p: Any{def &(q: Boolean): Boolean}) = p & true def f16(p: Any{def ||(q: Boolean): Boolean}) = p || true def f17(p: Any{def &&(q: Boolean): Boolean}) = p && true - + def f18(p: Any{def <<(q: Int): Int}) = p << 7 def f19(p: Any{def >>(q: Int): Int}) = p >> 7 def f20(p: Any{def >>>(q: Int): Int}) = p >>> 7 - + def f21(p: Any{def toByte: Byte}) = p.toByte def f22(p: Any{def toShort: Short}) = p.toShort def f23(p: Any{def toChar: Char}) = p.toChar @@ -33,28 +33,28 @@ object Test extends App { def f25(p: Any{def toLong: Long}) = p.toLong def f26(p: Any{def toFloat: Float}) = p.toFloat def f27(p: Any{def toDouble: Double}) = p.toDouble - + def f28(p: Any{def ==(q: Int): Boolean}) = p == 7 def f29(p: Any{def !=(q: Int): Boolean}) = p != 7 def f30(p: Any{def ==(q: Boolean): Boolean}) = p == true def f31(p: Any{def !=(q: Boolean): Boolean}) = p != true - + def f32(p: Any{def <(q: Int): Boolean}) = p < 7 def f33(p: Any{def <=(q: Int): Boolean}) = p <= 7 def f34(p: Any{def >=(q: Int): Boolean}) = p >= 7 def f35(p: Any{def >(q: Int): Boolean}) = p > 7 - + print("f1 = "); println(f1(1) == +1) print("f2 = "); println(f2(1) == -1) print("f3 = "); println(f3(1) == ~1) print("f4 = "); println(f4(true) == !true) - + print("f5 = "); println(f5(4) == (4 + 7)) print("f6 = "); println(f6(4) == (4 - 7)) print("f7 = "); println(f7(4) == (4 * 7)) print("f8 = "); println(f8(4) == (4 / 7)) print("f9 = "); println(f9(4) == (4 % 7)) - + print("f10 = "); println(f10(4) == (4 | 7)) print("f11 = "); println(f11(false) == (false | true)) print("f12 = "); println(f12(4) == (4 ^ 7)) @@ -63,11 +63,11 @@ object Test extends App { print("f15 = "); println(f15(false) == (false & true)) print("f16 = "); println(f16(false) == (false || true)) print("f17 = "); println(f17(false) == (false && true)) - + print("f18 = "); println(f18(4) == (4 << 7)) print("f19 = "); println(f19(-4) == (-4 >> 7)) print("f20 = "); println(f20(-4) == (-4 >>> 7)) - + print("f21 = "); println(f21(4.2) == (4.2.toByte)) print("f22 = "); println(f22(4.2) == (4.2.toShort)) print("f23 = "); println(f23(4.2) == (4.2.toChar)) @@ -75,17 +75,17 @@ object Test extends App { print("f25 = "); println(f25(4.2) == (4.2.toLong)) print("f26 = "); println(f26(4.2) == (4.2.toFloat)) print("f27 = "); println(f27(4.2) == (4.2.toDouble)) - + print("f28 = "); println(f28(4) == (4 == 7)) print("f29 = "); println(f29(4) == (4 != 7)) print("f30 = "); println(f30(false) == (false == true)) print("f31 = "); println(f31(false) == (false != true)) - + print("f32 = "); println(f32(4) == (4 < 7)) print("f33 = "); println(f33(4) == (4 <= 7)) print("f34 = "); println(f34(4) == (4 >= 7)) print("f35 = "); println(f35(4) == (4 > 7)) - + println("ok") - + } diff --git a/test/files/run/iterator-from.scala b/test/files/run/iterator-from.scala index fb33f6b5ed..269e859657 100644 --- a/test/files/run/iterator-from.scala +++ b/test/files/run/iterator-from.scala @@ -25,7 +25,7 @@ object Test extends App { } def testMap[A <% Ordered[A], B](map: SortedMap[A, B], list: List[(A, B)]) { - val distinctSorted = distinctByKey(list).sortBy(_._1) + val distinctSorted = distinctByKey(list).sortBy(_._1) assertEquals("Map size wasn't the same as list sze", map.size, distinctSorted.size) for(keyValue <- distinctSorted) { @@ -35,7 +35,7 @@ object Test extends App { check(clazz, list, s"map iteratorFrom $key", s"(map from $key).iterator", iteratorFrom, (map from key).iterator.toList) check(clazz, list, s"map iteratorFrom $key", s"distinctSorted dropWhile (_._1 < $key)", iteratorFrom, distinctSorted dropWhile (_._1 < key)) check(clazz, list, s"map iteratorFrom $key map (_._1)", s"map keysIteratorFrom $key", iteratorFrom map (_._1), (map keysIteratorFrom key).toList) - check(clazz, list, s"map iteratorFrom $key map (_._2)", s"map valuesIteratorFrom $key", iteratorFrom map (_._2), (map valuesIteratorFrom key).toList) + check(clazz, list, s"map iteratorFrom $key map (_._2)", s"map valuesIteratorFrom $key", iteratorFrom map (_._2), (map valuesIteratorFrom key).toList) } } @@ -54,7 +54,7 @@ object Test extends App { val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value } - 0 until maxLength foreach {length => + 0 until maxLength foreach {length => val keyValues = (0 until length map {_ => (R nextInt maxKey, R nextInt maxValue)}).toList val keys = keyValues map (_._2) testSet(immutable.BitSet(keys:_*), keys) diff --git a/test/files/run/iterator3444.scala b/test/files/run/iterator3444.scala index 2d0643bd56..1d0713addc 100644 --- a/test/files/run/iterator3444.scala +++ b/test/files/run/iterator3444.scala @@ -2,22 +2,22 @@ // ticked #3444 object Test { - + def main(args: Array[String]) { val it = (1 to 12).toSeq.iterator - + assert(it.next == 1) assert(it.take(2).toList == List(2, 3)) - + val jt = (4 to 12).toSeq.iterator assert(jt.next == 4) assert(jt.drop(5).toList == List(10, 11, 12)) - + val kt = (1 until 10).toSeq.iterator assert(kt.drop(50).toList == Nil) - + val mt = (1 until 5).toSeq.iterator assert(mt.take(50).toList == List(1, 2, 3, 4)) } - + } diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index e2d0f93a05..57e05d3472 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -84,16 +84,16 @@ object Test { var xs4 = a.slice(0, 4).iterator.toList; xs0.length + xs1.length + xs2.length + xs3.length + xs4.length } - + def check_toSeq: String = List(1, 2, 3, 4, 5).iterator.toSeq.mkString("x") - + def check_indexOf: String = { val i = List(1, 2, 3, 4, 5).indexOf(4) val j = List(1, 2, 3, 4, 5).indexOf(16) "" + i + "x" + j } - + def check_findIndexOf: String = { val i = List(1, 2, 3, 4, 5).indexWhere { x: Int => x >= 4 } val j = List(1, 2, 3, 4, 5).indexWhere { x: Int => x >= 16 } diff --git a/test/files/run/java-erasure.scala b/test/files/run/java-erasure.scala index 0441ad705b..c9f9b0ad51 100644 --- a/test/files/run/java-erasure.scala +++ b/test/files/run/java-erasure.scala @@ -3,7 +3,7 @@ object Test { list add "a" list add "c" list add "b" - + def main(args: Array[String]): Unit = { println(java.util.Collections.max(list)) } diff --git a/test/files/run/kind-repl-command.check b/test/files/run/kind-repl-command.check index afa32acdae..1c292572e6 100644 --- a/test/files/run/kind-repl-command.check +++ b/test/files/run/kind-repl-command.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> :kind scala.Option scala.Option's kind is F[+A] @@ -28,5 +26,3 @@ scala> :k Nonexisting ^ scala> - -scala> diff --git a/test/files/run/kmpSliceSearch.scala b/test/files/run/kmpSliceSearch.scala index 0f7e052d5f..e72f78bfed 100644 --- a/test/files/run/kmpSliceSearch.scala +++ b/test/files/run/kmpSliceSearch.scala @@ -12,7 +12,7 @@ object Test { } def main(args: Array[String]) { val rng = new scala.util.Random(java.lang.Integer.parseInt("kmp",36)) - + // Make sure we agree with naive implementation for (h <- Array(2,5,1000)) { for (i <- 0 to 100) { @@ -38,7 +38,7 @@ object Test { } } } - + // Check performance^Wcorrectness of common small test cases val haystacks = List[Seq[Int]]( Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15), @@ -52,8 +52,8 @@ object Test { List(1,1,1,1,1,2), 5 to 9 ) - (haystacks zip needles) foreach { - case (hay, nee) => + (haystacks zip needles) foreach { + case (hay, nee) => println(hay.indexOfSlice(nee,2) + " " + hay.lastIndexOfSlice(nee,13)) } } diff --git a/test/files/run/lazy-exprs.scala b/test/files/run/lazy-exprs.scala index fc724bd10b..204c4b564b 100644 --- a/test/files/run/lazy-exprs.scala +++ b/test/files/run/lazy-exprs.scala @@ -2,7 +2,7 @@ object TestExpressions { def patmatchScrut { lazy val z1: Option[String] = { println("forced <z1>"); Some("lazy z1") } - + val res = z1 match { case Some(msg) => msg case None => "failed" @@ -17,10 +17,10 @@ object TestExpressions { def patmatchCase { val t: Option[String] = Some("test") val res = t match { - case Some(msg) => + case Some(msg) => lazy val z1 = { println("forced <z1>"); "lazy z1" } z1 - + case None => "failed" } print("lazy val in case: ") @@ -36,9 +36,9 @@ object TestExpressions { print("lazy val in case: ") val t: Option[String] = Some("lazy Z1") t match { - case Some(Z1) => + case Some(Z1) => println("ok") - + case None => println("failed") } @@ -60,13 +60,13 @@ object TestExpressions { print("lazy val in pattern: ") val t: Option[String] = Some("LazyField") t match { - case Some(LazyField) => + case Some(LazyField) => println("ok") - + case None => println("failed") } - } + } lazy val (x, y) = ({print("x"); "x"}, {print("y"); "y"}) def testPatLazyVal { diff --git a/test/files/run/lazy-locals.scala b/test/files/run/lazy-locals.scala index 8d4c61be8c..b28b28e35d 100644 --- a/test/files/run/lazy-locals.scala +++ b/test/files/run/lazy-locals.scala @@ -59,7 +59,7 @@ object Test extends App { val sum3 = t00 + t01 + t02 + t03 + t04 + t05 + t06 + t07 + t08 + t09 + t10 + t11 + t12 + t13 + t14 + t15 + t16 + t17 + t18 + t19 + t20 + t21 + t22 + t23 + t24 + t25 + t26 + - t27 + t28 + t29 + t30 + t31 + t27 + t28 + t29 + t30 + t31 @@ -175,18 +175,18 @@ object Test extends App { // see #1589 object NestedLazyVals { - lazy val x = { + lazy val x = { lazy val y = { println("forcing y"); 42; } println("forcing x") - y + y } - + val x1 = 5 + { lazy val y = 10 ; y } - + println(x) println(x1) } - + trait TNestedLazyVals { lazy val x = { lazy val y = 42; y } } diff --git a/test/files/run/lazy-override-run.scala b/test/files/run/lazy-override-run.scala index d197408775..6016c3c8be 100644 --- a/test/files/run/lazy-override-run.scala +++ b/test/files/run/lazy-override-run.scala @@ -20,7 +20,7 @@ object Test extends App { val b = new B print("b.x=") - println(b.x) + println(b.x) print("b.z=") - println(b.z) + println(b.z) } diff --git a/test/files/run/lazy-traits.scala b/test/files/run/lazy-traits.scala index f04c0b8b1f..38207672db 100644 --- a/test/files/run/lazy-traits.scala +++ b/test/files/run/lazy-traits.scala @@ -1,5 +1,5 @@ trait A { - lazy val z1 = { + lazy val z1 = { println("<forced z1>") "lazy z1" } @@ -7,7 +7,7 @@ trait A { /** Simple class which mixes in one lazy val. */ class Cls extends AnyRef with A { - override def toString = + override def toString = "z1 = " + z1 } @@ -18,7 +18,7 @@ class Cls2 extends AnyRef with A { "lazy z2" } - override def toString = + override def toString = "z1 = " + z1 + " z2 = " + z2 } @@ -34,7 +34,7 @@ class ClsB extends Object with B { println("<forced zc1>") "lazy zc1" } - override def toString = + override def toString = "z1 = " + z1 + " zb1 = " + zb1 + " zc1 = " + zc1 } @@ -73,39 +73,39 @@ class OverflownLazyFields extends Object with A { lazy val zc30 = { println("<forced zc30>"); "lazy zc30" } lazy val zc31 = { println("<forced zc31>"); "lazy zc31" } - override def toString = - "\nzc00 = " + zc00 + - "\nzc01 = " + zc01 + - "\nzc02 = " + zc02 + - "\nzc03 = " + zc03 + - "\nzc04 = " + zc04 + - "\nzc05 = " + zc05 + - "\nzc06 = " + zc06 + - "\nzc07 = " + zc07 + - "\nzc08 = " + zc08 + - "\nzc09 = " + zc09 + - "\nzc10 = " + zc10 + - "\nzc11 = " + zc11 + - "\nzc12 = " + zc12 + - "\nzc13 = " + zc13 + - "\nzc14 = " + zc14 + - "\nzc15 = " + zc15 + - "\nzc16 = " + zc16 + - "\nzc17 = " + zc17 + - "\nzc18 = " + zc18 + - "\nzc19 = " + zc19 + - "\nzc20 = " + zc20 + - "\nzc21 = " + zc21 + - "\nzc22 = " + zc22 + - "\nzc23 = " + zc23 + - "\nzc24 = " + zc24 + - "\nzc25 = " + zc25 + - "\nzc26 = " + zc26 + - "\nzc27 = " + zc27 + - "\nzc28 = " + zc28 + - "\nzc29 = " + zc29 + - "\nzc30 = " + zc30 + - "\nzc31 = " + zc31 + + override def toString = + "\nzc00 = " + zc00 + + "\nzc01 = " + zc01 + + "\nzc02 = " + zc02 + + "\nzc03 = " + zc03 + + "\nzc04 = " + zc04 + + "\nzc05 = " + zc05 + + "\nzc06 = " + zc06 + + "\nzc07 = " + zc07 + + "\nzc08 = " + zc08 + + "\nzc09 = " + zc09 + + "\nzc10 = " + zc10 + + "\nzc11 = " + zc11 + + "\nzc12 = " + zc12 + + "\nzc13 = " + zc13 + + "\nzc14 = " + zc14 + + "\nzc15 = " + zc15 + + "\nzc16 = " + zc16 + + "\nzc17 = " + zc17 + + "\nzc18 = " + zc18 + + "\nzc19 = " + zc19 + + "\nzc20 = " + zc20 + + "\nzc21 = " + zc21 + + "\nzc22 = " + zc22 + + "\nzc23 = " + zc23 + + "\nzc24 = " + zc24 + + "\nzc25 = " + zc25 + + "\nzc26 = " + zc26 + + "\nzc27 = " + zc27 + + "\nzc28 = " + zc28 + + "\nzc29 = " + zc29 + + "\nzc30 = " + zc30 + + "\nzc31 = " + zc31 + "\nz1 = " + z1 } diff --git a/test/files/run/lift-and-unlift.scala b/test/files/run/lift-and-unlift.scala index a4a5d9502e..9cd85666e8 100644 --- a/test/files/run/lift-and-unlift.scala +++ b/test/files/run/lift-and-unlift.scala @@ -5,21 +5,21 @@ object Test { val evens2: PartialFunction[Int, Int] = { case x if x % 2 == 0 => x } - + def main(args: Array[String]): Unit = { val f1 = evens1 _ val f2 = evens2.lift - + assert(1 to 10 forall (x => f1(x) == f2(x))) - + val f3 = unlift(f1) val f4 = unlift(f2) - + assert(1 to 10 forall { x => if (!f3.isDefinedAt(x)) !f4.isDefinedAt(x) else f3(x) == f4(x) }) - + assert(f1 eq f3.lift) assert(f4 eq unlift(f2)) assert(f4 eq evens2) diff --git a/test/files/run/lists-run.scala b/test/files/run/lists-run.scala index 5ff3ee353e..05767b9005 100644 --- a/test/files/run/lists-run.scala +++ b/test/files/run/lists-run.scala @@ -6,7 +6,7 @@ import scala.language.postfixOps object Test { def main(args: Array[String]) { - Test_multiset.run() // multiset operations: union, intersect, diff + Test_multiset.run() // multiset operations: union, intersect, diff Test1.run() //count, exists, filter, .. Test2.run() //#468 Test3.run() //#1691 @@ -56,7 +56,7 @@ object Test_multiset { assert(List(3, 2) == (vs diff xs), "vs_diff_xs") assert(isSubListOf(xs filterNot (vs contains), xs diff vs), "xs_subset_vs") - // tests adapted from Thomas Jung + // tests adapted from Thomas Jung assert({ def sort(zs: List[Int]) = zs sortWith ( _ > _ ) sort(xs intersect ys) == sort(ys intersect xs) @@ -64,7 +64,7 @@ object Test_multiset { assert({ def cardinality[A](zs: List[A], e: A): Int = zs count (e == _) val intersection = xs intersect ys - xs forall (e => cardinality(intersection, e) == (cardinality(xs, e) + xs forall (e => cardinality(intersection, e) == (cardinality(xs, e) min cardinality(ys, e))) }, "obey min cardinality") assert({ @@ -135,7 +135,7 @@ object Test2 { def run() { val xs1 = List(1, 2, 3) val xs2 = List(0) - + val ys1 = xs1 ::: List(4) assert(List(1, 2, 3, 4) == ys1, "check_:::") diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check index 50a0cadebf..f76579412e 100644 --- a/test/files/run/lub-visibility.check +++ b/test/files/run/lub-visibility.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> // should infer List[scala.collection.immutable.Seq[Nothing]] scala> // but reverted that for SI-5534. @@ -11,5 +9,3 @@ scala> val x = List(List(), Vector()) x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing] with java.io.Serializable] = List(List(), Vector()) scala> - -scala> diff --git a/test/files/run/macro-abort-fresh.check b/test/files/run/macro-abort-fresh.check index 75ad5e79f8..87491f6e48 100644 --- a/test/files/run/macro-abort-fresh.check +++ b/test/files/run/macro-abort-fresh.check @@ -1,6 +1,6 @@ $1$ qwe1 qwe2 -reflective compilation has failed: +reflective compilation has failed: blargh diff --git a/test/files/run/macro-def-infer-return-type.check b/test/files/run/macro-def-infer-return-type.check index 308e881960..fbd164f139 100644 --- a/test/files/run/macro-def-infer-return-type.check +++ b/test/files/run/macro-def-infer-return-type.check @@ -1,5 +1,5 @@ 42 -reflective compilation has failed: +reflective compilation has failed: exception during macro expansion: java.lang.Error: an implementation is missing diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check index 1c3ecfdefb..2709b57038 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad.check @@ -1,4 +1,4 @@ -reflective compilation has failed: +reflective compilation has failed: no `: _*' annotation allowed here (such annotations are only allowed in arguments to *-parameters) diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check index 916195145e..1d531f6d86 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype.check @@ -1,4 +1,4 @@ -reflective compilation has failed: +reflective compilation has failed: type mismatch; found : String("42") diff --git a/test/files/run/macro-invalidret-nontypeable.check b/test/files/run/macro-invalidret-nontypeable.check index cf7acb0d60..25cef2c786 100644 --- a/test/files/run/macro-invalidret-nontypeable.check +++ b/test/files/run/macro-invalidret-nontypeable.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: not found: value IDoNotExist diff --git a/test/files/run/macro-invalidusage-badret.check b/test/files/run/macro-invalidusage-badret.check index 221732eefc..9225b716d6 100644 --- a/test/files/run/macro-invalidusage-badret.check +++ b/test/files/run/macro-invalidusage-badret.check @@ -1,4 +1,4 @@ -reflective compilation has failed: +reflective compilation has failed: type mismatch; found : Int(42) diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check index 326f3e08ca..6cbcb9e5af 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams.check +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: too few argument lists for macro invocation diff --git a/test/files/run/macro-invalidusage-partialapplication.check b/test/files/run/macro-invalidusage-partialapplication.check index 326f3e08ca..6cbcb9e5af 100644 --- a/test/files/run/macro-invalidusage-partialapplication.check +++ b/test/files/run/macro-invalidusage-partialapplication.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: too few argument lists for macro invocation diff --git a/test/files/run/macro-reify-freevars.check b/test/files/run/macro-reify-freevars.check index f13806889e..f618e307b2 100644 --- a/test/files/run/macro-reify-freevars.check +++ b/test/files/run/macro-reify-freevars.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: Macro expansion contains free term variable code defined by map in Macros_1.scala:9:9. Have you forgotten to use splice when splicing this variable into a reifee? If you have troubles tracking free term variables, consider using -Xlog-free-terms diff --git a/test/files/run/macro-reify-tagless-a.check b/test/files/run/macro-reify-tagless-a.check index 231741edc5..d160e8043c 100644 --- a/test/files/run/macro-reify-tagless-a.check +++ b/test/files/run/macro-reify-tagless-a.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: Macro expansion contains free type variable T defined by foo in Impls_Macros_1.scala:7:13. Have you forgotten to use c.WeakTypeTag annotation for this type parameter? If you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index 8d43a3aa16..46ea1f6405 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import language.experimental.macros import language.experimental.macros diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index 99b70ea3dc..9c35aad6b1 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> def bar(c: scala.reflect.macros.Context) = ??? bar: (c: scala.reflect.macros.Context)Nothing diff --git a/test/files/run/macro-system-properties.check b/test/files/run/macro-system-properties.check index a2da4aaf60..ff96a34426 100644 --- a/test/files/run/macro-system-properties.check +++ b/test/files/run/macro-system-properties.check @@ -1,9 +1,7 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> import language.experimental._, reflect.macros.Context +scala> import language.experimental._, reflect.macros.Context import language.experimental._ import reflect.macros.Context @@ -22,5 +20,3 @@ scala> object Test { class C(implicit a: Any) { GrabContext.grab } } defined object Test scala> - -scala> diff --git a/test/files/run/mapConserve.scala b/test/files/run/mapConserve.scala index 330fb34ca1..d1d52f3107 100644 --- a/test/files/run/mapConserve.scala +++ b/test/files/run/mapConserve.scala @@ -7,8 +7,8 @@ import scala.collection.mutable.ListBuffer object Test { val maxListLength = 7 // up to 16, but larger is slower var testCount = 0 - - def checkStackOverflow() = { + + def checkStackOverflow() = { var xs: List[String] = Nil for (i <- 0 until 250000) xs = "X" :: xs @@ -50,7 +50,7 @@ object Test { // Behaves like existing mapConserve with respect to eq checkBehaviourUnchanged(data, data mapConserve lastHexDigit, data mapConserve lastHexDigit) } - + checkStackOverflow(); } } diff --git a/test/files/run/mapValues.scala b/test/files/run/mapValues.scala index bd1794bc51..d3266bd18f 100644 --- a/test/files/run/mapValues.scala +++ b/test/files/run/mapValues.scala @@ -1,7 +1,7 @@ object Test { val m = Map(1 -> 1, 2 -> 2) val mv = (m mapValues identity) - 1 - + def main(args: Array[String]): Unit = { assert(mv.size == 1) } diff --git a/test/files/run/map_java_conversions.scala b/test/files/run/map_java_conversions.scala index 751167c04d..c007b3e0eb 100644 --- a/test/files/run/map_java_conversions.scala +++ b/test/files/run/map_java_conversions.scala @@ -4,20 +4,20 @@ object Test { - + def main(args: Array[String]) { import collection.JavaConversions._ - + test(new java.util.HashMap[String, String]) test(new java.util.Properties) testConcMap } - + def testConcMap { import collection.JavaConversions._ - + val concMap = new java.util.concurrent.ConcurrentHashMap[String, String] - + test(concMap) val cmap = mapAsScalaConcurrentMap(concMap) cmap.putIfAbsent("absentKey", "absentValue") @@ -26,31 +26,31 @@ object Test { assert(cmap.replace("absentKey", "newAbsentValue") == Some("absentValue")) assert(cmap.replace("absentKey", "newAbsentValue", ".......") == true) } - + def test(m: collection.mutable.Map[String, String]) { m.clear assert(m.size == 0) - + m.put("key", "value") assert(m.size == 1) - + assert(m.put("key", "anotherValue") == Some("value")) assert(m.put("key2", "value2") == None) assert(m.size == 2) - + m += (("key3", "value3")) assert(m.size == 3) - + m -= "key2" assert(m.size == 2) assert(m.nonEmpty) assert(m.remove("key") == Some("anotherValue")) - + m.clear for (i <- 0 until 10) m += (("key" + i, "value" + i)) for ((k, v) <- m) assert(k.startsWith("key")) } - + } diff --git a/test/files/run/matchbytes.scala b/test/files/run/matchbytes.scala index 7190886bab..f2cea06eb3 100644 --- a/test/files/run/matchbytes.scala +++ b/test/files/run/matchbytes.scala @@ -4,4 +4,4 @@ object Test extends App{ case 1 => println(1); case _ => println("????"); } -} +} diff --git a/test/files/run/matchintasany.scala b/test/files/run/matchintasany.scala index c6764b31b9..03f6ca2a84 100644 --- a/test/files/run/matchintasany.scala +++ b/test/files/run/matchintasany.scala @@ -5,4 +5,4 @@ object Test extends App{ case 1L => println(1); case _ => println("????"); } -} +} diff --git a/test/files/run/matchnull.scala b/test/files/run/matchnull.scala index cfb3049239..2cc8550d47 100644 --- a/test/files/run/matchnull.scala +++ b/test/files/run/matchnull.scala @@ -3,7 +3,7 @@ object Test def f1 = null match { case x: AnyRef => 1 case _ => -1 } def f2(x: Any) = x match { case 52 => 1 ; case null => -1 ; case _ => 0 } def f3(x: AnyRef) = x match { case x: String => 1 ; case List(_) => 0 ; case null => -1 ; case _ => -2 } - + def main(args: Array[String]): Unit = { println(f1) println(f2(null)) diff --git a/test/files/run/misc.scala b/test/files/run/misc.scala index 139d2d70f7..2ae76bd968 100644 --- a/test/files/run/misc.scala +++ b/test/files/run/misc.scala @@ -60,7 +60,7 @@ object Test { Console.println; val x = 13; x; - // !!! why are DefDef replaced by Block(Tree[0])? we should use Empty! + // !!! why are DefDef replaced by Block(Tree[0])? we should use Empty! def f = 19; f; def f0() = 11; diff --git a/test/files/run/missingparams.scala b/test/files/run/missingparams.scala index e9b1d27d68..fbc4d2a4f7 100644 --- a/test/files/run/missingparams.scala +++ b/test/files/run/missingparams.scala @@ -6,8 +6,8 @@ final class Foo(val x: Int) { // test that the closure elimination is not wrongly replacing // 'that' by 'this' - def intersect(that: Foo) = - filter { dummy => + def intersect(that: Foo) = + filter { dummy => // x // dummy that.x > 0 } diff --git a/test/files/run/mutable-treeset.scala b/test/files/run/mutable-treeset.scala index c9918cba96..100ab39965 100644 --- a/test/files/run/mutable-treeset.scala +++ b/test/files/run/mutable-treeset.scala @@ -9,21 +9,21 @@ object Test extends App { val min = list.min val max = list.max val nonlist = ((min - 10) until (max + 20) filterNot list.contains).toList - val sublist = list filter {x => x >=(min + 1) && x < max} - val distinctSublist = sublist.distinct + val sublist = list filter {x => x >=(min + 1) && x < max} + val distinctSublist = sublist.distinct val subnonlist = min :: max :: nonlist val subsorted = distinctSublist.sorted // subsublist for a 2nd level of slicing val almostmin = sublist.min val almostmax = sublist.max - val subsublist = sublist filter {x => x >=(almostmin + 1) && x < almostmax} - val distinctSubsublist = subsublist.distinct + val subsublist = sublist filter {x => x >=(almostmin + 1) && x < almostmax} + val distinctSubsublist = subsublist.distinct val subsubnonlist = almostmin :: almostmax :: subnonlist val subsubsorted = distinctSubsublist.sorted def testSize { - def check(set : TreeSet[Int], list: List[Int]) { + def check(set : TreeSet[Int], list: List[Int]) { assert(set.size == list.size, s"$set had size ${set.size} while $list had size ${list.size}") } @@ -46,7 +46,7 @@ object Test extends App { assert(list forall set.apply, s"$set did not contain all elements of $list using apply") assert(list forall set.contains, s"$set did not contain all elements of $list using contains") assert(!(nonlist exists set.apply), s"$set had an element from $nonlist using apply") - assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") + assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") } val set = TreeSet(list:_*) @@ -72,11 +72,11 @@ object Test extends App { assert(builtList.size == set.size, s"$set had size ${set.size} while $builtList had size ${builtList.size}") } assert(!(nonlist exists set.apply), s"$set had an element from $nonlist using apply") - assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") + assert(!(nonlist exists set.contains), s"$set had an element from $nonlist using contains") } val set = TreeSet[Int]() - val clone = set.clone + val clone = set.clone val subset = set.clone from (min + 1) until max val subclone = subset.clone val subsubset = subset.clone from (almostmin + 1) until almostmax @@ -100,10 +100,10 @@ object Test extends App { builtList = builtList filterNot (_ == x) assert(builtList forall set.apply, s"$set did not contain all elements of $builtList using apply") assert(builtList.size == set.size, s"$set had size $set.size while $builtList had size $builtList.size") - } + } } val set = TreeSet(list:_*) - val clone = set.clone + val clone = set.clone val subset = set.clone from (min + 1) until max val subclone = subset.clone val subsubset = subset.clone from (almostmin + 1) until almostmax @@ -114,7 +114,7 @@ object Test extends App { check(subset, subsorted) check(subclone, subsorted) - + check(subsubset, subsubsorted) check(subsubclone, subsubsorted) } diff --git a/test/files/run/null-and-intersect.scala b/test/files/run/null-and-intersect.scala index 1437fa4b25..7266dabe6d 100644 --- a/test/files/run/null-and-intersect.scala +++ b/test/files/run/null-and-intersect.scala @@ -2,7 +2,7 @@ object Test { trait Immortal class Bippy extends Immutable with Immortal class Boppy extends Immutable - + def f[T](x: Traversable[T]) = x match { case _: Map[_, _] => 3 case _: Seq[_] => 2 @@ -23,10 +23,10 @@ object Test { println(f(Seq(1))) println(f(Map(1 -> 2))) println(f(null)) - + println(g(new Bippy)) println(g(null)) - + println(h(new Bippy)) println(h(new Boppy)) println(h(null)) diff --git a/test/files/run/null-hash.scala b/test/files/run/null-hash.scala index abf15e8166..9b1f28b083 100644 --- a/test/files/run/null-hash.scala +++ b/test/files/run/null-hash.scala @@ -2,7 +2,7 @@ object Test { def f1 = List(5, 10, null: String).## def f2(x: Any) = x.## def f3 = ((55, "abc", null: List[Int])).## - + def main(args: Array[String]): Unit = { f1 f2(null) diff --git a/test/files/run/number-parsing.scala b/test/files/run/number-parsing.scala index 21551a3a07..ad1481063e 100644 --- a/test/files/run/number-parsing.scala +++ b/test/files/run/number-parsing.scala @@ -2,12 +2,12 @@ object Test { def numTests() = { val MinusZero = Float.box(-0.0f) val PlusZero = Float.box(0.0f) - + assert(PlusZero match { case MinusZero => false ; case _ => true }) assert(MinusZero match { case PlusZero => false ; case _ => true }) assert((MinusZero: scala.Float) == (PlusZero: scala.Float)) assert(!(MinusZero equals PlusZero)) - + List( -5f.max(2) , -5f max 2 , diff --git a/test/files/run/numbereq.scala b/test/files/run/numbereq.scala index a1f11da205..d50db6d049 100644 --- a/test/files/run/numbereq.scala +++ b/test/files/run/numbereq.scala @@ -13,13 +13,13 @@ object Test { if (x >= Byte.MinValue && x <= Byte.MaxValue) List(new java.lang.Byte(x.toByte)) else Nil, if (x >= Char.MinValue && x <= Char.MaxValue) List(new java.lang.Character(x.toChar)) else Nil ).flatten - + base ::: extras } def mkNumbers(x: BigInt): List[AnyRef] = { List( - List(BigDecimal(x, java.math.MathContext.UNLIMITED)), + List(BigDecimal(x, java.math.MathContext.UNLIMITED)), List(x), if (x.isValidDouble) List(new java.lang.Double(x.toDouble)) else Nil, if (x.isValidFloat) List(new java.lang.Float(x.toFloat)) else Nil, @@ -30,21 +30,21 @@ object Test { if (x.isValidChar) List(new java.lang.Character(x.toChar)) else Nil ).flatten } - + def main(args: Array[String]): Unit = { val ints = (0 to 15).toList map (Short.MinValue >> _) val ints2 = ints map (x => -x) val ints3 = ints map (_ + 1) val ints4 = ints2 map (_ - 1) - + val setneg1 = ints map mkNumbers val setneg2 = ints3 map mkNumbers val setpos1 = ints2 map mkNumbers val setpos2 = ints4 map mkNumbers val zero = mkNumbers(0) - - val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2 - + + val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2 + for (set <- sets ; x <- set ; y <- set) { // println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##)) assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass)) @@ -55,14 +55,14 @@ object Test { val bigInts2 = bigInts map (x => -x) val bigInts3 = bigInts map (_ + 1) val bigInts4 = bigInts2 map (_ - 1) - + val setneg1b = bigInts map mkNumbers val setneg2b = bigInts3 map mkNumbers val setpos1b = bigInts2 map mkNumbers val setpos2b = bigInts4 map mkNumbers val sets2 = setneg1 ++ setneg1b ++ setneg2 ++ setneg2b ++ List(zero) ++ setpos1 ++ setpos1b ++ setpos2 ++ setpos2b - + for (set <- sets2 ; x <- set ; y <- set) { // println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##)) assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass)) diff --git a/test/files/run/option-fold.scala b/test/files/run/option-fold.scala index 7e21403c2e..84e346ec79 100644 --- a/test/files/run/option-fold.scala +++ b/test/files/run/option-fold.scala @@ -2,7 +2,7 @@ object Test { sealed class A case object B extends A case class C(x: Int) extends A - + def f[T](x: Option[T]) = x.fold(List.empty[T])(List(_)) def g(x: Option[A]) = x.fold(-1) { case B => 0 diff --git a/test/files/run/origins.scala b/test/files/run/origins.scala index 0ad92297f5..6529351d3c 100644 --- a/test/files/run/origins.scala +++ b/test/files/run/origins.scala @@ -14,7 +14,7 @@ object Test { def f1() = 1 to 5 map boop def f2() = 1 to 10 map boop def f3() = 1 to 50 map boop - + def main(args: Array[String]): Unit = { f1() ; f2() ; f3() } diff --git a/test/files/run/parmap-ops.scala b/test/files/run/parmap-ops.scala index f93bd7b77e..4274460c9d 100644 --- a/test/files/run/parmap-ops.scala +++ b/test/files/run/parmap-ops.scala @@ -1,10 +1,10 @@ import collection._ object Test { - + def main(args: Array[String]) { val gm: GenMap[Int, Int] = GenMap(0 -> 0, 1 -> 1).par - + // ops assert(gm.isDefinedAt(1)) assert(gm.contains(1)) @@ -21,11 +21,11 @@ object Test { } catch { case e: NoSuchElementException => // ok } - + assert(gm.filterKeys(_ % 2 == 0)(0) == 0) assert(gm.filterKeys(_ % 2 == 0).get(1) == None) assert(gm.mapValues(_ + 1)(0) == 1) - + // with defaults val pm = parallel.mutable.ParMap(0 -> 0, 1 -> 1) val dm = pm.withDefault(x => -x) @@ -37,12 +37,12 @@ object Test { assert(dm(3) == 3) assert(pm(3) == 3) assert(dm(4) == -4) - + val imdm = parallel.immutable.ParMap(0 -> 0, 1 -> 1).withDefault(x => -x) assert(imdm(0) == 0) assert(imdm(1) == 1) assert(imdm(2) == -2) assert(imdm.updated(2, 2) == parallel.ParMap(0 -> 0, 1 -> 1, 2 -> 2)) } - + } diff --git a/test/files/run/patch-boundary.scala b/test/files/run/patch-boundary.scala index 8381956859..ed1a0e9fc1 100644 --- a/test/files/run/patch-boundary.scala +++ b/test/files/run/patch-boundary.scala @@ -1,8 +1,8 @@ object Test { def f = collection.mutable.ArrayBuffer(1, 2, 3, 4, 5, 6, 7, 8) def g = f.patch(4, List(1, 2), 10) - + def main(args: Array[String]): Unit = { - assert(g.size == 6) + assert(g.size == 6) } } diff --git a/test/files/run/patmat-exprs.scala b/test/files/run/patmat-exprs.scala index 56e4e01598..7ca5fd3063 100644 --- a/test/files/run/patmat-exprs.scala +++ b/test/files/run/patmat-exprs.scala @@ -39,7 +39,7 @@ trait Pattern { // // type Numeric[T] // import java.io.Serializable - // + // // implicit def compat27a[T](x: Iterable[T]) = new { // def iterator: Iterator[T] = x.elements // def sum: Int = 5 @@ -280,8 +280,8 @@ trait Pattern { case Mul(Mul(y, Const(z)), Const(x)) => Mul(const(num.mul(x, z)), y) case Const(x) if x == num.one => One[T] - case Const(x) if x == num.zero => Zero[T] - + case Const(x) if x == num.zero => Zero[T] + case Sub(x, Neg(y)) => Add(List(x, y)) case Sub(Neg(x), y) => Neg(Add(List(x, y))) case Neg(Neg(x)) => x diff --git a/test/files/run/patmat-finally.scala b/test/files/run/patmat-finally.scala index 6f769b30a0..dfea5ad176 100644 --- a/test/files/run/patmat-finally.scala +++ b/test/files/run/patmat-finally.scala @@ -21,5 +21,5 @@ object Test extends App { } bar(null, null) - x + x } diff --git a/test/files/run/patmat-seqs.scala b/test/files/run/patmat-seqs.scala index e23711697c..b5c47b4b4b 100644 --- a/test/files/run/patmat-seqs.scala +++ b/test/files/run/patmat-seqs.scala @@ -7,14 +7,14 @@ object Test { case Seq(_, _, _, _, _, x: String) => "ss6" case _ => "d" } - + def f2(x: Any) = x match { case Seq("a", "b", _*) => "s2" case Seq(1, _*) => "s1" case Seq(5, 6, 7, _*) => "s3" case _ => "d" } - + def main(args: Array[String]): Unit = { val xs1 = List( List(1,2,3), @@ -24,9 +24,9 @@ object Test { Seq(1, 2, 3, 4, 5, "abcd"), "abc" ) map f1 - + xs1 foreach println - + val xs2 = List( Seq(5, 6, 7), Seq(5, 6, 7, 8, 9), @@ -36,7 +36,7 @@ object Test { Nil, 5 ) map f2 - + xs2 foreach println } } diff --git a/test/files/run/patmat_unapp_abstype-new.check b/test/files/run/patmat_unapp_abstype-new.check index c5511e9516..35447dbbfa 100644 --- a/test/files/run/patmat_unapp_abstype-new.check +++ b/test/files/run/patmat_unapp_abstype-new.check @@ -1,5 +1,5 @@ patmat_unapp_abstype-new.scala:21: warning: abstract type pattern TypesUser.this.TypeRef is unchecked since it is eliminated by erasure - case TypeRef(x) => println("TypeRef") + case TypeRef(x) => println("TypeRef") ^ patmat_unapp_abstype-new.scala:53: warning: abstract type pattern Intermed.this.Foo is unchecked since it is eliminated by erasure case Foo(x) => println("Foo") diff --git a/test/files/run/patmat_unapp_abstype-new.scala b/test/files/run/patmat_unapp_abstype-new.scala index 1141177504..c2927bd124 100644 --- a/test/files/run/patmat_unapp_abstype-new.scala +++ b/test/files/run/patmat_unapp_abstype-new.scala @@ -18,7 +18,7 @@ trait TypesAPI { trait TypesUser extends TypesAPI { def shouldNotCrash(tp: Type): Unit = { tp match { - case TypeRef(x) => println("TypeRef") + case TypeRef(x) => println("TypeRef") case MethodType(x) => println("MethodType") case _ => println("none of the above") } @@ -27,7 +27,7 @@ trait TypesUser extends TypesAPI { trait TypesImpl extends TypesAPI { object TypeRef extends TypeRefExtractor // this will have a bridged unapply(x: Type) = unapply(x.asInstanceOf[TypeRef]) - case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef + case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef // --> the cast in the bridge will fail because the pattern matcher can't type test against the abstract types in TypesUser } diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala index fb49e0c924..35b733d080 100644 --- a/test/files/run/patmatnew.scala +++ b/test/files/run/patmatnew.scala @@ -254,7 +254,7 @@ object Test { } // (not regular) fancy guards / bug#644 - object TestSequence06 { + object TestSequence06 { case class A(i: Any) @@ -450,7 +450,7 @@ object Test { object Get extends Sync var ps: PartialFunction[Any, Any] = { - case Get(y) if y > 4 => // y gets a wildcard type for some reason?! hack + case Get(y) if y > 4 => // y gets a wildcard type for some reason?! hack } } def run() { diff --git a/test/files/run/pc-conversions.scala b/test/files/run/pc-conversions.scala index b1ef3d963e..19fef355c8 100644 --- a/test/files/run/pc-conversions.scala +++ b/test/files/run/pc-conversions.scala @@ -7,11 +7,11 @@ import collection._ // test conversions between collections object Test { - + def main(args: Array[String]) { testConversions } - + def testConversions { // seq conversions assertSeq(parallel.mutable.ParArray(1, 2, 3)) @@ -20,7 +20,7 @@ object Test { assertSeq(parallel.immutable.ParRange(1, 50, 1, false)) assertSeq(parallel.immutable.ParHashMap(1 -> 2, 2 -> 4)) assertSeq(parallel.immutable.ParHashSet(1, 2, 3)) - + // par conversions assertPar(Array(1, 2, 3)) assertPar(mutable.ArrayBuffer(1, 2, 3)) @@ -31,7 +31,7 @@ object Test { assertPar(immutable.Range(1, 50, 1)) assertPar(immutable.HashMap(1 -> 1, 2 -> 2)) assertPar(immutable.HashSet(1, 2, 3)) - + // par.to* and to*.par tests assertToPar(List(1 -> 1, 2 -> 2, 3 -> 3)) assertToPar(Stream(1 -> 1, 2 -> 2)) @@ -49,19 +49,19 @@ object Test { assertToPar(parallel.mutable.ParHashSet(1 -> 2)) assertToPar(parallel.immutable.ParHashMap(1 -> 2)) assertToPar(parallel.immutable.ParHashSet(1 -> 3)) - + assertToParWoMap(immutable.Range(1, 10, 2)) - + // seq and par again conversions) assertSeqPar(parallel.mutable.ParArray(1, 2, 3)) } - + def assertSeqPar[T](pc: parallel.ParIterable[T]) = pc.seq.par == pc - + def assertSeq[T](pc: parallel.ParIterable[T]) = assert(pc.seq == pc) - + def assertPar[T, P <: Parallel](xs: GenIterable[T]) = assert(xs == xs.par) - + def assertToPar[K, V](xs: GenTraversable[(K, V)]) { xs match { case _: Seq[_] => @@ -69,26 +69,26 @@ object Test { assert(xs.par.toIterable == xs) case _ => } - + assert(xs.toSeq.par == xs.toSeq) assert(xs.par.toSeq == xs.toSeq) - + assert(xs.toSet.par == xs.toSet) assert(xs.par.toSet == xs.toSet) - + assert(xs.toMap.par == xs.toMap) assert(xs.par.toMap == xs.toMap) } - + def assertToParWoMap[T](xs: GenSeq[T]) { assert(xs.toIterable.par == xs.toIterable) assert(xs.par.toIterable == xs.toIterable) - + assert(xs.toSeq.par == xs.toSeq) assert(xs.par.toSeq == xs.toSeq) - + assert(xs.toSet.par == xs.toSet) assert(xs.par.toSet == xs.toSet) } - + } diff --git a/test/files/run/pf-catch.scala b/test/files/run/pf-catch.scala index dfe43dc750..33982d0557 100644 --- a/test/files/run/pf-catch.scala +++ b/test/files/run/pf-catch.scala @@ -8,12 +8,12 @@ object Test { case x: java.util.NoSuchElementException => shortName(x) case x: java.lang.IllegalArgumentException => shortName(x) } - + def fn[T: Handler](body: => T): T = { try body catch implicitly[Handler[T]] } - + def f1 = { implicit val myHandler = standardHandler println(fn(Nil.head)) @@ -30,7 +30,7 @@ object Test { def main(args: Array[String]): Unit = { try f1 catch { case x: Throwable => println(shortName(x) + " slipped by.") } - + f2 } } diff --git a/test/files/run/primitive-sigs-2-old.scala b/test/files/run/primitive-sigs-2-old.scala index 0a4be93f22..16fe5ae555 100644 --- a/test/files/run/primitive-sigs-2-old.scala +++ b/test/files/run/primitive-sigs-2-old.scala @@ -27,7 +27,7 @@ object Test { val c1: Class[_] = classOf[T[_]] val c2: Class[_] = classOf[C] val c3: Class[_] = classOf[Arr] - + val c1m = c1.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString) val c2m = c2.getMethods.toList filter (_.getName == "f") map (_.getGenericReturnType.toString) val c3m = c3.getDeclaredMethods.toList map (_.toGenericString) diff --git a/test/files/run/priorityQueue.scala b/test/files/run/priorityQueue.scala index edc0e32b02..327d8bf137 100644 --- a/test/files/run/priorityQueue.scala +++ b/test/files/run/priorityQueue.scala @@ -31,23 +31,23 @@ object Test { // val pq2 = new PriorityQueue[String] // val pq3 = new PriorityQueue[String] // val pq4 = new PriorityQueue[String] - + // val strings = (1 to 20).toList map (i => List.fill((Math.abs(nextInt % 20)) + 1)("x").mkString) - + // pq1 ++= strings // pq2 ++= strings.reverse // for (s <- strings) pq3 += s // for (s <- strings.reverse) pq4 += s - + // val pqs = List(pq1, pq2, pq3, pq4, pq1.clone, pq2.clone) - + // for (queue1 <- pqs ; queue2 <- pqs) { // val l1: List[String] = queue1.dequeueAll[String, List[String]] // val l2: List[String] = queue2.dequeueAll[String, List[String]] // assert(l1 == l2) // assert(queue1.max == queue2.max) // } - + // assertPriorityDestructive(pq1) // } @@ -83,7 +83,7 @@ object Test { // } // for (i <- 0 until 100) assert(intpq(i) == (99 - i)) // } - + // def testTails { // val pq = new PriorityQueue[Int] // for (i <- 0 until 10) pq += i * 4321 % 200 @@ -108,13 +108,13 @@ object Test { // prev = curr // } // } - + // def testInits { // val pq = new PriorityQueue[Long] // for (i <- 0 until 20) pq += (i + 313) * 111 % 300 - + // assert(pq.size == 20) - + // val initpq = pq.init // assert(initpq.size == 19) // assertPriorityDestructive(initpq) @@ -123,19 +123,19 @@ object Test { // def testFilters { // val pq = new PriorityQueue[String] // for (i <- 0 until 100) pq += "Some " + (i * 312 % 200) - + // val filpq = pq.filter(_.indexOf('0') != -1) // assertPriorityDestructive(filpq) // } // def testIntensiveEnqueueDequeue { // val pq = new PriorityQueue[Int] - + // testIntensive(1000, pq) // pq.clear // testIntensive(200, pq) // } - + // def testIntensive(sz: Int, pq: PriorityQueue[Int]) { // val lst = new collection.mutable.ArrayBuffer[Int] ++ (0 until sz) // val rand = new util.Random(7) @@ -153,7 +153,7 @@ object Test { // pq ++= (0 until 100) // val droppq = pq.drop(50) // assertPriority(droppq) - + // pq.clear // pq ++= droppq // assertPriorityDestructive(droppq) @@ -173,7 +173,7 @@ object Test { // // assertPriority(pq) // // pq.clear - + // // pq ++= (1 to 100) // // pq(5) = 200 // // assert(pq(0) == 200) @@ -204,7 +204,7 @@ object Test { // def testEquality { // val pq1 = new PriorityQueue[Int] // val pq2 = new PriorityQueue[Int] - + // pq1 ++= (0 until 50) // var i = 49 // while (i >= 0) { @@ -213,7 +213,7 @@ object Test { // } // assert(pq1 == pq2) // assertPriority(pq2) - + // pq1 += 100 // assert(pq1 != pq2) // pq2 += 100 @@ -230,7 +230,7 @@ object Test { // val pq = new PriorityQueue[Int] // pq ++= (0 until 100) // assert(pq.size == 100) - + // val (p1, p2) = pq.partition(_ < 50) // assertPriorityDestructive(p1) // assertPriorityDestructive(p2) @@ -252,13 +252,13 @@ object Test { // assert(pq.lastIndexWhere(_ == 9) == 0) // assert(pq.lastIndexOf(8) == 1) // assert(pq.lastIndexOf(7) == 2) - + // pq += 5 // pq += 9 // assert(pq.lastIndexOf(9) == 1) // assert(pq.lastIndexWhere(_ % 2 == 1) == 10) // assert(pq.lastIndexOf(5) == 6) - + // val lst = pq.reverseIterator.toList // for (i <- 0 until 5) assert(lst(i) == i) // assert(lst(5) == 5) @@ -268,13 +268,13 @@ object Test { // assert(lst(9) == 8) // assert(lst(10) == 9) // assert(lst(11) == 9) - + // pq.clear // assert(pq.reverseIterator.toList.isEmpty) - + // pq ++= (50 to 75) // assert(pq.lastIndexOf(70) == 5) - + // pq += 55 // pq += 70 // assert(pq.lastIndexOf(70) == 6) @@ -284,11 +284,11 @@ object Test { // assert(pq.lastIndexWhere(_ > 54, 21) == 21) // assert(pq.lastIndexWhere(_ > 69, 5) == 5) // } - + // def testReverse { // val pq = new PriorityQueue[(Int, Int)] // pq ++= (for (i <- 0 until 10) yield (i, i * i % 10)) - + // assert(pq.reverse.size == pq.reverseIterator.toList.size) // assert((pq.reverse zip pq.reverseIterator.toList).forall(p => p._1 == p._2)) // assert(pq.reverse.sameElements(pq.reverseIterator.toSeq)) @@ -296,19 +296,19 @@ object Test { // assert(pq.reverse(1)._1 == pq(8)._1) // assert(pq.reverse(4)._1 == pq(5)._1) // assert(pq.reverse(9)._1 == pq(0)._1) - + // pq += ((7, 7)) // pq += ((7, 9)) // pq += ((7, 8)) // assert(pq.reverse.reverse == pq) // assert(pq.reverse.lastIndexWhere(_._2 == 6) == 6) // assertPriorityDestructive(pq.reverse.reverse) - + // val iq = new PriorityQueue[Int] // iq ++= (0 until 50) // assert(iq.reverse == iq.reverseIterator.toSeq) // assert(iq.reverse.reverse == iq) - + // iq += 25 // iq += 40 // iq += 10 @@ -317,10 +317,10 @@ object Test { // assert(iq.reverse.lastIndexWhere(_ == 10) == 11) // assertPriorityDestructive(iq.reverse.reverse) // } - + // def testToList { // val pq = new PriorityQueue[Int] - + // pq += 1 // pq += 4 // pq += 0 @@ -330,16 +330,16 @@ object Test { // assert(pq.toList == pq) // assert(pq == List(5, 4, 3, 2, 1, 0)) // assert(pq.reverse == List(0, 1, 2, 3, 4, 5)) - + // pq.clear // for (i <- -50 until 50) pq += i // assert(pq.toList == pq) // assert(pq.toList == (-50 until 50).reverse) // } - + // def testForeach { // val pq = new PriorityQueue[Char] - + // pq += 't' // pq += 'o' // pq += 'b' @@ -351,7 +351,7 @@ object Test { // assert(sbf.toString == sbi.toString) // assert(sbf.toString == "ytob") // } - + } diff --git a/test/files/run/private-inline.check b/test/files/run/private-inline.check index eee7f2973b..3e44989521 100644 --- a/test/files/run/private-inline.check +++ b/test/files/run/private-inline.check @@ -2,6 +2,6 @@ private-inline.scala:24: warning: Could not inline required method wrapper1 beca def f1b() = identity(wrapper1(5)) ^ private-inline.scala:29: warning: Could not inline required method wrapper2 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack. - def f2b() = identity(wrapper2(5)) + def f2b() = identity(wrapper2(5)) ^ 20 diff --git a/test/files/run/private-inline.scala b/test/files/run/private-inline.scala index 72cabaeff0..60fef9efca 100644 --- a/test/files/run/private-inline.scala +++ b/test/files/run/private-inline.scala @@ -2,7 +2,7 @@ final class A { private var x1 = false var x2 = false - + // manipulates private var @inline private def wrapper1[T](body: => T): T = { val saved = x1 @@ -17,35 +17,35 @@ final class A { try body finally x2 = saved } - + // not inlined def f1a() = wrapper1(5) // inlined! def f1b() = identity(wrapper1(5)) - + // not inlined def f2a() = wrapper2(5) // inlined! - def f2b() = identity(wrapper2(5)) + def f2b() = identity(wrapper2(5)) } object Test { def methodClasses = List("f1a", "f2a") map ("A$$anonfun$" + _ + "$1") - + def main(args: Array[String]): Unit = { val a = new A import a._ println(f1a() + f1b() + f2a() + f2b()) - + // Don't know how else to test this: all these should have been // inlined, so all should fail. methodClasses foreach { clazz => - + val foundClass = ( try Class.forName(clazz) catch { case _: Throwable => null } ) - + assert(foundClass == null, foundClass) } } diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check index a6e53fbe92..10d2ed5af7 100644 --- a/test/files/run/programmatic-main.check +++ b/test/files/run/programmatic-main.check @@ -24,4 +24,3 @@ superaccessors 6 add super accessors in traits and nested classes icode 22 generate portable intermediate code jvm 23 generate JVM bytecode terminal 24 the last phase during a compilation run - diff --git a/test/files/run/programmatic-main.scala b/test/files/run/programmatic-main.scala index 08335ca6f6..542ac2781e 100644 --- a/test/files/run/programmatic-main.scala +++ b/test/files/run/programmatic-main.scala @@ -7,7 +7,7 @@ object Test { val cwd = Option(System.getProperty("partest.cwd")) getOrElse "." val basedir = Path(cwd).parent / "lib" path val baseargs = Array("-usejavacp", "-bootclasspath", basedir + "/scala-library.jar", "-cp", basedir + "/scala-compiler.jar") - + def main(args: Array[String]): Unit = { Console.withErr(Console.out) { Main process (baseargs ++ "-Xpluginsdir /does/not/exist/foo/quux -Xshow-phases".split(' ')) diff --git a/test/files/run/proxy.scala b/test/files/run/proxy.scala index ea222cb496..8a6385dc85 100644 --- a/test/files/run/proxy.scala +++ b/test/files/run/proxy.scala @@ -1,16 +1,16 @@ object Test extends App { val p = new Proxy { - def self = 2 + def self = 2 } println(p equals 1) println(p equals 2) println(p equals 3) println(p equals null) - + case class Bippy(a: String) extends Proxy { def self = a } - + val label = Bippy("bippy!") println(label == label) println(label == "bippy!") diff --git a/test/files/run/range-unit.scala b/test/files/run/range-unit.scala index ece0d9806c..d8ebc00e9c 100644 --- a/test/files/run/range-unit.scala +++ b/test/files/run/range-unit.scala @@ -6,14 +6,14 @@ object Test { ( (-3 to 3) ++ List(17, 127, Int.MaxValue, Int.MinValue + 1) ).distinct.sortBy(n => (math.abs(n), n)) ) :+ Int.MinValue - + // reducing output a little val endpoints = numbers filterNot Set(-3, -2, 2, 17, 127) - + def num(n: Int) = { val frommax = Int.MaxValue - n val frommin = Int.MinValue - n - + if (n > 0) { if (frommax == 0) "MAX" else if (frommax < 1000) "MAX-" + frommax @@ -25,7 +25,7 @@ object Test { else "" + n } } - + def run[T](body: => Range): List[Any] = { try { val r = body ; if (r.isEmpty) List(r.length) else List(num(r.length), num(r.head), num(r.last)) } catch { case e: IllegalArgumentException => List("---\n " + e) } diff --git a/test/files/run/range.scala b/test/files/run/range.scala index b81e67921a..4637ab874d 100644 --- a/test/files/run/range.scala +++ b/test/files/run/range.scala @@ -6,7 +6,7 @@ object Test { range.foreach(buffer += _); assert(buffer.toList == range.iterator.toList, buffer.toList+"/"+range.iterator.toList) } - + def boundaryTests() = { // #4321 assert((Int.MinValue to Int.MaxValue by Int.MaxValue).size == 3) @@ -28,31 +28,31 @@ object Test { ) assert(noElemAtMax) } - + case class GR[T](val x: T)(implicit val num: Integral[T]) { import num._ - + def negated = GR[T](-x) - + def gr1 = NumericRange(x, x, x) def gr2 = NumericRange.inclusive(x, x, x) def gr3 = NumericRange(x, x * fromInt(10), x) def gr4 = NumericRange.inclusive(x, x * fromInt(10), x) def gr5 = gr3.toList ::: negated.gr3.toList - + def check = { assert(gr1.isEmpty && !gr2.isEmpty) - assert(gr3.size == 9 && gr4.size == 10) + assert(gr3.size == 9 && gr4.size == 10) assert(gr5.sum == num.zero, gr5.toString) assert(!(gr3 contains (x * fromInt(10)))) assert((gr4 contains (x * fromInt(10)))) } } - + def main(args: Array[String]): Unit = { implicit val imp1 = Numeric.BigDecimalAsIfIntegral implicit val imp2 = Numeric.DoubleAsIfIntegral - + val _grs = List[GR[_]]( GR(BigDecimal(5.0)), GR(BigInt(5)), @@ -62,21 +62,21 @@ object Test { ) val grs = _grs ::: (_grs map (_.negated)) grs foreach (_.check) - + assert(NumericRange(1, 10, 1) sameElements (1 until 10)) assert(NumericRange.inclusive(1, 10, 1) sameElements (1 to 10)) assert(NumericRange.inclusive(1, 100, 3) sameElements (1 to 100 by 3)) - + // #2518 assert((3L to 7 by 2) sameElements List(3L, 5L, 7L)) - + rangeForeach(1 to 10); rangeForeach(1 until 10); rangeForeach(10 to 1 by -1); rangeForeach(10 until 1 by -1); rangeForeach(10 to 1 by -3); rangeForeach(10 until 1 by -3); - + // living on the edges boundaryTests() } diff --git a/test/files/run/records.scala b/test/files/run/records.scala index bae0d943ff..f2b582b950 100644 --- a/test/files/run/records.scala +++ b/test/files/run/records.scala @@ -19,10 +19,10 @@ object Test { val y = new C { def f = 2 def g = " world" - } - + } + val z: T = y - + def main(args: Array[String]): Unit = { assert(x.f+z.f == 3) assert(x.g+z.g == "hello world") diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check index b3b66f48d6..3af3ad774d 100644 --- a/test/files/run/reflection-equality.check +++ b/test/files/run/reflection-equality.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class X { def methodIntIntInt(x: Int, y: Int) = x+y } @@ -23,7 +21,7 @@ scala> val cs: ClassSymbol = im.symbol cs: reflect.runtime.universe.ClassSymbol = class X scala> val ts: Type = cs.typeSignature -ts: reflect.runtime.universe.Type = +ts: reflect.runtime.universe.Type = scala.AnyRef { def <init>(): X def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check index bb8bdc9dd9..46c21dfa00 100644 --- a/test/files/run/reflection-magicsymbols-repl.check +++ b/test/files/run/reflection-magicsymbols-repl.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check index d70db59b85..874fed2d7c 100644 --- a/test/files/run/reflection-repl-classes.check +++ b/test/files/run/reflection-repl-classes.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class A defined class A diff --git a/test/files/run/reflection-repl-elementary.check b/test/files/run/reflection-repl-elementary.check index d9133f7e3e..4a223e8a24 100644 --- a/test/files/run/reflection-repl-elementary.check +++ b/test/files/run/reflection-repl-elementary.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> scala.reflect.runtime.universe.typeOf[List[Nothing]] res0: reflect.runtime.universe.Type = scala.List[Nothing] diff --git a/test/files/run/reify-repl-fail-gracefully.check b/test/files/run/reify-repl-fail-gracefully.check index 18cfd5a7ef..29ccee3cc6 100644 --- a/test/files/run/reify-repl-fail-gracefully.check +++ b/test/files/run/reify-repl-fail-gracefully.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import language.experimental.macros import language.experimental.macros @@ -17,5 +15,3 @@ scala> reify ^ scala> - -scala> diff --git a/test/files/run/reify_closure8b.check b/test/files/run/reify_closure8b.check index 5a7863ff15..5d48d3ab36 100644 --- a/test/files/run/reify_closure8b.check +++ b/test/files/run/reify_closure8b.check @@ -1,3 +1,3 @@ -scala.tools.reflect.ToolBoxError: reflective compilation has failed: +scala.tools.reflect.ToolBoxError: reflective compilation has failed: value y is not a member of Test.Foo diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index e68fe2f6b1..1432d10127 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ @@ -25,5 +23,3 @@ scala> { 2 scala> - -scala> diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index 38c95646a8..217f0a98c7 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ @@ -24,5 +22,3 @@ scala> def foo[T]{ foo: [T]=> Unit scala> - -scala> diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index 86f6abce02..93ad69defa 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> { import scala.reflect.runtime.universe._ val x = "2" @@ -15,5 +13,3 @@ scala> { TypeTag[x.type] scala> - -scala> diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index d3e2540de0..8e0ad87bf2 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> def foo[T]{ import scala.reflect.runtime.universe._ val tt = implicitly[WeakTypeTag[List[T]]] @@ -17,5 +15,3 @@ scala> foo[Int] WeakTypeTag[scala.List[T]] scala> - -scala> diff --git a/test/files/run/reify_newimpl_35.check b/test/files/run/reify_newimpl_35.check index 52aaa171e0..f884d2c0d0 100644 --- a/test/files/run/reify_newimpl_35.check +++ b/test/files/run/reify_newimpl_35.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ @@ -13,5 +11,3 @@ scala> println(foo) Expr[List[Nothing]](Nil) scala> - -scala> diff --git a/test/files/run/repl-assign.check b/test/files/run/repl-assign.check index c6b0458f04..bdc7793c37 100644 --- a/test/files/run/repl-assign.check +++ b/test/files/run/repl-assign.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> var x = 10 x: Int = 10 @@ -16,5 +14,3 @@ scala> y = 13 y: Int = 13 scala> - -scala> diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check index a92243c7c0..97ae208ff4 100644 --- a/test/files/run/repl-bare-expr.check +++ b/test/files/run/repl-bare-expr.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> 2 ; 3 <console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses 2 ;; @@ -50,5 +48,3 @@ scala> Bovine.x res4: List[Any] = List(Ruminant(5), Cow, Moooooo) scala> - -scala> diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check index 002316fd54..1f6d3e2b39 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> :type List[1, 2, 3] <console>:1: error: identifier expected but integer literal found. List[1, 2, 3] @@ -40,7 +38,7 @@ Int scala> :type protected lazy val f = 5 <console>:5: error: lazy value f cannot be accessed in object $iw Access to protected value f not permitted because - enclosing object $eval in package $line13 is not a subclass of + enclosing object $eval in package $line13 is not a subclass of object $iw where target is defined lazy val $result = f ^ @@ -80,7 +78,7 @@ TypeRef( TypeRef( TypeSymbol( sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable - + ) args = List( TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) @@ -101,7 +99,7 @@ PolyType( resultType = TypeRef( TypeSymbol( abstract trait Set[A] extends Iterable[A] with Set[A] with GenericSetTemplate[A,scala.collection.immutable.Set] with SetLike[A,scala.collection.immutable.Set[A]] with Parallelizable[A,scala.collection.parallel.immutable.ParSet[A]] - + ) args = List(TypeRef(TypeSymbol(abstract class Any extends ))) ) @@ -147,7 +145,7 @@ TypeRef( TypeRef( TypeSymbol( sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable - + ) args = List( TypeRef( @@ -180,7 +178,7 @@ PolyType( TypeRef( TypeSymbol( sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable - + ) args = List(TypeParamTypeRef(TypeParam(T <: AnyVal))) ) @@ -203,7 +201,7 @@ PolyType( resultType = TypeRef( TypeSymbol( sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable - + ) args = List(TypeParamTypeRef(TypeParam(U >: T))) ) @@ -221,5 +219,3 @@ scala> :type println("side effect!") Unit scala> - -scala> diff --git a/test/files/run/repl-out-dir.check b/test/files/run/repl-out-dir.check index a96f9ba9d9..3e51c63155 100644 --- a/test/files/run/repl-out-dir.check +++ b/test/files/run/repl-out-dir.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> case class Bippy(x: Int) defined class Bippy @@ -49,5 +47,3 @@ repl-out-dir-run.obj Test.class scala> - -scala> diff --git a/test/files/run/repl-paste-2.check b/test/files/run/repl-paste-2.check index 203b020f2c..ab3809a2e0 100644 --- a/test/files/run/repl-paste-2.check +++ b/test/files/run/repl-paste-2.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> scala> 999l // Detected repl transcript paste: ctrl-D to finish. @@ -31,7 +29,6 @@ res9: Int = 6 scala> x.length + res5 res10: Int = 12 - // Replaying 8 commands from transcript. scala> 999l diff --git a/test/files/run/repl-paste-3.check b/test/files/run/repl-paste-3.check index 2b4c941c33..8fae61792e 100644 --- a/test/files/run/repl-paste-3.check +++ b/test/files/run/repl-paste-3.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> println(3) 3 @@ -10,5 +8,3 @@ scala> List(1,2) res1: List[Int] = List(1, 2) scala> - -scala> diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check index e4c407c6e8..97f177ddc4 100644 --- a/test/files/run/repl-paste.check +++ b/test/files/run/repl-paste.check @@ -17,7 +17,6 @@ object Dingus val x = (new Dingus).y - // Exiting paste mode, now interpreting. defined class Dingus diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index 1abb8e9d14..d6a0d8c931 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -21,7 +21,7 @@ scala> tp.memberType(Array_apply) // evidence res1: $r.global.Type = (i: Int)scala.util.Random scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) // treedsl -m: $r.treedsl.global.Match = +m: $r.treedsl.global.Match = 10 match { case 5 => false case _ => true diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check index 7256b851bb..c6e147977a 100644 --- a/test/files/run/repl-reset.check +++ b/test/files/run/repl-reset.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> val x1 = 1 x1: Int = 1 @@ -51,5 +49,3 @@ scala> { new BippyBungus ; x1 } res2: Int = 4 scala> - -scala> diff --git a/test/files/run/repl-term-macros.check b/test/files/run/repl-term-macros.check index eae489c294..2a143a1777 100644 --- a/test/files/run/repl-term-macros.check +++ b/test/files/run/repl-term-macros.check @@ -1,9 +1,7 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> import scala.reflect.macros.Context +scala> import scala.reflect.macros.Context import scala.reflect.macros.Context scala> import language.experimental.macros @@ -40,5 +38,3 @@ defined term macro foo3: (x: Int)(y: Int)Unit scala> foo3(2)(3) scala> - -scala> diff --git a/test/files/run/repl-transcript.check b/test/files/run/repl-transcript.check index 6d22353882..49891af900 100644 --- a/test/files/run/repl-transcript.check +++ b/test/files/run/repl-transcript.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> scala> class Bippity // Detected repl transcript paste: ctrl-D to finish. @@ -19,7 +17,6 @@ scala> 1 to 100 map (_ + 1) res6: scala.collection.immutable.IndexedSeq[Int] = Vector(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101) scala> res6.sum + res5 - // Replaying 5 commands from transcript. scala> class Bippity diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala index 70ee8e1840..483659146a 100644 --- a/test/files/run/repl-trim-stack-trace.scala +++ b/test/files/run/repl-trim-stack-trace.scala @@ -20,7 +20,7 @@ scala> def f = throw new Exception("") f: Nothing scala> f -java.lang.Exception: +java.lang.Exception: at .f(<console>:7) ... 69 elided diff --git a/test/files/run/repl-type-verbose.check b/test/files/run/repl-type-verbose.check index 989c0735b0..e37754a060 100644 --- a/test/files/run/repl-type-verbose.check +++ b/test/files/run/repl-type-verbose.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> // verbose! scala> :type -v def f = 5 @@ -165,7 +163,7 @@ PolyType( normalize = TypeRef( TypeSymbol( abstract trait Ordering[T] extends Comparator[T] with PartialOrdering[T] with Serializable - + ) args = List(TypeParamTypeRef(TypeParam(T))) ) @@ -190,5 +188,3 @@ PolyType( ) scala> - -scala> diff --git a/test/files/run/run-bug4840.scala b/test/files/run/run-bug4840.scala index 5f98bc9f4b..dda280fd17 100644 --- a/test/files/run/run-bug4840.scala +++ b/test/files/run/run-bug4840.scala @@ -1,6 +1,6 @@ object Test { def g(x: Boolean): Option[String] = if (x) Some("booya") else None - + def f1() = { for (x <- g(true)) yield { g(false) match { @@ -9,11 +9,11 @@ object Test { } } } - + def f2() = { for (x <- g(true) ; y <- g(true) ; z <- g(true)) yield { for (x <- g(true) ; y <- g(true) ; z <- g(true)) yield { - g(true) map { _ => + g(true) map { _ => (null: Any) match { case Some(x: Int) => x case _ => 5 @@ -21,7 +21,7 @@ object Test { } } } - } + } def main(args: Array[String]): Unit = { println(f1()) diff --git a/test/files/run/runtime-richChar.scala b/test/files/run/runtime-richChar.scala index cf18a1d302..dceb70e74d 100644 --- a/test/files/run/runtime-richChar.scala +++ b/test/files/run/runtime-richChar.scala @@ -5,19 +5,19 @@ object Test extends App { else println(name + " failed: " + expected + " differs from " + got) } - + testSeq("'a' to 'c'", List('a', 'b', 'c'), 'a' to 'c') testSeq("'a' until 'c'", List('a', 'b'), 'a' until 'c') - + testSeq("'a' to 'b'", List('a', 'b'), 'a' to 'b') testSeq("'a' until 'b'", List('a'), 'a' until 'b') - + testSeq("'a' to 'a'", List('a'), 'a' to 'a') testSeq("'a' until 'a'", List(), 'a' until 'a') - + testSeq("'b' to 'a'", List(), 'b' to 'a') testSeq("'b' until 'a'", List(), 'b' until 'a') - + testSeq("'c' to 'a'", List(), 'c' to 'a') testSeq("'c' until 'a'", List(), 'c' until 'a') } diff --git a/test/files/run/scan.scala b/test/files/run/scan.scala index f056c77ba1..47e0a7d976 100644 --- a/test/files/run/scan.scala +++ b/test/files/run/scan.scala @@ -6,17 +6,17 @@ object Test { def main(args: Array[String]) { val lst = List(1, 2, 3, 4, 5) - + assert(lst.scanLeft(0)(_ + _) == List(0, 1, 3, 6, 10, 15)) assert(lst.scanRight(0)(_ + _) == List(15, 14, 12, 9, 5, 0)) - + val emp = List[Int]() assert(emp.scanLeft(0)(_ + _) == List(0)) assert(emp.scanRight(0)(_ + _) == List(0)) - + val stream = Stream(1, 2, 3, 4, 5) assert(stream.scanLeft(0)(_ + _) == Stream(0, 1, 3, 6, 10, 15)) - + assert(Stream.from(1).scanLeft(0)(_ + _).take(5) == Stream(0, 1, 3, 6, 10)) } diff --git a/test/files/run/seqlike-kmp.scala b/test/files/run/seqlike-kmp.scala index 514990cfa2..af39fda9af 100644 --- a/test/files/run/seqlike-kmp.scala +++ b/test/files/run/seqlike-kmp.scala @@ -2,7 +2,7 @@ object Test { val source = 0 to 99 val idxes = (-1 to 2) ++ (97 to 100) def str(xs: Seq[Int]) = xs.mkString("(", ", ", ")") - + def f(tgt: Seq[Int]) = { println("indexOfSlice") // the first index `>= from` such that... @@ -17,11 +17,11 @@ object Test { println(" %s with idx <= %d = %d".format(str(tgt), x, res)) } } - + def g(idx: Int, len: Int) = { f(source.slice(idx, idx + len)) } - + def main(args: Array[String]): Unit = { g(97, 1) g(97, 2) diff --git a/test/files/run/sequenceComparisons.scala b/test/files/run/sequenceComparisons.scala index f8ef17d77d..613b37f45a 100644 --- a/test/files/run/sequenceComparisons.scala +++ b/test/files/run/sequenceComparisons.scala @@ -2,12 +2,12 @@ import scala.collection.{ mutable, immutable } import collection.{ Seq, Traversable } object Test { - // TODO: + // TODO: // // SeqProxy // SeqForwarder // the commented out ones in seqMakers - + val seqMakers = List[List[Int] => Seq[Int]]( // scala.Array(_: _*), mutable.ArrayBuffer(_: _*), @@ -23,13 +23,13 @@ object Test { immutable.Seq(_: _*), mutable.Seq(_: _*), immutable.Stack(_: _*), - // mutable.Stack(_: _*), + // mutable.Stack(_: _*), immutable.IndexedSeq(_: _*), // was Vector //mutable.Vector(_: _*), immutable.List(_: _*), immutable.Stream(_: _*) ) - + abstract class Data[T] { val seq: Seq[T] private def seqList = seq.toList @@ -45,50 +45,50 @@ object Test { } lazy val eqeq = Method(_ == _, (List(seqList), List(Nil, seqList drop 1, seqList ::: seqList)), "%s == %s") - + val startsWithInputs: Inputs lazy val startsWith = Method(_ startsWith _, startsWithInputs, "%s startsWith %s") - + val endsWithInputs: Inputs lazy val endsWith = Method(_ endsWith _, endsWithInputs, "%s endsWith %s") val indexOfSliceInputs: Inputs private def subseqTest(s1: Seq[T], s2: Seq[T]) = (s1 indexOfSlice s2) != -1 lazy val indexOfSlice = Method(subseqTest _, indexOfSliceInputs, "(%s indexOfSlice %s) != -1") - + val sameElementsInputs: Inputs lazy val sameElements = Method(_ sameElements _, sameElementsInputs, "%s sameElements %s") - + def methodList = List(eqeq, startsWith, endsWith, indexOfSlice, sameElements) } - + object test1 extends Data[Int] { val seq = List(1,2,3,4,5) - + val startsWithInputs = ( List(Nil, List(1), List(1,2), seq), List(List(1,2,3,4,6), seq ::: List(5), List(0)) ) - + val endsWithInputs = ( List(Nil, List(5), List(4,5), seq), List(0 :: seq, List(5,2,3,4,5), List(3,4), List(5,6)) ) - + val indexOfSliceInputs = ( List(Nil, List(1), List(3), List(5), List(1,2), List(2,3,4), List(4,5), seq), List(List(1,2,3,5), List(6), List(5,4,3,2,1), List(2,1)) ) - + val sameElementsInputs = ( List(List(1,2,3,4,5)), List(Nil, List(1), List(1,2), List(2,3,4), List(2,3,4,5), List(2,3,4,5,1), List(1,2,3,5,4), seq.reverse) ) } - + val failures = new mutable.ListBuffer[String] var testCount = 0 - + def assertOne(op1: Any, op2: Any, res: Boolean, str: String) { testCount += 1 val resStr = str.format(op1, op2) @@ -97,25 +97,25 @@ object Test { failures += ("FAIL: " + resStr) // assert(res, resStr) } - + def runSeqs() = { for (s1f <- seqMakers ; s2f <- seqMakers ; testData <- List(test1)) { import testData._ val scrut = s1f(seq) - + for (Method(f, (trueList, falseList), descr) <- methodList) { for (s <- trueList; rhs = s2f(s)) assertOne(scrut, rhs, f(scrut, rhs), descr) - + for (s <- falseList; rhs = s2f(s)) assertOne(scrut, rhs, !f(scrut, rhs), "!(" + descr + ")") } } } - + def main(args: Array[String]) { runSeqs() - + assert(failures.isEmpty, failures mkString "\n") } } diff --git a/test/files/run/serialize-stream.scala b/test/files/run/serialize-stream.scala index e424d5b629..3ab9f2df34 100644 --- a/test/files/run/serialize-stream.scala +++ b/test/files/run/serialize-stream.scala @@ -5,13 +5,13 @@ object Test { val bos = new java.io.ByteArrayOutputStream() val oos = new java.io.ObjectOutputStream(bos) oos.writeObject(s) - + val ois = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bos.toByteArray)) val obj = ois.readObject() println(obj) println(obj.asInstanceOf[Seq[T]].toList) } - + def main(args: Array[String]) { ser(Stream(1, 2, 3)) ser(Stream(1)) diff --git a/test/files/run/slice-strings.scala b/test/files/run/slice-strings.scala index 23085866f5..129314387a 100644 --- a/test/files/run/slice-strings.scala +++ b/test/files/run/slice-strings.scala @@ -1,7 +1,7 @@ -object Test { +object Test { def cmp(x1: String) = { val x2 = x1.toList - + -10 to 10 foreach { i => assert(x1.take(i) == x2.take(i).mkString) assert(x1.drop(i) == x2.drop(i).mkString) @@ -12,7 +12,7 @@ object Test { assert(x1.slice(idx1, idx2) == x2.slice(idx1, idx2).mkString) } } - + def main(args: Array[String]): Unit = { cmp("abcde") } diff --git a/test/files/run/sm-interpolator.scala b/test/files/run/sm-interpolator.scala index 7f7b9f061a..b99daa2a8b 100644 --- a/test/files/run/sm-interpolator.scala +++ b/test/files/run/sm-interpolator.scala @@ -1,14 +1,14 @@ object Test extends App { import scala.reflect.internal.util.StringContextStripMarginOps - def check(actual: Any, expected: Any) = if (actual != expected) sys.error(s"expected: [$expected], actual: [$actual])") + def check(actual: Any, expected: Any) = if (actual != expected) sys.error(s"\nexpected:\n$expected\n\nactual:\n$actual") val bar = "|\n ||" check( - sm"""|ab + sm"""|ab |de |${bar} | ${1}""", - "ab \nde\n|\n || | 1") + "ab\nde\n|\n || | 1") check( sm"|", diff --git a/test/files/run/spec-nlreturn.scala b/test/files/run/spec-nlreturn.scala index a84160ecca..5ab1747856 100644 --- a/test/files/run/spec-nlreturn.scala +++ b/test/files/run/spec-nlreturn.scala @@ -5,7 +5,7 @@ object Test { val g = (1 to 10 map { i => return 16 ; i }).sum g } - catch { case x: runtime.NonLocalReturnControl[_] => + catch { case x: runtime.NonLocalReturnControl[_] => println(x.getClass.getName) x.value.asInstanceOf[Int] } diff --git a/test/files/run/streamWithFilter.scala b/test/files/run/streamWithFilter.scala index 7f8f9a09d2..cb919d4f55 100644 --- a/test/files/run/streamWithFilter.scala +++ b/test/files/run/streamWithFilter.scala @@ -4,7 +4,7 @@ object Test { def isBuzz(x: Int) = x % 5 == 0 // next line will run forever if withFilter isn't doing its thing. val fizzbuzzes = for (n <- nums ; if isFizz(n) ; if isBuzz(n)) yield n - + def main(args: Array[String]): Unit = { fizzbuzzes take 5 foreach println } diff --git a/test/files/run/streams.scala b/test/files/run/streams.scala index 03b2622edd..350e103eab 100644 --- a/test/files/run/streams.scala +++ b/test/files/run/streams.scala @@ -41,7 +41,7 @@ object Test extends App { def powers(x: Int) = if ((x&(x-1)) == 0) Some(x) else None println(s3.flatMap(powers).reverse.head) - // large enough to generate StackOverflows (on most systems) + // large enough to generate StackOverflows (on most systems) // unless the following methods are tail call optimized. val size = 100000 diff --git a/test/files/run/stringbuilder.scala b/test/files/run/stringbuilder.scala index a88ea38b92..a98f9cf37d 100644 --- a/test/files/run/stringbuilder.scala +++ b/test/files/run/stringbuilder.scala @@ -4,21 +4,21 @@ import scala.language.reflectiveCalls object Test extends App { val str = "ABCDEFGHIJKLMABCDEFGHIJKLM" val surrogateStr = "an old Turkic letter: \uD803\uDC22" - - type SB = { + + type SB = { def indexOf(str: String): Int def indexOf(str: String, fromIndex: Int): Int def lastIndexOf(str: String): Int def lastIndexOf(str: String, fromIndex: Int): Int } - + import scala.collection.mutable.{ StringBuilder => ScalaStringBuilder } import java.lang.{ StringBuilder => JavaStringBuilder } - + val sbScala = new ScalaStringBuilder() append str val sbJava = new JavaStringBuilder() append str val sbs: List[SB] = List[SB](sbScala, sbJava) - + def sameAnswers(f: (SB) => Int) = assert(f(sbScala) == f(sbJava)) sameAnswers(_.indexOf("")) @@ -34,10 +34,10 @@ object Test extends App { sameAnswers(_.lastIndexOf("QZV")) sameAnswers(_.lastIndexOf("GHI", 22)) sameAnswers(_.lastIndexOf("KLM", 22)) - + // testing that the "reverse" implementation avoids reversing surrogate pairs val jsb = new JavaStringBuilder(surrogateStr).reverse val ssb = new ScalaStringBuilder(surrogateStr).reverseContents - + assert(jsb.toString == ssb.toString) } diff --git a/test/files/run/structural.scala b/test/files/run/structural.scala index 2788717ec2..7da104ca6e 100644 --- a/test/files/run/structural.scala +++ b/test/files/run/structural.scala @@ -2,20 +2,20 @@ import scala.language.{ reflectiveCalls } object test1 { - + val o1 = new Object { override def toString = "ohone" } val o2 = new Object { override def toString = "ohtwo" } - + val t1 = new Tata("tieone") val t2 = new Tata("tietwo") - + class Tata(name: String) { override def toString = name def tatMe = "oy" } - + class Titi extends Tata("titi") - + object Rec { val a = 1 val b = 2 @@ -44,7 +44,7 @@ object test1 { val y: Tata = null def z(t: Tata) = () } - + type rt = Object { val a: Int; val c: String; @@ -68,7 +68,7 @@ object test1 { var v: Int val y: Tata } - + def l (r: rt) { println(" 1. " + r.c) println(" 2. " + r.a + 1) @@ -97,33 +97,33 @@ object test1 { println("25. " + r.y) println("26. " + r.e(null)) } - + /*def ma[T](r: Object{def e(x: T): T; val x: T}) { println("30. " + r.e(r.x)) // static error }*/ - + def mb(r: Object { def e[T](x: T): T }) { println("31. " + r.e[Int](4)) // while this is ok } - + def m1(r: Object { def z(x: Tata): Unit }) { println("32. " + r.z(new Titi)) // while this is ok } - + def m2[T](r: Object { def e(x: Tata): T; val x: Tata }) { println("33. " + r.e(r.x)) // and this too } - + class Rec3[T] { def e(x: T): T = x } - + def m3[T](r: Rec3[T], x: T) { println("33. " + r.e(x)) // and this too } - + Rec.g(11) - + this.l(Rec) this.mb(new Object{def e[T](x: T): T = x}) this.m1(Rec) @@ -135,7 +135,7 @@ object test2 { class C extends { def f() { println("1") } } val x1 = new C x1.f() - + abstract class D extends { def f() } val x2 = new D { def f() { println("2") } } x2.f() @@ -156,11 +156,11 @@ object test2 { object test3 { case class Exc() extends Exception - + object Rec { def f = throw Exc() } - + def m(r: { def f: Nothing }) = try { r.f @@ -169,31 +169,31 @@ object test3 { case e: Exc => println("caught") case e: Throwable => println(e) } - + m(Rec) - + } object test4 { class A - + val aar = Array(new A, new A, new A) val nar = Array(1, 2) - + def f(p: {def size: Int}) = println(p.size) //def g[T <: {def size: Int}](p: T) = println(p.size) // open issue //def h[T <% {def size: Int}](p: T) = println(p.size) // open issue - + f(aar) f(nar) - + //g(aar) //g(nar) - + //h(aar) //h(nar) - + } object Test extends App { diff --git a/test/files/run/sysprops.scala b/test/files/run/sysprops.scala index 4d98e2cdd0..bdad677221 100644 --- a/test/files/run/sysprops.scala +++ b/test/files/run/sysprops.scala @@ -3,16 +3,16 @@ import sys._ /** Basic sys.Prop test. */ object Test { val key = "ding.dong.doobie" - + def bool() = { val prop = BooleanProp.valueIsTrue(key) assert(prop.key == key) - + prop.clear() assert(!prop.value) assert(!prop.isSet) assert(prop.get != null) - + prop set "dingus" assert(prop.get == "dingus") assert(!prop.value) @@ -32,7 +32,7 @@ object Test { prop.set("523") assert(prop.value == 523) prop.set("DingusInt") - + try { println(prop.value) ; assert(false, "should not get here") } catch { case _: Exception => () } } @@ -41,7 +41,7 @@ object Test { prop.set("55.0") assert(prop.value == 55.0) } - + def main(args: Array[String]): Unit = { bool() int() diff --git a/test/files/run/t0017.scala b/test/files/run/t0017.scala index e976f453d8..245cbb7e42 100644 --- a/test/files/run/t0017.scala +++ b/test/files/run/t0017.scala @@ -7,7 +7,7 @@ def transpose[A](arr: Array[Array[A]]) = { var my_arr = Array(Array(1,2),Array(3,4)) -for (i <- Array.range(0, my_arr(0).length)) yield +for (i <- Array.range(0, my_arr(0).length)) yield for (row <- my_arr) yield row(i) val transposed = transpose(my_arr) diff --git a/test/files/run/t0325.scala b/test/files/run/t0325.scala index 048303206c..a126a3a204 100644 --- a/test/files/run/t0325.scala +++ b/test/files/run/t0325.scala @@ -7,7 +7,7 @@ case class RS(self: String) { } def split(separator: Char): Array[String] = self.split(escape(separator)) - + def split(separators: Array[Char]): Array[String] = { val re = separators.foldLeft("[")(_+escape(_)) + "]" self.split(re) @@ -27,7 +27,7 @@ object Test { case e: Throwable => println(which + " failed with " + e.getClass) } } - + def main(args: Array[String]) { val badChars = "?*{+([\\^.$" @@ -46,8 +46,8 @@ object Test { for ((c,str) <- badCases) test(("a"+c+"b").split(str.toArray),"RichString split(\""+ str + "\")") println - + for ((c,str) <- badCases) - test(RS("a"+c+"b").split(str.toArray),"RS split(\""+ str + "\")") + test(RS("a"+c+"b").split(str.toArray),"RS split(\""+ str + "\")") } } diff --git a/test/files/run/t0421-old.scala b/test/files/run/t0421-old.scala index 9b88b4789b..dde89bc542 100644 --- a/test/files/run/t0421-old.scala +++ b/test/files/run/t0421-old.scala @@ -9,17 +9,17 @@ object Test extends App { } def scalprod(xs: Array[Double], ys: Array[Double]) = { - var acc = 0.0 - for ((x, y) <- xs zip ys) acc = acc + x * y + var acc = 0.0 + for ((x, y) <- xs zip ys) acc = acc + x * y acc } def matmul(xss: Array[Array[Double]], yss: Array[Array[Double]]) = { - val ysst = transpose(yss) + val ysst = transpose(yss) val ysst1: Array[Array[Double]] = yss.transpose assert(ysst.deep == ysst1.deep) for (xs <- xss) yield - for (yst <- ysst) yield + for (yst <- ysst) yield scalprod(xs, yst) } @@ -27,6 +27,6 @@ object Test extends App { println(transpose(a1).deep.mkString("[", ",", "]")) println(matmul(Array(Array(2, 3)), Array(Array(5), Array(7))).deep.mkString("[", ",", "]")) - + println(matmul(Array(Array(4)), Array(Array(6, 8))).deep.mkString("[", ",", "]")) } diff --git a/test/files/run/t0508.scala b/test/files/run/t0508.scala index 0f4325e629..2283c46c36 100644 --- a/test/files/run/t0508.scala +++ b/test/files/run/t0508.scala @@ -9,5 +9,5 @@ object Test extends App { } } - foo(Foo.unapply, Foo("this might be fun", 10)) + foo(Foo.unapply, Foo("this might be fun", 10)) } diff --git a/test/files/run/t0631.scala b/test/files/run/t0631.scala index 5bceab6193..c401ed31cb 100644 --- a/test/files/run/t0631.scala +++ b/test/files/run/t0631.scala @@ -1,5 +1,5 @@ object Test extends App { - class Foo { + class Foo { override def equals(that: Any) = { println("Foo.equals called") super.equals(that) diff --git a/test/files/run/t0677-old.scala b/test/files/run/t0677-old.scala index c0f1abae53..8d4c3ee060 100644 --- a/test/files/run/t0677-old.scala +++ b/test/files/run/t0677-old.scala @@ -2,7 +2,7 @@ @deprecated("Suppress warnings", since="2.11") object Test extends App { - class X[T: ClassManifest] { + class X[T: ClassManifest] { val a = Array.ofDim[T](3, 4) } val x = new X[String] diff --git a/test/files/run/t0807.scala b/test/files/run/t0807.scala index 1a1add6b3a..1e2a26664a 100644 --- a/test/files/run/t0807.scala +++ b/test/files/run/t0807.scala @@ -1,5 +1,5 @@ trait A -trait B extends A { val x = println("early") } +trait B extends A { val x = println("early") } object Test extends App { new B {} } diff --git a/test/files/run/t0883.scala b/test/files/run/t0883.scala index adde95197b..c8ed06dbfe 100644 --- a/test/files/run/t0883.scala +++ b/test/files/run/t0883.scala @@ -1,14 +1,14 @@ object Foo { def apply(x: String) = new Foo(x) } class Foo(name: String) case object Bar extends Foo("Bar") -case class Baz() extends Foo("Baz") +case class Baz() extends Foo("Baz") object Test extends App { - Foo("Bar") match { - case Bar => println("What?") + Foo("Bar") match { + case Bar => println("What?") case _ => println("OK") } - Foo("Baz") match { - case Baz() => println("What?") + Foo("Baz") match { + case Baz() => println("What?") case _ => println("OK") - } + } } diff --git a/test/files/run/t1005.scala b/test/files/run/t1005.scala index 575ec43565..562e2e4c6d 100644 --- a/test/files/run/t1005.scala +++ b/test/files/run/t1005.scala @@ -11,7 +11,7 @@ object Test object FromPoly{ def mainer(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar } - + def main(args: Array[String]): Unit = { println(FromMono mainer null mkString) println(FromPoly mainer null mkString) diff --git a/test/files/run/t1141.scala b/test/files/run/t1141.scala index b907b4798f..732c57943c 100644 --- a/test/files/run/t1141.scala +++ b/test/files/run/t1141.scala @@ -6,6 +6,6 @@ object Test extends App { val foo = new { def apply(args : String*) = args foreach println } - + foo("var", "args") } diff --git a/test/files/run/t1167.scala b/test/files/run/t1167.scala index c2ec4cff4e..3dd0a30c00 100644 --- a/test/files/run/t1167.scala +++ b/test/files/run/t1167.scala @@ -10,17 +10,17 @@ trait Test1 { /* getName * Returns the binary name of the class if this class object represents a - * reference type that is not an array type. + * reference type that is not an array type. * getSimpleName * Returns the simple name of the underlying class as given in the source * code. Returns an empty string if the underlying class is anonymous. */ abstract class Foo { override def toString = getClass.getSimpleName - + abstract class Bar { override def toString = getClass.getSimpleName - } + } } object Test extends App { diff --git a/test/files/run/t1220.scala b/test/files/run/t1220.scala index 0ba188d02d..75e0ea07e8 100644 --- a/test/files/run/t1220.scala +++ b/test/files/run/t1220.scala @@ -1,7 +1,7 @@ object Test extends App { class QSRichIterable[A](self: Iterable[A]) { - def filterMap[R](f: PartialFunction[A,R]) = + def filterMap[R](f: PartialFunction[A,R]) = self filter (f.isDefinedAt) map f } diff --git a/test/files/run/t1300.scala b/test/files/run/t1300.scala index ce2f80eb4e..aa3580e33c 100644 --- a/test/files/run/t1300.scala +++ b/test/files/run/t1300.scala @@ -4,10 +4,10 @@ object Test extends App // val a1 = x1.toArray[Any] val a2 = Array('a','b','c','d').toArray[Any] val a3 = Array("e","f","g","h").toArray[Any] - + Array.copy(a3, 0, a1, 0, 4) Array.copy(a2, 0, a3, 0, 4) Array.copy(a2, 0, a1, 0, 4) - + println(a1.mkString + a2.mkString + a3.mkString) } diff --git a/test/files/run/t1309.scala b/test/files/run/t1309.scala index b6a75fe6ae..84963549a2 100644 --- a/test/files/run/t1309.scala +++ b/test/files/run/t1309.scala @@ -1,6 +1,6 @@ object Test { def f(ras: => IndexedSeq[Byte]): IndexedSeq[Byte] = ras - + def main(args: Array[String]): Unit = { f(new Array[Byte](0)) } diff --git a/test/files/run/t1323.scala b/test/files/run/t1323.scala index 8209b85219..94b51bd2a4 100644 --- a/test/files/run/t1323.scala +++ b/test/files/run/t1323.scala @@ -3,9 +3,9 @@ object Test extends App { println(" 2:" + List(1,2,3,4).indexOfSlice(List(1,2))) // 0 println(" 3:" + List(1,2,3,4).indexOfSlice(List(2,3))) // 1 println(" 4:" + List(1,2,3,4).indexOfSlice(List(3,4))) // 2 - println(" 5:" + List(1,2,3,4).indexOfSlice(List(4,5))) // -1 + println(" 5:" + List(1,2,3,4).indexOfSlice(List(4,5))) // -1 println(" 6:" + List(1,2,3,4).indexOfSlice(List(2,4))) // -1 - println(" 7:" + List(1,2,3,4).indexOfSlice(List(4,3))) // -1 + println(" 7:" + List(1,2,3,4).indexOfSlice(List(4,3))) // -1 println(" 8:" + List(1,2,3,4).indexOfSlice(List(1,3))) // -1 println(" 9:" + List(1,2,3,4).indexOfSlice(List(1,3))) // -1 println("10:" + List(1,2,3,4).indexOfSlice(List(1,2,3,4))) // 0 diff --git a/test/files/run/t1333.scala b/test/files/run/t1333.scala index 514b4ffc8a..1696629cbb 100644 --- a/test/files/run/t1333.scala +++ b/test/files/run/t1333.scala @@ -1,11 +1,11 @@ object Test { case class A(x: Int)(y: Int)(z: String) - + def f(x: Any) = x match { case A(x) => x case _ => -1 } - + def main(args: Array[String]): Unit = { println(f(A(10)(20)("abc"))) println(f(A(-10)(20)("abc"))) diff --git a/test/files/run/t1423.scala b/test/files/run/t1423.scala index 44c6653287..073483aeee 100644 --- a/test/files/run/t1423.scala +++ b/test/files/run/t1423.scala @@ -5,4 +5,4 @@ object Test extends App{ case 1L => println(1); case _ => println("????"); } -} +} diff --git a/test/files/run/t1427.scala b/test/files/run/t1427.scala index eeb2603c26..4b8057ffe8 100644 --- a/test/files/run/t1427.scala +++ b/test/files/run/t1427.scala @@ -12,7 +12,7 @@ object Test { def main(args: Array[String]): Unit = { val x = new Bob[List] val results = List(x, new Bob[Set], 55) map (x foo _) - + assert(results == List(true, true, false)) } } diff --git a/test/files/run/t1430/Bar_1.java b/test/files/run/t1430/Bar_1.java index 4db2eafcbd..e49b6becb2 100644 --- a/test/files/run/t1430/Bar_1.java +++ b/test/files/run/t1430/Bar_1.java @@ -2,7 +2,7 @@ package j; interface Foo { public void foo(); -} +} public interface Bar_1 extends Foo { public void bar(); -} +} diff --git a/test/files/run/t1430/Test_2.scala b/test/files/run/t1430/Test_2.scala index 7af65de5cd..278d9c7fd3 100644 --- a/test/files/run/t1430/Test_2.scala +++ b/test/files/run/t1430/Test_2.scala @@ -6,7 +6,7 @@ package s { class Baz(x: j.Bar_1) { x.foo override def toString = "Baz" - } + } } object Test { diff --git a/test/files/run/t1505.scala b/test/files/run/t1505.scala index d7feb30ce3..4afbb99ef7 100644 --- a/test/files/run/t1505.scala +++ b/test/files/run/t1505.scala @@ -18,5 +18,5 @@ object Test extends App { var failed = false try { Q.withName("x") } catch { case _: NoSuchElementException => failed = true } assert(failed) - + } diff --git a/test/files/run/t1537.scala b/test/files/run/t1537.scala index ddbfb29ac4..1dce501990 100644 --- a/test/files/run/t1537.scala +++ b/test/files/run/t1537.scala @@ -4,15 +4,15 @@ trait Syntax { trait Evaluation { val syntax: Syntax - + def equalInTrait = this.syntax.Foo == this.syntax.Foo } object Test extends Evaluation with App { - object syntax extends Syntax + object syntax extends Syntax def equalInObject = this.syntax.Foo == this.syntax.Foo - + println(equalInTrait) println(equalInObject) } diff --git a/test/files/run/t1591.scala b/test/files/run/t1591.scala index bd43f0b23d..6dd9605042 100644 --- a/test/files/run/t1591.scala +++ b/test/files/run/t1591.scala @@ -1,8 +1,8 @@ abstract class A { - + lazy val lazyBar = bar - - object bar { + + object bar { val foo = 12 } diff --git a/test/files/run/t1718.scala b/test/files/run/t1718.scala index 358bd1be5a..d1b19c38cd 100644 --- a/test/files/run/t1718.scala +++ b/test/files/run/t1718.scala @@ -1,10 +1,10 @@ object Test extends App{ - def matchesNull[T](mightBeNull: Array[T]): Boolean = mightBeNull match { + def matchesNull[T](mightBeNull: Array[T]): Boolean = mightBeNull match { case null => true case x => false } val nullArray: Array[String] = null - println(matchesNull(nullArray)) + println(matchesNull(nullArray)) } diff --git a/test/files/run/t1766.scala b/test/files/run/t1766.scala index 7d12451092..ff81da3f8e 100644 --- a/test/files/run/t1766.scala +++ b/test/files/run/t1766.scala @@ -2,18 +2,18 @@ import scala.language.{ reflectiveCalls } object Test extends App { - + class C(s: String) { - + def this(i: Int) = this("bar") - + def f = { val v: { def n: Int } = new { val n = 3 } v.n } - + } - + new C("foo").f - + } diff --git a/test/files/run/t1829.scala b/test/files/run/t1829.scala index 7c39d33ae9..8240527424 100644 --- a/test/files/run/t1829.scala +++ b/test/files/run/t1829.scala @@ -1,6 +1,6 @@ object Test{ def main(args : Array[String]){ - import scala.collection.immutable._ + import scala.collection.immutable._ assert(IntMap.empty == HashMap.empty); assert(HashMap.empty == IntMap.empty); assert(LongMap.empty == HashMap.empty); diff --git a/test/files/run/t1987.scala b/test/files/run/t1987.scala index 4c278ec6a0..de869edea0 100644 --- a/test/files/run/t1987.scala +++ b/test/files/run/t1987.scala @@ -5,7 +5,7 @@ package foo { package object bar { def duh(n: Long) = println("long") def duh(n: Double) = println("double") - + def duh2(n: Double) = println("double") def duh2(n: Long) = println("long") } @@ -16,7 +16,7 @@ package foo { bip.bar.duh(33L) duh(33d) bip.bar.duh(33d) - + duh2(33L) bip.bar.duh2(33L) duh2(33d) @@ -35,7 +35,7 @@ package bip { def duh2(n: Double) = println("double") def duh2(n: Long) = println("long") } - + package object bar extends Duh with Duh2 { } package bar { object Main { @@ -44,7 +44,7 @@ package bip { bip.bar.duh(33L) duh(33d) bip.bar.duh(33d) - + duh2(33L) bip.bar.duh2(33L) duh2(33d) diff --git a/test/files/run/t2029.scala b/test/files/run/t2029.scala index 1cbe97a350..32b04f0b47 100644 --- a/test/files/run/t2029.scala +++ b/test/files/run/t2029.scala @@ -3,10 +3,10 @@ object Test{ import scala.collection.immutable.TreeSet; val mainSet = TreeSet(1 to 5 :_*) - + var compareCalled = false; val smallerSet = TreeSet(2 to 4 :_*)(Ordering[Int].reverse) - + println(mainSet.mkString(",")) println(smallerSet.mkString(",")) println(smallerSet.subsetOf(mainSet)); diff --git a/test/files/run/t2074_2.scala b/test/files/run/t2074_2.scala index 1f59e0b8a1..4624170f89 100644 --- a/test/files/run/t2074_2.scala +++ b/test/files/run/t2074_2.scala @@ -12,7 +12,7 @@ object Test { def iterator = underlying.iterator } val w = IndexedSeq(1, 2, 3).view - + def main(args: Array[String]): Unit = { println(v) println(w) diff --git a/test/files/run/t2087-and-2400.scala b/test/files/run/t2087-and-2400.scala index 93cd633ffb..19a5df26e3 100644 --- a/test/files/run/t2087-and-2400.scala +++ b/test/files/run/t2087-and-2400.scala @@ -3,14 +3,14 @@ object Test def negativeCharMaker = new (Short => Char) { def apply(x: Short) = x.toChar } def main(args: Array[String]): Unit = { // throws exception if -100 gets to Character.valueOf - val x = negativeCharMaker(-100) - + val x = negativeCharMaker(-100) + // chars are unsigned, they should never be equal to negative values assert((-100).toShort != (-100).toChar) assert((-100).toChar != (-100).toShort) assert((-100).toChar != (-100).toByte) assert((-100).toByte != (-100).toChar) - + // BoxesRunTime must agree as well assert(((-100).toShort: Any) != (-100).toChar) assert(((-100).toChar: Any) != (-100).toShort) diff --git a/test/files/run/t2296c/Action.java b/test/files/run/t2296c/Action.java index 50ba9a4de1..4a6b69a5b8 100644 --- a/test/files/run/t2296c/Action.java +++ b/test/files/run/t2296c/Action.java @@ -8,7 +8,7 @@ public abstract class Action { public Action(Global glob0) { m_glob = glob0; } - + public Action() { this(null); } diff --git a/test/files/run/t2308a.scala b/test/files/run/t2308a.scala index 200dee1ef6..d1144db37d 100644 --- a/test/files/run/t2308a.scala +++ b/test/files/run/t2308a.scala @@ -2,8 +2,8 @@ import scala.language.{ higherKinds } object Test { trait T[M[_]] - + def f1 = classOf[T[X] forSome { type X[_] } ] - + def main(args: Array[String]): Unit = println(f1) } diff --git a/test/files/run/t2318.scala b/test/files/run/t2318.scala index d7fd9fdd41..b638c433f5 100644 --- a/test/files/run/t2318.scala +++ b/test/files/run/t2318.scala @@ -4,7 +4,7 @@ import scala.language.{ reflectiveCalls } object Test { trait Bar { def bar: Unit } - + object Mgr extends SecurityManager { override def checkPermission(perm: Permission) = perm match { case _: java.lang.RuntimePermission => () @@ -14,11 +14,11 @@ object Test { case _ => super.checkPermission(perm) } } - + def t1() = { val p = Runtime.getRuntime().exec("ls"); type Destroyable = { def destroy() : Unit } - def doDestroy( obj : Destroyable ) : Unit = obj.destroy(); + def doDestroy( obj : Destroyable ) : Unit = obj.destroy(); doDestroy( p ); } def t2() = { @@ -30,12 +30,12 @@ object Test { val structural = b.asInstanceOf[{ def bar: Unit }] structural.bar } - + def main(args: Array[String]) { // figuring this will otherwise break on windows try t1() catch { case _: java.io.IOException => () } - + t2() } } diff --git a/test/files/run/t2337.scala b/test/files/run/t2337.scala index 86a372ce56..edb574cba4 100644 --- a/test/files/run/t2337.scala +++ b/test/files/run/t2337.scala @@ -10,7 +10,7 @@ object Test { // throw new Exception("Unsupported compare " + first + "; " + second) } } - + def main(args: Array[String]): Unit = { println("Both Int", -1, compare(0, 1)) println("Both Float", 1, compare(1.0, 0.0)) diff --git a/test/files/run/t2417.scala b/test/files/run/t2417.scala index 18b6c326b5..8d1527e2d6 100644 --- a/test/files/run/t2417.scala +++ b/test/files/run/t2417.scala @@ -1,6 +1,6 @@ // #2417 object Test { - + def parallel(numThreads: Int)(block: => Unit) { var failure: Throwable = null val threads = Array.tabulate(numThreads)(i => new Thread { @@ -16,7 +16,7 @@ object Test { for (t <- threads) t.join if (failure != null) println("FAILURE: " + failure) } - + def testSet(initialSize: Int, numThreads: Int, passes: Int) { val orig = Set.empty ++ (1 to initialSize) parallel(numThreads) { @@ -32,7 +32,7 @@ object Test { } } } - + def testMap(initialSize: Int, numThreads: Int, passes: Int) { val orig = Map.empty ++ ((1 to initialSize) map ((_,"v"))) parallel(numThreads) { @@ -48,28 +48,28 @@ object Test { } } } - + def main(args: Array[String]) { println("testing small Map that doesn't promote to HashMap...") testMap(4, 2, 1000000) println() - + println("testing single-threaded HashMap use...") testMap(5, 1, 1000000) println() - + println("testing HashMap.size from multiple threads...") testMap(5, 2, 1000000) println() - + println("testing small Set that doesn't promote to HashSet...") testSet(4, 2, 1000000) println() - + println("testing single-threaded HashSet use...") testSet(5, 1, 1000000) println() - + println("testing HashSet.size from multiple threads...") testSet(5, 2, 1000000) println() diff --git a/test/files/run/t2512.scala b/test/files/run/t2512.scala index de20af5e72..8166839a9a 100644 --- a/test/files/run/t2512.scala +++ b/test/files/run/t2512.scala @@ -3,11 +3,11 @@ import scala.tools.nsc.util.HashSet object Test { val runs = 10000 class Bop - + def main(args: Array[String]): Unit = { val set: HashSet[Bop] = HashSet("Bop", 16) (1 to runs).toList foreach (_ => set addEntry new Bop) - + assert(runs == set.size && set.size == set.iterator.length) } } diff --git a/test/files/run/t2514.scala b/test/files/run/t2514.scala index cf5fa0ea02..0bf716e8bb 100644 --- a/test/files/run/t2514.scala +++ b/test/files/run/t2514.scala @@ -5,7 +5,7 @@ import scala.language.{ implicitConversions, postfixOps, reflectiveCalls } object Test { implicit def x[A](a: A) = new { def xx = a } - + def main(args: Array[String]): Unit = { val r1 = 12 xx; val r2 = 12.xx @@ -13,7 +13,7 @@ object Test val r4 = 12.xx + 12.xx val r5 = 12.`xx` + 12.xx val r6 = 12.3.`xx` + 12.xx - + assert(r5 == 24) } } diff --git a/test/files/run/t2526.scala b/test/files/run/t2526.scala index d37185535f..53f3059135 100644 --- a/test/files/run/t2526.scala +++ b/test/files/run/t2526.scala @@ -4,18 +4,18 @@ */ object Test { import collection._ - + def main(args: Array[String]) { val m = new mutable.HashMap[String, String] - + /* Use non hash-based structure for verification */ val keys = List("a", "b", "c", "d", "e") val valueSuffix = "value" val values = keys.map(_ + valueSuffix) val entries = keys.zip(values) - + for (k <- keys) m(k) = k + valueSuffix - + assertForeach(keys, m.keySet.iterator) assertForeach(keys, m.keysIterator) assertForeach(keys, m.keySet) @@ -25,7 +25,7 @@ object Test { assertForeach(entries, m) } - + /* Checks foreach of `actual` goes over all the elements in `expected` */ private def assertForeach[E](expected: Traversable[E], actual: Iterator[E]): Unit = { val notYetFound = new mutable.ArrayBuffer[E]() ++= expected @@ -35,12 +35,12 @@ object Test { } assert(notYetFound.size == 0, "mutable.HashMap.foreach should have iterated over: " + notYetFound) } - - /* + + /* * Checks foreach of `actual` goes over all the elements in `expected` * We duplicate the method above because there is no common inteface between Traversable and * Iterator and we want to avoid converting between collections to ensure that we test what - * we mean to test. + * we mean to test. */ private def assertForeach[E](expected: Traversable[E], actual: Traversable[E]): Unit = { val notYetFound = new mutable.ArrayBuffer[E]() ++= expected diff --git a/test/files/run/t2552.scala b/test/files/run/t2552.scala index 17dcac596b..0c6b4f005b 100644 --- a/test/files/run/t2552.scala +++ b/test/files/run/t2552.scala @@ -2,11 +2,11 @@ object Test extends App { def testTakeWhile = { val numbers = Iterator.range(0, 50) val zeroTo9 = numbers.takeWhile(x => { println("p(" + x + ")"); x < 10 } ) - + zeroTo9.foreach(println _) - + val zeroTo1 = Iterator.range(0, 20).takeWhile(x => { println("p(" + x + ")"); x < 2 } ) - + println(zeroTo1.hasNext) println(zeroTo1.hasNext) println(zeroTo1.next) @@ -15,16 +15,16 @@ object Test extends App { println(zeroTo1.hasNext) println(zeroTo1.hasNext) } - + def testFilter = { val predicate = (x: Int) => { println("p(" + x + ")"); x % 2 == 0 } - + val evens = Iterator.range(0, 10).filter(predicate) - + println(evens.hasNext) println(evens.hasNext) println(evens.next) - + evens.foreach(println _) } diff --git a/test/files/run/t2636.scala b/test/files/run/t2636.scala index 6ae2248a26..2f55c8ad5a 100644 --- a/test/files/run/t2636.scala +++ b/test/files/run/t2636.scala @@ -6,28 +6,28 @@ object Test type Foo = { def update(x: Int, value: String): Unit } type Foo2 = { def update(x: Int, value: String): Int } type Foo3 = { def update(x: Int, value: String): Array[Int] } - + def alen() = { type L1 = { def length: Int } def len(p: L1) = p.length val x: L1 = Array(1,2,3) len(x) } - + type A1 = { def apply(x: Int): String } def arrApply(a: A1, x: Int) = a(x) - + def main(args: Array[String]): Unit = { val arr = new Array[String](3) val p1: Foo = arr def a1 = p1(0) = "b" val p2: Foo2 = new { def update(x: Int, value: String) = { p1(1) = "o" ; 1 } } - def a2 = p2(0) = "c" - + def a2 = p2(0) = "c" + val p3: Foo3 = new { def update(x: Int, value: String) = { p1(2) = "b" ; Array(1) } } def a3 = p3(10) = "hi mom" - + a1 ; a2 ; a3 ; assert(arr.mkString == "bob") diff --git a/test/files/run/t266.scala b/test/files/run/t266.scala index 1fd6dab185..20a29dabbb 100644 --- a/test/files/run/t266.scala +++ b/test/files/run/t266.scala @@ -2,9 +2,9 @@ trait O { self: Test.type => - + Nil foreach identity - + def f = (1 to 10).toList map identity } diff --git a/test/files/run/t2755.scala b/test/files/run/t2755.scala index c279ecc24e..8d10b56734 100644 --- a/test/files/run/t2755.scala +++ b/test/files/run/t2755.scala @@ -28,7 +28,7 @@ object Test { case x: Array[_] => 6 case _ => 7 } - + def main(args: Array[String]): Unit = { println(f1(Array(1, 2, 3))) @@ -38,7 +38,7 @@ object Test { println(f1(new Array[Any](10))) // should match as Array[AnyRef] println(f1(Array(1L))) println(f1(null)) - + println(f2(Array(1, 2, 3))) println(f2(Array(1.0, -2.0, 3.0, 1.0))) println(f2(Array(1.0f, 2.0f, 3.0f, -3.0f))) @@ -46,7 +46,7 @@ object Test { println(f2(new Array[Any](10))) // should match as Array[AnyRef] println(f2(Array(1L))) println(f2(null)) - + println(f3(Array(1, 2, 3))) println(f3(Array(1.0, -2.0, 3.0, 1.0))) println(f3(Array(1.0f, 2.0f, 3.0f, -3.0f))) diff --git a/test/files/run/t2800.scala b/test/files/run/t2800.scala index cc6fb30bbc..84d1de0507 100644 --- a/test/files/run/t2800.scala +++ b/test/files/run/t2800.scala @@ -3,20 +3,20 @@ object Test { def f2 = (5: Any) match { case List(x @ _*) => x ; case _ => false } def f3 = (Nil: Any) match { case List(x @ _*) => x ; case _ => false } def f4 = (Array(1): Any) match { case List(x @ _*) => x ; case _ => false } - + def f5 = ("": Any) match { case Array(x @ _*) => x ; case _ => false } def f6 = (5: Any) match { case Array(x @ _*) => x ; case _ => false } def f7 = (Nil: Any) match { case Array(x @ _*) => x ; case _ => false } def f8 = (Array(1): Any) match { case Array(x @ _*) => x ; case _ => false } - + def f9 = ("": Any) match { case x @ List(_*) => x ; case _ => false } def f10 = ("": Any) match { case List(_*) => true ; case _ => false } def f11 = (Nil: Any) match { case List(_*) => true ; case _ => false } def f12 = ("": Any) match { case x @ Array(_*) => x ; case _ => false } def f13 = ("": Any) match { case Array(_*) => true ; case _ => false } def f14 = (Nil: Any) match { case Array(_*) => true ; case _ => false } - - + + def main(args: Array[String]): Unit = { println(f1) println(f2) diff --git a/test/files/run/t2818.scala b/test/files/run/t2818.scala index 19b67cbc88..746cdfb049 100644 --- a/test/files/run/t2818.scala +++ b/test/files/run/t2818.scala @@ -1,6 +1,6 @@ object Test extends App { println((List.range(1L, 15L) :\ 0L) (_ + _)) println((List.range(1L, 1000000L) :\ 0L) (_ + _)) - println((List.fill(5)(1) :\ 1) (_ - _)) - println((List.fill(1000000)(1) :\ 1) (_ - _)) + println((List.fill(5)(1) :\ 1) (_ - _)) + println((List.fill(1000000)(1) :\ 1) (_ - _)) } diff --git a/test/files/run/t2849.scala b/test/files/run/t2849.scala index 0995f64010..cadf605ae0 100644 --- a/test/files/run/t2849.scala +++ b/test/files/run/t2849.scala @@ -16,9 +16,9 @@ object Test { def ticketExample { var big = 100000 - + var aSortedSet: SortedSet[Int] = TreeSet(big) - + for (i <- 1 until N) { aSortedSet = (aSortedSet - big) ++ (TreeSet(i, big - 1)) big -= 1 @@ -42,7 +42,7 @@ object Test { } } } - + } diff --git a/test/files/run/t2867.scala b/test/files/run/t2867.scala index 0d30f95f8d..25e55eaecd 100644 --- a/test/files/run/t2867.scala +++ b/test/files/run/t2867.scala @@ -1,6 +1,6 @@ object Test { - case class A(l: List[_]*) - + case class A(l: List[_]*) + def main(args: Array[String]): Unit = { /** Kind of sneaking a slightly different test in here as well as * testing 2867. How subversive. @@ -9,7 +9,7 @@ object Test { val xs2 = List(1.0, 2.0, 3.0) val xs3 = List[Any](1.0f, 2.0f, 3.0f) val xs4 = List[Byte](1, 2, 3) - + assert(A(List(xs1, xs2)) == A(List(xs3, xs4))) } } diff --git a/test/files/run/t2958.scala b/test/files/run/t2958.scala index b9563a1b77..dcd24ecc36 100644 --- a/test/files/run/t2958.scala +++ b/test/files/run/t2958.scala @@ -2,14 +2,14 @@ object Test { def f(args: Array[String]) = args match { case Array("-p", prefix, from, to) => prefix + from + to - + case Array(from, to) => from + to case _ => "default" } - + def main(args: Array[String]) { assert(f(Array("1", "2")) == "12") } diff --git a/test/files/run/t3026.scala b/test/files/run/t3026.scala index 0231c7bcd1..22dde9cc03 100755 --- a/test/files/run/t3026.scala +++ b/test/files/run/t3026.scala @@ -3,6 +3,6 @@ object Test { case object RED extends Colour case object YELLOW extends Colour val items = Array(RED, YELLOW) - + def main(args: Array[String]): Unit = items foreach println } diff --git a/test/files/run/t3038.scala b/test/files/run/t3038.scala index 986fc982e7..7eb69f7fb5 100644 --- a/test/files/run/t3038.scala +++ b/test/files/run/t3038.scala @@ -2,18 +2,18 @@ class A { private lazy val a1 = "a1" object B private lazy val a2 = "a2" - + @transient lazy val a3 = "a3" @transient private lazy val a4 = "a4" @transient lazy val a5 = "a5" @transient private lazy val a6 = "a6" - + final val a7 = "a7" private final val a8 = "a8" @transient final val a9 = "a9" - - + + def run = { @@ -27,13 +27,13 @@ class A { println(a7) println(a8) println(a9) - } + } } class C extends A { private lazy val c1 = "c1" lazy val c2 = "c2" - + private lazy val c3 = "c3" @transient lazy val c4 = "c4" @@ -41,7 +41,7 @@ class C extends A { @transient lazy val c6 = "c6" @transient private lazy val c7 = "c7" lazy val c8 = "c8" - + final val c9 = "c9" private final val c10 = "c10" diff --git a/test/files/run/t3038c/A_1.scala b/test/files/run/t3038c/A_1.scala index 14579fcf67..91564e3021 100644 --- a/test/files/run/t3038c/A_1.scala +++ b/test/files/run/t3038c/A_1.scala @@ -59,7 +59,7 @@ class A { lazy val a57 = 58 lazy val a58 = 59 lazy val a59 = 60 - private lazy val a60 = 61 + private lazy val a60 = 61 private lazy val a61 = 62 private lazy val a62 = 63 private lazy val a63 = 64 @@ -69,7 +69,7 @@ class A { private lazy val a67 = 68 private lazy val a68 = 69 private lazy val a69 = 70 - + def run = { println(List(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, diff --git a/test/files/run/t3038d.scala b/test/files/run/t3038d.scala index 56cfcdb174..44fb047b0b 100644 --- a/test/files/run/t3038d.scala +++ b/test/files/run/t3038d.scala @@ -20,13 +20,13 @@ class Bar extends Foo with Serializable { @transient protected var first: Any = null def size = a @transient var second: Any = null - + def checkMember { if (first == null) print("") } - + private def writeObject(out: java.io.ObjectOutputStream) { serializeTo(out) } - + private def readObject(in: java.io.ObjectInputStream) { first = null init(in) @@ -38,7 +38,7 @@ object Test { val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(bytes)) in.readObject.asInstanceOf[A] } - + private def toBytes(o: AnyRef): Array[Byte] = { val bos = new java.io.ByteArrayOutputStream val out = new java.io.ObjectOutputStream(bos) @@ -47,7 +47,7 @@ object Test { bos.toByteArray } - + def main(args: Array[String]) { val a1 = new Bar() val serialized:Array[Byte] = toBytes(a1) diff --git a/test/files/run/t3050.scala b/test/files/run/t3050.scala index 65b2674b69..160f8b664b 100644 --- a/test/files/run/t3050.scala +++ b/test/files/run/t3050.scala @@ -1,9 +1,9 @@ object Test { def main(args: Array[String]): Unit = { - val x = + val x = try { ("": Any) match { case List(_*) => true } } catch { case _: Throwable => false } - + assert(!x) } } diff --git a/test/files/run/t3112.scala b/test/files/run/t3112.scala index 88677fa09e..eb8eec6327 100644 --- a/test/files/run/t3112.scala +++ b/test/files/run/t3112.scala @@ -7,5 +7,5 @@ object Test { println((Vector() ++ (0 until 32)) takeRight 0) // works println((Vector() ++ (0 until 33)) takeRight 0) // error } - + }
\ No newline at end of file diff --git a/test/files/run/t3150.scala b/test/files/run/t3150.scala index 8acdb50354..034703b5f7 100644 --- a/test/files/run/t3150.scala +++ b/test/files/run/t3150.scala @@ -1,7 +1,7 @@ object Test { case object Bob { override def equals(other: Any) = true } def f(x: Any) = x match { case Bob => Bob } - + def main(args: Array[String]): Unit = { assert(f(Bob) eq Bob) assert(f(0) eq Bob) diff --git a/test/files/run/t3158.scala b/test/files/run/t3158.scala index 2261b5cd81..c824b62e96 100644 --- a/test/files/run/t3158.scala +++ b/test/files/run/t3158.scala @@ -1,6 +1,6 @@ object Test { def main(args: Array[String]) { - println(args.map(_ => foo _).deep) + println(args.map(_ => foo _).deep) } def foo(xs: String*) { diff --git a/test/files/run/t3175.scala b/test/files/run/t3175.scala index 5c6daead38..ea56ded229 100644 --- a/test/files/run/t3175.scala +++ b/test/files/run/t3175.scala @@ -9,46 +9,46 @@ object Test { def f1(x:{ def apply(x: Int): Long }) = x(0) def f2(x:{ def apply(x: Int): Byte }) = x(0) def f3(x:{ def apply(x: Int): String }) = x(0).length - + def f4(x:{ def update(x: Int, y: Long): Unit }, y: Long) = x(0) = y def f5(x:{ def update(x: Int, y: Byte): Unit }, y: Byte) = x(0) = y def f6(x:{ def update(x: Int, y: String): Unit }, y: String) = x(0) = y - + def f7(x: { def length: Any }) = x.length - + def f8(x: { def apply(x: Int): Any }) = x(0) def f9(x: { def apply(x: Int): Int }) = x(0) def f10(x: { def apply(x: Int): Long }) = x(0) - + // update has some interesting special cases def f11(x:{ def update(x: Int, y: Long): Any }, y: Long) = x(0) = y - def f12(x:{ def update(x: Int, y: String): AnyVal }, y: String) = x(0) = y + def f12(x:{ def update(x: Int, y: String): AnyVal }, y: String) = x(0) = y def f13(x:{ def update(x: Int, y: String): AnyRef }, y: String) = x(0) = y - + // doesn't work yet, see #3197 // def fclone(x:{ def clone(): AnyRef }) = x.clone() - + def main(args: Array[String]): Unit = { val longs = Array(5L) val bytes = Array(5: Byte) val strs = Array("abcde", "fghjij") - + println(len(Array(1,2,3)) + len(Array(4.0,5.0f)) + len(Array("abc", 5)) + len("bop")) println(f1(longs) + f2(bytes) + f3(strs)) - + f4(longs, 1) f5(bytes, 1) f6(strs, "a") - + println(f1(longs) + f2(bytes) + f3(strs)) - + println(f7(Array(1,2,3))) println(f7("def")) - + println(f8(Array(5))) println(f9(Array(5))) println(f10(Array(5))) - + f11(longs, 100L) f12(strs, "jabooboo") println(longs(0)) diff --git a/test/files/run/t3232.scala b/test/files/run/t3232.scala index 4c6cb1e35c..900a1f5dba 100644 --- a/test/files/run/t3232.scala +++ b/test/files/run/t3232.scala @@ -4,14 +4,14 @@ object Test { val r2 = 1 to Int.MaxValue val r3 = Int.MinValue to -2 val r4 = Int.MinValue until -1 - + // some exceptional conditions val e1 = () => (0 to Int.MaxValue).length val e2 = () => (5 until 5).last - + def main(args: Array[String]): Unit = { List(r1, r2, r3, r4) foreach (x => assert(x.length == Int.MaxValue)) - + // exception required List(e1, e2) foreach { f => try { f() ; assert(false) } diff --git a/test/files/run/t3269.scala b/test/files/run/t3269.scala index 6fe727111c..17e42cdb0e 100644 --- a/test/files/run/t3269.scala +++ b/test/files/run/t3269.scala @@ -4,6 +4,6 @@ object Test { println(it.next) it.hasNext it.hasNext - it.hasNext + it.hasNext } } diff --git a/test/files/run/t3273.scala b/test/files/run/t3273.scala index a4dfc4b30c..379a8a29c1 100644 --- a/test/files/run/t3273.scala +++ b/test/files/run/t3273.scala @@ -1,7 +1,7 @@ object Test { val num1: Stream[Int] = 1 #:: num1.map(_ + 1) val num2: Stream[Int] = 1 #:: num2.iterator.map(_ + 1).toStream - + def main(args: Array[String]): Unit = { val x1 = (num1 take 10).toList val x2 = (num2 take 10).toList diff --git a/test/files/run/t3326.scala b/test/files/run/t3326.scala index f70cb01504..4ac7ef9138 100644 --- a/test/files/run/t3326.scala +++ b/test/files/run/t3326.scala @@ -10,7 +10,7 @@ import scala.math.Ordering * * There are 2 `++` overloads - a generic one in traversables and * a map-specific one in `MapLike` - which knows about the ordering. - * + * * The problem here is that the expected return type for the expression * in which `++` appears drives the decision of the overload that needs * to be taken. @@ -18,36 +18,36 @@ import scala.math.Ordering * `SortedMap`, but `immutable.Map` instead. * This is why `collection.SortedMap` used to resort to the generic * `TraversableLike.++` which knows nothing about the ordering. - * + * * To avoid `collection.SortedMap`s resort to the more generic `TraverableLike.++`, * we override the `MapLike.++` overload in `collection.SortedMap` to return * the proper type `SortedMap`. */ object Test { - + def main(args: Array[String]) { testCollectionSorted() testImmutableSorted() } - + def testCollectionSorted() { import collection._ val order = implicitly[Ordering[Int]].reverse var m1: SortedMap[Int, String] = SortedMap.empty[Int, String](order) var m2: SortedMap[Int, String] = SortedMap.empty[Int, String](order) - + m1 += (1 -> "World") m1 += (2 -> "Hello") - + m2 += (4 -> "Bar") m2 += (5 -> "Foo") - + val m3: SortedMap[Int, String] = m1 ++ m2 - + println(m1) println(m2) println(m3) - + println(m1 + (3 -> "?")) } @@ -56,19 +56,19 @@ object Test { val order = implicitly[Ordering[Int]].reverse var m1: SortedMap[Int, String] = SortedMap.empty[Int, String](order) var m2: SortedMap[Int, String] = SortedMap.empty[Int, String](order) - + m1 += (1 -> "World") m1 += (2 -> "Hello") - + m2 += (4 -> "Bar") m2 += (5 -> "Foo") - + val m3: SortedMap[Int, String] = m1 ++ m2 - + println(m1) println(m2) println(m3) - + println(m1 + (3 -> "?")) } } diff --git a/test/files/run/t3361.scala b/test/files/run/t3361.scala index f739d17b86..d49bcbc905 100644 --- a/test/files/run/t3361.scala +++ b/test/files/run/t3361.scala @@ -40,7 +40,7 @@ object Test extends App { def insert_1 { val ten = DoubleLinkedList(1 to 10: _*) ten.append(DoubleLinkedList(11)) - + // Post-insert size test require(11 == ten.size) // Post-insert data test diff --git a/test/files/run/t3376.check b/test/files/run/t3376.check index 3a1d7d581b..cc6949d326 100644 --- a/test/files/run/t3376.check +++ b/test/files/run/t3376.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class M[@specialized T] { override def toString = "mmm" } defined class M diff --git a/test/files/run/t3395.scala b/test/files/run/t3395.scala index 01cc431871..b4990a1716 100644 --- a/test/files/run/t3395.scala +++ b/test/files/run/t3395.scala @@ -1,11 +1,11 @@ object Test { def main(args: Array[String]): Unit = { - Seq("") match { + Seq("") match { case Seq("") => println("abc") case Seq(_, _, x) => println(x) } - - Seq(1, 2, "def") match { + + Seq(1, 2, "def") match { case Seq("") => println("abc") case Seq(_, _, x) => println(x) } diff --git a/test/files/run/t3397.scala b/test/files/run/t3397.scala index 243fe766de..2c8cbed3ab 100644 --- a/test/files/run/t3397.scala +++ b/test/files/run/t3397.scala @@ -1,7 +1,7 @@ object Test { def main(args: Array[String]): Unit = { val x = Seq(Set(1,2,3),Set(4,5,6),Set(7,8,9)).transpose - + () } } diff --git a/test/files/run/t3488.scala b/test/files/run/t3488.scala index 20a1400dce..a8cfa9b808 100644 --- a/test/files/run/t3488.scala +++ b/test/files/run/t3488.scala @@ -1,6 +1,6 @@ object Test extends App { def foo(p: => Unit)(x:Int = 0) = x - + println(foo { val List(_*)=List(0); 1 } ()) println(foo { val List(_*)=List(0); 1 } (1)) } diff --git a/test/files/run/t3493.scala b/test/files/run/t3493.scala index b0b7589cfd..aafe7a3a4a 100644 --- a/test/files/run/t3493.scala +++ b/test/files/run/t3493.scala @@ -3,7 +3,7 @@ object Test { - + def main(args: Array[String]) { import scala.collection.immutable._ val x = TreeSet("a", "b", "c", "d") @@ -11,5 +11,5 @@ object Test { assert(x2.toString == "TreeSet(a, b, c, d, e)") assert(x2.toString == runtime.ScalaRunTime.stringOf(x2).trim) } - + } diff --git a/test/files/run/t3496.scala b/test/files/run/t3496.scala index 80a4e6bd86..e1aa032ab1 100644 --- a/test/files/run/t3496.scala +++ b/test/files/run/t3496.scala @@ -4,12 +4,12 @@ // ticket #3496 object Test { - + def main(args: Array[String]) { val s = Stream.from(1) s.take(5) s.drop(5) s.splitAt(5) } - + } diff --git a/test/files/run/t3502.scala b/test/files/run/t3502.scala index 9492b2d4d4..cc78e54c86 100644 --- a/test/files/run/t3502.scala +++ b/test/files/run/t3502.scala @@ -5,7 +5,7 @@ // ticket #3502 object Test { - + object GeneratePrimeFactorsLazy extends (Int => List[Int]) { override def apply(n:Int) = { val s = Stream.range(2, n / 2).filter(n % _ == 0) @@ -13,12 +13,12 @@ object Test { s.headOption.map(x => x :: apply(n / x)).getOrElse(List(n)) } } - + def main(args:Array[String]) { // a prime number //val num = 623456789 val num = 2796203 assert(GeneratePrimeFactorsLazy(num) == List(num)) } - + } diff --git a/test/files/run/t3509.scala b/test/files/run/t3509.scala index 7ec150eb01..76f8d6016e 100644 --- a/test/files/run/t3509.scala +++ b/test/files/run/t3509.scala @@ -1,7 +1,7 @@ object Test { - class Foo(final var i:Int) - + class Foo(final var i:Int) + def main(args : Array[String]) : Unit = { val foo = new Foo(0) foo.i += 1 diff --git a/test/files/run/t3511.scala b/test/files/run/t3511.scala index 9b4d581462..30757b1a66 100644 --- a/test/files/run/t3511.scala +++ b/test/files/run/t3511.scala @@ -6,31 +6,31 @@ import scala.collection.immutable._ // ticket #3511 object Test { - + def main(args: Array[String]) { assert(Stream.from(0).view.force.take(5) == List(0, 1, 2, 3, 4)) - + val s = Stream.from(0) val smap = s.view.map(_ * 2).force.take(5) assert(smap == List(0, 2, 4, 6, 8)) - + val sfilter = s.view.filter(_ % 2 == 0).force.take(5) assert(sfilter == List(0, 2, 4, 6, 8)) - + val sflatmap = s.view.flatMap(n => List(n, n * 2)).force.take(6) assert(sflatmap == List(0, 0, 1, 2, 2, 4)) - + val stakewhile = s.view.takeWhile(_ < 10).force assert(stakewhile == List.range(0, 10)) - + val szip = s.view.zip(s.map(_ / 2)).force.take(5) assert(szip == List((0, 0), (1, 0), (2, 1), (3, 1), (4, 2))) - + val szipall = s.view.zipAll(List(0, 1, 2), 0, 0).force.take(5) assert(szipall == List((0, 0), (1, 1), (2, 2), (3, 0), (4, 0))) - + val spatch = s.view.patch(1, List(5, 5, 5), 5).force.take(5) assert(spatch == List(0, 5, 5, 5, 6)) } - + } diff --git a/test/files/run/t3516.scala b/test/files/run/t3516.scala index 82a97f27de..aa302ce85a 100644 --- a/test/files/run/t3516.scala +++ b/test/files/run/t3516.scala @@ -1,7 +1,7 @@ object Test { def mkIterator = (1 to 5).iterator map (x => { println(x) ; x }) def mkInfinite = Iterator continually { println(1) ; 1 } - + def main(args: Array[String]): Unit = { // Stream is strict in its head so we should see 1 from each of them. val s1 = mkIterator.toStream diff --git a/test/files/run/t3518.scala b/test/files/run/t3518.scala index 36ca9daaa2..033cc19548 100644 --- a/test/files/run/t3518.scala +++ b/test/files/run/t3518.scala @@ -4,7 +4,7 @@ object Test { val r3 = 10.0 to 1.0 by -0.5 val r4 = 1.0 until 1.0 by 1.0 val r5 = 1 to 100 by 2 - + def main(args: Array[String]): Unit = { assert(r3 forall (r1 contains _)) assert(r1 forall (r3 contains _)) diff --git a/test/files/run/t3530.scala b/test/files/run/t3530.scala index 3fedc66dbe..f6f7fb4229 100644 --- a/test/files/run/t3530.scala +++ b/test/files/run/t3530.scala @@ -5,7 +5,7 @@ object Test { case xs @ List(_*) => "list: " + xs.length case _ => "not a list" }) - + def f2[T](x: List[T]) = println(x match { case List(_, _) => "two" case List(_, _, _) => "three" @@ -21,9 +21,9 @@ object Test { f(Nil) f(List(1,2,3,4,5)) f(null) - + println - + f2(List(1, 2)) f2(List('a', 'b', 'c')) f2(List('a', 'b', 'c', 'd')) diff --git a/test/files/run/t3540.scala b/test/files/run/t3540.scala index 4eb3de780b..5ffacb5dff 100644 --- a/test/files/run/t3540.scala +++ b/test/files/run/t3540.scala @@ -2,6 +2,6 @@ object Test { def main(args: Array[String]): Unit = { assert(List.iterate(List(1,2,3), 4)(_.tail).last.isEmpty) assert(Stream.iterate(Stream(1,2,3), 4)(_.tail).last.isEmpty) - assert(Array.iterate(Array(1,2,3), 4)(_.tail).last.isEmpty) + assert(Array.iterate(Array(1,2,3), 4)(_.tail).last.isEmpty) } } diff --git a/test/files/run/t3563.scala b/test/files/run/t3563.scala index 2a80ef412a..8abbb60803 100644 --- a/test/files/run/t3563.scala +++ b/test/files/run/t3563.scala @@ -5,17 +5,17 @@ // ticket #3563 object Test { - + def main(args: Array[String]) { var sum = 0 val setseq = Set(1, 2, 3, 4).toSeq setseq.map( n => { sum += n; n * n }).head assert(sum == 10) - + sum = 0 val mapseq = Map(1 -> 1, 2 -> 2, 3 -> 3, 4 -> 4).toSeq mapseq.map( n => { sum += n._1; (n._1 + n._1, n._2 * n._2) }).head assert(sum == 10) } - + } diff --git a/test/files/run/t3569.scala b/test/files/run/t3569.scala index 4699aeaab3..91d437e0e3 100644 --- a/test/files/run/t3569.scala +++ b/test/files/run/t3569.scala @@ -1,9 +1,9 @@ object Test { final val bippy1 = 1 final lazy val bippy2 = 2 - + lazy val lv = scala.util.Random.nextInt() - + class X(final var x: Int) { final var var1: Int = 0 final private var var2: Int = 0 @@ -12,20 +12,20 @@ object Test { final val val1: Int = 1 final private val val2: Int = 1 final private[this] val val3: Int = 1 - + final lazy val lval1: Int = 2 final private lazy val lval2: Int = 2 final private[this] lazy val lval3: Int = 2 } case class Y(final var x: Int, final private var y: Int, final val z1: Int, final private val z2: Int) { } - + def f = new X(0).x += 1 def main(args: Array[String]) { f val s = new X(0) s.x += 1 println(s.x) - + (classOf[X].getDeclaredFields map ("" + _)).sorted foreach println (classOf[Y].getDeclaredFields map ("" + _)).sorted foreach println } diff --git a/test/files/run/t3575.scala b/test/files/run/t3575.scala index 7ede65b00c..ef83e84f14 100644 --- a/test/files/run/t3575.scala +++ b/test/files/run/t3575.scala @@ -46,7 +46,7 @@ object Test { println(TwoShort(12, "Hello").getClass().getName()); println(TwoShort("Hello", 12).getClass().getName()); println(TwoShort(12, 12).getClass().getName()); - + println(TwoMinimal("Hello", "World").getClass().getName()); println(TwoMinimal(12, "Hello").getClass().getName()); println(TwoMinimal("Hello", 12).getClass().getName()); diff --git a/test/files/run/t3580.scala b/test/files/run/t3580.scala index ac9f81ab9e..50ff6c4551 100644 --- a/test/files/run/t3580.scala +++ b/test/files/run/t3580.scala @@ -4,14 +4,14 @@ object Test { - + class Empty extends Traversable[Nothing] { def foreach[U](f: Nothing => U) {} } - + def main(args: Array[String]) { val t = new Empty t.toStream } - + } diff --git a/test/files/run/t3603.scala b/test/files/run/t3603.scala index a0821a2a45..a89cb7080a 100644 --- a/test/files/run/t3603.scala +++ b/test/files/run/t3603.scala @@ -2,17 +2,17 @@ object Test { - + def main(args: Array[String]) { import collection.immutable._ - + val intmap = IntMap(1 -> 1, 2 -> 2) val intres = intmap.map { case (a, b) => (a, b.toString) } assert(intres.isInstanceOf[IntMap[_]]) - + val longmap = LongMap(1L -> 1, 2L -> 2) val longres = longmap.map { case (a, b) => (a, b.toString) } assert(longres.isInstanceOf[LongMap[_]]) } - + } diff --git a/test/files/run/t3613.scala b/test/files/run/t3613.scala index 171a6a21aa..1293f62c0f 100644 --- a/test/files/run/t3613.scala +++ b/test/files/run/t3613.scala @@ -1,7 +1,7 @@ class Boopy { private val s = new Schnuck def observer : PartialFunction[ Any, Unit ] = s.observer - + private class Schnuck extends javax.swing.AbstractListModel { model => val observer : PartialFunction[ Any, Unit ] = { @@ -10,13 +10,13 @@ class Boopy { def getSize = 0 def getElementAt( idx: Int ) = ??? } - + } object Test { def main(args: Array[String]): Unit = { val x = new Boopy val o = x.observer - o( "Boopy" ) // --> throws runtime error + o( "Boopy" ) // --> throws runtime error } } diff --git a/test/files/run/t3619.scala b/test/files/run/t3619.scala index 46324b4d69..3f4c56ea53 100644 --- a/test/files/run/t3619.scala +++ b/test/files/run/t3619.scala @@ -17,7 +17,7 @@ object Test extends App { } } */ - + new Meh } diff --git a/test/files/run/t363.scala b/test/files/run/t363.scala index 5f3f30a098..c747be2ec9 100644 --- a/test/files/run/t363.scala +++ b/test/files/run/t363.scala @@ -3,7 +3,7 @@ object Test { println("I love the smell of (Array[String])Unit in the morning.") } } - + class Test { def kurtz() = "We must kill them. We must incinerate them." } diff --git a/test/files/run/t3647.scala b/test/files/run/t3647.scala index 434a13f414..a970e887f6 100644 --- a/test/files/run/t3647.scala +++ b/test/files/run/t3647.scala @@ -13,10 +13,10 @@ object Test { "line4" ).iterator) assert(ps.filter(_ == '\n').size == 3) - + val ps1 = PagedSeq.fromLines(List("Ok").iterator) assert(ps1.filter(_ == '\n').size == 0) - + val eps = PagedSeq.fromLines(List().iterator) assert(eps.filter(_ == '\n').size == 0) } diff --git a/test/files/run/t3702.scala b/test/files/run/t3702.scala index 021abcb625..0cdafd90b6 100644 --- a/test/files/run/t3702.scala +++ b/test/files/run/t3702.scala @@ -3,7 +3,7 @@ object Test { case 5 :: _ => () case List(from) => from } - + def main(args: Array[String]): Unit = { println(foo(5 :: Nil, List(1,2,3))) println(foo(6 :: Nil, List(1,2,3))) diff --git a/test/files/run/t3714.scala b/test/files/run/t3714.scala index c344b40f1f..2d600f97f1 100644 --- a/test/files/run/t3714.scala +++ b/test/files/run/t3714.scala @@ -21,7 +21,7 @@ object Test { case BreakImpl(x) => x case _ => -1 } - + def main(args: Array[String]) { val break = BreakImpl(22) // assert(f1(break) == 22) diff --git a/test/files/run/t3719.scala b/test/files/run/t3719.scala index 4649f11bb1..01dc205545 100644 --- a/test/files/run/t3719.scala +++ b/test/files/run/t3719.scala @@ -1,7 +1,7 @@ object Days extends Enumeration { type Day = DayValue val Mon, Tue, Wed, Thu, Fri, Sat, Sun = new DayValue // DayValue - + protected class DayValue extends Val { def isWeekday: Boolean = this match { @@ -21,7 +21,7 @@ object Test extends App { val d: Day = Mon d.toString } - + def nameOfTue(): String = { import Days._ val d: Day = Tue diff --git a/test/files/run/t3822.scala b/test/files/run/t3822.scala index eaf0a145d3..c35804035e 100644 --- a/test/files/run/t3822.scala +++ b/test/files/run/t3822.scala @@ -1,17 +1,17 @@ import scala.collection.{ mutable, immutable, generic } import immutable.ListSet -object Test { +object Test { def main(args: Array[String]): Unit = { val xs = ListSet(-100000 to 100001: _*) - + assert(xs.size == 200002) assert(xs.sum == 100001) - + val ys = ListSet[Int]() val ys1 = (1 to 12).grouped(3).foldLeft(ys)(_ ++ _) val ys2 = (1 to 12).foldLeft(ys)(_ + _) - + assert(ys1 == ys2) } } diff --git a/test/files/run/t3829.scala b/test/files/run/t3829.scala index e3d8c56882..780a6a95b7 100644 --- a/test/files/run/t3829.scala +++ b/test/files/run/t3829.scala @@ -1,11 +1,11 @@ // ticket #3829 object Test { import collection.{ mutable, immutable } - + def main(args: Array[String]) { val map = immutable.Map(1 -> 2, 3 -> 4) assert(map.get(0) == None) - + // Since r24255 defaultMap.get(x) returns None rather than // using the default, so these mostly use apply. val defmap = map.withDefaultValue(-1) @@ -19,10 +19,10 @@ object Test { assert((defmap - 1)(0) == -1) assert((defmap - 1)(1) == -1) assert((defmap - 1)(3) == 4) - + val mutmap = mutable.Map(1 -> 2, 2 -> 3) assert(mutmap.get(0) == None) - + val defmutmap = mutmap.withDefaultValue(-1) assert(defmutmap(0) == -1) assert(defmutmap(3) == -1) @@ -36,5 +36,5 @@ object Test { assert(defmutmap(1) == 2) assert(mutmap(1) == 2) } - + } diff --git a/test/files/run/t3855.scala b/test/files/run/t3855.scala index d8029e16f0..d10aab5383 100644 --- a/test/files/run/t3855.scala +++ b/test/files/run/t3855.scala @@ -1,7 +1,7 @@ object Test { def byval[A](a: => A) = a def closure[A](f: () => A) = f() - + def f1(s: String) = { var n = try { s.toInt } catch { case _: Throwable => 1 } byval(n) diff --git a/test/files/run/t3877.scala b/test/files/run/t3877.scala index ce1e9283a7..5710e982a0 100644 --- a/test/files/run/t3877.scala +++ b/test/files/run/t3877.scala @@ -11,7 +11,7 @@ object Test { println("test1: " + d) } } - + def test2 { var d = 2 var i = 0 @@ -25,7 +25,7 @@ object Test { return } } - + def test3 { var d = 2 var i = 0 @@ -34,9 +34,9 @@ object Test { d = b i += 1 println("test3: " + d) - } while (d < LIMIT && i < LIMIT) + } while (d < LIMIT && i < LIMIT) } - + def test4 { var d = 2 var i = 0 @@ -47,9 +47,9 @@ object Test { println("test4: " + d) if (d >= LIMIT || i >= LIMIT) return - } while (true) + } while (true) } - + def test5 { var d = 2 var i = 0 @@ -58,7 +58,7 @@ object Test { d = b i += 1 println("test5.1: " + d) - + var e = 2 var j = 0 while (e < LIMIT && j < LIMIT) { @@ -69,7 +69,7 @@ object Test { } } } - + def main(args: Array[String]) { test1 diff --git a/test/files/run/t3887.scala b/test/files/run/t3887.scala index 81fa7a917e..16ce983efc 100644 --- a/test/files/run/t3887.scala +++ b/test/files/run/t3887.scala @@ -13,4 +13,4 @@ object Test { val option1: (Int, String) = (1, "abc") -} +} diff --git a/test/files/run/t3888.scala b/test/files/run/t3888.scala index 1914072599..19771041fc 100644 --- a/test/files/run/t3888.scala +++ b/test/files/run/t3888.scala @@ -6,13 +6,13 @@ object Test { val T1 = new P private[this] val T2 = T1 - def m1 = + def m1 = (1, 2) match { case T1 => true case _ => false } - def m2 = + def m2 = (1, 2) match { case T2 => true case _ => false diff --git a/test/files/run/t3897/J_2.java b/test/files/run/t3897/J_2.java index 178412dc92..a4c9a98fb1 100644 --- a/test/files/run/t3897/J_2.java +++ b/test/files/run/t3897/J_2.java @@ -7,7 +7,7 @@ public class J_2 { String name = fields[i].getName(); if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { } else System.out.println("(" + name + "," + fields[i].getGenericType() + ")"); - } + } } public void f2(Class<?> clazz) { Method[] methods = clazz.getDeclaredMethods(); @@ -15,7 +15,7 @@ public class J_2 { String name = methods[i].getName(); if (name.length() >= 7 && name.substring(0, 7).equals("bitmap$")) { } else System.out.println("(" + name + "," + methods[i].getGenericReturnType() + ")"); - } + } } public void javaRun() { diff --git a/test/files/run/t3897/a_2.scala b/test/files/run/t3897/a_2.scala index 4d9e59ef05..7a161fcbe4 100644 --- a/test/files/run/t3897/a_2.scala +++ b/test/files/run/t3897/a_2.scala @@ -1,12 +1,12 @@ object Test { def f1(clazz: Class[_]) = ( - clazz.getDeclaredFields.toList + clazz.getDeclaredFields.toList . filterNot (_.getName contains "bitmap$") . map (f => (f.getName, f.getGenericType)) . foreach (println) ) def f2(clazz: Class[_]) = ( - clazz.getDeclaredMethods.toList + clazz.getDeclaredMethods.toList . filterNot (_.getName contains "bitmap$") . map (f => (f.getName, f.getGenericReturnType)) . foreach (println) @@ -17,7 +17,7 @@ object Test { f2(classOf[One]) f1(classOf[Two]) f2(classOf[Two]) - + new J_2().javaRun } } diff --git a/test/files/run/t3932.scala b/test/files/run/t3932.scala index 51fc16d6ea..f577ef8315 100644 --- a/test/files/run/t3932.scala +++ b/test/files/run/t3932.scala @@ -23,10 +23,10 @@ object Test { def main(args: Array[String]): Unit = { println(O1.g1) println(O1.g2) - + println(O2.g1) println(O2.g2) - + val o3 = new O3() println(o3.g1) println(o3.g2) diff --git a/test/files/run/t3964.scala b/test/files/run/t3964.scala index 68ff9a44c4..9b46cdb298 100644 --- a/test/files/run/t3964.scala +++ b/test/files/run/t3964.scala @@ -2,15 +2,15 @@ import scala.language.implicitConversions object Test { - class Base + class Base object Bob extends Base class Foo { def bippy = 42 } class Oof { def bippy = -21 } - + // I am more specific than you implicit def f1(x: Bob.type): Foo = new Foo implicit def f2(x: Base): Oof = new Oof - + def main(args: Array[String]): Unit = { // this would of course print an unambiguous 42 println(Bob.bippy) diff --git a/test/files/run/t3970.scala b/test/files/run/t3970.scala index f8c763bc85..35b5ce6e1b 100644 --- a/test/files/run/t3970.scala +++ b/test/files/run/t3970.scala @@ -9,11 +9,11 @@ object Test { def main(args: Array[String]) { val dl = DoubleLinkedList[Int]() dl.remove() - + val dl2 = DoubleLinkedList[Int](1, 2, 3) dl2.next.remove() assert(dl2 == DoubleLinkedList(1, 3)) - + val dl3 = DoubleLinkedList[Int](1, 2, 3) assert(dl3.drop(1) == DoubleLinkedList(2, 3)) assert(dl3.drop(1).prev == null) diff --git a/test/files/run/t3980.scala b/test/files/run/t3980.scala index 4e693eba9b..c140176ce4 100644 --- a/test/files/run/t3980.scala +++ b/test/files/run/t3980.scala @@ -2,7 +2,7 @@ object A { def run1 { lazy val x: Unit = {(); println("once")} x - x + x } def run2 { lazy val y: Int = 2 diff --git a/test/files/run/t3984.scala b/test/files/run/t3984.scala index 9a2e00a2a8..0747b0ee25 100644 --- a/test/files/run/t3984.scala +++ b/test/files/run/t3984.scala @@ -36,7 +36,7 @@ object MapBug { im = im + ((ih,ih)) mm = mm + ((ih,ih)) } - assert(im == mm) + assert(im == mm) val x = IH(6,4) im = im - x mm = mm - x diff --git a/test/files/run/t4013.scala b/test/files/run/t4013.scala index da7fbc5b3f..7060559317 100644 --- a/test/files/run/t4013.scala +++ b/test/files/run/t4013.scala @@ -5,12 +5,12 @@ trait Base[B] { } -class Suba[@specialized B](override val data: Array[B]) extends Base[B] { +class Suba[@specialized B](override val data: Array[B]) extends Base[B] { assert(data != null) } -class Subopt[@specialized B](override val data: Option[B]) extends Base[B] { +class Subopt[@specialized B](override val data: Option[B]) extends Base[B] { assert(data != null) } diff --git a/test/files/run/t4013b.scala b/test/files/run/t4013b.scala index f17eaea3d3..1262e261f5 100644 --- a/test/files/run/t4013b.scala +++ b/test/files/run/t4013b.scala @@ -8,7 +8,7 @@ trait Base[B] { class M[@specialized(Int) A] -class Sub3[@specialized(Int) B](override val data: M[B]) extends Base[B] { +class Sub3[@specialized(Int) B](override val data: M[B]) extends Base[B] { assert(data != null) } diff --git a/test/files/run/t4023.scala b/test/files/run/t4023.scala index 38190cfa5c..518b58382a 100644 --- a/test/files/run/t4023.scala +++ b/test/files/run/t4023.scala @@ -5,8 +5,8 @@ object Test { object B3 private object B4 object B5 extends B1 - private object B6 extends B2 - + private object B6 extends B2 + val classes1 = this.getClass.getDeclaredClasses val classes2 = C.getClass .getDeclaredClasses val classes3 = getClass .getDeclaredClasses @@ -19,7 +19,7 @@ object Test { val valuesTry2 = C.classes2.sortBy(_.getName) val valuesTry3 = C.classes3.sortBy(_.getName) } - + def main(args: Array[String]) { println("Try 1: (" + TestHelper.valuesTry1.length + " classes)") TestHelper.valuesTry1.foreach(println) diff --git a/test/files/run/t4024.scala b/test/files/run/t4024.scala index 7c62a3fc6e..f48410915d 100644 --- a/test/files/run/t4024.scala +++ b/test/files/run/t4024.scala @@ -1,9 +1,9 @@ object Test extends App { - val x = "abc" + val x = "abc" val m = x.getClass.getMethod("toString") - + assert(m.invoke(x, (Nil: List[AnyRef]): _*) == "abc") Test2.main(Array()) diff --git a/test/files/run/t4025.check b/test/files/run/t4025.check index 6715003cb6..2d4f644c5a 100644 --- a/test/files/run/t4025.check +++ b/test/files/run/t4025.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class Color(val red: Int) defined class Color diff --git a/test/files/run/t4027.scala b/test/files/run/t4027.scala index d70ca0cc3a..585c5c8b37 100644 --- a/test/files/run/t4027.scala +++ b/test/files/run/t4027.scala @@ -7,7 +7,7 @@ import collection._ * Mapping, filtering, etc. on these views should return sorted maps again. */ object Test extends App { - + val sortedmap = SortedMap(1 -> false, 2 -> true, 3 -> false, 4 -> true) println(sortedmap.filterKeys(_ % 2 == 0): SortedMap[Int, Boolean]) println(sortedmap.mapValues(_ + "!"): SortedMap[Int, String]) @@ -15,7 +15,7 @@ object Test extends App { println(sortedmap.mapValues(_ + "!").map(t => (t._1, t._2.toString.length)): SortedMap[Int, Int]) println(sortedmap.filterKeys(_ % 2 == 0).filter(t => t._1 < 2): SortedMap[Int, Boolean]) println(sortedmap.mapValues(_ + "!").filter(t => t._1 < 2): SortedMap[Int, String]) - + val immsortedmap = immutable.SortedMap(1 -> false, 2 -> true, 3 -> false, 4 -> true) println(immsortedmap.filterKeys(_ % 2 == 0): immutable.SortedMap[Int, Boolean]) println(immsortedmap.mapValues(_ + "!"): immutable.SortedMap[Int, String]) @@ -23,5 +23,5 @@ object Test extends App { println(immsortedmap.mapValues(_ + "!").map(t => (t._1, t._2.toString.length)): immutable.SortedMap[Int, Int]) println(immsortedmap.filterKeys(_ % 2 == 0).filter(t => t._1 < 2): immutable.SortedMap[Int, Boolean]) println(immsortedmap.mapValues(_ + "!").filter(t => t._1 < 2): immutable.SortedMap[Int, String]) - + } diff --git a/test/files/run/t4054.scala b/test/files/run/t4054.scala index 8f1f685854..83a58ef97c 100644 --- a/test/files/run/t4054.scala +++ b/test/files/run/t4054.scala @@ -9,7 +9,7 @@ object Test { def main(args: Array[String]) { val it = Iterator.from(1).map(n => n * n).scanLeft(0)(_+_) - + assert(it.next == 0) assert(it.next == 1) assert(it.next == 5) diff --git a/test/files/run/t4062.scala b/test/files/run/t4062.scala index 6a5aea5b47..f5478e7593 100644 --- a/test/files/run/t4062.scala +++ b/test/files/run/t4062.scala @@ -1,7 +1,7 @@ class A(val f : String) class B(f: String) extends A(f) { - def foo(x: String) = x match { + def foo(x: String) = x match { case `f` => true case _ => false } diff --git a/test/files/run/t4072.scala b/test/files/run/t4072.scala index bff2e0c7d2..c035fcc22a 100644 --- a/test/files/run/t4072.scala +++ b/test/files/run/t4072.scala @@ -4,11 +4,11 @@ import scala.language.{ reflectiveCalls } object Test { class DryRun { - val compiler = new Global(new Settings()) { + val compiler = new Global(new Settings()) { lazy val test1 = new AnyRef } } - + def main(args: Array[String]) { new DryRun().compiler.test1 } diff --git a/test/files/run/t408.scala b/test/files/run/t408.scala index 4d3dcbcb84..9e51e881ed 100644 --- a/test/files/run/t408.scala +++ b/test/files/run/t408.scala @@ -2,7 +2,7 @@ object Test { val a = scala.collection.immutable.Set.empty ++ (0 to 100000) val b = scala.collection.immutable.Set.empty ++ (0 to 100000) - + def main(args: Array[String]): Unit = { a -- b a -- b diff --git a/test/files/run/t4119/J.java b/test/files/run/t4119/J.java index 42508993ea..ee65d33e22 100644 --- a/test/files/run/t4119/J.java +++ b/test/files/run/t4119/J.java @@ -1,6 +1,6 @@ package foo.bar; -public abstract class J { +public abstract class J { protected void foo(J j) { return; } diff --git a/test/files/run/t4119/S.scala b/test/files/run/t4119/S.scala index e5e3db5da3..d6ae5f1b87 100644 --- a/test/files/run/t4119/S.scala +++ b/test/files/run/t4119/S.scala @@ -1,6 +1,6 @@ class S extends foo.bar.J { sss => - + val fn = () => { foo(S.this) } diff --git a/test/files/run/t4122.scala b/test/files/run/t4122.scala index 7ead2b7742..5ff570c009 100644 --- a/test/files/run/t4122.scala +++ b/test/files/run/t4122.scala @@ -4,7 +4,7 @@ object Test { val sw3 = Seq('a', 'b') val sw4 = "ab".toList val all = List(sw, sw2, sw3, sw4) - + def main(args: Array[String]): Unit = { for (s1 <- all ; s2 <- all) { assert(s1 == s2, s1 + " != " + s2) diff --git a/test/files/run/t4148.scala b/test/files/run/t4148.scala index 6de0c8fe7a..d543e093ab 100644 --- a/test/files/run/t4148.scala +++ b/test/files/run/t4148.scala @@ -2,7 +2,7 @@ object Test { val x1 = try { "aaa".asInstanceOf[Int] } catch { case _: Throwable => "cce1" } val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _: Throwable => "cce2" } val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _: Throwable => "cce3" } - + def main(args: Array[String]): Unit = { List(x1, x2, x3) foreach println } diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check index b48c9ca056..d94638d27e 100644 --- a/test/files/run/t4172.check +++ b/test/files/run/t4172.check @@ -1,12 +1,8 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) } +scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) } warning: there were 1 feature warning(s); re-run with -feature for details c: (C, C{def f: Int}) forSome { type C <: AnyRef } = (C,C) scala> - -scala> diff --git a/test/files/run/t4238/J_1.java b/test/files/run/t4238/J_1.java index 21a4b182ad..47a9c21000 100644 --- a/test/files/run/t4238/J_1.java +++ b/test/files/run/t4238/J_1.java @@ -3,14 +3,14 @@ import scala.*; class J_1 { scala.collection.mutable.HashMap<String, String> map = new scala.collection.mutable.HashMap<String, String>(); - + Function1<Tuple2<String, String>, Integer> f = new scala.runtime.AbstractFunction1<Tuple2<String, String>, Integer>() { public Integer apply(Tuple2<String, String> s) { return s._1().length(); } }; - + scala.collection.Seq<Integer> counts = map.groupBy(f).keys().toList(); } diff --git a/test/files/run/t4285.check b/test/files/run/t4285.check index 84f8929e43..314c8e5a35 100644 --- a/test/files/run/t4285.check +++ b/test/files/run/t4285.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> val x = Array(1,2,3,4,5,6,7) x: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7) @@ -13,5 +11,3 @@ scala> println(y.sum) 56 scala> - -scala> diff --git a/test/files/run/t4288.scala b/test/files/run/t4288.scala index eafd2808f1..4e7b366f60 100644 --- a/test/files/run/t4288.scala +++ b/test/files/run/t4288.scala @@ -6,7 +6,7 @@ object Test { def f5 = (1 to 9).toArray.slice(-5, -1) def f6 = (1 to 9).toStream.slice(-5, -1) def f7 = (1 to 9).slice(-5, -1) - + def main(args: Array[String]): Unit = { List[Traversable[Int]](f1, f2, f3, f4, f5, f6, f7) foreach (x => assert(x.isEmpty, x)) } diff --git a/test/files/run/t4317/S_3.scala b/test/files/run/t4317/S_3.scala index dd04ea31ef..ce8e2330e3 100644 --- a/test/files/run/t4317/S_3.scala +++ b/test/files/run/t4317/S_3.scala @@ -1,4 +1,4 @@ -object Test { +object Test { def main(args: Array[String]): Unit = { val j = new J_2() println(j.bar1()) diff --git a/test/files/run/t4396.scala b/test/files/run/t4396.scala index ca143165b7..d67eaa378e 100644 --- a/test/files/run/t4396.scala +++ b/test/files/run/t4396.scala @@ -1,4 +1,4 @@ -// #43896 +// #43896 trait M extends DelayedInit { def delayedInit(body : => Unit) { println("hallo") diff --git a/test/files/run/t4426.scala b/test/files/run/t4426.scala index 95759444d6..1cbd42da25 100644 --- a/test/files/run/t4426.scala +++ b/test/files/run/t4426.scala @@ -5,7 +5,7 @@ object Test { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") - object cc extends Global(settings) { + object cc extends Global(settings) { object dummy override def computePluginPhases() = { @@ -16,9 +16,9 @@ object Test { new cc.Run () } - + def main(args: Array[String]): Unit = { - + } } diff --git a/test/files/run/t4461.scala b/test/files/run/t4461.scala index adc9201313..1801a653e7 100644 --- a/test/files/run/t4461.scala +++ b/test/files/run/t4461.scala @@ -9,7 +9,7 @@ object Test { buf.subscribe(new Subscriber[Message[Int], ObservableBuffer[Int]] { def notify(pub: ObservableBuffer[Int], event: Message[Int]) = println(event) }) - + buf += 1 // works buf ++= Array(2) // works buf ++= ArrayBuffer(3, 4) // works diff --git a/test/files/run/t4535.scala b/test/files/run/t4535.scala index eba79431c9..91c13a28cd 100644 --- a/test/files/run/t4535.scala +++ b/test/files/run/t4535.scala @@ -5,26 +5,26 @@ import collection._ // #4535 object Test { - + def main(args: Array[String]) { val as = new mutable.ArrayStack[Int] as push 1 as push 2 as push 3 println(as.reverse) - + as push 4 as push 5 as push 6 println(as.reverse) - + println(as map { x => x }) - + for (i <- 0 until 100) { as push i assert(as == as.map(x => x)) assert(as == as.reverse.reverse) } } - + } diff --git a/test/files/run/t4536.scala b/test/files/run/t4536.scala index acd91deb7f..6661eae6a7 100644 --- a/test/files/run/t4536.scala +++ b/test/files/run/t4536.scala @@ -37,10 +37,10 @@ object dynamicMixin extends dynamicAbstractClass with dynamicTrait { object Test { - + def main(args: Array[String]) { val cls = new dynamicClass dynamicMixin } - + } diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check index cd7a2905e2..5a8108dcbc 100644 --- a/test/files/run/t4542.check +++ b/test/files/run/t4542.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> @deprecated("foooo", "ReplTest version 1.0-FINAL") class Foo() { override def toString = "Bippy" } @@ -18,5 +16,3 @@ scala> val f = new Foo f: Foo = Bippy scala> - -scala> diff --git a/test/files/run/t4570.scala b/test/files/run/t4570.scala index 5408caf6db..5e1a20c52d 100644 --- a/test/files/run/t4570.scala +++ b/test/files/run/t4570.scala @@ -1,8 +1,8 @@ object Test extends Enumeration { val foo = Value def bar = withName("foo") - + def main(args: Array[String]): Unit = { - values foreach println + values foreach println } } diff --git a/test/files/run/t4608.scala b/test/files/run/t4608.scala index 2d43bebd10..9ffcb0f3f1 100644 --- a/test/files/run/t4608.scala +++ b/test/files/run/t4608.scala @@ -1,8 +1,8 @@ // #4608 object Test { - + def main(args: Array[String]) { ((1 to 100) sliding 10).toList.par.map{_.map{i => i * i}}.flatten } - + } diff --git a/test/files/run/t4617.scala b/test/files/run/t4617.scala index 3a877c1915..2fea5e29ec 100644 --- a/test/files/run/t4617.scala +++ b/test/files/run/t4617.scala @@ -3,7 +3,7 @@ object Test { def f2 = { lazy val d = 4D lazy val f = 4f - + def bar = "Str " + (d + f) bar } diff --git a/test/files/run/t4656.scala b/test/files/run/t4656.scala index ab3e3cf53d..4f3d189c8f 100644 --- a/test/files/run/t4656.scala +++ b/test/files/run/t4656.scala @@ -6,7 +6,7 @@ object Test { buf prependToList List(4, 5, 6) l } - + def main(args: Array[String]): Unit = { println(f) } diff --git a/test/files/run/t4671.check b/test/files/run/t4671.check index d4f8af480a..0c36083759 100644 --- a/test/files/run/t4671.check +++ b/test/files/run/t4671.check @@ -10,7 +10,7 @@ s: scala.io.BufferedSource = non-empty iterator scala> println(s.getLines.mkString("\n")) import scala.tools.partest.ReplTest -object Test extends ReplTest { +object Test extends ReplTest { // My god...it's full of quines def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } @@ -30,7 +30,7 @@ s: scala.io.BufferedSource = non-empty iterator scala> println(s.mkString("")) import scala.tools.partest.ReplTest -object Test extends ReplTest { +object Test extends ReplTest { // My god...it's full of quines def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } diff --git a/test/files/run/t4671.scala b/test/files/run/t4671.scala index aba0138aad..6170104c33 100644 --- a/test/files/run/t4671.scala +++ b/test/files/run/t4671.scala @@ -1,6 +1,6 @@ import scala.tools.partest.ReplTest -object Test extends ReplTest { +object Test extends ReplTest { // My god...it's full of quines def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } diff --git a/test/files/run/t4680.scala b/test/files/run/t4680.scala index 88611df7ae..d5c8d0e7af 100644 --- a/test/files/run/t4680.scala +++ b/test/files/run/t4680.scala @@ -43,13 +43,13 @@ class E() extends D() { object Test { def p(msg: String) = println("\n\n// " + msg) - + def main(args: Array[String]) { p("new C { }") new C { } p("new C { 5 }") new C { 5 } - + p("new D()") new D() p("new D() { }") diff --git a/test/files/run/t4697.scala b/test/files/run/t4697.scala index 728d095ff8..95592172e0 100644 --- a/test/files/run/t4697.scala +++ b/test/files/run/t4697.scala @@ -1,7 +1,7 @@ object Test { var st = Stream(0) for (i <- 1 to 10000) st = i +: st - + def main(args: Array[String]): Unit = { println(st.take(10000).sum) } diff --git a/test/files/run/t4752.scala b/test/files/run/t4752.scala index 2a9fc5361f..3d5c166a7a 100644 --- a/test/files/run/t4752.scala +++ b/test/files/run/t4752.scala @@ -2,8 +2,8 @@ object Test { object Bippy { case object Dingus } - - def main(args: Array[String]): Unit = { + + def main(args: Array[String]): Unit = { assert(None.## == "None".##, None) assert(Test.Bippy.Dingus.## == "Dingus".##, Test.Bippy.Dingus) } diff --git a/test/files/run/t4753.scala b/test/files/run/t4753.scala index 98f3e92678..cfb252cbe5 100644 --- a/test/files/run/t4753.scala +++ b/test/files/run/t4753.scala @@ -1,4 +1,4 @@ -trait A { +trait A { val actualType: Class[_] } trait B extends A { diff --git a/test/files/run/t4761.scala b/test/files/run/t4761.scala index a9c245d7d5..e4bd87cb15 100644 --- a/test/files/run/t4761.scala +++ b/test/files/run/t4761.scala @@ -3,7 +3,7 @@ object Test { val gs = for (x <- (1 to 5)) yield { if (x % 2 == 0) List(1).seq else List(1).par } println(gs.flatten) println(gs.transpose) - + val s = Stream(Vector(1).par, Vector(2).par) println(s.flatten.toList) println(s.transpose.map(_.toList).toList) diff --git a/test/files/run/t4809.scala b/test/files/run/t4809.scala index b30d80562f..4b721d111b 100644 --- a/test/files/run/t4809.scala +++ b/test/files/run/t4809.scala @@ -5,7 +5,7 @@ import scala.util.control.Breaks._ object Test { - + def main(args: Array[String]) { val x = tryBreakable { break @@ -14,14 +14,14 @@ object Test { 3 } assert(x == 3, x) - + val y = tryBreakable { 2 } catchBreak { 3 } assert(y == 2, y) - + val z = tryBreakable { break 1.0 @@ -30,5 +30,5 @@ object Test { } assert(z == 2.0, z) } - + } diff --git a/test/files/run/t4835.scala b/test/files/run/t4835.scala index c964e42e7c..26275c0ab4 100644 --- a/test/files/run/t4835.scala +++ b/test/files/run/t4835.scala @@ -1,6 +1,6 @@ /* * Test case for SI-4835. This tests confirm that the fix - * doesn't break laziness. To test memory consumption, + * doesn't break laziness. To test memory consumption, * I need to confirm that OutOfMemoryError doesn't occur. * I could create such tests. However, such tests consume * too much time and memory. diff --git a/test/files/run/t4871.scala b/test/files/run/t4871.scala index 70d8b7145c..e25d5c1387 100644 --- a/test/files/run/t4871.scala +++ b/test/files/run/t4871.scala @@ -5,7 +5,7 @@ object Test { def main(args: Array[String]): Unit = { val z: Class[C] = classOf val z2: Class[D] = classOf[D] - + println(z) println(z2) } diff --git a/test/files/run/t4894.scala b/test/files/run/t4894.scala index aa3b4340af..2b70da141d 100644 --- a/test/files/run/t4894.scala +++ b/test/files/run/t4894.scala @@ -4,24 +4,24 @@ object Test { - + def main(args: Array[String]) { import collection._ val hs = mutable.HashSet[Int]() hs ++= 1 to 10 hs --= 1 to 10 - + val phs = parallel.mutable.ParHashSet[Int]() phs ++= 1 to 10 for (i <- 1 to 10) assert(phs(i)) phs --= 1 to 10 assert(phs.isEmpty) - + val phm = parallel.mutable.ParHashMap[Int, Int]() phm ++= ((1 to 10) zip (1 to 10)) for (i <- 1 to 10) assert(phm(i) == i) phm --= 1 to 10 assert(phm.isEmpty) } - + } diff --git a/test/files/run/t4895.scala b/test/files/run/t4895.scala index a0e8c19f00..3842f8a389 100644 --- a/test/files/run/t4895.scala +++ b/test/files/run/t4895.scala @@ -1,16 +1,16 @@ object Test { - + def checkPar(sz: Int) { import collection._ val hs = mutable.HashSet[Int]() ++ (1 to sz) assert(hs.par.map(_ + 1).seq.toSeq.sorted == (2 to (sz + 1))) } - + def main(args: Array[String]) { for (i <- 0 until 100) checkPar(i) for (i <- 100 until 1000 by 50) checkPar(i) for (i <- 1000 until 10000 by 500) checkPar(i) for (i <- 10000 until 100000 by 5000) checkPar(i) } - + } diff --git a/test/files/run/t4954.scala b/test/files/run/t4954.scala index b4916e651d..f0bb1cc02d 100644 --- a/test/files/run/t4954.scala +++ b/test/files/run/t4954.scala @@ -4,7 +4,7 @@ import collection._ object Test { - + def main(args: Array[String]) { val m = scala.collection.mutable.LinkedHashMap("one" -> 1, "two" -> 2, "three" -> 3, "four" -> 4, "five" -> 5) val expected = List("one", "two", "three", "four", "five") @@ -15,7 +15,7 @@ object Test { assert(m.keys.drop(3).iterator.toList == expected.drop(3)) assert(m.keys.drop(4).iterator.toList == expected.drop(4)) assert(m.keys.drop(5).iterator.toList == expected.drop(5)) - + val expvals = List(1, 2, 3, 4, 5) assert(m.values.iterator.toList == expvals) assert(m.values.drop(0).iterator.toList == expvals) @@ -24,7 +24,7 @@ object Test { assert(m.values.drop(3).iterator.toList == expvals.drop(3)) assert(m.values.drop(4).iterator.toList == expvals.drop(4)) assert(m.values.drop(5).iterator.toList == expvals.drop(5)) - + val pred = (x: String) => x.length < 6 val filtered = m.filterKeys(pred) assert(filtered.drop(0).keys.toList == expected.filter(pred)) @@ -32,7 +32,7 @@ object Test { assert(filtered.drop(2).keys.toList == expected.filter(pred).drop(2)) assert(filtered.drop(3).keys.toList == expected.filter(pred).drop(3)) assert(filtered.drop(4).keys.toList == expected.filter(pred).drop(4)) - + val mapped = m.mapValues(-_) assert(mapped.drop(0).keys.toList == expected) assert(mapped.drop(1).keys.toList == expected.drop(1)) @@ -41,5 +41,5 @@ object Test { assert(mapped.drop(4).keys.toList == expected.drop(4)) assert(mapped.drop(5).keys.toList == expected.drop(5)) } - + } diff --git a/test/files/run/t4996.scala b/test/files/run/t4996.scala index 8e7636aaac..8a38e7fe7f 100644 --- a/test/files/run/t4996.scala +++ b/test/files/run/t4996.scala @@ -20,7 +20,7 @@ trait M extends B { abstract override def foo(t: Int) { super.foo(t) println("M.foo") - } + } } diff --git a/test/files/run/t5018.scala b/test/files/run/t5018.scala index bb67a252e5..70bd6c52ea 100644 --- a/test/files/run/t5018.scala +++ b/test/files/run/t5018.scala @@ -7,7 +7,7 @@ import collection._ object Test { - + def serializeDeserialize[T <: AnyRef](obj: T) = { val buffer = new ByteArrayOutputStream val out = new ObjectOutputStream(buffer) @@ -15,23 +15,23 @@ object Test { val in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray)) in.readObject.asInstanceOf[T] } - + def main(args: Array[String]) { val values = mutable.Map(1 -> 1).values assert(serializeDeserialize(values).toList == values.toList) - + val keyset = mutable.Map(1 -> 1).keySet assert(serializeDeserialize(keyset) == keyset) - + val imkeyset = immutable.Map(1 -> 1).keySet assert(serializeDeserialize(imkeyset) == imkeyset) - + val defaultmap = immutable.Map(1 -> 1).withDefaultValue(1) assert(serializeDeserialize(defaultmap) == defaultmap) - + val minusmap = mutable.Map(1 -> 1).withDefault(x => -x) assert(serializeDeserialize(minusmap) == minusmap) } - + } diff --git a/test/files/run/t5053.scala b/test/files/run/t5053.scala index 233edf6780..50057ce66c 100644 --- a/test/files/run/t5053.scala +++ b/test/files/run/t5053.scala @@ -6,18 +6,18 @@ object Test extends App { val (left, right) = Seq((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip println(left.isInstanceOf[scala.collection.SeqViewLike[_,_,_]]) val (l, m, r) = Seq((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3 - println(l.isInstanceOf[scala.collection.SeqViewLike[_,_,_]]) + println(l.isInstanceOf[scala.collection.SeqViewLike[_,_,_]]) } { val (left, right) = Iterable((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip println(left.isInstanceOf[scala.collection.IterableViewLike[_,_,_]]) val (l, m, r) = Iterable((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3 - println(l.isInstanceOf[scala.collection.IterableViewLike[_,_,_]]) + println(l.isInstanceOf[scala.collection.IterableViewLike[_,_,_]]) } { val (left, right) = Traversable((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip println(left.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]]) val (l, m, r) = Traversable((1, 1.0, "a"), (1, 1.0, "a"), (1, 1.0, "a"), (3, 3.0, "c")).view.unzip3 - println(l.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]]) + println(l.isInstanceOf[scala.collection.TraversableViewLike[_,_,_]]) } } diff --git a/test/files/run/t5064.check b/test/files/run/t5064.check index 61ccfd16e7..7b92e40c35 100644 --- a/test/files/run/t5064.check +++ b/test/files/run/t5064.check @@ -1,19 +1,19 @@ [53] T5064.super.<init>() [53] T5064.super.<init> [53] this -[16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) +[20/16:23] immutable.this.List.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) [16:20] immutable.this.List.apply <16:20> immutable.this.List <16:20> immutable.this -[16:23] scala.this.Predef.wrapIntArray(Array[Int]{1}) +[20/16:23] scala.this.Predef.wrapIntArray(Array[Int]{1}) [20] scala.this.Predef.wrapIntArray [20] scala.this.Predef [20] scala.this -[26:32] collection.this.Seq.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) +[29/26:32] collection.this.Seq.apply(scala.this.Predef.wrapIntArray(Array[Int]{1})) [26:29] collection.this.Seq.apply <26:29> collection.this.Seq <26:29> collection.this -[26:32] scala.this.Predef.wrapIntArray(Array[Int]{1}) +[29/26:32] scala.this.Predef.wrapIntArray(Array[Int]{1}) [29] scala.this.Predef.wrapIntArray [29] scala.this.Predef [29] scala.this diff --git a/test/files/run/t5072.check b/test/files/run/t5072.check index 8fe75f55d6..ddd49c71cb 100644 --- a/test/files/run/t5072.check +++ b/test/files/run/t5072.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class C defined class C @@ -10,5 +8,3 @@ scala> Thread.currentThread.getContextClassLoader.loadClass(classOf[C].getName) res0: Class[_] = class C scala> - -scala> diff --git a/test/files/run/t5125b.scala b/test/files/run/t5125b.scala index 29c08fee4c..149c49e213 100644 --- a/test/files/run/t5125b.scala +++ b/test/files/run/t5125b.scala @@ -7,7 +7,7 @@ class C2 { @scala.annotation.varargs def f(values:String*) = println("Calling C2.f(): " + values) def g(): String => Int = s => s.hashCode - + class C3 { @scala.annotation.varargs def f(values:String*) = println("Calling C3.f(): " + values) diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check index b7617e80a2..5705acf20a 100644 --- a/test/files/run/t5256d.check +++ b/test/files/run/t5256d.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe._ @@ -28,5 +26,3 @@ scala.AnyRef { } scala> - -scala> diff --git a/test/files/run/t5262.scala b/test/files/run/t5262.scala index fc4e57aa96..67448442da 100644 --- a/test/files/run/t5262.scala +++ b/test/files/run/t5262.scala @@ -6,21 +6,21 @@ object Test { - + def serializationDeserialization(obj : Any) { val bos = new java.io.ByteArrayOutputStream() val out = new java.io.ObjectOutputStream(bos) out.writeObject(obj) - + val arr = bos.toByteArray() val in = new java.io.ObjectInputStream(new java.io.ByteArrayInputStream(arr)) val o = in.readObject() println(o) } - + def main(args : Array[String]) { serializationDeserialization(List(1,2,3,4)) serializationDeserialization(List(1,2,null,4)) } - + } diff --git a/test/files/run/t5284b.scala b/test/files/run/t5284b.scala index a9282a895f..0da7972490 100644 --- a/test/files/run/t5284b.scala +++ b/test/files/run/t5284b.scala @@ -23,6 +23,6 @@ object Foo { class Foo[@specialized(Int) T] { val id: T => T = x => x - + def bar[@specialized(Int) W <: T, @specialized(Int) S](w: W) = id(w) } diff --git a/test/files/run/t5284c.scala b/test/files/run/t5284c.scala index 383b84c2cc..dec743fb94 100644 --- a/test/files/run/t5284c.scala +++ b/test/files/run/t5284c.scala @@ -25,6 +25,6 @@ object Foo { class Foo[@specialized(Int) T] { val len: List[T] => Int = xs => xs.length - + def bar[@specialized(Int) W <: T](ws: List[W]) = len(ws) } diff --git a/test/files/run/t5293-map.scala b/test/files/run/t5293-map.scala index 2707aed07e..ad1bbcfe30 100644 --- a/test/files/run/t5293-map.scala +++ b/test/files/run/t5293-map.scala @@ -6,7 +6,7 @@ import scala.collection.JavaConverters._ object Test extends App { - + def bench(label: String)(body: => Unit): Long = { val start = System.nanoTime @@ -15,14 +15,14 @@ object Test extends App { val end = System.nanoTime //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0)) - + end - start } - + def benchJava(values: java.util.Map[Int, Int]) = { bench("Java Map") { val m = new java.util.HashMap[Int, Int] - + m.putAll(values) } } @@ -30,33 +30,33 @@ object Test extends App { def benchScala(values: Iterable[(Int, Int)]) = { bench("Scala Map") { val m = new scala.collection.mutable.HashMap[Int, Int] - + m ++= values } } - + def benchScalaSorted(values: Iterable[(Int, Int)]) = { bench("Scala Map sorted") { val m = new scala.collection.mutable.HashMap[Int, Int] - + m ++= values.toArray.sorted } } - + def benchScalaPar(values: Iterable[(Int, Int)]) = { bench("Scala ParMap") { val m = new scala.collection.parallel.mutable.ParHashMap[Int, Int] map { x => x } - + m ++= values } } - + val total = 50000 val values = (0 until total) zip (0 until total) val map = scala.collection.mutable.HashMap.empty[Int, Int] - + map ++= values - + // warmup for (x <- 0 until 5) { benchJava(map.asJava) @@ -66,15 +66,15 @@ object Test extends App { benchScala(map) benchScalaPar(map) } - + val javamap = benchJava(map.asJava) val scalamap = benchScala(map) val scalaparmap = benchScalaPar(map) - + // println(javamap) // println(scalamap) // println(scalaparmap) - + assert(scalamap < (javamap * 10), "scalamap: " + scalamap + " vs. javamap: " + javamap) assert(scalaparmap < (javamap * 10), "scalaparmap: " + scalaparmap + " vs. javamap: " + javamap) } diff --git a/test/files/run/t5293.scala b/test/files/run/t5293.scala index 01ead45d2a..c42c967b42 100644 --- a/test/files/run/t5293.scala +++ b/test/files/run/t5293.scala @@ -6,7 +6,7 @@ import scala.collection.JavaConverters._ object Test extends App { - + def bench(label: String)(body: => Unit): Long = { val start = System.nanoTime @@ -15,14 +15,14 @@ object Test extends App { val end = System.nanoTime //println("%s: %s ms".format(label, (end - start) / 1000.0 / 1000.0)) - + end - start } - + def benchJava(values: java.util.Collection[Int]) = { bench("Java Set") { val set = new java.util.HashSet[Int] - + set.addAll(values) } } @@ -30,32 +30,32 @@ object Test extends App { def benchScala(values: Iterable[Int]) = { bench("Scala Set") { val set = new scala.collection.mutable.HashSet[Int] - + set ++= values } } - + def benchScalaSorted(values: Iterable[Int]) = { bench("Scala Set sorted") { val set = new scala.collection.mutable.HashSet[Int] - + set ++= values.toArray.sorted } } - + def benchScalaPar(values: Iterable[Int]) = { bench("Scala ParSet") { val set = new scala.collection.parallel.mutable.ParHashSet[Int] map { x => x } - + set ++= values } } - + val values = 0 until 50000 val set = scala.collection.mutable.HashSet.empty[Int] - + set ++= values - + // warmup for (x <- 0 until 5) { benchJava(set.asJava) @@ -65,11 +65,11 @@ object Test extends App { benchScala(set) benchScalaPar(set) } - + val javaset = benchJava(set.asJava) val scalaset = benchScala(set) val scalaparset = benchScalaPar(set) - + assert(scalaset < (javaset * 8), "scalaset: " + scalaset + " vs. javaset: " + javaset) assert(scalaparset < (javaset * 8), "scalaparset: " + scalaparset + " vs. javaset: " + javaset) } diff --git a/test/files/run/t5300.scala b/test/files/run/t5300.scala index 073b29604a..0f1c807177 100644 --- a/test/files/run/t5300.scala +++ b/test/files/run/t5300.scala @@ -1,6 +1,6 @@ object Test { val pf: PartialFunction[Any, Unit] = { case _ => () } - + def main(args: Array[String]): Unit = { pf orElse pf } diff --git a/test/files/run/t5313.scala b/test/files/run/t5313.scala index 4cbc29ba5d..0d7168fa89 100644 --- a/test/files/run/t5313.scala +++ b/test/files/run/t5313.scala @@ -3,7 +3,7 @@ import scala.tools.partest.IcodeComparison object Test extends IcodeComparison { override def printIcodeAfterPhase = "dce" - override def extraSettings: String = super.extraSettings + " -optimize" + override def extraSettings: String = super.extraSettings + " -optimize" override def code = """class Foo { @@ -18,11 +18,11 @@ object Test extends IcodeComparison { val erased3 = erased2 // and this var erased4 = erased2 // and this val erased5 = erased4 // and this - var kept2: Object = new Object // ultimately can't be eliminated + var kept2: Object = new Object // ultimately can't be eliminated while(randomBoolean) { val kept3 = kept2 kept2 = null // this can't, because it clobbers kept2, which is used - erased4 = null // safe to eliminate + erased4 = null // safe to eliminate println(kept3) } var kept4 = new Object // have to keep, it's used diff --git a/test/files/run/t5385.check b/test/files/run/t5385.check index 1df74fcfb5..f56464facd 100644 --- a/test/files/run/t5385.check +++ b/test/files/run/t5385.check @@ -1,8 +1,8 @@ -[0:9] class Azz -[0:9] class Bzz -[0:9] class Czz -[0:9] class Dzz -[0:11] class Ezz -[0:11] class Fzz -[0:13] class Gzz -[0:13] class Hzz +[6/0:9] class Azz +[6/0:9] class Bzz +[6/0:9] class Czz +[6/0:9] class Dzz +[6/0:11] class Ezz +[6/0:11] class Fzz +[6/0:13] class Gzz +[6/0:13] class Hzz diff --git a/test/files/run/t5428.scala b/test/files/run/t5428.scala index fb58cbbe24..44003e06ba 100644 --- a/test/files/run/t5428.scala +++ b/test/files/run/t5428.scala @@ -11,19 +11,19 @@ class A extends StackProxy[Int] { object Test { - + def main(args: Array[String]) { val a = new A - + a push 3 a push 4 a push 5 - + a.push(6, 7, 8) - + println(a) - + a.pop } - + } diff --git a/test/files/run/t5488-fn.scala b/test/files/run/t5488-fn.scala index d17bcf90a5..e6efe176c7 100644 --- a/test/files/run/t5488-fn.scala +++ b/test/files/run/t5488-fn.scala @@ -4,7 +4,7 @@ class C[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized(I object Test { def main(args:Array[String]) { def show(x: Any) = println(x.getClass.getName) - + show(new B((x: Int) => 1)) show(new B((x: Int) => "abc")) show(new B((x: Int) => ())) diff --git a/test/files/run/t5488.scala b/test/files/run/t5488.scala index 7bab0cdc3c..f93cf29060 100644 --- a/test/files/run/t5488.scala +++ b/test/files/run/t5488.scala @@ -5,15 +5,15 @@ class C0[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized( object Test { def main(args:Array[String]) { def show(x: Any) = println(x.getClass.getName) - + show(new A0[Int]()) show(new A0[AnyRef]()) - + show(new B0[Int, Int]()) show(new B0[Int, AnyRef]()) show(new B0[AnyRef, Int]()) show(new B0[AnyRef, AnyRef]()) - + show(new C0[Int, Int, Int]()) show(new C0[Int, Int, AnyRef]()) show(new C0[Int, AnyRef, Int]()) diff --git a/test/files/run/t5500b.scala b/test/files/run/t5500b.scala index 32de858e7b..9a49624fde 100644 --- a/test/files/run/t5500b.scala +++ b/test/files/run/t5500b.scala @@ -26,7 +26,7 @@ object Test { println(new C1A[Double, Int].getClass.getName) println(new C1A[Double, Double].getClass.getName) println(new C1A[Double, String].getClass.getName) - + println(new C1B[String, Int]("abc").getClass.getName) println(new C1B[String, Double]("abc").getClass.getName) println(new C1B[String, String]("abc").getClass.getName) @@ -36,7 +36,7 @@ object Test { println(new C1B[Double, Int](1d).getClass.getName) println(new C1B[Double, Double](1d).getClass.getName) println(new C1B[Double, String](1d).getClass.getName) - + println(new C1C("abc", 123).getClass.getName) println(new C1C("abc", 123).getClass.getName) println(new C1C("a", 1d).getClass.getName) diff --git a/test/files/run/t5535.check b/test/files/run/t5535.check index 8da9829b78..a0c87a47f4 100644 --- a/test/files/run/t5535.check +++ b/test/files/run/t5535.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> def h()(i: Int) = 1 + i h: ()(i: Int)Int @@ -16,5 +14,3 @@ scala> println(f(10)) 11 scala> - -scala> diff --git a/test/files/run/t5537.check b/test/files/run/t5537.check index 68c3ebf2e2..b9d521f301 100644 --- a/test/files/run/t5537.check +++ b/test/files/run/t5537.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> List[Predef.type]() res0: List[scala.Predef.type] = List() @@ -16,5 +14,3 @@ scala> List[Set.type]() res3: List[Set.type] = List() scala> - -scala> diff --git a/test/files/run/t5577.scala b/test/files/run/t5577.scala index b5d6d8c5b6..650b3c2c69 100644 --- a/test/files/run/t5577.scala +++ b/test/files/run/t5577.scala @@ -6,22 +6,22 @@ import collection._ object Test { - + class AlarmingBuffer[T] extends mutable.ArrayBuffer[T] { override def sizeHint(x: Int) { println("Received a size hint: " + x) super.sizeHint(x) } } - + def main(args: Array[String]) { val iteratorBuilder = (new AlarmingBuffer[Int]) mapResult { res => res.iterator } - + iteratorBuilder.sizeHint(10) iteratorBuilder ++= (0 until 10) iteratorBuilder.result.foreach(println) } - + } diff --git a/test/files/run/t5583.check b/test/files/run/t5583.check index 39b969fbe7..af96405bdd 100644 --- a/test/files/run/t5583.check +++ b/test/files/run/t5583.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> var s = 0 s: Int = 0 @@ -16,5 +14,3 @@ scala> println(s) 165 scala> - -scala> diff --git a/test/files/run/t5590.scala b/test/files/run/t5590.scala index 9c806e0b7d..baf0503a04 100644 --- a/test/files/run/t5590.scala +++ b/test/files/run/t5590.scala @@ -7,25 +7,25 @@ import collection._ object Test { - + def check(obj: AnyRef) { println(obj) - + val bos = new ByteArrayOutputStream() val out = new ObjectOutputStream(bos) out.writeObject(obj) val arr = bos.toByteArray() val in = new ObjectInputStream(new ByteArrayInputStream(arr)) val deser = in.readObject() - + println(deser) } - + def main(args: Array[String]) { val lhm = mutable.LinkedHashMap("a" -> "a", "b" -> "b", "c" -> "c") val lhs = mutable.LinkedHashSet("a", "b", "c", "d", "e") check(lhm) check(lhs) } - + } diff --git a/test/files/run/t5603.check b/test/files/run/t5603.check index 188f39ff82..46fcdd4470 100644 --- a/test/files/run/t5603.check +++ b/test/files/run/t5603.check @@ -1,29 +1,29 @@ [[syntax trees at end of parser]] // newSource1.scala [0:241]package [0:0]<empty> { - [0:82]abstract trait Greeting extends [15:82][83]scala.AnyRef { + [6/0:82]abstract trait Greeting extends [15:82][83]scala.AnyRef { [15]def $init$() = [15]{ [15]() }; - [23:39]val name: [33:39]String; - [46:76]val msg = [56:76][56:72][56:71]"How are you, ".$plus([72:76]name) + [27:39]val name: [33:39]String; + [50:76]val msg = [71/56:76][71/56:72][56:71]"How are you, ".$plus([72:76]name) }; - [87:209]class C extends [94:209][151:159]Greeting { - [119:139]val nameElse = _; + [93/87:209]class C extends [94:209][151:159]Greeting { + [123:139]val nameElse = _; [95:101]<paramaccessor> private[this] val i: [98:101]Int = _; - <119:139>def <init>([95]i: [98]Int) = <119:139>{ - <119:139>val nameElse = <134:139>"Bob"; - [NoPosition][NoPosition][NoPosition]super.<init>(); + <123:139>def <init>([95]i: [98]Int) = <123:139>{ + <123:139>val nameElse = <134:139>"Bob"; + [X][X][X]super.<init>(); [94]() }; - [168:184]val name = [179:184]"avc"; - [191:203][191:198]println([199:202]msg) + [172:184]val name = [179:184]"avc"; + [198/191:203][191:198]println([199:202]msg) }; - [215:241]object Test extends [227:241][235:238]App { + [222/215:241]object Test extends [227:241][235:238]App { [227]def <init>() = [227]{ - [NoPosition][NoPosition][NoPosition]super.<init>(); + [X][X][X]super.<init>(); [227]() }; - [NoPosition]<empty> + [X]<empty> } } diff --git a/test/files/run/t5610.scala b/test/files/run/t5610.scala index f62b2df6b4..82dabcc59f 100644 --- a/test/files/run/t5610.scala +++ b/test/files/run/t5610.scala @@ -20,7 +20,7 @@ object Test { val f: (String, Int*) => Unit = m(2, 3) f("", 5, 6) } - + def foo(s: => String)(dummy: Int) = () => println(s) def m(a: Int*)(z: String, b: Int*) { diff --git a/test/files/run/t5629.scala b/test/files/run/t5629.scala index 69feddd3a5..5b91007f7e 100644 --- a/test/files/run/t5629.scala +++ b/test/files/run/t5629.scala @@ -27,10 +27,10 @@ class AnyChild extends Parent[Any] { object Test { - + def main(args: Array[String]) { new IntChild().foo(33) new AnyChild().foo(33) } - + } diff --git a/test/files/run/t5629b.scala b/test/files/run/t5629b.scala index adb9ca5498..9ff29c8d89 100644 --- a/test/files/run/t5629b.scala +++ b/test/files/run/t5629b.scala @@ -4,7 +4,7 @@ object Test extends App { - + trait MyPF[@specialized(Int) -A] extends (A => Unit) { def isDefinedAt(x: A): Boolean def applyOrElse[A1 <: A](x: A1, default: A1 => Unit): Unit = { @@ -12,30 +12,30 @@ object Test extends App { if (isDefinedAt(x)) apply(x) else default(x) } } - + trait MySmartPF[@specialized(Int) -A] extends MyPF[A] { def apply(x: A): Unit = { println("MySmartPF.apply entered...") applyOrElse(x, { _: Any => throw new MatchError }) } } - + type T = Int //type T = Any - + def newPF(test: T): MyPF[T] = new MySmartPF[T] { def isDefinedAt(x: T): Boolean = x != test override def applyOrElse[A1 <: T](x: A1, default: A1 => Unit): Unit = { println("newPF.applyOrElse entered...") - if (x != test) { println("ok"); () } else { println("default"); default(x) } + if (x != test) { println("ok"); () } else { println("default"); default(x) } } } - + val pf = newPF(1) println("=== pf(1):") try { pf(1) } catch { case x: Throwable => println(x) } println("=== pf(42):") pf(42) println("=== done") - + } diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check index 1103b0e36f..06c6b32599 100644 --- a/test/files/run/t5655.check +++ b/test/files/run/t5655.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> object x { def x={} } defined object x @@ -26,5 +24,3 @@ and import x ^ scala> - -scala> diff --git a/test/files/run/t5656.scala b/test/files/run/t5656.scala index f5ea147a4e..5eb1df51af 100644 --- a/test/files/run/t5656.scala +++ b/test/files/run/t5656.scala @@ -3,9 +3,9 @@ object Test { - + def main(args: Array[String]) { println(Seq(List('1', '2', '3'), List('a', 'b', 'c')).view.addString(new StringBuilder, "_")) } - + } diff --git a/test/files/run/t5676.scala b/test/files/run/t5676.scala index b643c300ce..0c920e4a9d 100644 --- a/test/files/run/t5676.scala +++ b/test/files/run/t5676.scala @@ -13,12 +13,12 @@ class Baz[S] extends Foo[S] { } object Test { - + def main(a: Array[String]) { val b = new Baz[Any] println(b.A.foo()) println(Modifier.isFinal(classOf[Baz[Any]].getModifiers())) println(Modifier.isFinal(Test.getClass.getModifiers())) } - + } diff --git a/test/files/run/t5753_1/Test_2.scala b/test/files/run/t5753_1/Test_2.scala index a2777638bc..864d356fdb 100644 --- a/test/files/run/t5753_1/Test_2.scala +++ b/test/files/run/t5753_1/Test_2.scala @@ -1,4 +1,4 @@ -object Test extends App { +object Test extends App { import Macros._ println(foo(42)) }
\ No newline at end of file diff --git a/test/files/run/t5753_2/Impls_Macros_1.scala b/test/files/run/t5753_2/Impls_Macros_1.scala index e23c0b938b..41d584d0ac 100644 --- a/test/files/run/t5753_2/Impls_Macros_1.scala +++ b/test/files/run/t5753_2/Impls_Macros_1.scala @@ -1,7 +1,7 @@ import scala.reflect.macros.{Context => Ctx} trait Macro_T { - def foo[T](c: Ctx)(s: c.Expr[T]) = s + def foo[T](c: Ctx)(s: c.Expr[T]) = s } object Macros { diff --git a/test/files/run/t5753_2/Test_2.scala b/test/files/run/t5753_2/Test_2.scala index a2777638bc..864d356fdb 100644 --- a/test/files/run/t5753_2/Test_2.scala +++ b/test/files/run/t5753_2/Test_2.scala @@ -1,4 +1,4 @@ -object Test extends App { +object Test extends App { import Macros._ println(foo(42)) }
\ No newline at end of file diff --git a/test/files/run/t5789.check b/test/files/run/t5789.check index ea8d4966b1..bcb2382559 100644 --- a/test/files/run/t5789.check +++ b/test/files/run/t5789.check @@ -1,14 +1,10 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> val n = 2 +scala> val n = 2 n: Int = 2 scala> () => n res0: () => Int = <function0> scala> - -scala> diff --git a/test/files/run/t5804.scala b/test/files/run/t5804.scala index b96a736035..b6a8940c1f 100644 --- a/test/files/run/t5804.scala +++ b/test/files/run/t5804.scala @@ -4,29 +4,29 @@ import collection.mutable._ object Test { - + def main(args: Array[String]) { class CustomHashMap extends HashMap[Int, Int] { override def initialSize = 65 - + println(table.length) } - + new CustomHashMap new HashMap { println(table.length) } - + class CustomHashSet extends HashSet[Int] { override def initialSize = 96 - + println(table.length) } - + new CustomHashSet new HashSet { println(table.length) } } - + } diff --git a/test/files/run/t5857.scala b/test/files/run/t5857.scala index bf67bedf54..c82fd88c08 100644 --- a/test/files/run/t5857.scala +++ b/test/files/run/t5857.scala @@ -2,44 +2,44 @@ object Test { - + def time[U](b: =>U): Long = { val start = System.currentTimeMillis b val end = System.currentTimeMillis - + end - start } - + def main(args: Array[String]) { val sz = 1000000000 - + val range = 1 to sz check { assert(range.min == 1, range.min) } check { assert(range.max == sz, range.max) } - + val descending = sz to 1 by -1 check { assert(descending.min == 1) } check { assert(descending.max == sz) } - + val numeric = 1.0 to sz.toDouble by 1 check { assert(numeric.min == 1.0) } check { assert(numeric.max == sz.toDouble) } - + val numdesc = sz.toDouble to 1.0 by -1 check { assert(numdesc.min == 1.0) } check { assert(numdesc.max == sz.toDouble) } } - + def check[U](b: =>U) { val exectime = time { b } - + // whatever it is, it should be less than, say, 250ms // if `max` involves traversal, it takes over 5 seconds on a 3.2GHz i7 CPU //println(exectime) assert(exectime < 250, exectime) } - + } diff --git a/test/files/run/t5867.scala b/test/files/run/t5867.scala index 6a86ac3e6d..f7e9393b7a 100644 --- a/test/files/run/t5867.scala +++ b/test/files/run/t5867.scala @@ -3,12 +3,12 @@ import collection.mutable.UnrolledBuffer object Test { - + def main(args: Array[String]) { val buf = UnrolledBuffer(1 to 50: _*) val dub = buf ++ buf - + println(dub) } - + } diff --git a/test/files/run/t5879.scala b/test/files/run/t5879.scala index 18dd94289d..83a583da54 100644 --- a/test/files/run/t5879.scala +++ b/test/files/run/t5879.scala @@ -2,23 +2,23 @@ import collection.immutable.HashMap object Test { - + def main(args: Array[String]) { resolveDefault() resolveFirst() resolveSecond() resolveMany() } - + def resolveDefault() { val a = HashMap(1 -> "1") val b = HashMap(1 -> "2") - + val r = a.merged(b)(null) println(r) println(r(1)) } - + def resolveFirst() { val a = HashMap(1 -> "1") val b = HashMap(1 -> "2") @@ -26,12 +26,12 @@ object Test { println(a) a } - + val r = a.merged(b) { collision } println(r) println(r(1)) } - + def resolveSecond() { val a = HashMap(1 -> "1") val b = HashMap(1 -> "2") @@ -39,21 +39,21 @@ object Test { println(b) b } - + val r = a.merged(b) { collision } println(r) println(r(1)) } - + def resolveMany() { val a = HashMap((0 until 100) zip (0 until 100): _*) val b = HashMap((0 until 100) zip (100 until 200): _*) def collision(a: (Int, Int), b: (Int, Int)) = { (a._1, a._2 + b._2) } - + val r = a.merged(b) { collision } for ((k, v) <- r) assert(v == 100 + 2 * k, (k, v)) } - + } diff --git a/test/files/run/t5880.scala b/test/files/run/t5880.scala index 4cda599f79..f88df90160 100644 --- a/test/files/run/t5880.scala +++ b/test/files/run/t5880.scala @@ -5,13 +5,13 @@ import scala.collection.JavaConversions._ object Test { - + def main(args:Array[String]) = { val tests = 5000 val jm: java.util.Map[Int, Int] = scala.collection.mutable.Map((0 until tests) zip (0 until tests).reverse: _*) val es = jm.entrySet() val it = es.iterator - + // chi square test val groups = 10 val hits = new Array[Int](groups) @@ -28,7 +28,7 @@ object Test { val diffs = for (i <- 0 until groups) yield (hits(i) - expected) * (hits(i) - expected) diffs.sum.toDouble / expected } - + while (it.hasNext) { val x = it.next() hit(x.##) @@ -37,5 +37,5 @@ object Test { // println(ChiSquare) assert(ChiSquare < 4.0, ChiSquare + " -> " + hits.mkString(", ")) } - + } diff --git a/test/files/run/t5937.scala b/test/files/run/t5937.scala index e5bf6617af..9ec4ff12d3 100644 --- a/test/files/run/t5937.scala +++ b/test/files/run/t5937.scala @@ -6,7 +6,7 @@ import collection._ object Test extends App { - + val list: List[Int] = (immutable.Vector(1, 2, 3) :+ 4)(breakOut) - + } diff --git a/test/files/run/t5971.scala b/test/files/run/t5971.scala index dbd9beebb3..bc24255ece 100644 --- a/test/files/run/t5971.scala +++ b/test/files/run/t5971.scala @@ -12,12 +12,12 @@ * Mind blowing, I know. */ object Test { - + def main(args: Array[String]) { println("bar".view.reverse.filter(_ > 'a').mkString(",")) println("bar".view.reverse.take(1).mkString(",")) println("bar".view.reverse.dropWhile(_ > 'a').mkString(",")) println("bar".view.reverse.takeWhile(_ => true).mkString(",")) } - + } diff --git a/test/files/run/t5986.scala b/test/files/run/t5986.scala index 8cf7086f98..b9c21a7b37 100644 --- a/test/files/run/t5986.scala +++ b/test/files/run/t5986.scala @@ -9,22 +9,22 @@ import scala.collection._ * and the element already exists in the set. */ object Test { - + class Foo(val name: String, val n: Int) { override def equals(obj: Any): Boolean = obj match { case other: Foo => name == other.name; case _ => false } override def hashCode = name.## override def toString = "Foo(" + name + ", " + n + ")" } - + implicit val ordering: Ordering[Foo] = Ordering.fromLessThan[Foo] { (a, b) => a.name.compareTo(b.name) < 0 } - + def check[S <: Set[Foo]](set: S) { def output(s: Set[Foo]) = println(s.toList.sorted.mkString(",")) output(set + new Foo("bar", 2)) output(set ++ List(new Foo("bar", 2), new Foo("bar", 3), new Foo("bar", 4))) output(set union Set(new Foo("bar", 2), new Foo("baz", 3), new Foo("bazz", 4))) } - + def main(args: Array[String]) { check(Set(new Foo("bar", 1))) check(immutable.Set(new Foo("bar", 1))) @@ -32,5 +32,5 @@ object Test { check(immutable.SortedSet(new Foo("bar", 1))) check(mutable.SortedSet(new Foo("bar", 1))) } - + } diff --git a/test/files/run/t603.scala b/test/files/run/t603.scala index 54fb8e6974..84a224a40a 100644 --- a/test/files/run/t603.scala +++ b/test/files/run/t603.scala @@ -24,7 +24,7 @@ object forceDelay { object Test { import forceDelay._ - + def main(args: Array[String]) = { val s: Susp[Int] = delay { Console.println("evaluating..."); 3 } Console.println("s = " + s) diff --git a/test/files/run/t6052.scala b/test/files/run/t6052.scala index 385d5390d3..5482cfb293 100644 --- a/test/files/run/t6052.scala +++ b/test/files/run/t6052.scala @@ -8,13 +8,13 @@ object Test extends App { def seqarr(i: Int) = Array[Int]() ++ (0 until i) def pararr(i: Int) = seqarr(i).par - + def check[T](i: Int, f: Int => T) { val gseq = seqarr(i).toSeq.groupBy(f) val gpar = pararr(i).groupBy(f) assert(gseq == gpar, (gseq, gpar)) } - + for (i <- 0 until 20) check(i, _ > 0) for (i <- 0 until 20) check(i, _ % 2) for (i <- 0 until 20) check(i, _ % 4) diff --git a/test/files/run/t6070.scala b/test/files/run/t6070.scala index b6af48ef21..434949f869 100644 --- a/test/files/run/t6070.scala +++ b/test/files/run/t6070.scala @@ -11,7 +11,7 @@ class StringBomb extends Bomb { def size(that: String): Int = that.length } -class IntBomb extends Bomb { +class IntBomb extends Bomb { type T = Int val x = 10 @@ -22,7 +22,7 @@ case class Mean(var bomb: Bomb) object Test extends App { def foo(x: Mean) = x match { - case Mean(b) => + case Mean(b) => // BUG: b is assumed to be a stable identifier, but it can actually be mutated println(b.size({ mutate(); b.x })) } diff --git a/test/files/run/t6086-repl.check b/test/files/run/t6086-repl.check index 97f20bd66b..115eff5f85 100644 --- a/test/files/run/t6086-repl.check +++ b/test/files/run/t6086-repl.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> case class X(s: String) defined class X diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check index 2333b9d986..a3b09efcd9 100644 --- a/test/files/run/t6146b.check +++ b/test/files/run/t6146b.check @@ -45,7 +45,7 @@ scala> val mt1 = memType(S1, fTpe) mt1: u.Type = O.X.S1.type scala> global.typeDeconstruct.show(mt1) -res0: String = +res0: String = TypeRef( pre = SingleType(pre = ThisType(object O), object X) TypeSymbol(class S1 extends C.this.F[T]) diff --git a/test/files/run/t6168/Context.java b/test/files/run/t6168/Context.java index e527844563..d0fb5d2543 100644 --- a/test/files/run/t6168/Context.java +++ b/test/files/run/t6168/Context.java @@ -10,7 +10,7 @@ public class Context<ParentType> { public void setParent(ParentType parent) { this.parent = parent; } - + public Field<Integer> intField() { return new Field<Integer>() { @Override diff --git a/test/files/run/t6259.scala b/test/files/run/t6259.scala index 294c95e96b..b2c27df51f 100644 --- a/test/files/run/t6259.scala +++ b/test/files/run/t6259.scala @@ -37,9 +37,9 @@ object Early extends { class DoubleTrouble[X](x: AnyRef)(implicit override val tt: TypeTag[X]) extends A[X] object DoubleOk extends DoubleTrouble[String]({ - // Drops to this.getClass and is an issue - object InnerTrouble extends A[String]; - InnerTrouble + // Drops to this.getClass and is an issue + object InnerTrouble extends A[String]; + InnerTrouble }) object Test extends App { diff --git a/test/files/run/t6273.check b/test/files/run/t6273.check index c1c18daac2..bef0b227d2 100644 --- a/test/files/run/t6273.check +++ b/test/files/run/t6273.check @@ -1,19 +1,15 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> val y = 55 y: Int = 55 scala> val x = s""" y = $y """ -x: String = +x: String = " y = 55 " scala> - -scala> diff --git a/test/files/run/t6288.check b/test/files/run/t6288.check index a032a10de6..0da03c0439 100644 --- a/test/files/run/t6288.check +++ b/test/files/run/t6288.check @@ -18,7 +18,7 @@ [64]case6(){ [64][64]matchEnd4([64]throw [64][64][64]new [64]MatchError([64]x1)) }; - [64]matchEnd4(x: [NoPosition]Unit){ + [64]matchEnd4(x: [X]Unit){ [64]x } } @@ -44,7 +44,7 @@ [175]case6(){ [175][175]matchEnd4([175]throw [175][175][175]new [175]MatchError([175]x1)) }; - [175]matchEnd4(x: [NoPosition]Unit){ + [175]matchEnd4(x: [X]Unit){ [175]x } } @@ -70,7 +70,7 @@ [273]case6(){ [273][273]matchEnd4([273]throw [273][273][273]new [273]MatchError([273]x1)) }; - [273]matchEnd4(x: [NoPosition]Unit){ + [273]matchEnd4(x: [X]Unit){ [273]x } } diff --git a/test/files/run/t6320.check b/test/files/run/t6320.check index e56bacd223..013acc1c54 100644 --- a/test/files/run/t6320.check +++ b/test/files/run/t6320.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.language.dynamics import scala.language.dynamics @@ -13,5 +11,3 @@ scala> new Dyn(Map("foo" -> 10)).foo[Int] res0: Int = 10 scala> - -scala> diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check index 3480bbdd0b..5049426ab4 100644 --- a/test/files/run/t6329_repl.check +++ b/test/files/run/t6329_repl.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.reflect.classTag import scala.reflect.classTag @@ -35,5 +33,3 @@ scala> classTag[scala.collection.immutable.Set[_]] res7: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set scala> - -scala> diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check index 3f5f7dc8a4..f804fa75f4 100644 --- a/test/files/run/t6439.check +++ b/test/files/run/t6439.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class A defined class A @@ -73,5 +71,3 @@ scala> lookup("F") // this now works as a result of changing .typeSymbol to .typ res0: $r.intp.global.Symbol = type F scala> - -scala> diff --git a/test/files/run/t6507.check b/test/files/run/t6507.check index 336db0aeaf..3536c42381 100644 --- a/test/files/run/t6507.check +++ b/test/files/run/t6507.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> :silent Switched off result printing. diff --git a/test/files/run/t6549.check b/test/files/run/t6549.check index bc78aac741..d5dfc5ebe8 100644 --- a/test/files/run/t6549.check +++ b/test/files/run/t6549.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> case class `X"`(var xxx: Any) defined class X$u0022 @@ -28,5 +26,3 @@ scala> val `"` = 0 ": Int = 0 scala> - -scala> diff --git a/test/files/run/t6632.scala b/test/files/run/t6632.scala index c1c8d4abe0..0242e60104 100644 --- a/test/files/run/t6632.scala +++ b/test/files/run/t6632.scala @@ -1,6 +1,6 @@ object Test extends App { import collection.mutable.ListBuffer - + def newLB = ListBuffer('a, 'b, 'c, 'd, 'e) val lb0 = newLB diff --git a/test/files/run/t6669.scala b/test/files/run/t6669.scala index b55718b12b..e18f2514a9 100644 --- a/test/files/run/t6669.scala +++ b/test/files/run/t6669.scala @@ -2,7 +2,7 @@ import java.io.{ByteArrayOutputStream, PrintStream} object Test extends App { val baos = new ByteArrayOutputStream() - val ps = new PrintStream(baos) + val ps = new PrintStream(baos) // first test with the default classpath (scala.Console withOut ps) { diff --git a/test/files/run/t6719.check b/test/files/run/t6719.check new file mode 100644 index 0000000000..6a452c185a --- /dev/null +++ b/test/files/run/t6719.check @@ -0,0 +1 @@ +() diff --git a/test/files/run/t6719.scala b/test/files/run/t6719.scala new file mode 100644 index 0000000000..847929a95d --- /dev/null +++ b/test/files/run/t6719.scala @@ -0,0 +1,8 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} +object Test extends App { + val tb = cm.mkToolBox() + val tree = tb.parse("(); val res = 0") + println(tb.eval(tree)) +}
\ No newline at end of file diff --git a/test/files/run/t6768.check b/test/files/run/t6768.check new file mode 100644 index 0000000000..64df4568ec --- /dev/null +++ b/test/files/run/t6768.check @@ -0,0 +1,12 @@ +[[syntax trees at end of typer]] // newSource1.scala +[1:58]package [1:1]<empty> { + [7/1:58]class A extends [9:58][58]scala.AnyRef { + [58]def <init>(): [9]A = [58]{ + [58][58][58]A.super.<init>(); + [9]() + }; + [17/13:31]def f1: [17]Some[String] = [26/22:31][22:26][22:26]scala.Some.apply[[22]String]([27:30]"a"); + [38/34:56]def f2: [38]Some[String] = [47/43:56][47:51][47:51]new [47:51]<type: [47:51]scala.Some>([52:55]"b") + } +} + diff --git a/test/files/run/t6768.scala b/test/files/run/t6768.scala new file mode 100644 index 0000000000..11470a0ef8 --- /dev/null +++ b/test/files/run/t6768.scala @@ -0,0 +1,12 @@ +import scala.tools.partest._ + +object Test extends DirectTest { + override def extraSettings: String = "-usejavacp -Xprint:typer -Yrangepos -Xprint-pos -d " + testOutput.path + override def show() = Console.withErr(System.out)(compile()) + + override def code = """ +class A { + def f1 = Some("a") + def f2 = new Some("b") +}""" +} diff --git a/test/files/run/t6863.scala b/test/files/run/t6863.scala index c4f3c2c885..7210ebc01d 100644 --- a/test/files/run/t6863.scala +++ b/test/files/run/t6863.scala @@ -3,34 +3,34 @@ object Test { def lazyVal() = { // internally lazy vals become vars which are initialized with "_", so they need to be tested just like vars do lazy val x = "42" - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def ident() = { val y = "42" var x = y - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def apply() = { def y(x : Int) = x.toString var x = y(42) - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def literal() = { var x = "42" - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def `new`() = { var x = new String("42") - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def select() = { object Foo{val bar = "42"} var x = Foo.bar - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def `throw`() = { var x = if (true) "42" else throw new Exception("42") - assert({ () => x }.apply == "42") + assert({ () => x }.apply == "42") } def assign() = { var y = 1 @@ -59,7 +59,7 @@ object Test { assert({ () => x }.apply == ()) } def ifElse() = { - var x = if(true) "42" else "43" + var x = if(true) "42" else "43" assert({ () => x }.apply == "42") } def matchCase() = { @@ -77,7 +77,7 @@ object Test { assert({ () => x }.apply == "42") } def labelDef() = { - var x = 100 match { + var x = 100 match { case 100 => try "42" finally () } assert({ () => x }.apply == "42") @@ -86,7 +86,7 @@ object Test { var x = { val y = 42 if(true) try "42" catch {case _: Throwable => "43"} - else "44" + else "44" } assert({ () => x }.apply == "42") } diff --git a/test/files/run/t6937.check b/test/files/run/t6937.check index 9a1fa4cfaf..4729dc7006 100644 --- a/test/files/run/t6937.check +++ b/test/files/run/t6937.check @@ -1,9 +1,7 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> import scala.reflect.runtime.{universe => ru} +scala> import scala.reflect.runtime.{universe => ru} import scala.reflect.runtime.{universe=>ru} scala> import scala.reflect.runtime.{currentMirror => cm} @@ -22,5 +20,3 @@ scala> apiru.typeTag[A].in(cm) res0: reflect.runtime.universe.TypeTag[A] = TypeTag[A] scala> - -scala> diff --git a/test/files/run/t7181.scala b/test/files/run/t7181.scala index a055e43481..489ec313f6 100644 --- a/test/files/run/t7181.scala +++ b/test/files/run/t7181.scala @@ -21,7 +21,7 @@ object Test extends App { val result = try driver(action) catch { - case UncaughtException(a) => + case UncaughtException(a) => gotException = true a } @@ -35,13 +35,13 @@ object Test extends App { def driver(action: Action): Action = { val result = try { action match { - case MainNormalExit => + case MainNormalExit => println(s"normal exit $action") action case MainReturn => println(s"return $action") return action - case MainUncaughtException => + case MainUncaughtException => println(s"uncaught exception $action") throw UncaughtException(action) case _ => @@ -50,16 +50,16 @@ object Test extends App { } } catch { case CaughtException(action) => action match { - case ExceptionNormalExit => + case ExceptionNormalExit => println(s"normal exit $action") action - case ExceptionReturn => + case ExceptionReturn => println(s"return $action") return action - case ExceptionUncaughtException => + case ExceptionUncaughtException => println(s"uncaught exception $action") throw UncaughtException(action) - case _ => + case _ => sys.error(s"unexpected $action in exception handler") } } finally { diff --git a/test/files/run/t7185.check b/test/files/run/t7185.check index f95910ba5f..38449b3497 100644 --- a/test/files/run/t7185.check +++ b/test/files/run/t7185.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> import scala.tools.reflect.ToolBox import scala.tools.reflect.ToolBox @@ -16,7 +14,7 @@ scala> val ORef = reify { O }.tree ORef: reflect.runtime.universe.Tree = $read.O scala> val tree = Apply(Block(Nil, Block(Nil, ORef)), Nil) -tree: reflect.runtime.universe.Apply = +tree: reflect.runtime.universe.Apply = { { $read.O @@ -24,7 +22,7 @@ tree: reflect.runtime.universe.Apply = }() scala> {val tb = reflect.runtime.currentMirror.mkToolBox(); tb.typeCheck(tree): Any} -res0: Any = +res0: Any = { { $read.O.apply() diff --git a/test/files/run/t7271.check b/test/files/run/t7271.check index f7a23018ca..86b5230fd7 100644 --- a/test/files/run/t7271.check +++ b/test/files/run/t7271.check @@ -2,7 +2,7 @@ [6]package [6]<empty> { [6]class C extends [8][91]scala.AnyRef { [8]def <init>() = [8]{ - [NoPosition][NoPosition][NoPosition]super.<init>(); + [X][X][X]super.<init>(); [8]() }; [20]def quote = [28][28][28][28]StringContext([30]"foo", [40]"baz").s([35]this); diff --git a/test/files/run/t7291.scala b/test/files/run/t7291.scala index d996c615ce..ca44e96693 100644 --- a/test/files/run/t7291.scala +++ b/test/files/run/t7291.scala @@ -17,6 +17,6 @@ elem: Fooable[T]): Fooable[Coll[T]] = { new Fooable[Coll[T]]{} } def main(args: Array[String]) { - implicitly[Fooable[List[Any]]] + implicitly[Fooable[List[Any]]] } } diff --git a/test/files/run/t7319.check b/test/files/run/t7319.check index b5081f2d00..d03ee3a6cf 100644 --- a/test/files/run/t7319.check +++ b/test/files/run/t7319.check @@ -1,8 +1,6 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - scala> class M[A] defined class M diff --git a/test/files/run/t7331b.check b/test/files/run/t7331b.check index 7034a95a3f..413c93aaf7 100644 --- a/test/files/run/t7331b.check +++ b/test/files/run/t7331b.check @@ -1,3 +1,3 @@ -reflective compilation has failed: +reflective compilation has failed: ')' expected but eof found. diff --git a/test/files/run/t7336.scala b/test/files/run/t7336.scala index ace83f2c1f..21b0be5446 100644 --- a/test/files/run/t7336.scala +++ b/test/files/run/t7336.scala @@ -9,7 +9,7 @@ import scala.concurrent.duration.Duration * resulting in a speedy OutOfMemoryError. Now, each array should be freed soon * after it is created and the test should complete without problems. */ -object Test { +object Test { def main(args: Array[String]) { def loop(i: Int, arraySize: Int): Future[Unit] = { val array = new Array[Byte](arraySize) diff --git a/test/files/run/t7341.scala b/test/files/run/t7341.scala index dc526c6c19..ffea7f918b 100755 --- a/test/files/run/t7341.scala +++ b/test/files/run/t7341.scala @@ -4,7 +4,7 @@ object Obj { def foo { returning(() => cache = ()) } - + def apply(): Any = { cache } diff --git a/test/files/run/t744.scala b/test/files/run/t744.scala index d5e9f6df34..4895e9baa0 100644 --- a/test/files/run/t744.scala +++ b/test/files/run/t744.scala @@ -5,7 +5,7 @@ trait Linked { } } object Test { - class Test extends Linked { + class Test extends Linked { trait FileImpl extends super.FileImpl { // val x: int = 1 } diff --git a/test/files/run/t7482a.check b/test/files/run/t7482a.check index b26e685784..943538f352 100644 --- a/test/files/run/t7482a.check +++ b/test/files/run/t7482a.check @@ -1,14 +1,10 @@ Type in expressions to have them evaluated. Type :help for more information. -scala> - -scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5) +scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5) v: java.util.ArrayList[String] = [] scala> val v: java.util.ArrayList[String] = new java.util.ArrayList[String](5) v: java.util.ArrayList[String] = [] scala> - -scala> diff --git a/test/files/run/t7805-repl-i.scala b/test/files/run/t7805-repl-i.scala index a4061689f0..bb5203951e 100644 --- a/test/files/run/t7805-repl-i.scala +++ b/test/files/run/t7805-repl-i.scala @@ -34,7 +34,7 @@ trait HangingRepl extends ReplTest { import scala.concurrent.duration._ import ExecutionContext.Implicits._ import Resulting._ - def timeout = 15 seconds + def timeout = 120 seconds def hanging[A](a: =>A): A = future(a) resultWithin timeout override def show() = Try(hanging(super.show())) recover { case e => e.printStackTrace() diff --git a/test/files/run/t7852.check b/test/files/run/t7852.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/t7852.check diff --git a/test/files/run/t7852.flags b/test/files/run/t7852.flags new file mode 100644 index 0000000000..f6262fd3e0 --- /dev/null +++ b/test/files/run/t7852.flags @@ -0,0 +1 @@ +-Ynooptimise diff --git a/test/files/run/t7852.scala b/test/files/run/t7852.scala new file mode 100644 index 0000000000..c93db718fd --- /dev/null +++ b/test/files/run/t7852.scala @@ -0,0 +1,39 @@ +import scala.tools.partest.BytecodeTest +import scala.tools.asm +import scala.tools.asm.util._ +import scala.tools.nsc.util.stringFromWriter +import scala.collection.JavaConverters._ + +object Test extends BytecodeTest { + val nullChecks = Set(asm.Opcodes.IFNONNULL, asm.Opcodes.IFNULL) + + def show: Unit = { + def test(methodName: String, expected: Int) { + val classNode = loadClassNode("Lean") + val methodNode = getMethod(classNode, methodName) + val got = countNullChecks(methodNode.instructions) + assert(got == expected, s"expected $expected but got $got comparisons") + } + test("string", expected = 0) + test("module", expected = 0) + test("moduleIndirect", expected = 2) + } + + def countNullChecks(insnList: asm.tree.InsnList): Int = + insnList.iterator.asScala.map(_.getOpcode).count(nullChecks) +} + +class Lean { + def string { + "" == toString + } + + def module { + Nil == (toString: Any) + } + + def moduleIndirect { + val n: Nil.type = null + n == (toString: Any) // still need null checks here. + } +} diff --git a/test/files/run/t874.scala b/test/files/run/t874.scala index 7e70fc34eb..b077859ef3 100644 --- a/test/files/run/t874.scala +++ b/test/files/run/t874.scala @@ -7,7 +7,7 @@ object Test { } U("xyz")(2) } - class Mix extends Base { + class Mix extends Base { case class U[A](x1: A)(x2: Int) { Console.println("U created with "+x1+" and "+x2) } diff --git a/test/files/run/t920.scala b/test/files/run/t920.scala index 1e12e6ba87..6a7f122d55 100644 --- a/test/files/run/t920.scala +++ b/test/files/run/t920.scala @@ -7,7 +7,7 @@ object Test { trait Foo extends Test.Foo0 { def foo : B.this.type = B.this; } - class baz extends Baz with Foo { + class baz extends Baz with Foo { override def toString = "baz" } Console.println(new baz); diff --git a/test/files/run/takeAndDrop.scala b/test/files/run/takeAndDrop.scala index 6e87838e11..8d2dff0bfa 100644 --- a/test/files/run/takeAndDrop.scala +++ b/test/files/run/takeAndDrop.scala @@ -1,9 +1,9 @@ -object Test { +object Test { def main(args: Array[String]): Unit = { val range = 1 to 10 val target = (3 to 8).toList val confirm = (xs: Seq[Int]) => assert(xs.toList == target, xs) - + confirm(range drop 2 dropRight 2) confirm(range drop 1 dropRight 1 drop 1 dropRight 1) confirm(range take 8 drop 2) diff --git a/test/files/run/tcpoly_monads.scala b/test/files/run/tcpoly_monads.scala index 6372851451..978f889590 100644 --- a/test/files/run/tcpoly_monads.scala +++ b/test/files/run/tcpoly_monads.scala @@ -7,15 +7,15 @@ trait Monads { * (>>=) :: m a -> (a -> m b) -> m b * return :: a -> m a * - * MonadTC encodes the above Haskell type class, + * MonadTC encodes the above Haskell type class, * an instance of MonadTC corresponds to a method dictionary. * (see http://lampwww.epfl.ch/~odersky/talks/wg2.8-boston06.pdf) * * Note that the identity (`this') of the method dictionary does not really correspond - * to the instance of m[x] (`self') that is `wrapped': e.g., unit does not use `self' (which + * to the instance of m[x] (`self') that is `wrapped': e.g., unit does not use `self' (which * corresponds to the argument of the implicit conversion that encodes an instance of this type class) */ - trait MonadTC[m[x], a] { + trait MonadTC[m[x], a] { def unit[a](orig: a): m[a] // >>='s first argument comes from the implicit definition constructing this "method dictionary" @@ -30,7 +30,7 @@ trait Monads { */ trait OptionMonad extends Monads { // this implicit method encodes the Monad type class instance for Option - implicit def OptionInstOfMonad[a](self: Option[a]): MonadTC[Option, a] + implicit def OptionInstOfMonad[a](self: Option[a]): MonadTC[Option, a] = new MonadTC[Option, a] { def unit[a](orig: a) = Some(orig) def >>=[b](fun: a => Option[b]): Option[b] = self match { diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala index ec17e062db..c8bcf693a1 100644 --- a/test/files/run/tcpoly_parseridioms.scala +++ b/test/files/run/tcpoly_parseridioms.scala @@ -3,11 +3,11 @@ import scala.language.{ higherKinds, implicitConversions, postfixOps } trait Parsers { type Input = List[Char] - + sealed class ParseResult[+t](val next: Input) - case class Success[+t](override val next: Input, result: t) extends ParseResult[t](next) + case class Success[+t](override val next: Input, result: t) extends ParseResult[t](next) case class Failure(override val next: Input, msg: String) extends ParseResult[Nothing](next) - + abstract class Parser[+t] { def apply(in: Input): ParseResult[t] } @@ -19,7 +19,7 @@ trait Parsers { case Success(next2, y) => Success(next2, Pair(x,y)) case Failure(_, msg) => Failure(in, msg) } - case Failure(_, msg) => Failure(in, msg) + case Failure(_, msg) => Failure(in, msg) } } @@ -41,20 +41,20 @@ trait Parsers { case Failure(n, msg) => Failure(n, msg) } } - + def accept[T](c: Char, r: T): Parser[T] = new Parser[T] { def apply(in: Input) = in match { case c2 :: n if c2 == c => Success(n, r) case n => Failure(n, "expected "+c+" at the head of "+n) } } - - def apply_++[s, tt](fun: Parser[s => tt], arg: Parser[s]): Parser[tt] = lift[Pair[s=>tt, s], tt]({case Pair(f, a) => f(a)})(sq(fun, arg)) - + + def apply_++[s, tt](fun: Parser[s => tt], arg: Parser[s]): Parser[tt] = lift[Pair[s=>tt, s], tt]({case Pair(f, a) => f(a)})(sq(fun, arg)) + def success[u](v: u): Parser[u] = new Parser[u] { def apply(in: Input) = Success(in, v) } - + } trait Idioms { @@ -64,21 +64,21 @@ trait Idioms { def pureMethod[a](name: String, x: a): idi[a] = pure(x) // hack for Mirrors: allow passing of method names } - class IdiomaticTarget[idi[x], idiom <: Idiom[idi], s](i: idiom, tgt: s) { + class IdiomaticTarget[idi[x], idiom <: Idiom[idi], s](i: idiom, tgt: s) { def dot [t](fun: s => t, name: String) = new IdiomaticApp2[idi, idiom, t](i, i.liftedApply(i.pureMethod(name, fun))(i.pure(tgt))) } // TODO: `.` --> java.lang.ClassFormatError: Illegal method name "." in class Idioms$Id$ - class IdiomaticFunction[idi[x], idiom <: Idiom[idi], s, t](i: idiom, fun: s => t) { + class IdiomaticFunction[idi[x], idiom <: Idiom[idi], s, t](i: idiom, fun: s => t) { def <| (a: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(i.pure(fun))(a)) } class IdiomaticApp[idi[x], idiom <: Idiom[idi], x](i: idiom, a: idi[x]) { // where x <: s=>t -- TODO can this be expressed without generalised constraints? def <> [s, t](b: idi[s]) = new IdiomaticApp[idi, idiom, t](i, i.liftedApply(a.asInstanceOf[idi[s=>t]])(b)) - + def |> : idi[x] = a } - + class IdiomaticApp2[idi[x], idiom <: Idiom[idi], x](i: idiom, a: idi[x]) extends IdiomaticApp[idi, idiom, x](i, a) { def <| [s, t](b: idi[s]) = <>[s,t](b) } @@ -89,22 +89,22 @@ trait ParserIdioms extends Parsers with Idioms { def liftedApply[s, t](fun: Parser[s => t])(arg: Parser[s]): Parser[t] = apply_++(fun, arg) def pure[a](x: a): Parser[a] = success(x) } - - implicit def parserIdiomFun[s, t](fun: s=>t): IdiomaticFunction[Parser, ParserIdiom.type, s, t] = + + implicit def parserIdiomFun[s, t](fun: s=>t): IdiomaticFunction[Parser, ParserIdiom.type, s, t] = new IdiomaticFunction[Parser, ParserIdiom.type, s, t](ParserIdiom, fun) - implicit def parserIdiomTgt[s](tgt: s): IdiomaticTarget[Parser, ParserIdiom.type, s] = + implicit def parserIdiomTgt[s](tgt: s): IdiomaticTarget[Parser, ParserIdiom.type, s] = new IdiomaticTarget[Parser, ParserIdiom.type, s](ParserIdiom, tgt) - + trait Expr case class Plus(a: Int, b: Int) extends Expr - + def num = or(accept('0', 0), or(accept('1', 1),accept('2', 2))) - - // TODO: how can parserIdiom(curry2(_)) be omitted? + + // TODO: how can parserIdiom(curry2(_)) be omitted? def expr: Parser[Expr] = parserIdiomFun(curry2(Plus)) <| num <> num |> - + implicit def curry2[s,t,u](fun: (s, t)=>u)(a: s)(b: t) = fun(a, b) - implicit def curry3[r,s,t,u](fun: (r,s, t)=>u)(a: r)(b: s)(c: t) = fun(a, b, c) + implicit def curry3[r,s,t,u](fun: (r,s, t)=>u)(a: r)(b: s)(c: t) = fun(a, b, c) } object Test extends ParserIdioms with App { diff --git a/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala index c6eda56776..4e00e72658 100644 --- a/test/files/run/test-cpp.scala +++ b/test/files/run/test-cpp.scala @@ -3,11 +3,11 @@ * in the copy-propagation performed before ClosureElimination. * * In the general case, the local variable 'l' is connected through - * an alias chain with other local variables and at the end of the + * an alias chain with other local variables and at the end of the * alias chain there may be a Value, call it 'v'. * * If 'v' is cheaper to access (it is a Deref(This) or Const(_)), then - * replace the instruction to load it from the cheaper place. + * replace the instruction to load it from the cheaper place. * Otherwise, we use the local variable at the end of the alias chain * instead of 'l'. */ @@ -20,8 +20,8 @@ object Test extends IcodeComparison { import scala.util.Random._ -/** - * The example in the bug report (Issue-5321): an alias chain which store +/** + * The example in the bug report (Issue-5321): an alias chain which store * an Unknown. Should remove local variable 'y'. */ object TestBugReport { @@ -42,20 +42,20 @@ object TestSetterInline { } -/** +/** * The access of the local variable 'y' should be replaced by the * constant. - */ + */ object TestAliasChainConstat { def main(args: Array[String]): Unit = { val x = 2 val y = x - println(y) + println(y) } } -/** +/** * At the end of the alias chain we have a reference to 'this'. * The local variables should be all discarded and replace by a * direct reference to this @@ -72,7 +72,7 @@ class TestAliasChainDerefThis { /** * At the end of the alias chain, there is the value of a field. * The use of variable 'y' should be replaced by 'x', not by an access - * to the field 'f' since it is more costly. + * to the field 'f' since it is more costly. */ object TestAliasChainDerefField { def f = nextInt @@ -86,7 +86,7 @@ object TestAliasChainDerefField { /** - * The first time 'println' is called, 'x' is replaced by 'y' + * The first time 'println' is called, 'x' is replaced by 'y' * and the second time, 'y' is replaced by 'x'. But none of them * can be removed. */ diff --git a/test/files/run/trait-renaming/A_1.scala b/test/files/run/trait-renaming/A_1.scala index 2c3d4f566f..d0fab7bfc3 100644 --- a/test/files/run/trait-renaming/A_1.scala +++ b/test/files/run/trait-renaming/A_1.scala @@ -9,7 +9,7 @@ package bippy { } new B with C { } } - + def g = Class.forName("bippy.A$B$1$class") } } diff --git a/test/files/run/transform.scala b/test/files/run/transform.scala index 82f924950d..d73155ceec 100644 --- a/test/files/run/transform.scala +++ b/test/files/run/transform.scala @@ -1,6 +1,6 @@ object Test { val x = (1 to 10).toBuffer - + def main(args: Array[String]): Unit = { x transform (_ * 2) assert(x.sum == (1 to 10).sum * 2) diff --git a/test/files/run/transpose.scala b/test/files/run/transpose.scala index 3bea74b365..2761a24ff5 100644 --- a/test/files/run/transpose.scala +++ b/test/files/run/transpose.scala @@ -1,8 +1,8 @@ object Test { - def wrap[T >: Null](body: => T) = + def wrap[T >: Null](body: => T) = try body catch { case _: IllegalArgumentException => null } - + def main(args: Array[String]): Unit = { assert(wrap(Nil.transpose) == Nil) assert(wrap(List(List(1, 2), List(1)).transpose) == null) diff --git a/test/files/run/triemap-hash.scala b/test/files/run/triemap-hash.scala index 7f19997da0..f9913816d4 100644 --- a/test/files/run/triemap-hash.scala +++ b/test/files/run/triemap-hash.scala @@ -6,41 +6,41 @@ import util.hashing.Hashing object Test { - + def main(args: Array[String]) { hashing() equality() } - + def hashing() { import collection._ - + val tm = new concurrent.TrieMap[String, String](Hashing.fromFunction(x => x.length + x(0).toInt), Equiv.universal) tm.put("a", "b") tm.put("c", "d") - + assert(tm("a") == "b") assert(tm("c") == "d") - + for (i <- 0 until 1000) tm(i.toString) = i.toString for (i <- 0 until 1000) assert(tm(i.toString) == i.toString) } - + def equality() { import collection._ - + val tm = new concurrent.TrieMap[String, String](Hashing.fromFunction(x => x(0).toInt), Equiv.fromFunction(_(0) == _(0))) tm.put("a", "b") tm.put("a1", "d") tm.put("b", "c") - + assert(tm("a") == "d", tm) assert(tm("b") == "c", tm) - + for (i <- 0 until 1000) tm(i.toString) = i.toString assert(tm.size == 12, tm) assert(tm("0") == "0", tm) for (i <- 1 to 9) assert(tm(i.toString) == i.toString + "99", tm) } - + } diff --git a/test/files/run/triple-quoted-expr.scala b/test/files/run/triple-quoted-expr.scala index 0b30946de2..6d91ac5888 100644 --- a/test/files/run/triple-quoted-expr.scala +++ b/test/files/run/triple-quoted-expr.scala @@ -1,18 +1,18 @@ class A { def f1 = { val x = 5 - + """ hi""" } def f2 = { val x = 5 - + """hi""" - } + } def f3 = { val x = 5 - + "\nhi" } } diff --git a/test/files/run/tuple-match.scala b/test/files/run/tuple-match.scala index 57ba9cf6e1..fcaefbff5b 100644 --- a/test/files/run/tuple-match.scala +++ b/test/files/run/tuple-match.scala @@ -1,7 +1,7 @@ object Test { val FOUR = (-1, -2, -3, "bingo donkey vegas") val THREE = (-1, -2, -3) - + def f(x: Any) = x match { case FOUR => "FOUR" case (_, _, 3, _) => "4, #3" @@ -13,7 +13,7 @@ object Test { case (_, 2) => "2, #2" case _ => "default" } - + def main(args: Array[String]): Unit = { println(f((1, 2, 3, 4))) println(f((1, 2, 30, 4))) diff --git a/test/files/run/tuple-zipped.scala b/test/files/run/tuple-zipped.scala index c8ba41f042..37ac52977f 100644 --- a/test/files/run/tuple-zipped.scala +++ b/test/files/run/tuple-zipped.scala @@ -11,32 +11,31 @@ object Test { val as1 = 1 to 100 toArray val as2 = as1.view val as3 = as1 take 10 - + def xss1 = List[Seq[Int]](xs1, xs2, xs3, ss1, ss2, ss3, as1, as2, as3) def xss2 = List[Seq[Int]](xs1, xs2, xs3, ss3, as1, as2, as3) // no infinities def xss3 = List[Seq[Int]](xs2, xs3, ss3, as1) // representative sampling - + def main(args: Array[String]): Unit = { for (cc1 <- xss1 ; cc2 <- xss2) { val sum1 = (cc1, cc2).zipped map { case (x, y) => x + y } sum val sum2 = (cc1, cc2).zipped map (_ + _) sum - + assert(sum1 == sum2) } - + for (cc1 <- xss1 ; cc2 <- xss2 ; cc3 <- xss3) { val sum1 = (cc1, cc2, cc3).zipped map { case (x, y, z) => x + y + z } sum val sum2 = (cc1, cc2, cc3).zipped map (_ + _ + _) sum - + assert(sum1 == sum2) } - + assert((ss1, ss1).zipped exists ((x, y) => true)) assert((ss1, ss1, ss1).zipped exists ((x, y, z) => true)) - + assert(!(ss1, ss2, 1 to 3).zipped.exists(_ + _ + _ > 100000)) assert((1 to 3, ss1, ss2).zipped.forall(_ + _ + _ > 0)) assert((ss1, 1 to 3, ss2).zipped.map(_ + _ + _).size == 3) } } - diff --git a/test/files/run/type-currying.scala b/test/files/run/type-currying.scala index 5e31fef403..e10f8fc9f1 100644 --- a/test/files/run/type-currying.scala +++ b/test/files/run/type-currying.scala @@ -36,10 +36,10 @@ object Test { val immutableBippy = Partial[immutable.HashMap].values[Int] def make[T](xs: T*) = immutableBippy[T] ++ xs.zipWithIndex - + val n0 = Partial[immutable.HashMap][String][Int] ++ Seq(("a", 1)) val n1 = Partial.apply[immutable.HashMap].apply[String].apply[Int] ++ Seq(("a", 1)) - + def main(args: Array[String]): Unit = { println(mutableBippy) make('a' to 'z': _*).toList.sorted foreach println diff --git a/test/files/run/typealias_overriding.scala b/test/files/run/typealias_overriding.scala index 8a2d1312ab..4b6a0037ec 100644 --- a/test/files/run/typealias_overriding.scala +++ b/test/files/run/typealias_overriding.scala @@ -1,21 +1,21 @@ // this bug (http://scala-webapps.epfl.ch/bugtracking/bugs/displayItem.do?id=1065) -// was caused by Uncurry not normalizing all the types +// was caused by Uncurry not normalizing all the types // (more specifically the argument/return types of an anonymous Function) object Test extends App { trait AddRemove { type TNode <: NodeImpl; trait NodeImpl; - + object removing { type TNode = AddRemove.this.TNode; def printNode(node: TNode, f: TNode => String) = Console.println(f(node)) } } - + class Linked extends AddRemove { type TNode = Node // can also directly write `class Node extends super.NodeImpl' -- doesn't change the bug class Node extends super.NodeImpl { override def toString = "LinkedNode" } - + removing.printNode(new Node, (x: removing.TNode) => x.toString) // make inference explicit, doesn't affect the bug } diff --git a/test/files/run/unapply.scala b/test/files/run/unapply.scala index 90dd4fae73..0c5a70e768 100644 --- a/test/files/run/unapply.scala +++ b/test/files/run/unapply.scala @@ -22,7 +22,7 @@ object Faa { def unapply(x: Any): Option[String] = if(x.isInstanceOf[Bar]) Some(x.asInstanceOf[Bar].name) else None } object FaaPrecise { - def unapply(x: Bar): Option[String] = Some(x.name) + def unapply(x: Bar): Option[String] = Some(x.name) } object FaaPreciseSome { def unapply(x: Bar) = Some(x.name) // return type Some[String] @@ -108,14 +108,14 @@ object Test1256 { class Sync { def unapply(scrut: Any): Boolean = false } - + class Buffer { val Get = new Sync val jp: PartialFunction[Any, Any] = { case Get() => } } - + def run() { assert(!(new Buffer).jp.isDefinedAt(42)) } diff --git a/test/files/run/unittest_collection.scala b/test/files/run/unittest_collection.scala index 3639b496b3..822e2b0c98 100644 --- a/test/files/run/unittest_collection.scala +++ b/test/files/run/unittest_collection.scala @@ -12,7 +12,7 @@ object Test { } def test(x: Buffer[String]) { - // testing method += + // testing method += x += "one" assert(x(0) == "one", "retrieving 'one'") assert(x.length == 1, "length A") @@ -25,10 +25,10 @@ object Test { assert(x.length == 1, "length C") - try { x(1); sys.error("no exception for removed element") } + try { x(1); sys.error("no exception for removed element") } catch { case i:IndexOutOfBoundsException => } - try { x.remove(1); sys.error("no exception for removed element") } + try { x.remove(1); sys.error("no exception for removed element") } catch { case i:IndexOutOfBoundsException => } x += "two2" diff --git a/test/files/run/unittest_iterator.scala b/test/files/run/unittest_iterator.scala index 89ccdb9d58..21dc64c3c5 100644 --- a/test/files/run/unittest_iterator.scala +++ b/test/files/run/unittest_iterator.scala @@ -1,5 +1,5 @@ // Some iterator grouped/sliding unit tests -object Test { +object Test { def it = (1 to 10).iterator def assertThat[T](expectedLength: Int, expectedLast: Seq[T])(it: Iterator[Seq[T]]) { val xs = it.toList @@ -7,15 +7,15 @@ object Test { assert(xs.size == expectedLength, fail("expected length " + expectedLength)) assert(xs.last == expectedLast, fail("expected last " + expectedLast)) } - + def main(args: Array[String]): Unit = { val itSum = it.toStream.sum for (i <- it) { // sum of the groups == sum of the original val thisSum = ((it grouped i) map (_.sum)).toStream.sum - assert(thisSum == itSum, thisSum + " != " + itSum) + assert(thisSum == itSum, thisSum + " != " + itSum) } - + // grouped assertThat(4, List(10)) { it grouped 3 } assertThat(3, List(7, 8, 9)) { it grouped 3 withPartial false } @@ -32,11 +32,11 @@ object Test { assertThat(1, (1 to 8).toList) { it.sliding(8, 8) withPartial false } assertThat(2, List(9, 10, -1, -1, -1)) { it.sliding(5, 8) withPadding -1 } assertThat(1, (1 to 5).toList) { it.sliding(5, 8) withPartial false } - + // larger step than window assertThat(5, List(9)) { it.sliding(1, 2) } assertThat(3, List(9, 10)) { it.sliding(2, 4) } - + // make sure it throws past the end val thrown = try { val it = List(1,2,3).sliding(2) diff --git a/test/files/run/unreachable.scala b/test/files/run/unreachable.scala index 99ac730746..bb907c92bf 100644 --- a/test/files/run/unreachable.scala +++ b/test/files/run/unreachable.scala @@ -66,7 +66,7 @@ object Test extends App { return 42 } catch { case x: Throwable => return 2 - } + } return 3 } @@ -75,7 +75,7 @@ object Test extends App { error("haha") } catch { case x: Throwable => return 42 - } + } return 3 } diff --git a/test/files/run/vector1.scala b/test/files/run/vector1.scala index 2e335aded4..d536183961 100644 --- a/test/files/run/vector1.scala +++ b/test/files/run/vector1.scala @@ -9,7 +9,7 @@ import scala.collection.mutable.Builder object Test { - + def vector(label: String, n: Int): Vector[String] = { val a = new VectorBuilder[String] for (i <- 0 until n) @@ -67,7 +67,7 @@ object Test { def test1() = { println("===== test1 =====") - + val N = 150000 val a = vector("a", N) val b = vectorForward("b", N) @@ -81,22 +81,22 @@ object Test { println("===== test2 =====") var a: Vector[String] = Vector.empty - + val rand = new java.util.Random - + val N = 150000 var min = N/2//rand.nextInt(N) var max = min - + val chunkLimit = 11 - + def nextChunkSize = 3 //rand.nextInt(chunkLimit) - + def seqBack() = for (i <- 0 until Math.min(nextChunkSize, N-max)) { a = a :+ ("a"+max); max += 1 } def seqFront() = for (i <- 0 until Math.min(nextChunkSize, min)) { min -= 1; a = ("a"+min) +: a } - + try { - + while (min > 0 || max < N) { seqFront() seqBack() @@ -107,7 +107,7 @@ object Test { //a.debug throw ex } - + assertVector(a, "a", 0, N) } @@ -122,14 +122,14 @@ object Test { val pos = scala.util.Random.shuffle(scala.collection.mutable.WrappedArray.make[Int](Array.tabulate[Int](N)(i => i))) var b = a - + { var i = 0 while (i < N) { b = b.updated(pos(i), "b"+(pos(i))) i += 1 } - + assertVector(b, "b", 0, N) } diff --git a/test/files/run/view-headoption.scala b/test/files/run/view-headoption.scala index 629b974c19..659c7e6b82 100644 --- a/test/files/run/view-headoption.scala +++ b/test/files/run/view-headoption.scala @@ -2,13 +2,13 @@ object Test { val failer = () => { println("fail") ; None } val succeeder = () => { println("success") ; Some(5) } val fs = List(failer, succeeder, failer, failer, succeeder, failer, failer, failer, succeeder) - + def f0 = fs.view flatMap (f => f()) def f1 = f0.headOption def f2 = f0.head def f3 = f0.lastOption def f4 = f0.last - + def main(args: Array[String]): Unit = { println("f1: " + f1) println("f2: " + f2) diff --git a/test/files/run/view-iterator-stream.scala b/test/files/run/view-iterator-stream.scala index c172b5cb99..0e0c42d7d3 100644 --- a/test/files/run/view-iterator-stream.scala +++ b/test/files/run/view-iterator-stream.scala @@ -21,7 +21,7 @@ object Test { } def and(g: Perturber): Perturber = new Perturber(this.labels ++ g.labels, f andThen g.f) - + override def toString = labels mkString " -> " } object Perturber { @@ -42,14 +42,14 @@ object Test { "slice(%d, %d)".format(from, until), _.toTraversable.slice(from, until) ) - + val fns = List[Perturber](toV, toI, toS, toIS) def tds(n: Int): Perturber = p(drop(n), take(n / 2), slice(1, n / 4)) def dts(n: Int): Perturber = p(take(n), drop(n / 2), slice(1, n / 4)) def sdt(n: Int): Perturber = p(slice(n, n * 2), drop(n / 2), take(n / 4)) def std(n: Int): Perturber = p(slice(n, n * 2), take(n / 2), drop(n / 4)) - + val transforms = (fns.permutations map (xs => p(xs take 3: _*))).toList.distinct def mkOps(n: Int) = List[Perturber](tds(n), dts(n), sdt(n), std(n)) def runOps(n: Int) = { @@ -63,7 +63,7 @@ object Test { } () } - + def main(args: Array[String]): Unit = { runOps(20) } diff --git a/test/files/run/viewtest.scala b/test/files/run/viewtest.scala index bb2c28d68a..581958e9a6 100755 --- a/test/files/run/viewtest.scala +++ b/test/files/run/viewtest.scala @@ -25,8 +25,8 @@ object Test extends App { 2.8 regression: CCE when zipping list projection with stream Reported by: szeiger Owned by: odersky Priority: normal Component: Standard Library -Keywords: collections, zip Cc: -Fixed in version: +Keywords: collections, zip Cc: +Fixed in version: Description Welcome to Scala version 2.8.0.r18784-b20090925021043 (Java HotSpot(TM) Client VM, Java 1.6.0_11). diff --git a/test/files/run/virtpatmat_apply.scala b/test/files/run/virtpatmat_apply.scala index 34cb80e449..b8776f4afb 100644 --- a/test/files/run/virtpatmat_apply.scala +++ b/test/files/run/virtpatmat_apply.scala @@ -1,5 +1,5 @@ object Test extends App { - List(1, 2, 3) match { + List(1, 2, 3) match { case Nil => println("FAIL") case x :: y :: xs if xs.length == 2 => println("FAIL") case x :: y :: xs if xs.length == 1 => println("OK "+ y) diff --git a/test/files/run/virtpatmat_casting.scala b/test/files/run/virtpatmat_casting.scala index 22ac29bc3b..a36daec6fb 100644 --- a/test/files/run/virtpatmat_casting.scala +++ b/test/files/run/virtpatmat_casting.scala @@ -1,7 +1,7 @@ object Test extends App { - println(List(1,2,3) match { - case Nil => List(0) -// since the :: extractor's argument must be a ::, there has to be a cast before its unapply is invoked + println(List(1,2,3) match { + case Nil => List(0) +// since the :: extractor's argument must be a ::, there has to be a cast before its unapply is invoked case x :: y :: z :: a :: xs => xs ++ List(x) case x :: y :: z :: xs => xs ++ List(x) case _ => List(0) diff --git a/test/files/run/virtpatmat_literal.scala b/test/files/run/virtpatmat_literal.scala index 5bd6b30791..9a68d296b5 100644 --- a/test/files/run/virtpatmat_literal.scala +++ b/test/files/run/virtpatmat_literal.scala @@ -1,22 +1,22 @@ object Test extends App { val a = 1 - 1 match { - case 2 => println("FAILED") - case 1 => println("OK") - case `a` => println("FAILED") + 1 match { + case 2 => println("FAILED") + case 1 => println("OK") + case `a` => println("FAILED") } val one = 1 - 1 match { - case 2 => println("FAILED") - case `one` => println("OK") - case 1 => println("FAILED") + 1 match { + case 2 => println("FAILED") + case `one` => println("OK") + case 1 => println("FAILED") } - 1 match { - case 2 => println("FAILED") - case Test.one => println("OK") - case 1 => println("FAILED") + 1 match { + case 2 => println("FAILED") + case Test.one => println("OK") + case 1 => println("FAILED") } }
\ No newline at end of file diff --git a/test/files/run/virtpatmat_switch.scala b/test/files/run/virtpatmat_switch.scala index 1329c19d0f..2f2e210d9e 100644 --- a/test/files/run/virtpatmat_switch.scala +++ b/test/files/run/virtpatmat_switch.scala @@ -4,11 +4,11 @@ object Test extends App { case 1 => "one" case _ => "many" } - + println(intSwitch(0)) println(intSwitch(1)) println(intSwitch(10)) - + def charSwitch(x: Char) = x match { case 'a' => "got a" case 'b' => "got b" @@ -20,15 +20,15 @@ object Test extends App { case 'b' => "got b" case _ => "got some letter" } - + println(charSwitch('a')) println(byteSwitch('b')) println(charSwitch('z')) - + def implicitDefault(x: Int) = x match { case 0 => 0 } - + try { implicitDefault(5) } catch { diff --git a/test/files/run/virtpatmat_typed.check b/test/files/run/virtpatmat_typed.check index 9924d84148..b304fa5ffc 100644 --- a/test/files/run/virtpatmat_typed.check +++ b/test/files/run/virtpatmat_typed.check @@ -1,4 +1,4 @@ virtpatmat_typed.scala:5: warning: unreachable code - case x: String => println("FAILED") + case x: String => println("FAILED") ^ OK foo diff --git a/test/files/run/virtpatmat_typed.scala b/test/files/run/virtpatmat_typed.scala index a9863cc48a..cdd6d3c749 100644 --- a/test/files/run/virtpatmat_typed.scala +++ b/test/files/run/virtpatmat_typed.scala @@ -1,7 +1,7 @@ object Test extends App { - ("foo": Any) match { - case x: Int => println("FAILED") - case x: String => println("OK "+ x) - case x: String => println("FAILED") + ("foo": Any) match { + case x: Int => println("FAILED") + case x: String => println("OK "+ x) + case x: String => println("FAILED") } }
\ No newline at end of file diff --git a/test/files/run/virtpatmat_unapply.scala b/test/files/run/virtpatmat_unapply.scala index 6d7b4dbe68..a6e71f3963 100644 --- a/test/files/run/virtpatmat_unapply.scala +++ b/test/files/run/virtpatmat_unapply.scala @@ -6,12 +6,12 @@ object IntList { } object Test extends App { - IntList(1, IntList(2, NilIL)) match { + IntList(1, IntList(2, NilIL)) match { case IntList(a1, IntList(a2, IntList(a3, y))) => println(a1 + a2 + a3) case IntList(x, y) => println(x) } - IntList(1, IntList(2, IntList(3, NilIL))) match { + IntList(1, IntList(2, IntList(3, NilIL))) match { case IntList(a1, IntList(a2, IntList(a3, y))) => println(a1 + a2 + a3) case IntList(x, y) => println(x) } @@ -20,12 +20,12 @@ object Test extends App { // ((x1: IntList) => IntList.unapply(x1).flatMap(((x4: (Int, IntList)) => IntList.unapply(x4._2).flatMap(((x5: (Int, IntList)) => IntList.unapply(x5._2).flatMap(((x6: (Int, IntList)) => implicitly[Predef.MatchingStrategy[Option]].success(Predef.println(x4._1.+(x5._1).+(x6._1))))))))).orElse(IntList.unapply(x1).flatMap(((x7: (Int, IntList)) => implicitly[scala.Predef.MatchingStrategy[Option]].success(Predef.println(x7._1))))).orElse(implicitly[scala.Predef.MatchingStrategy[Option]].fail))(IntList.apply(1, IntList.apply(2, IntList.apply(3, null)))) /* - ((x1: IntList) => - IntList.this.unapply(x1).flatMap[Int](((x4: (Int, IntList)) => - IntList.this.unapply(x4._2).flatMap[Int](((x5: (Int, IntList)) => - IntList.this.unapply(x5._2).flatMap[Int](((x6: (Int, IntList)) => + ((x1: IntList) => + IntList.this.unapply(x1).flatMap[Int](((x4: (Int, IntList)) => + IntList.this.unapply(x4._2).flatMap[Int](((x5: (Int, IntList)) => + IntList.this.unapply(x5._2).flatMap[Int](((x6: (Int, IntList)) => Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).success[Int](x6._1))))))).orElse[Int]( - IntList.this.unapply(x1).flatMap[Int](((x7: (Int, IntList)) => + IntList.this.unapply(x1).flatMap[Int](((x7: (Int, IntList)) => Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).success[Int](x7._1)))).orElse[Int]( Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).fail) ).apply(IntList.apply(1, null)) diff --git a/test/files/scalacheck/Ctrie.scala b/test/files/scalacheck/Ctrie.scala index 736bf938bc..714f1c3b09 100644 --- a/test/files/scalacheck/Ctrie.scala +++ b/test/files/scalacheck/Ctrie.scala @@ -17,21 +17,21 @@ case class Wrap(i: Int) { /** A check mainly oriented towards checking snapshot correctness. */ object Test extends Properties("concurrent.TrieMap") { - + /* generators */ - + val sizes = choose(0, 200000) - + val threadCounts = choose(2, 16) - + val threadCountsAndSizes = for { p <- threadCounts sz <- sizes } yield (p, sz); - - + + /* helpers */ - + def inParallel[T](totalThreads: Int)(body: Int => T): Seq[T] = { val threads = for (idx <- 0 until totalThreads) yield new Thread { setName("ParThread-" + idx) @@ -44,11 +44,11 @@ object Test extends Properties("concurrent.TrieMap") { res } } - + threads foreach (_.start()) threads map (_.result) } - + def spawn[T](body: =>T): { def get: T } = { val t = new Thread { setName("SpawnThread") @@ -66,7 +66,7 @@ object Test extends Properties("concurrent.TrieMap") { } } } - + def elementRange(threadIdx: Int, totalThreads: Int, totalElems: Int): Range = { val sz = totalElems val idx = threadIdx @@ -76,7 +76,7 @@ object Test extends Properties("concurrent.TrieMap") { val end = start + elems (start until end) } - + def hasGrown[K, V](last: Map[K, V], current: Map[K, V]) = { (last.size <= current.size) && { last forall { @@ -84,7 +84,7 @@ object Test extends Properties("concurrent.TrieMap") { } } } - + object err { var buffer = new StringBuilder def println(a: AnyRef) = buffer.append(a.toString).append("\n") @@ -94,16 +94,16 @@ object Test extends Properties("concurrent.TrieMap") { clear() } } - - + + /* properties */ - + property("concurrent growing snapshots") = forAll(threadCounts, sizes) { (numThreads, numElems) => val p = 3 //numThreads val sz = 102 //numElems val ct = new TrieMap[Wrap, Int] - + // checker val checker = spawn { def check(last: Map[Wrap, Int], iterationsLeft: Int): Boolean = { @@ -115,23 +115,23 @@ object Test extends Properties("concurrent.TrieMap") { } check(ct.readOnlySnapshot(), 500) } - + // fillers inParallel(p) { idx => elementRange(idx, p, sz) foreach (i => ct.update(Wrap(i), i)) } - + // wait for checker to finish val growing = true//checker.get - + val ok = growing && ((0 until sz) forall { case i => ct.get(Wrap(i)) == Some(i) }) - + ok } - + property("update") = forAll(sizes) { (n: Int) => val ct = new TrieMap[Int, Int] @@ -140,52 +140,52 @@ object Test extends Properties("concurrent.TrieMap") { case i => ct(i) == i } } - + property("concurrent update") = forAll(threadCountsAndSizes) { case (p, sz) => val ct = new TrieMap[Wrap, Int] - + inParallel(p) { idx => for (i <- elementRange(idx, p, sz)) ct(Wrap(i)) = i } - + (0 until sz) forall { case i => ct(Wrap(i)) == i } } - - + + property("concurrent remove") = forAll(threadCounts, sizes) { (p, sz) => val ct = new TrieMap[Wrap, Int] for (i <- 0 until sz) ct(Wrap(i)) = i - + inParallel(p) { idx => for (i <- elementRange(idx, p, sz)) ct.remove(Wrap(i)) } - + (0 until sz) forall { case i => ct.get(Wrap(i)) == None } } - - + + property("concurrent putIfAbsent") = forAll(threadCounts, sizes) { (p, sz) => val ct = new TrieMap[Wrap, Int] - + val results = inParallel(p) { idx => elementRange(idx, p, sz) find (i => ct.putIfAbsent(Wrap(i), i) != None) } - + (results forall (_ == None)) && ((0 until sz) forall { case i => ct.get(Wrap(i)) == Some(i) }) } - + } diff --git a/test/files/scalacheck/Unrolled.scala b/test/files/scalacheck/Unrolled.scala index 8067a44501..34604b8667 100644 --- a/test/files/scalacheck/Unrolled.scala +++ b/test/files/scalacheck/Unrolled.scala @@ -5,7 +5,7 @@ import Gen._ import collection.mutable.UnrolledBuffer object Test extends Properties("UnrolledBuffer") { - + property("concat size") = forAll { (l1: List[Int], l2: List[Int]) => val u1 = new UnrolledBuffer[Int] u1 ++= l1 @@ -15,12 +15,12 @@ object Test extends Properties("UnrolledBuffer") { u1 concat u2 totalsz == u1.size } - + property("adding") = forAll { (l: List[Int]) => val u = new UnrolledBuffer[Int] u ++= l u == l } - + } diff --git a/test/files/scalacheck/array-old.scala b/test/files/scalacheck/array-old.scala index f262bc6320..03c0217180 100644 --- a/test/files/scalacheck/array-old.scala +++ b/test/files/scalacheck/array-old.scala @@ -11,7 +11,7 @@ object Test extends Properties("Array") { */ implicit def arbArray[T](implicit a: Arbitrary[T], m: Manifest[T]): Arbitrary[Array[T]] = Arbitrary(containerOf[List,T](arbitrary[T]) map (_.toArray)) - + val arrGen: Gen[Array[_]] = oneOf( arbitrary[Array[Int]], arbitrary[Array[Array[Int]]], @@ -20,7 +20,7 @@ object Test extends Properties("Array") { arbitrary[Array[Boolean]], arbitrary[Array[AnyVal]] ) - + // inspired by #1857 and #2352 property("eq/ne") = forAll(arrGen, arrGen) { (c1, c2) => (c1 eq c2) || (c1 ne c2) @@ -32,6 +32,6 @@ object Test extends Properties("Array") { val arr = Array.ofDim[String](i1, i2, i3) val flattened = arr flatMap (x => x) flatMap (x => x) flattened.length == i1 * i2 * i3 - } + } } diff --git a/test/files/scalacheck/avl.scala b/test/files/scalacheck/avl.scala index 02003bd271..4cfacaf407 100644 --- a/test/files/scalacheck/avl.scala +++ b/test/files/scalacheck/avl.scala @@ -52,7 +52,7 @@ package scala.collection.mutable { } yield { // selected mustn't be in elements already val list = makeAllBalancedTree(elements.sorted.distinct.map(_*2)) - (selected*2+1, list) + (selected*2+1, list) } def genInputDelete: org.scalacheck.Gen[(Int, List[AVLTree[Int]])] = for { @@ -63,7 +63,7 @@ package scala.collection.mutable { } yield { // selected must be in elements already val list = makeAllBalancedTree(e) - (e(selected), list) + (e(selected), list) } } @@ -76,7 +76,7 @@ package scala.collection.mutable { } def setup(invariant: AVLTree[Int] => Boolean) = forAll(genInput) { - case (selected: Int, trees: List[AVLTree[Int]]) => + case (selected: Int, trees: List[AVLTree[Int]]) => trees.map(tree => invariant(tree)).fold(true)((a, b) => a && b) } diff --git a/test/files/scalacheck/list.scala b/test/files/scalacheck/list.scala index 4e1cf1fc80..5f6de95237 100644 --- a/test/files/scalacheck/list.scala +++ b/test/files/scalacheck/list.scala @@ -12,7 +12,7 @@ object Test extends Properties("List") { property("startsWith/take") = forAll { (xs: List[Int], count: Int) => xs startsWith (xs take count) } property("endsWith/takeRight") = forAll { (xs: List[Int], count: Int) => xs endsWith (xs takeRight count) } property("fill") = forAll(choose(1, 100)) { count => - forAll { (x: Int) => + forAll { (x: Int) => val xs = List.fill(count)(x) (xs.length == count) && (xs.distinct == List(x)) } diff --git a/test/files/scalacheck/parallel-collections/IntOperators.scala b/test/files/scalacheck/parallel-collections/IntOperators.scala index 5c997962ba..4a74b91da8 100644 --- a/test/files/scalacheck/parallel-collections/IntOperators.scala +++ b/test/files/scalacheck/parallel-collections/IntOperators.scala @@ -106,7 +106,7 @@ trait IntSeqOperators extends IntOperators with SeqOperators[Int] { List(4, 5, 6, 7, 8, 9, 10), List(4, 5, 6, 7, 8, 9, 0), List(-4, -3, -2, -1) - ) + ) } diff --git a/test/files/scalacheck/parallel-collections/PairOperators.scala b/test/files/scalacheck/parallel-collections/PairOperators.scala index 4711e21c34..fe851114be 100644 --- a/test/files/scalacheck/parallel-collections/PairOperators.scala +++ b/test/files/scalacheck/parallel-collections/PairOperators.scala @@ -7,76 +7,76 @@ import scala.collection.parallel._ trait PairOperators[K, V] extends Operators[(K, V)] { def koperators: Operators[K] def voperators: Operators[V] - + private def zipPredicates(kps: List[K => Boolean], vps: List[V => Boolean]): List[((K, V)) => Boolean] = for { (kp, vp) <- koperators.countPredicates zip voperators.countPredicates } yield new Function1[(K, V), Boolean] { def apply(kv: (K, V)) = kp(kv._1) && vp(kv._2) } - + /* operators */ - + def reduceOperators = for { (kop, vop) <- koperators.reduceOperators zip voperators.reduceOperators } yield new Function2[(K, V), (K, V), (K, V)] { def apply(kv1: (K, V), kv2: (K, V)) = (kop(kv1._1, kv2._1), vop(kv1._2, kv2._2)) } - + def countPredicates = zipPredicates(koperators.countPredicates, voperators.countPredicates) - + def forallPredicates = zipPredicates(koperators.forallPredicates, voperators.forallPredicates) - + def existsPredicates = zipPredicates(koperators.existsPredicates, voperators.existsPredicates) - + def findPredicates = zipPredicates(koperators.findPredicates, voperators.findPredicates) - + def mapFunctions = for { (km, vm) <- koperators.mapFunctions zip voperators.mapFunctions } yield new Function1[(K, V), (K, V)] { def apply(kv: (K, V)) = (km(kv._1), vm(kv._2)) } - + def partialMapFunctions = for { (kpm, vpm) <- koperators.partialMapFunctions zip voperators.partialMapFunctions } yield new PartialFunction[(K, V), (K, V)] { def isDefinedAt(kv: (K, V)) = kpm.isDefinedAt(kv._1) && vpm.isDefinedAt(kv._2) def apply(kv: (K, V)) = (kpm(kv._1), vpm(kv._2)) } - + def flatMapFunctions = for { (kfm, vfm) <- koperators.flatMapFunctions zip voperators.flatMapFunctions } yield new Function1[(K, V), Traversable[(K, V)]] { def apply(kv: (K, V)) = kfm(kv._1).toIterable zip vfm(kv._2).toIterable } - + def filterPredicates = zipPredicates(koperators.filterPredicates, voperators.filterPredicates) - + def filterNotPredicates = filterPredicates - + def partitionPredicates = filterPredicates - + def takeWhilePredicates = zipPredicates(koperators.takeWhilePredicates, voperators.takeWhilePredicates) - + def dropWhilePredicates = takeWhilePredicates - + def spanPredicates = takeWhilePredicates - + def foldArguments = for { ((kinit, kop), (vinit, vop)) <- koperators.foldArguments zip voperators.foldArguments } yield ((kinit, vinit), new Function2[(K, V), (K, V), (K, V)] { def apply(kv1: (K, V), kv2: (K, V)) = (kop(kv1._1, kv2._1), vop(kv1._2, kv2._2)) }) - + def addAllTraversables = for { (kt, vt) <- koperators.addAllTraversables zip voperators.addAllTraversables } yield kt.toIterable zip vt.toIterable - + def newArray(sz: Int) = new Array[(K, V)](sz) - + def groupByFunctions = (koperators.groupByFunctions zip voperators.groupByFunctions) map { opt => { (p: (K, V)) => (opt._1(p._1), opt._2(p._2)) } } - + } diff --git a/test/files/scalacheck/parallel-collections/PairValues.scala b/test/files/scalacheck/parallel-collections/PairValues.scala index 5007c4598b..864dad2425 100644 --- a/test/files/scalacheck/parallel-collections/PairValues.scala +++ b/test/files/scalacheck/parallel-collections/PairValues.scala @@ -17,7 +17,7 @@ import org.scalacheck.Arbitrary._ trait PairValues[K, V] { def kvalues: Seq[Gen[K]] def vvalues: Seq[Gen[V]] - + def values = for { kg <- kvalues vg <- vvalues diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala b/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala index a01c8c7dbe..255c04498e 100644 --- a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala @@ -17,11 +17,11 @@ import scala.collection.parallel.ops._ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("ParArray[" + tp + "]") { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + type CollType = ParArray[T] - + def isCheckingViews = false - + def hasStrictOrder = true def ofSize(vals: Seq[Gen[T]], sz: Int) = { @@ -30,7 +30,7 @@ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("Pa for (i <- 0 until sz) a += sample(gen) a } - + def fromSeq(a: Seq[T]) = { val pa = new ParArray[T](a.size) var i = 0 @@ -40,20 +40,20 @@ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("Pa } pa } - + property("array mappings must be equal") = forAll(collectionPairs) { case (t, coll) => val results = for ((f, ind) <- mapFunctions.zipWithIndex) yield ("op index: " + ind) |: t.map(f) == coll.map(f) results.reduceLeft(_ && _) } - + } object IntParallelArrayCheck extends ParallelArrayCheck[Int]("Int") with IntSeqOperators with IntValues { override def instances(vals: Seq[Gen[Int]]) = oneOf(super.instances(vals), sized { sz => (0 until sz).toArray.toSeq - }, sized { sz => + }, sized { sz => (-sz until 0).toArray.toSeq }) } diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayTest.scala b/test/files/scalacheck/parallel-collections/ParallelArrayTest.scala index 680f6e1d28..db2b1ea01e 100644 --- a/test/files/scalacheck/parallel-collections/ParallelArrayTest.scala +++ b/test/files/scalacheck/parallel-collections/ParallelArrayTest.scala @@ -15,7 +15,7 @@ // /** // * this currently passes, but do we want it to? -// * does it have meaning to have an empty parallel array? +// * does it have meaning to have an empty parallel array? // */ // new ParallelArray(0) // () diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala b/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala index d2a8fa7c22..9805e2644f 100644 --- a/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala @@ -24,18 +24,18 @@ // extends ParallelSeqCheck[T]("ParallelSeqView[" + tp + ", ParallelArray[" + tp + "]]") { // // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + // type CollType = ParallelSeqView[T, ParallelArray[T], ArraySeq[T]] - + // def isCheckingViews = true - + // def instances(vals: Seq[Gen[T]]): Gen[Seq[T]] = sized { sz => // val a = new ArrayBuffer[T](sz) // val gen = vals(rnd.nextInt(vals.size)) // for (i <- 0 until sz) a += sample(gen) // a // } - + // def fromSeq(a: Seq[T]) = { // val pa = new ParallelArray[T](a.size) // var i = 0 @@ -45,13 +45,13 @@ // } // pa.view // } - + // property("forces must be equal") = forAll(collectionPairs) { case (s, coll) => // val smodif = (s ++ s).reverse.take(s.length).reverse.zip(s).drop(s.length / 2) // val cmodif = (coll ++ s).reverse.take(s.length).reverse.zip(s).drop(s.length / 2).force // smodif == cmodif // } - + // } @@ -68,18 +68,18 @@ // extends ParallelSeqCheck[T]("ParallelSeqView[" + tp + "], ParallelArray[" + tp + "].++.patch.reverse.take.reverse") { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + // type CollType = collection.parallel.ParallelSeq[T] - + // def isCheckingViews = true - + // def instances(vals: Seq[Gen[T]]): Gen[Seq[T]] = sized { sz => // val a = new ArrayBuffer[T](sz) // val gen = vals(rnd.nextInt(vals.size)) // for (i <- 0 until sz) a += sample(gen) // a // } - + // def fromSeq(a: Seq[T]) = { // val pa = new ParallelArray[T](a.size) // var i = 0 @@ -91,7 +91,7 @@ // val original = modified.take(modified.length / 2).reverse // original // } - + // } diff --git a/test/files/scalacheck/parallel-collections/ParallelCtrieCheck.scala b/test/files/scalacheck/parallel-collections/ParallelCtrieCheck.scala index e141c398fd..b952704af2 100644 --- a/test/files/scalacheck/parallel-collections/ParallelCtrieCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelCtrieCheck.scala @@ -18,20 +18,20 @@ import scala.collection.parallel.ops._ abstract class ParallelConcurrentTrieMapCheck[K, V](tp: String) extends ParallelMapCheck[K, V]("mutable.ParConcurrentTrieMap[" + tp + "]") { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + type CollType = ParTrieMap[K, V] - + def isCheckingViews = false - + def hasStrictOrder = false - def ofSize(vals: Seq[Gen[(K, V)]], sz: Int) = { + def ofSize(vals: Seq[Gen[(K, V)]], sz: Int) = { val ct = new concurrent.TrieMap[K, V] val gen = vals(rnd.nextInt(vals.size)) for (i <- 0 until sz) ct += sample(gen) ct } - + def fromTraversable(t: Traversable[(K, V)]) = { val pct = new ParTrieMap[K, V] var i = 0 @@ -41,7 +41,7 @@ abstract class ParallelConcurrentTrieMapCheck[K, V](tp: String) extends Parallel } pct } - + } @@ -52,22 +52,22 @@ with PairValues[Int, Int] def intvalues = new IntValues {} def kvalues = intvalues.values def vvalues = intvalues.values - + val intoperators = new IntOperators {} def voperators = intoperators def koperators = intoperators - + override def printDataStructureDebugInfo(ds: AnyRef) = ds match { case pm: ParTrieMap[k, v] => println("Mutable parallel ctrie") case _ => println("could not match data structure type: " + ds.getClass) } - + override def checkDataStructureInvariants(orig: Traversable[(Int, Int)], ds: AnyRef) = ds match { // case pm: ParHashMap[k, v] if 1 == 0 => // disabled this to make tests faster // val invs = pm.brokenInvariants - + // val containsall = (for ((k, v) <- orig) yield { // if (pm.asInstanceOf[ParHashMap[Int, Int]].get(k) == Some(v)) true // else { @@ -75,8 +75,8 @@ with PairValues[Int, Int] // false // } // }).foldLeft(true)(_ && _) - - + + // if (invs.isEmpty) containsall // else { // println("Invariants broken:\n" + invs.mkString("\n")) @@ -84,7 +84,7 @@ with PairValues[Int, Int] // } case _ => true } - + } diff --git a/test/files/scalacheck/parallel-collections/ParallelHashMapCheck.scala b/test/files/scalacheck/parallel-collections/ParallelHashMapCheck.scala index 0152b1b435..9299a201a1 100644 --- a/test/files/scalacheck/parallel-collections/ParallelHashMapCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelHashMapCheck.scala @@ -17,20 +17,20 @@ import scala.collection.parallel.ops._ abstract class ParallelHashMapCheck[K, V](tp: String) extends ParallelMapCheck[K, V]("mutable.ParHashMap[" + tp + "]") { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + type CollType = ParHashMap[K, V] - + def isCheckingViews = false - + def hasStrictOrder = false - def ofSize(vals: Seq[Gen[(K, V)]], sz: Int) = { + def ofSize(vals: Seq[Gen[(K, V)]], sz: Int) = { val hm = new mutable.HashMap[K, V] val gen = vals(rnd.nextInt(vals.size)) for (i <- 0 until sz) hm += sample(gen) hm } - + def fromTraversable(t: Traversable[(K, V)]) = { val phm = new ParHashMap[K, V] var i = 0 @@ -40,7 +40,7 @@ abstract class ParallelHashMapCheck[K, V](tp: String) extends ParallelMapCheck[K } phm } - + } @@ -51,22 +51,22 @@ with PairValues[Int, Int] def intvalues = new IntValues {} def kvalues = intvalues.values def vvalues = intvalues.values - + val intoperators = new IntOperators {} def voperators = intoperators def koperators = intoperators - + override def printDataStructureDebugInfo(ds: AnyRef) = ds match { case pm: ParHashMap[k, v] => println("Mutable parallel hash map\n" + pm.hashTableContents.debugInformation) case _ => println("could not match data structure type: " + ds.getClass) } - + override def checkDataStructureInvariants(orig: Traversable[(Int, Int)], ds: AnyRef) = ds match { // case pm: ParHashMap[k, v] if 1 == 0 => // disabled this to make tests faster // val invs = pm.brokenInvariants - + // val containsall = (for ((k, v) <- orig) yield { // if (pm.asInstanceOf[ParHashMap[Int, Int]].get(k) == Some(v)) true // else { @@ -74,8 +74,8 @@ with PairValues[Int, Int] // false // } // }).foldLeft(true)(_ && _) - - + + // if (invs.isEmpty) containsall // else { // println("Invariants broken:\n" + invs.mkString("\n")) @@ -83,7 +83,7 @@ with PairValues[Int, Int] // } case _ => true } - + } diff --git a/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala b/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala index a0a6d1ae5e..8b41908a26 100644 --- a/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelHashSetCheck.scala @@ -17,20 +17,20 @@ import scala.collection.parallel.ops._ abstract class ParallelHashSetCheck[T](tp: String) extends ParallelSetCheck[T]("mutable.ParHashSet[" + tp + "]") { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + type CollType = ParHashSet[T] - + def isCheckingViews = false - + def hasStrictOrder = false - def ofSize(vals: Seq[Gen[T]], sz: Int) = { + def ofSize(vals: Seq[Gen[T]], sz: Int) = { val hm = new mutable.HashSet[T] val gen = vals(rnd.nextInt(vals.size)) for (i <- 0 until sz) hm += sample(gen) hm } - + def fromTraversable(t: Traversable[T]) = { val phm = new ParHashSet[T] var i = 0 @@ -40,7 +40,7 @@ abstract class ParallelHashSetCheck[T](tp: String) extends ParallelSetCheck[T](" } phm } - + } @@ -54,12 +54,12 @@ with IntValues case _ => println("could not match data structure type: " + ds.getClass) } - + override def checkDataStructureInvariants(orig: Traversable[Int], ds: AnyRef) = ds match { // case pm: ParHashSet[t] if 1 == 0 => // // for an example of how not to write code proceed below // val invs = pm.brokenInvariants - + // val containsall = (for (elem <- orig) yield { // if (pm.asInstanceOf[ParHashSet[Int]](elem) == true) true // else { @@ -69,8 +69,8 @@ with IntValues // false // } // }).foldLeft(true)(_ && _) - - + + // if (invs.isEmpty) { // if (!containsall) println(pm.debugInformation) // containsall @@ -80,7 +80,7 @@ with IntValues // } case _ => true } - + } diff --git a/test/files/scalacheck/parallel-collections/ParallelHashTrieCheck.scala b/test/files/scalacheck/parallel-collections/ParallelHashTrieCheck.scala index 3a2893f48a..bbec52dc92 100644 --- a/test/files/scalacheck/parallel-collections/ParallelHashTrieCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelHashTrieCheck.scala @@ -17,20 +17,20 @@ import scala.collection.parallel.ops._ abstract class ParallelHashMapCheck[K, V](tp: String) extends ParallelMapCheck[K, V]("immutable.ParHashMap[" + tp + "]") { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + type CollType = ParHashMap[K, V] - + def isCheckingViews = false - + def hasStrictOrder = false - + def ofSize(vals: Seq[Gen[(K, V)]], sz: Int) = { var hm = new immutable.HashMap[K, V] val gen = vals(rnd.nextInt(vals.size)) for (i <- 0 until sz) hm += sample(gen) hm } - + def fromTraversable(t: Traversable[(K, V)]) = { var phm = new ParHashMap[K, V] var i = 0 @@ -40,7 +40,7 @@ abstract class ParallelHashMapCheck[K, V](tp: String) extends ParallelMapCheck[K } phm } - + } @@ -51,11 +51,11 @@ with PairValues[Int, Int] def intvalues = new IntValues {} def kvalues = intvalues.values def vvalues = intvalues.values - + val intoperators = new IntOperators {} def voperators = intoperators def koperators = intoperators - + override def printDataStructureDebugInfo(ds: AnyRef) = ds match { case pm: ParHashMap[k, v] => pm.printDebugInfo @@ -69,20 +69,20 @@ with PairValues[Int, Int] abstract class ParallelHashSetCheck[T](tp: String) extends ParallelSetCheck[T]("immutable.ParHashSet[" + tp + "]") { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + type CollType = ParHashSet[T] - + def isCheckingViews = false - + def hasStrictOrder = false - + def ofSize(vals: Seq[Gen[T]], sz: Int) = { var hm = new immutable.HashSet[T] val gen = vals(rnd.nextInt(vals.size)) for (i <- 0 until sz) hm += sample(gen) hm } - + def fromTraversable(t: Traversable[T]) = { var phm = new ParHashSet[T] var i = 0 @@ -92,14 +92,14 @@ abstract class ParallelHashSetCheck[T](tp: String) extends ParallelSetCheck[T](" } phm } - + override def printDataStructureDebugInfo(ds: AnyRef) = ds match { case pm: ParHashSet[t] => println("Parallel hash set") case _ => println("could not match data structure type: " + ds.getClass) } - + } @@ -110,7 +110,7 @@ with IntValues def intvalues = new IntValues {} def kvalues = intvalues.values def vvalues = intvalues.values - + override def printDataStructureDebugInfo(ds: AnyRef) = ds match { case pm: ParHashMap[k, v] => pm.printDebugInfo diff --git a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala b/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala index e3f8778bca..26fa71d72c 100644 --- a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala @@ -16,14 +16,14 @@ import scala.collection.parallel._ abstract class ParallelIterableCheck[T](collName: String) extends Properties(collName) with Operators[T] { type CollType <: ParIterable[T] - + def values: Seq[Gen[T]] def ofSize(vals: Seq[Gen[T]], sz: Int): Iterable[T] def fromTraversable(t: Traversable[T]): CollType def isCheckingViews: Boolean def hasStrictOrder: Boolean - - + + def instances(vals: Seq[Gen[T]]): Gen[Iterable[T]] = oneOf( sized( sz => @@ -31,46 +31,46 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ), for (sz <- choose(1000, 2000)) yield ofSize(vals, sz), for (sz <- choose(4000, 4001)) yield ofSize(vals, sz), - for (sz <- choose(10000, 10001)) yield ofSize(vals, sz) + for (sz <- choose(10000, 10001)) yield ofSize(vals, sz) ) - + // used to check if constructed collection is valid def checkDataStructureInvariants(orig: Traversable[T], cf: AnyRef) = { // can be overriden in subclasses true } - + def printDataStructureDebugInfo(cf: AnyRef) { // can be overridden in subclasses } - + val rnd = new scala.util.Random - + def sample(gen: Gen[T]): T = { var s = gen.sample while (s == None) s = gen.sample s.get } - + def sampleValue: T = sample(values(rnd.nextInt(values.length))) - + def collectionPairs = for (inst <- instances(values)) yield (inst, fromTraversable(inst)) - + def collectionPairsWithLengths = for (inst <- instances(values); s <- choose(0, inst.size)) yield (inst, fromTraversable(inst), s) - + def collectionPairsWith2Indices = for ( inst <- instances(values); f <- choose(0, inst.size); s <- choose(0, inst.size)) yield (inst, fromTraversable(inst), f, s) - - def collectionTriplets = for (inst <- instances(values); + + def collectionTriplets = for (inst <- instances(values); updStart <- choose(0, inst.size); howMany <- choose(0, inst.size)) yield { val modif = inst.toSeq.patch(updStart, inst.toSeq, howMany) (inst, fromTraversable(inst), modif) } - + def areEqual(t1: GenTraversable[T], t2: GenTraversable[T]) = if (hasStrictOrder) { t1 == t2 && t2 == t1 } else (t1, t2) match { // it is slightly delicate what `equal` means if the order is not strict @@ -81,14 +81,14 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col i1s == i2s && i2s == i1s case _ => t1 == t2 && t2 == t1 } - + def printDebugInfo(coll: ParIterableLike[_, _, _]) { println("Collection debug info: ") coll.printDebugBuffer println("Task debug info: ") println(coll.tasksupport.debugMessages.mkString("\n")) } - + def printComparison(t: Traversable[_], coll: ParIterable[_], tf: Traversable[_], cf: ParIterable[_], ind: Int) { printDebugInfo(coll) println("Operator: " + ind) @@ -108,7 +108,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col println("tf == cf - " + (tf == cf)) println("cf == tf - " + (cf == tf)) } - + property("reductions must be equal for assoc. operators") = forAll(collectionPairs) { case (t, coll) => if (t.size != 0) { val results = for ((op, ind) <- reduceOperators.zipWithIndex) yield { @@ -126,7 +126,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col results.reduceLeft(_ && _) } else "has size 0" |: true } - + property("counts must be equal") = forAll(collectionPairs) { case (t, coll) => val results = for ((pred, ind) <- countPredicates.zipWithIndex) yield { val tc = t.count(pred) @@ -142,19 +142,19 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col } results.reduceLeft(_ && _) } - + property("forall must be equal") = forAll(collectionPairs) { case (t, coll) => val results = for ((pred, ind) <- forallPredicates.zipWithIndex) yield ("op index: " + ind) |: t.forall(pred) == coll.forall(pred) results.reduceLeft(_ && _) } - + property("exists must be equal") = forAll(collectionPairs) { case (t, coll) => val results = for ((pred, ind) <- existsPredicates.zipWithIndex) yield ("op index: " + ind) |: t.exists(pred) == coll.exists(pred) results.reduceLeft(_ && _) } - + property("both must find or not find an element") = forAll(collectionPairs) { case (t, coll) => val results = for ((pred, ind) <- findPredicates.zipWithIndex) yield { val ft = t.find(pred) @@ -163,7 +163,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col } results.reduceLeft(_ && _) } - + property("mappings must be equal") = forAll(collectionPairs) { case (t, coll) => val results = for ((f, ind) <- mapFunctions.zipWithIndex) yield { val ms = t.map(f) @@ -184,7 +184,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col } results.reduceLeft(_ && _) } - + property("collects must be equal") = forAll(collectionPairs) { case (t, coll) => val results = for ((f, ind) <- partialMapFunctions.zipWithIndex) yield { val ps = t.collect(f) @@ -200,12 +200,12 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col } results.reduceLeft(_ && _) } - + property("flatMaps must be equal") = forAll(collectionPairs) { case (t, coll) => (for ((f, ind) <- flatMapFunctions.zipWithIndex) yield ("op index: " + ind) |: areEqual(t.flatMap(f), coll.flatMap(f))).reduceLeft(_ && _) } - + property("filters must be equal") = forAll(collectionPairs) { case (t, coll) => (for ((p, ind) <- filterPredicates.zipWithIndex) yield { val tf = t.filter(p) @@ -234,7 +234,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("op index: " + ind) |: tf == cf && cf == tf && invs }).reduceLeft(_ && _) } - + property("filterNots must be equal") = forAll(collectionPairs) { case (t, coll) => (for ((p, ind) <- filterNotPredicates.zipWithIndex) yield { val tf = t.filterNot(p) @@ -243,7 +243,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("op index: " + ind) |: tf == cf && cf == tf }).reduceLeft(_ && _) } - + if (!isCheckingViews) property("partitions must be equal") = forAll(collectionPairs) { case (t, coll) => (for ((p, ind) <- partitionPredicates.zipWithIndex) yield { val tpart = t.partition(p) @@ -257,15 +257,15 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("op index: " + ind) |: tpart == cpart }).reduceLeft(_ && _) } - + if (hasStrictOrder) property("takes must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) => ("take " + n + " elements") |: t.take(n) == coll.take(n) } - + if (hasStrictOrder) property("drops must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) => ("drop " + n + " elements") |: t.drop(n) == coll.drop(n) } - + if (hasStrictOrder) property("slices must be equal") = forAll(collectionPairsWith2Indices) { case (t, coll, fr, slicelength) => val from = if (fr < 0) 0 else fr @@ -289,7 +289,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col } ("slice from " + from + " until " + until) |: tsl == collsl } - + if (hasStrictOrder) property("splits must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) => val tspl = t.splitAt(n) val cspl = coll.splitAt(n) @@ -302,7 +302,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col } ("splitAt " + n) |: tspl == cspl } - + if (hasStrictOrder) property("takeWhiles must be equal") = forAll(collectionPairs) { case (t, coll) => (for ((pred, ind) <- takeWhilePredicates.zipWithIndex) yield { val tt = t.takeWhile(pred) @@ -317,7 +317,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("operator " + ind) |: tt == ct }).reduceLeft(_ && _) } - + if (hasStrictOrder) property("spans must be equal") = forAll(collectionPairs) { case (t, coll) => (for ((pred, ind) <- spanPredicates.zipWithIndex) yield { val tsp = t.span(pred) @@ -335,13 +335,13 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("operator " + ind) |: tsp == csp }).reduceLeft(_ && _) } - + if (hasStrictOrder) property("dropWhiles must be equal") = forAll(collectionPairs) { case (t, coll) => (for ((pred, ind) <- dropWhilePredicates.zipWithIndex) yield { ("operator " + ind) |: t.dropWhile(pred) == coll.dropWhile(pred) }).reduceLeft(_ && _) } - + property("folds must be equal for assoc. operators") = forAll(collectionPairs) { case (t, coll) => (for (((first, op), ind) <- foldArguments.zipWithIndex) yield { val tres = t.foldLeft(first)(op) @@ -356,7 +356,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("operator " + ind) |: tres == cres }).reduceLeft(_ && _) } - + property("++s must be equal") = forAll(collectionTriplets) { case (t, coll, colltoadd) => val toadd = colltoadd val tr = t ++ toadd.iterator @@ -383,7 +383,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("traversable " + ind) |: areEqual(tadded, cadded) }).reduceLeft(_ && _) } - + if (hasStrictOrder) property("copies to array must be equal") = forAll(collectionPairs) { case (t, coll) => val tarr = newArray(t.size) val collarr = newArray(coll.size) @@ -397,7 +397,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col } tarr.toSeq == collarr.toSeq } - + if (hasStrictOrder) property("scans must be equal") = forAll(collectionPairs) { case (t, coll) => (for (((first, op), ind) <- foldArguments.zipWithIndex) yield { @@ -413,7 +413,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("operator " + ind) |: tscan == cscan && cscan == tscan }).reduceLeft(_ && _) } - + property("groupBy must be equal") = forAll(collectionPairs) { case (t, coll) => (for ((f, ind) <- groupByFunctions.zipWithIndex) yield { @@ -429,7 +429,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col ("operator " + ind) |: tgroup == cgroup && cgroup == tgroup }).reduceLeft(_ && _) } - + } diff --git a/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala b/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala index b6af8f41bd..d4643e7f2c 100644 --- a/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala +++ b/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala @@ -16,15 +16,15 @@ import scala.collection.parallel._ abstract class ParallelMapCheck[K, V](collname: String) extends ParallelIterableCheck[(K, V)](collname) { type CollType <: ParMap[K, V] - + property("gets iterated keys") = forAll(collectionPairs) { case (t, coll) => val containsT = for ((k, v) <- t) yield (coll.get(k) == Some(v)) val containsSelf = coll.map { case (k, v) => coll.get(k) == Some(v) } ("Par contains elements of seq map" |: containsT.forall(_ == true)) && ("Par contains elements of itself" |: containsSelf.forall(_ == true)) - } - + } + } diff --git a/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala b/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala index 3c6a35d8f1..372d6b9fbd 100644 --- a/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelRangeCheck.scala @@ -20,15 +20,15 @@ import scala.collection.parallel.ops._ object ParallelRangeCheck extends ParallelSeqCheck[Int]("ParallelRange[Int]") with ops.IntSeqOperators { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + type CollType = collection.parallel.ParSeq[Int] - + def hasStrictOrder = true - + def isCheckingViews = false - + def ofSize(vals: Seq[Gen[Int]], sz: Int) = unsupported - + override def instances(vals: Seq[Gen[Int]]): Gen[Seq[Int]] = sized { start => sized { end => sized { step => @@ -36,7 +36,7 @@ object ParallelRangeCheck extends ParallelSeqCheck[Int]("ParallelRange[Int]") wi } } } - + def fromSeq(a: Seq[Int]) = a match { case r: Range => ParRange(r.start, r.end, r.step, false) case _ => @@ -44,14 +44,14 @@ object ParallelRangeCheck extends ParallelSeqCheck[Int]("ParallelRange[Int]") wi for (i <- 0 until a.length) pa(i) = a(i) pa } - + override def traversable2Seq(t: Traversable[Int]): Seq[Int] = t match { case r: Range => r case _ => t.toSeq } - + def values = Seq(choose(-100, 100)) - + } diff --git a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala b/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala index dd897412ae..3f8a8ad4f5 100644 --- a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala @@ -16,13 +16,13 @@ import scala.collection.parallel._ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableCheck[T](collName) with SeqOperators[T] { - + type CollType <: collection.parallel.ParSeq[T] - + def ofSize(vals: Seq[Gen[T]], sz: Int): Seq[T] def fromSeq(s: Seq[T]): CollType - + override def instances(vals: Seq[Gen[T]]): Gen[Seq[T]] = oneOf( sized( sz => @@ -31,17 +31,17 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe for (sz <- choose(1000, 2000)) yield ofSize(vals, sz) ) - + def fromTraversable(t: Traversable[T]) = fromSeq(traversable2Seq(t)) def traversable2Seq(t: Traversable[T]): Seq[T] = { if (t.isInstanceOf[Iterable[_]]) t.asInstanceOf[Iterable[T]].iterator.toList else t.toList } - + override def collectionPairs: Gen[(Seq[T], CollType)] = for (inst <- instances(values)) yield (inst, fromSeq(inst)) - + override def collectionPairsWithLengths: Gen[(Seq[T], CollType, Int)] = for (inst <- instances(values); s <- choose(0, inst.size)) yield (inst, fromSeq(inst), s); - + def collectionPairsWithModifiedWithLengths: Gen[(Seq[T], CollType, ParSeq[T], Int)] = for (inst <- instances(values); s <- choose(0, inst.size); updateStart <- choose(0, inst.size); howMany <- choose(0, inst.size)) yield { @@ -49,31 +49,31 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe val parcollmodif = fromSeq(modifySlightly(inst, updateStart, howMany)) (inst, parcoll, parcollmodif, s) } - + def collectionPairsWithModified: Gen[(Seq[T], CollType, ParSeq[T])] = for (inst <- instances(values); updateStart <- choose(0, inst.size); howMany <- choose(0, inst.size)) yield { val parcoll = fromSeq(inst) val parcollmodif = fromSeq(modifySlightly(inst, updateStart, howMany)) (inst, parcoll, parcollmodif) } - + def collectionPairsWithSliced: Gen[(Seq[T], CollType, ParSeq[T])] = for (inst <- instances(values); sliceStart <- choose(0, inst.size); howMany <- choose(0, inst.size)) yield { val parcoll = fromSeq(inst) val parcollsliced = fromSeq(inst.slice(sliceStart, sliceStart + howMany)) (inst, parcoll, parcollsliced) } - + def collectionTripletsWith2Indices: Gen[(Seq[T], CollType, Seq[T], Int, Int)] = for (inst <- instances(values); f <- choose(0, inst.size); s <- choose(0, inst.size - f); third <- instances(values); sliceStart <- choose(0, inst.size); howMany <- choose(0, inst.size)) yield { (inst, fromSeq(inst), inst.slice(sliceStart, sliceStart + howMany), f, s) } - + private def modifySlightly(coll: Seq[T], updateStart: Int, howMany: Int) = { coll.patch(updateStart, coll, howMany) } - + property("segmentLengths must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) => (for ((pred, ind) <- segmentLengthPredicates.zipWithIndex) yield { val slen = s.segmentLength(pred, if (len < 0) 0 else len) @@ -87,13 +87,13 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe ("operator " + ind) |: slen == clen }).reduceLeft(_ && _) } - + property("prefixLengths must be equal") = forAll(collectionPairs) { case (s, coll) => (for ((pred, ind) <- segmentLengthPredicates.zipWithIndex) yield { ("operator " + ind) |: s.prefixLength(pred) == coll.prefixLength(pred) }).reduceLeft(_ && _) } - + property("indexWheres must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) => (for ((pred, ind) <- indexWherePredicates.zipWithIndex) yield { val sind = s.indexWhere(pred, len) @@ -108,7 +108,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe ("operator " + ind) |: sind == cind }).reduceLeft(_ && _) } - + property("lastIndexWheres must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) => (for ((pred, ind) <- lastIndexWherePredicates.zipWithIndex) yield { val end = if (len >= s.size) s.size - 1 else len @@ -117,7 +117,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe ("operator " + ind) |: sind == cind }).reduceLeft(_ && _) } - + property("reverses must be equal") = forAll(collectionPairs) { case (s, coll) => (s.length == 0 && s.getClass == classOf[collection.immutable.Range]) || { @@ -132,13 +132,13 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe sr == cr } } - + property("reverseMaps must be equal") = forAll(collectionPairs) { case (s, coll) => (for ((f, ind) <- reverseMapFunctions.zipWithIndex) yield { ("operator " + ind) |: s.reverseMap(f) == coll.reverseMap(f) }).reduceLeft(_ && _) } - + property("sameElements must be equal") = forAll(collectionPairsWithModifiedWithLengths) { case (s, coll, collmodif, len) => val pos = if (len < 0) 0 else len @@ -170,7 +170,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe ("collection " + ind) |: sres == pres }).reduceLeft(_ && _) } - + property("startsWiths must be equal") = forAll(collectionPairsWithModifiedWithLengths) { case (s, coll, collmodif, len) => val pos = if (len < 0) 0 else len @@ -194,7 +194,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe ("seq " + sq) |: ss == cs }).reduceLeft(_ && _) } - + property("endsWiths must be equal") = forAll(collectionPairsWithModified) { case (s, coll, collmodif) => ("ends with self" |: s.endsWith(s) == coll.endsWith(s)) && @@ -213,18 +213,18 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe ("seq " + sq) |: sew == cew }).reduceLeft(_ && _) } - + property("unions must be equal") = forAll(collectionPairsWithModified) { case (s, coll, collmodif) => ("modified" |: s.union(collmodif.seq) == coll.union(collmodif)) && ("empty" |: s.union(Nil) == coll.union(fromSeq(Nil))) } - + // This is failing with my views patch: array index out of bounds in the array iterator. // Couldn't see why this and only this was impacted, could use a second pair of eyes. - // + // // This was failing because some corner cases weren't added to the patch method in ParSeqLike. // Curiously, this wasn't detected before. - // + // if (!isCheckingViews) property("patches must be equal") = forAll(collectionTripletsWith2Indices) { case (s, coll, pat, from, repl) => ("with seq" |: s.patch(from, pat, repl) == coll.patch(from, pat, repl)) && @@ -232,7 +232,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe ("with empty" |: s.patch(from, Nil, repl) == coll.patch(from, fromSeq(Nil), repl)) && ("with one" |: (s.length == 0 || s.patch(from, List(s(0)), 1) == coll.patch(from, fromSeq(List(coll(0))), 1))) } - + if (!isCheckingViews) property("updates must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) => val pos = if (len >= s.length) s.length - 1 else len if (s.length > 0) { @@ -247,15 +247,15 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe "from first" |: (supd == cupd) } else "trivially" |: true } - + property("prepends must be equal") = forAll(collectionPairs) { case (s, coll) => s.length == 0 || s(0) +: s == coll(0) +: coll } - + property("appends must be equal") = forAll(collectionPairs) { case (s, coll) => s.length == 0 || s :+ s(0) == coll :+ coll(0) } - + property("padTos must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) => val someValue = sampleValue val sdoub = s.padTo(len * 2, someValue) @@ -269,14 +269,14 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe ("smaller" |: s.padTo(len / 2, someValue) == coll.padTo(len / 2, someValue)) && ("bigger" |: sdoub == cdoub) } - + property("corresponds must be equal") = forAll(collectionPairsWithModified) { case (s, coll, modified) => val modifcut = modified.toSeq.slice(0, modified.length) ("self" |: s.corresponds(s)(_ == _) == coll.corresponds(coll)(_ == _)) && ("modified" |: s.corresponds(modified.seq)(_ == _) == coll.corresponds(modified)(_ == _)) && ("modified2" |: s.corresponds(modifcut)(_ == _) == coll.corresponds(modifcut)(_ == _)) } - + } diff --git a/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala b/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala index 4211abbd16..56f7832fed 100644 --- a/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala @@ -16,15 +16,15 @@ import scala.collection.parallel._ abstract class ParallelSetCheck[T](collname: String) extends ParallelIterableCheck[T](collname) { type CollType <: ParSet[T] - + property("gets iterated keys") = forAll(collectionPairs) { case (t, coll) => val containsT = for (elem <- t) yield (coll.contains(elem)) val containsSelf = for (elem <- coll) yield (coll.contains(elem)) ("Par contains elements of seq map" |: containsT.forall(_ == true)) && ("Par contains elements of itself" |: containsSelf.forall(_ == true)) - } - + } + } diff --git a/test/files/scalacheck/parallel-collections/ParallelVectorCheck.scala b/test/files/scalacheck/parallel-collections/ParallelVectorCheck.scala index e4bb588fa7..a2b6cef96d 100644 --- a/test/files/scalacheck/parallel-collections/ParallelVectorCheck.scala +++ b/test/files/scalacheck/parallel-collections/ParallelVectorCheck.scala @@ -23,11 +23,11 @@ import immutable.VectorBuilder abstract class ParallelVectorCheck[T](tp: String) extends collection.parallel.ParallelSeqCheck[T]("ParVector[" + tp + "]") { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) - + type CollType = ParVector[T] - + def isCheckingViews = false - + def hasStrictOrder = true def ofSize(vals: Seq[Gen[T]], sz: Int) = { @@ -36,13 +36,13 @@ abstract class ParallelVectorCheck[T](tp: String) extends collection.parallel.Pa for (i <- 0 until sz) vb += sample(gen) vb.result } - + def fromSeq(a: Seq[T]) = { val pa = ParVector.newCombiner[T] for (elem <- a.toList) pa += elem pa.result } - + } diff --git a/test/files/scalacheck/parallel-collections/pc.scala b/test/files/scalacheck/parallel-collections/pc.scala index e6b6b4856d..c588692fd2 100644 --- a/test/files/scalacheck/parallel-collections/pc.scala +++ b/test/files/scalacheck/parallel-collections/pc.scala @@ -8,28 +8,28 @@ import scala.collection.parallel._ class ParCollProperties extends Properties("Parallel collections") { /* Collections */ - + // parallel arrays include(mutable.IntParallelArrayCheck) - + // parallel ranges include(immutable.ParallelRangeCheck) - + // parallel immutable hash maps (tries) include(immutable.IntIntParallelHashMapCheck) - + // parallel immutable hash sets (tries) include(immutable.IntParallelHashSetCheck) - + // parallel mutable hash maps (tables) include(mutable.IntIntParallelHashMapCheck) - + // parallel ctrie include(mutable.IntIntParallelConcurrentTrieMapCheck) - + // parallel mutable hash sets (tables) include(mutable.IntParallelHashSetCheck) - + // parallel vectors include(immutable.IntParallelVectorCheck) } diff --git a/test/files/scalacheck/primitive-eqeq.scala b/test/files/scalacheck/primitive-eqeq.scala index a783805e46..60fe63c207 100644 --- a/test/files/scalacheck/primitive-eqeq.scala +++ b/test/files/scalacheck/primitive-eqeq.scala @@ -4,7 +4,7 @@ import Gen._ object Test extends Properties("==") { def equalObjectsEqualHashcodes(x: Any, y: Any) = (x != y) || (x == y && x.## == y.##) - + // ticket #2087 property("short/char") = forAll { (x: Short) => { val ch: Char = x.toChar @@ -14,15 +14,15 @@ object Test extends Properties("==") { property("symmetry") = forAll { (x: AnyVal, y: AnyVal) => (x == y) == (y == x) } property("transitivity") = forAll { (x: AnyVal, y: AnyVal, z: AnyVal) => x != y || y != z || x == z } - - property("##") = forAll { + + property("##") = forAll { (x: Short) => { val anyvals = List(x.toByte, x.toChar, x, x.toInt, x.toLong, x.toFloat, x.toDouble, BigInt(x), BigDecimal(x)) val shortAndLarger = anyvals drop 2 val result = ( - ((anyvals, anyvals).zipped forall equalObjectsEqualHashcodes) && - ((shortAndLarger, shortAndLarger).zipped forall (_ == _)) && + ((anyvals, anyvals).zipped forall equalObjectsEqualHashcodes) && + ((shortAndLarger, shortAndLarger).zipped forall (_ == _)) && ((shortAndLarger, shortAndLarger).zipped forall ((x, y) => (x: Any) == (y: Any))) ) result diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala index c6cca85c81..753ad1aa59 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala @@ -167,4 +167,28 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { val x = q"val x: Int = 1" assertThrows[IllegalArgumentException] { q"($x) => x" } } + + property("assign variable") = test { + val v = q"v" + val value = q"foo" + assertEqAst(q"$v = $value", "v = foo") + } + + property("assign update 1") = test { + val v = q"v" + val args = q"1" :: q"2" :: Nil + val value = q"foo" + assertEqAst(q"$v(..$args) = $value", "v(1, 2) = foo") + } + + property("assign update 2") = test { + val a = q"v(0)" + val value = q"foo" + assertEqAst(q"$a = $value", "v(0) = foo") + } + + property("assign or named arg") = test { + val assignx = q"x = 1" + assertEqAst(q"f($assignx)", "f(x = 1)") + } } diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala index 45c7ee4bb7..22d4b1ce4f 100644 --- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala @@ -91,4 +91,24 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction matches("new { val early = 1} with Parent[Int] { body }") matches("new Foo { selfie => }") } + + property("exhaustive assign pattern") = test { + def matches(tree: Tree) { val q"$rhs = $lhs" = tree } + matches(parse("left = right")) + matches(parse("arr(1) = 2")) + matches(AssignOrNamedArg(EmptyTree, EmptyTree)) + } + + property("deconstruct update 1") = test { + val q"$obj(..$args) = $value" = q"foo(bar) = baz" + assert(obj ≈ q"foo") + assert(args ≈ List(q"bar")) + assert(value ≈ q"baz") + } + + property("deconstruct update 2") = test { + val q"$left = $value" = q"foo(bar) = baz" + assert(left ≈ q"foo(bar)") + assert(value ≈ q"baz") + } } diff --git a/test/files/scalacheck/range.scala b/test/files/scalacheck/range.scala index 72979115be..6c7c32bfdf 100644 --- a/test/files/scalacheck/range.scala +++ b/test/files/scalacheck/range.scala @@ -30,7 +30,7 @@ abstract class RangeTest(kind: String) extends Properties("Range "+kind) { def myGen: Gen[Range] def genReasonableSizeRange = oneOf(genArbitraryRange, genBoundaryRange) - + def genArbitraryRange = for { start <- choose(Int.MinValue, Int.MaxValue) end <- choose(Int.MinValue, Int.MaxValue) @@ -56,7 +56,7 @@ abstract class RangeTest(kind: String) extends Properties("Range "+kind) { } yield if (start < end) Range(start, end, step) else Range(start, end, -step) def genRangeByOne = oneOf(genRangeOpenByOne, genRangeClosedByOne) - + def genRangeOpenByOne = for { r <- oneOf(genSmallRange, genBoundaryRange) if (r.end.toLong - r.start.toLong).abs <= 10000000L diff --git a/test/files/scalacheck/redblacktree.scala b/test/files/scalacheck/redblacktree.scala index bc7f92aa1b..871444a4b8 100644 --- a/test/files/scalacheck/redblacktree.scala +++ b/test/files/scalacheck/redblacktree.scala @@ -205,22 +205,22 @@ package scala.collection.immutable.redblacktree { filteredTree == keysIterator(newTree).toList } } - + object TestDrop extends RedBlackTreeTest with RedBlackTreeInvariants { import RB._ - + override type ModifyParm = Int override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = drop(tree, parm) - + property("drop") = forAll(genInput) { case (tree, parm, newTree) => iterator(tree).drop(parm).toList == iterator(newTree).toList } } - + object TestTake extends RedBlackTreeTest with RedBlackTreeInvariants { import RB._ - + override type ModifyParm = Int override def genParm(tree: Tree[String, Int]): Gen[ModifyParm] = choose(0, iterator(tree).size) override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = take(tree, parm) @@ -229,7 +229,7 @@ package scala.collection.immutable.redblacktree { iterator(tree).take(parm).toList == iterator(newTree).toList } } - + object TestSlice extends RedBlackTreeTest with RedBlackTreeInvariants { import RB._ @@ -239,7 +239,7 @@ package scala.collection.immutable.redblacktree { to <- choose(from, iterator(tree).size) } yield (from, to) override def modify(tree: Tree[String, Int], parm: ModifyParm): Tree[String, Int] = slice(tree, parm._1, parm._2) - + property("slice") = forAll(genInput) { case (tree, parm, newTree) => iterator(tree).slice(parm._1, parm._2).toList == iterator(newTree).toList } diff --git a/test/files/scalacheck/substringTests.scala b/test/files/scalacheck/substringTests.scala index a48356e1fa..76260b9dd2 100644 --- a/test/files/scalacheck/substringTests.scala +++ b/test/files/scalacheck/substringTests.scala @@ -6,11 +6,11 @@ object Test extends Properties("String") { property("endsWith") = Prop.forAll((a: String, b: String) => (a+b).endsWith(b)) - property("concat") = Prop.forAll((a: String, b: String) => + property("concat") = Prop.forAll((a: String, b: String) => (a+b).length >= a.length && (a+b).length >= b.length ) - property("substring") = Prop.forAll((a: String, b: String) => + property("substring") = Prop.forAll((a: String, b: String) => (a+b).substring(a.length) == b ) diff --git a/test/files/scalacheck/treeset.scala b/test/files/scalacheck/treeset.scala index 018c1b9e29..7fca3ed5e4 100644 --- a/test/files/scalacheck/treeset.scala +++ b/test/files/scalacheck/treeset.scala @@ -149,7 +149,7 @@ object Test extends Properties("TreeSet") { val result = subject.foldLeft(subject)((acc, elt) => acc - elt) result.isEmpty } - + property("ordering must not be null") = throws(TreeSet.empty[Int](null), classOf[NullPointerException]) } diff --git a/test/files/scalap/caseClass.scala b/test/files/scalap/caseClass.scala index 95f9984519..be86714898 100644 --- a/test/files/scalap/caseClass.scala +++ b/test/files/scalap/caseClass.scala @@ -1,3 +1,3 @@ case class CaseClass[A <: Seq[Int]](i: A, s: String) { - def foo = 239 + def foo = 239 } diff --git a/test/files/scalap/caseObject.scala b/test/files/scalap/caseObject.scala index 6a3ff10d75..809341ade9 100644 --- a/test/files/scalap/caseObject.scala +++ b/test/files/scalap/caseObject.scala @@ -1,3 +1,3 @@ case object CaseObject { - def bar = 239 + def bar = 239 } diff --git a/test/files/scalap/cbnParam.scala b/test/files/scalap/cbnParam.scala index 2f366df64a..978a718032 100644 --- a/test/files/scalap/cbnParam.scala +++ b/test/files/scalap/cbnParam.scala @@ -1 +1 @@ -class CbnParam(s: => String) +class CbnParam(s: => String) diff --git a/test/files/specialized/SI-7343.scala b/test/files/specialized/SI-7343.scala index 5ee683064c..8d14a2c1c5 100644 --- a/test/files/specialized/SI-7343.scala +++ b/test/files/specialized/SI-7343.scala @@ -1,4 +1,4 @@ -class Parent[@specialized(Int) T] +class Parent[@specialized(Int) T] object Test extends App { diff --git a/test/files/specialized/SI-7344.scala b/test/files/specialized/SI-7344.scala index 1040460bd1..624adb6bbb 100644 --- a/test/files/specialized/SI-7344.scala +++ b/test/files/specialized/SI-7344.scala @@ -1,13 +1,13 @@ /* Test for SI-7344, where specialized methods inside the bodies of other * methods are not specialized, although they might as well be. The name - * for the specialized method should not be different depending on the + * for the specialized method should not be different depending on the * outside method/class' specialization. */ class Test[@specialized(Int, Double) X](val x: X) { def checkSpecialization[Y](@specialized(Int, Double) y: Y): X = { - // checking the specialization using the method name, which we can + // checking the specialization using the method name, which we can // extract from an exception's stack trace. We can match just the // prefix, since the compiler will add a suffix to the method name // during lambdalift, when it lifts the local methods outside. @@ -33,7 +33,7 @@ object Test extends App { val t2 = new Test(123) val t3 = new Test(1.3) - // we want specialization to rewire these, + // we want specialization to rewire these, // that's why they're not in a for loop: t1.checkSpecialization("x") @@ -49,5 +49,5 @@ object Test extends App { // t2.checkSpecialization(1.3) // t3.checkSpecialization("x") // t3.checkSpecialization(123) - // t3.checkSpecialization(1.3) + // t3.checkSpecialization(1.3) } diff --git a/test/files/specialized/arrays-traits.scala b/test/files/specialized/arrays-traits.scala index 34a1c37a01..9183d7a190 100644 --- a/test/files/specialized/arrays-traits.scala +++ b/test/files/specialized/arrays-traits.scala @@ -23,7 +23,7 @@ object Test { (new BaseS(new Array[String](1)): SuperS[String]).bar(new Array[String](1)) println(arrayApplyCount) println(arrayUpdateCount) - + (new BaseG(new Array[String](1)): SuperG[String]).foo println(arrayApplyCount) (new BaseG(new Array[String](1)): SuperG[String]).bar(new Array[String](1)) diff --git a/test/files/specialized/arrays.scala b/test/files/specialized/arrays.scala index c946a8fc55..505f482486 100644 --- a/test/files/specialized/arrays.scala +++ b/test/files/specialized/arrays.scala @@ -15,23 +15,23 @@ class Spec[@specialized(AnyRef) T](a: Array[T]) { object Test { - + def main(args: Array[String]) { val len = 50 - + testSpec(new Array[String](len)) println(arrayApplyCount) - + (new Spec(new Array[String](len)))() println(arrayApplyCount) - + testGeneric(new Array[String](len)) println(arrayApplyCount) - + (new Generic(new Array[String](len)))() println(arrayApplyCount) } - + def testGeneric[T](a: Array[T]) = { var i = 0 var sum = 0 @@ -41,7 +41,7 @@ object Test { } sum } - + def testSpec[@specialized(AnyRef) T](a: Array[T]) = { var i = 0 var sum = 0 @@ -51,5 +51,5 @@ object Test { } sum } - + } diff --git a/test/files/specialized/fft.scala b/test/files/specialized/fft.scala index 62a6a2abb9..76029832a9 100644 --- a/test/files/specialized/fft.scala +++ b/test/files/specialized/fft.scala @@ -1,13 +1,13 @@ /* * http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/dft/ - Modification of Paul Bourkes FFT code by Peter Cusack + Modification of Paul Bourkes FFT code by Peter Cusack to utilise the Microsoft complex type. - This computes an in-place complex-to-complex FFT + This computes an in-place complex-to-complex FFT x and y are the real and imaginary arrays of 2^m points. dir = 1 gives forward transform - dir = -1 gives reverse transform + dir = -1 gives reverse transform */ import Math.{sqrt, pow} @@ -24,19 +24,19 @@ object Test { x(j) = tmp } - def times(x: Complex, y: Complex): Complex = + def times(x: Complex, y: Complex): Complex = (x._1 * y._1 - x._2 * y._2, x._1 * y._2 + x._2 * y._1) - + def div(x: Complex, y: Complex): Complex = { val num = pow(y._1, 2) + pow(y._2, 2) ((x._1 * y._1 + x._2 * y._2)/num, (x._2 * y._1 - x._1 * y._2)/num) } - def div(x: Complex, y: Long) = + def div(x: Complex, y: Long) = (x._1 / y, x._2 / y) - def add(x: Complex, y: Complex) = + def add(x: Complex, y: Complex) = (x._1 + y._1, x._2 + y._2) def minus(x: Complex, y: Complex) = @@ -49,8 +49,8 @@ object Test { /*Calculate the number of points */ n = 1 - for (i <- 0l until m) - n <<= 1 + for (i <- 0l until m) + n <<= 1 /* Do the bit reversal */ i2 = n >> 1 @@ -86,7 +86,7 @@ object Test { for (i <- j.until(n, l2)) { i1 = i + l1; t1 = times(u, x(i1.toInt)) - x(i1.toInt) = minus(x(i.toInt), t1) + x(i1.toInt) = minus(x(i.toInt), t1) x(i.toInt) = add(x(i.toInt), t1) } @@ -97,7 +97,7 @@ object Test { c = (c._1, sqrt( (1.0 - c._1) / 2.0 )) // if (dir == 1) // c.imag(-c.imag()); - if (dir == 1) + if (dir == 1) c = (c._1, -c._2) // c.real(sqrt((1.0 + c.real()) / 2.0)); @@ -107,8 +107,8 @@ object Test { /* Scaling for forward transform */ if (dir == 1) { for (i <- 0l until n) - x(i.toInt) = div(x(i.toInt), n) - } + x(i.toInt) = div(x(i.toInt), n) + } } def run() { diff --git a/test/files/specialized/spec-ame.scala b/test/files/specialized/spec-ame.scala index 129fb9f447..017d5dfa37 100644 --- a/test/files/specialized/spec-ame.scala +++ b/test/files/specialized/spec-ame.scala @@ -1,13 +1,13 @@ // ticket #3432 object Test { trait B[@specialized(Int) T] { - def value: T + def value: T } - class A[@specialized(Int) T](x: T) { - def foo: B[T] = new B[T] { - def value = x - } + class A[@specialized(Int) T](x: T) { + def foo: B[T] = new B[T] { + def value = x + } } def main(args: Array[String]) { diff --git a/test/files/specialized/spec-hlists.scala b/test/files/specialized/spec-hlists.scala index 8c4ac8f610..82e3bf74c5 100644 --- a/test/files/specialized/spec-hlists.scala +++ b/test/files/specialized/spec-hlists.scala @@ -4,7 +4,7 @@ sealed trait HList { type Self <: HList - + type |: [E] = HCons[E, Self] final def |: [@specialized E](elem: E): |: [E] = new HCons[E, Self](elem, this.asInstanceOf[Self]) @@ -23,7 +23,7 @@ final object HNil extends HList { object Test extends App { val l1 = new HCons(42, "foo" |: HNil) println(l1.getClass) - + val l2 = 42 |: "abc" |: HNil println(l2.getClass) } diff --git a/test/files/specialized/spec-init.scala b/test/files/specialized/spec-init.scala index 5f27062ed2..94cd0ee82b 100644 --- a/test/files/specialized/spec-init.scala +++ b/test/files/specialized/spec-init.scala @@ -36,7 +36,7 @@ object Test { (new TouchGlobal(new Object)) Global.msg = "ok" // reset the value (new TouchGlobal(42)) - + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/specialized/spec-matrix-old.scala b/test/files/specialized/spec-matrix-old.scala index 83941e80a7..4e3d3f1377 100644 --- a/test/files/specialized/spec-matrix-old.scala +++ b/test/files/specialized/spec-matrix-old.scala @@ -4,7 +4,7 @@ @deprecated("Suppress warnings", since="2.11") class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { private val arr: Array[Array[A]] = Array.ofDim[A](rows, cols) - + def apply(i: Int, j: Int): A = { if (i < 0 || i >= rows || j < 0 || j >= cols) throw new NoSuchElementException("Indexes out of bounds: " + (i, j)) @@ -31,7 +31,7 @@ object Test { def main(args: Array[String]) { val m = randomMatrix(200, 100) val n = randomMatrix(100, 200) - + val p = mult(m, n) println(p(0, 0)) println("Boxed doubles: " + runtime.BoxesRunTime.doubleBoxCount) @@ -40,7 +40,7 @@ object Test { def randomMatrix(n: Int, m: Int) = { val r = new util.Random(10) - val x = new Matrix[Double](n, m) + val x = new Matrix[Double](n, m) for (i <- 0 until n; j <- 0 until m) x(i, j) = (r.nextInt % 1000).toDouble x @@ -48,7 +48,7 @@ object Test { def printMatrix[Double](m: Matrix[Double]) { for (i <- 0 until m.rows) { - for (j <- 0 until m.cols) + for (j <- 0 until m.cols) print("%5.3f ".format(m(i, j))) println } @@ -58,7 +58,7 @@ object Test { val p = new Matrix[T](m.rows, n.cols) import num._ - for (i <- 0 until m.rows) + for (i <- 0 until m.rows) for (j <- 0 until n.cols) { var sum = num.zero for (k <- 0 until n.rows) @@ -70,7 +70,7 @@ object Test { def mult(m: Matrix[Double], n: Matrix[Double]) = { val p = new Matrix[Double](m.rows, n.cols) - for (i <- 0 until m.rows) + for (i <- 0 until m.rows) for (j <- 0 until n.cols) { var sum = 0.0 for (k <- 0 until n.rows) diff --git a/test/files/specialized/spec-overrides.scala b/test/files/specialized/spec-overrides.scala index 90dd5a4e72..994dd9d245 100644 --- a/test/files/specialized/spec-overrides.scala +++ b/test/files/specialized/spec-overrides.scala @@ -17,6 +17,6 @@ object Test extends App { assert(d2.default == 1.0, d2.default) assert((d2: Base[_]).default == 1.0, (d2: Base[_]).default) assert((d2: D1).default == 1.0, (d2: D1).default) - + println(runtime.BoxesRunTime.integerBoxCount) } diff --git a/test/files/specialized/spec-patmatch.scala b/test/files/specialized/spec-patmatch.scala index 979d143fe2..909629455d 100644 --- a/test/files/specialized/spec-patmatch.scala +++ b/test/files/specialized/spec-patmatch.scala @@ -46,7 +46,7 @@ object Test { (new Foo).test(42.0) (new Foo).test(42.0f) (new Foo).test(new Object) - + println(runtime.BoxesRunTime.integerBoxCount) } diff --git a/test/files/specialized/spec-super.scala b/test/files/specialized/spec-super.scala index a77f65b2cf..056a7712f0 100644 --- a/test/files/specialized/spec-super.scala +++ b/test/files/specialized/spec-super.scala @@ -7,13 +7,13 @@ object Test { val i = new Extended(1) println(i.foo) //infinite loop with StackOverflowError - + println(runtime.BoxesRunTime.integerBoxCount) } } -class Base[@specialized(Int) T](val t: T) { - def foo() :T = t +class Base[@specialized(Int) T](val t: T) { + def foo() :T = t } class Extended [@specialized(Int) T](t: T) extends Base[T](t) { override def foo() :T = super.foo diff --git a/test/files/specialized/spec-t3896.scala b/test/files/specialized/spec-t3896.scala index 3a3be3da2b..3c849036c1 100644 --- a/test/files/specialized/spec-t3896.scala +++ b/test/files/specialized/spec-t3896.scala @@ -1,7 +1,7 @@ // see ticket #3896. Tests interaction between overloading, specialization and default params trait Atomic[@specialized(Boolean) T] { def x: T - + // crash depends on the overloading: if second method is "g", no crash. def f(fn: T => T): Boolean = f(fn(x)) def f[R](a: T, b: R = true) = b @@ -14,7 +14,7 @@ object Test { val x = e.f( (a : Boolean) => !a ) // ok println( e.f( (a : Boolean) => !a ).toString ) // ok println( e.f( (a : Boolean) => !a) ) // compiler crash - + println(runtime.BoxesRunTime.integerBoxCount) } } diff --git a/test/files/specialized/td3651.scala b/test/files/specialized/td3651.scala index 19a4ab616c..117710b6dc 100644 --- a/test/files/specialized/td3651.scala +++ b/test/files/specialized/td3651.scala @@ -11,7 +11,7 @@ object Test { val b: Base[Double] = new Derived(10) b.a println(runtime.BoxesRunTime.doubleBoxCount) - + val der = new Derived(10) der.a println(runtime.BoxesRunTime.doubleBoxCount) diff --git a/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala b/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala new file mode 100644 index 0000000000..05e69978c6 --- /dev/null +++ b/test/junit/scala/tools/nsc/symtab/StdNamesTest.scala @@ -0,0 +1,46 @@ +package scala.tools.nsc +package symtab + +import org.junit.Assert._ +import scala.tools.testing.AssertUtil._ +import org.junit.{Ignore, Test} +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(classOf[JUnit4]) +class StdNamesTest { + object symbolTable extends SymbolTableForUnitTesting + import symbolTable._ + import nme.{SPECIALIZED_SUFFIX, unspecializedName, splitSpecializedName} + + @Test + def testNewTermNameInvalid(): Unit = { + assertThrows[IllegalArgumentException](newTermName("foo".toCharArray, 0, -1)) + assertThrows[IllegalArgumentException](newTermName("foo".toCharArray, 0, 0)) + assertThrows[IllegalArgumentException](newTermName("foo".toCharArray, -1, 1)) + } + + @Test + def testUnspecializedName(): Unit = { + def test(expected: Name, nme: Name) { + assertEquals(expected, unspecializedName(nme)) + } + test(TermName("Tuple2"), TermName("Tuple2$mcII" + SPECIALIZED_SUFFIX)) + test(TermName("foo"), TermName("foo$mIcD" + SPECIALIZED_SUFFIX)) + test(TermName("foo"), TermName("foo$mIc" + SPECIALIZED_SUFFIX)) + test(TermName("T1"), TermName(s"T1$SPECIALIZED_SUFFIX")) + test(TermName(""), SPECIALIZED_SUFFIX) + } + + @Test + def testSplitSpecializedName(): Unit = { + def test(expected: (Name, String, String), nme: Name) { + assertEquals(expected, splitSpecializedName(nme)) + } + test((TermName("Tuple2"), "II", ""), TermName("Tuple2$mcII" + SPECIALIZED_SUFFIX)) + test((TermName("foo"), "D", "I"), TermName("foo$mIcD" + SPECIALIZED_SUFFIX)) + test((TermName("foo"), "", "I"), TermName("foo$mIc" + SPECIALIZED_SUFFIX)) + test((TermName("T1"), "", ""), TermName(s"T1$SPECIALIZED_SUFFIX")) + test((TermName(""), "", ""), SPECIALIZED_SUFFIX) + } +} |