diff options
90 files changed, 523 insertions, 230 deletions
@@ -170,7 +170,7 @@ PROPERTIES <property file="${basedir}/build.number"/> <!-- Additional command line arguments for scalac. They are added to all build targets --> - <property name="scalac.args" value="-Xmacros"/> + <property name="scalac.args" value=""/> <property name="javac.args" value=""/> <!-- Sets location of pre-compiled libraries --> @@ -314,12 +314,13 @@ INITIALISATION <target name="init.version.done" depends="init.version.release, init.version.snapshot"/> <target name="init" depends="init.jars, init.maven.jars, init.version.done"> + <property name="scalac.args.always" value="-Xmacros" /> <!-- scalac.args.optimise is selectively overridden in certain antcall tasks. --> <property name="scalac.args.optimise" value=""/> <!-- scalac.args.quickonly are added to quick.* targets but not others (particularly, locker.) This is to facilitate testing new command line options which do not yet exist in starr. --> <property name="scalac.args.quickonly" value=""/> - <property name="scalac.args.all" value="${scalac.args} ${scalac.args.optimise}"/> + <property name="scalac.args.all" value="${scalac.args.always} ${scalac.args} ${scalac.args.optimise}"/> <property name="scalac.args.quick" value="${scalac.args.all} ${scalac.args.quickonly}"/> <!-- Setting-up Ant contrib tasks --> <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${lib.dir}/ant/ant-contrib.jar"/> @@ -826,7 +827,7 @@ QUICK BUILD (QUICK) <scalacfork destdir="${build-quick.dir}/classes/library" compilerpathref="quick.classpath" - params="${scalac.args.quick} -Xplugin-require:continuations" + params="${scalac.args.quick} -Xplugin-require:continuations -P:continuations:enable" srcdir="${src.dir}/continuations/library" jvmargs="${scalacfork.jvmargs}"> <include name="**/*.scala"/> @@ -1363,7 +1364,7 @@ BOOTSTRAPPING BUILD (STRAP) <scalacfork destdir="${build-strap.dir}/classes/library" compilerpathref="pack.classpath" - params="${scalac.args.all} -Xplugin-require:continuations" + params="${scalac.args.all} -Xplugin-require:continuations -P:continuations:enable" srcdir="${src.dir}/continuations/library" jvmargs="${scalacfork.jvmargs}"> <include name="**/*.scala"/> @@ -1937,7 +1938,7 @@ BOOTRAPING TEST AND TEST SUITE <partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java" timeout="2400000" srcdir="${partest.srcdir}" - scalacopts="${scalac.args.optimise} -Xplugin-require:continuations"> + scalacopts="${scalac.args.optimise} -Xplugin-require:continuations -P:continuations:enable"> <compilerarg value="-Xpluginsdir"/> <compilerarg file="${build-quick.dir}/misc/scala-devel/plugins"/> <compilationpath> diff --git a/gitignore.SAMPLE b/gitignore.SAMPLE index 3c15a5de9e..483ad4caca 100644 --- a/gitignore.SAMPLE +++ b/gitignore.SAMPLE @@ -27,4 +27,9 @@ /src/intellij/*.iml /src/intellij/*.ipr /src/intellij/*.iws +/.cache +/.idea +/.settings +# bak files produced by ./cleanup-commit +*.bak diff --git a/src/compiler/scala/reflect/internal/SymbolTable.scala b/src/compiler/scala/reflect/internal/SymbolTable.scala index ffc8178528..5ed37c04ad 100644 --- a/src/compiler/scala/reflect/internal/SymbolTable.scala +++ b/src/compiler/scala/reflect/internal/SymbolTable.scala @@ -52,6 +52,13 @@ abstract class SymbolTable extends api.Universe /** Overridden when we know more about what was happening during a failure. */ def supplementErrorMessage(msg: String): String = msg + + private[scala] def printCaller[T](msg: String)(result: T) = { + Console.err.println(msg + ": " + result) + Console.err.println("Called from:") + (new Throwable).getStackTrace.drop(2).take(15).foreach(Console.err.println) + result + } private[scala] def printResult[T](msg: String)(result: T) = { Console.err.println(msg + ": " + result) diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala index f9c1907696..a86462ad5f 100644 --- a/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala +++ b/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala @@ -287,7 +287,12 @@ class JLineCompletion(val intp: IMain) extends Completion with CompletionOutput } // chasing down results which won't parse + // This used to work fine, now it reports a type error before any + // exception gets to us. See SI-5657. Don't have time to deal with + // it, so disabling everything. def execute(line: String): Option[ExecResult] = { + return None // disabled + val parsed = Parsed(line) def noDotOrSlash = line forall (ch => ch != '.' && ch != '/') diff --git a/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala b/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala index 68bfeafbc6..099034fe97 100644 --- a/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala +++ b/src/compiler/scala/tools/nsc/interpreter/MemberHandlers.scala @@ -120,7 +120,7 @@ trait MemberHandlers { private def vparamss = member.vparamss private def isMacro = member.mods.hasFlag(scala.reflect.internal.Flags.MACRO) // true if not a macro and 0-arity - override def definesValue = !isMacro && (vparamss.isEmpty || vparamss.head.isEmpty) + override def definesValue = !isMacro && (vparamss.isEmpty || vparamss.head.isEmpty && vparamss.tail.isEmpty) override def resultExtractionCode(req: Request) = if (mods.isPublic) codegenln(name, ": ", req.typeOf(name)) else "" } diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala b/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala index 8c589eba60..0c26aa8b28 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala @@ -27,6 +27,12 @@ trait ReplConfig { try Console println msg catch { case x: AssertionError => Console.println("Assertion error printing debugging output: " + x) } + private[nsc] def repldbgex(ex: Throwable): Unit = { + if (isReplDebug) { + echo("Caught/suppressing: " + ex) + ex.printStackTrace + } + } private[nsc] def repldbg(msg: => String) = if (isReplDebug) echo(msg) private[nsc] def repltrace(msg: => String) = if (isReplTrace) echo(msg) private[nsc] def replinfo(msg: => String) = if (isReplInfo) echo(msg) diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 12d2513756..8d08888a1f 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1327,7 +1327,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { } } else super.transform(tree) - case TypeApply(Select(qual, name), targs) + case TypeApply(sel @ Select(qual, name), targs) if (!specializedTypeVars(symbol.info).isEmpty && name != nme.CONSTRUCTOR) => debuglog("checking typeapp for rerouting: " + tree + " with sym.tpe: " + symbol.tpe + " tree.tpe: " + tree.tpe) val qual1 = transform(qual) @@ -1341,14 +1341,20 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val residualTargs = symbol.info.typeParams zip targs collect { case (tvar, targ) if !env.contains(tvar) || !isPrimitiveValueClass(env(tvar).typeSymbol) => targ } + // See SI-5583. Don't know why it happens now if it didn't before. + if (specMember.info.typeParams.isEmpty && residualTargs.nonEmpty) { + log("!!! Type args to be applied, but symbol says no parameters: " + ((specMember.defString, residualTargs))) + localTyper.typed(sel) + } + else { + ifDebug(assert(residualTargs.length == specMember.info.typeParams.length, + "residual: %s, tparams: %s, env: %s".format(residualTargs, specMember.info.typeParams, env)) + ) - ifDebug(assert(residualTargs.length == specMember.info.typeParams.length, - "residual: %s, tparams: %s, env: %s".format(residualTargs, symbol.info.typeParams, env)) - ) - - val tree1 = gen.mkTypeApply(Select(qual1, specMember), residualTargs) - debuglog("rewrote " + tree + " to " + tree1) - localTyper.typedOperator(atPos(tree.pos)(tree1)) // being polymorphic, it must be a method + val tree1 = gen.mkTypeApply(Select(qual1, specMember), residualTargs) + debuglog("rewrote " + tree + " to " + tree1) + localTyper.typedOperator(atPos(tree.pos)(tree1)) // being polymorphic, it must be a method + } case None => super.transform(tree) } diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 76ea68442f..2b7c8e8304 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2745,7 +2745,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { val lencmp = compareLengths(args, formals) def checkNotMacro() = { - if (fun.symbol != null && fun.symbol.filter(sym => sym != null && sym.isTermMacro) != NoSymbol) + if (fun.symbol != null && fun.symbol.filter(sym => sym != null && sym.isTermMacro && !sym.isErroneous) != NoSymbol) duplErrorTree(NamedAndDefaultArgumentsNotSupportedForMacros(tree, fun)) } @@ -4574,7 +4574,7 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { // A: solely for robustness reasons. this mechanism might change in the future, which might break unprotected code val expr1 = context.withMacrosDisabled(typed1(expr, mode, pt)) expr1 match { - case macroDef if macroDef.symbol.isTermMacro => + case macroDef if macroDef.symbol != null && macroDef.symbol.isTermMacro && !macroDef.symbol.isErroneous => MacroEtaError(expr1) case _ => typedEta(checkDead(expr1)) diff --git a/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala b/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala index 67ea6e15f0..6f5284f75f 100644 --- a/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala +++ b/src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala @@ -9,7 +9,7 @@ trait CPSUtils { import global._ import definitions._ - var cpsEnabled = true + var cpsEnabled = false val verbose: Boolean = System.getProperty("cpsVerbose", "false") == "true" def vprintln(x: =>Any): Unit = if (verbose) println(x) diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala index eb18f03748..8a500d6c4d 100644 --- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala +++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSPlugin.scala @@ -26,6 +26,7 @@ class SelectiveCPSPlugin(val global: Global) extends Plugin { override val runsBefore = List("uncurry") } + val components = List[PluginComponent](anfPhase, cpsPhase) val checker = new CPSAnnotationChecker { @@ -42,17 +43,19 @@ class SelectiveCPSPlugin(val global: Global) extends Plugin { } // TODO: require -enabled command-line flag + override def processOptions(options: List[String], error: String => Unit) = { - var enabled = true - options foreach { - case "enable" => enabled = true - case "disable" => enabled = false - case option => error("Option not understood: "+option) + var enabled = false + for (option <- options) { + if (option == "enable") { + enabled = true + } else { + error("Option not understood: "+option) + } } setEnabled(enabled) } - override val optionsHelp: Option[String] = { - Some(" -P:continuations:disable Disable continuations plugin") - } + override val optionsHelp: Option[String] = + Some(" -P:continuations:enable Enable continuations") } diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check index c97be5d9f6..25df9a6a4a 100644 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.check @@ -1,14 +1,10 @@ -Macros_Package_10.scala:1: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-package `macro`
+macro-deprecate-dont-touch-backquotedidents.scala:37: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package `macro` {
^
-Macros_Package_10.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-package `macro`.bar
- ^
-Macros_Package_11.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-package `macro`.foo
- ^
-Main.scala:2: error: Unmatched closing brace '}' ignored here
-}
-^
-three warnings found
-one error found
+macro-deprecate-dont-touch-backquotedidents.scala:38: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ package `macro`.bar {
+ ^
+macro-deprecate-dont-touch-backquotedidents.scala:43: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ package `macro`.foo {
+ ^
+three errors found
diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.flags b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.scala new file mode 100644 index 0000000000..dee2f1de3b --- /dev/null +++ b/test/files/neg/macro-deprecate-dont-touch-backquotedidents.scala @@ -0,0 +1,56 @@ +object Test1 { + val `macro` = ??? +} + +object Test2 { + var `macro` = ??? +} + +object Test3 { + type `macro` = Int +} + +package test4 { + class `macro` +} + +object Test5 { + class `macro` +} + +package test6 { + object `macro` +} + +object Test7 { + object `macro` +} + +package test8 { + trait `macro` +} + +object Test9 { + trait `macro` +} + +package `macro` { + package `macro`.bar { + } +} + +package foo { + package `macro`.foo { + } +} + +object Test12 { + val Some(`macro`) = Some(42) + `macro` match { + case `macro` => println(`macro`) + } +} + +object Test13 { + def `macro` = 2 +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Bind_12.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Bind_12.scala deleted file mode 100644 index 97c07b04a0..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Bind_12.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test12 { - val Some(`macro`) = Some(42) - `macro` match { - case `macro` => println(`macro`) - } -}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_4.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_4.scala deleted file mode 100644 index f0037b5f82..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_4.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test4 - -class `macro` diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_5.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_5.scala deleted file mode 100644 index a6d0903cbb..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Class_5.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test5 { - class `macro` -} diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Def_13.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Def_13.scala deleted file mode 100644 index 6af8e1d65e..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Def_13.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test13 { - def `macro` = 2 -}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_6.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_6.scala deleted file mode 100644 index 29dab017d2..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_6.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test6 - -object `macro` diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_7.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_7.scala deleted file mode 100644 index 6cbcac55ca..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Object_7.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test7 { - object `macro` -} diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_10.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_10.scala deleted file mode 100644 index 4985d6691e..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_10.scala +++ /dev/null @@ -1,3 +0,0 @@ -package `macro` - -package `macro`.bar
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_11.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_11.scala deleted file mode 100644 index 35ed610637..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Package_11.scala +++ /dev/null @@ -1,3 +0,0 @@ -package foo - -package `macro`.foo diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_8.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_8.scala deleted file mode 100644 index 7895cf9a43..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_8.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test8 - -trait `macro` diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_9.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_9.scala deleted file mode 100644 index 90ba2207b7..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Trait_9.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test9 { - trait `macro` -} diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Type_3.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Type_3.scala deleted file mode 100644 index 7a2196c9cd..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Type_3.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test3 { - type `macro` = Int -}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Val_1.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Val_1.scala deleted file mode 100644 index 9ad08b8ba0..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Val_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test1 { - val `macro` = ??? -}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Var_2.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Var_2.scala deleted file mode 100644 index 4fbe152e76..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Macros_Var_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test2 { - var `macro` = ??? -}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Main.scala b/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Main.scala deleted file mode 100644 index f5278d9e7e..0000000000 --- a/test/files/neg/macro-deprecate-dont-touch-backquotedidents/Main.scala +++ /dev/null @@ -1,2 +0,0 @@ -object Test extends App -}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents.check b/test/files/neg/macro-deprecate-idents.check index 5fa1dc84d0..bd685fc7b9 100644 --- a/test/files/neg/macro-deprecate-idents.check +++ b/test/files/neg/macro-deprecate-idents.check @@ -1,50 +1,46 @@ -Macros_Bind_12.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
- val Some(macro) = Some(42)
- ^
-Macros_Bind_12.scala:4: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
- case macro => println(macro)
- ^
-Macros_Class_4.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-class macro
+macro-deprecate-idents.scala:2: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ val macro = ???
^
-Macros_Class_5.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
- class macro
- ^
-Macros_Def_13.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
- def macro = 2
+macro-deprecate-idents.scala:6: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ var macro = ???
^
-Macros_Object_6.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-object macro
+macro-deprecate-idents.scala:10: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ type macro = Int
^
-Macros_Object_7.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
- object macro
- ^
-Macros_Package_10.scala:1: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-package macro
+macro-deprecate-idents.scala:14: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ class macro
^
-Macros_Package_10.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-package macro.bar
+macro-deprecate-idents.scala:18: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ class macro
^
-Macros_Package_11.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-package macro.foo
+macro-deprecate-idents.scala:22: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ object macro
+ ^
+macro-deprecate-idents.scala:26: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ object macro
+ ^
+macro-deprecate-idents.scala:30: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ trait macro
^
-Macros_Trait_8.scala:3: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
-trait macro
- ^
-Macros_Trait_9.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
+macro-deprecate-idents.scala:34: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
trait macro
^
-Macros_Type_3.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
- type macro = Int
- ^
-Macros_Val_1.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
- val macro = ???
- ^
-Macros_Var_2.scala:2: warning: in future versions of Scala "macro" will be a keyword. consider using a different name.
- var macro = ???
+macro-deprecate-idents.scala:37: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+package macro {
+ ^
+macro-deprecate-idents.scala:38: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ package macro.bar {
+ ^
+macro-deprecate-idents.scala:43: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ package macro.foo {
+ ^
+macro-deprecate-idents.scala:48: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ val Some(macro) = Some(42)
+ ^
+macro-deprecate-idents.scala:50: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ case macro => println(macro)
+ ^
+macro-deprecate-idents.scala:55: error: in future versions of Scala "macro" will be a keyword. consider using a different name.
+ def macro = 2
^
-Main.scala:2: error: Unmatched closing brace '}' ignored here
-}
-^
-15 warnings found
-one error found
+15 errors found
diff --git a/test/files/neg/macro-deprecate-idents.flags b/test/files/neg/macro-deprecate-idents.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/macro-deprecate-idents.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents.scala b/test/files/neg/macro-deprecate-idents.scala new file mode 100644 index 0000000000..23c398e341 --- /dev/null +++ b/test/files/neg/macro-deprecate-idents.scala @@ -0,0 +1,56 @@ +object Test1 { + val macro = ??? +} + +object Test2 { + var macro = ??? +} + +object Test3 { + type macro = Int +} + +package test4 { + class macro +} + +object Test5 { + class macro +} + +package test6 { + object macro +} + +object Test7 { + object macro +} + +package test8 { + trait macro +} + +object Test9 { + trait macro +} + +package macro { + package macro.bar { + } +} + +package foo { + package macro.foo { + } +} + +object Test12 { + val Some(macro) = Some(42) + macro match { + case macro => println(macro) + } +} + +object Test13 { + def macro = 2 +}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala b/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala deleted file mode 100644 index f4e25bfdfc..0000000000 --- a/test/files/neg/macro-deprecate-idents/Macros_Def_13.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test13 { - def macro = 2 -}
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Main.scala b/test/files/neg/macro-deprecate-idents/Main.scala deleted file mode 100644 index f5278d9e7e..0000000000 --- a/test/files/neg/macro-deprecate-idents/Main.scala +++ /dev/null @@ -1,2 +0,0 @@ -object Test extends App -}
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala b/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala index cbd6232073..fa50ac4f73 100644 --- a/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala +++ b/test/files/neg/macro-invalidsig-params-badvarargs/Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { import Macros._ - foo(42) + foo(42, 100) }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala b/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala index cbd6232073..fa50ac4f73 100644 --- a/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala +++ b/test/files/neg/macro-invalidsig-params-namemismatch/Test_2.scala @@ -1,4 +1,4 @@ object Test extends App { import Macros._ - foo(42) + foo(42, 100) }
\ No newline at end of file diff --git a/test/files/neg/macro-keyword-bind.check b/test/files/neg/macro-keyword-bind.check new file mode 100644 index 0000000000..1f74cfe5cd --- /dev/null +++ b/test/files/neg/macro-keyword-bind.check @@ -0,0 +1,7 @@ +macro-keyword-bind.scala:2: error: illegal start of simple pattern
+ val Some(macro) = Some(42)
+ ^
+macro-keyword-bind.scala:6: error: ')' expected but '}' found.
+}
+^
+two errors found
diff --git a/test/files/neg/macro-keyword.flags b/test/files/neg/macro-keyword-bind.flags index 7fea2ff901..7fea2ff901 100644 --- a/test/files/neg/macro-keyword.flags +++ b/test/files/neg/macro-keyword-bind.flags diff --git a/test/files/neg/macro-deprecate-idents/Macros_Bind_12.scala b/test/files/neg/macro-keyword-bind.scala index a3b1553348..a3b1553348 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Bind_12.scala +++ b/test/files/neg/macro-keyword-bind.scala diff --git a/test/files/neg/macro-keyword-class1.check b/test/files/neg/macro-keyword-class1.check new file mode 100644 index 0000000000..d8983180ef --- /dev/null +++ b/test/files/neg/macro-keyword-class1.check @@ -0,0 +1,4 @@ +macro-keyword-class1.scala:3: error: identifier expected but 'macro' found.
+class macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-class1.flags b/test/files/neg/macro-keyword-class1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-class1.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Class_4.scala b/test/files/neg/macro-keyword-class1.scala index 8635d1f4f6..8635d1f4f6 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Class_4.scala +++ b/test/files/neg/macro-keyword-class1.scala diff --git a/test/files/neg/macro-keyword-class2.check b/test/files/neg/macro-keyword-class2.check new file mode 100644 index 0000000000..0e4d11bcc4 --- /dev/null +++ b/test/files/neg/macro-keyword-class2.check @@ -0,0 +1,4 @@ +macro-keyword-class2.scala:2: error: identifier expected but 'macro' found.
+ class macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-class2.flags b/test/files/neg/macro-keyword-class2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-class2.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Class_5.scala b/test/files/neg/macro-keyword-class2.scala index af24a489d0..af24a489d0 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Class_5.scala +++ b/test/files/neg/macro-keyword-class2.scala diff --git a/test/files/neg/macro-keyword-object1.check b/test/files/neg/macro-keyword-object1.check new file mode 100644 index 0000000000..cfbd06ffd6 --- /dev/null +++ b/test/files/neg/macro-keyword-object1.check @@ -0,0 +1,4 @@ +macro-keyword-object1.scala:3: error: identifier expected but 'macro' found.
+object macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-object1.flags b/test/files/neg/macro-keyword-object1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-object1.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Object_6.scala b/test/files/neg/macro-keyword-object1.scala index 66eb494e6b..66eb494e6b 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Object_6.scala +++ b/test/files/neg/macro-keyword-object1.scala diff --git a/test/files/neg/macro-keyword-object2.check b/test/files/neg/macro-keyword-object2.check new file mode 100644 index 0000000000..ede31f13e5 --- /dev/null +++ b/test/files/neg/macro-keyword-object2.check @@ -0,0 +1,4 @@ +macro-keyword-object2.scala:2: error: identifier expected but 'macro' found.
+ object macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-object2.flags b/test/files/neg/macro-keyword-object2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-object2.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Object_7.scala b/test/files/neg/macro-keyword-object2.scala index 6f5b9ceacd..6f5b9ceacd 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Object_7.scala +++ b/test/files/neg/macro-keyword-object2.scala diff --git a/test/files/neg/macro-keyword-package1.check b/test/files/neg/macro-keyword-package1.check new file mode 100644 index 0000000000..22c1e11ded --- /dev/null +++ b/test/files/neg/macro-keyword-package1.check @@ -0,0 +1,4 @@ +macro-keyword-package1.scala:1: error: identifier expected but 'macro' found.
+package macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-package1.flags b/test/files/neg/macro-keyword-package1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-package1.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Package_10.scala b/test/files/neg/macro-keyword-package1.scala index 52d3fbabf6..52d3fbabf6 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Package_10.scala +++ b/test/files/neg/macro-keyword-package1.scala diff --git a/test/files/neg/macro-keyword-package2.check b/test/files/neg/macro-keyword-package2.check new file mode 100644 index 0000000000..0cb542a85d --- /dev/null +++ b/test/files/neg/macro-keyword-package2.check @@ -0,0 +1,4 @@ +macro-keyword-package2.scala:3: error: identifier expected but 'macro' found.
+package macro.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-package2.flags b/test/files/neg/macro-keyword-package2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-package2.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Package_11.scala b/test/files/neg/macro-keyword-package2.scala index a68ebd935f..a68ebd935f 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Package_11.scala +++ b/test/files/neg/macro-keyword-package2.scala diff --git a/test/files/neg/macro-keyword-trait1.check b/test/files/neg/macro-keyword-trait1.check new file mode 100644 index 0000000000..9586a62e08 --- /dev/null +++ b/test/files/neg/macro-keyword-trait1.check @@ -0,0 +1,4 @@ +macro-keyword-trait1.scala:3: error: identifier expected but 'macro' found.
+trait macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-trait1.flags b/test/files/neg/macro-keyword-trait1.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-trait1.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Trait_8.scala b/test/files/neg/macro-keyword-trait1.scala index e32d4c1385..e32d4c1385 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Trait_8.scala +++ b/test/files/neg/macro-keyword-trait1.scala diff --git a/test/files/neg/macro-keyword-trait2.check b/test/files/neg/macro-keyword-trait2.check new file mode 100644 index 0000000000..40aa764378 --- /dev/null +++ b/test/files/neg/macro-keyword-trait2.check @@ -0,0 +1,4 @@ +macro-keyword-trait2.scala:2: error: identifier expected but 'macro' found.
+ trait macro
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-trait2.flags b/test/files/neg/macro-keyword-trait2.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-trait2.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Trait_9.scala b/test/files/neg/macro-keyword-trait2.scala index 243a54abe6..243a54abe6 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Trait_9.scala +++ b/test/files/neg/macro-keyword-trait2.scala diff --git a/test/files/neg/macro-keyword-type.check b/test/files/neg/macro-keyword-type.check new file mode 100644 index 0000000000..4a7481114c --- /dev/null +++ b/test/files/neg/macro-keyword-type.check @@ -0,0 +1,4 @@ +macro-keyword-type.scala:2: error: identifier expected but 'macro' found.
+ type macro = Int
+ ^
+one error found
diff --git a/test/files/neg/macro-keyword-type.flags b/test/files/neg/macro-keyword-type.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-type.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Type_3.scala b/test/files/neg/macro-keyword-type.scala index 30e523bcaf..30e523bcaf 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Type_3.scala +++ b/test/files/neg/macro-keyword-type.scala diff --git a/test/files/neg/macro-keyword-val.check b/test/files/neg/macro-keyword-val.check new file mode 100644 index 0000000000..0dc4c030a9 --- /dev/null +++ b/test/files/neg/macro-keyword-val.check @@ -0,0 +1,7 @@ +macro-keyword-val.scala:2: error: illegal start of simple pattern
+ val macro = ???
+ ^
+macro-keyword-val.scala:3: error: '=' expected but '}' found.
+}
+^
+two errors found
diff --git a/test/files/neg/macro-keyword-val.flags b/test/files/neg/macro-keyword-val.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-val.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Val_1.scala b/test/files/neg/macro-keyword-val.scala index 96f57acb30..96f57acb30 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Val_1.scala +++ b/test/files/neg/macro-keyword-val.scala diff --git a/test/files/neg/macro-keyword-var.check b/test/files/neg/macro-keyword-var.check new file mode 100644 index 0000000000..96d02e0052 --- /dev/null +++ b/test/files/neg/macro-keyword-var.check @@ -0,0 +1,7 @@ +macro-keyword-var.scala:2: error: illegal start of simple pattern
+ var macro = ???
+ ^
+macro-keyword-var.scala:3: error: '=' expected but '}' found.
+}
+^
+two errors found
diff --git a/test/files/neg/macro-keyword-var.flags b/test/files/neg/macro-keyword-var.flags new file mode 100644 index 0000000000..7fea2ff901 --- /dev/null +++ b/test/files/neg/macro-keyword-var.flags @@ -0,0 +1 @@ +-Xmacros
\ No newline at end of file diff --git a/test/files/neg/macro-deprecate-idents/Macros_Var_2.scala b/test/files/neg/macro-keyword-var.scala index a79dda6dc2..a79dda6dc2 100644 --- a/test/files/neg/macro-deprecate-idents/Macros_Var_2.scala +++ b/test/files/neg/macro-keyword-var.scala diff --git a/test/files/neg/macro-keyword.check b/test/files/neg/macro-keyword.check deleted file mode 100644 index fd63db951c..0000000000 --- a/test/files/neg/macro-keyword.check +++ /dev/null @@ -1,49 +0,0 @@ -Macros_Bind_12.scala:2: error: illegal start of simple pattern
- val Some(macro) = Some(42)
- ^
-Macros_Bind_12.scala:6: error: ')' expected but '}' found.
-}
-^
-Macros_Class_4.scala:3: error: identifier expected but 'macro' found.
-class macro
- ^
-Macros_Class_5.scala:2: error: identifier expected but 'macro' found.
- class macro
- ^
-Macros_Def_13.scala:2: error: identifier expected but 'macro' found.
- def macro = 2
- ^
-Macros_Object_6.scala:3: error: identifier expected but 'macro' found.
-object macro
- ^
-Macros_Object_7.scala:2: error: identifier expected but 'macro' found.
- object macro
- ^
-Macros_Package_10.scala:1: error: identifier expected but 'macro' found.
-package macro
- ^
-Macros_Package_11.scala:3: error: identifier expected but 'macro' found.
-package macro.foo
- ^
-Macros_Trait_8.scala:3: error: identifier expected but 'macro' found.
-trait macro
- ^
-Macros_Trait_9.scala:2: error: identifier expected but 'macro' found.
- trait macro
- ^
-Macros_Type_3.scala:2: error: identifier expected but 'macro' found.
- type macro = Int
- ^
-Macros_Val_1.scala:2: error: illegal start of simple pattern
- val macro = ???
- ^
-Macros_Val_1.scala:3: error: '=' expected but '}' found.
-}
-^
-Macros_Var_2.scala:2: error: illegal start of simple pattern
- var macro = ???
- ^
-Macros_Var_2.scala:3: error: '=' expected but '}' found.
-}
-^
-16 errors found
diff --git a/test/files/neg/macro-keyword/Macros_Bind_12.scala b/test/files/neg/macro-keyword/Macros_Bind_12.scala deleted file mode 100644 index a3b1553348..0000000000 --- a/test/files/neg/macro-keyword/Macros_Bind_12.scala +++ /dev/null @@ -1,6 +0,0 @@ -object Test12 { - val Some(macro) = Some(42) - macro match { - case macro => println(macro) - } -}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Class_4.scala b/test/files/neg/macro-keyword/Macros_Class_4.scala deleted file mode 100644 index 8635d1f4f6..0000000000 --- a/test/files/neg/macro-keyword/Macros_Class_4.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test4 - -class macro diff --git a/test/files/neg/macro-keyword/Macros_Class_5.scala b/test/files/neg/macro-keyword/Macros_Class_5.scala deleted file mode 100644 index af24a489d0..0000000000 --- a/test/files/neg/macro-keyword/Macros_Class_5.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test5 { - class macro -} diff --git a/test/files/neg/macro-keyword/Macros_Def_13.scala b/test/files/neg/macro-keyword/Macros_Def_13.scala deleted file mode 100644 index f4e25bfdfc..0000000000 --- a/test/files/neg/macro-keyword/Macros_Def_13.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test13 { - def macro = 2 -}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Object_6.scala b/test/files/neg/macro-keyword/Macros_Object_6.scala deleted file mode 100644 index 66eb494e6b..0000000000 --- a/test/files/neg/macro-keyword/Macros_Object_6.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test6 - -object macro diff --git a/test/files/neg/macro-keyword/Macros_Object_7.scala b/test/files/neg/macro-keyword/Macros_Object_7.scala deleted file mode 100644 index 6f5b9ceacd..0000000000 --- a/test/files/neg/macro-keyword/Macros_Object_7.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test7 { - object macro -} diff --git a/test/files/neg/macro-keyword/Macros_Package_10.scala b/test/files/neg/macro-keyword/Macros_Package_10.scala deleted file mode 100644 index 52d3fbabf6..0000000000 --- a/test/files/neg/macro-keyword/Macros_Package_10.scala +++ /dev/null @@ -1,3 +0,0 @@ -package macro - -package macro.bar
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Package_11.scala b/test/files/neg/macro-keyword/Macros_Package_11.scala deleted file mode 100644 index a68ebd935f..0000000000 --- a/test/files/neg/macro-keyword/Macros_Package_11.scala +++ /dev/null @@ -1,3 +0,0 @@ -package foo - -package macro.foo diff --git a/test/files/neg/macro-keyword/Macros_Trait_8.scala b/test/files/neg/macro-keyword/Macros_Trait_8.scala deleted file mode 100644 index e32d4c1385..0000000000 --- a/test/files/neg/macro-keyword/Macros_Trait_8.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test8 - -trait macro diff --git a/test/files/neg/macro-keyword/Macros_Trait_9.scala b/test/files/neg/macro-keyword/Macros_Trait_9.scala deleted file mode 100644 index 243a54abe6..0000000000 --- a/test/files/neg/macro-keyword/Macros_Trait_9.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test9 { - trait macro -} diff --git a/test/files/neg/macro-keyword/Macros_Type_3.scala b/test/files/neg/macro-keyword/Macros_Type_3.scala deleted file mode 100644 index 30e523bcaf..0000000000 --- a/test/files/neg/macro-keyword/Macros_Type_3.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test3 { - type macro = Int -}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Val_1.scala b/test/files/neg/macro-keyword/Macros_Val_1.scala deleted file mode 100644 index 96f57acb30..0000000000 --- a/test/files/neg/macro-keyword/Macros_Val_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test1 { - val macro = ??? -}
\ No newline at end of file diff --git a/test/files/neg/macro-keyword/Macros_Var_2.scala b/test/files/neg/macro-keyword/Macros_Var_2.scala deleted file mode 100644 index a79dda6dc2..0000000000 --- a/test/files/neg/macro-keyword/Macros_Var_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -object Test2 { - var macro = ??? -}
\ No newline at end of file diff --git a/test/files/run/t5535.check b/test/files/run/t5535.check new file mode 100644 index 0000000000..8da9829b78 --- /dev/null +++ b/test/files/run/t5535.check @@ -0,0 +1,20 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> def h()(i: Int) = 1 + i +h: ()(i: Int)Int + +scala> println(h()(5)) +6 + +scala> val f = h() _ +f: Int => Int = <function1> + +scala> println(f(10)) +11 + +scala> + +scala> diff --git a/test/files/run/t5535.scala b/test/files/run/t5535.scala new file mode 100644 index 0000000000..7bc12f3470 --- /dev/null +++ b/test/files/run/t5535.scala @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ +def h()(i: Int) = 1 + i +println(h()(5)) +val f = h() _ +println(f(10)) + """ +} diff --git a/test/files/run/t5583.check b/test/files/run/t5583.check new file mode 100644 index 0000000000..39b969fbe7 --- /dev/null +++ b/test/files/run/t5583.check @@ -0,0 +1,20 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> var s = 0 +s: Int = 0 + +scala> for (i <- 1 to 10) {s += i} + +scala> for (i <- 1 to 10) {s += i} + +scala> for (i <- 1 to 10) {s += i} + +scala> println(s) +165 + +scala> + +scala> diff --git a/test/files/run/t5583.scala b/test/files/run/t5583.scala new file mode 100644 index 0000000000..8561a5946f --- /dev/null +++ b/test/files/run/t5583.scala @@ -0,0 +1,11 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ +var s = 0 +for (i <- 1 to 10) {s += i} +for (i <- 1 to 10) {s += i} +for (i <- 1 to 10) {s += i} +println(s) + """ +} diff --git a/tools/binary-repo-lib.sh b/tools/binary-repo-lib.sh index 4c5497e803..09d0af1d50 100755 --- a/tools/binary-repo-lib.sh +++ b/tools/binary-repo-lib.sh @@ -88,12 +88,22 @@ pushJarFile() { # rm $jar } +getJarSha() { + local jar=$1 + if [[ ! -f "$jar" ]]; then + echo "" + else + shastring=$(sha1sum "$jar") + echo "${shastring:0:$(expr index "$shastring" " ")-1}" + fi +} + # Tests whether or not the .desired.sha1 hash matches a given file. # Arugment 1 - The jar file to test validity. # Returns: Empty string on failure, "OK" on success. isJarFileValid() { local jar=$1 - if [[ ! -f $jar ]]; then + if [[ ! -f "$jar" ]]; then echo "" else local jar_dir=$(dirname $jar) @@ -131,6 +141,27 @@ pushJarFiles() { fi } + +checkJarSha() { + local jar=$1 + local sha=$2 + local testsha=$(getJarSha "$jar") + if test "$sha" == "$testsha"; then + echo "OK" + fi +} + +makeCacheLocation() { + local uri=$1 + local sha=$2 + local cache_loc="$cache_dir/$uri" + local cdir=$(dirname $cache_loc) + if [[ ! -d "$cdir" ]]; then + mkdir -p "$cdir" + fi + echo "$cache_loc" +} + # Pulls a single binary artifact from a remote repository. # Argument 1 - The uri to the file that should be downloaded. # Argument 2 - SHA of the file... @@ -138,16 +169,19 @@ pushJarFiles() { pullJarFileToCache() { local uri=$1 local sha=$2 - local cache_loc=$cache_dir/$uri - local cdir=$(dirname $cache_loc) - if [[ ! -d $cdir ]]; then - mkdir -p $cdir - fi + local cache_loc="$(makeCacheLocation $uri)" # TODO - Check SHA of local cache is accurate. - if [[ ! -f $cache_loc ]]; then + if test -f "$cache_loc" && test "$(checkJarSha "$cache_loc" "$sha")" != "OK"; then + echo "Found bad cached file: $cache_loc" + rm -f "$cache_loc" + fi + if [[ ! -f "$cache_loc" ]]; then curlDownload $cache_loc ${remote_urlbase}/${uri} + if test "$(checkJarSha "$cache_loc" "$sha")" != "OK"; then + echo "Trouble downloading $uri. Please try pull-binary-libs again when your internet connection is stable." + exit 2 + fi fi - echo "$cache_loc" } # Pulls a single binary artifact from a remote repository. @@ -162,7 +196,8 @@ pullJarFile() { local version=${sha1% ?$jar_name} local remote_uri=${version}/${jar#$basedir/} echo "Resolving [${remote_uri}]" - local cached_file=$(pullJarFileToCache $remote_uri $version) + pullJarFileToCache $remote_uri $version + local cached_file=$(makeCacheLocation $remote_uri) cp $cached_file $jar } diff --git a/tools/cleanup-commit b/tools/cleanup-commit new file mode 100755 index 0000000000..400d434359 --- /dev/null +++ b/tools/cleanup-commit @@ -0,0 +1,130 @@ +#!/bin/bash + +## +## The cleanup-commit script +## ------------------------- +## This little script will cleanup your commit before you send it. You need to add the files to the staged area and +## run this script. It will automatically cleanup tabs and trailing spaces for the files you added and then add the +## clean versions to the staging area. +## +## Use at your own risk, I spent some time making the script error-proof so it will abort if sees any inconsistency, +## but of course playing around with your commit might break things. Btw, it saves the original file to file.bak. +## +## Happy hacking! +## + +ABORT="Ab0rT0p3r4+|0n" + +# +# Cleanup function +# +function cleanup { + echo Cleaning up $1... + # prepare the ground + rm -rf $1.bak + # compress <TAB> into double <BLANK> and eliminate trailing <BLANC>s + sed -i.bak -e 's/\t/ /g' -e 's/ *$//' $1 +} + + +# +# Get the git status for the current staged commit +# +FULLSTATUS=`git status --porcelain` + +if [ $? -ne 0 ] +then + echo "Unable to run git. Check if:" + echo " -- git is installed (you can run git in the command line)" + echo " -- the current directory is a valid git repository" + exit 1 +fi + +echo + +# +# Based on the status decide what files will get cleaned up +# +CLEANUP_FILES=`echo "$FULLSTATUS" | while read LINE +do + + STATUS=$(echo $LINE | sed 's/^\(..\).*$/\1/') + if [ $? -ne 0 ] + then + echo "Could not get the status for line: $LINE" + echo " -- you have the basic unix tools installed (grep, cut, sed)" + echo $ABORT # This goes to CLEANUP_FILES + exit 1 + fi + + FILES=$(echo $LINE | sed 's/^..//') + FILE1=$(echo $FILES | cut -d ' ' -f 1) + FILE2=$(echo $FILES | cut -d ' ' -f 3) + + case "$STATUS" in + [AMRDC]" ") + case "$STATUS" in + "A "|"M ") + echo $FILE1 + ;; + "R ") + echo $FILE2 + ;; + "D ") + #nothing to do + ;; + "C ") + echo $FILE1 + echo $FILE2 + ;; + esac + ;; + "??") + # File is not tracked, no need to do anything about it + # echo Untracked: $FILE1 + ;; + *) + echo "Unstable status of file $FILE1 (\"$STATUS\")" >&2 + echo "Aborting cleanup!" >&2 + echo $ABORT # This goes to CLEANUP_FILES + exit 1 + esac +done; echo $CLEANUP_FILES` + + +# +# Perform actual cleanup +# +case $CLEANUP_FILES in +*"$ABORT") + echo + exit 1 + ;; +"") + echo Nothing to do! + ;; +*) + cd $(git rev-parse --show-toplevel) + + if [ $? -ne 0 ] + then + echo Unexpected error: cannot cd to the repository root + echo Aborting cleanup! + exit 1 + fi + + echo "$CLEANUP_FILES" | while read FILE + do + cleanup $FILE + done + + cd - &>/dev/null + + echo + echo "Cleanup done: " + echo " - original files saved as .bak" + echo " - you can do \"git diff\" to see the changes the script did" + echo " - you can do \"git commit -a\" to commit the cleaned up files" + echo + ;; +esac |