Reversed the values of "is" and "is not" in recent for comprehension deprecation.
DO NOT BLOW HATCH REPEAT DO NOT BLOW HATCH "Roger! Hatch blown." Events reveal it was all baby, no bathwater. It turns out that the specification is merely a document, not infallible holy writ as we had all previously believed. So it is not the ABSENCE of val in a for comprehension assignment which is deprecated, it is the PRESENCE of val. Summarizing again, more accurately perhaps: for (x <- 1 to 5 ; y = x) yield x+y // THAT's the one for (val x <- 1 to 5 ; y = x) yield x+y // fail for (val x <- 1 to 5 ; val y = x) yield x+y // fail for (x <- 1 to 5 ; val y = x) yield x+y // deprecated No review. git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25484 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
9d54213c10
commit
d440c79aa6
|
@ -1640,12 +1640,9 @@ self =>
|
|||
val point = in.offset
|
||||
val hasEq = in.token == EQUALS
|
||||
|
||||
if (hasVal && !hasEq)
|
||||
syntaxError(in.offset, "val in for comprehension must be followed by assignment")
|
||||
if (!hasVal && hasEq) {
|
||||
deprecationWarning(in.lastOffset, "for comprehension assignment without a `val' declaration is deprecated.")
|
||||
// not yet, deprecated in 2.10.0.
|
||||
// syntaxError(in.offset, "assignment in for comprehension must be preceded by `val`")
|
||||
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()
|
||||
|
|
|
@ -318,7 +318,7 @@ abstract class TreeBuilder {
|
|||
*
|
||||
* 3.
|
||||
*
|
||||
* for (P_1 <- G_1; val P_2 <- G_2; ...) ...
|
||||
* for (P_1 <- G_1; P_2 <- G_2; ...) ...
|
||||
* ==>
|
||||
* G_1.flatMap (P_1 => for (P_2 <- G_2; ...) ...)
|
||||
*
|
||||
|
@ -330,7 +330,7 @@ abstract class TreeBuilder {
|
|||
*
|
||||
* 5. For N < MaxTupleArity:
|
||||
*
|
||||
* for (P_1 <- G; val P_2 = E_2; val P_N = E_N; ...)
|
||||
* for (P_1 <- G; P_2 = E_2; val P_N = E_N; ...)
|
||||
* ==>
|
||||
* for (TupleN(P_1, P_2, ... P_N) <-
|
||||
* for (x_1 @ P_1 <- G) yield {
|
||||
|
|
|
@ -224,7 +224,7 @@ trait Members { self: ICodes =>
|
|||
val nextBlock: mutable.Map[BasicBlock, BasicBlock] = mutable.HashMap.empty
|
||||
for (b <- code.blocks.toList
|
||||
if b.successors.length == 1;
|
||||
val succ = b.successors.head;
|
||||
succ = b.successors.head;
|
||||
if succ ne b;
|
||||
if succ.predecessors.length == 1;
|
||||
if succ.predecessors.head eq b;
|
||||
|
|
|
@ -44,7 +44,7 @@ abstract class Liveness {
|
|||
gen.clear()
|
||||
kill.clear()
|
||||
|
||||
for (b <- m.code.blocks; val (g, k) = genAndKill(b)) {
|
||||
for (b <- m.code.blocks; (g, k) = genAndKill(b)) {
|
||||
gen += (b -> g)
|
||||
kill += (b -> k)
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ abstract class ReachingDefinitions {
|
|||
drops.clear()
|
||||
outStack.clear()
|
||||
|
||||
for (b <- m.code.blocks.toList; val (g, k) = genAndKill(b); val (d, st) = dropsAndGen(b)) {
|
||||
for (b <- m.code.blocks.toList; (g, k) = genAndKill(b); (d, st) = dropsAndGen(b)) {
|
||||
gen += (b -> g)
|
||||
kill += (b -> k)
|
||||
drops += (b -> d)
|
||||
|
|
|
@ -421,11 +421,15 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
|
|||
c.cunit.source.toString)
|
||||
|
||||
var fieldList = List[String]()
|
||||
for (f <- clasz.fields if f.symbol.hasGetter;
|
||||
val g = f.symbol.getter(c.symbol);
|
||||
val s = f.symbol.setter(c.symbol);
|
||||
if g.isPublic && !(f.symbol.name startsWith "$")) // inserting $outer breaks the bean
|
||||
for {
|
||||
f <- clasz.fields
|
||||
if f.symbol.hasGetter
|
||||
g = f.symbol.getter(c.symbol)
|
||||
s = f.symbol.setter(c.symbol)
|
||||
if g.isPublic && !(f.symbol.name startsWith "$") // inserting $outer breaks the bean
|
||||
} {
|
||||
fieldList = javaName(f.symbol) :: javaName(g) :: (if (s != NoSymbol) javaName(s) else null) :: fieldList
|
||||
}
|
||||
val methodList =
|
||||
for (m <- clasz.methods
|
||||
if !m.symbol.isConstructor &&
|
||||
|
|
|
@ -330,7 +330,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
|
|||
|
||||
/** Update the map of definitions per source file */
|
||||
private def updateDefinitions(files: Set[AbstractFile]) {
|
||||
for (src <- files; val localDefs = compiler.dependencyAnalysis.definitions(src)) {
|
||||
for (src <- files; localDefs = compiler.dependencyAnalysis.definitions(src)) {
|
||||
definitions(src) = (localDefs map (s => {
|
||||
this.classes += s.fullName -> src
|
||||
SymWithHistory(
|
||||
|
|
|
@ -1064,13 +1064,12 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends
|
|||
for {
|
||||
tpe <- typeOfTerm(id)
|
||||
clazz <- classOfTerm(id)
|
||||
val staticSym = tpe.typeSymbol
|
||||
staticSym = tpe.typeSymbol
|
||||
runtimeSym <- safeClass(clazz.getName)
|
||||
if runtimeSym != staticSym
|
||||
if runtimeSym isSubClass staticSym
|
||||
} yield {
|
||||
runtimeSym.info
|
||||
}
|
||||
yield runtimeSym.info
|
||||
}
|
||||
|
||||
object replTokens extends {
|
||||
|
|
|
@ -251,7 +251,7 @@ abstract class SymbolLoaders {
|
|||
}
|
||||
}
|
||||
// enter decls of parent classes
|
||||
for (pt <- module.info.parents; val p = pt.typeSymbol) {
|
||||
for (pt <- module.info.parents; p = pt.typeSymbol) {
|
||||
if (p != definitions.ObjectClass && p != definitions.ScalaObjectClass) {
|
||||
openPackageModule(p)(packageClass)
|
||||
}
|
||||
|
|
|
@ -417,7 +417,7 @@ abstract class ClassfileParser {
|
|||
val parts = name.decode.toString.split(Array('.', '$'))
|
||||
var sym: Symbol = definitions.RootClass
|
||||
atPhase(currentRun.flattenPhase.prev) {
|
||||
for (part0 <- parts; if !(part0 == ""); val part = newTermName(part0)) {
|
||||
for (part0 <- parts; if !(part0 == ""); part = newTermName(part0)) {
|
||||
val sym1 = atPhase(currentRun.icodePhase) {
|
||||
sym.linkedClassOfClass.info
|
||||
sym.info.decl(part.encode)
|
||||
|
|
|
@ -310,7 +310,7 @@ abstract class Constructors extends Transform with ast.TreeDSL {
|
|||
}
|
||||
|
||||
log("merging: " + originalStats.mkString("\n") + "\nwith\n" + specializedStats.mkString("\n"))
|
||||
val res = for (s <- originalStats; val stat = s.duplicate) yield {
|
||||
val res = for (s <- originalStats; stat = s.duplicate) yield {
|
||||
log("merge: looking at " + stat)
|
||||
val stat1 = stat match {
|
||||
case Assign(sel @ Select(This(_), field), _) =>
|
||||
|
|
|
@ -856,7 +856,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
|
|||
*/
|
||||
def addCheckedGetters(clazz: Symbol, stats: List[Tree]): List[Tree] = {
|
||||
|
||||
val stats1 = for (stat <- stats; val sym = stat.symbol) yield stat match {
|
||||
val stats1 = for (stat <- stats; sym = stat.symbol) yield stat match {
|
||||
case DefDef(mods, name, tp, vp, tpt, rhs)
|
||||
if sym.isLazy && rhs != EmptyTree && !clazz.isImplClass =>
|
||||
assert(fieldOffset.isDefinedAt(sym))
|
||||
|
|
|
@ -1512,7 +1512,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
|
|||
val (oldtparams, newtparams) = reskolemize(tparams)
|
||||
|
||||
// create fresh symbols for value parameters to hold the skolem types
|
||||
val vparamss1 = List(for (vdef <- vparamss.head; val param = vdef.symbol) yield {
|
||||
val vparamss1 = List(for (vdef <- vparamss.head; param = vdef.symbol) yield {
|
||||
ValDef(param.cloneSymbol(symbol).setInfo(param.info.substSym(oldtparams, newtparams)))
|
||||
})
|
||||
|
||||
|
@ -1551,20 +1551,21 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
|
|||
if (info(m).target.hasAccessorFlag) hasSpecializedFields = true
|
||||
if (m.isClassConstructor) {
|
||||
val origParamss = parameters(info(m).target)
|
||||
|
||||
val vparams =
|
||||
for ((tp, sym) <- m.info.paramTypes zip origParamss(0))
|
||||
yield m.newValue(sym.pos, specializedName(sym, typeEnv(cls)))
|
||||
val vparams = (
|
||||
for ((tp, sym) <- m.info.paramTypes zip origParamss(0)) yield (
|
||||
m.newValue(sym.pos, specializedName(sym, typeEnv(cls)))
|
||||
.setInfo(tp)
|
||||
.setFlag(sym.flags)
|
||||
|
||||
)
|
||||
)
|
||||
// param accessors for private members (the others are inherited from the generic class)
|
||||
if (m.isPrimaryConstructor)
|
||||
for (param <- vparams if cls.info.nonPrivateMember(param.name) == NoSymbol;
|
||||
val acc = param.cloneSymbol(cls).setFlag(PARAMACCESSOR | PRIVATE)) {
|
||||
if (m.isPrimaryConstructor) {
|
||||
for (param <- vparams ; if cls.info.nonPrivateMember(param.name) == NoSymbol) {
|
||||
val acc = param.cloneSymbol(cls).setFlag(PARAMACCESSOR | PRIVATE)
|
||||
cls.info.decls.enter(acc)
|
||||
mbrs += ValDef(acc, EmptyTree).setType(NoType).setPos(m.pos)
|
||||
}
|
||||
}
|
||||
|
||||
// ctor
|
||||
mbrs += atPos(m.pos)(DefDef(m, Modifiers(m.flags), List(vparams) map (_ map ValDef), EmptyTree))
|
||||
|
|
|
@ -78,7 +78,7 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with
|
|||
case Match(selector, cases) if (ext.isDefined && getAnswerTypeAnn(body.tpe).isEmpty) =>
|
||||
val cases1 = for {
|
||||
cd @ CaseDef(pat, guard, caseBody) <- cases
|
||||
val caseBody1 = transExpr(body, None, ext)
|
||||
caseBody1 = transExpr(body, None, ext)
|
||||
} yield {
|
||||
treeCopy.CaseDef(cd, transform(pat), transform(guard), caseBody1)
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with
|
|||
|
||||
val caseVals = for {
|
||||
cd @ CaseDef(pat, guard, body) <- cases
|
||||
val bodyVal = transExpr(body, cpsA2, cpsR2)
|
||||
bodyVal = transExpr(body, cpsA2, cpsR2)
|
||||
} yield {
|
||||
treeCopy.CaseDef(cd, transform(pat), transform(guard), bodyVal)
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with
|
|||
|
||||
val catchVals = for {
|
||||
cd @ CaseDef(pat, guard, body) <- catches
|
||||
val bodyVal = transExpr(body, cpsA, cpsR)
|
||||
bodyVal = transExpr(body, cpsA, cpsR)
|
||||
} yield {
|
||||
treeCopy.CaseDef(cd, transform(pat), transform(guard), bodyVal)
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ abstract class WordBerrySethi extends BaseBerrySethi {
|
|||
}
|
||||
|
||||
protected def collectTransitions(): Unit = // make transitions
|
||||
for (j <- 0 until pos ; val fol = follow(j) ; k <- fol) {
|
||||
for (j <- 0 until pos ; fol = follow(j) ; k <- fol) {
|
||||
if (pos == k) finals = finals.updated(j, finalTag)
|
||||
else makeTransition(j, k, labelAt(k))
|
||||
}
|
||||
|
|
|
@ -43,12 +43,12 @@ final class MultipleFilesILPrinterVisitor(destPath: String, sourceFilesPath: Str
|
|||
// print each module
|
||||
var m: Array[Module] = assemblyBuilder.GetModules()
|
||||
nomembers = true
|
||||
for(val i <- 0 until m.length) {
|
||||
for(i <- 0 until m.length) {
|
||||
print(m(i).asInstanceOf[ModuleBuilder])
|
||||
}
|
||||
|
||||
nomembers = false
|
||||
for(val i <- 0 until m.length) {
|
||||
for(i <- 0 until m.length) {
|
||||
print(m(i).asInstanceOf[ModuleBuilder])
|
||||
}
|
||||
ILPrinterVisitor.currAssembly = null
|
||||
|
@ -72,7 +72,7 @@ final class MultipleFilesILPrinterVisitor(destPath: String, sourceFilesPath: Str
|
|||
|
||||
// "Types" contain all the classes
|
||||
var t: Array[Type] = module.GetTypes()
|
||||
for(val i <- 0 until t.length) {
|
||||
for(i <- 0 until t.length) {
|
||||
val tBuilder = t(i).asInstanceOf[TypeBuilder]
|
||||
val sourceFilename = tBuilder.sourceFilename
|
||||
val sourceFilepath = new File(tBuilder.sourceFilepath).getCanonicalPath
|
||||
|
@ -124,7 +124,7 @@ final class MultipleFilesILPrinterVisitor(destPath: String, sourceFilesPath: Str
|
|||
printAttributes(module)
|
||||
}
|
||||
|
||||
for(val i <- 0 until m.length) {
|
||||
for(i <- 0 until m.length) {
|
||||
print(m(i).asInstanceOf[MethodBuilder])
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ final class SingleFileILPrinterVisitor(_fileName: String) extends ILPrinterVisit
|
|||
// print each module
|
||||
var m: Array[Module] = assemblyBuilder.GetModules()
|
||||
nomembers = true
|
||||
for(val i <- 0 until m.length) {
|
||||
for(i <- 0 until m.length) {
|
||||
print(m(i).asInstanceOf[ModuleBuilder])
|
||||
}
|
||||
|
||||
nomembers = false
|
||||
for(val i <- 0 until m.length) {
|
||||
for(i <- 0 until m.length) {
|
||||
print(m(i).asInstanceOf[ModuleBuilder])
|
||||
}
|
||||
// close out file
|
||||
|
@ -79,12 +79,12 @@ final class SingleFileILPrinterVisitor(_fileName: String) extends ILPrinterVisit
|
|||
module.CreateGlobalFunctions()
|
||||
|
||||
var m: Array[MethodInfo] = module.GetMethods()
|
||||
for(val i <- 0 until m.length) {
|
||||
for(i <- 0 until m.length) {
|
||||
print(m(i).asInstanceOf[MethodBuilder])
|
||||
}
|
||||
|
||||
var t: Array[Type] = module.GetTypes()
|
||||
for(val i <- 0 until t.length) {
|
||||
for(i <- 0 until t.length) {
|
||||
print(t(i).asInstanceOf[TypeBuilder])
|
||||
}
|
||||
currentModule = null
|
||||
|
|
|
@ -222,7 +222,7 @@ class TypeBuilder (module: Module, attributes: Int, fullName: String, baseType:
|
|||
object TypeBuilder {
|
||||
def types2String(types: Array[Type]): String = {
|
||||
var s = new StringBuffer("(")
|
||||
for(val i <- 0 until types.length) {
|
||||
for(i <- 0 until types.length) {
|
||||
if (i > 0) s.append(", ")
|
||||
s.append(types(i))
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ object TypeBuilder {
|
|||
val p2 = m2.GetParameters()
|
||||
if (p1.length != p2.length)
|
||||
return false
|
||||
for(val i <- 0 until p1.length)
|
||||
for(i <- 0 until p1.length)
|
||||
if (p1(i).ParameterType != p2(i).ParameterType)
|
||||
return false
|
||||
return true
|
||||
|
@ -252,7 +252,7 @@ object TypeBuilder {
|
|||
val p2 = c2.GetParameters()
|
||||
if (p1.length != p2.length)
|
||||
return false
|
||||
for(val i <- 0 until p1.length)
|
||||
for(i <- 0 until p1.length)
|
||||
if (p1(i).ParameterType != p2(i).ParameterType)
|
||||
return false
|
||||
return true
|
||||
|
|
|
@ -143,7 +143,7 @@ object Arbitrary {
|
|||
/** Arbitrary instance of Date */
|
||||
implicit lazy val arbDate: Arbitrary[Date] = Arbitrary(for {
|
||||
l <- arbitrary[Long]
|
||||
val d = new Date
|
||||
d = new Date
|
||||
} yield new Date(d.getTime + l))
|
||||
|
||||
/** Arbitrary instance of Throwable */
|
||||
|
|
|
@ -399,7 +399,7 @@ object Gen {
|
|||
/** A generator that picks a given number of elements from a list, randomly */
|
||||
def pick[T](n: Int, g1: Gen[T], g2: Gen[T], gs: Gen[T]*): Gen[Seq[T]] = for {
|
||||
is <- pick(n, 0 until (gs.size+2))
|
||||
val allGs = gs ++ (g1::g2::Nil)
|
||||
allGs = gs ++ (g1::g2::Nil)
|
||||
xs <- sequence[List,T](is.toList.map(allGs(_)))
|
||||
} yield xs
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ object Pretty {
|
|||
"> Collected test data: " / {
|
||||
for {
|
||||
(xs,r) <- fm.getRatios
|
||||
val ys = xs - ()
|
||||
ys = xs - ()
|
||||
if !ys.isEmpty
|
||||
} yield round(r*100)+"% " + ys.mkString(", ")
|
||||
}.mkString("\n")
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
for-comprehension-old.scala:2: warning: for comprehension assignment without a `val' declaration is deprecated.
|
||||
for (x <- 1 to 5 ; y = x) yield x+y // fail
|
||||
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:4: warning: for comprehension assignment without a `val' declaration is deprecated.
|
||||
for (val x <- 1 to 5 ; 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:7: warning: for comprehension assignment without a `val' declaration is deprecated.
|
||||
for (z <- 1 to 2 ; x <- 1 to 5 ; 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:9: warning: for comprehension assignment without a `val' declaration is deprecated.
|
||||
for (z <- 1 to 2 ; val x <- 1 to 5 ; 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
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
class A {
|
||||
for (x <- 1 to 5 ; y = x) yield x+y // fail
|
||||
for (x <- 1 to 5 ; val y = x) yield x+y // ok
|
||||
for (x <- 1 to 5 ; y = x) yield x+y // ok
|
||||
for (x <- 1 to 5 ; val y = x) yield x+y // fail
|
||||
for (val x <- 1 to 5 ; y = x) yield x+y // fail
|
||||
for (val x <- 1 to 5 ; val y = x) yield x+y // fail
|
||||
|
||||
for (z <- 1 to 2 ; x <- 1 to 5 ; y = x) yield x+y // fail
|
||||
for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // ok
|
||||
for (z <- 1 to 2 ; x <- 1 to 5 ; y = x) yield x+y // ok
|
||||
for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // fail
|
||||
for (z <- 1 to 2 ; val x <- 1 to 5 ; y = x) yield x+y // fail
|
||||
for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
t4163.scala:4: error: '<-' expected but '=' found.
|
||||
val x = 3
|
||||
x = 3
|
||||
^
|
||||
t4163.scala:5: error: illegal start of simple expression
|
||||
y <- 0 to 100
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Bug {
|
||||
val z = (
|
||||
for {
|
||||
val x = 3
|
||||
x = 3
|
||||
y <- 0 to 100
|
||||
} yield y
|
||||
).toArray
|
||||
|
|
|
@ -12,6 +12,6 @@ abstract class Base {
|
|||
|
||||
abstract class Derived extends Base {
|
||||
def f(inputs: List[tType]): Unit = {
|
||||
for (t <- inputs; val m = t.module) { }
|
||||
for (t <- inputs; m = t.module) { }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,6 @@ class Foo extends TestJava {
|
|||
val aVal = repeatParam("1","2","3") */
|
||||
|
||||
// THIS YIELDS TO CRASH
|
||||
for (a <- 1 to 4 ; val anotherVal = repeatParam("1","2","3"))
|
||||
for (a <- 1 to 4 ; anotherVal = repeatParam("1","2","3"))
|
||||
yield anotherVal
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
object Unpositioned1 {
|
||||
for (a <- Some("foo") ; val b = true) {}
|
||||
for (a <- Some("foo") ; b = true) {}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ trait ScalaNodeScannerXXX {
|
|||
trait UnfixedImpl extends NodeImpl { def self : Unfixed; }
|
||||
}
|
||||
//def f = { Console.println("hello"); 42; }
|
||||
//for (val ns <-n; val i <- 0.until(ns)) yield f;
|
||||
//for (ns <-n; val i <- 0.until(ns)) yield f;
|
||||
|
||||
|
||||
trait NewScalaScannerXXX extends ScalaNodeScannerXXX {
|
||||
|
|
|
@ -76,10 +76,10 @@ object Test extends App {
|
|||
for {x <- it
|
||||
if x % 2 == 0} print(x + " "); println
|
||||
for (x <- it;
|
||||
val y = 2
|
||||
y = 2
|
||||
if x % y == 0) print(x + " "); println
|
||||
for {x <- it
|
||||
val y = 2
|
||||
y = 2
|
||||
if x % y == 0} print(x + " "); println
|
||||
|
||||
// arrays
|
||||
|
|
|
@ -24,7 +24,7 @@ object Test {
|
|||
val input = L.range(0,20)
|
||||
val oddFirstTimesTwo =
|
||||
for {x <- input
|
||||
val xf = firstDigit(x)
|
||||
xf = firstDigit(x)
|
||||
if xf % 2 == 1}
|
||||
yield x*2
|
||||
println(oddFirstTimesTwo)
|
||||
|
@ -36,9 +36,9 @@ object Test {
|
|||
val input = L.range(0, 20)
|
||||
val oddFirstTimesTwo =
|
||||
for {x <- input
|
||||
val xf = firstDigit(x)
|
||||
val yf = x - firstDigit(x) / 10
|
||||
val (a, b) = (xf - yf, xf + yf)
|
||||
xf = firstDigit(x)
|
||||
yf = x - firstDigit(x) / 10
|
||||
(a, b) = (xf - yf, xf + yf)
|
||||
if xf % 2 == 1}
|
||||
yield a + b
|
||||
println(oddFirstTimesTwo)
|
||||
|
@ -51,7 +51,7 @@ object Test {
|
|||
val input = L.range(0, 20).iterator
|
||||
val oddFirstTimesTwo =
|
||||
for {x <- input
|
||||
val xf = firstDigit(x)
|
||||
xf = firstDigit(x)
|
||||
if xf % 2 == 1}
|
||||
yield x*2
|
||||
println(oddFirstTimesTwo.toList)
|
||||
|
@ -63,7 +63,7 @@ object Test {
|
|||
val input = L.range(0,20)
|
||||
val oddFirstTimesTwo =
|
||||
for {x <- input
|
||||
val xf = firstDigit(x)
|
||||
xf = firstDigit(x)
|
||||
if xf % 2 == 1}
|
||||
yield xf*2
|
||||
println(oddFirstTimesTwo)
|
||||
|
@ -80,7 +80,7 @@ object Test {
|
|||
|
||||
val input = L.range(0,20)
|
||||
for {x <- input
|
||||
val xf = fdct(x)
|
||||
xf = fdct(x)
|
||||
if xf % 2 == 1}
|
||||
yield xf
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ object Test {
|
|||
def main(args: Array[String]) {
|
||||
for (length <- 0 to maxListLength;
|
||||
bitmap <- 0 until (1 << length);
|
||||
val data = List.range(0, length) map { x: Int =>
|
||||
data = List.range(0, length) map { x: Int =>
|
||||
if ((bitmap & (1 << x)) != 0) BigInt(x+16)
|
||||
else BigInt(x)
|
||||
})
|
||||
|
|
|
@ -30,12 +30,18 @@ scala> object o {
|
|||
}
|
||||
}
|
||||
case class DingDangDoobie(ding: Int, dang: Int, doobie: Double)
|
||||
case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x
|
||||
case class Dongoo
|
||||
@serializable case class Heyooooo
|
||||
|
||||
@deprecated("I'm an ironic deprecation warning") def f0 = 5 // where's this disappearing?
|
||||
def f1 = scala.Math.Pi // and this?
|
||||
}
|
||||
warning: there were 4 deprecation warnings; re-run with -deprecation for details
|
||||
warning: there were 6 deprecation warnings; re-run with -deprecation for details
|
||||
warning: there were 3 unchecked warnings; re-run with -unchecked for details
|
||||
defined module o
|
||||
|
||||
scala>
|
||||
|
||||
scala> :warnings
|
||||
<console>:3: warning: case classes without a parameter list have been deprecated;
|
||||
use either case objects or case classes with `()' as parameter list.
|
||||
|
@ -43,14 +49,15 @@ use either case objects or case classes with `()' as parameter list.
|
|||
^
|
||||
<console>:11: warning: case classes without a parameter list have been deprecated;
|
||||
use either case objects or case classes with `()' as parameter list.
|
||||
case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x
|
||||
case class Dongoo
|
||||
^
|
||||
<console>:11: warning: case classes without a parameter list have been deprecated;
|
||||
use either case objects or case classes with `()' as parameter list.
|
||||
case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x
|
||||
case class Dongoo
|
||||
^
|
||||
<console>:11: warning: for comprehension assignment without a `val' declaration is deprecated.
|
||||
case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x
|
||||
<console>:12: warning: case classes without a parameter list have been deprecated;
|
||||
use either case objects or case classes with `()' as parameter list.
|
||||
@serializable case class Heyooooo
|
||||
^
|
||||
|
||||
scala>
|
||||
|
|
|
@ -19,8 +19,13 @@ object o {
|
|||
}
|
||||
}
|
||||
case class DingDangDoobie(ding: Int, dang: Int, doobie: Double)
|
||||
case class Dongoo ; case class Heyooooo ; for (x <- 1 to 10 ; val y = x ; z = y) yield x
|
||||
case class Dongoo
|
||||
@serializable case class Heyooooo
|
||||
|
||||
@deprecated("I'm an ironic deprecation warning") def f0 = 5 // where's this disappearing?
|
||||
def f1 = scala.Math.Pi // and this?
|
||||
}
|
||||
|
||||
:warnings
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -104,10 +104,10 @@ object Test {
|
|||
val scrut = s1f(seq)
|
||||
|
||||
for (Method(f, (trueList, falseList), descr) <- methodList) {
|
||||
for (s <- trueList; val rhs = s2f(s))
|
||||
for (s <- trueList; rhs = s2f(s))
|
||||
assertOne(scrut, rhs, f(scrut, rhs), descr)
|
||||
|
||||
for (s <- falseList; val rhs = s2f(s))
|
||||
for (s <- falseList; rhs = s2f(s))
|
||||
assertOne(scrut, rhs, !f(scrut, rhs), "!(" + descr + ")")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ object Test extends App {
|
|||
|
||||
def f(ts: List[tType]): Unit = {
|
||||
|
||||
for (t <- ts; val m = t.module) {}
|
||||
for (t <- ts; m = t.module) {}
|
||||
ts.map(t => t.module).foreach { _ => () }
|
||||
// ts.map(t => (t : T).module).foreach { _ => () } // runs successfully
|
||||
}
|
||||
|
|
|
@ -1,201 +1,201 @@
|
|||
ackermann object Test extends Application {
|
||||
for(val n <- List(9,10,11)) ackermann.main(Array(n.toString))
|
||||
for(n <- List(9,10,11)) ackermann.main(Array(n.toString))
|
||||
}
|
||||
ary object Test extends Application {
|
||||
for(val n <- List(3000,5000,7000,9000)) ary.main(Array(n.toString))
|
||||
for(n <- List(3000,5000,7000,9000)) ary.main(Array(n.toString))
|
||||
}
|
||||
binarytrees object Test extends Application {
|
||||
for(val n <- List(12,14,16)) binarytrees.main(Array(n.toString))
|
||||
for(n <- List(12,14,16)) binarytrees.main(Array(n.toString))
|
||||
}
|
||||
chameneos object Test extends Application {
|
||||
for(val n <- List(10000,100000,1000000)) chameneos.main(Array(n.toString))
|
||||
for(n <- List(10000,100000,1000000)) chameneos.main(Array(n.toString))
|
||||
}
|
||||
dispatch object Test extends Application {
|
||||
for(val n <- List(200000,600000,1000000)) dispatch.main(Array(n.toString))
|
||||
for(n <- List(200000,600000,1000000)) dispatch.main(Array(n.toString))
|
||||
}
|
||||
echo object Test extends Application {
|
||||
for(val n <- List(40000,70000,100000,150000)) echo.main(Array(n.toString))
|
||||
for(n <- List(40000,70000,100000,150000)) echo.main(Array(n.toString))
|
||||
}
|
||||
except object Test extends Application {
|
||||
for(val n <- List(100000,150000,200000,250000)) except.main(Array(n.toString))
|
||||
for(n <- List(100000,150000,200000,250000)) except.main(Array(n.toString))
|
||||
}
|
||||
fannkuch object Test extends Application {
|
||||
for(val n <- List(8,9,10)) fannkuch.main(Array(n.toString))
|
||||
for(n <- List(8,9,10)) fannkuch.main(Array(n.toString))
|
||||
}
|
||||
fasta object Test extends Application {
|
||||
for(val n <- List(25000,250000,2500000)) fasta.main(Array(n.toString))
|
||||
for(n <- List(25000,250000,2500000)) fasta.main(Array(n.toString))
|
||||
}
|
||||
fibo object Test extends Application {
|
||||
for(val n <- List(12,24,32)) fibo.main(Array(n.toString))
|
||||
for(n <- List(12,24,32)) fibo.main(Array(n.toString))
|
||||
}
|
||||
harmonic object Test extends Application {
|
||||
for(val n <- List(6000000,8000000,10000000)) harmonic.main(Array(n.toString))
|
||||
for(n <- List(6000000,8000000,10000000)) harmonic.main(Array(n.toString))
|
||||
}
|
||||
hash object Test extends Application {
|
||||
for(val n <- List(40000,60000,80000,100000)) hash.main(Array(n.toString))
|
||||
for(n <- List(40000,60000,80000,100000)) hash.main(Array(n.toString))
|
||||
}
|
||||
hash2 object Test extends Application {
|
||||
for(val n <- List(50,100,150,200)) hash2.main(Array(n.toString))
|
||||
for(n <- List(50,100,150,200)) hash2.main(Array(n.toString))
|
||||
}
|
||||
health object Test extends Application {
|
||||
for(val n <- List(200,600,1000)) health.main(Array(n.toString))
|
||||
for(n <- List(200,600,1000)) health.main(Array(n.toString))
|
||||
}
|
||||
heapsort object Test extends Application {
|
||||
for(val n <- List(20000,40000,60000,80000,100000)) heapsort.main(Array(n.toString))
|
||||
for(n <- List(20000,40000,60000,80000,100000)) heapsort.main(Array(n.toString))
|
||||
}
|
||||
hello object Test extends Application {
|
||||
for(val n <- List(1,50,100,150,200)) hello.main(Array(n.toString))
|
||||
for(n <- List(1,50,100,150,200)) hello.main(Array(n.toString))
|
||||
}
|
||||
implicitode object Test extends Application {
|
||||
for(val n <- List(5,10,20,50)) implicitode.main(Array(n.toString))
|
||||
for(n <- List(5,10,20,50)) implicitode.main(Array(n.toString))
|
||||
}
|
||||
knucleotide object Test extends Application {
|
||||
for(val n <- List(2500,25000,250000)) knucleotide.main(Array(n.toString))
|
||||
for(n <- List(2500,25000,250000)) knucleotide.main(Array(n.toString))
|
||||
}
|
||||
knucleotide inputfile=../../website/desc/knucleotide-input.txt
|
||||
lists object Test extends Application {
|
||||
for(val n <- List(4,8,12,16,18)) lists.main(Array(n.toString))
|
||||
for(n <- List(4,8,12,16,18)) lists.main(Array(n.toString))
|
||||
}
|
||||
magicsquares object Test extends Application {
|
||||
for(val n <- List(3,4,5)) magicsquares.main(Array(n.toString))
|
||||
for(n <- List(3,4,5)) magicsquares.main(Array(n.toString))
|
||||
}
|
||||
mandelbrot object Test extends Application {
|
||||
for(val n <- List(200,400,600)) mandelbrot.main(Array(n.toString))
|
||||
for(n <- List(200,400,600)) mandelbrot.main(Array(n.toString))
|
||||
}
|
||||
matrix object Test extends Application {
|
||||
for(val n <- List(10,200,400,600)) matrix.main(Array(n.toString))
|
||||
for(n <- List(10,200,400,600)) matrix.main(Array(n.toString))
|
||||
}
|
||||
message object Test extends Application {
|
||||
for(val n <- List(1000,2000,3000)) message.main(Array(n.toString))
|
||||
for(n <- List(1000,2000,3000)) message.main(Array(n.toString))
|
||||
}
|
||||
meteor object Test extends Application {
|
||||
for(val n <- List(0)) meteor.main(Array(n.toString))
|
||||
for(n <- List(0)) meteor.main(Array(n.toString))
|
||||
}
|
||||
methcall object Test extends Application {
|
||||
for(val n <- List(100000,400000,700000,1000000)) methcall.main(Array(n.toString))
|
||||
for(n <- List(100000,400000,700000,1000000)) methcall.main(Array(n.toString))
|
||||
}
|
||||
moments object Test extends Application {
|
||||
for(val n <- List(25,75,125,200)) {
|
||||
for(n <- List(25,75,125,200)) {
|
||||
System.setIn(new java.io.FileInputStream(System.getProperty("partest.cwd")+"/moments-input"+n+".txt"))
|
||||
moments.main(Array(n.toString))
|
||||
}
|
||||
}
|
||||
|
||||
nbody object Test extends Application {
|
||||
for(val n <- List(200000,2000000,20000000)) nbody.main(Array(n.toString))
|
||||
for(n <- List(200000,2000000,20000000)) nbody.main(Array(n.toString))
|
||||
}
|
||||
nestedloop object Test extends Application {
|
||||
for(val n <- List(8,12,16,18)) nestedloop.main(Array(n.toString))
|
||||
for(n <- List(8,12,16,18)) nestedloop.main(Array(n.toString))
|
||||
}
|
||||
nsieve object Test extends Application {
|
||||
for(val n <- List(7,8,9)) nsieve.main(Array(n.toString))
|
||||
for(n <- List(7,8,9)) nsieve.main(Array(n.toString))
|
||||
}
|
||||
nsievebits object Test extends Application {
|
||||
for(val n <- List(7,8,9)) nsievebits.main(Array(n.toString))
|
||||
for(n <- List(7,8,9)) nsievebits.main(Array(n.toString))
|
||||
}
|
||||
objinst object Test extends Application {
|
||||
for(val n <- List(400000,700000,1000000,1500000)) objinst.main(Array(n.toString))
|
||||
for(n <- List(400000,700000,1000000,1500000)) objinst.main(Array(n.toString))
|
||||
}
|
||||
partialsums object Test extends Application {
|
||||
for(val n <- List(25000,250000,2500000)) partialsums.main(Array(n.toString))
|
||||
for(n <- List(25000,250000,2500000)) partialsums.main(Array(n.toString))
|
||||
}
|
||||
pidigits object Test extends Application {
|
||||
for(val n <- List(600,800,1000)) pidigits.main(Array(n.toString))
|
||||
for(n <- List(600,800,1000)) pidigits.main(Array(n.toString))
|
||||
}
|
||||
process object Test extends Application {
|
||||
for(val n <- List(1000,2000,3000)) process.main(Array(n.toString))
|
||||
for(n <- List(1000,2000,3000)) process.main(Array(n.toString))
|
||||
}
|
||||
prodcons object Test extends Application {
|
||||
for(val n <- List(30000,70000,100000,150000)) prodcons.main(Array(n.toString))
|
||||
for(n <- List(30000,70000,100000,150000)) prodcons.main(Array(n.toString))
|
||||
}
|
||||
random object Test extends Application {
|
||||
for(val n <- List(9000,300000,600000,900000)) random.main(Array(n.toString))
|
||||
for(n <- List(9000,300000,600000,900000)) random.main(Array(n.toString))
|
||||
}
|
||||
raytracer object Test extends Application {
|
||||
for(val n <- List(20,40,80,160)) raytracer.main(Array(n.toString))
|
||||
for(n <- List(20,40,80,160)) raytracer.main(Array(n.toString))
|
||||
}
|
||||
recursive object Test extends Application {
|
||||
for(val n <- List(3,7,11)) recursive.main(Array(n.toString))
|
||||
for(n <- List(3,7,11)) recursive.main(Array(n.toString))
|
||||
}
|
||||
regexdna object Test extends Application {
|
||||
for(val n <- List(100000,300000,500000)) {
|
||||
for(n <- List(100000,300000,500000)) {
|
||||
System.setIn(new java.io.FileInputStream(System.getProperty("partest.cwd")+"/regexdna-input"+n+".txt"))
|
||||
regexdna.main(Array(n.toString))
|
||||
}
|
||||
}
|
||||
regexmatch object Test extends Application {
|
||||
for(val n <- List(100,6000,9000,12000)) {
|
||||
for(n <- List(100,6000,9000,12000)) {
|
||||
System.setIn(new java.io.FileInputStream(System.getProperty("partest.cwd")+"/regexmatch-input"+n+".txt"))
|
||||
regexmatch.main(Array(n.toString))
|
||||
}
|
||||
}
|
||||
|
||||
revcomp object Test extends Application {
|
||||
for(val n <- List(25000,250000,2500000)) {
|
||||
for(n <- List(25000,250000,2500000)) {
|
||||
System.setIn(new java.io.FileInputStream(System.getProperty("partest.cwd")+"/revcomp-input"+n+".txt"))
|
||||
revcomp.main(Array(n.toString))
|
||||
}
|
||||
}
|
||||
|
||||
reversefile object Test extends Application {
|
||||
for(val n <- List(10,15,20,25)) reversefile.main(Array(n.toString))
|
||||
for(n <- List(10,15,20,25)) reversefile.main(Array(n.toString))
|
||||
}
|
||||
reversefile inputfile=../../website/desc/reversefile-input.txt
|
||||
|
||||
sieve object Test extends Application {
|
||||
for(val n <- List(300,600,900,1200)) sieve.main(Array(n.toString))
|
||||
for(n <- List(300,600,900,1200)) sieve.main(Array(n.toString))
|
||||
}
|
||||
spectralnorm object Test extends Application {
|
||||
for(val n <- List(500,1500,2500)) spectralnorm.main(Array(n.toString))
|
||||
for(n <- List(500,1500,2500)) spectralnorm.main(Array(n.toString))
|
||||
}
|
||||
spellcheck object Test extends Application {
|
||||
for(val n <- List(4,7,10,15)) spellcheck.main(Array(n.toString))
|
||||
for(n <- List(4,7,10,15)) spellcheck.main(Array(n.toString))
|
||||
}
|
||||
spellcheck inputfile=../../website/desc/spellcheck-input.txt
|
||||
|
||||
object Test extends Application {
|
||||
for(val n <- List(2500,25000,250000)) {
|
||||
for(n <- List(2500,25000,250000)) {
|
||||
System.setIn(new java.io.FileInputStream(System.getProperty("partest.cwd")+"/knucleotide-input"+n+".txt"))
|
||||
knucleotide.main(Array(n.toString))
|
||||
}
|
||||
}
|
||||
|
||||
strcat object Test extends Application {
|
||||
for(val n <- List(10000,20000,30000,40000)) strcat.main(Array(n.toString))
|
||||
for(n <- List(10000,20000,30000,40000)) strcat.main(Array(n.toString))
|
||||
}
|
||||
sumcol object Test extends Application {
|
||||
for(val n <- List(400,700,1000,8000)) {
|
||||
for(n <- List(400,700,1000,8000)) {
|
||||
System.setIn(new java.io.FileInputStream(System.getProperty("partest.cwd")+"/sumcol-input"+n+".txt"))
|
||||
sumcol.main(Array(n.toString))
|
||||
}
|
||||
}
|
||||
takfp object Test extends Application {
|
||||
for(val n <- List(8,9,10)) takfp.main(Array(n.toString))
|
||||
for(n <- List(8,9,10)) takfp.main(Array(n.toString))
|
||||
}
|
||||
tcpecho object Test extends Application {
|
||||
for(val n <- List(6,8,10)) tcpecho.main(Array(n.toString))
|
||||
for(n <- List(6,8,10)) tcpecho.main(Array(n.toString))
|
||||
}
|
||||
tcprequest object Test extends Application {
|
||||
for(val n <- List(120,160,200)) tcprequest.main(Array(n.toString))
|
||||
for(n <- List(120,160,200)) tcprequest.main(Array(n.toString))
|
||||
}
|
||||
tcpsocket object Test extends Application {
|
||||
for(val n <- List(1000,5000,9000)) tcpsocket.main(Array(n.toString))
|
||||
for(n <- List(1000,5000,9000)) tcpsocket.main(Array(n.toString))
|
||||
}
|
||||
tcpstream object Test extends Application {
|
||||
for(val n <- List(30,40,50)) tcpstream.main(Array(n.toString))
|
||||
for(n <- List(30,40,50)) tcpstream.main(Array(n.toString))
|
||||
}
|
||||
wc object Test extends Application {
|
||||
for(val n <- List(1000,1500,2000,2500)) wc.main(Array(n.toString))
|
||||
for(n <- List(1000,1500,2000,2500)) wc.main(Array(n.toString))
|
||||
}
|
||||
wc inputfile=Input
|
||||
|
||||
wordfreq object Test extends Application {
|
||||
for(val n <- List(5,10,15,20,25)) wordfreq.main(Array(n.toString))
|
||||
for(n <- List(5,10,15,20,25)) wordfreq.main(Array(n.toString))
|
||||
}
|
||||
wordfreq inputfile=../../website/desc/wordfreq-input.txt
|
||||
|
||||
object Test extends Application {
|
||||
for(val n <- List(2500,25000,250000)) {
|
||||
for(n <- List(2500,25000,250000)) {
|
||||
System.setIn(new java.io.FileInputStream(System.getProperty("partest.cwd")+"/knucleotide-input"+n+".txt"))
|
||||
knucleotide.main(Array(n.toString))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue