diff options
Diffstat (limited to 'test')
925 files changed, 6178 insertions, 7214 deletions
diff --git a/test/attic/files/cli/test1/Main.check.j9vm5 b/test/attic/files/cli/test1/Main.check.j9vm5 deleted file mode 100644 index de454ef478..0000000000 --- a/test/attic/files/cli/test1/Main.check.j9vm5 +++ /dev/null @@ -1,4 +0,0 @@ -env: -cpp: No such file or directory -env: test1.Main: No such file or directory -env: -cp: No such file or directory -1: test 3 passed diff --git a/test/attic/files/cli/test1/Main.check.java b/test/attic/files/cli/test1/Main.check.java deleted file mode 100644 index 64410de98f..0000000000 --- a/test/attic/files/cli/test1/Main.check.java +++ /dev/null @@ -1,6 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -1: test 1 passed (1) -1: test 2 passed (1) -1: test 3 passed (1) -1: test 4 passed (2) diff --git a/test/attic/files/cli/test1/Main.check.java5 b/test/attic/files/cli/test1/Main.check.java5 deleted file mode 100644 index 64410de98f..0000000000 --- a/test/attic/files/cli/test1/Main.check.java5 +++ /dev/null @@ -1,6 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -1: test 1 passed (1) -1: test 2 passed (1) -1: test 3 passed (1) -1: test 4 passed (2) diff --git a/test/attic/files/cli/test1/Main.check.java5_api b/test/attic/files/cli/test1/Main.check.java5_api deleted file mode 100644 index 8693a5d92f..0000000000 --- a/test/attic/files/cli/test1/Main.check.java5_api +++ /dev/null @@ -1,19 +0,0 @@ -|-- allclasses-frame.html -|-- allclasses-noframe.html -|-- constant-values.html -|-- deprecated-list.html -|-- help-doc.html -|-- index-all.html -|-- index.html -|-- overview-tree.html -|-- package-list -|-- resources -| `-- inherit.gif -|-- stylesheet.css -`-- test1 - |-- Main.html - |-- package-frame.html - |-- package-summary.html - `-- package-tree.html - -2 directories, 15 files diff --git a/test/attic/files/cli/test1/Main.check.java5_j9 b/test/attic/files/cli/test1/Main.check.java5_j9 deleted file mode 100644 index de454ef478..0000000000 --- a/test/attic/files/cli/test1/Main.check.java5_j9 +++ /dev/null @@ -1,4 +0,0 @@ -env: -cpp: No such file or directory -env: test1.Main: No such file or directory -env: -cp: No such file or directory -1: test 3 passed diff --git a/test/attic/files/cli/test1/Main.check.javac b/test/attic/files/cli/test1/Main.check.javac deleted file mode 100644 index ba25d9b6ca..0000000000 --- a/test/attic/files/cli/test1/Main.check.javac +++ /dev/null @@ -1,19 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -help Print a synopsis of standard options - diff --git a/test/attic/files/cli/test1/Main.check.javac5 b/test/attic/files/cli/test1/Main.check.javac5 deleted file mode 100644 index 0cb29d31ff..0000000000 --- a/test/attic/files/cli/test1/Main.check.javac5 +++ /dev/null @@ -1,24 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -cp <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - diff --git a/test/attic/files/cli/test1/Main.check.javac6 b/test/attic/files/cli/test1/Main.check.javac6 deleted file mode 100644 index 8f37a05bcb..0000000000 --- a/test/attic/files/cli/test1/Main.check.javac6 +++ /dev/null @@ -1,29 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files and annotation processors - -cp <path> Specify where to find user class files and annotation processors - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -proc:{none, only} Control whether annotation processing and/or compilation is done. - -processor <class> Name of the annotation processor to run; bypasses default discovery process - -processorpath <path> Specify where to find annotation processors - -d <directory> Specify where to place generated class files - -s <directory> Specify where to place generated source files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -A[key[=value]] Options to pass to annotation processors - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - diff --git a/test/attic/files/cli/test1/Main.check.jikes b/test/attic/files/cli/test1/Main.check.jikes deleted file mode 100644 index cd891689db..0000000000 --- a/test/attic/files/cli/test1/Main.check.jikes +++ /dev/null @@ -1,3 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. diff --git a/test/attic/files/cli/test1/Main.check.jikes5 b/test/attic/files/cli/test1/Main.check.jikes5 deleted file mode 100644 index cd891689db..0000000000 --- a/test/attic/files/cli/test1/Main.check.jikes5 +++ /dev/null @@ -1,3 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. diff --git a/test/attic/files/cli/test1/Main.check.scala b/test/attic/files/cli/test1/Main.check.scala deleted file mode 100644 index 43b200ae02..0000000000 --- a/test/attic/files/cli/test1/Main.check.scala +++ /dev/null @@ -1,24 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - -1: test 1 passed (1) -1: test 2 passed (1) -1: test 3 passed (1) -1: test 4 passed (2) diff --git a/test/attic/files/cli/test1/Main.check.scala_api b/test/attic/files/cli/test1/Main.check.scala_api deleted file mode 100644 index 6fac39d3f0..0000000000 --- a/test/attic/files/cli/test1/Main.check.scala_api +++ /dev/null @@ -1,33 +0,0 @@ -|-- all-classes.html -|-- index.html -|-- modules.html -|-- nav-classes.html -|-- root-content.html -|-- scala -| |-- Any.html -| |-- AnyRef.html -| |-- AnyVal.html -| |-- Boolean.html -| |-- Byte.html -| |-- Char.html -| |-- Double.html -| |-- Float.html -| |-- Int.html -| |-- Long.html -| |-- Nothing.html -| |-- Null.html -| |-- Short.html -| |-- Unit.html -| `-- runtime -| |-- BoxedFloat.html -| |-- BoxedInt.html -| |-- BoxedLong.html -| `-- BoxedNumber.html -|-- script.js -|-- style.css -|-- test1 -| `-- Main$object.html -|-- test1$content.html -`-- test1$package.html - -3 directories, 28 files diff --git a/test/attic/files/cli/test1/Main.check.scala_j9 b/test/attic/files/cli/test1/Main.check.scala_j9 deleted file mode 100644 index 65d5ddaac4..0000000000 --- a/test/attic/files/cli/test1/Main.check.scala_j9 +++ /dev/null @@ -1,15 +0,0 @@ -unknown option: '-cpp' -scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>] - -<compiler-option>'s are as for scalac; see scalac -help. -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. --howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -1: test 1 passed (1) -1: test 2 passed (1) -1: test 3 passed (1) -1: test 4 passed (2) diff --git a/test/attic/files/cli/test1/Main.check.scalac b/test/attic/files/cli/test1/Main.check.scalac deleted file mode 100644 index 8465810d0b..0000000000 --- a/test/attic/files/cli/test1/Main.check.scalac +++ /dev/null @@ -1,63 +0,0 @@ -scalac error: bad option: '-dd' - scalac -help gives more information -Usage: scalac <options | source files> -where possible options include: - -doc Generate documentation - -g:<g> Generate debugging info (none,source,line,vars,notc) - -nowarn Generate no warnings - -noassert Generate no assertions and assumptions - -verbose Output messages about what the compiler is doing - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -windowtitle <windowtitle> Specify window title of generated HTML documentation - -documenttitle <documenttitle> Specify document title of generated HTML documentation - -target:<target> Specify which backend to use (jvm-1.5,msil) - -migrate Assist in migrating from Scala version 1.0 - -o <file> Name of the output assembly (only relevant with -target:msil) - -r <path> List of assemblies referenced by the program (only relevant with -target:msil) - -debug Output debugging messages - -deprecation enable detailed deprecation warnings - -unchecked enable detailed unchecked warnings - -statistics Print compiler statistics - -explaintypes Explain type errors in more detail - -resident Compiler stays resident, files to compile are read from standard input - -uniqid Print identifiers with unique names (debugging option) - -printtypes Print tree types (debugging option) - -prompt Display a prompt after each error (debugging option) - -noimports Compile without any implicit imports - -nopredefs Compile without any implicit predefined values - -skip:<phase> Skip <phase> - -check:<phase> Check the tree at start of <phase> - -print:<phase> Print out program after <phase> - -printer:<printer> Printer to use (text,html) - -printfile <file> Specify file in which to print trees - -graph:<phase> Graph the program after <phase> - -browse:<phase> Browse the abstract syntax tree after <phase> - -stop:<phase> Stop after phase <phase> - -log:<phase> Log operations in <phase> - -logall Log all operations - -version Print product version and exit - -help Print a synopsis of standard options - -nouescape disables handling of \u unicode escapes - -Xinline Perform inlining when possible - -XO Optimize. implies -Xinline, -Xcloselim and -Xdce - -Xcloselim Perform closure elimination - -Xdce Perform dead code elimination - -Xwarndeadcode Emit warnings for dead code - -XbytecodeRead Enable bytecode reader. - -Xdetach Perform detaching of remote closures - -Xshowcls <class> Show class info - -Xshowobj <object> Show object info - -Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types - -Xprintpos Print tree positions (as offsets) - -Xscript compile script file - -Xexperimental enable experimental extensions - -Xplugtypes parse but ignore annotations in more locations - -Xkilloption optimizes option types - -one error found diff --git a/test/attic/files/cli/test1/Main.check.scalaint b/test/attic/files/cli/test1/Main.check.scalaint deleted file mode 100644 index 88345d1874..0000000000 --- a/test/attic/files/cli/test1/Main.check.scalaint +++ /dev/null @@ -1,45 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - - -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 1: test 1 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 1: test 2 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 1: test 3 passed (1) -unnamed0: scala.Unit = () - -scala> diff --git a/test/attic/files/cli/test1/Main.java b/test/attic/files/cli/test1/Main.java deleted file mode 100644 index 8850b87517..0000000000 --- a/test/attic/files/cli/test1/Main.java +++ /dev/null @@ -1,8 +0,0 @@ -// @info no dependency -package test1; -public class Main { - public static void main(String args[]) { - String arg = (args.length > 0) ? args[0] : "?"; - System.out.println("1: test " + arg + " passed (" + args.length + ")"); - } -} diff --git a/test/attic/files/cli/test1/Main.scala b/test/attic/files/cli/test1/Main.scala deleted file mode 100644 index f7dd8a0a36..0000000000 --- a/test/attic/files/cli/test1/Main.scala +++ /dev/null @@ -1,8 +0,0 @@ -// @info no dependency -package test1 -object Main { - def main(args: Array[String]) = { - val arg = if (args != null && args.length > 0) args(0) else "?" - Console.println("1: test " + arg + " passed (" + args.length + ")") - } -} diff --git a/test/attic/files/cli/test2/Main.check.j9vm5 b/test/attic/files/cli/test2/Main.check.j9vm5 deleted file mode 100644 index 8f4fdf8aa1..0000000000 --- a/test/attic/files/cli/test2/Main.check.j9vm5 +++ /dev/null @@ -1,4 +0,0 @@ -env: -cpp: No such file or directory -env: test2.Main: No such file or directory -env: -cp: No such file or directory -2: 1: test 3 passed diff --git a/test/attic/files/cli/test2/Main.check.java b/test/attic/files/cli/test2/Main.check.java deleted file mode 100644 index aca383de3e..0000000000 --- a/test/attic/files/cli/test2/Main.check.java +++ /dev/null @@ -1,6 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -2: 1: test 1 passed (1) -2: 1: test 2 passed (1) -2: 1: test 3 passed (1) -2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test2/Main.check.java5 b/test/attic/files/cli/test2/Main.check.java5 deleted file mode 100644 index aca383de3e..0000000000 --- a/test/attic/files/cli/test2/Main.check.java5 +++ /dev/null @@ -1,6 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -2: 1: test 1 passed (1) -2: 1: test 2 passed (1) -2: 1: test 3 passed (1) -2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test2/Main.check.java5_api b/test/attic/files/cli/test2/Main.check.java5_api deleted file mode 100644 index 4ff775c3da..0000000000 --- a/test/attic/files/cli/test2/Main.check.java5_api +++ /dev/null @@ -1,24 +0,0 @@ -|-- allclasses-frame.html -|-- allclasses-noframe.html -|-- constant-values.html -|-- deprecated-list.html -|-- help-doc.html -|-- index-all.html -|-- index.html -|-- overview-tree.html -|-- package-list -|-- resources -| `-- inherit.gif -|-- stylesheet.css -|-- test1 -| |-- Main.html -| |-- package-frame.html -| |-- package-summary.html -| `-- package-tree.html -`-- test2 - |-- Main.html - |-- package-frame.html - |-- package-summary.html - `-- package-tree.html - -3 directories, 19 files diff --git a/test/attic/files/cli/test2/Main.check.java5_j9 b/test/attic/files/cli/test2/Main.check.java5_j9 deleted file mode 100644 index 2dcb6e892a..0000000000 --- a/test/attic/files/cli/test2/Main.check.java5_j9 +++ /dev/null @@ -1,36 +0,0 @@ -JVMJ9VM007E Command-line option unrecognised: -cpp -Could not create the Java virtual machine. - -Usage: java [-options] class [args...] - (to execute a class) - or java [-jar] [-options] jarfile [args...] - (to execute a jar file) - -where options include: - -cp -classpath <directories and zip/jar files separated by :> - set search path for application classes and resources - -D<name>=<value> - set a system property - -verbose[:class|gc|jni] - enable verbose output - -version print product version - -version:<value> - require the specified version to run - -showversion print product version and continue - -jre-restrict-search | -no-jre-restrict-search - include/exclude user private JREs in the version search - -agentlib:<libname>[=<options>] - load native agent library <libname>, e.g. -agentlib:hprof - see also, -agentlib:jdwp=help and -agentlib:hprof=help - -agentpath:<pathname>[=<options>] - load native agent library by full pathname - -javaagent:<jarpath>[=<options>] - load Java programming language agent, see java.lang.instrument - -? -help print this help message - -X print help on non-standard options - -assert print help on assert options - -The java class is not found: test2.Main -The java class is not found: test2.Main -The java class is not found: test2.Main -The java class is not found: test2.Main diff --git a/test/attic/files/cli/test2/Main.check.javac b/test/attic/files/cli/test2/Main.check.javac deleted file mode 100644 index c40c0a7a89..0000000000 --- a/test/attic/files/cli/test2/Main.check.javac +++ /dev/null @@ -1,27 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -help Print a synopsis of standard options - -files/cli/test2/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -1 error -files/cli/test2/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -1 error diff --git a/test/attic/files/cli/test2/Main.check.javac5 b/test/attic/files/cli/test2/Main.check.javac5 deleted file mode 100644 index 0ac32b056e..0000000000 --- a/test/attic/files/cli/test2/Main.check.javac5 +++ /dev/null @@ -1,28 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -cp <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - -files/cli/test2/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -1 error diff --git a/test/attic/files/cli/test2/Main.check.javac6 b/test/attic/files/cli/test2/Main.check.javac6 deleted file mode 100644 index 350d3253bc..0000000000 --- a/test/attic/files/cli/test2/Main.check.javac6 +++ /dev/null @@ -1,33 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files and annotation processors - -cp <path> Specify where to find user class files and annotation processors - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -proc:{none, only} Control whether annotation processing and/or compilation is done. - -processor <class> Name of the annotation processor to run; bypasses default discovery process - -processorpath <path> Specify where to find annotation processors - -d <directory> Specify where to place generated class files - -s <directory> Specify where to place generated source files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -A[key[=value]] Options to pass to annotation processors - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - -files/cli/test2/Main.java:5: package test1 does not exist - test1.Main.main(args); - ^ -1 error diff --git a/test/attic/files/cli/test2/Main.check.jikes b/test/attic/files/cli/test2/Main.check.jikes deleted file mode 100644 index 97943e8347..0000000000 --- a/test/attic/files/cli/test2/Main.check.jikes +++ /dev/null @@ -1,9 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. - -Found 1 semantic error compiling "files/cli/test2/Main.java": - - 6. test1.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test1" was found in type "test2.Main". diff --git a/test/attic/files/cli/test2/Main.check.jikes5 b/test/attic/files/cli/test2/Main.check.jikes5 deleted file mode 100644 index 97943e8347..0000000000 --- a/test/attic/files/cli/test2/Main.check.jikes5 +++ /dev/null @@ -1,9 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. - -Found 1 semantic error compiling "files/cli/test2/Main.java": - - 6. test1.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test1" was found in type "test2.Main". diff --git a/test/attic/files/cli/test2/Main.check.scala b/test/attic/files/cli/test2/Main.check.scala deleted file mode 100644 index 7e5f17625b..0000000000 --- a/test/attic/files/cli/test2/Main.check.scala +++ /dev/null @@ -1,24 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - -2: 1: test 1 passed (1) -2: 1: test 2 passed (1) -2: 1: test 3 passed (1) -2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test2/Main.check.scala_api b/test/attic/files/cli/test2/Main.check.scala_api deleted file mode 100644 index bcb0f0c7fb..0000000000 --- a/test/attic/files/cli/test2/Main.check.scala_api +++ /dev/null @@ -1,37 +0,0 @@ -|-- all-classes.html -|-- index.html -|-- modules.html -|-- nav-classes.html -|-- root-content.html -|-- scala -| |-- Any.html -| |-- AnyRef.html -| |-- AnyVal.html -| |-- Boolean.html -| |-- Byte.html -| |-- Char.html -| |-- Double.html -| |-- Float.html -| |-- Int.html -| |-- Long.html -| |-- Nothing.html -| |-- Null.html -| |-- Short.html -| |-- Unit.html -| `-- runtime -| |-- BoxedFloat.html -| |-- BoxedInt.html -| |-- BoxedLong.html -| `-- BoxedNumber.html -|-- script.js -|-- style.css -|-- test1 -| `-- Main$object.html -|-- test1$content.html -|-- test1$package.html -|-- test2 -| `-- Main$object.html -|-- test2$content.html -`-- test2$package.html - -4 directories, 31 files diff --git a/test/attic/files/cli/test2/Main.check.scala_j9 b/test/attic/files/cli/test2/Main.check.scala_j9 deleted file mode 100644 index 80cbb50fa9..0000000000 --- a/test/attic/files/cli/test2/Main.check.scala_j9 +++ /dev/null @@ -1,15 +0,0 @@ -unknown option: '-cpp' -scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>] - -<compiler-option>'s are as for scalac; see scalac -help. -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. --howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -2: 1: test 1 passed (1) -2: 1: test 2 passed (1) -2: 1: test 3 passed (1) -2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test2/Main.check.scalac b/test/attic/files/cli/test2/Main.check.scalac deleted file mode 100644 index 8465810d0b..0000000000 --- a/test/attic/files/cli/test2/Main.check.scalac +++ /dev/null @@ -1,63 +0,0 @@ -scalac error: bad option: '-dd' - scalac -help gives more information -Usage: scalac <options | source files> -where possible options include: - -doc Generate documentation - -g:<g> Generate debugging info (none,source,line,vars,notc) - -nowarn Generate no warnings - -noassert Generate no assertions and assumptions - -verbose Output messages about what the compiler is doing - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -windowtitle <windowtitle> Specify window title of generated HTML documentation - -documenttitle <documenttitle> Specify document title of generated HTML documentation - -target:<target> Specify which backend to use (jvm-1.5,msil) - -migrate Assist in migrating from Scala version 1.0 - -o <file> Name of the output assembly (only relevant with -target:msil) - -r <path> List of assemblies referenced by the program (only relevant with -target:msil) - -debug Output debugging messages - -deprecation enable detailed deprecation warnings - -unchecked enable detailed unchecked warnings - -statistics Print compiler statistics - -explaintypes Explain type errors in more detail - -resident Compiler stays resident, files to compile are read from standard input - -uniqid Print identifiers with unique names (debugging option) - -printtypes Print tree types (debugging option) - -prompt Display a prompt after each error (debugging option) - -noimports Compile without any implicit imports - -nopredefs Compile without any implicit predefined values - -skip:<phase> Skip <phase> - -check:<phase> Check the tree at start of <phase> - -print:<phase> Print out program after <phase> - -printer:<printer> Printer to use (text,html) - -printfile <file> Specify file in which to print trees - -graph:<phase> Graph the program after <phase> - -browse:<phase> Browse the abstract syntax tree after <phase> - -stop:<phase> Stop after phase <phase> - -log:<phase> Log operations in <phase> - -logall Log all operations - -version Print product version and exit - -help Print a synopsis of standard options - -nouescape disables handling of \u unicode escapes - -Xinline Perform inlining when possible - -XO Optimize. implies -Xinline, -Xcloselim and -Xdce - -Xcloselim Perform closure elimination - -Xdce Perform dead code elimination - -Xwarndeadcode Emit warnings for dead code - -XbytecodeRead Enable bytecode reader. - -Xdetach Perform detaching of remote closures - -Xshowcls <class> Show class info - -Xshowobj <object> Show object info - -Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types - -Xprintpos Print tree positions (as offsets) - -Xscript compile script file - -Xexperimental enable experimental extensions - -Xplugtypes parse but ignore annotations in more locations - -Xkilloption optimizes option types - -one error found diff --git a/test/attic/files/cli/test2/Main.check.scalaint b/test/attic/files/cli/test2/Main.check.scalaint deleted file mode 100644 index 89b6766bb5..0000000000 --- a/test/attic/files/cli/test2/Main.check.scalaint +++ /dev/null @@ -1,45 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - - -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 2: 1: test 1 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 2: 1: test 2 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 2: 1: test 3 passed (1) -unnamed0: scala.Unit = () - -scala> diff --git a/test/attic/files/cli/test2/Main.java b/test/attic/files/cli/test2/Main.java deleted file mode 100644 index f6797632bf..0000000000 --- a/test/attic/files/cli/test2/Main.java +++ /dev/null @@ -1,8 +0,0 @@ -// @info 1 dependency -package test2; -public class Main { - public static void main(String args[]) { - System.out.print("2: "); - test1.Main.main(args); - } -} diff --git a/test/attic/files/cli/test2/Main.scala b/test/attic/files/cli/test2/Main.scala deleted file mode 100644 index 11c878b9c0..0000000000 --- a/test/attic/files/cli/test2/Main.scala +++ /dev/null @@ -1,8 +0,0 @@ -// @info 1 dependency -package test2 -object Main { - def main(args: Array[String]) = { - Console.print("2: ") - test1.Main.main(args) - } -} diff --git a/test/attic/files/cli/test3/Main.check.j9vm5 b/test/attic/files/cli/test3/Main.check.j9vm5 deleted file mode 100644 index a094dc8daf..0000000000 --- a/test/attic/files/cli/test3/Main.check.j9vm5 +++ /dev/null @@ -1,5 +0,0 @@ -env: -cpp: No such file or directory -env: test3.Main: No such file or directory -env: -cp: No such file or directory -3: 1: test 3 passed -3: 2: 1: test 3 passed diff --git a/test/attic/files/cli/test3/Main.check.java b/test/attic/files/cli/test3/Main.check.java deleted file mode 100644 index de3eb7b136..0000000000 --- a/test/attic/files/cli/test3/Main.check.java +++ /dev/null @@ -1,10 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -3: 1: test 4 passed (2) -3: 2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test3/Main.check.java5 b/test/attic/files/cli/test3/Main.check.java5 deleted file mode 100644 index de3eb7b136..0000000000 --- a/test/attic/files/cli/test3/Main.check.java5 +++ /dev/null @@ -1,10 +0,0 @@ -Unrecognized option: -cpp -Could not create the Java virtual machine. -3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -3: 1: test 4 passed (2) -3: 2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test3/Main.check.java5_api b/test/attic/files/cli/test3/Main.check.java5_api deleted file mode 100644 index f6112211f0..0000000000 --- a/test/attic/files/cli/test3/Main.check.java5_api +++ /dev/null @@ -1,29 +0,0 @@ -|-- allclasses-frame.html -|-- allclasses-noframe.html -|-- constant-values.html -|-- deprecated-list.html -|-- help-doc.html -|-- index-all.html -|-- index.html -|-- overview-tree.html -|-- package-list -|-- resources -| `-- inherit.gif -|-- stylesheet.css -|-- test1 -| |-- Main.html -| |-- package-frame.html -| |-- package-summary.html -| `-- package-tree.html -|-- test2 -| |-- Main.html -| |-- package-frame.html -| |-- package-summary.html -| `-- package-tree.html -`-- test3 - |-- Main.html - |-- package-frame.html - |-- package-summary.html - `-- package-tree.html - -4 directories, 23 files diff --git a/test/attic/files/cli/test3/Main.check.java5_j9 b/test/attic/files/cli/test3/Main.check.java5_j9 deleted file mode 100644 index 9e228d7649..0000000000 --- a/test/attic/files/cli/test3/Main.check.java5_j9 +++ /dev/null @@ -1,36 +0,0 @@ -JVMJ9VM007E Command-line option unrecognised: -cpp -Could not create the Java virtual machine. - -Usage: java [-options] class [args...] - (to execute a class) - or java [-jar] [-options] jarfile [args...] - (to execute a jar file) - -where options include: - -cp -classpath <directories and zip/jar files separated by :> - set search path for application classes and resources - -D<name>=<value> - set a system property - -verbose[:class|gc|jni] - enable verbose output - -version print product version - -version:<value> - require the specified version to run - -showversion print product version and continue - -jre-restrict-search | -no-jre-restrict-search - include/exclude user private JREs in the version search - -agentlib:<libname>[=<options>] - load native agent library <libname>, e.g. -agentlib:hprof - see also, -agentlib:jdwp=help and -agentlib:hprof=help - -agentpath:<pathname>[=<options>] - load native agent library by full pathname - -javaagent:<jarpath>[=<options>] - load Java programming language agent, see java.lang.instrument - -? -help print this help message - -X print help on non-standard options - -assert print help on assert options - -The java class is not found: test3.Main -The java class is not found: test3.Main -The java class is not found: test3.Main -The java class is not found: test3.Main diff --git a/test/attic/files/cli/test3/Main.check.javac b/test/attic/files/cli/test3/Main.check.javac deleted file mode 100644 index 8d235b647b..0000000000 --- a/test/attic/files/cli/test3/Main.check.javac +++ /dev/null @@ -1,33 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -help Print a synopsis of standard options - -files/cli/test3/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -files/cli/test3/Main.java:8: package test2 does not exist - test2.Main.main(args); - ^ -2 errors -files/cli/test3/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -files/cli/test3/Main.java:8: package test2 does not exist - test2.Main.main(args); - ^ -2 errors diff --git a/test/attic/files/cli/test3/Main.check.javac5 b/test/attic/files/cli/test3/Main.check.javac5 deleted file mode 100644 index 3a48fa000e..0000000000 --- a/test/attic/files/cli/test3/Main.check.javac5 +++ /dev/null @@ -1,31 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files - -cp <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - -files/cli/test3/Main.java:6: package test1 does not exist - test1.Main.main(args); - ^ -files/cli/test3/Main.java:8: package test2 does not exist - test2.Main.main(args); - ^ -2 errors diff --git a/test/attic/files/cli/test3/Main.check.javac6 b/test/attic/files/cli/test3/Main.check.javac6 deleted file mode 100644 index 677b950aed..0000000000 --- a/test/attic/files/cli/test3/Main.check.javac6 +++ /dev/null @@ -1,36 +0,0 @@ -javac: invalid flag: -dd -Usage: javac <options> <source files> -where possible options include: - -g Generate all debugging info - -g:none Generate no debugging info - -g:{lines,vars,source} Generate only some debugging info - -nowarn Generate no warnings - -verbose Output messages about what the compiler is doing - -deprecation Output source locations where deprecated APIs are used - -classpath <path> Specify where to find user class files and annotation processors - -cp <path> Specify where to find user class files and annotation processors - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -endorseddirs <dirs> Override location of endorsed standards path - -proc:{none, only} Control whether annotation processing and/or compilation is done. - -processor <class> Name of the annotation processor to run; bypasses default discovery process - -processorpath <path> Specify where to find annotation processors - -d <directory> Specify where to place generated class files - -s <directory> Specify where to place generated source files - -encoding <encoding> Specify character encoding used by source files - -source <release> Provide source compatibility with specified release - -target <release> Generate class files for specific VM version - -version Version information - -help Print a synopsis of standard options - -A[key[=value]] Options to pass to annotation processors - -X Print a synopsis of nonstandard options - -J<flag> Pass <flag> directly to the runtime system - -files/cli/test3/Main.java:5: package test1 does not exist - test1.Main.main(args); - ^ -files/cli/test3/Main.java:7: package test2 does not exist - test2.Main.main(args); - ^ -2 errors diff --git a/test/attic/files/cli/test3/Main.check.jikes b/test/attic/files/cli/test3/Main.check.jikes deleted file mode 100644 index 604333e81a..0000000000 --- a/test/attic/files/cli/test3/Main.check.jikes +++ /dev/null @@ -1,14 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. - -Found 2 semantic errors compiling "files/cli/test3/Main.java": - - 6. test1.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test1" was found in type "test3.Main". - - - 8. test2.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test2" was found in type "test3.Main". diff --git a/test/attic/files/cli/test3/Main.check.jikes5 b/test/attic/files/cli/test3/Main.check.jikes5 deleted file mode 100644 index 604333e81a..0000000000 --- a/test/attic/files/cli/test3/Main.check.jikes5 +++ /dev/null @@ -1,14 +0,0 @@ -Error: "-dd" is an invalid option. -use: jikes [options] [@files] file.java... -For more help, try -help or -version. - -Found 2 semantic errors compiling "files/cli/test3/Main.java": - - 6. test1.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test1" was found in type "test3.Main". - - - 8. test2.Main.main(args); - ^---^ -*** Semantic Error: No accessible field named "test2" was found in type "test3.Main". diff --git a/test/attic/files/cli/test3/Main.check.scala b/test/attic/files/cli/test3/Main.check.scala deleted file mode 100644 index f78729b9a2..0000000000 --- a/test/attic/files/cli/test3/Main.check.scala +++ /dev/null @@ -1,28 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - -3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -3: 1: test 4 passed (2) -3: 2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test3/Main.check.scala_api b/test/attic/files/cli/test3/Main.check.scala_api deleted file mode 100644 index 4552819b5b..0000000000 --- a/test/attic/files/cli/test3/Main.check.scala_api +++ /dev/null @@ -1,41 +0,0 @@ -|-- all-classes.html -|-- index.html -|-- modules.html -|-- nav-classes.html -|-- root-content.html -|-- scala -| |-- Any.html -| |-- AnyRef.html -| |-- AnyVal.html -| |-- Boolean.html -| |-- Byte.html -| |-- Char.html -| |-- Double.html -| |-- Float.html -| |-- Int.html -| |-- Long.html -| |-- Nothing.html -| |-- Null.html -| |-- Short.html -| |-- Unit.html -| `-- runtime -| |-- BoxedFloat.html -| |-- BoxedInt.html -| |-- BoxedLong.html -| `-- BoxedNumber.html -|-- script.js -|-- style.css -|-- test1 -| `-- Main$object.html -|-- test1$content.html -|-- test1$package.html -|-- test2 -| `-- Main$object.html -|-- test2$content.html -|-- test2$package.html -|-- test3 -| `-- Main$object.html -|-- test3$content.html -`-- test3$package.html - -5 directories, 34 files diff --git a/test/attic/files/cli/test3/Main.check.scala_j9 b/test/attic/files/cli/test3/Main.check.scala_j9 deleted file mode 100644 index 3804c17636..0000000000 --- a/test/attic/files/cli/test3/Main.check.scala_j9 +++ /dev/null @@ -1,19 +0,0 @@ -unknown option: '-cpp' -scala [ <compiler-option> | -howtorun:how ]... [<torun> <arguments>] - -<compiler-option>'s are as for scalac; see scalac -help. -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. --howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -3: 1: test 4 passed (2) -3: 2: 1: test 4 passed (2) diff --git a/test/attic/files/cli/test3/Main.check.scalac b/test/attic/files/cli/test3/Main.check.scalac deleted file mode 100644 index 8465810d0b..0000000000 --- a/test/attic/files/cli/test3/Main.check.scalac +++ /dev/null @@ -1,63 +0,0 @@ -scalac error: bad option: '-dd' - scalac -help gives more information -Usage: scalac <options | source files> -where possible options include: - -doc Generate documentation - -g:<g> Generate debugging info (none,source,line,vars,notc) - -nowarn Generate no warnings - -noassert Generate no assertions and assumptions - -verbose Output messages about what the compiler is doing - -classpath <path> Specify where to find user class files - -sourcepath <path> Specify where to find input source files - -bootclasspath <path> Override location of bootstrap class files - -extdirs <dirs> Override location of installed extensions - -d <directory> Specify where to place generated class files - -encoding <encoding> Specify character encoding used by source files - -windowtitle <windowtitle> Specify window title of generated HTML documentation - -documenttitle <documenttitle> Specify document title of generated HTML documentation - -target:<target> Specify which backend to use (jvm-1.5,msil) - -migrate Assist in migrating from Scala version 1.0 - -o <file> Name of the output assembly (only relevant with -target:msil) - -r <path> List of assemblies referenced by the program (only relevant with -target:msil) - -debug Output debugging messages - -deprecation enable detailed deprecation warnings - -unchecked enable detailed unchecked warnings - -statistics Print compiler statistics - -explaintypes Explain type errors in more detail - -resident Compiler stays resident, files to compile are read from standard input - -uniqid Print identifiers with unique names (debugging option) - -printtypes Print tree types (debugging option) - -prompt Display a prompt after each error (debugging option) - -noimports Compile without any implicit imports - -nopredefs Compile without any implicit predefined values - -skip:<phase> Skip <phase> - -check:<phase> Check the tree at start of <phase> - -print:<phase> Print out program after <phase> - -printer:<printer> Printer to use (text,html) - -printfile <file> Specify file in which to print trees - -graph:<phase> Graph the program after <phase> - -browse:<phase> Browse the abstract syntax tree after <phase> - -stop:<phase> Stop after phase <phase> - -log:<phase> Log operations in <phase> - -logall Log all operations - -version Print product version and exit - -help Print a synopsis of standard options - -nouescape disables handling of \u unicode escapes - -Xinline Perform inlining when possible - -XO Optimize. implies -Xinline, -Xcloselim and -Xdce - -Xcloselim Perform closure elimination - -Xdce Perform dead code elimination - -Xwarndeadcode Emit warnings for dead code - -XbytecodeRead Enable bytecode reader. - -Xdetach Perform detaching of remote closures - -Xshowcls <class> Show class info - -Xshowobj <object> Show object info - -Xlinearizer:<Xlinearizer> Linearizer to use (normal,dfs,rpo,dump) - -Xgenerics Use generic Java types - -Xprintpos Print tree positions (as offsets) - -Xscript compile script file - -Xexperimental enable experimental extensions - -Xplugtypes parse but ignore annotations in more locations - -Xkilloption optimizes option types - -one error found diff --git a/test/attic/files/cli/test3/Main.check.scalaint b/test/attic/files/cli/test3/Main.check.scalaint deleted file mode 100644 index cffa02c5b6..0000000000 --- a/test/attic/files/cli/test3/Main.check.scalaint +++ /dev/null @@ -1,48 +0,0 @@ -unknown option: '-cpp' -scala [ <option> ]... [<torun> <arguments>] - -All options to scalac are allowed. See scalac -help. - -<torun>, if present, is an object or script file to run. -If no <torun> is present, run an interactive interpreter. - -Option -howtorun allows explicitly specifying how to run <torun>: - script: it is a script file - object: it is an object name - guess: (the default) try to guess - -Option -savecompiled requests that the compiled script be saved -for future use. - -Option -nocompdaemon requests that the fsc offline compiler not be used. - -Option -Dproperty=value sets a Java system property. - - -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 3: 1: test 1 passed (1) -3: 2: 1: test 1 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 3: 1: test 2 passed (1) -3: 2: 1: test 2 passed (1) -unnamed0: scala.Unit = () - -scala> -This is an interpreter for Scala. -Type in expressions to have them evaluated. -Type :help for more information. - -scala> 3: 1: test 3 passed (1) -3: 2: 1: test 3 passed (1) -unnamed0: scala.Unit = () - -scala> diff --git a/test/attic/files/cli/test3/Main.java b/test/attic/files/cli/test3/Main.java deleted file mode 100644 index 208863d012..0000000000 --- a/test/attic/files/cli/test3/Main.java +++ /dev/null @@ -1,10 +0,0 @@ -// @info 2 dependency -package test3; -public class Main { - public static void main(String args[]) { - System.out.print("3: "); - test1.Main.main(args); - System.out.print("3: "); - test2.Main.main(args); - } -} diff --git a/test/attic/files/cli/test3/Main.scala b/test/attic/files/cli/test3/Main.scala deleted file mode 100644 index 63fc11b771..0000000000 --- a/test/attic/files/cli/test3/Main.scala +++ /dev/null @@ -1,10 +0,0 @@ -// @info 2 dependencies -package test3 -object Main { - def main(args: Array[String]) = { - Console.print("3: ") - test1.Main.main(args) - Console.print("3: ") - test2.Main.main(args) - } -} diff --git a/test/files/disabled/A.scala b/test/disabled/buildmanager/overloaded_1/A.scala index c070faf978..c070faf978 100644 --- a/test/files/disabled/A.scala +++ b/test/disabled/buildmanager/overloaded_1/A.scala diff --git a/test/files/disabled/overloaded_1.check b/test/disabled/buildmanager/overloaded_1/overloaded_1.check index 4d643ce6b4..4d643ce6b4 100644 --- a/test/files/disabled/overloaded_1.check +++ b/test/disabled/buildmanager/overloaded_1/overloaded_1.check diff --git a/test/files/disabled/overloaded_1.test b/test/disabled/buildmanager/overloaded_1/overloaded_1.test index 392e0d365f..392e0d365f 100644 --- a/test/files/disabled/overloaded_1.test +++ b/test/disabled/buildmanager/overloaded_1/overloaded_1.test diff --git a/test/files/disabled/t4245/A.scala b/test/disabled/buildmanager/t4245/A.scala index 7c4efe1b4b..7c4efe1b4b 100644 --- a/test/files/disabled/t4245/A.scala +++ b/test/disabled/buildmanager/t4245/A.scala diff --git a/test/files/disabled/t4245/t4245.check b/test/disabled/buildmanager/t4245/t4245.check index 3d3898c671..3d3898c671 100644 --- a/test/files/disabled/t4245/t4245.check +++ b/test/disabled/buildmanager/t4245/t4245.check diff --git a/test/files/disabled/t4245/t4245.test b/test/disabled/buildmanager/t4245/t4245.test index 392e0d365f..392e0d365f 100644 --- a/test/files/disabled/t4245/t4245.test +++ b/test/disabled/buildmanager/t4245/t4245.test diff --git a/test/disabled/pos/spec-List.scala b/test/disabled/pos/spec-List.scala index 81e55f46cb..b31e035c1b 100644 --- a/test/disabled/pos/spec-List.scala +++ b/test/disabled/pos/spec-List.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/disabled/presentation/akka.flags b/test/disabled/presentation/akka.flags index 56d026a62d..9bf2878f62 100644 --- a/test/disabled/presentation/akka.flags +++ b/test/disabled/presentation/akka.flags @@ -12,7 +12,7 @@ # running partest from. Run it from the root scala checkout for these files to resolve correctly # (by default when running 'ant test', or 'test/partest'). Paths use Unix separators, the test # framework translates them to the platform dependent representation. -# -bootclasspath lib/scala-compiler.jar:lib/scala-library.jar:lib/fjbg.jar +# -bootclasspath lib/scala-compiler.jar:lib/scala-library.jar # the following line would test using the quick compiler -# -bootclasspath build/quick/classes/compiler:build/quick/classes/library:lib/fjbg.jar +# -bootclasspath build/quick/classes/compiler:build/quick/classes/library diff --git a/test/disabled/presentation/akka/src/akka/dispatch/Dispatchers.scala b/test/disabled/presentation/akka/src/akka/dispatch/Dispatchers.scala index 7dd1bf6218..a567d0bcb0 100644 --- a/test/disabled/presentation/akka/src/akka/dispatch/Dispatchers.scala +++ b/test/disabled/presentation/akka/src/akka/dispatch/Dispatchers.scala @@ -89,7 +89,7 @@ object Dispatchers { new ThreadBasedDispatcher(actor, mailboxCapacity, pushTimeOut) /** - * Creates a executor-based event-driven dispatcher serving multiple (millions) of actors through a thread pool. + * Creates an executor-based event-driven dispatcher serving multiple (millions) of actors through a thread pool. * <p/> * Has a fluent builder interface for configuring its semantics. */ @@ -97,7 +97,7 @@ object Dispatchers { ThreadPoolConfigDispatcherBuilder(config => new ExecutorBasedEventDrivenDispatcher(name, config), ThreadPoolConfig()) /** - * Creates a executor-based event-driven dispatcher serving multiple (millions) of actors through a thread pool. + * Creates an executor-based event-driven dispatcher serving multiple (millions) of actors through a thread pool. * <p/> * Has a fluent builder interface for configuring its semantics. */ @@ -106,7 +106,7 @@ object Dispatchers { new ExecutorBasedEventDrivenDispatcher(name, throughput, THROUGHPUT_DEADLINE_TIME_MILLIS, mailboxType, config), ThreadPoolConfig()) /** - * Creates a executor-based event-driven dispatcher serving multiple (millions) of actors through a thread pool. + * Creates an executor-based event-driven dispatcher serving multiple (millions) of actors through a thread pool. * <p/> * Has a fluent builder interface for configuring its semantics. */ @@ -115,7 +115,7 @@ object Dispatchers { new ExecutorBasedEventDrivenDispatcher(name, throughput, throughputDeadlineMs, mailboxType, config), ThreadPoolConfig()) /** - * Creates a executor-based event-driven dispatcher, with work-stealing, serving multiple (millions) of actors through a thread pool. + * Creates an executor-based event-driven dispatcher, with work-stealing, serving multiple (millions) of actors through a thread pool. * <p/> * Has a fluent builder interface for configuring its semantics. */ @@ -123,7 +123,7 @@ object Dispatchers { ThreadPoolConfigDispatcherBuilder(config => new ExecutorBasedEventDrivenWorkStealingDispatcher(name, config), ThreadPoolConfig()) /** - * Creates a executor-based event-driven dispatcher, with work-stealing, serving multiple (millions) of actors through a thread pool. + * Creates an executor-based event-driven dispatcher, with work-stealing, serving multiple (millions) of actors through a thread pool. * <p/> * Has a fluent builder interface for configuring its semantics. */ @@ -132,7 +132,7 @@ object Dispatchers { new ExecutorBasedEventDrivenWorkStealingDispatcher(name, throughput, THROUGHPUT_DEADLINE_TIME_MILLIS, MAILBOX_TYPE, config), ThreadPoolConfig()) /** - * Creates a executor-based event-driven dispatcher, with work-stealing, serving multiple (millions) of actors through a thread pool. + * Creates an executor-based event-driven dispatcher, with work-stealing, serving multiple (millions) of actors through a thread pool. * <p/> * Has a fluent builder interface for configuring its semantics. */ @@ -141,7 +141,7 @@ object Dispatchers { new ExecutorBasedEventDrivenWorkStealingDispatcher(name, throughput, THROUGHPUT_DEADLINE_TIME_MILLIS, mailboxType, config), ThreadPoolConfig()) /** - * Creates a executor-based event-driven dispatcher, with work-stealing, serving multiple (millions) of actors through a thread pool. + * Creates an executor-based event-driven dispatcher, with work-stealing, serving multiple (millions) of actors through a thread pool. * <p/> * Has a fluent builder interface for configuring its semantics. */ @@ -224,4 +224,4 @@ class ExecutorBasedEventDrivenWorkStealingDispatcherConfigurator extends Message mailboxType(config), threadPoolConfig)).build } -}
\ No newline at end of file +} diff --git a/test/disabled/presentation/simple-tests.check b/test/disabled/presentation/simple-tests.check index cdb80ed987..0f72cb5ab9 100644 --- a/test/disabled/presentation/simple-tests.check +++ b/test/disabled/presentation/simple-tests.check @@ -187,8 +187,6 @@ TypeMember(value Xshowobj,Tester.this.settings.StringSetting,false,true,<none>) TypeMember(value Xshowtrees,Tester.this.settings.BooleanSetting,false,true,<none>) TypeMember(value Xwarnfatal,Tester.this.settings.BooleanSetting,false,true,<none>) TypeMember(value Xwarninit,Tester.this.settings.BooleanSetting,false,true,<none>) -TypeMember(value Ybuilderdebug,Tester.this.settings.ChoiceSetting,false,true,<none>) -TypeMember(value Ybuildmanagerdebug,Tester.this.settings.BooleanSetting,false,true,<none>) TypeMember(value Ycompacttrees,Tester.this.settings.BooleanSetting,false,true,<none>) TypeMember(value Ycompletion,Tester.this.settings.BooleanSetting,false,true,<none>) TypeMember(value YdepMethTpes,Tester.this.settings.BooleanSetting,false,true,<none>) diff --git a/test/disabled/presentation/simple-tests.opts b/test/disabled/presentation/simple-tests.opts index 8529bbf1a0..d651316984 100644 --- a/test/disabled/presentation/simple-tests.opts +++ b/test/disabled/presentation/simple-tests.opts @@ -12,7 +12,7 @@ # running partest from. Run it from the root scala checkout for these files to resolve correctly # (by default when running 'ant test', or 'test/partest'). Paths use Unix separators, the test # framework translates them to the platform dependent representation. --bootclasspath lib/scala-compiler.jar:lib/scala-library.jar:lib/fjbg.jar +-bootclasspath lib/scala-compiler.jar:lib/scala-library.jar # the following line would test using the quick compiler -# -bootclasspath build/quick/classes/compiler:build/quick/classes/library:lib/fjbg.jar +# -bootclasspath build/quick/classes/compiler:build/quick/classes/library diff --git a/test/files/run/t4146.scala b/test/disabled/run/t4146.scala index 93ce22b519..a17de50ee1 100644 --- a/test/files/run/t4146.scala +++ b/test/disabled/run/t4146.scala @@ -1,4 +1,4 @@ -object bob extends Application { +object bob extends App { var name = "Bob" } diff --git a/test/files/ant/imported.xml b/test/files/ant/imported.xml index 5a4dfc319b..182c80aadf 100644 --- a/test/files/ant/imported.xml +++ b/test/files/ant/imported.xml @@ -56,7 +56,6 @@ INITIALISATION <property name="scala.dir" value="${quick.dir}"/> <property name="scala-library.lib" value="${scala.dir}/classes/library/"/> <property name="scala-compiler.lib" value="${scala.dir}/classes/compiler/"/> - <property name="fjbg.lib" value="${project.dir}/lib/fjbg.jar"/> </target> <target name="pack.init" if="pack.binary"> @@ -67,7 +66,6 @@ INITIALISATION <property name="scala.dir" value="${pack.dir}"/> <property name="scala-library.lib" value="${scala.dir}/lib/scala-library.jar"/> <property name="scala-compiler.lib" value="${scala.dir}/lib/scala-compiler.jar"/> - <property name="fjbg.lib" value=""/> </target> <target name="latest.init" if="latest.binary"> @@ -78,7 +76,6 @@ INITIALISATION <property name="scala.dir" value="${latest.dir}"/> <property name="scala-library.lib" value="${scala.dir}/lib/scala-library.jar"/> <property name="scala-compiler.lib" value="${scala.dir}/lib/scala-compiler.jar"/> - <property name="fjbg.lib" value=""/> </target> <target name="installed.init" if="installed.binary"> @@ -89,7 +86,6 @@ INITIALISATION <property name="scala.dir" value="${installed.dir}"/> <property name="scala-library.lib" value="${scala.dir}/lib/scala-library.jar"/> <property name="scala-compiler.lib" value="${scala.dir}/lib/scala-compiler.jar"/> - <property name="fjbg.lib" value=""/> </target> <target name="init" depends="quick.init, pack.init, latest.init, installed.init"> @@ -98,7 +94,6 @@ INITIALISATION <path id="scala.classpath"> <pathelement location="${scala-library.lib}"/> <pathelement location="${scala-compiler.lib}"/> - <pathelement location="${fjbg.lib}"/> <!-- only present for 'quick' --> </path> <fail message="Scala library '${scala-library.lib}' or '${scala-compiler.lib}' is missing/broken"> diff --git a/test/files/bench/equality/eqeq.eqlog b/test/files/bench/equality/eqeq.eqlog index d1e27aceed..55a5eb430a 100644 --- a/test/files/bench/equality/eqeq.eqlog +++ b/test/files/bench/equality/eqeq.eqlog @@ -1,42 +1,42 @@ -Banchmark results for testing equality operations:
-eq.scala: Base case, use eq equality only
-eqeq.scala: Test case, use == instead of eq.
-All tests run on Thinkpad T400, 1.6.0_12 client VM.
-Test command: java eq 5 5
- java eqeq 5 5
-eq.scala, no -optimise
-eq$ 109 78 79 63 63
-eq$ 94 63 63 78 78
-eq$ 94 62 62 62 78
-eq$ 94 78 78 78 78
-eq$ 94 78 78 78 78
-eq.scala, with -optimise
-eq$ 421 63 62 47 63
-eq$ 406 62 62 63 62
-eq$ 407 62 62 78 63
-eq$ 406 63 63 62 62
-eq$ 407 62 62 63 47
-eqeq.scala with version of BoxesRuntime as of Nov 13th, no -optimise
-eqeq$ 562 516 516 516 515
-eqeq$ 547 515 515 531 532
-eqeq$ 532 516 516 515 516
-eqeq$ 547 531 531 516 531
-eqeq$ 547 515 515 516 516
-eqeq.scala with version of BoxesRuntime as of Nov 13th, with -optimise
-eqeq$ 1031 390 391 391 391
-eqeq$ 1031 391 391 391 390
-eqeq$ 1031 390 390 391 391
-eqeq$ 1031 406 407 391 390
-eqeq$ 1031 390 390 391 391
-eqeq.scala with 1st optimized of Nov 14th, no -optimise
-eqeq$ 484 421 438 438 437
-eqeq$ 484 438 437 437 438
-eqeq$ 469 437 453 454 438
-eqeq$ 468 437 438 468 438
-eqeq$ 485 437 437 422 438
-eqeq.scala with 1st optimized of Nov 14th, with -optimise
-eqeq$ 1016 375 391 375 375
-eqeq$ 1016 375 391 390 375
-eqeq$ 1016 390 391 375 375
-eqeq$ 1015 375 391 390 375
-eqeq$ 1016 390 375 375 375
+Banchmark results for testing equality operations: +eq.scala: Base case, use eq equality only +eqeq.scala: Test case, use == instead of eq. +All tests run on Thinkpad T400, 1.6.0_12 client VM. +Test command: java eq 5 5 + java eqeq 5 5 +eq.scala, no -optimise +eq$ 109 78 79 63 63 +eq$ 94 63 63 78 78 +eq$ 94 62 62 62 78 +eq$ 94 78 78 78 78 +eq$ 94 78 78 78 78 +eq.scala, with -optimise +eq$ 421 63 62 47 63 +eq$ 406 62 62 63 62 +eq$ 407 62 62 78 63 +eq$ 406 63 63 62 62 +eq$ 407 62 62 63 47 +eqeq.scala with version of BoxesRuntime as of Nov 13th, no -optimise +eqeq$ 562 516 516 516 515 +eqeq$ 547 515 515 531 532 +eqeq$ 532 516 516 515 516 +eqeq$ 547 531 531 516 531 +eqeq$ 547 515 515 516 516 +eqeq.scala with version of BoxesRuntime as of Nov 13th, with -optimise +eqeq$ 1031 390 391 391 391 +eqeq$ 1031 391 391 391 390 +eqeq$ 1031 390 390 391 391 +eqeq$ 1031 406 407 391 390 +eqeq$ 1031 390 390 391 391 +eqeq.scala with 1st optimized of Nov 14th, no -optimise +eqeq$ 484 421 438 438 437 +eqeq$ 484 438 437 437 438 +eqeq$ 469 437 453 454 438 +eqeq$ 468 437 438 468 438 +eqeq$ 485 437 437 422 438 +eqeq.scala with 1st optimized of Nov 14th, with -optimise +eqeq$ 1016 375 391 375 375 +eqeq$ 1016 375 391 390 375 +eqeq$ 1016 390 391 375 375 +eqeq$ 1015 375 391 390 375 +eqeq$ 1016 390 375 375 375 diff --git a/test/files/buildmanager/annotated/A.scala b/test/files/buildmanager/annotated/A.scala deleted file mode 100644 index 4130cf21ec..0000000000 --- a/test/files/buildmanager/annotated/A.scala +++ /dev/null @@ -1 +0,0 @@ -case class A[T](x: String, y: T) diff --git a/test/files/buildmanager/annotated/annotated.check b/test/files/buildmanager/annotated/annotated.check deleted file mode 100644 index ce92c9a294..0000000000 --- a/test/files/buildmanager/annotated/annotated.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala -compiling Set(A.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(), object A -> List()) diff --git a/test/files/buildmanager/annotated/annotated.test b/test/files/buildmanager/annotated/annotated.test deleted file mode 100644 index 392e0d365f..0000000000 --- a/test/files/buildmanager/annotated/annotated.test +++ /dev/null @@ -1,2 +0,0 @@ ->>compile A.scala ->>compile A.scala diff --git a/test/files/buildmanager/freshnames/A.scala b/test/files/buildmanager/freshnames/A.scala deleted file mode 100644 index e8ab26ca1e..0000000000 --- a/test/files/buildmanager/freshnames/A.scala +++ /dev/null @@ -1,16 +0,0 @@ -abstract class A { - - var t: List[B] - - def foo(n: String): Option[B] = { - t.reverse find (_.names contains n) - } - - def bar(n: Int): Option[B] = { - t.reverse find (_.names contains n) - } -} - -//class A -case class B(names: List[String]) - diff --git a/test/files/buildmanager/freshnames/B.scala b/test/files/buildmanager/freshnames/B.scala deleted file mode 100644 index d700225c08..0000000000 --- a/test/files/buildmanager/freshnames/B.scala +++ /dev/null @@ -1,4 +0,0 @@ -abstract class C extends A { - def test(n: Int) = bar(n) -} - diff --git a/test/files/buildmanager/freshnames/freshnames.check b/test/files/buildmanager/freshnames/freshnames.check deleted file mode 100644 index 9f05fb8a36..0000000000 --- a/test/files/buildmanager/freshnames/freshnames.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > B.scala A.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(), class B -> List(), object B -> List()) diff --git a/test/files/buildmanager/freshnames/freshnames.test b/test/files/buildmanager/freshnames/freshnames.test deleted file mode 100644 index 20b20298f9..0000000000 --- a/test/files/buildmanager/freshnames/freshnames.test +++ /dev/null @@ -1,2 +0,0 @@ ->>compile B.scala A.scala ->>compile A.scala diff --git a/test/files/buildmanager/infer/A.scala b/test/files/buildmanager/infer/A.scala deleted file mode 100644 index 46b5391609..0000000000 --- a/test/files/buildmanager/infer/A.scala +++ /dev/null @@ -1,16 +0,0 @@ -class Foo(flag: Boolean) { - val classpath = - if (flag) - new AClasspath - else - new BClasspath -} - -class AClasspath extends MergedClasspath[A] - -class BClasspath extends MergedClasspath[B] - -abstract class MergedClasspath[T] - -class A -class B diff --git a/test/files/buildmanager/infer/infer.check b/test/files/buildmanager/infer/infer.check deleted file mode 100644 index 1f736977ff..0000000000 --- a/test/files/buildmanager/infer/infer.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala -compiling Set(A.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(), class AClasspath -> List(), class B -> List(), class BClasspath -> List(), class Foo -> List(), class MergedClasspath -> List()) diff --git a/test/files/buildmanager/infer/infer.test b/test/files/buildmanager/infer/infer.test deleted file mode 100644 index 392e0d365f..0000000000 --- a/test/files/buildmanager/infer/infer.test +++ /dev/null @@ -1,2 +0,0 @@ ->>compile A.scala ->>compile A.scala diff --git a/test/files/buildmanager/namesdefaults/defparam-use.scala b/test/files/buildmanager/namesdefaults/defparam-use.scala deleted file mode 100644 index 5b5bbb3f4e..0000000000 --- a/test/files/buildmanager/namesdefaults/defparam-use.scala +++ /dev/null @@ -1,5 +0,0 @@ - -object Test extends App { - val outer = new Outer - new outer.Inner -} diff --git a/test/files/buildmanager/namesdefaults/defparam.scala b/test/files/buildmanager/namesdefaults/defparam.scala deleted file mode 100644 index d817c719ab..0000000000 --- a/test/files/buildmanager/namesdefaults/defparam.scala +++ /dev/null @@ -1,7 +0,0 @@ -class Outer { - - class Inner(val x: List[Int] = Nil) - -// lazy val Inner = "abc" -} - diff --git a/test/files/buildmanager/namesdefaults/namesdefaults.check b/test/files/buildmanager/namesdefaults/namesdefaults.check deleted file mode 100644 index 4a94d1fb55..0000000000 --- a/test/files/buildmanager/namesdefaults/namesdefaults.check +++ /dev/null @@ -1,9 +0,0 @@ -builder > defparam.scala defparam-use.scala -compiling Set(defparam-use.scala, defparam.scala) -Changes: Map() -builder > defparam-use.scala -compiling Set(defparam-use.scala) -Changes: Map(class Test$delayedInit$body -> List(), object Test -> List()) -builder > defparam-use.scala -compiling Set(defparam-use.scala) -Changes: Map(class Test$delayedInit$body -> List(), object Test -> List()) diff --git a/test/files/buildmanager/namesdefaults/namesdefaults.test b/test/files/buildmanager/namesdefaults/namesdefaults.test deleted file mode 100644 index 84ccc36bc3..0000000000 --- a/test/files/buildmanager/namesdefaults/namesdefaults.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile defparam.scala defparam-use.scala ->>compile defparam-use.scala ->>compile defparam-use.scala diff --git a/test/files/buildmanager/simpletest/A.scala b/test/files/buildmanager/simpletest/A.scala deleted file mode 100644 index ef704706bb..0000000000 --- a/test/files/buildmanager/simpletest/A.scala +++ /dev/null @@ -1,3 +0,0 @@ -class A { - def foo = 2 -} diff --git a/test/files/buildmanager/simpletest/B.scala b/test/files/buildmanager/simpletest/B.scala deleted file mode 100644 index 364dc6e4cb..0000000000 --- a/test/files/buildmanager/simpletest/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -class B extends A { - override def foo = 2 -} diff --git a/test/files/buildmanager/simpletest/simpletest.changes/A1.scala b/test/files/buildmanager/simpletest/simpletest.changes/A1.scala deleted file mode 100644 index 83d15dc739..0000000000 --- a/test/files/buildmanager/simpletest/simpletest.changes/A1.scala +++ /dev/null @@ -1 +0,0 @@ -class A diff --git a/test/files/buildmanager/simpletest/simpletest.check b/test/files/buildmanager/simpletest/simpletest.check deleted file mode 100644 index 95ea2c4c0d..0000000000 --- a/test/files/buildmanager/simpletest/simpletest.check +++ /dev/null @@ -1,11 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(Removed(Definition(A.foo)))) -invalidate B.scala because inherited method removed [Removed(Definition(A.foo))] -compiling Set(B.scala) -B.scala:2: error: method foo overrides nothing - override def foo = 2 - ^ diff --git a/test/files/buildmanager/simpletest/simpletest.test b/test/files/buildmanager/simpletest/simpletest.test deleted file mode 100644 index 2c0be1502f..0000000000 --- a/test/files/buildmanager/simpletest/simpletest.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A1.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2280/A.scala b/test/files/buildmanager/t2280/A.scala deleted file mode 100644 index 5febadeb06..0000000000 --- a/test/files/buildmanager/t2280/A.scala +++ /dev/null @@ -1 +0,0 @@ -class A extends B diff --git a/test/files/buildmanager/t2280/B.java b/test/files/buildmanager/t2280/B.java deleted file mode 100644 index aef8e106e9..0000000000 --- a/test/files/buildmanager/t2280/B.java +++ /dev/null @@ -1,2 +0,0 @@ -public class B {} - diff --git a/test/files/buildmanager/t2280/t2280.check b/test/files/buildmanager/t2280/t2280.check deleted file mode 100644 index 7ea7511c63..0000000000 --- a/test/files/buildmanager/t2280/t2280.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala B.java -compiling Set(A.scala, B.java) -Changes: Map() -builder > B.java -compiling Set(B.java) -Changes: Map(class B -> List()) diff --git a/test/files/buildmanager/t2280/t2280.test b/test/files/buildmanager/t2280/t2280.test deleted file mode 100644 index 2eda777853..0000000000 --- a/test/files/buildmanager/t2280/t2280.test +++ /dev/null @@ -1,2 +0,0 @@ ->>compile A.scala B.java ->>compile B.java diff --git a/test/files/buildmanager/t2556_1/A.scala b/test/files/buildmanager/t2556_1/A.scala deleted file mode 100644 index c6e200b217..0000000000 --- a/test/files/buildmanager/t2556_1/A.scala +++ /dev/null @@ -1,3 +0,0 @@ -class A { - def x(i: Int) = i+"3" -} diff --git a/test/files/buildmanager/t2556_1/B.scala b/test/files/buildmanager/t2556_1/B.scala deleted file mode 100644 index 8529587b56..0000000000 --- a/test/files/buildmanager/t2556_1/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -class B extends A { - def x(s: String) = s+"5" -} diff --git a/test/files/buildmanager/t2556_1/t2556_1.changes/A2.scala b/test/files/buildmanager/t2556_1/t2556_1.changes/A2.scala deleted file mode 100644 index 4ac1045e13..0000000000 --- a/test/files/buildmanager/t2556_1/t2556_1.changes/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - def x(i: String) = i+"3" -} - diff --git a/test/files/buildmanager/t2556_1/t2556_1.check b/test/files/buildmanager/t2556_1/t2556_1.check deleted file mode 100644 index 2e501c8f6f..0000000000 --- a/test/files/buildmanager/t2556_1/t2556_1.check +++ /dev/null @@ -1,12 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: <method>])) -invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: <method>]] -compiling Set(B.scala) -B.scala:2: error: overriding method x in class A of type (i: String)String; - method x needs `override' modifier - def x(s: String) = s+"5" - ^ diff --git a/test/files/buildmanager/t2556_1/t2556_1.test b/test/files/buildmanager/t2556_1/t2556_1.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2556_1/t2556_1.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2556_2/A.scala b/test/files/buildmanager/t2556_2/A.scala deleted file mode 100644 index b8da5c8fb1..0000000000 --- a/test/files/buildmanager/t2556_2/A.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - def x(i: Int) = i+"3" -} - diff --git a/test/files/buildmanager/t2556_2/B.scala b/test/files/buildmanager/t2556_2/B.scala deleted file mode 100644 index 80ff25d0ca..0000000000 --- a/test/files/buildmanager/t2556_2/B.scala +++ /dev/null @@ -1,2 +0,0 @@ -class B extends A - diff --git a/test/files/buildmanager/t2556_2/C.scala b/test/files/buildmanager/t2556_2/C.scala deleted file mode 100644 index 0ab13e3757..0000000000 --- a/test/files/buildmanager/t2556_2/C.scala +++ /dev/null @@ -1,4 +0,0 @@ -class C extends B { - def x(s: String) = s+"5" -} - diff --git a/test/files/buildmanager/t2556_2/t2556_2.changes/A2.scala b/test/files/buildmanager/t2556_2/t2556_2.changes/A2.scala deleted file mode 100644 index 4ac1045e13..0000000000 --- a/test/files/buildmanager/t2556_2/t2556_2.changes/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - def x(i: String) = i+"3" -} - diff --git a/test/files/buildmanager/t2556_2/t2556_2.check b/test/files/buildmanager/t2556_2/t2556_2.check deleted file mode 100644 index cae4f72212..0000000000 --- a/test/files/buildmanager/t2556_2/t2556_2.check +++ /dev/null @@ -1,13 +0,0 @@ -builder > A.scala B.scala C.scala -compiling Set(A.scala, B.scala, C.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: <method>])) -invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: <method>]] -invalidate C.scala because inherited method changed [Changed(Definition(A.x))[method x changed from (i: Int)String to (i: String)String flags: <method>]] -compiling Set(B.scala, C.scala) -C.scala:2: error: overriding method x in class A of type (i: String)String; - method x needs `override' modifier - def x(s: String) = s+"5" - ^ diff --git a/test/files/buildmanager/t2556_2/t2556_2.test b/test/files/buildmanager/t2556_2/t2556_2.test deleted file mode 100644 index 9f31bb6409..0000000000 --- a/test/files/buildmanager/t2556_2/t2556_2.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala C.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2556_3/A.scala b/test/files/buildmanager/t2556_3/A.scala deleted file mode 100644 index 089a05f493..0000000000 --- a/test/files/buildmanager/t2556_3/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -class A { - def x = 3 -} -class B extends A - diff --git a/test/files/buildmanager/t2556_3/B.scala b/test/files/buildmanager/t2556_3/B.scala deleted file mode 100644 index 0ec5ae4b55..0000000000 --- a/test/files/buildmanager/t2556_3/B.scala +++ /dev/null @@ -1,5 +0,0 @@ -object E { - def main(args: Array[String]) = - println( (new C).x ) -} - diff --git a/test/files/buildmanager/t2556_3/C.scala b/test/files/buildmanager/t2556_3/C.scala deleted file mode 100644 index 403df8455e..0000000000 --- a/test/files/buildmanager/t2556_3/C.scala +++ /dev/null @@ -1,2 +0,0 @@ -class C extends B - diff --git a/test/files/buildmanager/t2556_3/t2556_3.changes/A2.scala b/test/files/buildmanager/t2556_3/t2556_3.changes/A2.scala deleted file mode 100644 index 21cb2779f9..0000000000 --- a/test/files/buildmanager/t2556_3/t2556_3.changes/A2.scala +++ /dev/null @@ -1,5 +0,0 @@ -class A { - def x = 3 -} -class B - diff --git a/test/files/buildmanager/t2556_3/t2556_3.check b/test/files/buildmanager/t2556_3/t2556_3.check deleted file mode 100644 index 34f90f7f9b..0000000000 --- a/test/files/buildmanager/t2556_3/t2556_3.check +++ /dev/null @@ -1,18 +0,0 @@ -builder > A.scala B.scala C.scala -compiling Set(A.scala, B.scala, C.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(), class B -> List(Changed(Class(B))[List((A,Object))])) -invalidate C.scala because parents have changed [Changed(Class(B))[List((A,Object))]] -invalidate B.scala because it references invalid (no longer inherited) definition [ParentChanged(Class(C))] -compiling Set(B.scala, C.scala) -B.scala:3: error: type mismatch; - found : C - required: ?{def x: ?} -Note that implicit conversions are not applicable because they are ambiguous: - both method any2Ensuring in object Predef of type [A](x: A)Ensuring[A] - and method any2ArrowAssoc in object Predef of type [A](x: A)ArrowAssoc[A] - are possible conversion functions from C to ?{def x: ?} - println( (new C).x ) - ^ diff --git a/test/files/buildmanager/t2556_3/t2556_3.test b/test/files/buildmanager/t2556_3/t2556_3.test deleted file mode 100644 index 9f31bb6409..0000000000 --- a/test/files/buildmanager/t2556_3/t2556_3.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala C.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2557/A.scala b/test/files/buildmanager/t2557/A.scala deleted file mode 100644 index 3be55f19a6..0000000000 --- a/test/files/buildmanager/t2557/A.scala +++ /dev/null @@ -1,4 +0,0 @@ -trait A { - def x = 3 -} - diff --git a/test/files/buildmanager/t2557/B.scala b/test/files/buildmanager/t2557/B.scala deleted file mode 100644 index ea86a90079..0000000000 --- a/test/files/buildmanager/t2557/B.scala +++ /dev/null @@ -1,4 +0,0 @@ -trait B extends A { - override def x = super.x * 2 -} - diff --git a/test/files/buildmanager/t2557/C.scala b/test/files/buildmanager/t2557/C.scala deleted file mode 100644 index dd575ac38d..0000000000 --- a/test/files/buildmanager/t2557/C.scala +++ /dev/null @@ -1,3 +0,0 @@ -trait C extends A { - override def x = super.x + 5 -} diff --git a/test/files/buildmanager/t2557/D.scala b/test/files/buildmanager/t2557/D.scala deleted file mode 100644 index 4e662a80ce..0000000000 --- a/test/files/buildmanager/t2557/D.scala +++ /dev/null @@ -1 +0,0 @@ -trait D extends C with B diff --git a/test/files/buildmanager/t2557/E.scala b/test/files/buildmanager/t2557/E.scala deleted file mode 100644 index 2aee552675..0000000000 --- a/test/files/buildmanager/t2557/E.scala +++ /dev/null @@ -1 +0,0 @@ -trait E extends D diff --git a/test/files/buildmanager/t2557/F.scala b/test/files/buildmanager/t2557/F.scala deleted file mode 100644 index e1996704e7..0000000000 --- a/test/files/buildmanager/t2557/F.scala +++ /dev/null @@ -1,4 +0,0 @@ -object F extends E { - def main(args: Array[String]) = - println(x) -} diff --git a/test/files/buildmanager/t2557/t2557.changes/D2.scala b/test/files/buildmanager/t2557/t2557.changes/D2.scala deleted file mode 100644 index 67295f8e6d..0000000000 --- a/test/files/buildmanager/t2557/t2557.changes/D2.scala +++ /dev/null @@ -1,2 +0,0 @@ -trait D extends B with C - diff --git a/test/files/buildmanager/t2557/t2557.check b/test/files/buildmanager/t2557/t2557.check deleted file mode 100644 index 736ef3645e..0000000000 --- a/test/files/buildmanager/t2557/t2557.check +++ /dev/null @@ -1,10 +0,0 @@ -builder > A.scala B.scala C.scala D.scala E.scala F.scala -compiling Set(A.scala, B.scala, C.scala, D.scala, E.scala, F.scala) -Changes: Map() -builder > D.scala -compiling Set(D.scala) -Changes: Map(trait D -> List(Changed(Class(D))[List((Object,Object), (C,B), (B,C))])) -invalidate E.scala because parents have changed [Changed(Class(D))[List((Object,Object), (C,B), (B,C))]] -invalidate F.scala because parents have changed [Changed(Class(D))[List((Object,Object), (C,B), (B,C))]] -compiling Set(E.scala, F.scala) -Changes: Map(object F -> List(), trait E -> List()) diff --git a/test/files/buildmanager/t2557/t2557.test b/test/files/buildmanager/t2557/t2557.test deleted file mode 100644 index 6b0103092f..0000000000 --- a/test/files/buildmanager/t2557/t2557.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala C.scala D.scala E.scala F.scala ->>update D.scala=>D2.scala ->>compile D.scala diff --git a/test/files/buildmanager/t2559/A.scala b/test/files/buildmanager/t2559/A.scala deleted file mode 100644 index fb4f6e3545..0000000000 --- a/test/files/buildmanager/t2559/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -sealed trait A -class B extends A -class C extends A -//class E extends A - diff --git a/test/files/buildmanager/t2559/D.scala b/test/files/buildmanager/t2559/D.scala deleted file mode 100644 index 62dc5427f9..0000000000 --- a/test/files/buildmanager/t2559/D.scala +++ /dev/null @@ -1,4 +0,0 @@ -object D { - def x(a: A) = if (a.isInstanceOf[B] || a.isInstanceOf[C]) () -} - diff --git a/test/files/buildmanager/t2559/t2559.changes/A2.scala b/test/files/buildmanager/t2559/t2559.changes/A2.scala deleted file mode 100644 index 8e90594e2c..0000000000 --- a/test/files/buildmanager/t2559/t2559.changes/A2.scala +++ /dev/null @@ -1,5 +0,0 @@ -sealed trait A -class B extends A -class C extends A -class E extends A - diff --git a/test/files/buildmanager/t2559/t2559.check b/test/files/buildmanager/t2559/t2559.check deleted file mode 100644 index 4d43838cf5..0000000000 --- a/test/files/buildmanager/t2559/t2559.check +++ /dev/null @@ -1,9 +0,0 @@ -builder > A.scala D.scala -compiling Set(A.scala, D.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class B -> List(), class C -> List(), class E -> List(Changed(Class(A))[class E extends a sealed trait A]), trait A -> List()) -invalidate D.scala because it references changed class [Changed(Class(A))[class E extends a sealed trait A]] -compiling Set(D.scala) -Changes: Map(object D -> List()) diff --git a/test/files/buildmanager/t2559/t2559.test b/test/files/buildmanager/t2559/t2559.test deleted file mode 100644 index b787c5b39f..0000000000 --- a/test/files/buildmanager/t2559/t2559.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala D.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2562/A.scala b/test/files/buildmanager/t2562/A.scala deleted file mode 100644 index 740cd1e868..0000000000 --- a/test/files/buildmanager/t2562/A.scala +++ /dev/null @@ -1,7 +0,0 @@ -object A -{ - def x0 = B.x0 - def x1 = B.x1 - def x2 = B.x2 - def x3 = 3 -} diff --git a/test/files/buildmanager/t2562/B.scala b/test/files/buildmanager/t2562/B.scala deleted file mode 100644 index a524e5cc84..0000000000 --- a/test/files/buildmanager/t2562/B.scala +++ /dev/null @@ -1,8 +0,0 @@ -object B -{ - def x0 = A.x1 - def x1 = A.x2 - def x2 = A.x3 -} - - diff --git a/test/files/buildmanager/t2562/t2562.changes/A2.scala b/test/files/buildmanager/t2562/t2562.changes/A2.scala deleted file mode 100644 index c560e1e816..0000000000 --- a/test/files/buildmanager/t2562/t2562.changes/A2.scala +++ /dev/null @@ -1,8 +0,0 @@ -object A -{ - def x0 = B.x0 - def x1 = B.x1 - def x2 = B.x2 - def x3 = "3" -} - diff --git a/test/files/buildmanager/t2562/t2562.check b/test/files/buildmanager/t2562/t2562.check deleted file mode 100644 index 74575f28ea..0000000000 --- a/test/files/buildmanager/t2562/t2562.check +++ /dev/null @@ -1,12 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(object A -> List(Changed(Definition(A.x3))[method x3 changed from ()Int to ()String flags: <method> <triedcooking>])) -invalidate B.scala because it references changed definition [Changed(Definition(A.x3))[method x3 changed from ()Int to ()String flags: <method> <triedcooking>]] -compiling Set(B.scala) -Changes: Map(object B -> List(Changed(Definition(B.x2))[method x2 changed from ()Int to ()String flags: <method> <triedcooking>])) -invalidate A.scala because it references changed definition [Changed(Definition(B.x2))[method x2 changed from ()Int to ()String flags: <method> <triedcooking>]] -compiling Set(A.scala, B.scala) -Changes: Map(object A -> List(Changed(Definition(A.x0))[method x0 changed from ()Int to ()String flags: <method>], Changed(Definition(A.x1))[method x1 changed from ()Int to ()String flags: <method> <triedcooking>], Changed(Definition(A.x2))[method x2 changed from ()Int to ()String flags: <method> <triedcooking>]), object B -> List(Changed(Definition(B.x0))[method x0 changed from ()Int to ()String flags: <method>], Changed(Definition(B.x1))[method x1 changed from ()Int to ()String flags: <method>])) diff --git a/test/files/buildmanager/t2562/t2562.test b/test/files/buildmanager/t2562/t2562.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2562/t2562.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2649/A.scala b/test/files/buildmanager/t2649/A.scala deleted file mode 100644 index 86cc3f2c15..0000000000 --- a/test/files/buildmanager/t2649/A.scala +++ /dev/null @@ -1,3 +0,0 @@ -object A { - def x(zz: Int, yy: Int) = yy - zz -} diff --git a/test/files/buildmanager/t2649/B.scala b/test/files/buildmanager/t2649/B.scala deleted file mode 100644 index 26c89518cb..0000000000 --- a/test/files/buildmanager/t2649/B.scala +++ /dev/null @@ -1,4 +0,0 @@ -object B { - def main(args: Array[String]): Unit = - println( A.x(zz = 3, yy = 4) ) -} diff --git a/test/files/buildmanager/t2649/t2649.changes/A2.scala b/test/files/buildmanager/t2649/t2649.changes/A2.scala deleted file mode 100644 index 9a6309fca3..0000000000 --- a/test/files/buildmanager/t2649/t2649.changes/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object A { - def x(yy: Int, zz: Int) = yy - zz -} - diff --git a/test/files/buildmanager/t2649/t2649.check b/test/files/buildmanager/t2649/t2649.check deleted file mode 100644 index d0f41f32ec..0000000000 --- a/test/files/buildmanager/t2649/t2649.check +++ /dev/null @@ -1,9 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(object A -> List(Changed(Definition(A.x))[method x changed from (zz: Int, yy: Int)Int to (yy: Int, zz: Int)Int flags: <method> <triedcooking>])) -invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from (zz: Int, yy: Int)Int to (yy: Int, zz: Int)Int flags: <method> <triedcooking>]] -compiling Set(B.scala) -Changes: Map(object B -> List()) diff --git a/test/files/buildmanager/t2649/t2649.test b/test/files/buildmanager/t2649/t2649.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2649/t2649.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2650_1/A.scala b/test/files/buildmanager/t2650_1/A.scala deleted file mode 100644 index 74714a3c47..0000000000 --- a/test/files/buildmanager/t2650_1/A.scala +++ /dev/null @@ -1,4 +0,0 @@ -trait A { - type S[_] -} - diff --git a/test/files/buildmanager/t2650_1/B.scala b/test/files/buildmanager/t2650_1/B.scala deleted file mode 100644 index 80f0e30259..0000000000 --- a/test/files/buildmanager/t2650_1/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -trait B extends A { - type F = S[Int] -} diff --git a/test/files/buildmanager/t2650_1/t2650_1.changes/A2.scala b/test/files/buildmanager/t2650_1/t2650_1.changes/A2.scala deleted file mode 100644 index 2b8ead4ff1..0000000000 --- a/test/files/buildmanager/t2650_1/t2650_1.changes/A2.scala +++ /dev/null @@ -1,3 +0,0 @@ -trait A { - type S -} diff --git a/test/files/buildmanager/t2650_1/t2650_1.check b/test/files/buildmanager/t2650_1/t2650_1.check deleted file mode 100644 index f1e4b1b8bc..0000000000 --- a/test/files/buildmanager/t2650_1/t2650_1.check +++ /dev/null @@ -1,12 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -warning: there were 1 feature warnings; re-run with -feature for details -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(trait A -> List(Changed(Definition(A.S))[type S changed from A.this.S[_] to A.this.S flags: <deferred>])) -invalidate B.scala because inherited method changed [Changed(Definition(A.S))[type S changed from A.this.S[_] to A.this.S flags: <deferred>]] -compiling Set(B.scala) -B.scala:2: error: B.this.S does not take type parameters - type F = S[Int] - ^ diff --git a/test/files/buildmanager/t2650_1/t2650_1.test b/test/files/buildmanager/t2650_1/t2650_1.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2650_1/t2650_1.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2650_2/A.scala b/test/files/buildmanager/t2650_2/A.scala deleted file mode 100644 index bcea634485..0000000000 --- a/test/files/buildmanager/t2650_2/A.scala +++ /dev/null @@ -1,3 +0,0 @@ -trait A { - type S = Int -} diff --git a/test/files/buildmanager/t2650_2/B.scala b/test/files/buildmanager/t2650_2/B.scala deleted file mode 100644 index 22a3a9a48e..0000000000 --- a/test/files/buildmanager/t2650_2/B.scala +++ /dev/null @@ -1,4 +0,0 @@ -trait B extends A { - def x: S - def y: Int = x -} diff --git a/test/files/buildmanager/t2650_2/t2650_2.changes/A2.scala b/test/files/buildmanager/t2650_2/t2650_2.changes/A2.scala deleted file mode 100644 index 8274c1b62d..0000000000 --- a/test/files/buildmanager/t2650_2/t2650_2.changes/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -trait A { - type S = Long -} - diff --git a/test/files/buildmanager/t2650_2/t2650_2.check b/test/files/buildmanager/t2650_2/t2650_2.check deleted file mode 100644 index 53a0287dfc..0000000000 --- a/test/files/buildmanager/t2650_2/t2650_2.check +++ /dev/null @@ -1,14 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(trait A -> List(Changed(Definition(A.S))[type S changed from A.this.S to A.this.S flags: ])) -invalidate B.scala because inherited method changed [Changed(Definition(A.S))[type S changed from A.this.S to A.this.S flags: ]] -compiling Set(B.scala) -B.scala:3: error: type mismatch; - found : B.this.S - (which expands to) Long - required: Int - def y: Int = x - ^ diff --git a/test/files/buildmanager/t2650_2/t2650_2.test b/test/files/buildmanager/t2650_2/t2650_2.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2650_2/t2650_2.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2650_3/A.scala b/test/files/buildmanager/t2650_3/A.scala deleted file mode 100644 index cd13843eb9..0000000000 --- a/test/files/buildmanager/t2650_3/A.scala +++ /dev/null @@ -1,4 +0,0 @@ -trait A { - type T = Int - def x: T -} diff --git a/test/files/buildmanager/t2650_3/B.scala b/test/files/buildmanager/t2650_3/B.scala deleted file mode 100644 index 46a8cf270a..0000000000 --- a/test/files/buildmanager/t2650_3/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -object B { - def x(a: A): Int = a.x -} diff --git a/test/files/buildmanager/t2650_3/t2650_3.changes/A2.scala b/test/files/buildmanager/t2650_3/t2650_3.changes/A2.scala deleted file mode 100644 index e5667b2539..0000000000 --- a/test/files/buildmanager/t2650_3/t2650_3.changes/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -trait A { - type T = Long - def x: T -} diff --git a/test/files/buildmanager/t2650_3/t2650_3.check b/test/files/buildmanager/t2650_3/t2650_3.check deleted file mode 100644 index 5c6326d59f..0000000000 --- a/test/files/buildmanager/t2650_3/t2650_3.check +++ /dev/null @@ -1,14 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(trait A -> List(Changed(Definition(A.T))[type T changed from A.this.T to A.this.T flags: ])) -invalidate B.scala because it references changed definition [Changed(Definition(A.T))[type T changed from A.this.T to A.this.T flags: ]] -compiling Set(B.scala) -B.scala:2: error: type mismatch; - found : a.T - (which expands to) Long - required: Int - def x(a: A): Int = a.x - ^ diff --git a/test/files/buildmanager/t2650_3/t2650_3.test b/test/files/buildmanager/t2650_3/t2650_3.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2650_3/t2650_3.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2650_4/A.scala b/test/files/buildmanager/t2650_4/A.scala deleted file mode 100644 index b9a519eb48..0000000000 --- a/test/files/buildmanager/t2650_4/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -trait A { - type T = Int - type T2 = T - def x: T2 -} diff --git a/test/files/buildmanager/t2650_4/B.scala b/test/files/buildmanager/t2650_4/B.scala deleted file mode 100644 index 46a8cf270a..0000000000 --- a/test/files/buildmanager/t2650_4/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -object B { - def x(a: A): Int = a.x -} diff --git a/test/files/buildmanager/t2650_4/t2650_4.changes/A2.scala b/test/files/buildmanager/t2650_4/t2650_4.changes/A2.scala deleted file mode 100644 index 0220e7b7bc..0000000000 --- a/test/files/buildmanager/t2650_4/t2650_4.changes/A2.scala +++ /dev/null @@ -1,5 +0,0 @@ -trait A { - type T = Long - type T2 = T - def x: T2 -} diff --git a/test/files/buildmanager/t2650_4/t2650_4.check b/test/files/buildmanager/t2650_4/t2650_4.check deleted file mode 100644 index a4aeaddfbb..0000000000 --- a/test/files/buildmanager/t2650_4/t2650_4.check +++ /dev/null @@ -1,14 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(trait A -> List(Changed(Definition(A.T))[type T changed from A.this.T to A.this.T flags: ])) -invalidate B.scala because it references changed definition [Changed(Definition(A.T))[type T changed from A.this.T to A.this.T flags: ]] -compiling Set(B.scala) -B.scala:2: error: type mismatch; - found : a.T2 - (which expands to) Long - required: Int - def x(a: A): Int = a.x - ^ diff --git a/test/files/buildmanager/t2650_4/t2650_4.test b/test/files/buildmanager/t2650_4/t2650_4.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2650_4/t2650_4.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2651_2/A.scala b/test/files/buildmanager/t2651_2/A.scala deleted file mode 100644 index d712f6febe..0000000000 --- a/test/files/buildmanager/t2651_2/A.scala +++ /dev/null @@ -1 +0,0 @@ -trait A[T] diff --git a/test/files/buildmanager/t2651_2/t2651_2.changes/A2.scala b/test/files/buildmanager/t2651_2/t2651_2.changes/A2.scala deleted file mode 100644 index 7fb573e077..0000000000 --- a/test/files/buildmanager/t2651_2/t2651_2.changes/A2.scala +++ /dev/null @@ -1 +0,0 @@ -trait A[S] diff --git a/test/files/buildmanager/t2651_2/t2651_2.check b/test/files/buildmanager/t2651_2/t2651_2.check deleted file mode 100644 index dd789b7565..0000000000 --- a/test/files/buildmanager/t2651_2/t2651_2.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala -compiling Set(A.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(trait A -> List()) diff --git a/test/files/buildmanager/t2651_2/t2651_2.test b/test/files/buildmanager/t2651_2/t2651_2.test deleted file mode 100644 index d0614473ce..0000000000 --- a/test/files/buildmanager/t2651_2/t2651_2.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2651_3/A.scala b/test/files/buildmanager/t2651_3/A.scala deleted file mode 100644 index 14f9e4662f..0000000000 --- a/test/files/buildmanager/t2651_3/A.scala +++ /dev/null @@ -1,3 +0,0 @@ -trait A[T, S] { - def x: T -} diff --git a/test/files/buildmanager/t2651_3/t2651_3.changes/A2.scala b/test/files/buildmanager/t2651_3/t2651_3.changes/A2.scala deleted file mode 100644 index 51bf27d1fa..0000000000 --- a/test/files/buildmanager/t2651_3/t2651_3.changes/A2.scala +++ /dev/null @@ -1,3 +0,0 @@ -trait A[T, S] { - def x: S -} diff --git a/test/files/buildmanager/t2651_3/t2651_3.check b/test/files/buildmanager/t2651_3/t2651_3.check deleted file mode 100644 index 2a60e3d806..0000000000 --- a/test/files/buildmanager/t2651_3/t2651_3.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala -compiling Set(A.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(trait A -> List(Changed(Definition(A.x))[method x changed from ()T to ()S flags: <method> <deferred>])) diff --git a/test/files/buildmanager/t2651_3/t2651_3.test b/test/files/buildmanager/t2651_3/t2651_3.test deleted file mode 100644 index d0614473ce..0000000000 --- a/test/files/buildmanager/t2651_3/t2651_3.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2651_4/A.scala b/test/files/buildmanager/t2651_4/A.scala deleted file mode 100644 index 63f2a1643e..0000000000 --- a/test/files/buildmanager/t2651_4/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -trait A[T, S] { - def x: T - def y(a: T) - def z[B <: T] -} diff --git a/test/files/buildmanager/t2651_4/B.scala b/test/files/buildmanager/t2651_4/B.scala deleted file mode 100644 index b33dbde676..0000000000 --- a/test/files/buildmanager/t2651_4/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -trait B extends A[Int, String] { - def x = 3 -} diff --git a/test/files/buildmanager/t2651_4/t2651_4.changes/A2.scala b/test/files/buildmanager/t2651_4/t2651_4.changes/A2.scala deleted file mode 100644 index f155129d13..0000000000 --- a/test/files/buildmanager/t2651_4/t2651_4.changes/A2.scala +++ /dev/null @@ -1,5 +0,0 @@ -trait A[S, T] { - def x: T - def y(a: T) - def z[B <: T] -} diff --git a/test/files/buildmanager/t2651_4/t2651_4.check b/test/files/buildmanager/t2651_4/t2651_4.check deleted file mode 100644 index 74e5d8f99b..0000000000 --- a/test/files/buildmanager/t2651_4/t2651_4.check +++ /dev/null @@ -1,13 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(trait A -> List(Changed(Definition(A.x))[method x changed from ()T to ()T flags: <method> <deferred> <triedcooking>], Changed(Definition(A.y))[method y changed from (a: T)Unit to (a: T)Unit flags: <method> <deferred>], Changed(Definition(A.z))[method z changed from [B <: T]()Unit to [B <: T]()Unit flags: <method> <deferred>])) -invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from ()T to ()T flags: <method> <deferred> <triedcooking>]] -compiling Set(B.scala) -B.scala:2: error: type mismatch; - found : Int(3) - required: String - def x = 3 - ^ diff --git a/test/files/buildmanager/t2651_4/t2651_4.test b/test/files/buildmanager/t2651_4/t2651_4.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2651_4/t2651_4.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2653/A.scala b/test/files/buildmanager/t2653/A.scala deleted file mode 100644 index fb17a158c7..0000000000 --- a/test/files/buildmanager/t2653/A.scala +++ /dev/null @@ -1,2 +0,0 @@ -class A[+T] - diff --git a/test/files/buildmanager/t2653/B.scala b/test/files/buildmanager/t2653/B.scala deleted file mode 100644 index 8f55a88e05..0000000000 --- a/test/files/buildmanager/t2653/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -object B { - val a: A[Any] = new A[Int] -} diff --git a/test/files/buildmanager/t2653/t2653.changes/A2.scala b/test/files/buildmanager/t2653/t2653.changes/A2.scala deleted file mode 100644 index 51d13cce6e..0000000000 --- a/test/files/buildmanager/t2653/t2653.changes/A2.scala +++ /dev/null @@ -1,2 +0,0 @@ -class A[T] - diff --git a/test/files/buildmanager/t2653/t2653.check b/test/files/buildmanager/t2653/t2653.check deleted file mode 100644 index 36781522af..0000000000 --- a/test/files/buildmanager/t2653/t2653.check +++ /dev/null @@ -1,15 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(Changed(Class(A))[ tparams: List((type T,type T))], Changed(Definition(A.<init>))[constructor A changed from ()A[T] to ()A[T] flags: <method> <triedcooking>])) -invalidate B.scala because it references changed class [Changed(Class(A))[ tparams: List((type T,type T))]] -compiling Set(B.scala) -B.scala:2: error: type mismatch; - found : A[Int] - required: A[Any] -Note: Int <: Any, but class A is invariant in type T. -You may wish to define T as +T instead. (SLS 4.5) - val a: A[Any] = new A[Int] - ^ diff --git a/test/files/buildmanager/t2653/t2653.test b/test/files/buildmanager/t2653/t2653.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2653/t2653.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2654/A.scala b/test/files/buildmanager/t2654/A.scala deleted file mode 100644 index 75f396d039..0000000000 --- a/test/files/buildmanager/t2654/A.scala +++ /dev/null @@ -1,2 +0,0 @@ -class A - diff --git a/test/files/buildmanager/t2654/B.scala b/test/files/buildmanager/t2654/B.scala deleted file mode 100644 index a18aec3dbe..0000000000 --- a/test/files/buildmanager/t2654/B.scala +++ /dev/null @@ -1 +0,0 @@ -class B extends A diff --git a/test/files/buildmanager/t2654/t2654.changes/A2.scala b/test/files/buildmanager/t2654/t2654.changes/A2.scala deleted file mode 100644 index c302edbd85..0000000000 --- a/test/files/buildmanager/t2654/t2654.changes/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A { - private def x = 5 -} - diff --git a/test/files/buildmanager/t2654/t2654.check b/test/files/buildmanager/t2654/t2654.check deleted file mode 100644 index 68f6e8efc0..0000000000 --- a/test/files/buildmanager/t2654/t2654.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List()) diff --git a/test/files/buildmanager/t2654/t2654.test b/test/files/buildmanager/t2654/t2654.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2654/t2654.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2655/A.scala b/test/files/buildmanager/t2655/A.scala deleted file mode 100644 index b2c54ac47d..0000000000 --- a/test/files/buildmanager/t2655/A.scala +++ /dev/null @@ -1,4 +0,0 @@ -object A { - def x(i: => String) = () -} - diff --git a/test/files/buildmanager/t2655/B.scala b/test/files/buildmanager/t2655/B.scala deleted file mode 100644 index 6c1918c0fb..0000000000 --- a/test/files/buildmanager/t2655/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -object B { - val x = A.x("3") -} diff --git a/test/files/buildmanager/t2655/t2655.changes/A2.scala b/test/files/buildmanager/t2655/t2655.changes/A2.scala deleted file mode 100644 index 0d6a7c69bb..0000000000 --- a/test/files/buildmanager/t2655/t2655.changes/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object A { - def x(i: Function0[String]) = () -} - diff --git a/test/files/buildmanager/t2655/t2655.check b/test/files/buildmanager/t2655/t2655.check deleted file mode 100644 index 41ce65a2f5..0000000000 --- a/test/files/buildmanager/t2655/t2655.check +++ /dev/null @@ -1,13 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(object A -> List(Changed(Definition(A.x))[method x changed from (i: Function0)Unit to (i: Function0)Unit flags: <method> <triedcooking>])) -invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from (i: Function0)Unit to (i: Function0)Unit flags: <method> <triedcooking>]] -compiling Set(B.scala) -B.scala:2: error: type mismatch; - found : String("3") - required: () => String - val x = A.x("3") - ^ diff --git a/test/files/buildmanager/t2655/t2655.test b/test/files/buildmanager/t2655/t2655.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2655/t2655.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2657/A.scala b/test/files/buildmanager/t2657/A.scala deleted file mode 100644 index 2a6c62d29c..0000000000 --- a/test/files/buildmanager/t2657/A.scala +++ /dev/null @@ -1,3 +0,0 @@ -class A { - implicit def y(i: Int): String = i.toString -} diff --git a/test/files/buildmanager/t2657/B.scala b/test/files/buildmanager/t2657/B.scala deleted file mode 100644 index 77869890db..0000000000 --- a/test/files/buildmanager/t2657/B.scala +++ /dev/null @@ -1,4 +0,0 @@ -object B extends A { - val x: String = 3 -} - diff --git a/test/files/buildmanager/t2657/t2657.changes/A2.scala b/test/files/buildmanager/t2657/t2657.changes/A2.scala deleted file mode 100644 index 7dc99d425e..0000000000 --- a/test/files/buildmanager/t2657/t2657.changes/A2.scala +++ /dev/null @@ -1,3 +0,0 @@ -class A { - def y(i: Int): String = i.toString -} diff --git a/test/files/buildmanager/t2657/t2657.check b/test/files/buildmanager/t2657/t2657.check deleted file mode 100644 index 0d6709e58b..0000000000 --- a/test/files/buildmanager/t2657/t2657.check +++ /dev/null @@ -1,14 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -warning: there were 1 feature warnings; re-run with -feature for details -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(Changed(Definition(A.y))[method y changed from (i: Int)String to (i: Int)String flags: <method> implicit <triedcooking>])) -invalidate B.scala because inherited method changed [Changed(Definition(A.y))[method y changed from (i: Int)String to (i: Int)String flags: <method> implicit <triedcooking>]] -compiling Set(B.scala) -B.scala:2: error: type mismatch; - found : Int(3) - required: String - val x: String = 3 - ^ diff --git a/test/files/buildmanager/t2657/t2657.test b/test/files/buildmanager/t2657/t2657.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2657/t2657.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2789/A.scala b/test/files/buildmanager/t2789/A.scala deleted file mode 100644 index 08d5bc840c..0000000000 --- a/test/files/buildmanager/t2789/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -class A { - implicit def e: E = new E - def x(i: Int)(implicit y: E): String = "" -} -class E diff --git a/test/files/buildmanager/t2789/B.scala b/test/files/buildmanager/t2789/B.scala deleted file mode 100644 index dcefbeec1b..0000000000 --- a/test/files/buildmanager/t2789/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -object B extends A { - val y = x(3) -} diff --git a/test/files/buildmanager/t2789/t2789.changes/A2.scala b/test/files/buildmanager/t2789/t2789.changes/A2.scala deleted file mode 100644 index 4ba3814e71..0000000000 --- a/test/files/buildmanager/t2789/t2789.changes/A2.scala +++ /dev/null @@ -1,5 +0,0 @@ -class A { - def e: E = new E - def x(i: Int)(implicit y: E): String = "" -} -class E diff --git a/test/files/buildmanager/t2789/t2789.check b/test/files/buildmanager/t2789/t2789.check deleted file mode 100644 index 066561ac44..0000000000 --- a/test/files/buildmanager/t2789/t2789.check +++ /dev/null @@ -1,11 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(Changed(Definition(A.e))[method e changed from ()E to ()E flags: <method> implicit <triedcooking>]), class E -> List()) -invalidate B.scala because inherited method changed [Changed(Definition(A.e))[method e changed from ()E to ()E flags: <method> implicit <triedcooking>]] -compiling Set(B.scala) -B.scala:2: error: could not find implicit value for parameter y: E - val y = x(3) - ^ diff --git a/test/files/buildmanager/t2789/t2789.test b/test/files/buildmanager/t2789/t2789.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2789/t2789.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2790/A.scala b/test/files/buildmanager/t2790/A.scala deleted file mode 100644 index 6e9c1a90db..0000000000 --- a/test/files/buildmanager/t2790/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -object A { - def x(f: String, g: Int): Int = g - def x(f: Int, g: Int = 3): Int = g -} - diff --git a/test/files/buildmanager/t2790/B.scala b/test/files/buildmanager/t2790/B.scala deleted file mode 100644 index 441055ca12..0000000000 --- a/test/files/buildmanager/t2790/B.scala +++ /dev/null @@ -1,4 +0,0 @@ -object B { - val y = A.x(5) -} - diff --git a/test/files/buildmanager/t2790/t2790.changes/A2.scala b/test/files/buildmanager/t2790/t2790.changes/A2.scala deleted file mode 100644 index 704ef4e96e..0000000000 --- a/test/files/buildmanager/t2790/t2790.changes/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object A { - def x(f: String, g: Int = 3): Int = g - def x(f: Int, g: Int): Int = g -} diff --git a/test/files/buildmanager/t2790/t2790.check b/test/files/buildmanager/t2790/t2790.check deleted file mode 100644 index 13d61dac42..0000000000 --- a/test/files/buildmanager/t2790/t2790.check +++ /dev/null @@ -1,13 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(object A -> List(Added(Definition(A.x)), Changed(Definition(A.x))[value x changed from (f: String, g: Int)Int to (f: String, g: Int)Int <and> (f: Int, g: Int)Int flags: <method>])) -invalidate B.scala because it references changed definition [Changed(Definition(A.x))[value x changed from (f: String, g: Int)Int to (f: String, g: Int)Int <and> (f: Int, g: Int)Int flags: <method>]] -compiling Set(B.scala) -B.scala:2: error: type mismatch; - found : Int(5) - required: String - val y = A.x(5) - ^ diff --git a/test/files/buildmanager/t2790/t2790.test b/test/files/buildmanager/t2790/t2790.test deleted file mode 100644 index 6f3bd03361..0000000000 --- a/test/files/buildmanager/t2790/t2790.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A.scala B.scala ->>update A.scala=>A2.scala ->>compile A.scala diff --git a/test/files/buildmanager/t2792/A1.scala b/test/files/buildmanager/t2792/A1.scala deleted file mode 100644 index 96dc0ef933..0000000000 --- a/test/files/buildmanager/t2792/A1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object A { - val x = new C -} diff --git a/test/files/buildmanager/t2792/A2.scala b/test/files/buildmanager/t2792/A2.scala deleted file mode 100644 index e55e681c76..0000000000 --- a/test/files/buildmanager/t2792/A2.scala +++ /dev/null @@ -1,4 +0,0 @@ -object B { - import A.x.y - val z = y -} diff --git a/test/files/buildmanager/t2792/A3.scala b/test/files/buildmanager/t2792/A3.scala deleted file mode 100644 index cd083cdb34..0000000000 --- a/test/files/buildmanager/t2792/A3.scala +++ /dev/null @@ -1,3 +0,0 @@ -class C { - val y = 4 -} diff --git a/test/files/buildmanager/t2792/t2792.changes/A1_1.scala b/test/files/buildmanager/t2792/t2792.changes/A1_1.scala deleted file mode 100644 index 00ee05f273..0000000000 --- a/test/files/buildmanager/t2792/t2792.changes/A1_1.scala +++ /dev/null @@ -1,3 +0,0 @@ -object A { - var x = new C -} diff --git a/test/files/buildmanager/t2792/t2792.check b/test/files/buildmanager/t2792/t2792.check deleted file mode 100644 index 00a2b83469..0000000000 --- a/test/files/buildmanager/t2792/t2792.check +++ /dev/null @@ -1,14 +0,0 @@ -builder > A1.scala A2.scala A3.scala -compiling Set(A1.scala, A2.scala, A3.scala) -Changes: Map() -builder > A1.scala -compiling Set(A1.scala) -Changes: Map(object A -> List(Added(Definition(A.x_$eq)), Changed(Definition(A.x))[value x changed to variable x])) -invalidate A2.scala because it references changed definition [Changed(Definition(A.x))[value x changed to variable x]] -compiling Set(A2.scala) -A2.scala:2: error: stable identifier required, but A.x found. - import A.x.y - ^ -A2.scala:3: error: not found: value y - val z = y - ^ diff --git a/test/files/buildmanager/t2792/t2792.test b/test/files/buildmanager/t2792/t2792.test deleted file mode 100644 index f199950bba..0000000000 --- a/test/files/buildmanager/t2792/t2792.test +++ /dev/null @@ -1,3 +0,0 @@ ->>compile A1.scala A2.scala A3.scala ->>update A1.scala=>A1_1.scala ->>compile A1.scala diff --git a/test/files/buildmanager/t3045/A.java b/test/files/buildmanager/t3045/A.java deleted file mode 100644 index d1acb00cd6..0000000000 --- a/test/files/buildmanager/t3045/A.java +++ /dev/null @@ -1,7 +0,0 @@ -public interface A { - public class C implements A {} -} - -class B { - static class C {} -} diff --git a/test/files/buildmanager/t3045/t3045.check b/test/files/buildmanager/t3045/t3045.check deleted file mode 100644 index 5e4e71e045..0000000000 --- a/test/files/buildmanager/t3045/t3045.check +++ /dev/null @@ -1,3 +0,0 @@ -builder > A.java -compiling Set(A.java) -Changes: Map() diff --git a/test/files/buildmanager/t3045/t3045.test b/test/files/buildmanager/t3045/t3045.test deleted file mode 100644 index 6cf7e35543..0000000000 --- a/test/files/buildmanager/t3045/t3045.test +++ /dev/null @@ -1 +0,0 @@ ->>compile A.java diff --git a/test/files/buildmanager/t3054/bar/Bar.java b/test/files/buildmanager/t3054/bar/Bar.java deleted file mode 100644 index e1b056d4e5..0000000000 --- a/test/files/buildmanager/t3054/bar/Bar.java +++ /dev/null @@ -1,7 +0,0 @@ -package bar; -import foo.Foo$; - - -public class Bar { - void bar() { Foo$.MODULE$.foo(); } -} diff --git a/test/files/buildmanager/t3054/foo/Foo.scala b/test/files/buildmanager/t3054/foo/Foo.scala deleted file mode 100644 index c0fcd97390..0000000000 --- a/test/files/buildmanager/t3054/foo/Foo.scala +++ /dev/null @@ -1,5 +0,0 @@ -package foo - -class Foo { - def foo() = println("foo") -} diff --git a/test/files/buildmanager/t3054/t3054.check b/test/files/buildmanager/t3054/t3054.check deleted file mode 100644 index 97cca8862e..0000000000 --- a/test/files/buildmanager/t3054/t3054.check +++ /dev/null @@ -1,3 +0,0 @@ -builder > bar/Bar.java foo/Foo.scala -compiling Set(bar/Bar.java, foo/Foo.scala) -Changes: Map() diff --git a/test/files/buildmanager/t3054/t3054.test b/test/files/buildmanager/t3054/t3054.test deleted file mode 100644 index 903df24b13..0000000000 --- a/test/files/buildmanager/t3054/t3054.test +++ /dev/null @@ -1 +0,0 @@ ->>compile bar/Bar.java foo/Foo.scala diff --git a/test/files/buildmanager/t3059/A.scala b/test/files/buildmanager/t3059/A.scala deleted file mode 100644 index 0dd25f6647..0000000000 --- a/test/files/buildmanager/t3059/A.scala +++ /dev/null @@ -1,4 +0,0 @@ -class A extends B { - private def getBar = List(1,2,3) - lazy val bar: List[Int] = getBar -} diff --git a/test/files/buildmanager/t3059/B.scala b/test/files/buildmanager/t3059/B.scala deleted file mode 100644 index 46596870ac..0000000000 --- a/test/files/buildmanager/t3059/B.scala +++ /dev/null @@ -1,4 +0,0 @@ -abstract class B { - private def getFoo = 12 - lazy val foo: Int = getFoo -} diff --git a/test/files/buildmanager/t3059/t3059.check b/test/files/buildmanager/t3059/t3059.check deleted file mode 100644 index 4a8076aae1..0000000000 --- a/test/files/buildmanager/t3059/t3059.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala B.scala -compiling Set(A.scala, B.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List())
\ No newline at end of file diff --git a/test/files/buildmanager/t3059/t3059.test b/test/files/buildmanager/t3059/t3059.test deleted file mode 100644 index 6f3749dc4b..0000000000 --- a/test/files/buildmanager/t3059/t3059.test +++ /dev/null @@ -1,2 +0,0 @@ ->>compile A.scala B.scala ->>compile A.scala
\ No newline at end of file diff --git a/test/files/buildmanager/t3133/A.java b/test/files/buildmanager/t3133/A.java deleted file mode 100644 index c4e7f3af0e..0000000000 --- a/test/files/buildmanager/t3133/A.java +++ /dev/null @@ -1,7 +0,0 @@ -public class A { - class Foo {} - - public A(Foo a) {} - - private void bar(Foo z) {} -} diff --git a/test/files/buildmanager/t3133/t3133.check b/test/files/buildmanager/t3133/t3133.check deleted file mode 100644 index 5e4e71e045..0000000000 --- a/test/files/buildmanager/t3133/t3133.check +++ /dev/null @@ -1,3 +0,0 @@ -builder > A.java -compiling Set(A.java) -Changes: Map() diff --git a/test/files/buildmanager/t3133/t3133.test b/test/files/buildmanager/t3133/t3133.test deleted file mode 100644 index 6cf7e35543..0000000000 --- a/test/files/buildmanager/t3133/t3133.test +++ /dev/null @@ -1 +0,0 @@ ->>compile A.java diff --git a/test/files/buildmanager/t3140/A.scala b/test/files/buildmanager/t3140/A.scala deleted file mode 100644 index f7768044d1..0000000000 --- a/test/files/buildmanager/t3140/A.scala +++ /dev/null @@ -1,8 +0,0 @@ -class As { - trait A { - def foo(parents: String): A = { - (() => parents) - null - } - } -} diff --git a/test/files/buildmanager/t3140/t3140.check b/test/files/buildmanager/t3140/t3140.check deleted file mode 100644 index 008d5a9618..0000000000 --- a/test/files/buildmanager/t3140/t3140.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala -compiling Set(A.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class As -> List(), object As$A$class -> List(), trait As$A -> List()) diff --git a/test/files/buildmanager/t3140/t3140.test b/test/files/buildmanager/t3140/t3140.test deleted file mode 100644 index 392e0d365f..0000000000 --- a/test/files/buildmanager/t3140/t3140.test +++ /dev/null @@ -1,2 +0,0 @@ ->>compile A.scala ->>compile A.scala diff --git a/test/files/buildmanager/t4215/A.scala b/test/files/buildmanager/t4215/A.scala deleted file mode 100644 index 9db40b0fee..0000000000 --- a/test/files/buildmanager/t4215/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -class A { - def B() { - object C - } -} diff --git a/test/files/buildmanager/t4215/t4215.check b/test/files/buildmanager/t4215/t4215.check deleted file mode 100644 index d9ec9a743a..0000000000 --- a/test/files/buildmanager/t4215/t4215.check +++ /dev/null @@ -1,6 +0,0 @@ -builder > A.scala -compiling Set(A.scala) -Changes: Map() -builder > A.scala -compiling Set(A.scala) -Changes: Map(class A -> List(), object A$C$2 -> List()) diff --git a/test/files/buildmanager/t4215/t4215.test b/test/files/buildmanager/t4215/t4215.test deleted file mode 100644 index 392e0d365f..0000000000 --- a/test/files/buildmanager/t4215/t4215.test +++ /dev/null @@ -1,2 +0,0 @@ ->>compile A.scala ->>compile A.scala diff --git a/test/files/continuations-run/implicit-infer-annotations.check b/test/files/continuations-run/implicit-infer-annotations.check new file mode 100644 index 0000000000..e8206c4319 --- /dev/null +++ b/test/files/continuations-run/implicit-infer-annotations.check @@ -0,0 +1,5 @@ +Range(5, 6, 7, 8, 9, 10) +Range(5, 6, 7, 8, 9, 10) +15 +List(10, 1, 2, 3) +Range(5, 6, 7, 8, 9, 10) diff --git a/test/files/continuations-run/implicit-infer-annotations.scala b/test/files/continuations-run/implicit-infer-annotations.scala new file mode 100644 index 0000000000..3f0e959f60 --- /dev/null +++ b/test/files/continuations-run/implicit-infer-annotations.scala @@ -0,0 +1,59 @@ +import annotation._ + +object A { + class foo[-B,+C] extends StaticAnnotation with TypeConstraint + + def shift[A, B, C](fun: (A => B) => C): A @foo[B, C] = ??? + def reset[A, C](ctx: => (A @foo[A, C])): C = ??? + + def m1 = reset { shift { f: (Int => Range) => f(5) }.to(10) } +} + +object B { + import scala.util.continuations._ + + def m1 = reset { shift { f: (Int => Range) => f(5) }.to(10) } + def m2 = reset { val a = shift { f: (Int => Range) => f(5) } ; a.to(10) } + + val x1 = reset{ + shift{ cont: (Int => Range) => + cont(5) + }.to(10) + } + + val x2 = reset{ + val a = shift{ cont: (Int => Range) => + cont(5) + } + a.to(10) + } // x is now Range(5, 6, 7, 8, 9, 10) + + val x3 = reset{ + shift{ cont: (Int => Int) => + cont(5) + } + 10 + } // x is now 15 + + val x4 = reset{ + 10 :: shift{ cont: (List[Int] => List[Int]) => + cont(List(1, 2, 3)) + } + } // x is List(10, 1, 2, 3) + + val x5 = reset{ + new scala.runtime.RichInt(shift{ cont: (Int => Range) => + cont(5) + }) to 10 + } +} + +object Test { + def main(args: Array[String]): Unit = { + import B._ + println(x1) + println(x2) + println(x3) + println(x4) + println(x5) + } +} diff --git a/test/files/detach-neg/det_bar.check b/test/files/detach-neg/det_bar.check deleted file mode 100644 index 70b47581a5..0000000000 --- a/test/files/detach-neg/det_bar.check +++ /dev/null @@ -1,4 +0,0 @@ -det_bar.scala:7: error: detach inapplicable for method bar - detach(bar) - ^ -one error found diff --git a/test/files/detach-neg/det_bar.scala b/test/files/detach-neg/det_bar.scala deleted file mode 100644 index 862afb1d6e..0000000000 --- a/test/files/detach-neg/det_bar.scala +++ /dev/null @@ -1,13 +0,0 @@ -import scala.remoting._ -class A(y: Int) { - var z = 2 - var bar = (x: Int) => x + y + z - def foo(x: Int): Int = x + y + z - bar = (x: Int) => x * y - detach(bar) -} - -object test extends App { - val a = new A(1) - println(a.bar(2)) -} diff --git a/test/files/detach-run/actor-run.check b/test/files/detach-run/actor-run.check deleted file mode 100644 index 9448ddd5fe..0000000000 --- a/test/files/detach-run/actor-run.check +++ /dev/null @@ -1,5 +0,0 @@ -Server.main 8889 -Client.main 127.0.0.1 8889 -yInstVal = 10 -zLocVal = 1000 -result received: 11111 diff --git a/test/files/detach-run/actor/Client.scala b/test/files/detach-run/actor/Client.scala deleted file mode 100644 index 12573e24d3..0000000000 --- a/test/files/detach-run/actor/Client.scala +++ /dev/null @@ -1,54 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import scala.actors.Actor._, ClientHelper._ -import scala.actors.remote._, RemoteActor._ -import scala.remoting._, Debug._ - -object Foo { - def trace(msg: String) { info("[Foo.trace] "+msg)} -} -object Client { - val yInstVal: Int = 10 - var yInstVar: Int = 99 - object Bar { - def trace(msg: String) { info("[Bar.trace] "+msg) } - } - def main(args: Array[String]) { - init(args) - actor { - val server = select(Node(host, port), 'Server) - val zLocVal: Int = 1000 - var zLocVar: Int = 9998 - server ! detach( - (x: Int) => { - println("yInstVal = "+yInstVal) - this.trace("yInstVar = "+yInstVar) - Bar.trace("zLocVal = "+zLocVal) - Foo.trace("zLocVar = "+zLocVar) - zLocVar += 2 - System.out.println("zLocVal = "+zLocVal) - Debug.info("zLocVar = "+zLocVar) - x + yInstVal + yInstVar + zLocVal + zLocVar - }) - react { - case result: Int => - println("result received: " + result) - Predef.exit(0) - } - } - } - private def trace(msg: String) { info("[Client.trace] "+msg) } -} - -object ClientHelper { - private var _host = "127.0.0.1" - private var _port = 8888 - def host = _host - def port = _port - def init(args: Array[String]) { - try { _host = args(0) } catch { case _ => } - try { _port = args(1).toInt } catch { case _ => } - } -} diff --git a/test/files/detach-run/actor/Server.scala b/test/files/detach-run/actor/Server.scala deleted file mode 100644 index b56d22f744..0000000000 --- a/test/files/detach-run/actor/Server.scala +++ /dev/null @@ -1,27 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import scala.actors.Actor._ -import scala.actors.remote.RemoteActor._ - -object Server extends ServerConsole { - private def computation(f: Int => Int): Int = { - //some time-consuming task - f(2) - } - def main(args: Array[String]) { - actor { - classLoader = serverClassLoader - alive(args(0).toInt) - register('Server, self) - loopWhile(isRunning) { - react { - case f: (Int => Int) => - val result = computation(f) - sender ! result - } - } - } - } -} diff --git a/test/files/detach-run/actor/ServerConsole.scala b/test/files/detach-run/actor/ServerConsole.scala deleted file mode 100644 index 8ebd9d4c2e..0000000000 --- a/test/files/detach-run/actor/ServerConsole.scala +++ /dev/null @@ -1,75 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import java.io.{BufferedReader, InputStreamReader} - -import scala.compat.Platform.currentTime -import scala.remoting.Debug, Debug._ - -trait ServerConsole extends Thread { - private val startTime = currentTime - actors.Debug.level = // e.g. 3 // info+warning+error - try { System.getProperty("scala.actors.logLevel", "0").toInt } - catch { case e => 0 } - - start() - - val serverClassLoader = { - import java.rmi.server.RMIClassLoader - val codebase = System.getProperty("java.rmi.server.codebase") - info("[ServerConsole] codebase="+codebase) - RMIClassLoader getClassLoader codebase - } - - private var isTerminated = false - - def terminate() { isTerminated = false } - - def isRunning = !isTerminated - - override def run() { - val in = new BufferedReader(new InputStreamReader(System.in)) - var quit = false - while (!quit) { - val args = getArgs(in) - if (args contains "quit") - quit = true - if (args contains "cls") { - println(ERASE_SCREEN) - println(CURSOR_HOME) - } - if (args contains "warning") - Debug.level = Level.WARNING - if (args contains "info") - Debug.level = Level.INFO - if (args contains "silent") - Debug.level = Level.SILENT - } - terminate() - println("Server exited ("+mkTimeString(currentTime - startTime)+")") - sys.exit(0) - } - - protected def trace(msg: String) { - Debug.info("[ServerConsole.trace] "+msg) - } - - private def getArgs(in: BufferedReader): List[String] = { - val input = try { in.readLine() } catch { case _ => null } - if (input != null) (input.trim split "\\s+").toList else Nil - } - - private def mkTimeString(time: Long): String = { - def twoDigits(i: Long) = (if (i < 10) "0" else "")+i - val sec = time / 1000 - val min = sec / 60 - val h = min / 60 - twoDigits(h) +":"+ - twoDigits(min - h * 60)+":"+ - twoDigits(sec - min * 60) - } - - private val ERASE_SCREEN = "\033[2J" - private val CURSOR_HOME = "\033[H" -} diff --git a/test/files/detach-run/actor/actor.flags b/test/files/detach-run/actor/actor.flags deleted file mode 100644 index 55eed8bbcd..0000000000 --- a/test/files/detach-run/actor/actor.flags +++ /dev/null @@ -1 +0,0 @@ --Xpluginsdir ../../../../build/pack/misc/scala-devel/plugins -Xplugin-require:detach -P:detach:enable diff --git a/test/files/detach-run/actor/actor.scala b/test/files/detach-run/actor/actor.scala deleted file mode 100644 index 23a10d6982..0000000000 --- a/test/files/detach-run/actor/actor.scala +++ /dev/null @@ -1,157 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -object Test { - - val name = "actor" - val host = "127.0.0.1" - val port = 8889 - - def main(args: Array[String]) { - setenv() - println("Server.main "+port) - Server.main(Array(port.toString)) - println("Client.main "+host+" "+port) - Client.main(Array(host, port.toString)) - Server.terminate() - } - - private def setenv() { - import Env._ - - // Java properties for server & client - System.setProperty("scala.actors.logLevel", actors_logLevel) - System.setProperty("scala.remoting.logLevel", logLevel) - System.setProperty("java.security.manager", "") - System.setProperty("java.security.policy", policyFile) - // Java properties for server only - System.setProperty("java.rmi.server.codebase", deployUrl) - System.setProperty("java.rmi.server.hostname", host) - System.setProperty("java.rmi.server.useCodebaseOnly", "true") - - // application-specific classes to be deployed and accessed via URL - // (i.e. detached closure, proxy interfaces and proxy stubs) - val classNames = List( - "$anonfun$main$1$proxy", - "$anonfun$main$1$proxyImpl_Stub", - "Bar$proxy", - "Bar$proxyImpl_Stub", - "Client$$anonfun$main$1$$anonfun$apply$1$detach", - "Client$proxy", - "Client$proxyImpl_Stub", - "Foo$proxy", - "Foo$proxyImpl_Stub") - - val proxyImplNames = - for (n <- classNames; i = n lastIndexOf "_Stub"; if i > 0) - yield n.substring(0, i) - - generatePolicyFile() - generateRmiStubs(proxyImplNames) - generateJarFile(classNames) - } -} - -object Env { - import java.io._, java.util.jar._ - - val actors_logLevel = "0" - // = "3" // info+warning+error - val logLevel = "silent" - // = "info" // debug user code only - // = "info,lib" // debug user & library code - - // we assume an Apache server is running locally for deployment - private val sep = File.separator - val docPath = System.getProperty("user.home")+sep+"public_html" - val docRoot = "http://127.0.0.1/~"+System.getProperty("user.name") - - private val policyTmpl = - System.getProperty("partest.cwd")+sep+Test.name+sep+"java.policy" - val outPath = System.getProperty("partest.output") - val libPath = System.getProperty("partest.lib") - val policyFile = outPath+sep+"java.policy" - val codebaseDir = outPath+sep+"-" - - assert((new File(docPath)).isDirectory, - "Root directory \""+docPath+"\" not found") - val deployJar = docPath+sep+Test.name+"_deploy.jar" - val deployUrl = docRoot+"/"+Test.name+"_deploy.jar" - - def generatePolicyFile() { - val in = new BufferedReader(new FileReader(policyTmpl)) - val out = new PrintWriter(new BufferedWriter(new FileWriter(policyFile))) - var line = in.readLine() - while (line != null) { - val line1 = line.replaceAll("@PROJECT_LIB_BASE@", codebaseDir) - out.println(line1) - line = in.readLine() - } - in.close() - out.close() - } - - def generateRmiStubs(classNames: List[String]) { - val options = List( - "-v1.2", - "-classpath "+libPath+File.pathSeparator+outPath, - "-d "+outPath) - rmic(options, classNames) - //ls(outPath) - } - - def generateJarFile(classNames: List[String]) { - val out = new JarOutputStream(new FileOutputStream(deployJar)) - classNames foreach (name => try { - val classFile = name+".class" - val in = new FileInputStream(outPath+sep+classFile) - out putNextEntry new JarEntry(classFile) - val buf = new Array[Byte](512) - var len = in read buf - while (len != -1) { - out.write(buf, 0, len) - len = in read buf - } - in.close() - } catch { - case e: FileNotFoundException => println(e) - }) - out.close() - } - - private def ls(path: String) { exec("ls -al "+path) } - - private def rmic(options: List[String], classNames: List[String]) { - val javaHome = scala.util.Properties.javaHome - val jdkHome = - if (javaHome endsWith "jre") javaHome.substring(0, javaHome.length-4) - else javaHome - val rmicExt = if (scala.util.Properties.isWin) ".exe" else "" - val rmicCmd = jdkHome+sep+"bin"+sep+"rmic"+rmicExt - val cmdLine = rmicCmd+options.mkString(" ", " ", "")+ - classNames.mkString(" "," ","") - // println(cmdLine) - exec(cmdLine) - } - - private def exec(command: String) { - val proc = Runtime.getRuntime exec command - proc.waitFor() - val out = new BufferedReader(new InputStreamReader(proc.getInputStream)) - var line = out.readLine() - while (line != null) { - println(line) - line = out.readLine() - } - out.close() - val err = new BufferedReader(new InputStreamReader(proc.getErrorStream)) - line = err.readLine() - while (line != null) { - println(line) - line = err.readLine() - } - err.close() - } -} - diff --git a/test/files/detach-run/actor/java.policy b/test/files/detach-run/actor/java.policy deleted file mode 100644 index 4beb2ca26b..0000000000 --- a/test/files/detach-run/actor/java.policy +++ /dev/null @@ -1,25 +0,0 @@ -// See http://java.sun.com/javase/6/docs/technotes/guides/security/permissions.html -// See http://mindprod.com/jgloss/policyfile.html -// The policy expands ${/} to the correct path or folder delimiter on your host platform. - -// Actions available with SocketPermission: accept, connect, listen, resolve -// 1) The "resolve" action is implied when any of the other actions are present. -// 2) The "listen" action is only meaningful when used with "localhost". - -grant { - permission java.net.SocketPermission "*:80", "connect,accept,listen"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "scala.remoting.logLevel", "read"; - permission java.util.PropertyPermission "scala.remoting.port", "read"; -}; - -grant codeBase "@PROJECT_LIB_BASE@" { - permission java.lang.RuntimePermission "getClassLoader"; - permission java.util.PropertyPermission "java.rmi.server.codebase", "read"; - permission java.util.PropertyPermission "java.rmi.server.hostname", "read"; - permission java.util.PropertyPermission "sun.rmi.dgc.server.gcInterval", "read,write"; -}; -
-//grant { -// permission java.security.AllPermission; -//}; diff --git a/test/files/detach-run/basic-run.check b/test/files/detach-run/basic-run.check deleted file mode 100644 index 6463d97497..0000000000 --- a/test/files/detach-run/basic-run.check +++ /dev/null @@ -1,5 +0,0 @@ -Server.main 8889 -> Client.main 127.0.0.1 8889 -yInstVal = 10 -zLocVal = 1000 -result received: 11111 diff --git a/test/files/detach-run/basic/Client.scala b/test/files/detach-run/basic/Client.scala deleted file mode 100644 index f8eddb041d..0000000000 --- a/test/files/detach-run/basic/Client.scala +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import java.net._, Thread._, ClientHelper._ -import scala.remoting._, Debug._ - -object Foo { - def trace(s: String) { info("[Foo.trace] "+s)} -} -object Client { - val yInstVal: Int = 10 - var yInstVar: Int = 99 - object Bar { - def trace(s: String) { info("[Bar.trace] "+s) } - } - def main(args: Array[String]) { - init(args) - val server = new Channel(host, port) - val zLocVal: Int = 1000 - var zLocVar: Int = 9998 - server ! detach( - (x: Int) => { - println("yInstVal = "+yInstVal) - this.trace("yInstVar = "+yInstVar) - Bar.trace("zLocVal = "+zLocVal) - Foo.trace("zLocVar = "+zLocVar) - zLocVar += 2 - System.out.println("zLocVal = "+zLocVal) - Debug.info("zLocVar = "+zLocVar) - x + yInstVal + yInstVar + zLocVal + zLocVar - }) - val result = server.receiveInt - println("result received: " + result) - } - private def trace(s: String) { info("[Client.trace] "+s) } -} - -object ClientHelper { - private var _host = "127.0.0.1" - private var _port = 8888 - def host = _host - def port = _port - def init(args: Array[String]) { - try { _host = args(0) } catch { case _ => } - try { _port = args(1).toInt } catch { case _ => } - } -} diff --git a/test/files/detach-run/basic/Server.scala b/test/files/detach-run/basic/Server.scala deleted file mode 100644 index f8aa02a4ba..0000000000 --- a/test/files/detach-run/basic/Server.scala +++ /dev/null @@ -1,22 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import scala.remoting.ServerChannel - -object Server extends ServerConsole { - private def computation(f: Int => Int): Int = { - //some time-consuming task - f(2) - } - def main(args: Array[String]) { - val server = new ServerChannel(args(0).toInt) - loop { - val client = server.accept - val f = client.receive[Int => Int] - val result = computation(f) - client ! result - } - server.close() - } -} diff --git a/test/files/detach-run/basic/ServerConsole.scala b/test/files/detach-run/basic/ServerConsole.scala deleted file mode 100644 index 65b81c0ca1..0000000000 --- a/test/files/detach-run/basic/ServerConsole.scala +++ /dev/null @@ -1,83 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -import java.io._ - -import scala.compat.Platform.currentTime -import scala.remoting.Debug, Debug._ - -trait ServerConsole extends Thread { - private val startTime = currentTime - - start() - - private var isTerminated = false - - def terminate() { isTerminated = true } - - protected def loop(block: => Unit) { - while (!isTerminated) { - try { - block - } - catch { - case e: ObjectStreamException => - trace("Object stream error ("+e.getMessage+")") - case e: EOFException => - trace("Connection lost") - case e: ClassNotFoundException => - trace("Class not found") - case e => - trace("Server error: "+e) - } - } - } - - override def run() { - val in = new BufferedReader(new InputStreamReader(System.in)) - var quit = false - while (!quit) { - val args = getArgs(in) - if (args contains "quit") - quit = true - if (args contains "cls") { - println(ERASE_SCREEN) - println(CURSOR_HOME) - } - if (args contains "warning") - Debug.level = Level.WARNING - if (args contains "info") - Debug.level = Level.INFO - if (args contains "silent") - Debug.level = Level.SILENT - } - terminate() - println("Server exited ("+mkTimeString(currentTime - startTime)+")") - exit(0) - - } - - protected def trace(msg: String) { - Debug.info("[ServerConsole.trace] "+msg) - } - - private def getArgs(in: BufferedReader): List[String] = { - print("> ") - val input = try { in.readLine() } catch { case _ => null } - if (input != null) (input.trim split "\\s+").toList else Nil - } - - private def mkTimeString(time: Long): String = { - def twoDigits(i: Long) = (if (i < 10) "0" else "")+i - val sec = time / 1000 - val min = sec / 60 - val h = min / 60 - twoDigits(h) +":"+ - twoDigits(min - h * 60)+":"+ - twoDigits(sec - min * 60) - } - - private val ERASE_SCREEN = "\033[2J" - private val CURSOR_HOME = "\033[H" -} diff --git a/test/files/detach-run/basic/basic.flags b/test/files/detach-run/basic/basic.flags deleted file mode 100644 index 55eed8bbcd..0000000000 --- a/test/files/detach-run/basic/basic.flags +++ /dev/null @@ -1 +0,0 @@ --Xpluginsdir ../../../../build/pack/misc/scala-devel/plugins -Xplugin-require:detach -P:detach:enable diff --git a/test/files/detach-run/basic/basic.scala b/test/files/detach-run/basic/basic.scala deleted file mode 100644 index 4d0fc2d933..0000000000 --- a/test/files/detach-run/basic/basic.scala +++ /dev/null @@ -1,169 +0,0 @@ -/* - * @author Stephane Micheloud - */ - -object Test { - - val name = "basic" - val host = "127.0.0.1" - val port = 8889 - - def main(args: Array[String]) { - setenv() - println("Server.main "+port) - server.start() - println("Client.main "+host+" "+port) - client.start() - server.terminate() - } - - private var server = new ServerThread(port) - private var client = new ClientThread(host, port) - - private class ServerThread(port: Int) extends Runnable { - private var th = new Thread(this) - def start() { th.start(); Thread.sleep(1000) } - def run() { Server.main(Array(port.toString)) } - def terminate() { Server.terminate(); sys.exit(0) } - } - - private class ClientThread(host: String, port: Int) extends Runnable { - private var th = new Thread(this) - def start() { th.start(); th.join() } - def run() { Client.main(Array(host, port.toString)) } - } - - private def setenv() { - import Env._ - - // Java properties for server & client - System.setProperty("scala.remoting.logLevel", logLevel) - System.setProperty("java.security.manager", "") - System.setProperty("java.security.policy", policyFile) - // Java properties for server only - System.setProperty("java.rmi.server.codebase", deployUrl) - System.setProperty("java.rmi.server.hostname", host) - System.setProperty("java.rmi.server.useCodebaseOnly", "true") - - // application-secific classes to be deployed and accessed via URL - // (i.e. detached closure, proxy interfaces and proxy stubs) - val classNames = List( - "Bar$proxy", - "Bar$proxyImpl_Stub", - "Client$$anonfun$main$1$detach", - "Client$proxy", - "Client$proxyImpl_Stub", - "Foo$proxy", - "Foo$proxyImpl_Stub") - - val proxyImplNames = - for (n <- classNames; i = n lastIndexOf "_Stub"; if i > 0) - yield n.substring(0, i) - - generatePolicyFile() - generateRmiStubs(proxyImplNames) - generateJarFile(classNames) - } -} - -object Env { - import java.io._, java.util.jar._ - - val actors_logLevel = "0" - // = "3" // info+warning+error - val logLevel = "silent" - // = "info" // debug user code only - // = "info,lib" // debug user & library code - - // we assume an Apache server is running locally for deployment - private val sep = File.separator - val docPath = System.getProperty("user.home")+sep+"public_html" - val docRoot = "http://127.0.0.1/~"+System.getProperty("user.name") - - private val policyTmpl = - System.getProperty("partest.cwd")+sep+Test.name+sep+"java.policy" - val outPath = System.getProperty("partest.output") - val libPath = System.getProperty("partest.lib") - val policyFile = outPath+sep+"java.policy" - val codebaseDir = outPath+sep+"-" - - assert((new File(docPath)).isDirectory, - "Root directory \""+docPath+"\" not found") - val deployJar = docPath+sep+Test.name+"_deploy.jar" - val deployUrl = docRoot+"/"+Test.name+"_deploy.jar" - - def generatePolicyFile() { - val in = new BufferedReader(new FileReader(policyTmpl)) - val out = new PrintWriter(new BufferedWriter(new FileWriter(policyFile))) - var line = in.readLine() - while (line != null) { - val line1 = line.replaceAll("@PROJECT_LIB_BASE@", codebaseDir) - out.println(line1) - line = in.readLine() - } - in.close() - out.close() - } - - def generateRmiStubs(classNames: List[String]) { - val options = List( - "-v1.2", - "-classpath "+libPath+File.pathSeparator+outPath, - "-d "+outPath) - rmic(options, classNames) - //ls(outPath) - } - - def generateJarFile(classNames: List[String]) { - val out = new JarOutputStream(new FileOutputStream(deployJar)) - classNames foreach (name => try { - val classFile = name+".class" - val in = new FileInputStream(outPath+sep+classFile) - out putNextEntry new JarEntry(classFile) - val buf = new Array[Byte](512) - var len = in read buf - while (len != -1) { - out.write(buf, 0, len) - len = in read buf - } - in.close() - } catch { - case e: FileNotFoundException => println(e) - }) - out.close() - } - - private def ls(path: String) { exec("ls -al "+path) } - - private def rmic(options: List[String], classNames: List[String]) { - val javaHome = scala.util.Properties.javaHome - val jdkHome = - if (javaHome endsWith "jre") javaHome.substring(0, javaHome.length-4) - else javaHome - val rmicExt = if (scala.util.Properties.isWin) ".exe" else "" - val rmicCmd = jdkHome+sep+"bin"+sep+"rmic"+rmicExt - val cmdLine = rmicCmd+options.mkString(" ", " ", "")+ - classNames.mkString(" "," ","") - // println(cmdLine) - exec(cmdLine) - } - - private def exec(command: String) { - val proc = Runtime.getRuntime exec command - proc.waitFor() - val out = new BufferedReader(new InputStreamReader(proc.getInputStream)) - var line = out.readLine() - while (line != null) { - println(line) - line = out.readLine() - } - out.close() - val err = new BufferedReader(new InputStreamReader(proc.getErrorStream)) - line = err.readLine() - while (line != null) { - println(line) - line = err.readLine() - } - err.close() - } -} diff --git a/test/files/detach-run/basic/java.policy b/test/files/detach-run/basic/java.policy deleted file mode 100644 index 92c1045c3d..0000000000 --- a/test/files/detach-run/basic/java.policy +++ /dev/null @@ -1,26 +0,0 @@ -// See http://java.sun.com/javase/6/docs/technotes/guides/security/permissions.html -// See http://mindprod.com/jgloss/policyfile.html -// The policy expands ${/} to the correct path or folder delimiter on your host platform. - -// Actions available with SocketPermission: accept, connect, listen, resolve -// 1) The "resolve" action is implied when any of the other actions are present. -// 2) The "listen" action is only meaningful when used with "localhost". - -grant { - permission java.net.SocketPermission "*:80", "connect,accept,listen"; - permission java.net.SocketPermission "*:1024-", "connect,accept,listen"; - permission java.util.PropertyPermission "scala.remoting.logLevel", "read"; - permission java.util.PropertyPermission "scala.remoting.port", "read"; -}; - -grant codeBase "@PROJECT_LIB_BASE@" { - permission java.lang.RuntimePermission "getClassLoader"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.util.PropertyPermission "java.rmi.server.codebase", "read"; - permission java.util.PropertyPermission "java.rmi.server.hostname", "read"; - permission java.util.PropertyPermission "sun.rmi.dgc.server.gcInterval", "read,write"; -}; - -//grant { -// permission java.security.AllPermission; -//}; diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 6145b6c4d2..477096fb7e 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -357,10 +357,8 @@ defined class Term scala> def f(e: Exp) = e match { // non-exhaustive warning here case _:Fact => 3 } -<console>:18: warning: match is not exhaustive! -missing combination Exp -missing combination Term - +<console>:18: warning: match may not be exhaustive. +It would fail on the following inputs: Exp(), Term() def f(e: Exp) = e match { // non-exhaustive warning here ^ f: (e: Exp)Int diff --git a/test/files/jvm/interpreter.scala b/test/files/jvm/interpreter.scala index f45eb034a9..bd1851053f 100644 --- a/test/files/jvm/interpreter.scala +++ b/test/files/jvm/interpreter.scala @@ -2,7 +2,7 @@ import scala.tools.nsc._ import scala.tools.partest.ReplTest object Test extends ReplTest { - override def extraSettings = "-deprecation -Xoldpatmat" + override def extraSettings = "-deprecation" def code = <code> // basics 3+4 diff --git a/test/files/jvm/manifests-new.scala b/test/files/jvm/manifests-new.scala index f730be67bb..3937fdec69 100644 --- a/test/files/jvm/manifests-new.scala +++ b/test/files/jvm/manifests-new.scala @@ -56,7 +56,7 @@ object Test1 extends TestUtil { } object Test2 { - import scala.util.Marshal._ + import Marshal._ println("()="+load[Unit](dump(()))) println("true="+load[Boolean](dump(true))) println("a="+load[Char](dump('a'))) @@ -88,6 +88,38 @@ object Test2 { println() } +object Marshal { + import java.io._ + import scala.reflect.ClassTag + + def dump[A](o: A)(implicit t: ClassTag[A]): Array[Byte] = { + val ba = new ByteArrayOutputStream(512) + val out = new ObjectOutputStream(ba) + out.writeObject(t) + out.writeObject(o) + out.close() + ba.toByteArray() + } + + @throws(classOf[IOException]) + @throws(classOf[ClassCastException]) + @throws(classOf[ClassNotFoundException]) + def load[A](buffer: Array[Byte])(implicit expected: ClassTag[A]): A = { + val in = new ObjectInputStream(new ByteArrayInputStream(buffer)) + val found = in.readObject.asInstanceOf[ClassTag[_]] + try { + found.runtimeClass.asSubclass(expected.runtimeClass) + in.readObject.asInstanceOf[A] + } catch { + case _: ClassCastException => + in.close() + throw new ClassCastException("type mismatch;"+ + "\n found : "+found+ + "\n required: "+expected) + } + } +} + trait TestUtil { import java.io._ def write[A](o: A): Array[Byte] = { diff --git a/test/files/jvm/manifests-old.scala b/test/files/jvm/manifests-old.scala index 241966fd9d..bb1928f094 100644 --- a/test/files/jvm/manifests-old.scala +++ b/test/files/jvm/manifests-old.scala @@ -55,7 +55,7 @@ object Test1 extends TestUtil { } object Test2 { - import scala.util.Marshal._ + import Marshal._ println("()="+load[Unit](dump(()))) println("true="+load[Boolean](dump(true))) println("a="+load[Char](dump('a'))) @@ -87,6 +87,38 @@ object Test2 { println() } +object Marshal { + import java.io._ + import scala.reflect.ClassTag + + def dump[A](o: A)(implicit t: ClassTag[A]): Array[Byte] = { + val ba = new ByteArrayOutputStream(512) + val out = new ObjectOutputStream(ba) + out.writeObject(t) + out.writeObject(o) + out.close() + ba.toByteArray() + } + + @throws(classOf[IOException]) + @throws(classOf[ClassCastException]) + @throws(classOf[ClassNotFoundException]) + def load[A](buffer: Array[Byte])(implicit expected: ClassTag[A]): A = { + val in = new ObjectInputStream(new ByteArrayInputStream(buffer)) + val found = in.readObject.asInstanceOf[ClassTag[_]] + try { + found.runtimeClass.asSubclass(expected.runtimeClass) + in.readObject.asInstanceOf[A] + } catch { + case _: ClassCastException => + in.close() + throw new ClassCastException("type mismatch;"+ + "\n found : "+found+ + "\n required: "+expected) + } + } +} + trait TestUtil { import java.io._ def write[A](o: A): Array[Byte] = { diff --git a/test/files/jvm/t1143-2/t1143-2.scala b/test/files/jvm/t1143-2/t1143-2.scala index 44b1febd8b..13ab13b48c 100644 --- a/test/files/jvm/t1143-2/t1143-2.scala +++ b/test/files/jvm/t1143-2/t1143-2.scala @@ -16,43 +16,39 @@ object Serialize { } } -@serializable @SerialVersionUID(1L) -class VarModel[T]( getter: => T, setter: T => Unit ) -{ +class VarModel[T](getter: => T, setter: T => Unit) extends Serializable { Serialize.write(getter) Serialize.write(setter) - def this( getter: => T ) = this( getter, null ) + def this(getter: => T) = this(getter, null) def getObject: AnyRef = getter.asInstanceOf[AnyRef] - def setObject( v: AnyRef ) = { - if( setter==null ) - throw new RuntimeException( "Tried to set readonly model!") - setter( v.asInstanceOf[T] ) + def setObject(v: AnyRef) = { + if(setter==null) + throw new RuntimeException("Tried to set readonly model!") + setter(v.asInstanceOf[T]) } def detach = () } -@serializable @SerialVersionUID(1L) -class Printer( p: VarModel[String] ) { - def print = println( p.getObject ); +class Printer(p: VarModel[String]) extends Serializable { + def print = println(p.getObject) } class Component extends Marker { } class Form extends Component { } -@serializable @SerialVersionUID(1L) -class Main { +class Main extends Serializable { var pass = "pass" - def main(args : Array[String]) : Unit = { + def main(args: Array[String]): Unit = { val f = new Form { - val p = new Printer( new VarModel( pass, s => pass = s ) ); + val p = new Printer(new VarModel(pass, s => pass = s)) p.print } () diff --git a/test/files/jvm/t1143.scala b/test/files/jvm/t1143.scala index 7dd374f432..eb03c7224e 100644 --- a/test/files/jvm/t1143.scala +++ b/test/files/jvm/t1143.scala @@ -16,9 +16,8 @@ object Serialize { } } -@serializable @SerialVersionUID(1L) -class VarModel[T](getter: => T, setter: T => Unit) { +class VarModel[T](getter: => T, setter: T => Unit) extends Serializable { Serialize.write(getter) Serialize.write(setter) @@ -35,23 +34,20 @@ class VarModel[T](getter: => T, setter: T => Unit) { def detach = () } -@serializable @SerialVersionUID(1L) -class Printer(p: VarModel[String]) { +class Printer(p: VarModel[String]) extends Serializable { def print = println(p.getObject) } -@serializable @SerialVersionUID(1L) -class Component { +class Component extends Serializable { } class Form extends Component { } -@serializable @SerialVersionUID(1L) -class Main { +class Main extends Serializable { var pass = "pass" def main(args: Array[String]) { val f = new Form { diff --git a/test/files/jvm/t1342/SI.scala b/test/files/jvm/t1342/SI.scala index 8e3b753210..7c37d4bcd7 100644 --- a/test/files/jvm/t1342/SI.scala +++ b/test/files/jvm/t1342/SI.scala @@ -4,7 +4,7 @@ class SI extends JI { } } -object Test extends Application { +object Test extends App { val x: JI = new SI x.varArgsMethod("one", "two") } diff --git a/test/files/jvm/t1600.scala b/test/files/jvm/t1600.scala index 7e23687425..69179c1ba4 100644 --- a/test/files/jvm/t1600.scala +++ b/test/files/jvm/t1600.scala @@ -69,8 +69,7 @@ object Test { var hashCodeModifier = 0 } - @serializable - class Foo { + class Foo extends Serializable { override def hashCode = System.identityHashCode(this) + Foo.hashCodeModifier } } diff --git a/test/files/jvm/ticket2163/ticket2163.java b/test/files/jvm/t2163/t2163.java index b6511d241c..83bd37d212 100644 --- a/test/files/jvm/ticket2163/ticket2163.java +++ b/test/files/jvm/t2163/t2163.java @@ -1,9 +1,9 @@ import java.util.*; -public class ticket2163 { +public class t2163 { public void test() { List<Integer> array = new ArrayList<Integer>(); - Ticket2163Scala<List> foo = new Ticket2163Scala<List>(array); + T2163Scala<List> foo = new T2163Scala<List>(array); foo.bar(array); } } diff --git a/test/files/jvm/t2163/t2163.scala b/test/files/jvm/t2163/t2163.scala new file mode 100644 index 0000000000..f73b520cbe --- /dev/null +++ b/test/files/jvm/t2163/t2163.scala @@ -0,0 +1,5 @@ +class T2163Scala[CC[X]](x: CC[Int]) { + def bar[DD[X]](meh: DD[Int]): CC[Int] = x +} + +object Test extends App {} diff --git a/test/files/jvm/t2470.cmds b/test/files/jvm/t2470.cmds deleted file mode 100644 index b4ef0f4aeb..0000000000 --- a/test/files/jvm/t2470.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac Action.java Task.java -scalac Test_1.scala -scalac Read_Classfile_2.scala diff --git a/test/files/jvm/t2570/Test.scala b/test/files/jvm/t2570/Test.scala index 7944aedae6..f1cba53546 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 Application {}
\ No newline at end of file +object Test extends App {}
\ No newline at end of file diff --git a/test/files/jvm/t3003.cmds b/test/files/jvm/t3003.cmds deleted file mode 100644 index c00396627c..0000000000 --- a/test/files/jvm/t3003.cmds +++ /dev/null @@ -1,2 +0,0 @@ -javac Annot.java -scalac Test_1.scala diff --git a/test/files/jvm/t3415/HelloWorld.scala b/test/files/jvm/t3415/HelloWorld.scala index 53bf55e444..5ef012390e 100644 --- a/test/files/jvm/t3415/HelloWorld.scala +++ b/test/files/jvm/t3415/HelloWorld.scala @@ -1,4 +1,4 @@ -object Test extends Application { +object Test extends App { @Hello def foo() { } } diff --git a/test/files/jvm/ticket4283/AbstractFoo.java b/test/files/jvm/t4283/AbstractFoo.java index 74f3827fe3..74f3827fe3 100644 --- a/test/files/jvm/ticket4283/AbstractFoo.java +++ b/test/files/jvm/t4283/AbstractFoo.java diff --git a/test/files/jvm/ticket4283/ScalaBipp.scala b/test/files/jvm/t4283/ScalaBipp.scala index 36dea9f4de..36dea9f4de 100644 --- a/test/files/jvm/ticket4283/ScalaBipp.scala +++ b/test/files/jvm/t4283/ScalaBipp.scala diff --git a/test/files/jvm/ticket4283/Test.scala b/test/files/jvm/t4283/Test.scala index 9bbfaab928..9bbfaab928 100644 --- a/test/files/jvm/ticket4283/Test.scala +++ b/test/files/jvm/t4283/Test.scala diff --git a/test/files/jvm/ticket2163/ticket2163.scala b/test/files/jvm/ticket2163/ticket2163.scala deleted file mode 100644 index d30bfe251b..0000000000 --- a/test/files/jvm/ticket2163/ticket2163.scala +++ /dev/null @@ -1,5 +0,0 @@ -class Ticket2163Scala[CC[X]](x: CC[Int]) { - def bar[DD[X]](meh: DD[Int]): CC[Int] = x -} - -object Test extends Application {} diff --git a/test/files/jvm/typerep.scala b/test/files/jvm/typerep.scala index 3befc7ff3f..47bd16a467 100644 --- a/test/files/jvm/typerep.scala +++ b/test/files/jvm/typerep.scala @@ -280,100 +280,74 @@ object TypeRep { override def toString = "Nothing" } - @serializable case class ClassRep[A](elemRep: TypeRep[A]) extends TypeRep[Class[A]] { override def toString = "Class[" + elemRep + "]" } - @serializable case class SomeRep[A](elemRep: TypeRep[A]) extends TypeRep[Some[A]] { override def toString = "Some[" + elemRep + "]" } - @serializable case class NoneRep[A](elemRep: TypeRep[A]) extends TypeRep[Option[A]] { override def toString = "None[" + elemRep + "]" } - - @serializable case class ListRep[A](elemRep: TypeRep[A]) extends TypeRep[List[A]] { override def toString = "List[" + elemRep + "]" } - - @serializable case class ArrayRep[A](elemRep: TypeRep[A]) extends TypeRep[Array[A]] { override def toString = "Array[" + elemRep + "]" } - - @serializable case class Tuple2Rep[A1, A2](_1: TypeRep[A1], _2: TypeRep[A2]) extends TypeRep[(A1, A2)] { override def toString = "Tuple2[" + _1 + ", " + _2 + "]" } - @serializable case class Tuple3Rep[A1, A2, A3](_1: TypeRep[A1], _2: TypeRep[A2], _3: TypeRep[A3]) extends TypeRep[Tuple3[A1, A2, A3]] { override def toString = "Tuple3[" + _1 + ", " + _2 + ", " + _3 + "]" } - @serializable case class Tuple4Rep[A1, A2, A3, A4](_1: TypeRep[A1], _2: TypeRep[A2], _3: TypeRep[A3], _4: TypeRep[A4]) extends TypeRep[Tuple4[A1, A2, A3, A4]] { override def toString = "Tuple4[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + "]" } - @serializable case class Tuple5Rep[A1, A2, A3, A4, A5](_1: TypeRep[A1], _2: TypeRep[A2], _3: TypeRep[A3], _4: TypeRep[A4], _5: TypeRep[A5]) extends TypeRep[Tuple5[A1, A2, A3, A4, A5]] { override def toString = "Tuple5[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + "]" } - @serializable case class Tuple6Rep[A1, A2, A3, A4, A5, A6](val _1: TypeRep[A1], val _2: TypeRep[A2], val _3: TypeRep[A3], val _4: TypeRep[A4], val _5: TypeRep[A5], val _6: TypeRep[A6]) extends TypeRep[Tuple6[A1, A2, A3, A4, A5, A6]] { override def toString = "Tuple6[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + ", " + _6 + "]" } - @serializable case class Tuple7Rep[A1, A2, A3, A4, A5, A6, A7](val _1: TypeRep[A1], val _2: TypeRep[A2], val _3: TypeRep[A3], val _4: TypeRep[A4], val _5: TypeRep[A5], val _6: TypeRep[A6], val _7: TypeRep[A7]) extends TypeRep[Tuple7[A1, A2, A3, A4, A5, A6, A7]] { override def toString = "Tuple7[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + ", " + _6 + ", " + _7 + "]" } - @serializable case class Tuple8Rep[A1, A2, A3, A4, A5, A6, A7, A8](val _1: TypeRep[A1], val _2: TypeRep[A2], val _3: TypeRep[A3], val _4: TypeRep[A4], val _5: TypeRep[A5], val _6: TypeRep[A6], val _7: TypeRep[A7], val _8: TypeRep[A8]) extends TypeRep[Tuple8[A1, A2, A3, A4, A5, A6, A7, A8]] { override def toString = "Tuple8[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + ", " + _6 + ", " + _7 + ", " + _8 + "]" } - @serializable case class Tuple9Rep[A1, A2, A3, A4, A5, A6, A7, A8, A9](val _1: TypeRep[A1], val _2: TypeRep[A2], val _3: TypeRep[A3], val _4: TypeRep[A4], val _5: TypeRep[A5], val _6: TypeRep[A6], val _7: TypeRep[A7], val _8: TypeRep[A8], val _9: TypeRep[A9]) extends TypeRep[Tuple9[A1, A2, A3, A4, A5, A6, A7, A8, A9]] { override def toString = "Tuple9[" + _1 + ", " + _2 + ", " + _3 + ", " + _4 + ", " + _5 + ", " + _6 + ", " + _7 + ", " + _8 + ", " + _9 + "]" } - @serializable case class Function1Rep[A1, B](a1: TypeRep[A1], b: TypeRep[B]) extends TypeRep[Function1[A1, B]] { override def toString = "Function1[" + a1 + ", " + b + "]" } - @serializable case class Function2Rep[A1, A2, B](a1: TypeRep[A1], a2: TypeRep[A2], b: TypeRep[B]) extends TypeRep[Function2[A1, A2, B]] { override def toString = "Function2[" + a1 + ", " + a2 + ", " + b + "]" } - @serializable case class Function3Rep[A1, A2, A3, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], b: TypeRep[B]) extends TypeRep[Function3[A1, A2, A3, B]] { override def toString = "Function3[" + a1 + ", " + a2 + ", " + a3 + ", " + b + "]" } - @serializable case class Function4Rep[A1, A2, A3, A4, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], b: TypeRep[B]) extends TypeRep[Function4[A1, A2, A3, A4, B]] { override def toString = "Function4[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + b + "]" } - @serializable case class Function5Rep[A1, A2, A3, A4, A5, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], b: TypeRep[B]) extends TypeRep[Function5[A1, A2, A3, A4, A5, B]] { override def toString = "Function5[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + b + "]" } - @serializable case class Function6Rep[A1, A2, A3, A4, A5, A6, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], a6: TypeRep[A6], b: TypeRep[B]) extends TypeRep[Function6[A1, A2, A3, A4, A5, A6, B]] { override def toString = "Function6[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + a6 + ", " + b + "]" } - @serializable case class Function7Rep[A1, A2, A3, A4, A5, A6, A7, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], a6: TypeRep[A6], a7: TypeRep[A7], b: TypeRep[B]) extends TypeRep[Function7[A1, A2, A3, A4, A5, A6, A7, B]] { override def toString = "Function7[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + a6 + ", " + a7 + ", " + b + "]" } - @serializable case class Function8Rep[A1, A2, A3, A4, A5, A6, A7, A8, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], a6: TypeRep[A6], a7: TypeRep[A7], a8: TypeRep[A8], b: TypeRep[B]) extends TypeRep[Function8[A1, A2, A3, A4, A5, A6, A7, A8, B]] { override def toString = "Function8[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + a6 + ", " + a7 + ", " + a8 + b + "]" } - @serializable case class Function9Rep[A1, A2, A3, A4, A5, A6, A7, A8, A9, B](a1: TypeRep[A1], a2: TypeRep[A2], a3: TypeRep[A3], a4: TypeRep[A4], a5: TypeRep[A5], a6: TypeRep[A6], a7: TypeRep[A7], a8: TypeRep[A8], a9: TypeRep[A9], b: TypeRep[B]) extends TypeRep[Function9[A1, A2, A3, A4, A5, A6, A7, A8, A9, B]] { override def toString = "Function9[" + a1 + ", " + a2 + ", " + a3 + ", " + a4 + ", " + a5 + ", " + a6 + ", " + a7 + ", " + a8 + ", " + b + "]" } /* - @serializable case class ObjectRep[A](c: Class) extends TypeRep[A] { override def toString = c.getName } diff --git a/test/files/jvm/xmlattr.scala b/test/files/jvm/xmlattr.scala index d214642eb6..6423268ba7 100644 --- a/test/files/jvm/xmlattr.scala +++ b/test/files/jvm/xmlattr.scala @@ -6,6 +6,7 @@ object Test { UnprefixedAttributeTest() AttributeWithOptionTest() AttributeOutputTest() + AttributeOperatorTest() } object UnprefixedAttributeTest { @@ -60,4 +61,10 @@ object Test { } } + object AttributeOperatorTest { + def apply() { + val xml = <foo bar="apple" /> + assert(xml \@ "bar" == "apple") + } + } } diff --git a/test/files/lib/jsoup-1.3.1.jar.desired.sha1 b/test/files/lib/jsoup-1.3.1.jar.desired.sha1 new file mode 100644 index 0000000000..46fa3dae9d --- /dev/null +++ b/test/files/lib/jsoup-1.3.1.jar.desired.sha1 @@ -0,0 +1 @@ +346d3dff4088839d6b4d163efa2892124039d216 ?jsoup-1.3.1.jar diff --git a/test/files/neg/abstract-inaccessible.check b/test/files/neg/abstract-inaccessible.check index 42b98ac026..d56f5691be 100644 --- a/test/files/neg/abstract-inaccessible.check +++ b/test/files/neg/abstract-inaccessible.check @@ -1,13 +1,15 @@ -abstract-inaccessible.scala:5: error: method implementMe in trait YourTrait references private[foo] trait Bippy. +abstract-inaccessible.scala:5: warning: method implementMe in trait YourTrait references private[foo] trait Bippy. Classes which cannot access Bippy may be unable to provide a concrete implementation of implementMe. def implementMe(f: Int => (String, Bippy)): Unit ^ -abstract-inaccessible.scala:6: error: method overrideMe in trait YourTrait references private[foo] trait Bippy. +abstract-inaccessible.scala:6: warning: method overrideMe in trait YourTrait references private[foo] trait Bippy. Classes which cannot access Bippy may be unable to override overrideMe. def overrideMe[T <: Bippy](x: T): T = x ^ -abstract-inaccessible.scala:7: error: method overrideMeAlso in trait YourTrait references private[foo] trait Bippy. +abstract-inaccessible.scala:7: warning: method overrideMeAlso in trait YourTrait references private[foo] trait Bippy. Classes which cannot access Bippy may be unable to override overrideMeAlso. def overrideMeAlso(x: Map[Int, Set[Bippy]]) = 5 ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/ambiguous-float-dots.check b/test/files/neg/ambiguous-float-dots.check index 6c21056d7a..cdd2d6fa2a 100644 --- a/test/files/neg/ambiguous-float-dots.check +++ b/test/files/neg/ambiguous-float-dots.check @@ -1,16 +1,27 @@ -ambiguous-float-dots.scala:2: error: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. +ambiguous-float-dots.scala:2: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. val x0 = 5. ^ -ambiguous-float-dots.scala:6: error: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. +ambiguous-float-dots.scala:6: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. val x1 = 5.f ^ -ambiguous-float-dots.scala:7: error: Treating numbers with a leading zero as octal is deprecated. +ambiguous-float-dots.scala:7: warning: Treating numbers with a leading zero as octal is deprecated. val y0 = 055 ^ -ambiguous-float-dots.scala:11: error: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. +ambiguous-float-dots.scala:11: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. 1.+(2) ^ -ambiguous-float-dots.scala:12: error: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. +ambiguous-float-dots.scala:12: warning: This lexical syntax is deprecated. From scala 2.11, a dot will only be considered part of a number if it is immediately followed by a digit. 1. + 2 ^ -5 errors found +ambiguous-float-dots.scala:11: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1.+(2) + ^ +ambiguous-float-dots.scala:12: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1. + 2 + ^ +ambiguous-float-dots.scala:13: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1 + 2 + ^ +error: No warnings can be incurred under -Xfatal-warnings. +8 warnings found +one error found diff --git a/test/files/neg/array-not-seq.check b/test/files/neg/array-not-seq.check deleted file mode 100644 index a3a639e772..0000000000 --- a/test/files/neg/array-not-seq.check +++ /dev/null @@ -1,13 +0,0 @@ -array-not-seq.scala:2: error: An Array will no longer match as Seq[_]. - def f1(x: Any) = x.isInstanceOf[Seq[_]] - ^ -array-not-seq.scala:4: error: An Array will no longer match as Seq[_]. - case _: Seq[_] => true - ^ -array-not-seq.scala:16: error: An Array will no longer match as Seq[_]. - case (Some(_: Seq[_]), Nil, _) => 1 - ^ -array-not-seq.scala:17: error: An Array will no longer match as Seq[_]. - case (None, List(_: List[_], _), _) => 2 - ^ -four errors found diff --git a/test/files/neg/array-not-seq.flags b/test/files/neg/array-not-seq.flags deleted file mode 100644 index 4e9f7e4a56..0000000000 --- a/test/files/neg/array-not-seq.flags +++ /dev/null @@ -1 +0,0 @@ --Xmigration -Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/array-not-seq.scala b/test/files/neg/array-not-seq.scala deleted file mode 100644 index 5f367bdd85..0000000000 --- a/test/files/neg/array-not-seq.scala +++ /dev/null @@ -1,26 +0,0 @@ -object Test { - def f1(x: Any) = x.isInstanceOf[Seq[_]] - def f2(x: Any) = x match { - case _: Seq[_] => true - case _ => false - } - - def f3(x: Any) = x match { - 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 - case _ => 3 - } - - def main(args: Array[String]): Unit = { - // println(f1(Array(1))) - // println(f2(Array(1))) - // println(f3(Array(1)) - } -} diff --git a/test/files/neg/case-collision.check b/test/files/neg/case-collision.check index 4edc6f1205..22cf105a4f 100644 --- a/test/files/neg/case-collision.check +++ b/test/files/neg/case-collision.check @@ -1,10 +1,12 @@ -case-collision.scala:5: error: Class foo.BIPPY differs only in case from foo.Bippy. Such classes will overwrite one another on case-insensitive filesystems. +case-collision.scala:5: warning: Class foo.BIPPY differs only in case from foo.Bippy. Such classes will overwrite one another on case-insensitive filesystems. class BIPPY ^ -case-collision.scala:11: error: Class foo.HyRaX$ differs only in case from foo.Hyrax$. Such classes will overwrite one another on case-insensitive filesystems. +case-collision.scala:11: warning: Class foo.HyRaX$ differs only in case from foo.Hyrax$. Such classes will overwrite one another on case-insensitive filesystems. object HyRaX ^ -case-collision.scala:8: error: Class foo.DINGO$ differs only in case from foo.Dingo$. Such classes will overwrite one another on case-insensitive filesystems. +case-collision.scala:8: warning: Class foo.DINGO$ differs only in case from foo.Dingo$. Such classes will overwrite one another on case-insensitive filesystems. object DINGO ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/catch-all.check b/test/files/neg/catch-all.check index 62f895cc7e..aaf51480c3 100644 --- a/test/files/neg/catch-all.check +++ b/test/files/neg/catch-all.check @@ -1,10 +1,12 @@ -catch-all.scala:2: error: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning. +catch-all.scala:2: warning: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning. try { "warn" } catch { case _ => } ^ -catch-all.scala:4: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. +catch-all.scala:4: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. try { "warn" } catch { case x => } ^ -catch-all.scala:6: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. +catch-all.scala:6: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. try { "warn" } catch { case _: RuntimeException => ; case x => } ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/check-dead.check b/test/files/neg/check-dead.check index 29601c1d4a..2150a942bf 100644 --- a/test/files/neg/check-dead.check +++ b/test/files/neg/check-dead.check @@ -1,13 +1,15 @@ -check-dead.scala:7: error: dead code following this construct +check-dead.scala:7: warning: dead code following this construct def z1 = y1(throw new Exception) // should warn ^ -check-dead.scala:10: error: dead code following this construct +check-dead.scala:10: warning: dead code following this construct def z2 = y2(throw new Exception) // should warn ^ -check-dead.scala:29: error: dead code following this construct +check-dead.scala:29: warning: dead code following this construct throw new Exception // should warn ^ -check-dead.scala:33: error: dead code following this construct +check-dead.scala:33: warning: dead code following this construct throw new Exception // should warn ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index d785179a56..e5f1a38d96 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -1,100 +1,102 @@ -checksensible.scala:13: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:13: warning: comparing a fresh object using `eq' will always yield false (new AnyRef) eq (new AnyRef) ^ -checksensible.scala:14: error: comparing a fresh object using `ne' will always yield true +checksensible.scala:14: warning: comparing a fresh object using `ne' will always yield true (new AnyRef) ne (new AnyRef) ^ -checksensible.scala:15: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:15: warning: comparing a fresh object using `eq' will always yield false Shmoopie eq (new AnyRef) ^ -checksensible.scala:16: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:16: warning: comparing a fresh object using `eq' will always yield false (Shmoopie: AnyRef) eq (new AnyRef) ^ -checksensible.scala:17: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:17: warning: comparing a fresh object using `eq' will always yield false (new AnyRef) eq Shmoopie ^ -checksensible.scala:18: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:18: warning: comparing a fresh object using `eq' will always yield false (new AnyRef) eq null ^ -checksensible.scala:19: error: comparing a fresh object using `eq' will always yield false +checksensible.scala:19: warning: comparing a fresh object using `eq' will always yield false null eq new AnyRef ^ -checksensible.scala:26: error: comparing values of types Unit and Int using `==' will always yield false +checksensible.scala:26: warning: comparing values of types Unit and Int using `==' will always yield false (c = 1) == 0 ^ -checksensible.scala:27: error: comparing values of types Int and Unit using `==' will always yield false +checksensible.scala:27: warning: comparing values of types Int and Unit using `==' will always yield false 0 == (c = 1) ^ -checksensible.scala:29: error: comparing values of types Int and String using `==' will always yield false +checksensible.scala:29: warning: comparing values of types Int and String using `==' will always yield false 1 == "abc" ^ -checksensible.scala:33: error: comparing values of types Some[Int] and Int using `==' will always yield false +checksensible.scala:33: warning: comparing values of types Some[Int] and Int using `==' will always yield false Some(1) == 1 // as above ^ -checksensible.scala:38: error: comparing a fresh object using `==' will always yield false +checksensible.scala:38: warning: comparing a fresh object using `==' will always yield false new AnyRef == 1 ^ -checksensible.scala:41: error: comparing values of types Int and Boolean using `==' will always yield false +checksensible.scala:41: warning: comparing values of types Int and Boolean using `==' will always yield false 1 == (new java.lang.Boolean(true)) ^ -checksensible.scala:43: error: comparing values of types Int and Boolean using `!=' will always yield true +checksensible.scala:43: warning: comparing values of types Int and Boolean using `!=' will always yield true 1 != true ^ -checksensible.scala:44: error: comparing values of types Unit and Boolean using `==' will always yield false +checksensible.scala:44: warning: comparing values of types Unit and Boolean using `==' will always yield false () == true ^ -checksensible.scala:45: error: comparing values of types Unit and Unit using `==' will always yield true +checksensible.scala:45: warning: comparing values of types Unit and Unit using `==' will always yield true () == () ^ -checksensible.scala:46: error: comparing values of types Unit and Unit using `==' will always yield true +checksensible.scala:46: warning: comparing values of types Unit and Unit using `==' will always yield true () == println ^ -checksensible.scala:47: error: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true +checksensible.scala:47: warning: comparing values of types Unit and scala.runtime.BoxedUnit using `==' will always yield true () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false ^ -checksensible.scala:48: error: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false +checksensible.scala:48: warning: comparing values of types scala.runtime.BoxedUnit and Unit using `!=' will always yield false scala.runtime.BoxedUnit.UNIT != () ^ -checksensible.scala:51: error: comparing values of types Int and Unit using `!=' will always yield true +checksensible.scala:51: warning: comparing values of types Int and Unit using `!=' will always yield true (1 != println) ^ -checksensible.scala:52: error: comparing values of types Int and Symbol using `!=' will always yield true +checksensible.scala:52: warning: comparing values of types Int and Symbol using `!=' will always yield true (1 != 'sym) ^ -checksensible.scala:58: error: comparing a fresh object using `==' will always yield false +checksensible.scala:58: warning: comparing a fresh object using `==' will always yield false ((x: Int) => x + 1) == null ^ -checksensible.scala:59: error: comparing a fresh object using `==' will always yield false +checksensible.scala:59: warning: comparing a fresh object using `==' will always yield false Bep == ((_: Int) + 1) ^ -checksensible.scala:61: error: comparing a fresh object using `==' will always yield false +checksensible.scala:61: warning: comparing a fresh object using `==' will always yield false new Object == new Object ^ -checksensible.scala:62: error: comparing a fresh object using `==' will always yield false +checksensible.scala:62: warning: comparing a fresh object using `==' will always yield false new Object == "abc" ^ -checksensible.scala:63: error: comparing a fresh object using `!=' will always yield true +checksensible.scala:63: warning: comparing a fresh object using `!=' will always yield true new Exception() != new Exception() ^ -checksensible.scala:66: error: comparing values of types Int and Null using `==' will always yield false +checksensible.scala:66: warning: comparing values of types Int and Null using `==' will always yield false if (foo.length == null) "plante" else "plante pas" ^ -checksensible.scala:71: error: comparing values of types Bip and Bop using `==' will always yield false +checksensible.scala:71: warning: comparing values of types Bip and Bop using `==' will always yield false (x1 == x2) ^ -checksensible.scala:81: error: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false +checksensible.scala:81: warning: comparing values of types EqEqRefTest.this.C3 and EqEqRefTest.this.Z1 using `==' will always yield false c3 == z1 ^ -checksensible.scala:82: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false +checksensible.scala:82: warning: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `==' will always yield false z1 == c3 ^ -checksensible.scala:83: error: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true +checksensible.scala:83: warning: comparing values of types EqEqRefTest.this.Z1 and EqEqRefTest.this.C3 using `!=' will always yield true z1 != c3 ^ -checksensible.scala:84: error: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true +checksensible.scala:84: warning: comparing values of types EqEqRefTest.this.C3 and String using `!=' will always yield true c3 != "abc" ^ -checksensible.scala:95: error: comparing values of types Unit and Int using `!=' will always yield true +checksensible.scala:95: warning: comparing values of types Unit and Int using `!=' will always yield true while ((c = in.read) != -1) ^ -33 errors found +error: No warnings can be incurred under -Xfatal-warnings. +33 warnings found +one error found diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check index 12428c7626..fddd6bf5b4 100644 --- a/test/files/neg/classmanifests_new_deprecations.check +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -1,31 +1,33 @@ -classmanifests_new_deprecations.scala:2: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +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: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +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]) = ??? ^ -classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead val cm3: ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead val cm3: ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:6: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +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: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +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]) = ??? ^ -classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead val rcm3: scala.reflect.ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead val rcm3: scala.reflect.ClassManifest[Int] = null ^ -classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead type CM[T] = ClassManifest[T] ^ -classmanifests_new_deprecations.scala:15: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead +classmanifests_new_deprecations.scala:15: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead type RCM[T] = scala.reflect.ClassManifest[T] ^ -10 errors found +error: No warnings can be incurred under -Xfatal-warnings. +10 warnings found +one error found diff --git a/test/files/neg/cycle-bounds.check b/test/files/neg/cycle-bounds.check new file mode 100644 index 0000000000..d924838aec --- /dev/null +++ b/test/files/neg/cycle-bounds.check @@ -0,0 +1,4 @@ +cycle-bounds.scala:5: error: illegal cyclic reference involving type T +class NotOk[T <: Comparable[_ <: T]] + ^ +one error found diff --git a/test/files/neg/cycle-bounds.flags b/test/files/neg/cycle-bounds.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/neg/cycle-bounds.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/neg/cycle-bounds.scala b/test/files/neg/cycle-bounds.scala new file mode 100644 index 0000000000..0b43bc703e --- /dev/null +++ b/test/files/neg/cycle-bounds.scala @@ -0,0 +1,5 @@ +// This should be allowed +class Ok[T <: Comparable[_ >: T]] + +// This is (il)legitimately a cyclic reference +class NotOk[T <: Comparable[_ <: T]] diff --git a/test/files/neg/dbldef.check b/test/files/neg/dbldef.check index 3ee63475e4..b896c4cdcf 100644 --- a/test/files/neg/dbldef.check +++ b/test/files/neg/dbldef.check @@ -6,9 +6,7 @@ dbldef.scala:1: error: type mismatch; required: Int case class test0(x: Int, x: Float) ^ -dbldef.scala:1: error: type mismatch; - found : Float - required: Int +dbldef.scala:1: error: in class test0, multiple overloaded alternatives of x define default arguments case class test0(x: Int, x: Float) ^ three errors found diff --git a/test/files/neg/exhausting.check b/test/files/neg/exhausting.check index 0f0d13cb33..c573eb3e15 100644 --- a/test/files/neg/exhausting.check +++ b/test/files/neg/exhausting.check @@ -1,25 +1,27 @@ -exhausting.scala:21: error: match may not be exhaustive. +exhausting.scala:21: warning: match may not be exhaustive. It would fail on the following input: List(_, _, _) def fail1[T](xs: List[T]) = xs match { ^ -exhausting.scala:27: error: match may not be exhaustive. +exhausting.scala:27: warning: match may not be exhaustive. It would fail on the following input: Nil def fail2[T](xs: List[T]) = xs match { ^ -exhausting.scala:32: error: match may not be exhaustive. +exhausting.scala:32: warning: match may not be exhaustive. It would fail on the following input: List((x: Int forSome x not in (1, 2))) def fail3a(xs: List[Int]) = xs match { ^ -exhausting.scala:39: error: match may not be exhaustive. +exhausting.scala:39: warning: match may not be exhaustive. It would fail on the following input: Bar3 def fail3[T](x: Foo[T]) = x match { ^ -exhausting.scala:47: error: match may not be exhaustive. +exhausting.scala:47: warning: match may not be exhaustive. It would fail on the following inputs: (Bar1, Bar2), (Bar1, Bar3), (Bar2, Bar1), (Bar2, Bar2) def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { ^ -exhausting.scala:56: error: match may not be exhaustive. +exhausting.scala:56: warning: match may not be exhaustive. It would fail on the following inputs: (Bar1, Bar2), (Bar1, Bar3), (Bar2, Bar1), (Bar2, Bar2) def fail5[T](xx: (Foo[T], Foo[T])) = xx match { ^ -6 errors found +error: No warnings can be incurred under -Xfatal-warnings. +6 warnings found +one error found diff --git a/test/files/neg/gadts1.check b/test/files/neg/gadts1.check index a5e3e0de10..9b7ea5556a 100644 --- a/test/files/neg/gadts1.check +++ b/test/files/neg/gadts1.check @@ -1,8 +1,3 @@ -gadts1.scala:15: error: type mismatch; - found : Test.Double - required: a - case NumTerm(n) => c.x = Double(1.0) - ^ gadts1.scala:20: error: Test.Cell[a] does not take parameters case Cell[a](x: Int) => c.x = 5 ^ @@ -11,4 +6,4 @@ gadts1.scala:20: error: type mismatch; required: a case Cell[a](x: Int) => c.x = 5 ^ -three errors found +two errors found diff --git a/test/files/neg/import-precedence.check b/test/files/neg/import-precedence.check new file mode 100644 index 0000000000..5f99611052 --- /dev/null +++ b/test/files/neg/import-precedence.check @@ -0,0 +1,19 @@ +import-precedence.scala:18: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2._ +and import uniq1.X + object Y { def f = X } + ^ +import-precedence.scala:61: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2._ +and import uniq1._ + object Y { def f = X } + ^ +import-precedence.scala:67: error: reference to X is ambiguous; +it is imported twice in the same scope by +import uniq1.uniq2.X +and import uniq1.X + object Y { def f = X } + ^ +three errors found diff --git a/test/files/neg/import-precedence.scala b/test/files/neg/import-precedence.scala new file mode 100644 index 0000000000..0401635e32 --- /dev/null +++ b/test/files/neg/import-precedence.scala @@ -0,0 +1,68 @@ +package uniq1 { + object X + package uniq2 { + object X + package uniq3 { + object X + package uniq4 { + object X + } + } + } +} + +package p1 { + import uniq1.X + package p2 { + import uniq1.uniq2._ + object Y { def f = X } + } +} + +package p2 { + import uniq1.uniq2._ + package p2 { + import uniq1.X + object Y { def f = X } + } +} + +package p3 { + import uniq1.X + import uniq1.uniq2._ + object Y { def f = X } +} + +package p4 { + import uniq1.uniq2._ + import uniq1.X + object Y { def f = X } +} + +package p5 { + import uniq1.X + package p6 { + import uniq1.uniq2.X + object Y { def f = X } + } +} + +package p6 { + import uniq1._ + package p5 { + import uniq1.uniq2._ + object Y { def f = X } + } +} + +package p7 { + import uniq1._ + import uniq1.uniq2._ + object Y { def f = X } +} + +package p8 { + import uniq1.X + import uniq1.uniq2.X + object Y { def f = X } +} diff --git a/test/files/neg/javaConversions-2.10-ambiguity.check b/test/files/neg/javaConversions-2.10-ambiguity.check deleted file mode 100644 index c064a22964..0000000000 --- a/test/files/neg/javaConversions-2.10-ambiguity.check +++ /dev/null @@ -1,6 +0,0 @@ -javaConversions-2.10-ambiguity.scala:8: error: type mismatch; - found : scala.collection.concurrent.Map[String,String] - required: scala.collection.mutable.ConcurrentMap[String,String] - assertType[mutable.ConcurrentMap[String, String]](a) - ^ -one error found diff --git a/test/files/neg/lubs.check b/test/files/neg/lubs.check index 77ab20102c..affbd4983c 100644 --- a/test/files/neg/lubs.check +++ b/test/files/neg/lubs.check @@ -1,5 +1,10 @@ +lubs.scala:10: error: type mismatch; + found : test1.A[test1.A[Object]] + required: test1.A[test1.A[test1.A[Any]]] + val x3: A[A[A[Any]]] = f + ^ lubs.scala:11: error: type mismatch; - found : test1.A[test1.A[test1.A[Any]]] + found : test1.A[test1.A[Object]] required: test1.A[test1.A[test1.A[test1.A[Any]]]] val x4: A[A[A[A[Any]]]] = f ^ @@ -13,4 +18,4 @@ lubs.scala:25: error: type mismatch; required: test2.A{type T >: Null <: test2.A{type T >: Null <: test2.A{type T >: Null <: test2.A}}} val x4: A { type T >: Null <: A { type T >: Null <: A { type T >: Null <: A } } } = f ^ -three errors found +four errors found diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala index 908438cf65..f9e0ca5077 100644 --- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala +++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala @@ -3,19 +3,19 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) c.Expr[Int](body) } } diff --git a/test/files/neg/macro-deprecate-idents.check b/test/files/neg/macro-deprecate-idents.check index 22b667c390..c653eabaef 100644 --- a/test/files/neg/macro-deprecate-idents.check +++ b/test/files/neg/macro-deprecate-idents.check @@ -1,52 +1,54 @@ -macro-deprecate-idents.scala:2: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:2: warning: macro is now a reserved word; usage as an identifier is deprecated val macro = ??? ^ -macro-deprecate-idents.scala:6: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:6: warning: macro is now a reserved word; usage as an identifier is deprecated var macro = ??? ^ -macro-deprecate-idents.scala:10: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:10: warning: macro is now a reserved word; usage as an identifier is deprecated type macro = Int ^ -macro-deprecate-idents.scala:14: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:14: warning: macro is now a reserved word; usage as an identifier is deprecated class macro ^ -macro-deprecate-idents.scala:18: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:18: warning: macro is now a reserved word; usage as an identifier is deprecated class macro ^ -macro-deprecate-idents.scala:22: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:22: warning: macro is now a reserved word; usage as an identifier is deprecated object macro ^ -macro-deprecate-idents.scala:26: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:26: warning: macro is now a reserved word; usage as an identifier is deprecated object macro ^ -macro-deprecate-idents.scala:30: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:30: warning: macro is now a reserved word; usage as an identifier is deprecated trait macro ^ -macro-deprecate-idents.scala:34: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:34: warning: macro is now a reserved word; usage as an identifier is deprecated trait macro ^ -macro-deprecate-idents.scala:37: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:37: warning: macro is now a reserved word; usage as an identifier is deprecated package macro { ^ -macro-deprecate-idents.scala:38: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:38: warning: macro is now a reserved word; usage as an identifier is deprecated package macro.bar { ^ -macro-deprecate-idents.scala:43: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:43: warning: macro is now a reserved word; usage as an identifier is deprecated package macro.foo { ^ -macro-deprecate-idents.scala:48: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:48: warning: macro is now a reserved word; usage as an identifier is deprecated val Some(macro) = Some(42) ^ -macro-deprecate-idents.scala:49: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:49: warning: macro is now a reserved word; usage as an identifier is deprecated macro match { ^ -macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:50: warning: macro is now a reserved word; usage as an identifier is deprecated case macro => println(macro) ^ -macro-deprecate-idents.scala:50: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:50: warning: macro is now a reserved word; usage as an identifier is deprecated case macro => println(macro) ^ -macro-deprecate-idents.scala:55: error: macro is now a reserved word; usage as an identifier is deprecated +macro-deprecate-idents.scala:55: warning: macro is now a reserved word; usage as an identifier is deprecated def macro = 2 ^ -17 errors found +error: No warnings can be incurred under -Xfatal-warnings. +17 warnings found +one error found diff --git a/test/files/neg/macro-false-deprecation-warning.check b/test/files/neg/macro-false-deprecation-warning.check new file mode 100644 index 0000000000..7d56505ec4 --- /dev/null +++ b/test/files/neg/macro-false-deprecation-warning.check @@ -0,0 +1,4 @@ +Impls_Macros_1.scala:5: error: illegal start of simple expression +} +^ +one error found diff --git a/test/files/neg/macro-false-deprecation-warning.flags b/test/files/neg/macro-false-deprecation-warning.flags new file mode 100644 index 0000000000..59af162db6 --- /dev/null +++ b/test/files/neg/macro-false-deprecation-warning.flags @@ -0,0 +1 @@ +-language:experimental.macros -deprecation
\ No newline at end of file diff --git a/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala b/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala new file mode 100644 index 0000000000..6dc2ea114b --- /dev/null +++ b/test/files/neg/macro-false-deprecation-warning/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.Context + +object Helper { + def unapplySeq[T](x: List[T]): Option[Seq[T]] = +} + +object Macros { + def impl[T: c.WeakTypeTag](c: Context)(x: c.Expr[List[T]]) = { + c.universe.reify(Helper.unapplySeq(x.splice)) + } + + object UnapplyMacro { + def unapplySeq[T](x: List[T]): Option[Seq[T]] = macro impl[T] + } +} diff --git a/test/files/neg/macro-invalidimpl-f/Impls_1.scala b/test/files/neg/macro-invalidimpl-f/Impls_1.scala index 334ee714be..0e4da86d22 100644 --- a/test/files/neg/macro-invalidimpl-f/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-f/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def fooNullary(c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))) c.Expr[Unit](body) } diff --git a/test/files/neg/macro-invalidimpl-g/Impls_1.scala b/test/files/neg/macro-invalidimpl-g/Impls_1.scala index 334ee714be..0e4da86d22 100644 --- a/test/files/neg/macro-invalidimpl-g/Impls_1.scala +++ b/test/files/neg/macro-invalidimpl-g/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def fooNullary(c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))) c.Expr[Unit](body) } diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala index 7a7293422e..8205694768 100644 --- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala @@ -6,9 +6,9 @@ object Impls { import c.{prefix => prefix} import c.universe._ val body = Block(List( - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[U]].tpe))))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo_targs...")))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[U]].tpe))))), Literal(Constant(()))) c.Expr[Unit](body) } diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala index 8d7fdf3e8a..498bd4f18d 100644 --- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala +++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check index 895e0dca50..8c8f039225 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-a.check +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-a.check @@ -1,5 +1,5 @@ Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int; - macro method foo cannot override an abstract method + macro method foo cannot be used here - term macros cannot override abstract methods def foo(x: Int) = macro Impls.impl ^ one error found diff --git a/test/files/neg/macro-override-macro-overrides-abstract-method-b.check b/test/files/neg/macro-override-macro-overrides-abstract-method-b.check index 895e0dca50..8c8f039225 100644 --- a/test/files/neg/macro-override-macro-overrides-abstract-method-b.check +++ b/test/files/neg/macro-override-macro-overrides-abstract-method-b.check @@ -1,5 +1,5 @@ Impls_Macros_1.scala:12: error: overriding method foo in trait Foo of type (x: Int)Int; - macro method foo cannot override an abstract method + macro method foo cannot be used here - term macros cannot override abstract methods def foo(x: Int) = macro Impls.impl ^ one error found diff --git a/test/files/neg/macro-override-method-overrides-macro.check b/test/files/neg/macro-override-method-overrides-macro.check index 66dc11be96..e8cba5d029 100644 --- a/test/files/neg/macro-override-method-overrides-macro.check +++ b/test/files/neg/macro-override-method-overrides-macro.check @@ -1,5 +1,5 @@ Macros_Test_2.scala:8: error: overriding macro method foo in class B of type (x: String)Unit; - method foo cannot override a macro + method foo cannot be used here - only term macros can override term macros override def foo(x: String) = println("fooDString") ^ one error found diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala index ec93dd4111..69ef57d18d 100644 --- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala +++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala @@ -4,7 +4,7 @@ object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) c.Expr[Unit](body) } diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala index 8976f8e28d..c6677c4fde 100644 --- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala @@ -3,16 +3,16 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))) } def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))) } def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))) } }
\ No newline at end of file diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala index 8976f8e28d..c6677c4fde 100644 --- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala +++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala @@ -3,16 +3,16 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))) } def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))) } def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))) + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))) } }
\ No newline at end of file diff --git a/test/files/neg/main1.check b/test/files/neg/main1.check index 1a7a13e1e9..b745105818 100644 --- a/test/files/neg/main1.check +++ b/test/files/neg/main1.check @@ -1,26 +1,28 @@ -main1.scala:3: error: Foo has a main method with parameter type Array[String], but foo1.Foo will not be a runnable program. +main1.scala:3: warning: Foo has a main method with parameter type Array[String], but foo1.Foo will not be a runnable program. Reason: companion is a trait, which means no static forwarder can be generated. object Foo { // companion is trait ^ -main1.scala:10: error: Foo has a main method with parameter type Array[String], but foo2.Foo will not be a runnable program. +main1.scala:10: warning: Foo has a main method with parameter type Array[String], but foo2.Foo will not be a runnable program. Reason: companion contains its own main method, which means no static forwarder can be generated. object Foo { // companion has its own main ^ -main1.scala:22: error: Foo has a main method with parameter type Array[String], but foo3.Foo will not be a runnable program. +main1.scala:22: warning: Foo has a main method with parameter type Array[String], but foo3.Foo 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. object Foo { // Companion contains main, but not an interfering main. ^ -main1.scala:31: error: Foo has a main method with parameter type Array[String], but foo4.Foo will not be a runnable program. +main1.scala:31: warning: Foo has a main method with parameter type Array[String], but foo4.Foo will not be a runnable program. Reason: companion contains its own main method, which means no static forwarder can be generated. object Foo extends Foo { // Inherits main from the class ^ -main1.scala:39: error: Foo has a main method with parameter type Array[String], but foo5.Foo will not be a runnable program. +main1.scala:39: warning: Foo has a main method with parameter type Array[String], but foo5.Foo will not be a runnable program. Reason: companion contains its own main method, which means no static forwarder can be generated. object Foo extends Foo { // Overrides main from the class ^ -5 errors found +error: No warnings can be incurred under -Xfatal-warnings. +5 warnings found +one error found diff --git a/test/files/neg/migration28.check b/test/files/neg/migration28.check index d7dfacf3db..afb4db62e2 100644 --- a/test/files/neg/migration28.check +++ b/test/files/neg/migration28.check @@ -1,5 +1,7 @@ -migration28.scala:4: error: method scanRight in trait TraversableLike has changed semantics in version 2.9.0: +migration28.scala:4: warning: method scanRight in trait TraversableLike has changed semantics in version 2.9.0: The behavior of `scanRight` has changed. The previous behavior can be reproduced with scanRight.reverse. List(1,2,3,4,5).scanRight(0)(_+_) ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/names-defaults-neg-warn.check b/test/files/neg/names-defaults-neg-warn.check index e1085acf76..0f4edef84e 100644 --- a/test/files/neg/names-defaults-neg-warn.check +++ b/test/files/neg/names-defaults-neg-warn.check @@ -1,7 +1,9 @@ -names-defaults-neg-warn.scala:11: error: the parameter name s has been deprecated. Use x instead. +names-defaults-neg-warn.scala:11: warning: the parameter name s has been deprecated. Use x instead. deprNam2.f(s = "dlfkj") ^ -names-defaults-neg-warn.scala:12: error: the parameter name x has been deprecated. Use s instead. +names-defaults-neg-warn.scala:12: warning: the parameter name x has been deprecated. Use s instead. deprNam2.g(x = "dlkjf") ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/newpat_unreachable.check b/test/files/neg/newpat_unreachable.check index 08453cac19..a928e3853a 100644 --- a/test/files/neg/newpat_unreachable.check +++ b/test/files/neg/newpat_unreachable.check @@ -1,27 +1,29 @@ -newpat_unreachable.scala:6: error: patterns after a variable pattern cannot match (SLS 8.1.1) +newpat_unreachable.scala:6: warning: patterns after a variable pattern cannot match (SLS 8.1.1) If you intended to match against parameter b of method contrivedExample, you must use backticks, like: case `b` => case b => println("matched b") ^ -newpat_unreachable.scala:7: error: unreachable code due to variable pattern 'b' on line 6 +newpat_unreachable.scala:7: warning: unreachable code due to variable pattern 'b' on line 6 If you intended to match against parameter c of method contrivedExample, you must use backticks, like: case `c` => case c => println("matched c") ^ -newpat_unreachable.scala:8: error: unreachable code due to variable pattern 'b' on line 6 +newpat_unreachable.scala:8: warning: unreachable code due to variable pattern 'b' on line 6 If you intended to match against value d in class A, you must use backticks, like: case `d` => case d => println("matched d") ^ -newpat_unreachable.scala:9: error: unreachable code due to variable pattern 'b' on line 6 +newpat_unreachable.scala:9: warning: unreachable code due to variable pattern 'b' on line 6 case _ => println("matched neither") ^ -newpat_unreachable.scala:22: error: patterns after a variable pattern cannot match (SLS 8.1.1) +newpat_unreachable.scala:22: warning: patterns after a variable pattern cannot match (SLS 8.1.1) If you intended to match against parameter b of method g, you must use backticks, like: case `b` => case b => 1 ^ -newpat_unreachable.scala:23: error: unreachable code due to variable pattern 'b' on line 22 +newpat_unreachable.scala:23: warning: unreachable code due to variable pattern 'b' on line 22 If you intended to match against parameter c of method h, you must use backticks, like: case `c` => case c => 2 ^ -newpat_unreachable.scala:24: error: unreachable code due to variable pattern 'b' on line 22 +newpat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22 case _ => 3 ^ -7 errors found +error: No warnings can be incurred under -Xfatal-warnings. +7 warnings found +one error found diff --git a/test/files/neg/nonlocal-warning.check b/test/files/neg/nonlocal-warning.check new file mode 100644 index 0000000000..5202df655a --- /dev/null +++ b/test/files/neg/nonlocal-warning.check @@ -0,0 +1,9 @@ +nonlocal-warning.scala:4: warning: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning. + catch { case x => 11 } + ^ +nonlocal-warning.scala:2: warning: catch block may intercept non-local return from method foo + def foo(l: List[Int]): Int = { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/pending/pos/t4649.flags b/test/files/neg/nonlocal-warning.flags index e8fb65d50c..e8fb65d50c 100644 --- a/test/pending/pos/t4649.flags +++ b/test/files/neg/nonlocal-warning.flags diff --git a/test/files/neg/nonlocal-warning.scala b/test/files/neg/nonlocal-warning.scala new file mode 100644 index 0000000000..f908a86302 --- /dev/null +++ b/test/files/neg/nonlocal-warning.scala @@ -0,0 +1,18 @@ +class Foo { + def foo(l: List[Int]): Int = { + try l foreach { _ => return 5 } + catch { case x => 11 } + 22 + } + + val pf: PartialFunction[Throwable, Unit] = { + case x if false => () + } + + def bar(l: List[Int]): Int = { + try l foreach { _ => return 5 } + catch pf + finally println() + 22 + } +} diff --git a/test/files/neg/nullary-override.check b/test/files/neg/nullary-override.check index 6b2ded2d4a..f032f4a6c2 100644 --- a/test/files/neg/nullary-override.check +++ b/test/files/neg/nullary-override.check @@ -1,4 +1,6 @@ -nullary-override.scala:2: error: non-nullary method overrides nullary method +nullary-override.scala:2: warning: non-nullary method overrides nullary method class B extends A { override def x(): Int = 4 } ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/overloaded-implicit.check b/test/files/neg/overloaded-implicit.check index bdbe6a89d5..ca0870705d 100644 --- a/test/files/neg/overloaded-implicit.check +++ b/test/files/neg/overloaded-implicit.check @@ -1,7 +1,9 @@ -overloaded-implicit.scala:2: error: parameterized overloaded implicit methods are not visible as view bounds +overloaded-implicit.scala:2: warning: parameterized overloaded implicit methods are not visible as view bounds implicit def imp1[T](x: List[T]): Map[T, T] = Map() ^ -overloaded-implicit.scala:3: error: parameterized overloaded implicit methods are not visible as view bounds +overloaded-implicit.scala:3: warning: parameterized overloaded implicit methods are not visible as view bounds implicit def imp1[T](x: Set[T]): Map[T, T] = Map() ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/overloaded-implicit.flags b/test/files/neg/overloaded-implicit.flags index 7949c2afa2..9c1e74e4ef 100644 --- a/test/files/neg/overloaded-implicit.flags +++ b/test/files/neg/overloaded-implicit.flags @@ -1 +1 @@ --Xlint -Xfatal-warnings +-Xlint -Xfatal-warnings -Xdev diff --git a/test/files/neg/package-ob-case.check b/test/files/neg/package-ob-case.check index e6b2f858ef..9031ad13e7 100644 --- a/test/files/neg/package-ob-case.check +++ b/test/files/neg/package-ob-case.check @@ -1,5 +1,9 @@ -package-ob-case.scala:3: error: it is not recommended to define classes/objects inside of package objects. +package-ob-case.scala:3: warning: it is not recommended to define classes/objects inside of package objects. If possible, define class X in package foo instead. case class X(z: Int) { } ^ +package-ob-case.scala:3: error: implementation restriction: package object foo cannot contain case class X. Instead, class X should be placed directly in package foo. + case class X(z: Int) { } + ^ +one warning found one error found diff --git a/test/files/neg/pat_unreachable.check b/test/files/neg/pat_unreachable.check index c5706b7fad..b4c0e7e104 100644 --- a/test/files/neg/pat_unreachable.check +++ b/test/files/neg/pat_unreachable.check @@ -1,13 +1,14 @@ -pat_unreachable.scala:5: error: unreachable code - case Seq(x, y, z, w) => List(z,w) // redundant! - ^ -pat_unreachable.scala:9: error: unreachable code - case Seq(x, y) => List(x, y) - ^ -pat_unreachable.scala:23: error: unreachable code +pat_unreachable.scala:22: warning: patterns after a variable pattern cannot match (SLS 8.1.1) +If you intended to match against parameter b of method contrivedExample, you must use backticks, like: case `b` => + case b => println("matched b") + ^ +pat_unreachable.scala:23: warning: unreachable code due to variable pattern 'b' on line 22 +If you intended to match against parameter c of method contrivedExample, you must use backticks, like: case `c` => case c => println("matched c") ^ -pat_unreachable.scala:24: error: unreachable code +pat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22 case _ => println("matched neither") ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/pat_unreachable.flags b/test/files/neg/pat_unreachable.flags index cb8324a345..85d8eb2ba2 100644 --- a/test/files/neg/pat_unreachable.flags +++ b/test/files/neg/pat_unreachable.flags @@ -1 +1 @@ --Xoldpatmat
\ No newline at end of file +-Xfatal-warnings diff --git a/test/files/neg/patmat-type-check.check b/test/files/neg/patmat-type-check.check index 721217c314..fedac3b746 100644 --- a/test/files/neg/patmat-type-check.check +++ b/test/files/neg/patmat-type-check.check @@ -1,12 +1,27 @@ patmat-type-check.scala:11: warning: fruitless type test: a value of type Test.Bop4[T] cannot also be a Seq[A] def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true } ^ +patmat-type-check.scala:11: error: pattern type is incompatible with expected type; + found : Seq[A] + required: Test.Bop4[T] + def s3[T](x: Bop4[T]) = x match { case Seq('b', 'o', 'b') => true } + ^ patmat-type-check.scala:15: warning: fruitless type test: a value of type Test.Bop5[_$1,T1,T2] cannot also be a Seq[A] def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true } ^ +patmat-type-check.scala:15: error: pattern type is incompatible with expected type; + found : Seq[A] + required: Test.Bop5[_$1,T1,T2] where type _$1 + def s4[T1, T2](x: Bop5[_, T1, T2]) = x match { case Seq('b', 'o', 'b') => true } + ^ patmat-type-check.scala:19: warning: fruitless type test: a value of type Test.Bop3[T] cannot also be a Seq[A] def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true } ^ +patmat-type-check.scala:19: error: pattern type is incompatible with expected type; + found : Seq[A] + required: Test.Bop3[T] + def f4[T](x: Bop3[T]) = x match { case Seq('b', 'o', 'b') => true } + ^ patmat-type-check.scala:22: error: scrutinee is incompatible with pattern type; found : Seq[A] required: String @@ -28,4 +43,4 @@ patmat-type-check.scala:30: error: scrutinee is incompatible with pattern type; def f4[T](x: Bop3[Char]) = x match { case Seq('b', 'o', 'b') => true } // fail ^ three warnings found -four errors found +7 errors found diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 4556e6622f..6069dfdaab 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -1,40 +1,42 @@ -patmatexhaust.scala:7: error: match may not be exhaustive. +patmatexhaust.scala:7: warning: match may not be exhaustive. It would fail on the following input: Baz def ma1(x:Foo) = x match { ^ -patmatexhaust.scala:11: error: match may not be exhaustive. +patmatexhaust.scala:11: warning: match may not be exhaustive. It would fail on the following input: Bar(_) def ma2(x:Foo) = x match { ^ -patmatexhaust.scala:23: error: match may not be exhaustive. +patmatexhaust.scala:23: warning: match may not be exhaustive. It would fail on the following inputs: (Kult(_), Kult(_)), (Qult(), Qult()) def ma3(x:Mult) = (x,x) match { // not exhaustive ^ -patmatexhaust.scala:49: error: match may not be exhaustive. +patmatexhaust.scala:49: warning: match may not be exhaustive. It would fail on the following inputs: Gp(), Gu def ma4(x:Deep) = x match { // missing cases: Gu, Gp ^ -patmatexhaust.scala:55: error: unreachable code +patmatexhaust.scala:55: warning: unreachable code case _ if 1 == 0 => ^ -patmatexhaust.scala:53: error: match may not be exhaustive. +patmatexhaust.scala:53: warning: match may not be exhaustive. It would fail on the following input: Gp() def ma5(x:Deep) = x match { ^ -patmatexhaust.scala:75: error: match may not be exhaustive. +patmatexhaust.scala:75: warning: match may not be exhaustive. It would fail on the following input: B() def ma9(x: B) = x match { ^ -patmatexhaust.scala:100: error: match may not be exhaustive. +patmatexhaust.scala:100: warning: match may not be exhaustive. It would fail on the following input: C1() def ma10(x: C) = x match { // not exhaustive: C1 is not sealed. ^ -patmatexhaust.scala:114: error: match may not be exhaustive. +patmatexhaust.scala:114: warning: match may not be exhaustive. It would fail on the following inputs: D1, D2() def ma10(x: C) = x match { // not exhaustive: C1 has subclasses. ^ -patmatexhaust.scala:126: error: match may not be exhaustive. +patmatexhaust.scala:126: warning: match may not be exhaustive. It would fail on the following input: C1() def ma10(x: C) = x match { // not exhaustive: C1 is not abstract. ^ -10 errors found +error: No warnings can be incurred under -Xfatal-warnings. +10 warnings found +one error found diff --git a/test/files/neg/permanent-blindness.check b/test/files/neg/permanent-blindness.check index 18b4543707..cdde201ef6 100644 --- a/test/files/neg/permanent-blindness.check +++ b/test/files/neg/permanent-blindness.check @@ -1,10 +1,12 @@ -permanent-blindness.scala:10: error: imported `Bippy' is permanently hidden by definition of class Bippy in package bar +permanent-blindness.scala:10: warning: imported `Bippy' is permanently hidden by definition of class Bippy in package bar import foo.{ Bippy, Bop, Dingus } ^ -permanent-blindness.scala:10: error: imported `Bop' is permanently hidden by definition of object Bop in package bar +permanent-blindness.scala:10: warning: imported `Bop' is permanently hidden by definition of object Bop in package bar import foo.{ Bippy, Bop, Dingus } ^ -permanent-blindness.scala:10: error: imported `Dingus' is permanently hidden by definition of object Dingus in package bar +permanent-blindness.scala:10: warning: imported `Dingus' is permanently hidden by definition of object Dingus in package bar import foo.{ Bippy, Bop, Dingus } ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/sealed-final-neg.check b/test/files/neg/sealed-final-neg.check new file mode 100644 index 0000000000..500d23f49a --- /dev/null +++ b/test/files/neg/sealed-final-neg.check @@ -0,0 +1,4 @@ +sealed-final-neg.scala:41: error: expected class or object definition +"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed." +^ +one error found diff --git a/test/files/neg/sealed-final-neg.flags b/test/files/neg/sealed-final-neg.flags new file mode 100644 index 0000000000..cfabf7a5b4 --- /dev/null +++ b/test/files/neg/sealed-final-neg.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Yinline-warnings -optimise
\ No newline at end of file diff --git a/test/files/neg/sealed-final-neg.scala b/test/files/neg/sealed-final-neg.scala new file mode 100644 index 0000000000..bc25330e13 --- /dev/null +++ b/test/files/neg/sealed-final-neg.scala @@ -0,0 +1,41 @@ +package neg1 { + sealed abstract class Foo { + @inline def bar(x: Int) = x + 1 + } + object Foo { + def mkFoo(): Foo = new Baz2 + } + + object Baz1 extends Foo + final class Baz2 extends Foo + final class Baz3 extends Foo { + override def bar(x: Int) = x - 1 + } + + object Test { + // bar can't be inlined - it is overridden in Baz3 + def f = Foo.mkFoo() bar 10 + } +} + +package neg2 { + sealed abstract class Foo { + @inline def bar(x: Int) = x + 1 + } + object Foo { + def mkFoo(): Foo = new Baz2 + } + + object Baz1 extends Foo + final class Baz2 extends Foo + class Baz3 extends Foo { + override def bar(x: Int) = x - 1 + } + + object Test { + // bar can't be inlined - Baz3 is not final + def f = Foo.mkFoo() bar 10 + } +} + +"Due to SI-6142 this emits no warnings, so we'll just break it until that's fixed." diff --git a/test/files/neg/sealed-java-enums.check b/test/files/neg/sealed-java-enums.check index 20d00c8e91..a3c39ec5cd 100644 --- a/test/files/neg/sealed-java-enums.check +++ b/test/files/neg/sealed-java-enums.check @@ -1,5 +1,7 @@ -sealed-java-enums.scala:5: error: match may not be exhaustive. +sealed-java-enums.scala:5: warning: match may not be exhaustive. It would fail on the following inputs: BLOCKED, TERMINATED, TIMED_WAITING def f(state: State) = state match { ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/serialversionuid-not-const.check b/test/files/neg/serialversionuid-not-const.check new file mode 100644 index 0000000000..9c383d97ad --- /dev/null +++ b/test/files/neg/serialversionuid-not-const.check @@ -0,0 +1,10 @@ +serialversionuid-not-const.scala:1: error: annotation argument needs to be a constant; found: 13L.toLong +@SerialVersionUID(13l.toLong) class C1 extends Serializable + ^ +serialversionuid-not-const.scala:3: error: annotation argument needs to be a constant; found: 13.asInstanceOf[Long] +@SerialVersionUID(13.asInstanceOf[Long]) class C3 extends Serializable + ^ +serialversionuid-not-const.scala:4: error: annotation argument needs to be a constant; found: Test.bippy +@SerialVersionUID(Test.bippy) class C4 extends Serializable + ^ +three errors found diff --git a/test/files/neg/serialversionuid-not-const.scala b/test/files/neg/serialversionuid-not-const.scala new file mode 100644 index 0000000000..f0e3ef4e7e --- /dev/null +++ b/test/files/neg/serialversionuid-not-const.scala @@ -0,0 +1,16 @@ +@SerialVersionUID(13l.toLong) class C1 extends Serializable +@SerialVersionUID(13l) class C2 extends Serializable +@SerialVersionUID(13.asInstanceOf[Long]) class C3 extends Serializable +@SerialVersionUID(Test.bippy) class C4 extends Serializable + +object Test { + val bippy = 13L + + def show(c: Class[_]) = println(java.io.ObjectStreamClass.lookup(c).getSerialVersionUID) + def main(args: Array[String]): Unit = { + show(classOf[C1]) + show(classOf[C2]) + show(classOf[C3]) + show(classOf[C4]) + } +} diff --git a/test/files/neg/stmt-expr-discard.check b/test/files/neg/stmt-expr-discard.check index 2d6420a61d..1207e6da50 100644 --- a/test/files/neg/stmt-expr-discard.check +++ b/test/files/neg/stmt-expr-discard.check @@ -1,7 +1,9 @@ -stmt-expr-discard.scala:3: error: a pure expression does nothing in statement position; you may be omitting necessary parentheses +stmt-expr-discard.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 2 ^ -stmt-expr-discard.scala:4: error: a pure expression does nothing in statement position; you may be omitting necessary parentheses +stmt-expr-discard.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses - 4 ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/switch.check b/test/files/neg/switch.check index e4730b6459..f968d3a448 100644 --- a/test/files/neg/switch.check +++ b/test/files/neg/switch.check @@ -1,7 +1,9 @@ -switch.scala:38: error: could not emit switch for @switch annotated match +switch.scala:38: warning: could not emit switch for @switch annotated match def fail2(c: Char) = (c: @switch @unchecked) match { ^ -switch.scala:45: error: could not emit switch for @switch annotated match +switch.scala:45: warning: could not emit switch for @switch annotated match def fail3(c: Char) = (c: @unchecked @switch) match { ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t1224.check b/test/files/neg/t1224.check index fb61275911..ab8a6f1130 100644 --- a/test/files/neg/t1224.check +++ b/test/files/neg/t1224.check @@ -1,4 +1,4 @@ -t1224.scala:4: error: illegal cyclic reference involving type T +t1224.scala:4: error: lower bound C[A.this.T] does not conform to upper bound C[C[A.this.T]] type T >: C[T] <: C[C[T]] ^ one error found diff --git a/test/files/neg/t1224.flags b/test/files/neg/t1224.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/neg/t1224.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/neg/t2442.check b/test/files/neg/t2442.check index 714816fd62..9ff0b44661 100644 --- a/test/files/neg/t2442.check +++ b/test/files/neg/t2442.check @@ -1,9 +1,11 @@ -t2442.scala:4: error: match may not be exhaustive. +t2442.scala:4: warning: match may not be exhaustive. It would fail on the following input: THREE def f(e: MyEnum) = e match { ^ -t2442.scala:11: error: match may not be exhaustive. +t2442.scala:11: warning: match may not be exhaustive. It would fail on the following input: BLUE def g(e: MySecondEnum) = e match { ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t2796.check b/test/files/neg/t2796.check index aeb18497ed..4456a7fc19 100644 --- a/test/files/neg/t2796.check +++ b/test/files/neg/t2796.check @@ -1,4 +1,6 @@ -t2796.scala:7: error: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. +t2796.scala:7: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. val abstractVal = "T1.abstractVal" // warn ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t2968.check b/test/files/neg/t2968.check new file mode 100644 index 0000000000..5d2387f98c --- /dev/null +++ b/test/files/neg/t2968.check @@ -0,0 +1,10 @@ +t2968.scala:8: error: Missing closing brace `}' assumed here +} // missing brace +^ +t2968.scala:17: error: Missing closing brace `}' assumed here +} // missing brace +^ +t2968.scala:26: error: Missing closing brace `}' assumed here +} // missing brace +^ +three errors found diff --git a/test/files/neg/t2968.scala b/test/files/neg/t2968.scala new file mode 100644 index 0000000000..41c3a798a5 --- /dev/null +++ b/test/files/neg/t2968.scala @@ -0,0 +1,26 @@ +object t1 { + case object Const { + } + + class Var + { + +} // missing brace + +object t2 { + case class Const() { + } + + class Var + { + +} // missing brace + +object t3 { + final case class Const() { + } + + class Var + { + +} // missing brace diff --git a/test/files/neg/t2968b.check b/test/files/neg/t2968b.check new file mode 100644 index 0000000000..36d25a2d12 --- /dev/null +++ b/test/files/neg/t2968b.check @@ -0,0 +1,4 @@ +t2968b.scala:7: error: '}' expected but eof found. +// missing brace + ^ +one error found diff --git a/test/files/neg/t2968b.scala b/test/files/neg/t2968b.scala new file mode 100644 index 0000000000..422b618aba --- /dev/null +++ b/test/files/neg/t2968b.scala @@ -0,0 +1,7 @@ +case class Const() +{ +} + +class Var +{ +// missing brace diff --git a/test/files/neg/t3098.check b/test/files/neg/t3098.check index 85829747b9..5343b128f0 100644 --- a/test/files/neg/t3098.check +++ b/test/files/neg/t3098.check @@ -1,5 +1,7 @@ -b.scala:3: error: match may not be exhaustive. +b.scala:3: warning: match may not be exhaustive. It would fail on the following input: (_ : C) def f = (null: T) match { ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t3160ambiguous.check b/test/files/neg/t3160ambiguous.check new file mode 100644 index 0000000000..e80d9a5461 --- /dev/null +++ b/test/files/neg/t3160ambiguous.check @@ -0,0 +1,7 @@ +t3160ambiguous.scala:8: error: reference to Node is ambiguous; +it is imported twice in the same scope by +import scala.xml._ +and import Bippy._ + def f(x: Node): String = ??? // ambiguous, because Bippy.Node is accessible + ^ +one error found diff --git a/test/files/neg/t3160ambiguous.scala b/test/files/neg/t3160ambiguous.scala new file mode 100644 index 0000000000..cb9759b79c --- /dev/null +++ b/test/files/neg/t3160ambiguous.scala @@ -0,0 +1,15 @@ +object Bippy { + private class Node +} +class Bippy { + import Bippy._ + import scala.xml._ + + def f(x: Node): String = ??? // ambiguous, because Bippy.Node is accessible +} +class Other { + import Bippy._ + import scala.xml._ + + def f(x: Node): String = ??? // unambiguous, because Bippy.Node is inaccessible +} diff --git a/test/files/neg/t3224.check b/test/files/neg/t3224.check index 29304c567a..69b02c8862 100644 --- a/test/files/neg/t3224.check +++ b/test/files/neg/t3224.check @@ -1,6 +1,26 @@ -t3224.scala:29: error: polymorphic expression cannot be instantiated to expected type; +t3224.scala:30: error: polymorphic expression cannot be instantiated to expected type; found : [T]Array[T] required: List[?] - println(Texts textL Array()); println(Texts textL Array(1)); println(Texts textL Array(1, 1)) - ^ -one error found + println(Texts textL Array()) + ^ +t3224.scala:34: error: type mismatch; + found : List[Nothing] + required: Array[?] + println(Texts textA List()) + ^ +t3224.scala:35: error: type mismatch; + found : List[Int] + required: Array[?] + println(Texts textA List(1)) + ^ +t3224.scala:36: error: type mismatch; + found : List[Int] + required: Array[?] + println(Texts textA List(1, 1)); + ^ +t3224.scala:48: error: polymorphic expression cannot be instantiated to expected type; + found : [T]Array[T] + required: List[?] + assert(size(Array()) == 0) + ^ +5 errors found diff --git a/test/files/neg/t3224.scala b/test/files/neg/t3224.scala index 774de3335a..b7af8a67b5 100755 --- a/test/files/neg/t3224.scala +++ b/test/files/neg/t3224.scala @@ -1,30 +1,50 @@ object Texts{ - def textL[T](list: List[T]) = { - list match{ - case List() => "Empty" - case List(_) => "One" + def textL[T](list: List[T]) = { + list match{ + case List() => "Empty" + case List(_) => "One" case List(_*) => "Many" } } - def textA[T](array: Array[T]) = { - array match{ - case Array() => "Empty" - case Array(_) => "One" + def textA[T](array: Array[T]) = { + array match{ + case Array() => "Empty" + case Array(_) => "One" case Array(_*) => "Many" } } } object Test extends App { + { + implicit def array2list[T](array: Array[T]) = { + println(array.toList.size) + array.toList + } + + println(Texts textL List()) + println(Texts textL List(1)) + println(Texts textL List(1, 1)); + + println(Texts textL Array()) + println(Texts textL Array(1)) + println(Texts textL Array(1, 1)) - implicit def array2list[T](array: Array[T]) = { - println(array.toList.size) - array.toList + println(Texts textA List()) + println(Texts textA List(1)) + println(Texts textA List(1, 1)); + + println(Texts textA Array()) + println(Texts textA Array(1)) + println(Texts textA Array(1, 1)) } - - println(Texts textL List()); println(Texts textL List(1)); println(Texts textL List(1, 1)); + { + implicit def array2list[T](array: Array[T]) = array.toList + def size[T](list: List[T]) = list.size - println(Texts textL Array()); println(Texts textL Array(1)); println(Texts textL Array(1, 1)) + assert(size(array2list(Array())) == 0) + assert(size(Array()) == 0) + } } diff --git a/test/files/neg/t3234.check b/test/files/neg/t3234.check index 477b021e5e..8f0d624ed9 100644 --- a/test/files/neg/t3234.check +++ b/test/files/neg/t3234.check @@ -1,2 +1,6 @@ -error: there were 1 inliner warnings; re-run with -Yinline-warnings for details +t3234.scala:17: warning: At the end of the day, could not inline @inline-marked method foo3 + println(foo(42) + foo2(11) + foo3(2)) + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t3234.flags b/test/files/neg/t3234.flags index c9cefdc4b9..cc3d9fb6f0 100644 --- a/test/files/neg/t3234.flags +++ b/test/files/neg/t3234.flags @@ -1 +1 @@ --Yinline -Xfatal-warnings
\ No newline at end of file +-Yinline -Yinline-warnings -Xfatal-warnings diff --git a/test/files/neg/t3683a.check b/test/files/neg/t3683a.check index 3de3ad784e..6386265ebc 100644 --- a/test/files/neg/t3683a.check +++ b/test/files/neg/t3683a.check @@ -1,5 +1,7 @@ -t3683a.scala:14: error: match may not be exhaustive. +t3683a.scala:14: warning: match may not be exhaustive. It would fail on the following input: XX() w match { ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check index 5aa991c105..9b96449930 100644 --- a/test/files/neg/t3692-new.check +++ b/test/files/neg/t3692-new.check @@ -7,8 +7,13 @@ t3692-new.scala:15: warning: non-variable type argument Int in type pattern Map[ t3692-new.scala:16: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure case m2: Map[T, Int] => new java.util.HashMap[T, Integer] ^ -t3692-new.scala:16: error: unreachable code - case m2: Map[T, Int] => new java.util.HashMap[T, Integer] +t3692-new.scala:15: warning: unreachable code + case m1: Map[Int, V] => new java.util.HashMap[Integer, V] ^ -three warnings found +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 { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +5 warnings found one error found diff --git a/test/files/neg/t3692-new.flags b/test/files/neg/t3692-new.flags index cb8324a345..85d8eb2ba2 100644 --- a/test/files/neg/t3692-new.flags +++ b/test/files/neg/t3692-new.flags @@ -1 +1 @@ --Xoldpatmat
\ No newline at end of file +-Xfatal-warnings diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check deleted file mode 100644 index 9f3ae516aa..0000000000 --- a/test/files/neg/t3692-old.check +++ /dev/null @@ -1,14 +0,0 @@ -t3692-old.scala:13: warning: non-variable type argument Int in type pattern Map[Int,Int] is unchecked since it is eliminated by erasure - case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] - ^ -t3692-old.scala:14: warning: non-variable type argument Int in type pattern Map[Int,V] is unchecked since it is eliminated by erasure - case m1: Map[Int, V] => new java.util.HashMap[Integer, V] - ^ -t3692-old.scala:15: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure - case m2: Map[T, Int] => new java.util.HashMap[T, Integer] - ^ -t3692-old.scala:15: error: unreachable code - case m2: Map[T, Int] => new java.util.HashMap[T, Integer] - ^ -three warnings found -one error found diff --git a/test/files/neg/t3692-old.flags b/test/files/neg/t3692-old.flags deleted file mode 100644 index cb8324a345..0000000000 --- a/test/files/neg/t3692-old.flags +++ /dev/null @@ -1 +0,0 @@ --Xoldpatmat
\ No newline at end of file diff --git a/test/files/neg/t3692-old.scala b/test/files/neg/t3692-old.scala deleted file mode 100644 index 151535ae94..0000000000 --- a/test/files/neg/t3692-old.scala +++ /dev/null @@ -1,19 +0,0 @@ -import java.lang.Integer - -object ManifestTester { - def main(args: Array[String]) = { - val map = Map("John" -> 1, "Josh" -> 2) - new ManifestTester().toJavaMap(map) - } -} - -class ManifestTester { - private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { - map match { - case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] - case m1: Map[Int, V] => new java.util.HashMap[Integer, V] - case m2: Map[T, Int] => new java.util.HashMap[T, Integer] - case _ => new java.util.HashMap[T, V] - } - } -}
\ No newline at end of file diff --git a/test/files/neg/t4302.check b/test/files/neg/t4302.check index 450d28bbc5..ea48729276 100644 --- a/test/files/neg/t4302.check +++ b/test/files/neg/t4302.check @@ -1,4 +1,6 @@ -t4302.scala:2: error: abstract type T is unchecked since it is eliminated by erasure +t4302.scala:2: warning: abstract type T is unchecked since it is eliminated by erasure def hasMatch[T](x: AnyRef) = x.isInstanceOf[T] ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t4440.check b/test/files/neg/t4440.check index 2861dc3040..10e7188e32 100644 --- a/test/files/neg/t4440.check +++ b/test/files/neg/t4440.check @@ -1,13 +1,15 @@ -t4440.scala:12: error: The outer reference in this type test cannot be checked at run time. +t4440.scala:12: warning: The outer reference in this type test cannot be checked at run time. case _: b.Inner => println("b") ^ -t4440.scala:13: error: The outer reference in this type test cannot be checked at run time. +t4440.scala:13: warning: The outer reference in this type test cannot be checked at run time. case _: a.Inner => println("a") // this is the case we want ^ -t4440.scala:16: error: The outer reference in this type test cannot be checked at run time. +t4440.scala:16: warning: The outer reference in this type test cannot be checked at run time. case _: a.Inner => println("a") ^ -t4440.scala:17: error: The outer reference in this type test cannot be checked at run time. +t4440.scala:17: warning: The outer reference in this type test cannot be checked at run time. case _: b.Inner => println("b") // this is the case we want ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t4460a.check b/test/files/neg/t4460a.check new file mode 100644 index 0000000000..b711e7acb1 --- /dev/null +++ b/test/files/neg/t4460a.check @@ -0,0 +1,4 @@ +t4460a.scala:6: error: called constructor's definition must precede calling constructor's definition + def this() = this() // was binding to Predef.<init> !! + ^ +one error found diff --git a/test/files/neg/t4460a.scala b/test/files/neg/t4460a.scala new file mode 100644 index 0000000000..0a7a22178d --- /dev/null +++ b/test/files/neg/t4460a.scala @@ -0,0 +1,7 @@ +trait A + +class B(val x: Int) { + self: A => + + def this() = this() // was binding to Predef.<init> !! +} diff --git a/test/files/neg/t4460b.check b/test/files/neg/t4460b.check new file mode 100644 index 0000000000..f0e703fd10 --- /dev/null +++ b/test/files/neg/t4460b.check @@ -0,0 +1,4 @@ +t4460b.scala:7: error: called constructor's definition must precede calling constructor's definition + def this() = this() // was binding to Predef.<init> !! + ^ +one error found diff --git a/test/files/neg/t4460b.scala b/test/files/neg/t4460b.scala new file mode 100644 index 0000000000..1233017dd4 --- /dev/null +++ b/test/files/neg/t4460b.scala @@ -0,0 +1,9 @@ +trait A + +class Outer() { + class B(val x: Int) { + self: A => + + def this() = this() // was binding to Predef.<init> !! + } +} diff --git a/test/files/neg/t4460c.check b/test/files/neg/t4460c.check new file mode 100644 index 0000000000..4e96711b8b --- /dev/null +++ b/test/files/neg/t4460c.check @@ -0,0 +1,7 @@ +t4460c.scala:4: error: overloaded method constructor B with alternatives: + (a: String)B <and> + (x: Int)B + cannot be applied to () + def this(a: String) = this() + ^ +one error found diff --git a/test/files/neg/t4460c.scala b/test/files/neg/t4460c.scala new file mode 100644 index 0000000000..1ae258508e --- /dev/null +++ b/test/files/neg/t4460c.scala @@ -0,0 +1,7 @@ +class B(val x: Int) { + self: A => + + def this(a: String) = this() +} + +class A() diff --git a/test/files/neg/t4537.check b/test/files/neg/t4537.check deleted file mode 100644 index 931bcd0405..0000000000 --- a/test/files/neg/t4537.check +++ /dev/null @@ -1,4 +0,0 @@ -c.scala:7: error: object Settings in package a cannot be accessed in package a - println(Settings.Y) - ^ -one error found diff --git a/test/files/neg/t4537/c.scala b/test/files/neg/t4537/c.scala deleted file mode 100644 index 379599112d..0000000000 --- a/test/files/neg/t4537/c.scala +++ /dev/null @@ -1,8 +0,0 @@ -package b -package c - -import a._ - -object Test { - println(Settings.Y) -}
\ No newline at end of file diff --git a/test/files/neg/t4691_exhaust_extractor.check b/test/files/neg/t4691_exhaust_extractor.check index cd12e56f86..6396944145 100644 --- a/test/files/neg/t4691_exhaust_extractor.check +++ b/test/files/neg/t4691_exhaust_extractor.check @@ -1,13 +1,15 @@ -t4691_exhaust_extractor.scala:17: error: match may not be exhaustive. +t4691_exhaust_extractor.scala:17: warning: match may not be exhaustive. It would fail on the following input: Bar3() def f1(x: Foo) = x match { ^ -t4691_exhaust_extractor.scala:23: error: match may not be exhaustive. +t4691_exhaust_extractor.scala:23: warning: match may not be exhaustive. It would fail on the following input: Bar3() def f2(x: Foo) = x match { ^ -t4691_exhaust_extractor.scala:29: error: match may not be exhaustive. +t4691_exhaust_extractor.scala:29: warning: match may not be exhaustive. It would fail on the following input: Bar3() def f3(x: Foo) = x match { ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t4749.check b/test/files/neg/t4749.check index 93ad3935fa..34eed6e433 100644 --- a/test/files/neg/t4749.check +++ b/test/files/neg/t4749.check @@ -1,28 +1,30 @@ -t4749.scala:2: error: Fail1 has a main method with parameter type Array[String], but bippy.Fail1 will not be a runnable program. +t4749.scala:2: warning: Fail1 has a main method with parameter type Array[String], but bippy.Fail1 will not be a runnable program. Reason: main method must have exact signature (Array[String])Unit object Fail1 { ^ -t4749.scala:6: error: Fail2 has a main method with parameter type Array[String], but bippy.Fail2 will not be a runnable program. +t4749.scala:6: warning: Fail2 has a main method with parameter type Array[String], but bippy.Fail2 will not be a runnable program. Reason: main methods cannot be generic. object Fail2 { ^ -t4749.scala:13: error: Fail3 has a main method with parameter type Array[String], but bippy.Fail3 will not be a runnable program. +t4749.scala:13: warning: Fail3 has a main method with parameter type Array[String], but bippy.Fail3 will not be a runnable program. Reason: main methods cannot refer to type parameters or abstract types. object Fail3 extends Bippy[Unit] { } ^ -t4749.scala:16: error: Fail4 has a main method with parameter type Array[String], but bippy.Fail4 will not be a runnable program. +t4749.scala:16: warning: Fail4 has a main method with parameter type Array[String], but bippy.Fail4 will not be a runnable program. Reason: companion is a trait, which means no static forwarder can be generated. object Fail4 { ^ -t4749.scala:21: error: Fail5 has a main method with parameter type Array[String], but bippy.Fail5 will not be a runnable program. +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 { } ^ -t4749.scala:26: error: Fail6 has a main method with parameter type Array[String], but bippy.Fail6 will not be a runnable program. +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. object Fail6 { ^ -6 errors found +error: No warnings can be incurred under -Xfatal-warnings. +6 warnings found +one error found diff --git a/test/files/neg/t4762.check b/test/files/neg/t4762.check index 5e67f2022a..a0525f6226 100644 --- a/test/files/neg/t4762.check +++ b/test/files/neg/t4762.check @@ -1,7 +1,9 @@ -t4762.scala:15: error: private[this] value x in class B shadows mutable x inherited from class A. Changes to x will not be visible within class B - you may want to give them distinct names. +t4762.scala:15: warning: private[this] value x in class B shadows mutable x inherited from class A. Changes to x will not be visible within class B - you may want to give them distinct names. /* (99,99) */ (this.x, this.y), ^ -t4762.scala:48: error: private[this] value x in class Derived shadows mutable x inherited from class Base. Changes to x will not be visible within class Derived - you may want to give them distinct names. +t4762.scala:48: warning: private[this] value x in class Derived shadows mutable x inherited from class Base. Changes to x will not be visible within class Derived - you may want to give them distinct names. class Derived( x : Int ) extends Base( x ) { override def toString = x.toString } ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check index 9633fdffed..4f2919807e 100644 --- a/test/files/neg/t4851.check +++ b/test/files/neg/t4851.check @@ -1,49 +1,51 @@ -S.scala:2: error: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. +S.scala:2: 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 x1 = new J ^ -S.scala:3: error: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. +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: error: Adapting argument list by creating a 5-tuple: this may not be what you want. +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: error: Adapting argument list by creating a 3-tuple: this may not be what you want. +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 after adaptation: Some((1, 2, 3): (Int, Int, Int)) val y1 = Some(1, 2, 3) ^ -S.scala:7: error: Adapting argument list by creating a 3-tuple: this may not be what you want. +S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not be what you want. signature: Some(x: A): Some[A] 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: error: Adapting argument list by inserting (): this is unlikely to be what you want. +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: error: Adapting argument list by inserting (): this is unlikely to be what you want. +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: error: Adapting argument list by creating a 3-tuple: this may not be what you want. +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 after adaptation: Test.anyId((1, 2, 3): (Int, Int, Int)) val w1 = anyId(1, 2 ,3) ^ -8 errors found +error: No warnings can be incurred under -Xfatal-warnings. +8 warnings found +one error found diff --git a/test/files/neg/t5378.check b/test/files/neg/t5378.check new file mode 100644 index 0000000000..c1460083f6 --- /dev/null +++ b/test/files/neg/t5378.check @@ -0,0 +1,31 @@ +t5378.scala:7: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def contains = new { def apply[T1 <: T](value: T1) = ??? } + ^ +t5378.scala:8: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def contains1 = new { def apply[T1 <: A1](value: T1) = ??? } + ^ +t5378.scala:9: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def contains2 = new { def apply[T1 <: A2](value: T1) = ??? } + ^ +t5378.scala:15: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + new Bippy { def apply[T1 <: T](value: T1) = ??? } + ^ +t5378.scala:16: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + new Bippy { def apply[T1 <: B1](value: T1) = ??? } + ^ +t5378.scala:17: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + new Bippy { def apply[T1 <: B2](value: T1) = ??? } + ^ +t5378.scala:21: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def apply1[T1 <: B3](value: T1) = ??? + ^ +t5378.scala:23: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement + def apply3(value: B3) = ??? + ^ +t5378.scala:28: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement + def apply1(s: String)(x: Int)(value: T) = ??? + ^ +t5378.scala:29: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def apply2[T1 <: T](s: String)(x: Int)(value: T1) = ??? + ^ +10 errors found diff --git a/test/files/neg/t5378.scala b/test/files/neg/t5378.scala new file mode 100644 index 0000000000..fa6afa02be --- /dev/null +++ b/test/files/neg/t5378.scala @@ -0,0 +1,54 @@ +import scala.language.reflectiveCalls + +class Coll[+T] { + type A1 <: T + type A2 <: A1 + + def contains = new { def apply[T1 <: T](value: T1) = ??? } + def contains1 = new { def apply[T1 <: A1](value: T1) = ??? } + def contains2 = new { def apply[T1 <: A2](value: T1) = ??? } + def contains3 = { + trait Bippy { + type B1 <: T + type B2 <: B1 + } + new Bippy { def apply[T1 <: T](value: T1) = ??? } + new Bippy { def apply[T1 <: B1](value: T1) = ??? } + new Bippy { def apply[T1 <: B2](value: T1) = ??? } + new Bippy { + type B3 = B2 + type B4 = List[B2] + def apply1[T1 <: B3](value: T1) = ??? + def apply2[T1 <: B4](value: T1) = ??? + def apply3(value: B3) = ??? + def apply4(value: B4) = value.head + } + } + def contains4 = new { + def apply1(s: String)(x: Int)(value: T) = ??? + def apply2[T1 <: T](s: String)(x: Int)(value: T1) = ??? + } + def containsOk = { + trait Bippy { + type B1 <: AnyRef + type B2 <: B1 + } + new Bippy { def apply[T1 <: AnyRef](value: T1) = ??? } + new Bippy { type B1 = String ; def apply[T1 <: B1](value: T1) = ??? } + new Bippy { type B2 = String ; def apply[T1 <: B2](value: T1) = ??? } + } +} + +object Test { + def main(args: Array[String]): Unit = { + val xs = new Coll[List[String]] + val ys: Coll[Traversable[String]] = xs + + println(ys contains Nil) + // java.lang.NoSuchMethodException: Coll$$anon$1.apply(scala.collection.Traversable) + // at java.lang.Class.getMethod(Class.java:1605) + // at Test$.reflMethod$Method1(a.scala:14) + // at Test$.main(a.scala:14) + // at Test.main(a.scala) + } +} diff --git a/test/files/neg/t5426.check b/test/files/neg/t5426.check index d9e192d3f0..98f3ddaaae 100644 --- a/test/files/neg/t5426.check +++ b/test/files/neg/t5426.check @@ -1,13 +1,15 @@ -t5426.scala:2: error: comparing values of types Some[Int] and Int using `==' will always yield false +t5426.scala:2: warning: comparing values of types Some[Int] and Int using `==' will always yield false def f1 = Some(5) == 5 ^ -t5426.scala:3: error: comparing values of types Int and Some[Int] using `==' will always yield false +t5426.scala:3: warning: comparing values of types Int and Some[Int] using `==' will always yield false def f2 = 5 == Some(5) ^ -t5426.scala:8: error: comparing values of types Int and Some[Int] using `==' will always yield false +t5426.scala:8: warning: comparing values of types Int and Some[Int] using `==' will always yield false (x1 == x2) ^ -t5426.scala:9: error: comparing values of types Some[Int] and Int using `==' will always yield false +t5426.scala:9: warning: comparing values of types Some[Int] and Int using `==' will always yield false (x2 == x1) ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t5440.check b/test/files/neg/t5440.check index a862350a05..1c4592ccec 100644 --- a/test/files/neg/t5440.check +++ b/test/files/neg/t5440.check @@ -1,5 +1,7 @@ -t5440.scala:3: error: match may not be exhaustive. +t5440.scala:3: warning: match may not be exhaustive. It would fail on the following inputs: (List(_), Nil), (Nil, List(_)) (list1, list2) match { ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t5663-badwarneq.check b/test/files/neg/t5663-badwarneq.check index 00c2234e9d..12e93ff373 100644 --- a/test/files/neg/t5663-badwarneq.check +++ b/test/files/neg/t5663-badwarneq.check @@ -1,22 +1,24 @@ -t5663-badwarneq.scala:42: error: comparing case class values of types Some[Int] and None.type using `==' will always yield false +t5663-badwarneq.scala:42: warning: comparing case class values of types Some[Int] and None.type using `==' will always yield false println(new Some(1) == None) // Should complain on type, was: spuriously complains on fresh object ^ -t5663-badwarneq.scala:43: error: comparing case class values of types Some[Int] and Thing using `==' will always yield false +t5663-badwarneq.scala:43: warning: comparing case class values of types Some[Int] and Thing using `==' will always yield false println(Some(1) == new Thing(1)) // Should complain on type, was: spuriously complains on fresh object ^ -t5663-badwarneq.scala:51: error: ThingOne and Thingy are unrelated: they will most likely never compare equal +t5663-badwarneq.scala:51: warning: ThingOne and Thingy are unrelated: they will most likely never compare equal println(t1 == t2) // true, but apparently unrelated, a compromise warning ^ -t5663-badwarneq.scala:52: error: ThingThree and Thingy are unrelated: they will most likely never compare equal +t5663-badwarneq.scala:52: warning: ThingThree and Thingy are unrelated: they will most likely never compare equal println(t4 == t2) // true, complains because ThingThree is final and Thingy not a subclass, stronger claim than unrelated ^ -t5663-badwarneq.scala:55: error: comparing case class values of types ThingTwo and Some[Int] using `==' will always yield false +t5663-badwarneq.scala:55: warning: comparing case class values of types ThingTwo and Some[Int] using `==' will always yield false println(t3 == Some(1)) // false, warn on different cases ^ -t5663-badwarneq.scala:56: error: comparing values of types ThingOne and Cousin using `==' will always yield false +t5663-badwarneq.scala:56: warning: comparing values of types ThingOne and Cousin using `==' will always yield false println(t1 == c) // should warn ^ -t5663-badwarneq.scala:64: error: comparing case class values of types Simple and SimpleSibling.type using `==' will always yield false +t5663-badwarneq.scala:64: warning: comparing case class values of types Simple and SimpleSibling.type using `==' will always yield false println(new Simple() == SimpleSibling) // like Some(1) == None, but needn't be final case ^ -7 errors found +error: No warnings can be incurred under -Xfatal-warnings. +7 warnings found +one error found diff --git a/test/files/neg/t5692a.check b/test/files/neg/t5692a.check deleted file mode 100644 index ded95a8820..0000000000 --- a/test/files/neg/t5692a.check +++ /dev/null @@ -1,4 +0,0 @@ -Test_2.scala:2: error: type parameter not specified - def x = Macros.foo - ^ -one error found diff --git a/test/files/neg/t5692b.check b/test/files/neg/t5692b.check deleted file mode 100644 index e453870ec8..0000000000 --- a/test/files/neg/t5692b.check +++ /dev/null @@ -1,4 +0,0 @@ -Test_2.scala:2: error: type parameters not specified - def x = Macros.foo - ^ -one error found diff --git a/test/files/neg/t5762.check b/test/files/neg/t5762.check index 10064032aa..2a2f12144a 100644 --- a/test/files/neg/t5762.check +++ b/test/files/neg/t5762.check @@ -1,13 +1,15 @@ -t5762.scala:6: error: non-variable type argument Int in type pattern D[Int] is unchecked since it is eliminated by erasure +t5762.scala:6: warning: non-variable type argument Int in type pattern D[Int] is unchecked since it is eliminated by erasure case _: D[Int] if bippy => 1 ^ -t5762.scala:7: error: non-variable type argument String in type pattern D[String] is unchecked since it is eliminated by erasure +t5762.scala:7: warning: non-variable type argument String in type pattern D[String] is unchecked since it is eliminated by erasure case _: D[String] => 2 ^ -t5762.scala:20: error: non-variable type argument D[Int] in type pattern D[D[Int]] is unchecked since it is eliminated by erasure +t5762.scala:20: warning: non-variable type argument D[Int] in type pattern D[D[Int]] is unchecked since it is eliminated by erasure case _: D[D[Int]] if bippy => 1 ^ -t5762.scala:21: error: non-variable type argument D[String] in type pattern D[D[String]] is unchecked since it is eliminated by erasure +t5762.scala:21: warning: non-variable type argument D[String] in type pattern D[D[String]] is unchecked since it is eliminated by erasure case _: D[D[String]] => 2 ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t5830.check b/test/files/neg/t5830.check index 726fac2a1e..58c3a1be38 100644 --- a/test/files/neg/t5830.check +++ b/test/files/neg/t5830.check @@ -1,7 +1,9 @@ -t5830.scala:6: error: unreachable code +t5830.scala:6: warning: unreachable code case 'a' => println("b") // unreachable ^ -t5830.scala:4: error: could not emit switch for @switch annotated match +t5830.scala:4: warning: could not emit switch for @switch annotated match def unreachable(ch: Char) = (ch: @switch) match { ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t5956.check b/test/files/neg/t5956.check index 6641dac97f..f5ae42c799 100644 --- a/test/files/neg/t5956.check +++ b/test/files/neg/t5956.check @@ -1,20 +1,7 @@ -t5956.scala:1: warning: case classes without a parameter list have been deprecated; -use either case objects or case classes with `()' as parameter list. -object O { case class C[T]; class C } - ^ -t5956.scala:2: warning: case classes without a parameter list have been deprecated; -use either case objects or case classes with `()' as parameter list. -object T { case class C[T]; case class C } - ^ -t5956.scala:2: warning: case classes without a parameter list have been deprecated; -use either case objects or case classes with `()' as parameter list. -object T { case class C[T]; case class C } - ^ t5956.scala:1: error: C is already defined as case class C -object O { case class C[T]; class C } - ^ +object O { case class C[T](); class C() } + ^ t5956.scala:2: error: C is already defined as case class C -object T { case class C[T]; case class C } - ^ -three warnings found +object T { case class C[T](); case class C() } + ^ two errors found diff --git a/test/files/neg/t5956.scala b/test/files/neg/t5956.scala index d985fa97a4..3cc10f3e19 100644 --- a/test/files/neg/t5956.scala +++ b/test/files/neg/t5956.scala @@ -1,2 +1,2 @@ -object O { case class C[T]; class C } -object T { case class C[T]; case class C } +object O { case class C[T](); class C() } +object T { case class C[T](); case class C() } diff --git a/test/files/neg/t6011.check b/test/files/neg/t6011.check index 5b5a861e5b..cb7f189031 100644 --- a/test/files/neg/t6011.check +++ b/test/files/neg/t6011.check @@ -1,10 +1,12 @@ -t6011.scala:4: error: unreachable code +t6011.scala:4: warning: unreachable code case 'a' | 'c' => 1 // unreachable ^ -t6011.scala:10: error: unreachable code +t6011.scala:10: warning: unreachable code case 'b' | 'a' => 1 // unreachable ^ -t6011.scala:8: error: could not emit switch for @switch annotated match +t6011.scala:8: warning: could not emit switch for @switch annotated match def f2(ch: Char): Any = (ch: @annotation.switch) match { ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t6048.check b/test/files/neg/t6048.check index 5bdf2eca88..5e11d24fde 100644 --- a/test/files/neg/t6048.check +++ b/test/files/neg/t6048.check @@ -1,13 +1,15 @@ -t6048.scala:3: error: unreachable code +t6048.scala:3: warning: unreachable code case _ if false => x // unreachable ^ -t6048.scala:8: error: unreachable code +t6048.scala:8: warning: unreachable code case _ if false => x // unreachable ^ -t6048.scala:13: error: patterns after a variable pattern cannot match (SLS 8.1.1) +t6048.scala:13: warning: patterns after a variable pattern cannot match (SLS 8.1.1) case _ => x ^ -t6048.scala:14: error: unreachable code due to variable pattern on line 13 +t6048.scala:14: warning: unreachable code due to variable pattern on line 13 case 5 if true => x // unreachable ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t6162-inheritance.check b/test/files/neg/t6162-inheritance.check index a7d3cc3238..e98fa79eb7 100644 --- a/test/files/neg/t6162-inheritance.check +++ b/test/files/neg/t6162-inheritance.check @@ -1,10 +1,18 @@ -t6162-inheritance.scala:6: error: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. +t6162-inheritance.scala:6: warning: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. class SubFoo extends Foo ^ -t6162-inheritance.scala:11: error: inheritance from trait T in package t6126 is deprecated +t6162-inheritance.scala:11: warning: inheritance from trait T in package t6126 is deprecated object SubT extends T ^ -t6162-inheritance.scala:17: error: inheritance from trait S in package t6126 is deprecated +t6162-inheritance.scala:17: warning: inheritance from trait S in package t6126 is deprecated new S { ^ -three errors found +t6162-inheritance.scala:6: warning: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version. +class SubFoo extends Foo + ^ +t6162-inheritance.scala:11: warning: inheritance from trait T in package t6126 is deprecated +object SubT extends T + ^ +error: No warnings can be incurred under -Xfatal-warnings. +5 warnings found +one error found diff --git a/test/files/neg/t6162-overriding.check b/test/files/neg/t6162-overriding.check index e774888d36..6bff75d88d 100644 --- a/test/files/neg/t6162-overriding.check +++ b/test/files/neg/t6162-overriding.check @@ -1,7 +1,9 @@ -t6162-overriding.scala:14: error: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version. +t6162-overriding.scala:14: warning: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version. override def bar = 43 ^ -t6162-overriding.scala:15: error: overriding method baz in class Bar is deprecated +t6162-overriding.scala:15: warning: overriding method baz in class Bar is deprecated override def baz = 43 ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t6264.check b/test/files/neg/t6264.check index 438be4c39f..c0975a80b2 100644 --- a/test/files/neg/t6264.check +++ b/test/files/neg/t6264.check @@ -1,4 +1,6 @@ -t6264.scala:3: error: non-variable type argument Tuple1[_] in type Tuple2[_, Tuple1[_]] is unchecked since it is eliminated by erasure +t6264.scala:3: warning: non-variable type argument Tuple1[_] in type Tuple2[_, Tuple1[_]] is unchecked since it is eliminated by erasure x.isInstanceOf[Tuple2[_, Tuple1[_]]] ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t6276.check b/test/files/neg/t6276.check index 0b3dfa5531..f275de9d0a 100644 --- a/test/files/neg/t6276.check +++ b/test/files/neg/t6276.check @@ -1,19 +1,21 @@ -t6276.scala:4: error: method a in class C does nothing other than call itself recursively +t6276.scala:4: warning: method a in class C does nothing other than call itself recursively def a: Any = a // warn ^ -t6276.scala:5: error: value b in class C does nothing other than call itself recursively +t6276.scala:5: warning: value b in class C does nothing other than call itself recursively val b: Any = b // warn ^ -t6276.scala:7: error: method c in class C does nothing other than call itself recursively +t6276.scala:7: warning: method c in class C does nothing other than call itself recursively def c: Any = this.c // warn ^ -t6276.scala:8: error: method d in class C does nothing other than call itself recursively +t6276.scala:8: warning: method d in class C does nothing other than call itself recursively def d: Any = C.this.d // warn ^ -t6276.scala:13: error: method a does nothing other than call itself recursively +t6276.scala:13: warning: method a does nothing other than call itself recursively def a: Any = a // warn ^ -t6276.scala:22: error: method a does nothing other than call itself recursively +t6276.scala:22: warning: method a does nothing other than call itself recursively def a = a // warn ^ -6 errors found +error: No warnings can be incurred under -Xfatal-warnings. +6 warnings found +one error found diff --git a/test/files/neg/t6355.check b/test/files/neg/t6355.check new file mode 100644 index 0000000000..c1fa147f52 --- /dev/null +++ b/test/files/neg/t6355.check @@ -0,0 +1,4 @@ +t6355.scala:12: error: implementation restriction: applyDynamic cannot be overloaded + def applyDynamic(name: String)(x: Int): Int = 2 + ^ +one error found diff --git a/test/files/neg/t6355.scala b/test/files/neg/t6355.scala new file mode 100644 index 0000000000..3007dc49f6 --- /dev/null +++ b/test/files/neg/t6355.scala @@ -0,0 +1,13 @@ +package foo + +import scala.language.dynamics + +class DoesntExtendDynamic { + def applyDynamic(name: String)(s: String): Int = 1 + def applyDynamic(name: String)(x: Int): Int = 2 +} + +class A extends Dynamic { + def applyDynamic(name: String)(s: String): Int = 1 + def applyDynamic(name: String)(x: Int): Int = 2 +} diff --git a/test/files/neg/t6375.check b/test/files/neg/t6375.check new file mode 100644 index 0000000000..89d7d8060f --- /dev/null +++ b/test/files/neg/t6375.check @@ -0,0 +1,27 @@ +t6375.scala:6: warning: no valid targets for annotation on value x1 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @getter) + @Bippy val x1: Int // warn + ^ +t6375.scala:7: warning: no valid targets for annotation on value x2 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.field @getter) + @(Bippy @field) val x2: Int // warn + ^ +t6375.scala:9: warning: no valid targets for annotation on value x4 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.setter @getter) + @(Bippy @setter) val x4: Int // warn + ^ +t6375.scala:10: warning: no valid targets for annotation on value x5 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.param @getter) + @(Bippy @param) val x5: Int // warn + ^ +t6375.scala:20: warning: no valid targets for annotation on value q1 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.getter @field) + @(Bippy @getter) private[this] val q1: Int = 1 // warn + ^ +t6375.scala:40: warning: no valid targets for annotation on value p2 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.getter @param) + @(Bippy @getter) p2: Int, // warn + ^ +t6375.scala:41: warning: no valid targets for annotation on value p3 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.setter @param) + @(Bippy @setter) p3: Int, // warn + ^ +t6375.scala:42: warning: no valid targets for annotation on value p4 - it is discarded unused. You may specify targets with meta-annotations, e.g. @(Bippy @scala.annotation.meta.field @param) + @(Bippy @field) p4: Int // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +8 warnings found +one error found diff --git a/test/files/neg/t6375.flags b/test/files/neg/t6375.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/t6375.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/t6375.scala b/test/files/neg/t6375.scala new file mode 100644 index 0000000000..21634df688 --- /dev/null +++ b/test/files/neg/t6375.scala @@ -0,0 +1,67 @@ +import scala.annotation.meta._ + +class Bippy extends scala.annotation.StaticAnnotation + +abstract class Foo { + @Bippy val x1: Int // warn + @(Bippy @field) val x2: Int // warn + @(Bippy @getter) val x3: Int // no warn + @(Bippy @setter) val x4: Int // warn + @(Bippy @param) val x5: Int // warn +} + +object Bar extends Foo { + val x1 = 1 + val x2 = 2 + val x3 = 3 + val x4 = 4 + val x5 = 5 + + @(Bippy @getter) private[this] val q1: Int = 1 // warn + @(Bippy @getter) private val q2: Int = 1 // no warn + + def f1(@(Bippy @param) x: Int): Int = 0 // no warn + def f2(@(Bippy @getter) x: Int): Int = 0 // warn - todo + def f3(@(Bippy @setter) x: Int): Int = 0 // warn - todo + def f4(@(Bippy @field) x: Int): Int = 0 // warn - todo + def f5(@Bippy x: Int): Int = 0 // no warn + + @(Bippy @companionClass) def g1(x: Int): Int = 0 // warn - todo + @(Bippy @companionObject) def g2(x: Int): Int = 0 // warn - todo + @(Bippy @companionMethod) def g3(x: Int): Int = 0 // no warn + @Bippy def g4(x: Int): Int = 0 // no warn + + @(Bippy @companionObject @companionMethod) def g5(x: Int): Int = 0 // no warn +} + +class Dingo( + @Bippy p0: Int, // no warn + @(Bippy @param) p1: Int, // no warn + @(Bippy @getter) p2: Int, // warn + @(Bippy @setter) p3: Int, // warn + @(Bippy @field) p4: Int // warn +) + +class ValDingo( + @Bippy val p0: Int, // no warn + @(Bippy @param) val p1: Int, // no warn + @(Bippy @getter) val p2: Int, // no warn + @(Bippy @setter) val p3: Int, // warn - todo + @(Bippy @field) val p4: Int // no warn +) + +class VarDingo( + @Bippy var p0: Int, // no warn + @(Bippy @param) var p1: Int, // no warn + @(Bippy @getter) var p2: Int, // no warn + @(Bippy @setter) var p3: Int, // no warn + @(Bippy @field) var p4: Int // no warn +) + +case class CaseDingo( + @Bippy p0: Int, // no warn + @(Bippy @param) p1: Int, // no warn + @(Bippy @getter) p2: Int, // no warn + @(Bippy @setter) p3: Int, // warn - todo + @(Bippy @field) p4: Int // no warn +) diff --git a/test/files/neg/t6406-regextract.check b/test/files/neg/t6406-regextract.check new file mode 100644 index 0000000000..4fea66f760 --- /dev/null +++ b/test/files/neg/t6406-regextract.check @@ -0,0 +1,7 @@ +t6406-regextract.scala:4: error: cannot resolve overloaded unapply + List(1) collect { case r(i) => i } + ^ +t6406-regextract.scala:4: error: not found: value i + List(1) collect { case r(i) => i } + ^ +two errors found diff --git a/test/files/neg/t6406-regextract.flags b/test/files/neg/t6406-regextract.flags new file mode 100644 index 0000000000..7de3c0f3ee --- /dev/null +++ b/test/files/neg/t6406-regextract.flags @@ -0,0 +1 @@ +-Xfatal-warnings -deprecation diff --git a/test/files/neg/t6406-regextract.scala b/test/files/neg/t6406-regextract.scala new file mode 100644 index 0000000000..0f5dad908d --- /dev/null +++ b/test/files/neg/t6406-regextract.scala @@ -0,0 +1,5 @@ + +object Test extends App { + val r = "(\\d+)".r + List(1) collect { case r(i) => i } +} diff --git a/test/files/neg/t6426.check b/test/files/neg/t6426.check new file mode 100644 index 0000000000..149f74c4de --- /dev/null +++ b/test/files/neg/t6426.check @@ -0,0 +1,7 @@ +t6426.scala:4: error: wildcard invalid as backquoted identifier + println(`_`.Buffer(0)) + ^ +t6426.scala:5: error: ')' expected but '}' found. +} +^ +two errors found diff --git a/test/files/neg/t6426.scala b/test/files/neg/t6426.scala new file mode 100644 index 0000000000..a27d18eb58 --- /dev/null +++ b/test/files/neg/t6426.scala @@ -0,0 +1,5 @@ +class A { + import collection.{mutable => _, _} + + println(`_`.Buffer(0)) +} diff --git a/test/files/neg/t6446-additional.check b/test/files/neg/t6446-additional.check new file mode 100755 index 0000000000..53dd383941 --- /dev/null +++ b/test/files/neg/t6446-additional.check @@ -0,0 +1,31 @@ + phase name id description + ---------- -- ----------- + parser 1 parse source into ASTs, perform simple desugaring + namer 2 resolve names, attach symbols to named trees +packageobjects 3 load package objects + typer 4 the meat and potatoes: type the trees + patmat 5 translate match expressions +superaccessors 6 add super accessors in traits and nested classes + extmethods 7 add extension methods for inline classes + pickler 8 serialize symbol tables + refchecks 9 reference/override checking, translate nested objects + uncurry 10 uncurry, translate function values to anonymous classes + tailcalls 11 replace tail calls by jumps + specialize 12 @specialized-driven class and method specialization + explicitouter 13 this refs to outer pointers, translate patterns + erasure 14 erase types, add interfaces for traits + posterasure 15 clean up erased inline classes + lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs + lambdalift 17 move nested functions to top level + constructors 18 move field definitions into constructors + flatten 19 eliminate inner classes + mixin 20 mixin composition + cleanup 21 platform-specific cleanups, generate reflective calls + icode 22 generate portable intermediate code + inliner 23 optimization: do inlining +inlinehandlers 24 optimization: inline exception handlers + closelim 25 optimization: eliminate uncalled closures + dce 26 optimization: eliminate dead code + jvm 27 generate JVM bytecode + ploogin 28 A sample phase that does so many things it's kind of hard... + terminal 29 The last phase in the compiler chain diff --git a/test/files/neg/t6446-additional/ploogin_1.scala b/test/files/neg/t6446-additional/ploogin_1.scala new file mode 100644 index 0000000000..ed6adfc1cf --- /dev/null +++ b/test/files/neg/t6446-additional/ploogin_1.scala @@ -0,0 +1,31 @@ + +package t6446 + +import scala.tools.nsc.{ Global, Phase } +import scala.tools.nsc.plugins.{ Plugin, PluginComponent } +import scala.reflect.io.Path +import scala.reflect.io.File + +/** A test plugin. */ +class Ploogin(val global: Global) extends Plugin { + import global._ + + val name = "ploogin" + val description = "A sample plugin for testing." + val components = List[PluginComponent](TestComponent) + + private object TestComponent extends PluginComponent { + val global: Ploogin.this.global.type = Ploogin.this.global + //override val runsBefore = List("refchecks") + val runsAfter = List("jvm") + val phaseName = Ploogin.this.name + override def description = "A sample phase that does so many things it's kind of hard to describe briefly." + def newPhase(prev: Phase) = new TestPhase(prev) + class TestPhase(prev: Phase) extends StdPhase(prev) { + override def description = TestComponent.this.description + def apply(unit: CompilationUnit) { + // kewl kode + } + } + } +} diff --git a/test/files/neg/t6446-additional/sample_2.flags b/test/files/neg/t6446-additional/sample_2.flags new file mode 100644 index 0000000000..4d518c2286 --- /dev/null +++ b/test/files/neg/t6446-additional/sample_2.flags @@ -0,0 +1 @@ +-Xplugin:. -Xshow-phases diff --git a/test/files/neg/t6446-additional/sample_2.scala b/test/files/neg/t6446-additional/sample_2.scala new file mode 100644 index 0000000000..73cdc64e40 --- /dev/null +++ b/test/files/neg/t6446-additional/sample_2.scala @@ -0,0 +1,6 @@ + +package sample + +// just a sample that is compiled with the sample plugin enabled +object Sample extends App { +} diff --git a/test/files/neg/t6446-additional/scalac-plugin.xml b/test/files/neg/t6446-additional/scalac-plugin.xml new file mode 100644 index 0000000000..e849bb5919 --- /dev/null +++ b/test/files/neg/t6446-additional/scalac-plugin.xml @@ -0,0 +1,4 @@ +<plugin> +<name>sample-plugin</name> +<classname>t6446.Ploogin</classname> +</plugin> diff --git a/test/files/neg/t6446-list.check b/test/files/neg/t6446-list.check new file mode 100755 index 0000000000..fa5c581941 --- /dev/null +++ b/test/files/neg/t6446-list.check @@ -0,0 +1 @@ +ploogin - A sample plugin for testing. diff --git a/test/files/neg/t6446-list/ploogin_1.scala b/test/files/neg/t6446-list/ploogin_1.scala new file mode 100644 index 0000000000..ed6adfc1cf --- /dev/null +++ b/test/files/neg/t6446-list/ploogin_1.scala @@ -0,0 +1,31 @@ + +package t6446 + +import scala.tools.nsc.{ Global, Phase } +import scala.tools.nsc.plugins.{ Plugin, PluginComponent } +import scala.reflect.io.Path +import scala.reflect.io.File + +/** A test plugin. */ +class Ploogin(val global: Global) extends Plugin { + import global._ + + val name = "ploogin" + val description = "A sample plugin for testing." + val components = List[PluginComponent](TestComponent) + + private object TestComponent extends PluginComponent { + val global: Ploogin.this.global.type = Ploogin.this.global + //override val runsBefore = List("refchecks") + val runsAfter = List("jvm") + val phaseName = Ploogin.this.name + override def description = "A sample phase that does so many things it's kind of hard to describe briefly." + def newPhase(prev: Phase) = new TestPhase(prev) + class TestPhase(prev: Phase) extends StdPhase(prev) { + override def description = TestComponent.this.description + def apply(unit: CompilationUnit) { + // kewl kode + } + } + } +} diff --git a/test/files/neg/t6446-list/sample_2.flags b/test/files/neg/t6446-list/sample_2.flags new file mode 100644 index 0000000000..9cb3232964 --- /dev/null +++ b/test/files/neg/t6446-list/sample_2.flags @@ -0,0 +1 @@ +-Xplugin:. -Xplugin-list diff --git a/test/files/neg/t6446-list/sample_2.scala b/test/files/neg/t6446-list/sample_2.scala new file mode 100644 index 0000000000..73cdc64e40 --- /dev/null +++ b/test/files/neg/t6446-list/sample_2.scala @@ -0,0 +1,6 @@ + +package sample + +// just a sample that is compiled with the sample plugin enabled +object Sample extends App { +} diff --git a/test/files/neg/t6446-list/scalac-plugin.xml b/test/files/neg/t6446-list/scalac-plugin.xml new file mode 100644 index 0000000000..e849bb5919 --- /dev/null +++ b/test/files/neg/t6446-list/scalac-plugin.xml @@ -0,0 +1,4 @@ +<plugin> +<name>sample-plugin</name> +<classname>t6446.Ploogin</classname> +</plugin> diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check new file mode 100755 index 0000000000..f976bf480e --- /dev/null +++ b/test/files/neg/t6446-missing.check @@ -0,0 +1,31 @@ +Warning: class not found: t6446.Ploogin + phase name id description + ---------- -- ----------- + parser 1 parse source into ASTs, perform simple desugaring + namer 2 resolve names, attach symbols to named trees +packageobjects 3 load package objects + typer 4 the meat and potatoes: type the trees + patmat 5 translate match expressions +superaccessors 6 add super accessors in traits and nested classes + extmethods 7 add extension methods for inline classes + pickler 8 serialize symbol tables + refchecks 9 reference/override checking, translate nested objects + uncurry 10 uncurry, translate function values to anonymous classes + tailcalls 11 replace tail calls by jumps + specialize 12 @specialized-driven class and method specialization + explicitouter 13 this refs to outer pointers, translate patterns + erasure 14 erase types, add interfaces for traits + posterasure 15 clean up erased inline classes + lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs + lambdalift 17 move nested functions to top level + constructors 18 move field definitions into constructors + flatten 19 eliminate inner classes + mixin 20 mixin composition + cleanup 21 platform-specific cleanups, generate reflective calls + icode 22 generate portable intermediate code + inliner 23 optimization: do inlining +inlinehandlers 24 optimization: inline exception handlers + closelim 25 optimization: eliminate uncalled closures + dce 26 optimization: eliminate dead code + jvm 27 generate JVM bytecode + terminal 28 The last phase in the compiler chain diff --git a/test/files/neg/t6446-missing/sample_2.flags b/test/files/neg/t6446-missing/sample_2.flags new file mode 100644 index 0000000000..4d518c2286 --- /dev/null +++ b/test/files/neg/t6446-missing/sample_2.flags @@ -0,0 +1 @@ +-Xplugin:. -Xshow-phases diff --git a/test/files/neg/t6446-missing/sample_2.scala b/test/files/neg/t6446-missing/sample_2.scala new file mode 100644 index 0000000000..73cdc64e40 --- /dev/null +++ b/test/files/neg/t6446-missing/sample_2.scala @@ -0,0 +1,6 @@ + +package sample + +// just a sample that is compiled with the sample plugin enabled +object Sample extends App { +} diff --git a/test/files/neg/t6446-missing/scalac-plugin.xml b/test/files/neg/t6446-missing/scalac-plugin.xml new file mode 100644 index 0000000000..9c34d63f83 --- /dev/null +++ b/test/files/neg/t6446-missing/scalac-plugin.xml @@ -0,0 +1,4 @@ +<plugin> +<name>missing-plugin</name> +<classname>t6446.Ploogin</classname> +</plugin> diff --git a/test/files/neg/t6446-show-phases.check b/test/files/neg/t6446-show-phases.check new file mode 100644 index 0000000000..5bbe43990c --- /dev/null +++ b/test/files/neg/t6446-show-phases.check @@ -0,0 +1,30 @@ + phase name id description + ---------- -- ----------- + parser 1 parse source into ASTs, perform simple desugaring + namer 2 resolve names, attach symbols to named trees +packageobjects 3 load package objects + typer 4 the meat and potatoes: type the trees + patmat 5 translate match expressions +superaccessors 6 add super accessors in traits and nested classes + extmethods 7 add extension methods for inline classes + pickler 8 serialize symbol tables + refchecks 9 reference/override checking, translate nested objects + uncurry 10 uncurry, translate function values to anonymous classes + tailcalls 11 replace tail calls by jumps + specialize 12 @specialized-driven class and method specialization + explicitouter 13 this refs to outer pointers, translate patterns + erasure 14 erase types, add interfaces for traits + posterasure 15 clean up erased inline classes + lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs + lambdalift 17 move nested functions to top level + constructors 18 move field definitions into constructors + flatten 19 eliminate inner classes + mixin 20 mixin composition + cleanup 21 platform-specific cleanups, generate reflective calls + icode 22 generate portable intermediate code + inliner 23 optimization: do inlining +inlinehandlers 24 optimization: inline exception handlers + closelim 25 optimization: eliminate uncalled closures + dce 26 optimization: eliminate dead code + jvm 27 generate JVM bytecode + terminal 28 The last phase in the compiler chain diff --git a/test/files/neg/t6446-show-phases.flags b/test/files/neg/t6446-show-phases.flags new file mode 100644 index 0000000000..845666e100 --- /dev/null +++ b/test/files/neg/t6446-show-phases.flags @@ -0,0 +1 @@ +-Xshow-phases diff --git a/test/files/neg/t6446-show-phases.scala b/test/files/neg/t6446-show-phases.scala new file mode 100644 index 0000000000..a9afb042d2 --- /dev/null +++ b/test/files/neg/t6446-show-phases.scala @@ -0,0 +1,3 @@ + +// testing compiler flag output only +object Test extends App diff --git a/test/files/neg/t6566a.check b/test/files/neg/t6566a.check new file mode 100644 index 0000000000..7668f9d2fb --- /dev/null +++ b/test/files/neg/t6566a.check @@ -0,0 +1,4 @@ +t6566a.scala:2: error: covariant type T occurs in invariant position in type T of type MyType + class TypeCheat[+T] { type MyType = T } + ^ +one error found diff --git a/test/files/neg/t6566a.scala b/test/files/neg/t6566a.scala new file mode 100644 index 0000000000..74a0b38e56 --- /dev/null +++ b/test/files/neg/t6566a.scala @@ -0,0 +1,17 @@ +object WhatsYourTypeIsMyType { + class TypeCheat[+T] { type MyType = T } + + class Foo { + val tc = new TypeCheat[Foo] + var x: tc.MyType = _ + def setX() = x = new Foo + } + class Bar extends Foo { + override val tc = new TypeCheat[Bar] + def unsound = this + + setX() + println(x.unsound) + } + def main(args: Array[String]): Unit = new Bar +} diff --git a/test/files/neg/t6566b.check b/test/files/neg/t6566b.check new file mode 100644 index 0000000000..fb3fe81fca --- /dev/null +++ b/test/files/neg/t6566b.check @@ -0,0 +1,4 @@ +t6566b.scala:3: error: covariant type T occurs in invariant position in type T of type MyType + type MyType = T + ^ +one error found diff --git a/test/files/neg/t6566b.scala b/test/files/neg/t6566b.scala new file mode 100644 index 0000000000..18ddebf88b --- /dev/null +++ b/test/files/neg/t6566b.scala @@ -0,0 +1,19 @@ +object WhatsYourTypeIsMyType { + trait WithMyType[+T] { + type MyType = T + } + + class Foo extends WithMyType[Foo] { + var x: MyType = _ + def setX() = x = new Foo + } + + class Bar extends Foo with WithMyType[Bar] { + def unsound { println("iAmABar") } + + setX() + println(x.unsound) + } + + def main(args: Array[String]): Unit = new Bar +} diff --git a/test/files/neg/t6567.check b/test/files/neg/t6567.check index 4c513e64cd..a733d75354 100644 --- a/test/files/neg/t6567.check +++ b/test/files/neg/t6567.check @@ -1,7 +1,9 @@ -t6567.scala:8: error: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply. +t6567.scala:8: warning: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply. Option[B](a) ^ -t6567.scala:10: error: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply. +t6567.scala:10: warning: Suspicious application of an implicit view (Test.this.a2b) in the argument to Option.apply. val b: Option[B] = Option(a) ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t6601.check b/test/files/neg/t6601.check deleted file mode 100644 index 1410e1b11a..0000000000 --- a/test/files/neg/t6601.check +++ /dev/null @@ -1,4 +0,0 @@ -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/t6601/AccessPrivateConstructor_2.scala b/test/files/neg/t6601/AccessPrivateConstructor_2.scala deleted file mode 100644 index 816bc10d79..0000000000 --- a/test/files/neg/t6601/AccessPrivateConstructor_2.scala +++ /dev/null @@ -1,3 +0,0 @@ -class AccessPrivateConstructor { - new PrivateConstructor("") // Scalac should forbid accessing to the private constructor! -} diff --git a/test/files/neg/t6601/PrivateConstructor_1.scala b/test/files/neg/t6601/PrivateConstructor_1.scala deleted file mode 100644 index f09d7ad068..0000000000 --- a/test/files/neg/t6601/PrivateConstructor_1.scala +++ /dev/null @@ -1 +0,0 @@ -class PrivateConstructor private(val s: String) extends AnyVal diff --git a/test/files/neg/t6675-old-patmat.check b/test/files/neg/t6675-old-patmat.check deleted file mode 100644 index bc3920da06..0000000000 --- a/test/files/neg/t6675-old-patmat.check +++ /dev/null @@ -1,4 +0,0 @@ -t6675-old-patmat.scala:10: error: extractor pattern binds a single value to a Product3 of type (Int, Int, Int) - "" match { case X(b) => b } // should warn under -Xlint. Not an error because of SI-6111 - ^ -one error found diff --git a/test/files/neg/t6675-old-patmat.flags b/test/files/neg/t6675-old-patmat.flags deleted file mode 100644 index 604de64a62..0000000000 --- a/test/files/neg/t6675-old-patmat.flags +++ /dev/null @@ -1 +0,0 @@ --Xlint -Xfatal-warnings -Xoldpatmat
\ No newline at end of file diff --git a/test/files/neg/t6675-old-patmat.scala b/test/files/neg/t6675-old-patmat.scala deleted file mode 100644 index 4d500b77ba..0000000000 --- a/test/files/neg/t6675-old-patmat.scala +++ /dev/null @@ -1,13 +0,0 @@ -object X { - def unapply(s: String): Option[(Int,Int,Int)] = Some((1,2,3)) -} - -object Y { - def unapplySeq(s: String): Option[Seq[(Int,Int,Int)]] = Some(Seq((1,2,3))) -} - -object Test { - "" match { case X(b) => b } // should warn under -Xlint. Not an error because of SI-6111 - - "" match { case Y(b) => b } // no warning -} diff --git a/test/files/neg/t6675.check b/test/files/neg/t6675.check index 7b271de213..3a277af866 100644 --- a/test/files/neg/t6675.check +++ b/test/files/neg/t6675.check @@ -1,4 +1,6 @@ -t6675.scala:10: error: extractor pattern binds a single value to a Product3 of type (Int, Int, Int) +t6675.scala:10: warning: extractor pattern binds a single value to a Product3 of type (Int, Int, Int) "" match { case X(b) => b } // should warn under -Xlint. Not an error because of SI-6111 ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/t6963.check b/test/files/neg/t6963.check index 41cb796b0b..cc4a7a48fc 100644 --- a/test/files/neg/t6963.check +++ b/test/files/neg/t6963.check @@ -1,2 +1,4 @@ -error: -Xmigration is deprecated: This setting is no longer useful and will be removed. Please remove it from your build. +warning: -Xmigration is deprecated: This setting is no longer useful and will be removed. Please remove it from your build. +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/unchecked-abstract.check b/test/files/neg/unchecked-abstract.check index 6e811dc156..72019082ac 100644 --- a/test/files/neg/unchecked-abstract.check +++ b/test/files/neg/unchecked-abstract.check @@ -1,25 +1,27 @@ -unchecked-abstract.scala:16: error: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:16: warning: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Contravariant[H]]) ^ -unchecked-abstract.scala:21: error: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:21: warning: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Contravariant[H]]) ^ -unchecked-abstract.scala:27: error: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:27: warning: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[T]]) ^ -unchecked-abstract.scala:28: error: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:28: warning: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[L]]) ^ -unchecked-abstract.scala:31: error: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:31: warning: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[H]]) ^ -unchecked-abstract.scala:33: error: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:33: warning: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[L]]) ^ -unchecked-abstract.scala:36: error: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:36: warning: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[H]]) ^ -unchecked-abstract.scala:37: error: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure +unchecked-abstract.scala:37: warning: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure /* warn */ println(x.isInstanceOf[Invariant[T]]) ^ -8 errors found +error: No warnings can be incurred under -Xfatal-warnings. +8 warnings found +one error found diff --git a/test/files/neg/unchecked-impossible.check b/test/files/neg/unchecked-impossible.check index 0ab371dbaa..d150a5a853 100644 --- a/test/files/neg/unchecked-impossible.check +++ b/test/files/neg/unchecked-impossible.check @@ -1,4 +1,10 @@ -unchecked-impossible.scala:5: error: fruitless type test: a value of type T2[Int,Int] cannot also be a Seq[A] +unchecked-impossible.scala:5: warning: fruitless type test: a value of type T2[Int,Int] cannot also be a Seq[A] case Seq(x) => ^ +unchecked-impossible.scala:5: error: pattern type is incompatible with expected type; + found : Seq[A] + required: T2[Int,Int] + case Seq(x) => + ^ +one warning found one error found diff --git a/test/files/neg/unchecked-knowable.check b/test/files/neg/unchecked-knowable.check index d279427327..327a5f202d 100644 --- a/test/files/neg/unchecked-knowable.check +++ b/test/files/neg/unchecked-knowable.check @@ -1,7 +1,9 @@ -unchecked-knowable.scala:18: error: fruitless type test: a value of type Bippy cannot also be a A1 +unchecked-knowable.scala:18: warning: fruitless type test: a value of type Bippy cannot also be a A1 /* warn */ (new Bippy).isInstanceOf[A1] ^ -unchecked-knowable.scala:19: error: fruitless type test: a value of type Bippy cannot also be a B1 +unchecked-knowable.scala:19: warning: fruitless type test: a value of type Bippy cannot also be a B1 /* warn */ (new Bippy).isInstanceOf[B1] ^ -two errors found +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/unchecked-refinement.check b/test/files/neg/unchecked-refinement.check index d81517464f..e85a51f44d 100644 --- a/test/files/neg/unchecked-refinement.check +++ b/test/files/neg/unchecked-refinement.check @@ -1,13 +1,15 @@ -unchecked-refinement.scala:17: error: abstract type U in type pattern Foo[U,U,V] is unchecked since it is eliminated by erasure +unchecked-refinement.scala:17: warning: abstract type U in type pattern Foo[U,U,V] is unchecked since it is eliminated by erasure /* warn */ case _: Foo[U, U, V] if b => () ^ -unchecked-refinement.scala:19: error: non-variable type argument Any in type pattern Foo[Any,U,V] is unchecked since it is eliminated by erasure +unchecked-refinement.scala:19: warning: non-variable type argument Any in type pattern Foo[Any,U,V] is unchecked since it is eliminated by erasure /* warn */ case _: Foo[Any, U, V] if b => () ^ -unchecked-refinement.scala:23: error: a pattern match on a refinement type is unchecked +unchecked-refinement.scala:23: warning: a pattern match on a refinement type is unchecked /* nowarn - todo */ case x: AnyRef { def bippy: Int } if b => x.bippy // this could/should do an instance check and not warn ^ -unchecked-refinement.scala:24: error: a pattern match on a refinement type is unchecked +unchecked-refinement.scala:24: warning: a pattern match on a refinement type is unchecked /* nowarn - todo */ case x: AnyRef { def size: Int } if b => x.size // this could/should do a static conformance test and not warn ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/unchecked-suppress.check b/test/files/neg/unchecked-suppress.check index 2e23d21386..038105918e 100644 --- a/test/files/neg/unchecked-suppress.check +++ b/test/files/neg/unchecked-suppress.check @@ -1,10 +1,12 @@ -unchecked-suppress.scala:4: error: non-variable type argument Int in type pattern Set[Int] is unchecked since it is eliminated by erasure +unchecked-suppress.scala:4: warning: non-variable type argument Int in type pattern Set[Int] is unchecked since it is eliminated by erasure case xs: Set[Int] => xs.head // unchecked ^ -unchecked-suppress.scala:5: error: non-variable type argument String in type pattern Map[String @unchecked,String] is unchecked since it is eliminated by erasure +unchecked-suppress.scala:5: warning: non-variable type argument String in type pattern Map[String @unchecked,String] is unchecked since it is eliminated by erasure case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay ^ -unchecked-suppress.scala:7: error: non-variable type argument Int in type pattern (Int, Int) => Int is unchecked since it is eliminated by erasure +unchecked-suppress.scala:7: warning: non-variable type argument Int in type pattern (Int, Int) => Int is unchecked since it is eliminated by erasure case f: ((Int, Int) => Int) => // unchecked ^ -three errors found +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/unchecked.check b/test/files/neg/unchecked.check index 2883b716c9..570f02f219 100644 --- a/test/files/neg/unchecked.check +++ b/test/files/neg/unchecked.check @@ -1,19 +1,21 @@ -unchecked.scala:18: error: non-variable type argument String in type pattern Iterable[String] is unchecked since it is eliminated by erasure +unchecked.scala:18: warning: non-variable type argument String in type pattern Iterable[String] is unchecked since it is eliminated by erasure case xs: Iterable[String] => xs.head // unchecked ^ -unchecked.scala:22: error: non-variable type argument Any in type pattern Set[Any] is unchecked since it is eliminated by erasure +unchecked.scala:22: warning: non-variable type argument Any in type pattern Set[Any] is unchecked since it is eliminated by erasure case xs: Set[Any] => xs.head // unchecked ^ -unchecked.scala:26: error: non-variable type argument Any in type pattern Map[Any,Any] is unchecked since it is eliminated by erasure +unchecked.scala:26: warning: non-variable type argument Any in type pattern Map[Any,Any] is unchecked since it is eliminated by erasure case xs: Map[Any, Any] => xs.head // unchecked ^ -unchecked.scala:35: error: non-variable type argument List[Nothing] in type pattern Test.Contra[List[Nothing]] is unchecked since it is eliminated by erasure +unchecked.scala:35: warning: non-variable type argument List[Nothing] in type pattern Test.Contra[List[Nothing]] is unchecked since it is eliminated by erasure case xs: Contra[List[Nothing]] => xs.head // unchecked ^ -unchecked.scala:50: error: non-variable type argument String in type pattern Test.Exp[String] is unchecked since it is eliminated by erasure +unchecked.scala:50: warning: non-variable type argument String in type pattern Test.Exp[String] is unchecked since it is eliminated by erasure case ArrayApply(x: Exp[Array[T]], _, j: Exp[String]) => x // unchecked ^ -unchecked.scala:55: error: non-variable type argument Array[T] in type pattern Test.Exp[Array[T]] is unchecked since it is eliminated by erasure +unchecked.scala:55: warning: non-variable type argument Array[T] in type pattern Test.Exp[Array[T]] is unchecked since it is eliminated by erasure case ArrayApply(x: Exp[Array[T]], _, _) => x // unchecked ^ -6 errors found +error: No warnings can be incurred under -Xfatal-warnings. +6 warnings found +one error found diff --git a/test/files/neg/unchecked2.check b/test/files/neg/unchecked2.check index 68fdfa82ac..a7b8391856 100644 --- a/test/files/neg/unchecked2.check +++ b/test/files/neg/unchecked2.check @@ -1,43 +1,45 @@ -unchecked2.scala:4: error: fruitless type test: a value of type Some[List[Int]] cannot also be a Option[List[String]] (but still might match its erasure) +unchecked2.scala:4: warning: fruitless type test: a value of type Some[List[Int]] cannot also be a Option[List[String]] (but still might match its erasure) /* warn */ Some(List(1)).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:5: error: non-variable type argument Option[_] in type Option[Option[_]] is unchecked since it is eliminated by erasure +unchecked2.scala:5: warning: non-variable type argument Option[_] in type Option[Option[_]] is unchecked since it is eliminated by erasure /* warn */ Some(123).isInstanceOf[Option[Option[_]]] ^ -unchecked2.scala:6: error: fruitless type test: a value of type Some[Int] cannot also be a Option[String] (but still might match its erasure) +unchecked2.scala:6: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[String] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[String]] ^ -unchecked2.scala:7: error: fruitless type test: a value of type Some[Int] cannot also be a Option[List[String]] (but still might match its erasure) +unchecked2.scala:7: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[List[String]] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:8: error: fruitless type test: a value of type Some[Int] cannot also be a Option[List[Int => String]] (but still might match its erasure) +unchecked2.scala:8: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[List[Int => String]] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[List[Int => String]]] ^ -unchecked2.scala:9: error: fruitless type test: a value of type Some[Int] cannot also be a Option[(String, Double)] (but still might match its erasure) +unchecked2.scala:9: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[(String, Double)] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[(String, Double)]] ^ -unchecked2.scala:10: error: fruitless type test: a value of type Some[Int] cannot also be a Option[String => Double] (but still might match its erasure) +unchecked2.scala:10: warning: fruitless type test: a value of type Some[Int] cannot also be a Option[String => Double] (but still might match its erasure) /* warn */ Some(123).isInstanceOf[Option[String => Double]] ^ -unchecked2.scala:14: error: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure +unchecked2.scala:14: warning: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure /* warn */ (Some(List(1)): Any).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:15: error: non-variable type argument Int in type Option[Int] is unchecked since it is eliminated by erasure +unchecked2.scala:15: warning: non-variable type argument Int in type Option[Int] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[Int]] ^ -unchecked2.scala:16: error: non-variable type argument String in type Option[String] is unchecked since it is eliminated by erasure +unchecked2.scala:16: warning: non-variable type argument String in type Option[String] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[String]] ^ -unchecked2.scala:17: error: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure +unchecked2.scala:17: warning: non-variable type argument List[String] in type Option[List[String]] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[List[String]]] ^ -unchecked2.scala:18: error: non-variable type argument List[Int => String] in type Option[List[Int => String]] is unchecked since it is eliminated by erasure +unchecked2.scala:18: warning: non-variable type argument List[Int => String] in type Option[List[Int => String]] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[List[Int => String]]] ^ -unchecked2.scala:19: error: non-variable type argument (String, Double) in type Option[(String, Double)] is unchecked since it is eliminated by erasure +unchecked2.scala:19: warning: non-variable type argument (String, Double) in type Option[(String, Double)] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[(String, Double)]] ^ -unchecked2.scala:20: error: non-variable type argument String => Double in type Option[String => Double] is unchecked since it is eliminated by erasure +unchecked2.scala:20: warning: non-variable type argument String => Double in type Option[String => Double] is unchecked since it is eliminated by erasure /* warn */ (Some(123): Any).isInstanceOf[Option[String => Double]] ^ -14 errors found +error: No warnings can be incurred under -Xfatal-warnings. +14 warnings found +one error found diff --git a/test/files/neg/unchecked3.check b/test/files/neg/unchecked3.check index f4f0c74257..a7582a8930 100644 --- a/test/files/neg/unchecked3.check +++ b/test/files/neg/unchecked3.check @@ -1,37 +1,42 @@ -unchecked3.scala:24: error: non-variable type argument Double in type pattern E1[Double] is unchecked since it is eliminated by erasure +unchecked3.scala:24: warning: non-variable type argument Double in type pattern E1[Double] is unchecked since it is eliminated by erasure /* warn */ def peerTypes2(x: B1[Int]) = x match { case _: E1[Double] => true } ^ -unchecked3.scala:25: error: non-variable type argument Double in type pattern F1[Double] is unchecked since it is eliminated by erasure +unchecked3.scala:25: warning: non-variable type argument Double in type pattern F1[Double] is unchecked since it is eliminated by erasure /* warn */ def peerTypes3(x: B1[_]) = x match { case _: F1[Double] => true } ^ -unchecked3.scala:28: error: non-variable type argument Int in type pattern A2[Int] is unchecked since it is eliminated by erasure +unchecked3.scala:28: warning: non-variable type argument Int in type pattern A2[Int] is unchecked since it is eliminated by erasure /* warn */ def twotypes1[T](x: B2[T, Int]) = x match { case _: A2[Int] => true } ^ -unchecked3.scala:32: error: non-variable type argument Int in type pattern B2[_,Int] is unchecked since it is eliminated by erasure +unchecked3.scala:32: warning: non-variable type argument Int in type pattern B2[_,Int] is unchecked since it is eliminated by erasure /* warn */ def twotypes5[T](x: A2[T]) = x match { case _: B2[_, Int] => true } ^ -unchecked3.scala:40: error: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure +unchecked3.scala:40: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[List[String]] => () ^ -unchecked3.scala:43: error: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure +unchecked3.scala:43: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[Array[List[String]]] => () ^ -unchecked3.scala:50: error: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure +unchecked3.scala:50: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[List[String]] => () ^ -unchecked3.scala:53: error: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure +unchecked3.scala:53: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[Array[List[String]]] => () ^ -unchecked3.scala:60: error: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure +unchecked3.scala:60: warning: non-variable type argument String in type pattern Array[List[String]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[List[String]] => () ^ -unchecked3.scala:62: error: non-variable type argument Array[String] in type pattern Array[List[Array[String]]] is unchecked since it is eliminated by erasure +unchecked3.scala:62: warning: non-variable type argument Array[String] in type pattern Array[List[Array[String]]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[List[Array[String]]] => () ^ -unchecked3.scala:63: error: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure +unchecked3.scala:63: warning: non-variable type argument String in type pattern Array[Array[List[String]]] is unchecked since it is eliminated by erasure /* warn */ case _: Array[Array[List[String]]] => () ^ -unchecked3.scala:75: error: abstract type A in type pattern Set[Q.this.A] is unchecked since it is eliminated by erasure +unchecked3.scala:75: warning: abstract type A in type pattern Set[Q.this.A] is unchecked since it is eliminated by erasure /* warn */ case xs: Set[A] => xs.head ^ -12 errors found +unchecked3.scala:62: warning: unreachable code + /* warn */ case _: Array[List[Array[String]]] => () + ^ +error: No warnings can be incurred under -Xfatal-warnings. +13 warnings found +one error found diff --git a/test/files/neg/unit-returns-value.check b/test/files/neg/unit-returns-value.check index ab458a350b..f30a506ebe 100644 --- a/test/files/neg/unit-returns-value.check +++ b/test/files/neg/unit-returns-value.check @@ -1,7 +1,15 @@ -unit-returns-value.scala:4: error: a pure expression does nothing in statement position; you may be omitting necessary parentheses +unit-returns-value.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses if (b) return 5 ^ -unit-returns-value.scala:4: error: enclosing method f has result type Unit: return value discarded +unit-returns-value.scala:4: warning: enclosing method f has result type Unit: return value discarded if (b) return 5 ^ -two errors found +unit-returns-value.scala:22: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + i1 // warn + ^ +unit-returns-value.scala:23: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + i2 // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/unit-returns-value.scala b/test/files/neg/unit-returns-value.scala index ecc981f217..fc5a37069f 100644 --- a/test/files/neg/unit-returns-value.scala +++ b/test/files/neg/unit-returns-value.scala @@ -3,9 +3,30 @@ object Test { var b = false if (b) return 5 } - + // no warning def g { return println("hello") } } + +class UnusedValues { + var i1 = 2 + val i2 = 2 + lazy val i3 = 2 + object i4 { } + def i5 = 2 + final def i6 = 2 + + def x = { + i1 // warn + i2 // warn + i3 // no warn + i4 // no warn + i5 // no warn + i6 // could warn someday, if i6 returned 2.type instead of Int + + 5 + } +} + diff --git a/test/files/neg/unreachablechar.check b/test/files/neg/unreachablechar.check index 58ce1a7e91..121f12a0c7 100644 --- a/test/files/neg/unreachablechar.check +++ b/test/files/neg/unreachablechar.check @@ -1,4 +1,9 @@ -unreachablechar.scala:5: error: unreachable code +unreachablechar.scala:4: warning: patterns after a variable pattern cannot match (SLS 8.1.1) + case _ => println("stuff"); + ^ +unreachablechar.scala:5: warning: unreachable code due to variable pattern on line 4 case 'f' => println("not stuff?"); ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found one error found diff --git a/test/files/neg/unreachablechar.flags b/test/files/neg/unreachablechar.flags index 809e9ff2f2..85d8eb2ba2 100644 --- a/test/files/neg/unreachablechar.flags +++ b/test/files/neg/unreachablechar.flags @@ -1 +1 @@ - -Xoldpatmat +-Xfatal-warnings diff --git a/test/files/neg/variances-refinement.check b/test/files/neg/variances-refinement.check new file mode 100644 index 0000000000..2bed3ffa6b --- /dev/null +++ b/test/files/neg/variances-refinement.check @@ -0,0 +1,22 @@ +variances-refinement.scala:17: error: contravariant type A occurs in covariant position in type ()AnyRef{def f0(x: A): A} of method fail1 + def fail1() = { object O { def f0(x: A): A = ??? } ; O } // fail + ^ +variances-refinement.scala:18: error: covariant type B occurs in contravariant position in type ()AnyRef{def f0(x: B): A} of method fail2 + def fail2() = { object O { def f0(x: B): A = ??? } ; O } // fail + ^ +variances-refinement.scala:19: error: covariant type B occurs in contravariant position in type ()AnyRef{def f0(x: B): B} of method fail3 + def fail3() = { object O { def f0(x: B): B = ??? } ; O } // fail + ^ +variances-refinement.scala:20: error: covariant type B occurs in contravariant position in type ()AnyRef{def f0(x: B): C} of method fail4 + def fail4() = { object O { def f0(x: B): C = ??? } ; O } // fail + ^ +variances-refinement.scala:21: error: contravariant type A occurs in covariant position in type ()AnyRef{def f0(x: C): A} of method fail5 + def fail5() = { object O { def f0(x: C): A = ??? } ; O } // fail + ^ +variances-refinement.scala:23: error: contravariant type A occurs in covariant position in type ()O1.type forSome { val O1: AnyRef with O0; type O0 <: AnyRef{def f0(x: A): A; def f1(x: A): B; def f2(x: A): C} } of method fail6 + def fail6() = { // fail + ^ +variances-refinement.scala:32: error: contravariant type A occurs in covariant position in type ()AnyRef{def f0(x: A): A; def f1(x: A): B; def f2(x: A): C} of method fail7 + def fail7() = { // fail + ^ +7 errors found diff --git a/test/files/neg/variances-refinement.scala b/test/files/neg/variances-refinement.scala new file mode 100644 index 0000000000..6bfd336ce0 --- /dev/null +++ b/test/files/neg/variances-refinement.scala @@ -0,0 +1,40 @@ +trait Trait[-A, +B, C] { + def ok() = { // ok + object O { + private def f0(x: A): A = ??? + def f1(x: A): B = ??? + def f2(x: A): C = ??? + private def f3(x: B): A = ??? + private def f4(x: B): B = ??? + private def f5(x: B): C = ??? + private def f6(x: C): A = ??? + def f7(x: C): B = ??? + def f8(x: C): C = ??? + } + O + } + + def fail1() = { object O { def f0(x: A): A = ??? } ; O } // fail + def fail2() = { object O { def f0(x: B): A = ??? } ; O } // fail + def fail3() = { object O { def f0(x: B): B = ??? } ; O } // fail + def fail4() = { object O { def f0(x: B): C = ??? } ; O } // fail + def fail5() = { object O { def f0(x: C): A = ??? } ; O } // fail + + def fail6() = { // fail + trait O0 { + def f0(x: A): A = ??? + def f1(x: A): B = ??? + def f2(x: A): C = ??? + } + object O1 extends O0 + O1 + } + def fail7() = { // fail + trait O0 { + def f0(x: A): A = ??? + def f1(x: A): B = ??? + def f2(x: A): C = ??? + } + new O0 { } + } +} diff --git a/test/files/neg/variances.check b/test/files/neg/variances.check index 0643e533b7..7d965e94dc 100644 --- a/test/files/neg/variances.check +++ b/test/files/neg/variances.check @@ -13,7 +13,10 @@ variances.scala:21: error: covariant type A occurs in invariant position in supe variances.scala:74: error: covariant type A occurs in contravariant position in type => test.Covariant.T[A]{val m: A => A} of value x val x: T[A] { ^ +variances.scala:89: error: covariant type T occurs in invariant position in type T of type A + type A = T + ^ variances.scala:90: error: covariant type T occurs in contravariant position in type => test.TestAlias.B[C.this.A] of method foo def foo: B[A] ^ -6 errors found +7 errors found diff --git a/test/files/neg/variances2.check b/test/files/neg/variances2.check new file mode 100644 index 0000000000..433cc125ad --- /dev/null +++ b/test/files/neg/variances2.check @@ -0,0 +1,229 @@ +variances2.scala:9: error: covariant type B occurs in contravariant position in type B of value x + def f1(x: B): Unit = () + ^ +variances2.scala:12: error: covariant type E occurs in contravariant position in type E of value x + def f4(x: E): Unit = () + ^ +variances2.scala:15: error: contravariant type A occurs in covariant position in type ()A of method f6 + def f6(): A = ??? + ^ +variances2.scala:18: error: contravariant type D occurs in covariant position in type ()D of method f9 + def f9(): D = ??? + ^ +variances2.scala:22: error: contravariant type A occurs in covariant position in type A => A of value f + def f12(f: A => A): Unit = () + ^ +variances2.scala:23: error: contravariant type A occurs in covariant position in type A => B of value f + def f13(f: A => B): Unit = () + ^ +variances2.scala:24: error: contravariant type A occurs in covariant position in type A => C of value f + def f14(f: A => C): Unit = () + ^ +variances2.scala:25: error: contravariant type A occurs in covariant position in type A => D of value f + def f15(f: A => D): Unit = () + ^ +variances2.scala:26: error: contravariant type A occurs in covariant position in type A => E of value f + def f16(f: A => E): Unit = () + ^ +variances2.scala:27: error: contravariant type A occurs in covariant position in type A => F of value f + def f17(f: A => F): Unit = () + ^ +variances2.scala:29: error: covariant type B occurs in contravariant position in type B => B of value f + def f19(f: B => B): Unit = () + ^ +variances2.scala:32: error: covariant type E occurs in contravariant position in type B => E of value f + def f22(f: B => E): Unit = () + ^ +variances2.scala:35: error: covariant type B occurs in contravariant position in type C => B of value f + def f25(f: C => B): Unit = () + ^ +variances2.scala:38: error: covariant type E occurs in contravariant position in type C => E of value f + def f28(f: C => E): Unit = () + ^ +variances2.scala:40: error: contravariant type D occurs in covariant position in type D => A of value f + def f30(f: D => A): Unit = () + ^ +variances2.scala:41: error: contravariant type D occurs in covariant position in type D => B of value f + def f31(f: D => B): Unit = () + ^ +variances2.scala:42: error: contravariant type D occurs in covariant position in type D => C of value f + def f32(f: D => C): Unit = () + ^ +variances2.scala:43: error: contravariant type D occurs in covariant position in type D => D of value f + def f33(f: D => D): Unit = () + ^ +variances2.scala:44: error: contravariant type D occurs in covariant position in type D => E of value f + def f34(f: D => E): Unit = () + ^ +variances2.scala:45: error: contravariant type D occurs in covariant position in type D => F of value f + def f35(f: D => F): Unit = () + ^ +variances2.scala:47: error: covariant type B occurs in contravariant position in type E => B of value f + def f37(f: E => B): Unit = () + ^ +variances2.scala:50: error: covariant type E occurs in contravariant position in type E => E of value f + def f40(f: E => E): Unit = () + ^ +variances2.scala:53: error: covariant type B occurs in contravariant position in type F => B of value f + def f43(f: F => B): Unit = () + ^ +variances2.scala:56: error: covariant type E occurs in contravariant position in type F => E of value f + def f46(f: F => E): Unit = () + ^ +variances2.scala:59: error: contravariant type A occurs in covariant position in type ()A => A of method f48 + def f48(): A => A = null + ^ +variances2.scala:62: error: contravariant type D occurs in covariant position in type ()A => D of method f51 + def f51(): A => D = null + ^ +variances2.scala:65: error: covariant type B occurs in contravariant position in type ()B => A of method f54 + def f54(): B => A = null + ^ +variances2.scala:66: error: covariant type B occurs in contravariant position in type ()B => B of method f55 + def f55(): B => B = null + ^ +variances2.scala:67: error: covariant type B occurs in contravariant position in type ()B => C of method f56 + def f56(): B => C = null + ^ +variances2.scala:68: error: covariant type B occurs in contravariant position in type ()B => D of method f57 + def f57(): B => D = null + ^ +variances2.scala:69: error: covariant type B occurs in contravariant position in type ()B => E of method f58 + def f58(): B => E = null + ^ +variances2.scala:70: error: covariant type B occurs in contravariant position in type ()B => F of method f59 + def f59(): B => F = null + ^ +variances2.scala:71: error: contravariant type A occurs in covariant position in type ()C => A of method f60 + def f60(): C => A = null + ^ +variances2.scala:74: error: contravariant type D occurs in covariant position in type ()C => D of method f63 + def f63(): C => D = null + ^ +variances2.scala:77: error: contravariant type A occurs in covariant position in type ()D => A of method f66 + def f66(): D => A = null + ^ +variances2.scala:80: error: contravariant type D occurs in covariant position in type ()D => D of method f69 + def f69(): D => D = null + ^ +variances2.scala:83: error: covariant type E occurs in contravariant position in type ()E => A of method f72 + def f72(): E => A = null + ^ +variances2.scala:84: error: covariant type E occurs in contravariant position in type ()E => B of method f73 + def f73(): E => B = null + ^ +variances2.scala:85: error: covariant type E occurs in contravariant position in type ()E => C of method f74 + def f74(): E => C = null + ^ +variances2.scala:86: error: covariant type E occurs in contravariant position in type ()E => D of method f75 + def f75(): E => D = null + ^ +variances2.scala:87: error: covariant type E occurs in contravariant position in type ()E => E of method f76 + def f76(): E => E = null + ^ +variances2.scala:88: error: covariant type E occurs in contravariant position in type ()E => F of method f77 + def f77(): E => F = null + ^ +variances2.scala:89: error: contravariant type A occurs in covariant position in type ()F => A of method f78 + def f78(): F => A = null + ^ +variances2.scala:92: error: contravariant type D occurs in covariant position in type ()F => D of method f81 + def f81(): F => D = null + ^ +variances2.scala:96: error: contravariant type A occurs in covariant position in type (x: A)A of method f84 + def f84(x: A): A = ??? + ^ +variances2.scala:99: error: contravariant type D occurs in covariant position in type (x: A)D of method f87 + def f87(x: A): D = ??? + ^ +variances2.scala:102: error: contravariant type A occurs in covariant position in type (x: B)A of method f90 + def f90(x: B): A = ??? + ^ +variances2.scala:102: error: covariant type B occurs in contravariant position in type B of value x + def f90(x: B): A = ??? + ^ +variances2.scala:103: error: covariant type B occurs in contravariant position in type B of value x + def f91(x: B): B = ??? + ^ +variances2.scala:104: error: covariant type B occurs in contravariant position in type B of value x + def f92(x: B): C = ??? + ^ +variances2.scala:105: error: contravariant type D occurs in covariant position in type (x: B)D of method f93 + def f93(x: B): D = ??? + ^ +variances2.scala:105: error: covariant type B occurs in contravariant position in type B of value x + def f93(x: B): D = ??? + ^ +variances2.scala:106: error: covariant type B occurs in contravariant position in type B of value x + def f94(x: B): E = ??? + ^ +variances2.scala:107: error: covariant type B occurs in contravariant position in type B of value x + def f95(x: B): F = ??? + ^ +variances2.scala:108: error: contravariant type A occurs in covariant position in type (x: C)A of method f96 + def f96(x: C): A = ??? + ^ +variances2.scala:111: error: contravariant type D occurs in covariant position in type (x: C)D of method f99 + def f99(x: C): D = ??? + ^ +variances2.scala:114: error: contravariant type A occurs in covariant position in type (x: D)A of method f102 + def f102(x: D): A = ??? + ^ +variances2.scala:117: error: contravariant type D occurs in covariant position in type (x: D)D of method f105 + def f105(x: D): D = ??? + ^ +variances2.scala:120: error: contravariant type A occurs in covariant position in type (x: E)A of method f108 + def f108(x: E): A = ??? + ^ +variances2.scala:120: error: covariant type E occurs in contravariant position in type E of value x + def f108(x: E): A = ??? + ^ +variances2.scala:121: error: covariant type E occurs in contravariant position in type E of value x + def f109(x: E): B = ??? + ^ +variances2.scala:122: error: covariant type E occurs in contravariant position in type E of value x + def f110(x: E): C = ??? + ^ +variances2.scala:123: error: contravariant type D occurs in covariant position in type (x: E)D of method f111 + def f111(x: E): D = ??? + ^ +variances2.scala:123: error: covariant type E occurs in contravariant position in type E of value x + def f111(x: E): D = ??? + ^ +variances2.scala:124: error: covariant type E occurs in contravariant position in type E of value x + def f112(x: E): E = ??? + ^ +variances2.scala:125: error: covariant type E occurs in contravariant position in type E of value x + def f113(x: E): F = ??? + ^ +variances2.scala:126: error: contravariant type A occurs in covariant position in type (x: F)A of method f114 + def f114(x: F): A = ??? + ^ +variances2.scala:129: error: contravariant type D occurs in covariant position in type (x: F)D of method f117 + def f117(x: F): D = ??? + ^ +variances2.scala:133: error: contravariant type A occurs in covariant position in supertype Cov[A] of object O1 + object O1 extends Cov[A] + ^ +variances2.scala:136: error: contravariant type D occurs in covariant position in supertype Cov[D] of object O4 + object O4 extends Cov[D] + ^ +variances2.scala:140: error: covariant type B occurs in contravariant position in supertype Con[B] of object O8 + object O8 extends Con[B] + ^ +variances2.scala:143: error: covariant type E occurs in contravariant position in supertype Con[E] of object O11 + object O11 extends Con[E] + ^ +variances2.scala:145: error: contravariant type A occurs in invariant position in supertype Inv[A] of object O13 + object O13 extends Inv[A] + ^ +variances2.scala:146: error: covariant type B occurs in invariant position in supertype Inv[B] of object O14 + object O14 extends Inv[B] + ^ +variances2.scala:148: error: contravariant type D occurs in invariant position in supertype Inv[D] of object O16 + object O16 extends Inv[D] + ^ +variances2.scala:149: error: covariant type E occurs in invariant position in supertype Inv[E] of object O17 + object O17 extends Inv[E] + ^ +76 errors found diff --git a/test/files/neg/variances2.scala b/test/files/neg/variances2.scala new file mode 100644 index 0000000000..d30345dd83 --- /dev/null +++ b/test/files/neg/variances2.scala @@ -0,0 +1,303 @@ +trait Cov[+A] +trait Con[-A] +trait Inv[A] + +trait Trait[-A, +B, C] { + // trait Inner[-D <: C, +E >: C, F] { + trait Inner[-D <: C, +E >: C, F] { + def f0(x: A): Unit = () + def f1(x: B): Unit = () + def f2(x: C): Unit = () + def f3(x: D): Unit = () + def f4(x: E): Unit = () + def f5(x: F): Unit = () + + def f6(): A = ??? + def f7(): B = ??? + def f8(): C = ??? + def f9(): D = ??? + def f10(): E = ??? + def f11(): F = ??? + + def f12(f: A => A): Unit = () + def f13(f: A => B): Unit = () + def f14(f: A => C): Unit = () + def f15(f: A => D): Unit = () + def f16(f: A => E): Unit = () + def f17(f: A => F): Unit = () + def f18(f: B => A): Unit = () + def f19(f: B => B): Unit = () + def f20(f: B => C): Unit = () + def f21(f: B => D): Unit = () + def f22(f: B => E): Unit = () + def f23(f: B => F): Unit = () + def f24(f: C => A): Unit = () + def f25(f: C => B): Unit = () + def f26(f: C => C): Unit = () + def f27(f: C => D): Unit = () + def f28(f: C => E): Unit = () + def f29(f: C => F): Unit = () + def f30(f: D => A): Unit = () + def f31(f: D => B): Unit = () + def f32(f: D => C): Unit = () + def f33(f: D => D): Unit = () + def f34(f: D => E): Unit = () + def f35(f: D => F): Unit = () + def f36(f: E => A): Unit = () + def f37(f: E => B): Unit = () + def f38(f: E => C): Unit = () + def f39(f: E => D): Unit = () + def f40(f: E => E): Unit = () + def f41(f: E => F): Unit = () + def f42(f: F => A): Unit = () + def f43(f: F => B): Unit = () + def f44(f: F => C): Unit = () + def f45(f: F => D): Unit = () + def f46(f: F => E): Unit = () + def f47(f: F => F): Unit = () + + def f48(): A => A = null + def f49(): A => B = null + def f50(): A => C = null + def f51(): A => D = null + def f52(): A => E = null + def f53(): A => F = null + def f54(): B => A = null + def f55(): B => B = null + def f56(): B => C = null + def f57(): B => D = null + def f58(): B => E = null + def f59(): B => F = null + def f60(): C => A = null + def f61(): C => B = null + def f62(): C => C = null + def f63(): C => D = null + def f64(): C => E = null + def f65(): C => F = null + def f66(): D => A = null + def f67(): D => B = null + def f68(): D => C = null + def f69(): D => D = null + def f70(): D => E = null + def f71(): D => F = null + def f72(): E => A = null + def f73(): E => B = null + def f74(): E => C = null + def f75(): E => D = null + def f76(): E => E = null + def f77(): E => F = null + def f78(): F => A = null + def f79(): F => B = null + def f80(): F => C = null + def f81(): F => D = null + def f82(): F => E = null + def f83(): F => F = null + + def f84(x: A): A = ??? + def f85(x: A): B = ??? + def f86(x: A): C = ??? + def f87(x: A): D = ??? + def f88(x: A): E = ??? + def f89(x: A): F = ??? + def f90(x: B): A = ??? + def f91(x: B): B = ??? + def f92(x: B): C = ??? + def f93(x: B): D = ??? + def f94(x: B): E = ??? + def f95(x: B): F = ??? + def f96(x: C): A = ??? + def f97(x: C): B = ??? + def f98(x: C): C = ??? + def f99(x: C): D = ??? + def f100(x: C): E = ??? + def f101(x: C): F = ??? + def f102(x: D): A = ??? + def f103(x: D): B = ??? + def f104(x: D): C = ??? + def f105(x: D): D = ??? + def f106(x: D): E = ??? + def f107(x: D): F = ??? + def f108(x: E): A = ??? + def f109(x: E): B = ??? + def f110(x: E): C = ??? + def f111(x: E): D = ??? + def f112(x: E): E = ??? + def f113(x: E): F = ??? + def f114(x: F): A = ??? + def f115(x: F): B = ??? + def f116(x: F): C = ??? + def f117(x: F): D = ??? + def f118(x: F): E = ??? + def f119(x: F): F = ??? + + object O1 extends Cov[A] + object O2 extends Cov[B] + object O3 extends Cov[C] + object O4 extends Cov[D] + object O5 extends Cov[E] + object O6 extends Cov[F] + object O7 extends Con[A] + object O8 extends Con[B] + object O9 extends Con[C] + object O10 extends Con[D] + object O11 extends Con[E] + object O12 extends Con[F] + object O13 extends Inv[A] + object O14 extends Inv[B] + object O15 extends Inv[C] + object O16 extends Inv[D] + object O17 extends Inv[E] + object O18 extends Inv[F] + } +} + +trait Trait2[-A, +B, C] { + // trait Inner[-D <: C, +E >: C, F] { + def method[D <: A, E >: B, F]() { + def f0(x: A): Unit = () + def f1(x: B): Unit = () + def f2(x: C): Unit = () + def f3(x: D): Unit = () + def f4(x: E): Unit = () + def f5(x: F): Unit = () + + def f6(): A = ??? + def f7(): B = ??? + def f8(): C = ??? + def f9(): D = ??? + def f10(): E = ??? + def f11(): F = ??? + + def f12(f: A => A): Unit = () + def f13(f: A => B): Unit = () + def f14(f: A => C): Unit = () + def f15(f: A => D): Unit = () + def f16(f: A => E): Unit = () + def f17(f: A => F): Unit = () + def f18(f: B => A): Unit = () + def f19(f: B => B): Unit = () + def f20(f: B => C): Unit = () + def f21(f: B => D): Unit = () + def f22(f: B => E): Unit = () + def f23(f: B => F): Unit = () + def f24(f: C => A): Unit = () + def f25(f: C => B): Unit = () + def f26(f: C => C): Unit = () + def f27(f: C => D): Unit = () + def f28(f: C => E): Unit = () + def f29(f: C => F): Unit = () + def f30(f: D => A): Unit = () + def f31(f: D => B): Unit = () + def f32(f: D => C): Unit = () + def f33(f: D => D): Unit = () + def f34(f: D => E): Unit = () + def f35(f: D => F): Unit = () + def f36(f: E => A): Unit = () + def f37(f: E => B): Unit = () + def f38(f: E => C): Unit = () + def f39(f: E => D): Unit = () + def f40(f: E => E): Unit = () + def f41(f: E => F): Unit = () + def f42(f: F => A): Unit = () + def f43(f: F => B): Unit = () + def f44(f: F => C): Unit = () + def f45(f: F => D): Unit = () + def f46(f: F => E): Unit = () + def f47(f: F => F): Unit = () + + def f48(): A => A = null + def f49(): A => B = null + def f50(): A => C = null + def f51(): A => D = null + def f52(): A => E = null + def f53(): A => F = null + def f54(): B => A = null + def f55(): B => B = null + def f56(): B => C = null + def f57(): B => D = null + def f58(): B => E = null + def f59(): B => F = null + def f60(): C => A = null + def f61(): C => B = null + def f62(): C => C = null + def f63(): C => D = null + def f64(): C => E = null + def f65(): C => F = null + def f66(): D => A = null + def f67(): D => B = null + def f68(): D => C = null + def f69(): D => D = null + def f70(): D => E = null + def f71(): D => F = null + def f72(): E => A = null + def f73(): E => B = null + def f74(): E => C = null + def f75(): E => D = null + def f76(): E => E = null + def f77(): E => F = null + def f78(): F => A = null + def f79(): F => B = null + def f80(): F => C = null + def f81(): F => D = null + def f82(): F => E = null + def f83(): F => F = null + + def f84(x: A): A = ??? + def f85(x: A): B = ??? + def f86(x: A): C = ??? + def f87(x: A): D = ??? + def f88(x: A): E = ??? + def f89(x: A): F = ??? + def f90(x: B): A = ??? + def f91(x: B): B = ??? + def f92(x: B): C = ??? + def f93(x: B): D = ??? + def f94(x: B): E = ??? + def f95(x: B): F = ??? + def f96(x: C): A = ??? + def f97(x: C): B = ??? + def f98(x: C): C = ??? + def f99(x: C): D = ??? + def f100(x: C): E = ??? + def f101(x: C): F = ??? + def f102(x: D): A = ??? + def f103(x: D): B = ??? + def f104(x: D): C = ??? + def f105(x: D): D = ??? + def f106(x: D): E = ??? + def f107(x: D): F = ??? + def f108(x: E): A = ??? + def f109(x: E): B = ??? + def f110(x: E): C = ??? + def f111(x: E): D = ??? + def f112(x: E): E = ??? + def f113(x: E): F = ??? + def f114(x: F): A = ??? + def f115(x: F): B = ??? + def f116(x: F): C = ??? + def f117(x: F): D = ??? + def f118(x: F): E = ??? + def f119(x: F): F = ??? + + object O1 extends Cov[A] + object O2 extends Cov[B] + object O3 extends Cov[C] + object O4 extends Cov[D] + object O5 extends Cov[E] + object O6 extends Cov[F] + object O7 extends Con[A] + object O8 extends Con[B] + object O9 extends Con[C] + object O10 extends Con[D] + object O11 extends Con[E] + object O12 extends Con[F] + object O13 extends Inv[A] + object O14 extends Inv[B] + object O15 extends Inv[C] + object O16 extends Inv[D] + object O17 extends Inv[E] + object O18 extends Inv[F] + + () + } +} diff --git a/test/files/neg/virtpatmat_reach_null.check b/test/files/neg/virtpatmat_reach_null.check index 595c8ec889..e0c36c8c5b 100644 --- a/test/files/neg/virtpatmat_reach_null.check +++ b/test/files/neg/virtpatmat_reach_null.check @@ -1,4 +1,6 @@ -virtpatmat_reach_null.scala:13: error: unreachable code +virtpatmat_reach_null.scala:13: warning: unreachable code case _ => // unreachable ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/virtpatmat_reach_sealed_unsealed.check b/test/files/neg/virtpatmat_reach_sealed_unsealed.check index 10638eff52..064a12bcaa 100644 --- a/test/files/neg/virtpatmat_reach_sealed_unsealed.check +++ b/test/files/neg/virtpatmat_reach_sealed_unsealed.check @@ -1,14 +1,16 @@ -virtpatmat_reach_sealed_unsealed.scala:16: error: match may not be exhaustive. +virtpatmat_reach_sealed_unsealed.scala:16: warning: match may not be exhaustive. It would fail on the following input: false (true: Boolean) match { case true => } // not exhaustive, but reachable ^ -virtpatmat_reach_sealed_unsealed.scala:18: error: unreachable code +virtpatmat_reach_sealed_unsealed.scala:18: warning: unreachable code (true: Boolean) match { case true => case false => case _ => } // exhaustive, last case is unreachable ^ -virtpatmat_reach_sealed_unsealed.scala:19: error: unreachable code +virtpatmat_reach_sealed_unsealed.scala:19: warning: unreachable code (true: Boolean) match { case true => case false => case _: Boolean => } // exhaustive, last case is unreachable ^ -virtpatmat_reach_sealed_unsealed.scala:20: error: unreachable code +virtpatmat_reach_sealed_unsealed.scala:20: warning: unreachable code (true: Boolean) match { case true => case false => case _: Any => } // exhaustive, last case is unreachable ^ -four errors found +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/virtpatmat_unreach_select.check b/test/files/neg/virtpatmat_unreach_select.check index 3771971020..4fc78cd412 100644 --- a/test/files/neg/virtpatmat_unreach_select.check +++ b/test/files/neg/virtpatmat_unreach_select.check @@ -1,4 +1,6 @@ -virtpatmat_unreach_select.scala:10: error: unreachable code +virtpatmat_unreach_select.scala:10: warning: unreachable code case WARNING.id => // unreachable ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found one error found diff --git a/test/files/neg/warn-inferred-any.check b/test/files/neg/warn-inferred-any.check new file mode 100644 index 0000000000..4628033e55 --- /dev/null +++ b/test/files/neg/warn-inferred-any.check @@ -0,0 +1,12 @@ +warn-inferred-any.scala:8: warning: a type was inferred to be `Any`; this may indicate a programming error. + { List(1, 2, 3) contains "a" } // only this warns + ^ +warn-inferred-any.scala:16: warning: a type was inferred to be `AnyVal`; this may indicate a programming error. + { 1l to 5l contains 5 } + ^ +warn-inferred-any.scala:17: warning: a type was inferred to be `AnyVal`; this may indicate a programming error. + { 1l to 5l contains 5d } + ^ +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/warn-inferred-any.flags b/test/files/neg/warn-inferred-any.flags new file mode 100644 index 0000000000..a3127d392a --- /dev/null +++ b/test/files/neg/warn-inferred-any.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Ywarn-infer-any diff --git a/test/files/neg/warn-inferred-any.scala b/test/files/neg/warn-inferred-any.scala new file mode 100644 index 0000000000..b853e6e5a8 --- /dev/null +++ b/test/files/neg/warn-inferred-any.scala @@ -0,0 +1,19 @@ +trait Foo[-A <: AnyRef, +B <: AnyRef] { + def run[U](x: A)(action: B => U): Boolean = ??? + + { run(_: A)(_: B => String) } +} + +trait Xs[+A] { + { List(1, 2, 3) contains "a" } // only this warns + { List(1, 2, 3) contains 1 } + { identity(List(1, 2, 3) contains 1) } + { List("a") foreach println } +} + +trait Ys[+A] { + { 1 to 5 contains 5l } + { 1l to 5l contains 5 } + { 1l to 5l contains 5d } + { 1l to 5l contains 5l } +} diff --git a/test/files/neg/warn-unused-imports.check b/test/files/neg/warn-unused-imports.check new file mode 100644 index 0000000000..e61ec267d3 --- /dev/null +++ b/test/files/neg/warn-unused-imports.check @@ -0,0 +1,44 @@ +warn-unused-imports.scala:7: warning: it is not recommended to define classes/objects inside of package objects. +If possible, define class A in package p1 instead. + class A + ^ +warn-unused-imports.scala:13: warning: it is not recommended to define classes/objects inside of package objects. +If possible, define class A in package p2 instead. + class A + ^ +warn-unused-imports.scala:99: warning: local trait Warn is never used + trait Warn { // warn about unused local trait for good measure + ^ +warn-unused-imports.scala:57: warning: Unused import + import p1.A // warn + ^ +warn-unused-imports.scala:62: warning: Unused import + import p1.{ A, B } // warn on A + ^ +warn-unused-imports.scala:67: warning: Unused import + import p1.{ A, B } // warn on both + ^ +warn-unused-imports.scala:67: warning: Unused import + import p1.{ A, B } // warn on both + ^ +warn-unused-imports.scala:73: warning: Unused import + import c._ // warn + ^ +warn-unused-imports.scala:78: warning: Unused import + import p1._ // warn + ^ +warn-unused-imports.scala:85: warning: Unused import + import c._ // warn + ^ +warn-unused-imports.scala:91: warning: Unused import + import p1.c._ // warn + ^ +warn-unused-imports.scala:98: warning: Unused import + import p1._ // warn + ^ +warn-unused-imports.scala:118: warning: Unused import + import p1.A // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +13 warnings found +one error found diff --git a/test/files/neg/warn-unused-imports.flags b/test/files/neg/warn-unused-imports.flags new file mode 100644 index 0000000000..954eaba352 --- /dev/null +++ b/test/files/neg/warn-unused-imports.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Xlint diff --git a/test/files/neg/warn-unused-imports.scala b/test/files/neg/warn-unused-imports.scala new file mode 100644 index 0000000000..b7a2f1c414 --- /dev/null +++ b/test/files/neg/warn-unused-imports.scala @@ -0,0 +1,125 @@ +class Bippo { + def length: Int = 123 + class Tree +} + +package object p1 { + class A + implicit class B(val s: String) { def bippy = s } + val c: Bippo = new Bippo + type D = String +} +package object p2 { + class A + implicit class B(val s: String) { def bippy = s } + val c: Bippo = new Bippo + type D = Int +} + +trait NoWarn { + { + import p1._ // no warn + println("abc".bippy) + } + + { + import p1._ // no warn + println(new A) + } + + { + import p1.B // no warn + println("abc".bippy) + } + + { + import p1._ // no warn + import c._ // no warn + println(length) + } + + { + import p1._ // no warn + import c._ // no warn + val x: Tree = null + println(x) + } + + { + import p1.D // no warn + val x: D = null + println(x) + } +} + +trait Warn { + { + import p1.A // warn + println(123) + } + + { + import p1.{ A, B } // warn on A + println("abc".bippy) + } + + { + import p1.{ A, B } // warn on both + println(123) + } + + { + import p1._ // no warn (technically this could warn, but not worth the effort to unroll unusedness transitively) + import c._ // warn + println(123) + } + + { + import p1._ // warn + println(123) + } + + { + class Tree + import p1._ // no warn + import c._ // warn + val x: Tree = null + println(x) + } + + { + import p1.c._ // warn + println(123) + } +} + +trait Nested { + { + import p1._ // warn + trait Warn { // warn about unused local trait for good measure + import p2._ + println(new A) + println("abc".bippy) + } + println("") + } + + { + import p1._ // no warn + trait NoWarn { + import p2.B // no warn + println("abc".bippy) + println(new A) + } + println(new NoWarn { }) + } + + { + import p1.A // warn + trait Warn { + import p2.A + println(new A) + } + println(new Warn { }) + } +} diff --git a/test/files/neg/warn-unused-privates.check b/test/files/neg/warn-unused-privates.check new file mode 100644 index 0000000000..9c41a33e8f --- /dev/null +++ b/test/files/neg/warn-unused-privates.check @@ -0,0 +1,63 @@ +warn-unused-privates.scala:2: warning: private constructor in class Bippy is never used + private def this(c: Int) = this(c, c) // warn + ^ +warn-unused-privates.scala:4: warning: private method in class Bippy is never used + private def boop(x: Int) = x+a+b // warn + ^ +warn-unused-privates.scala:6: warning: private val in class Bippy is never used + final private val MILLIS2: Int = 1000 // warn + ^ +warn-unused-privates.scala:13: warning: private val in object Bippy is never used + private val HEY_INSTANCE: Int = 1000 // warn + ^ +warn-unused-privates.scala:35: warning: private val in class Boppy is never used + private val hummer = "def" // warn + ^ +warn-unused-privates.scala:42: warning: private var in trait Accessors is never used + private var v1: Int = 0 // warn + ^ +warn-unused-privates.scala:43: warning: private setter in trait Accessors is never used + private var v2: Int = 0 // warn, never set + ^ +warn-unused-privates.scala:44: warning: private var in trait Accessors is never used + private var v3: Int = 0 // warn, never got + ^ +warn-unused-privates.scala:56: warning: private default argument in trait DefaultArgs is never used + private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 + ^ +warn-unused-privates.scala:56: warning: private default argument in trait DefaultArgs is never used + private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 + ^ +warn-unused-privates.scala:67: warning: local var in method f0 is never used + var x = 1 // warn + ^ +warn-unused-privates.scala:74: warning: local val in method f1 is never used + val b = new Outer // warn + ^ +warn-unused-privates.scala:84: warning: private object in object Types is never used + private object Dongo { def f = this } // warn + ^ +warn-unused-privates.scala:94: warning: local object in method l1 is never used + object HiObject { def f = this } // warn + ^ +warn-unused-privates.scala:78: warning: local var x in method f2 is never set - it could be a val + var x = 100 // warn about it being a var + ^ +warn-unused-privates.scala:85: warning: private class Bar1 in object Types is never used + private class Bar1 // warn + ^ +warn-unused-privates.scala:87: warning: private type Alias1 in object Types is never used + private type Alias1 = String // warn + ^ +warn-unused-privates.scala:95: warning: local class Hi is never used + class Hi { // warn + ^ +warn-unused-privates.scala:99: warning: local class DingDongDoobie is never used + class DingDongDoobie // warn + ^ +warn-unused-privates.scala:102: warning: local type OtherThing is never used + type OtherThing = String // warn + ^ +error: No warnings can be incurred under -Xfatal-warnings. +20 warnings found +one error found diff --git a/test/files/neg/warn-unused-privates.flags b/test/files/neg/warn-unused-privates.flags new file mode 100644 index 0000000000..7949c2afa2 --- /dev/null +++ b/test/files/neg/warn-unused-privates.flags @@ -0,0 +1 @@ +-Xlint -Xfatal-warnings diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala new file mode 100644 index 0000000000..cb6e946a34 --- /dev/null +++ b/test/files/neg/warn-unused-privates.scala @@ -0,0 +1,105 @@ +class Bippy(a: Int, b: Int) { + private def this(c: Int) = this(c, c) // warn + private def bippy(x: Int): Int = bippy(x) // TODO: could warn + private def boop(x: Int) = x+a+b // warn + final private val MILLIS1 = 2000 // no warn, might have been inlined + final private val MILLIS2: Int = 1000 // warn + final private val HI_COMPANION: Int = 500 // no warn, accessed from companion + def hi() = Bippy.HI_INSTANCE +} +object Bippy { + def hi(x: Bippy) = x.HI_COMPANION + private val HI_INSTANCE: Int = 500 // no warn, accessed from instance + private val HEY_INSTANCE: Int = 1000 // warn +} + +class A(val msg: String) +class B1(msg: String) extends A(msg) +class B2(msg0: String) extends A(msg0) +class B3(msg0: String) extends A("msg") + +/*** Early defs warnings disabled primarily due to SI-6595. + * The test case is here to assure we aren't issuing false positives; + * the ones labeled "warn" don't warn. + ***/ +class Boppy extends { + private val hmm: String = "abc" // no warn, used in early defs + private val hom: String = "def" // no warn, used in body + private final val him = "ghi" // no warn, might have been (was) inlined + final val him2 = "ghi" // no warn, same + final val himinline = him + private val hum: String = "jkl" // warn + final val ding = hmm.length +} with Mutable { + val dinger = hom + private val hummer = "def" // warn + + private final val bum = "ghi" // no warn, might have been (was) inlined + final val bum2 = "ghi" // no warn, same +} + +trait Accessors { + private var v1: Int = 0 // warn + private var v2: Int = 0 // warn, never set + private var v3: Int = 0 // warn, never got + private var v4: Int = 0 // no warn + + def bippy(): Int = { + v3 = 5 + v4 = 6 + v2 + v4 + } +} + +trait DefaultArgs { + // warn about default getters for x2 and x3 + private def bippy(x1: Int, x2: Int = 10, x3: Int = 15): Int = x1 + x2 + x3 + + def boppy() = bippy(5, 100, 200) +} + +class Outer { + class Inner +} + +trait Locals { + def f0 = { + var x = 1 // warn + var y = 2 + y = 3 + y + y + } + def f1 = { + val a = new Outer // no warn + val b = new Outer // warn + new a.Inner + } + def f2 = { + var x = 100 // warn about it being a var + x + } +} + +object Types { + private object Dongo { def f = this } // warn + private class Bar1 // warn + private class Bar2 // no warn + private type Alias1 = String // warn + private type Alias2 = String // no warn + def bippo = (new Bar2).toString + + def f(x: Alias2) = x.length + + def l1() = { + object HiObject { def f = this } // warn + class Hi { // warn + def f1: Hi = new Hi + def f2(x: Hi) = x + } + class DingDongDoobie // warn + class Bippy // no warn + type Something = Bippy // no warn + type OtherThing = String // warn + (new Bippy): Something + } +} diff --git a/test/files/pos/CustomGlobal.scala b/test/files/pos/CustomGlobal.scala index 30bf227950..a5668bd7c0 100644 --- a/test/files/pos/CustomGlobal.scala +++ b/test/files/pos/CustomGlobal.scala @@ -22,7 +22,7 @@ class CustomGlobal(currentSettings: Settings, reporter: Reporter) extends Global override def newTyper(context: Context): Typer = new CustomTyper(context) class CustomTyper(context : Context) extends Typer(context) { - override def typed(tree: Tree, mode: Int, pt: Type): Tree = { + override def typed(tree: Tree, mode: Mode, pt: Type): Tree = { if (tree.summaryString contains "Bippy") println("I'm typing a Bippy! It's a " + tree.shortClass + ".") diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala index d92fbca380..cf58bc3dfd 100644 --- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala +++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala @@ -21,7 +21,7 @@ object Macros { // normalize argument name var b1 = new Transformer { override def transform(tree: Tree): Tree = tree match { - case Ident(x) if (x==n) => Ident(newTermName("_arg")) + case Ident(x) if (x==n) => Ident(TermName("_arg")) case tt @ TypeTree() if tt.original != null => TypeTree(tt.tpe) setOriginal transform(tt.original) // without the fix to LazyTreeCopier.Annotated, we would need to uncomment the line below to make the macro work // that's because the pattern match in the input expression gets expanded into Typed(<x>, TypeTree(<Int @unchecked>)) diff --git a/test/files/pos/annotations.scala b/test/files/pos/annotations.scala index 706a715bad..4832ce4ecd 100644 --- a/test/files/pos/annotations.scala +++ b/test/files/pos/annotations.scala @@ -2,7 +2,7 @@ class ann(i: Int) extends scala.annotation.Annotation class cfann(x: String) extends annotation.ClassfileAnnotation // annotations on abstract types -abstract class C1[@serializable @cloneable +T, U, V[_]] +abstract class C1[@annotation.elidable(0) +T, U, V[_]] abstract class C2[@deprecated @ann(1) T <: Number, V] diff --git a/test/pending/run/t5418.check b/test/files/pos/attachments-typed-another-ident.check index e69de29bb2..e69de29bb2 100644 --- a/test/pending/run/t5418.check +++ b/test/files/pos/attachments-typed-another-ident.check diff --git a/test/files/neg/t5692a.flags b/test/files/pos/attachments-typed-another-ident.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/neg/t5692a.flags +++ b/test/files/pos/attachments-typed-another-ident.flags diff --git a/test/files/pos/attachments-typed-another-ident/Impls_1.scala b/test/files/pos/attachments-typed-another-ident/Impls_1.scala new file mode 100644 index 0000000000..c3f541075e --- /dev/null +++ b/test/files/pos/attachments-typed-another-ident/Impls_1.scala @@ -0,0 +1,17 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object MyAttachment + +object Macros { + def impl(c: Context) = { + import c.universe._ + val ident = Ident(TermName("bar")) updateAttachment MyAttachment + assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments) + val typed = c.typeCheck(ident) + assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments) + c.Expr[Int](typed) + } + + def foo = macro impl +} diff --git a/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala b/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala new file mode 100644 index 0000000000..022639bfe9 --- /dev/null +++ b/test/files/pos/attachments-typed-another-ident/Macros_Test_2.scala @@ -0,0 +1,5 @@ +object Test extends App { + def bar = 2 + Macros.foo +} + diff --git a/test/files/pos/attachments-typed-ident/Impls_1.scala b/test/files/pos/attachments-typed-ident/Impls_1.scala index cc40893a93..c382cabc59 100644 --- a/test/files/pos/attachments-typed-ident/Impls_1.scala +++ b/test/files/pos/attachments-typed-ident/Impls_1.scala @@ -6,7 +6,7 @@ object MyAttachment object Macros { def impl(c: Context) = { import c.universe._ - val ident = Ident(newTermName("bar")) updateAttachment MyAttachment + val ident = Ident(TermName("bar")) updateAttachment MyAttachment assert(ident.attachments.get[MyAttachment.type].isDefined, ident.attachments) val typed = c.typeCheck(ident) assert(typed.attachments.get[MyAttachment.type].isDefined, typed.attachments) diff --git a/test/files/pos/attributes.scala b/test/files/pos/attributes.scala index ec735d0aae..60e00bff7d 100644 --- a/test/files/pos/attributes.scala +++ b/test/files/pos/attributes.scala @@ -1,3 +1,5 @@ +class serializable extends annotation.StaticAnnotation + @serializable class C1; @serializable @volatile class C2; @serializable @volatile class C3; diff --git a/test/files/pos/chang/Test.scala b/test/files/pos/chang/Test.scala index 9bb745e377..f74c6355b5 100644 --- a/test/files/pos/chang/Test.scala +++ b/test/files/pos/chang/Test.scala @@ -1,3 +1,3 @@ -object Test extends Application { +object Test extends App { new com.netgents.hello.Outer[String] } diff --git a/test/files/pos/cycle-jsoup.flags b/test/files/pos/cycle-jsoup.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/pos/cycle-jsoup.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/pos/cycle-jsoup.scala b/test/files/pos/cycle-jsoup.scala new file mode 100644 index 0000000000..879e693537 --- /dev/null +++ b/test/files/pos/cycle-jsoup.scala @@ -0,0 +1,5 @@ +object Test { + def main(args : Array[String]) { + org.jsoup.Jsoup.parse(null: java.net.URL, 3000) + } +} diff --git a/test/files/pos/cycle.flags b/test/files/pos/cycle.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/pos/cycle.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/pos/cycle/J_1.java b/test/files/pos/cycle/J_1.java new file mode 100644 index 0000000000..0cc218eebe --- /dev/null +++ b/test/files/pos/cycle/J_1.java @@ -0,0 +1,16 @@ +package bar; + +public class J_1 { + public void f(C.D arg) { + } +} + +class B extends J_1 { + public void g(C.D arg) { + } +} + +class C extends B { + public class D { + } +} diff --git a/test/files/pos/cycle/X_2.scala b/test/files/pos/cycle/X_2.scala new file mode 100644 index 0000000000..c1840f3b99 --- /dev/null +++ b/test/files/pos/cycle/X_2.scala @@ -0,0 +1,3 @@ +import bar.J_1._ //<--- illegal cyclic reference involving + +class X diff --git a/test/files/pos/depmet_implicit_oopsla_session_simpler.scala b/test/files/pos/depmet_implicit_oopsla_session_simpler.scala index d2986ef56f..7c9af66611 100644 --- a/test/files/pos/depmet_implicit_oopsla_session_simpler.scala +++ b/test/files/pos/depmet_implicit_oopsla_session_simpler.scala @@ -5,7 +5,7 @@ object Sessions { def run(dp: Dual): Unit } - sealed case class Stop extends Session { + sealed case class Stop() extends Session { type Dual = Stop def run(dp: Dual): Unit = {} diff --git a/test/pending/pos/exhaust_2.scala b/test/files/pos/exhaust_2.scala index 4f4e47c43b..4f4e47c43b 100644 --- a/test/pending/pos/exhaust_2.scala +++ b/test/files/pos/exhaust_2.scala diff --git a/test/files/pos/infer2-pos.scala b/test/files/pos/infer2-pos.scala index 06d0f5814f..0ed9666f40 100644 --- a/test/files/pos/infer2-pos.scala +++ b/test/files/pos/infer2-pos.scala @@ -1,7 +1,7 @@ package test class Lst[T] case class cons[T](x: T, xs: Lst[T]) extends Lst[T] -case class nil[T] extends Lst[T] +case class nil[T]() extends Lst[T] object test { Console.println(cons(1, nil())) } diff --git a/test/files/neg/javaConversions-2.10-ambiguity.scala b/test/files/pos/javaConversions-2.10-ambiguity.scala index e856846a29..c4aad6cbfc 100644 --- a/test/files/neg/javaConversions-2.10-ambiguity.scala +++ b/test/files/pos/javaConversions-2.10-ambiguity.scala @@ -5,6 +5,6 @@ import java.util.concurrent.{ConcurrentHashMap => CHM} object Bar { def assertType[T](t: T) = t val a = new CHM[String, String]() += (("", "")) - assertType[mutable.ConcurrentMap[String, String]](a) + assertType[concurrent.Map[String, String]](a) } // vim: set et: diff --git a/test/files/pos/javaConversions-2.10-regression.scala b/test/files/pos/javaConversions-2.10-regression.scala index e1b81015ba..7c7ff03b55 100644 --- a/test/files/pos/javaConversions-2.10-regression.scala +++ b/test/files/pos/javaConversions-2.10-regression.scala @@ -3,10 +3,10 @@ import JavaConversions._ import java.util.concurrent.{ConcurrentHashMap => CHM} object Foo { - def buildCache2_9_simple[K <: AnyRef, V <: AnyRef]: mutable.ConcurrentMap[K, V] = - asScalaConcurrentMap(new CHM()) + def buildCache2_9_simple[K <: AnyRef, V <: AnyRef]: concurrent.Map[K, V] = + mapAsScalaConcurrentMap(new CHM()) - def buildCache2_9_implicit[K <: AnyRef, V <: AnyRef]: mutable.ConcurrentMap[K, V] = + def buildCache2_9_implicit[K <: AnyRef, V <: AnyRef]: concurrent.Map[K, V] = new CHM[K, V]() } diff --git a/test/files/pos/liftcode_polymorphic.scala b/test/files/pos/liftcode_polymorphic.scala index 8f537d278a..249f5a0569 100644 --- a/test/files/pos/liftcode_polymorphic.scala +++ b/test/files/pos/liftcode_polymorphic.scala @@ -1,6 +1,6 @@ import scala.reflect.runtime.universe._ -object Append extends Application { +object Append extends App { def append[A](l1: List[A], l2: List[A]):List[A] = l1 match { diff --git a/test/pending/pos/no-widen-locals.scala b/test/files/pos/no-widen-locals.scala index 013e63f0a2..013e63f0a2 100644 --- a/test/pending/pos/no-widen-locals.scala +++ b/test/files/pos/no-widen-locals.scala diff --git a/test/files/pos/sealed-final.flags b/test/files/pos/sealed-final.flags new file mode 100644 index 0000000000..cfabf7a5b4 --- /dev/null +++ b/test/files/pos/sealed-final.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Yinline-warnings -optimise
\ No newline at end of file diff --git a/test/files/pos/sealed-final.scala b/test/files/pos/sealed-final.scala new file mode 100644 index 0000000000..bdedb5c1f6 --- /dev/null +++ b/test/files/pos/sealed-final.scala @@ -0,0 +1,14 @@ +sealed abstract class Foo { + @inline def bar(x: Int) = x + 1 +} +object Foo { + def mkFoo(): Foo = new Baz2 +} + +object Baz1 extends Foo +final class Baz2 extends Foo + +object Test { + // bar should be inlined now + def f = Foo.mkFoo() bar 10 +} diff --git a/test/files/pos/spec-Function1.scala b/test/files/pos/spec-Function1.scala index 5b6af67a74..2a3074fd14 100644 --- a/test/files/pos/spec-Function1.scala +++ b/test/files/pos/spec-Function1.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/files/pos/spec-annotations.scala b/test/files/pos/spec-annotations.scala index 48281e5df5..b23abf48e8 100644 --- a/test/files/pos/spec-annotations.scala +++ b/test/files/pos/spec-annotations.scala @@ -1,7 +1,7 @@ class ann(i: Int) extends scala.annotation.Annotation // annotations on abstract types -abstract class C1[@serializable @cloneable +T, U, V[_]] +abstract class C1[@annotation.elidable(0) +T, U, V[_]] abstract class C2[@deprecated @ann(1) T <: Number, V] diff --git a/test/files/pos/spec-arrays.scala b/test/files/pos/spec-arrays.scala index 84f6eef071..7ae2cb1efb 100644 --- a/test/files/pos/spec-arrays.scala +++ b/test/files/pos/spec-arrays.scala @@ -177,38 +177,11 @@ class ScalaSpec3Test extends Test { } } -object TestJava extends scala.testing.Benchmark { - def run() { - (new JavaTest).run() - } -} - -object TestSpec extends scala.testing.Benchmark { - def run() { - (new ScalaSpecTest).run() - } -} - -object TestSpec2 extends scala.testing.Benchmark { - def run() { - (new ScalaSpec2Test).run() - } -} - -object TestGen extends scala.testing.Benchmark { - def run() { - (new ScalaGenTest).run() - } -} - -object TestWrap extends scala.testing.Benchmark { - def run() { - (new ScalaWrapTest).run() - } -} - -object TestSpec3 extends scala.testing.Benchmark { - def run() { - (new ScalaSpec3Test).run() - } +object TestRunner { + (new JavaTest).run() + (new ScalaSpecTest).run() + (new ScalaSpec2Test).run() + (new ScalaGenTest).run() + (new ScalaWrapTest).run() + (new ScalaSpec3Test).run() } diff --git a/test/files/pos/spec-funs.scala b/test/files/pos/spec-funs.scala index 611ec0ef62..b9acbe171a 100644 --- a/test/files/pos/spec-funs.scala +++ b/test/files/pos/spec-funs.scala @@ -54,10 +54,7 @@ final class ClosureTest { } } -object TestInt extends scala.testing.Benchmark { - def run() = (new IntTest).run() -} - -object TestClosure extends scala.testing.Benchmark { - def run() = (new ClosureTest).run() +object TestRunner { + (new IntTest).run() + (new ClosureTest).run() } diff --git a/test/files/pos/super.cmds b/test/files/pos/super.cmds deleted file mode 100644 index 8f3f8a4172..0000000000 --- a/test/files/pos/super.cmds +++ /dev/null @@ -1,2 +0,0 @@ -javac Super_1.java -scalac Super_2.scala diff --git a/test/files/pos/t0301.scala b/test/files/pos/t0301.scala index cb68f38062..24b4776010 100644 --- a/test/files/pos/t0301.scala +++ b/test/files/pos/t0301.scala @@ -1,7 +1,7 @@ package fos abstract class Expr -case class Var extends Expr +case class Var() extends Expr object Analyzer { def substitution(expr: Expr, cls: (Var,Var)): Expr = diff --git a/test/files/pos/t0422.scala b/test/files/pos/t0422.scala index cb3ba279d4..2adfa392d2 100644 --- a/test/files/pos/t0422.scala +++ b/test/files/pos/t0422.scala @@ -1,5 +1,4 @@ -import scala.util.regexp.WordExp; -import scala.util.automata.WordBerrySethi; +package scala.xml.dtd.impl object BoolWordExp extends WordExp { type _labelT = MyLabels; diff --git a/test/files/pos/t0851.scala b/test/files/pos/t0851.scala new file mode 100644 index 0000000000..fc7109dcd4 --- /dev/null +++ b/test/files/pos/t0851.scala @@ -0,0 +1,14 @@ +package test + +object test1 { + case class Foo[T,T2](f : (T,T2) => String) extends (((T,T2)) => String){ + def apply(t : T) = (s:T2) => f(t,s) + def apply(p : (T,T2)) = f(p._1,p._2) + } + implicit def g[T](f : (T,String) => String) = Foo(f) + def main(args : Array[String]) : Unit = { + val f = (x:Int,s:String) => s + x + println(f(1)) + () + } +} diff --git a/test/files/pos/t0872.scala b/test/files/pos/t0872.scala new file mode 100644 index 0000000000..8f4c1c4436 --- /dev/null +++ b/test/files/pos/t0872.scala @@ -0,0 +1,8 @@ +object Main { + def main(args : Array[String]) { + 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/t1029.cmds b/test/files/pos/t1029.cmds deleted file mode 100644 index 06b863dc03..0000000000 --- a/test/files/pos/t1029.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac Test_1.scala -scalac Test_2.scala diff --git a/test/files/pos/t1107.scala b/test/files/pos/t1107a.scala index 0bf40bb4cc..0bf40bb4cc 100644 --- a/test/files/pos/t1107.scala +++ b/test/files/pos/t1107a.scala diff --git a/test/files/pos/t1203.scala b/test/files/pos/t1203a.scala index 062ef93fc6..062ef93fc6 100644 --- a/test/files/pos/t1203.scala +++ b/test/files/pos/t1203a.scala diff --git a/test/files/pos/t1230/S.scala b/test/files/pos/t1230/S.scala index f8a691b6de..530dd4b853 100644 --- a/test/files/pos/t1230/S.scala +++ b/test/files/pos/t1230/S.scala @@ -1 +1 @@ -object S extends Application { (new J).foo = 5 } +object S extends App { (new J).foo = 5 } diff --git a/test/files/pos/t1231/S.scala b/test/files/pos/t1231/S.scala index ee08866e04..f14aa2561b 100644 --- a/test/files/pos/t1231/S.scala +++ b/test/files/pos/t1231/S.scala @@ -1 +1 @@ -object S extends Application { println(J.j1) } +object S extends App { println(J.j1) } diff --git a/test/files/pos/t1385.scala b/test/files/pos/t1385.scala index 59953bcc39..6fe7308281 100644 --- a/test/files/pos/t1385.scala +++ b/test/files/pos/t1385.scala @@ -1,3 +1,3 @@ -@serializable object Test { - private def readResolve:AnyRef = this +object Test extends Serializable { + private def readResolve: AnyRef = this } diff --git a/test/files/pos/t1439.flags b/test/files/pos/t1439.flags index 1e70f5c5c7..bca57e4785 100644 --- a/test/files/pos/t1439.flags +++ b/test/files/pos/t1439.flags @@ -1 +1 @@ --unchecked -Xfatal-warnings -Xoldpatmat -language:higherKinds +-unchecked -Xfatal-warnings -language:higherKinds diff --git a/test/pending/pos/t1751/A1_2.scala b/test/files/pos/t1751/A1_2.scala index 354d5eecd0..354d5eecd0 100644 --- a/test/pending/pos/t1751/A1_2.scala +++ b/test/files/pos/t1751/A1_2.scala diff --git a/test/pending/pos/t1751/A2_1.scala b/test/files/pos/t1751/A2_1.scala index c768062e43..c768062e43 100644 --- a/test/pending/pos/t1751/A2_1.scala +++ b/test/files/pos/t1751/A2_1.scala diff --git a/test/pending/pos/t1751/SuiteClasses.java b/test/files/pos/t1751/SuiteClasses.java index a415e4f572..a415e4f572 100644 --- a/test/pending/pos/t1751/SuiteClasses.java +++ b/test/files/pos/t1751/SuiteClasses.java diff --git a/test/pending/pos/t1782/Ann.java b/test/files/pos/t1782/Ann.java index 0dcfbd2ed7..0dcfbd2ed7 100644 --- a/test/pending/pos/t1782/Ann.java +++ b/test/files/pos/t1782/Ann.java diff --git a/test/pending/pos/t1782/Days.java b/test/files/pos/t1782/Days.java index 203a87b1c2..203a87b1c2 100644 --- a/test/pending/pos/t1782/Days.java +++ b/test/files/pos/t1782/Days.java diff --git a/test/pending/pos/t1782/ImplementedBy.java b/test/files/pos/t1782/ImplementedBy.java index 6aa8b4fa9e..6aa8b4fa9e 100644 --- a/test/pending/pos/t1782/ImplementedBy.java +++ b/test/files/pos/t1782/ImplementedBy.java diff --git a/test/pending/pos/t1782/Test_1.scala b/test/files/pos/t1782/Test_1.scala index 6467a74c29..6467a74c29 100644 --- a/test/pending/pos/t1782/Test_1.scala +++ b/test/files/pos/t1782/Test_1.scala diff --git a/test/files/pos/t1942.cmds b/test/files/pos/t1942.cmds deleted file mode 100644 index c14311042a..0000000000 --- a/test/files/pos/t1942.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac A_1.scala -scalac Test_2.scala diff --git a/test/files/pos/t2421b_pos.scala b/test/files/pos/t2421b_pos.scala index 8b848abb75..0df3461662 100644 --- a/test/files/pos/t2421b_pos.scala +++ b/test/files/pos/t2421b_pos.scala @@ -11,7 +11,7 @@ object Test { f } -/* bug: +/* bug: error: ambiguous implicit values: both method b in object Test1 of type [X <: Test1.B]Test1.F[X] and method a in object Test1 of type => Test1.F[Test1.A] diff --git a/test/files/pos/t2464.cmds b/test/files/pos/t2464.cmds deleted file mode 100644 index ca733ef23d..0000000000 --- a/test/files/pos/t2464.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac JavaOne.java -scalac ScalaOne_1.scala -scalac t2464_2.scala diff --git a/test/files/pos/t2484.scala b/test/files/pos/t2484.scala index 7d1b7cb03c..29f798edf9 100755 --- a/test/files/pos/t2484.scala +++ b/test/files/pos/t2484.scala @@ -1,7 +1,9 @@ +import concurrent.ExecutionContext.Implicits.global + class Admin extends javax.swing.JApplet { val jScrollPane = new javax.swing.JScrollPane (null, 0, 0) def t2484: Unit = { - scala.concurrent.ops.spawn {jScrollPane.synchronized { + scala.concurrent.future {jScrollPane.synchronized { def someFunction () = {} //scala.concurrent.ops.spawn {someFunction ()} jScrollPane.addComponentListener (new java.awt.event.ComponentAdapter {override def componentShown (e: java.awt.event.ComponentEvent) = { diff --git a/test/files/pos/t2698.scala b/test/files/pos/t2698.scala index 0e2662de61..7de50a13d6 100644 --- a/test/files/pos/t2698.scala +++ b/test/files/pos/t2698.scala @@ -1,5 +1,6 @@ +package scala.xml.dtd.impl + import scala.collection._ -import scala.util.regexp._ abstract class S2 { val lang: WordExp diff --git a/test/files/pos/t2726.cmds b/test/files/pos/t2726.cmds deleted file mode 100644 index 5fcb18bfbb..0000000000 --- a/test/files/pos/t2726.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac SQLBuilder_1.scala -scalac test_2.scala diff --git a/test/pending/pos/t294/Ann.java b/test/files/pos/t294/Ann.java index 934ca46297..934ca46297 100644 --- a/test/pending/pos/t294/Ann.java +++ b/test/files/pos/t294/Ann.java diff --git a/test/pending/pos/t294/Ann2.java b/test/files/pos/t294/Ann2.java index 025b79e794..025b79e794 100644 --- a/test/pending/pos/t294/Ann2.java +++ b/test/files/pos/t294/Ann2.java diff --git a/test/pending/pos/t294/Test_1.scala b/test/files/pos/t294/Test_1.scala index ff1f34b10e..ff1f34b10e 100644 --- a/test/pending/pos/t294/Test_1.scala +++ b/test/files/pos/t294/Test_1.scala diff --git a/test/pending/pos/t294/Test_2.scala b/test/files/pos/t294/Test_2.scala index 9fb1c6e175..9fb1c6e175 100644 --- a/test/pending/pos/t294/Test_2.scala +++ b/test/files/pos/t294/Test_2.scala diff --git a/test/files/pos/t3160.scala b/test/files/pos/t3160.scala new file mode 100644 index 0000000000..3309ece160 --- /dev/null +++ b/test/files/pos/t3160.scala @@ -0,0 +1,6 @@ +import scala.collection.mutable._ +import scala.xml._ + +class A { + def f(x: Node): Node = ??? +} diff --git a/test/files/pos/t342.scala b/test/files/pos/t342.scala deleted file mode 100644 index 752b24d2ba..0000000000 --- a/test/files/pos/t342.scala +++ /dev/null @@ -1,8 +0,0 @@ -object Main extends App { - - object Foo extends Enumeration(0, "Bar") { // 2 - val Bar = Value - } - import Foo._; - Console.println(Bar) -} diff --git a/test/files/pos/t344.scala b/test/files/pos/t344.scala index 8a6ad9120d..449a763af7 100644 --- a/test/files/pos/t344.scala +++ b/test/files/pos/t344.scala @@ -1,7 +1,7 @@ object Bug { class A; - case class A1 extends A; - case class A2 extends A; + case class A1() extends A; + case class A2() extends A; def f: A = if (true) A1() diff --git a/test/files/pos/t3577.scala b/test/files/pos/t3577.scala new file mode 100644 index 0000000000..80a280f67a --- /dev/null +++ b/test/files/pos/t3577.scala @@ -0,0 +1,29 @@ +case class Check[A](val value: A) + +case class C2(checks: Check[_]*); + +object C { + def m(x : C2): Any = (null: Any) match { + case C2(_, rest @ _*) => { + rest.map(_.value) + } + } +} + +/////////////////// + +object Container { + trait Exp[+T] + abstract class FuncExp[-S, +T] + + sealed abstract class FoundNode[T, Repr] { + def optimize[TupleT, U, That](parentNode: FlatMap[T, Repr, U, That]): Any + def optimize2[TupleT, U, That](parentNode: Any): Any + } + + class FlatMap[T, Repr, U, That] + + val Seq(fn: FoundNode[t, repr]) = Seq[FoundNode[_, _]]() + fn.optimize(null) // was: scala.MatchError: ? (of class BoundedWildcardType) @ Variances#varianceInType + fn.optimize2(null) // was: fatal error: bad type: ?(class scala.reflect.internal.Types$BoundedWildcardType) @ Pickle.putType +} diff --git a/test/files/pos/t3864/tuples_1.scala b/test/files/pos/t3864/tuples_1.scala index 1d19af6e41..5e97f8452b 100644 --- a/test/files/pos/t3864/tuples_1.scala +++ b/test/files/pos/t3864/tuples_1.scala @@ -1,11 +1,11 @@ -trait PimpedType[X] { +trait EnrichedType[X] { val value: X } trait Tuples { - -trait Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends PimpedType[Tuple15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]] { + +trait Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends EnrichedType[Tuple15[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple15[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15)) @@ -13,8 +13,8 @@ trait Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] extends PimpedType[T implicit def ToTuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)): Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] = new { val value = t } with Tuple15W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O] - -trait Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends PimpedType[Tuple16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]] { + +trait Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends EnrichedType[Tuple16[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple16[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16)) @@ -22,8 +22,8 @@ trait Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] extends PimpedTyp implicit def ToTuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)): Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] = new { val value = t } with Tuple16W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P] - -trait Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends PimpedType[Tuple17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]] { + +trait Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends EnrichedType[Tuple17[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple17[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17)) @@ -31,8 +31,8 @@ trait Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] extends Pimped implicit def ToTuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)): Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] = new { val value = t } with Tuple17W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q] - -trait Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends PimpedType[Tuple18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]] { + +trait Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends EnrichedType[Tuple18[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple18[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18)) @@ -40,8 +40,8 @@ trait Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] extends Pim implicit def ToTuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)): Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] = new { val value = t } with Tuple18W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R] - -trait Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends PimpedType[Tuple19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]] { + +trait Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends EnrichedType[Tuple19[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple19[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _, _19: (S => SS) = identity[S] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18), _19(value._19)) @@ -49,8 +49,8 @@ trait Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] extends implicit def ToTuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)): Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] = new { val value = t } with Tuple19W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S] - -trait Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] extends PimpedType[Tuple20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]] { + +trait Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] extends EnrichedType[Tuple20[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple20[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _, _19: (S => SS) = identity[S] _, _20: (T => TT) = identity[T] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18), _19(value._19), _20(value._20)) @@ -58,8 +58,8 @@ trait Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] exten implicit def ToTuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)): Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] = new { val value = t } with Tuple20W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T] - -trait Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] extends PimpedType[Tuple21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]] { + +trait Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] extends EnrichedType[Tuple21[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple21[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT, UU](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _, _19: (S => SS) = identity[S] _, _20: (T => TT) = identity[T] _, _21: (U => UU) = identity[U] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT, UU) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18), _19(value._19), _20(value._20), _21(value._21)) @@ -67,12 +67,12 @@ trait Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] ex implicit def ToTuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)): Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] = new { val value = t } with Tuple21W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U] - -trait Tuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] extends PimpedType[Tuple22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]] { + +trait Tuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] extends EnrichedType[Tuple22[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V]] { def fold[Z](f: => (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) => Z): Z = {import value._; f(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22)} def toIndexedSeq[Z](implicit ev: value.type <:< Tuple22[Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z, Z]): IndexedSeq[Z] = {val zs = ev(value); import zs._; IndexedSeq(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22)} def mapElements[AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT, UU, VV](_1: (A => AA) = identity[A] _, _2: (B => BB) = identity[B] _, _3: (C => CC) = identity[C] _, _4: (D => DD) = identity[D] _, _5: (E => EE) = identity[E] _, _6: (F => FF) = identity[F] _, _7: (G => GG) = identity[G] _, _8: (H => HH) = identity[H] _, _9: (I => II) = identity[I] _, _10: (J => JJ) = identity[J] _, _11: (K => KK) = identity[K] _, _12: (L => LL) = identity[L] _, _13: (M => MM) = identity[M] _, _14: (N => NN) = identity[N] _, _15: (O => OO) = identity[O] _, _16: (P => PP) = identity[P] _, _17: (Q => QQ) = identity[Q] _, _18: (R => RR) = identity[R] _, _19: (S => SS) = identity[S] _, _20: (T => TT) = identity[T] _, _21: (U => UU) = identity[U] _, _22: (V => VV) = identity[V] _): (AA, BB, CC, DD, EE, FF, GG, HH, II, JJ, KK, LL, MM, NN, OO, PP, QQ, RR, SS, TT, UU, VV) = (_1(value._1), _2(value._2), _3(value._3), _4(value._4), _5(value._5), _6(value._6), _7(value._7), _8(value._8), _9(value._9), _10(value._10), _11(value._11), _12(value._12), _13(value._13), _14(value._14), _15(value._15), _16(value._16), _17(value._17), _18(value._18), _19(value._19), _20(value._20), _21(value._21), _22(value._22)) } implicit def ToTuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](t: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)): Tuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] = new { val value = t } with Tuple22W[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V] -}
\ No newline at end of file +} diff --git a/test/files/pos/t422.scala b/test/files/pos/t422.scala deleted file mode 100644 index cb3ba279d4..0000000000 --- a/test/files/pos/t422.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.util.regexp.WordExp; -import scala.util.automata.WordBerrySethi; - -object BoolWordExp extends WordExp { - type _labelT = MyLabels; - type _regexpT = RegExp; - abstract class MyLabels extends Label ; - case class MyLabel(c:Char) extends MyLabels; -} - -object MyTranslator extends WordBerrySethi { - override val lang = BoolWordExp; - import lang._; - override protected def seenLabel( r:RegExp, i:Int, label: _labelT ): Unit = { - super.seenLabel(r,i,label) - } -} diff --git a/test/files/pos/t4649.flags b/test/files/pos/t4649.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/pos/t4649.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/pending/pos/t4649.scala b/test/files/pos/t4649.scala index 0d6caa8d7a..0d6caa8d7a 100644 --- a/test/pending/pos/t4649.scala +++ b/test/files/pos/t4649.scala diff --git a/test/files/pos/t4744.flags b/test/files/pos/t4744.flags new file mode 100644 index 0000000000..ca20f55172 --- /dev/null +++ b/test/files/pos/t4744.flags @@ -0,0 +1 @@ +-Ybreak-cycles diff --git a/test/files/pos/t4744/Bar.scala b/test/files/pos/t4744/Bar.scala new file mode 100644 index 0000000000..1fb6d78973 --- /dev/null +++ b/test/files/pos/t4744/Bar.scala @@ -0,0 +1 @@ +class Bar { val quux = new Foo[java.lang.Integer]() } diff --git a/test/files/pos/t4744/Foo.java b/test/files/pos/t4744/Foo.java new file mode 100644 index 0000000000..6c764d0470 --- /dev/null +++ b/test/files/pos/t4744/Foo.java @@ -0,0 +1 @@ +public class Foo<T extends Comparable<? super T>> {} diff --git a/test/pending/pos/t4786.scala b/test/files/pos/t4786.scala index f0579142b8..f0579142b8 100644 --- a/test/pending/pos/t4786.scala +++ b/test/files/pos/t4786.scala diff --git a/test/files/pos/t5130.scala b/test/files/pos/t5130.scala new file mode 100644 index 0000000000..676d3c7050 --- /dev/null +++ b/test/files/pos/t5130.scala @@ -0,0 +1,46 @@ +import scala.language.reflectiveCalls + +class A { + this_a => + + def b = new B + class B { def a: this_a.type = this_a } +} +trait A2 { def c = () } + +object Test { + val v1 = new A { def c = () } + val v2 = new A with A2 { } + val v3: A { def c: Unit } = null + def d1 = new A { def c = () } + def d2 = new A with A2 { } + def d3: A { def c: Unit } = null + var x1 = new A { def c = () } + var x2 = new A with A2 { } + var x3: A { def c: Unit } = null + + def main(args: Array[String]): Unit = { + val mv1 = new A { def c = () } + val mv2 = new A with A2 { } + val mv3: A { def c: Unit } = null + def md1 = new A { def c = () } + def md2 = new A with A2 { } + def md3: A { def c: Unit } = null + + v1.b.a.c + v2.b.a.c + v3.b.a.c + d1.b.a.c + d2.b.a.c + d3.b.a.c + x1.b.a.c + x2.b.a.c + x3.b.a.c + mv1.b.a.c + mv2.b.a.c + mv3.b.a.c + md1.b.a.c + md2.b.a.c + md3.b.a.c + } +} diff --git a/test/files/pos/t5223.scala b/test/files/pos/t5223.scala index 0b2528e367..d81daa9907 100644 --- a/test/files/pos/t5223.scala +++ b/test/files/pos/t5223.scala @@ -2,5 +2,5 @@ import scala.reflect.runtime.universe._ object Foo extends App { reify{def printf(format: String, args: Any*): String = null } - reify{def printf(format: String, args: Any*): String = ("abc": @cloneable)} + reify{def printf(format: String, args: Any*): String = ("abc": @deprecated)} }
\ No newline at end of file diff --git a/test/pending/pos/t5399a.scala b/test/files/pos/t5399a.scala index 4ebd85ad03..4ebd85ad03 100644 --- a/test/pending/pos/t5399a.scala +++ b/test/files/pos/t5399a.scala diff --git a/test/files/pos/t5604b/T_1.scala b/test/files/pos/t5604b/T_1.scala new file mode 100644 index 0000000000..179dcb10c6 --- /dev/null +++ b/test/files/pos/t5604b/T_1.scala @@ -0,0 +1,6 @@ +// sandbox/t5604/T.scala +package t6504 + +trait T { + def foo: Boolean = false +} diff --git a/test/files/pos/t5604b/T_2.scala b/test/files/pos/t5604b/T_2.scala new file mode 100644 index 0000000000..179dcb10c6 --- /dev/null +++ b/test/files/pos/t5604b/T_2.scala @@ -0,0 +1,6 @@ +// sandbox/t5604/T.scala +package t6504 + +trait T { + def foo: Boolean = false +} diff --git a/test/files/pos/t5604b/Test_1.scala b/test/files/pos/t5604b/Test_1.scala new file mode 100644 index 0000000000..f7c58ebe83 --- /dev/null +++ b/test/files/pos/t5604b/Test_1.scala @@ -0,0 +1,7 @@ +// sandbox/t5604/Test.scala +package t6504 + +object Test { + def blerg1(a: Any): Any = if (foo) blerg1(0) + def blerg2(a: Any): Any = if (t6504.foo) blerg2(0) +} diff --git a/test/files/pos/t5604b/Test_2.scala b/test/files/pos/t5604b/Test_2.scala new file mode 100644 index 0000000000..f7c58ebe83 --- /dev/null +++ b/test/files/pos/t5604b/Test_2.scala @@ -0,0 +1,7 @@ +// sandbox/t5604/Test.scala +package t6504 + +object Test { + def blerg1(a: Any): Any = if (foo) blerg1(0) + def blerg2(a: Any): Any = if (t6504.foo) blerg2(0) +} diff --git a/test/files/pos/t5604b/pack_1.scala b/test/files/pos/t5604b/pack_1.scala new file mode 100644 index 0000000000..f50d568bfa --- /dev/null +++ b/test/files/pos/t5604b/pack_1.scala @@ -0,0 +1,5 @@ +// sandbox/t5604/pack.scala +package t6504 + +object `package` extends T { +} diff --git a/test/pending/pos/t5606.scala b/test/files/pos/t5606.scala index 2545271e32..2545271e32 100644 --- a/test/pending/pos/t5606.scala +++ b/test/files/pos/t5606.scala diff --git a/test/pending/pos/t5639/Bar.scala b/test/files/pos/t5639/Bar.scala index f577500acd..f577500acd 100644 --- a/test/pending/pos/t5639/Bar.scala +++ b/test/files/pos/t5639/Bar.scala diff --git a/test/pending/pos/t5639/Foo.scala b/test/files/pos/t5639/Foo.scala index 6602150661..6602150661 100644 --- a/test/pending/pos/t5639/Foo.scala +++ b/test/files/pos/t5639/Foo.scala diff --git a/test/files/pos/t5644/BoxesRunTime.java b/test/files/pos/t5644/BoxesRunTime.java index 241bf79ac8..74c4c6b4b9 100644 --- a/test/files/pos/t5644/BoxesRunTime.java +++ b/test/files/pos/t5644/BoxesRunTime.java @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2006-2011, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2006-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/files/pos/t5692a.check b/test/files/pos/t5692a.check new file mode 100644 index 0000000000..7fbfb5dba7 --- /dev/null +++ b/test/files/pos/t5692a.check @@ -0,0 +1,4 @@ +Test_2.scala:2: error: this type parameter must be specified + def x = Macros.foo + ^ +one error found diff --git a/test/files/neg/t5692b.flags b/test/files/pos/t5692a.flags index cd66464f2f..cd66464f2f 100644 --- a/test/files/neg/t5692b.flags +++ b/test/files/pos/t5692a.flags diff --git a/test/files/neg/t5692a/Macros_1.scala b/test/files/pos/t5692a/Macros_1.scala index 06b5a3de36..06b5a3de36 100644 --- a/test/files/neg/t5692a/Macros_1.scala +++ b/test/files/pos/t5692a/Macros_1.scala diff --git a/test/files/neg/t5692a/Test_2.scala b/test/files/pos/t5692a/Test_2.scala index 08d510cc6f..08d510cc6f 100644 --- a/test/files/neg/t5692a/Test_2.scala +++ b/test/files/pos/t5692a/Test_2.scala diff --git a/test/files/pos/t5692b.check b/test/files/pos/t5692b.check new file mode 100644 index 0000000000..16796826b4 --- /dev/null +++ b/test/files/pos/t5692b.check @@ -0,0 +1,4 @@ +Test_2.scala:2: error: these type parameters must be specified + def x = Macros.foo + ^ +one error found diff --git a/test/files/pos/t5692b.flags b/test/files/pos/t5692b.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/pos/t5692b.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/neg/t5692b/Macros_1.scala b/test/files/pos/t5692b/Macros_1.scala index b28d19f903..b28d19f903 100644 --- a/test/files/neg/t5692b/Macros_1.scala +++ b/test/files/pos/t5692b/Macros_1.scala diff --git a/test/files/neg/t5692b/Test_2.scala b/test/files/pos/t5692b/Test_2.scala index 08d510cc6f..08d510cc6f 100644 --- a/test/files/neg/t5692b/Test_2.scala +++ b/test/files/pos/t5692b/Test_2.scala diff --git a/test/files/pos/t5809.scala b/test/files/pos/t5809.scala index 133e13c4ed..6101f546b3 100644 --- a/test/files/pos/t5809.scala +++ b/test/files/pos/t5809.scala @@ -1,5 +1,6 @@ package object foo { - implicit class PimpedInt(foo: Int) { + implicit class EnrichedInt(foo: Int) { def bar = ??? + def bippy = foo } -}
\ No newline at end of file +} diff --git a/test/files/pos/t5858.scala b/test/files/pos/t5858.scala new file mode 100644 index 0000000000..f2b0f58d76 --- /dev/null +++ b/test/files/pos/t5858.scala @@ -0,0 +1,3 @@ +object Test { + new xml.Elem(null, null, xml.Null, xml.TopScope, Nil: _*) // was ambiguous +} diff --git a/test/files/pos/t5859.scala b/test/files/pos/t5859.scala new file mode 100644 index 0000000000..2a31e68ee5 --- /dev/null +++ b/test/files/pos/t5859.scala @@ -0,0 +1,15 @@ + +class A { + def f(xs: List[Int], ys: AnyRef*) = () + def f(xs: AnyRef*) = () + + f() + f(List[AnyRef](): _*) + f(List(): _*) + f(Nil: _*) + f(Array(): _*) + f(Array[AnyRef](): _*) + f(List(1)) + f(List(1), Nil: _*) + f(List(1), Array(): _*) +} diff --git a/test/files/pos/t5877.scala b/test/files/pos/t5877.scala index c7827df99f..939013cd01 100644 --- a/test/files/pos/t5877.scala +++ b/test/files/pos/t5877.scala @@ -7,8 +7,8 @@ package foo { } package object foo { - // Crasher: No synthetics for method PimpedFoo2: synthetics contains - implicit class PimpedFoo2(value: Foo) { + // Crasher: No synthetics for method EnrichedFoo2: synthetics contains + implicit class EnrichedFoo2(value: Foo) { def huzzah = "" } } diff --git a/test/files/pos/t5877b.scala b/test/files/pos/t5877b.scala index 6b8cbd473e..43a2ea2f06 100644 --- a/test/files/pos/t5877b.scala +++ b/test/files/pos/t5877b.scala @@ -7,7 +7,7 @@ object Test { } object `package` { - implicit class PimpedFoo2(value: Foo) { + implicit class EnrichedFoo2(value: Foo) { def huzzah = "" } } diff --git a/test/files/pos/t6072.scala b/test/files/pos/t6072.scala new file mode 100644 index 0000000000..e25ebbffc5 --- /dev/null +++ b/test/files/pos/t6072.scala @@ -0,0 +1,3 @@ +class A { + object B { def eq(lvl: Int) = ??? } +} diff --git a/test/files/pos/t6301.scala b/test/files/pos/t6301.scala new file mode 100644 index 0000000000..fa81bbfa77 --- /dev/null +++ b/test/files/pos/t6301.scala @@ -0,0 +1,9 @@ +trait LoadedOver[@specialized(Int) A] { + def foo(x: Any): A + def foo(xs: String): A +} + +object Test { + def loaded: AnyRef with LoadedOver[Int] = sys.error("") + loaded.foo("") +} diff --git a/test/files/pos/t640.scala b/test/files/pos/t640.scala index 55f61df8af..45608bc3d4 100644 --- a/test/files/pos/t640.scala +++ b/test/files/pos/t640.scala @@ -1,2 +1,2 @@ -@serializable class A -@serializable class B extends A +class A extends Serializable +class B extends A with Serializable diff --git a/test/files/pos/t6447.scala b/test/files/pos/t6447.scala new file mode 100644 index 0000000000..1c0c0f2a31 --- /dev/null +++ b/test/files/pos/t6447.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +class X { type T } + +object X { + // this works + def foo(x: X): x.T = macro fooImpl + def fooImpl(c: Context)(x: c.Expr[X]): c.Expr[x.value.T] = ??? + + // this doesn't + def bar(x: X, y: X): (x.T, y.T) = macro barImpl + def barImpl(c: Context)(x: c.Expr[X], y: c.Expr[X]): c.Expr[(x.value.T, y.value.T)] = ??? + + // neither does this + def baz(x: X)(xs: List[x.T]): Unit = macro bazImpl + def bazImpl(c: Context)(x: c.Expr[X])(xs: c.Expr[List[x.value.T]]): c.Expr[Unit] = ??? +} diff --git a/test/files/pos/t6482.scala b/test/files/pos/t6482.scala new file mode 100644 index 0000000000..24ea38e519 --- /dev/null +++ b/test/files/pos/t6482.scala @@ -0,0 +1,11 @@ +final class TraversableOnceOps[+A](val collection: TraversableOnce[A]) extends AnyVal { + def reduceLeftOption[B >: A](op: (B, A) => B): Option[B] = + if (collection.isEmpty) None else Some(collection.reduceLeft[B](op)) +} +// error: type arguments [B] do not conform to method reduceLeft's type parameter bounds [B >: A] +// if (collection.isEmpty) None else Some(collection.reduceLeft[B](op)) +// ^ + +class Foo[+A <: AnyRef](val xs: List[A]) extends AnyVal { + def baz[B >: A](x: B): List[B] = x :: xs +} diff --git a/test/files/pos/t6595.flags b/test/files/pos/t6595.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/pos/t6595.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/pos/t6595.scala b/test/files/pos/t6595.scala new file mode 100644 index 0000000000..437c0bcf05 --- /dev/null +++ b/test/files/pos/t6595.scala @@ -0,0 +1,18 @@ +import scala.annotation.switch + +class Foo extends { + final val b0 = 5 +} with AnyRef { + final val b1 = 10 + + // Using the @switch annotation as a means of testing that the + // type inferred for b0 is Int(5) and not Int. Only in the former + // case can a switch be generated. + def f(p: Int) = (p: @switch) match { + case `b0` => 1 + case `b1` => 2 + case 15 => 3 + case 20 => 4 + case _ => 5 + } +} diff --git a/test/files/pos/t6664.scala b/test/files/pos/t6664.scala new file mode 100644 index 0000000000..7eb85f619d --- /dev/null +++ b/test/files/pos/t6664.scala @@ -0,0 +1,4 @@ +final case class A(i: Int, s: String) { + protected def copy(s2: String): A = A(i, s2) + protected def copy(i2: Int): A = A(i2, s) +} diff --git a/test/files/pos/t6664b.scala b/test/files/pos/t6664b.scala new file mode 100644 index 0000000000..a622866838 --- /dev/null +++ b/test/files/pos/t6664b.scala @@ -0,0 +1,5 @@ +object T { + def A(s: String): A = new A(3, s) + def A(i: Int): A = A(i, "abc") + case class A(i: Int, s: String) +} diff --git a/test/files/pos/t6745.scala b/test/files/pos/t6745.scala new file mode 100644 index 0000000000..2ab8e6d39a --- /dev/null +++ b/test/files/pos/t6745.scala @@ -0,0 +1,4 @@ +class Bar(val i: Int) { + self: Any with AnyRef => + def this() = this(0) +} diff --git a/test/files/pos/t6966.scala b/test/files/pos/t6966.scala new file mode 100644 index 0000000000..23adc6d0d2 --- /dev/null +++ b/test/files/pos/t6966.scala @@ -0,0 +1,17 @@ +import Ordering.{Byte, comparatorToOrdering} +trait Format[T] +trait InputCache[T] +object CacheIvy { + implicit def basicInputCache[I](implicit fmt: Format[I], eqv: Equiv[I]): InputCache[I] = null + implicit def arrEquiv[T](implicit t: Equiv[T]): Equiv[Array[T]] = null + implicit def hNilCache: InputCache[HNil] = null + implicit def ByteArrayFormat: Format[Array[Byte]] = null + type :+:[H, T <: HList] = HCons[H,T] + implicit def hConsCache[H, T <: HList](implicit head: InputCache[H], tail: InputCache[T]): InputCache[H :+: T] = null + hConsCache[Array[Byte], HNil] +} + +sealed trait HList +sealed trait HNil extends HList +object HNil extends HNil +final class HCons[H, T <: HList](head : H, tail : T) extends HList
\ No newline at end of file diff --git a/test/files/pos/t715.cmds b/test/files/pos/t715.cmds deleted file mode 100644 index 2836967fca..0000000000 --- a/test/files/pos/t715.cmds +++ /dev/null @@ -1,2 +0,0 @@ -scalac meredith_1.scala -scalac runner_2.scala diff --git a/test/files/pos/t715/meredith_1.scala b/test/files/pos/t715/meredith_1.scala index 8261b9881a..c28afb4a9b 100644 --- a/test/files/pos/t715/meredith_1.scala +++ b/test/files/pos/t715/meredith_1.scala @@ -3,7 +3,7 @@ package com.sap.dspace.model.othello; import scala.xml._ trait XMLRenderer { - type T <: Any {def getClass() : java.lang.Class[_]} + type T <: Any {def getClass(): java.lang.Class[_]} val valueTypes = List( classOf[java.lang.Boolean], @@ -14,21 +14,21 @@ trait XMLRenderer { ) def value2XML( - value : Object, - field : java.lang.reflect.Field, - pojo : T - ) : Node = { + value: Object, + field: java.lang.reflect.Field, + pojo: T + ): Node = { value match { - case null => Text( "null" ) + case null => Text("null") case vUnmatched => if (value.isInstanceOf[java.lang.Boolean]) - Text( value.asInstanceOf[java.lang.Boolean].toString ) + Text(value.asInstanceOf[java.lang.Boolean].toString) else if (value.isInstanceOf[java.lang.Integer]) - Text( value.asInstanceOf[java.lang.Integer].toString ) + Text(value.asInstanceOf[java.lang.Integer].toString) else if (value.isInstanceOf[java.lang.Float]) - Text( value.asInstanceOf[java.lang.Float].toString ) + Text(value.asInstanceOf[java.lang.Float].toString) // else if (value.isInstanceOf[T]) - // pojo2XML( value.asInstanceOf[T] ) + // pojo2XML(value.asInstanceOf[T]) else <unmatchedType> <theType> @@ -42,16 +42,16 @@ trait XMLRenderer { } def field2XML( - field : java.lang.reflect.Field, - pojo : T - ) : Elem = { + field: java.lang.reflect.Field, + pojo: T + ): Elem = { - val accessible = field.isAccessible; - field.setAccessible( true ); + val accessible = field.isAccessible + field.setAccessible(true) // BUGBUG lgm need to disambiguate on type and possibly make // recursive call to pojo2XML - val fldValXML = value2XML( field.get( pojo ), field, pojo ); - field.setAccessible( accessible ); + val fldValXML = value2XML(field.get( pojo ), field, pojo) + field.setAccessible( accessible ) Elem( null, @@ -62,37 +62,37 @@ trait XMLRenderer { ) } - def pojo2XML( pojo : T ) : Elem = { + def pojo2XML(pojo: T): Elem = { val progeny = for (field <- pojo.getClass.getDeclaredFields) - yield field2XML( field, pojo ); + yield field2XML(field, pojo) Elem( null, pojo.getClass.getName, null, TopScope, - progeny.asInstanceOf[Array[scala.xml.Node]] : _* + progeny.asInstanceOf[Array[scala.xml.Node]]: _* ) } } -case class POJO2XMLRenderer( recurse : Boolean ) +case class POJO2XMLRenderer(recurse: Boolean) extends XMLRenderer { type T = java.io.Serializable override def value2XML( - value : Object, - field : java.lang.reflect.Field, - pojo : java.io.Serializable - ) : Node = { - if (recurse) super.value2XML( value, field, pojo ) - else Text( value + "" ) + value: Object, + field: java.lang.reflect.Field, + pojo: java.io.Serializable + ): Node = { + if (recurse) super.value2XML(value, field, pojo) + else Text(value + "") } } -object thePOJO2XMLRenderer extends POJO2XMLRenderer( true ) { +object thePOJO2XMLRenderer extends POJO2XMLRenderer(true) { } -object Test extends Application { +object Test extends App { println(com.sap.dspace.model.othello.thePOJO2XMLRenderer) } diff --git a/test/files/pos/t715/runner_2.scala b/test/files/pos/t715/runner_2.scala index 1e4f40d654..d54805629a 100644 --- a/test/files/pos/t715/runner_2.scala +++ b/test/files/pos/t715/runner_2.scala @@ -1,3 +1,3 @@ -object Test extends Application { +object Test extends App { println(com.sap.dspace.model.othello.thePOJO2XMLRenderer) } diff --git a/test/files/pos/t911.scala b/test/files/pos/t911.scala index 224b14cda3..cfa4f49dc1 100644 --- a/test/files/pos/t911.scala +++ b/test/files/pos/t911.scala @@ -1,6 +1,6 @@ object Test { -def foo : Any = { - case class Foo {} - Foo; -} + def foo: Any = { + case class Foo() {} + Foo; + } } diff --git a/test/files/pos/ticket2251.scala b/test/files/pos/ticket2251.scala index b3afee4ea9..c220e85350 100644 --- a/test/files/pos/ticket2251.scala +++ b/test/files/pos/ticket2251.scala @@ -22,4 +22,18 @@ lub of List(D, C) is B[_2] forSome { type _2 >: D with C{} <: B[_1] forSome { ty // should be: B[X] forSome {type X <: B[X]} -- can this be done automatically? for now, just detect f-bounded polymorphism and fall back to more coarse approximation val data: List[A] = List(new C, new D) + + val data2 = List(new C, new D) + + val data3: List[B[X] forSome { type X <: B[_ <: A] }] = List(new C, new D) + + // Not yet -- + // val data4: List[B[X] forSome { type X <: B[X] }] = List(new C, new D) + // <console>:7: error: type mismatch; + // found : List[B[_ >: D with C <: B[_ >: D with C <: A]]] + // required: List[B[X] forSome { type X <: B[X] }] + // val data4: List[B[X] forSome { type X <: B[X] }] = List(new C, new D) + + // works + val data5 = List[B[X] forSome { type X <: B[X] }](new C, new D) } diff --git a/test/files/pos/variances-flip.scala b/test/files/pos/variances-flip.scala new file mode 100644 index 0000000000..c3ea7b571d --- /dev/null +++ b/test/files/pos/variances-flip.scala @@ -0,0 +1,7 @@ +trait Foo[-A, +B, -C, +D] { + private[this] def b: B = ??? + private[this] def d: D = ??? + + def f(p1: B => A, p2: D => C) = g(p1(b), p2(d)) + def g(x: A, y: C) = ((b, d)) +} diff --git a/test/files/pos/variances-local.scala b/test/files/pos/variances-local.scala new file mode 100644 index 0000000000..35e395095c --- /dev/null +++ b/test/files/pos/variances-local.scala @@ -0,0 +1,7 @@ +class Foo1[+T] { + private[this] type MyType = T +} + +class Foo2[+T] { + protected[this] type MyType = T +} diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check index 3a08e2a2ea..dd3ee68e45 100644 --- a/test/files/presentation/callcc-interpreter.check +++ b/test/files/presentation/callcc-interpreter.check @@ -3,7 +3,7 @@ reload: CallccInterpreter.scala askTypeCompletion at CallccInterpreter.scala(51,38) ================================================================================ [response] aksTypeCompletion at (51,38) -retrieved 64 members +retrieved 63 members [accessible: true] `class AddcallccInterpreter.Add` [accessible: true] `class AppcallccInterpreter.App` [accessible: true] `class CcccallccInterpreter.Ccc` @@ -50,7 +50,6 @@ retrieved 64 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> callccInterpreter.type` [accessible: true] `method →[B](y: B)(callccInterpreter.type, B)` [accessible: true] `object WrongcallccInterpreter.Wrong.type` [accessible: true] `trait TermcallccInterpreter.Term` diff --git a/test/files/presentation/ide-bug-1000349.check b/test/files/presentation/ide-bug-1000349.check index 44a3207d75..7eeaddc054 100644 --- a/test/files/presentation/ide-bug-1000349.check +++ b/test/files/presentation/ide-bug-1000349.check @@ -3,7 +3,7 @@ reload: CompletionOnEmptyArgMethod.scala askTypeCompletion at CompletionOnEmptyArgMethod.scala(2,17) ================================================================================ [response] aksTypeCompletion at (2,17) -retrieved 37 members +retrieved 36 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -32,7 +32,6 @@ retrieved 37 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> Foo` [accessible: true] `method →[B](y: B)(Foo, B)` [accessible: true] `value __leftOfArrowFoo` [accessible: true] `value __resultOfEnsuringFoo` diff --git a/test/files/presentation/ide-bug-1000475.check b/test/files/presentation/ide-bug-1000475.check index 34c3b557d8..01de4608ca 100644 --- a/test/files/presentation/ide-bug-1000475.check +++ b/test/files/presentation/ide-bug-1000475.check @@ -3,7 +3,7 @@ reload: Foo.scala askTypeCompletion at Foo.scala(3,7) ================================================================================ [response] aksTypeCompletion at (3,7) -retrieved 36 members +retrieved 35 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -29,7 +29,6 @@ retrieved 36 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> Object` [accessible: true] `method →[B](y: B)(Object, B)` [accessible: true] `value __leftOfArrowObject` [accessible: true] `value __resultOfEnsuringObject` @@ -41,7 +40,7 @@ retrieved 36 members askTypeCompletion at Foo.scala(6,10) ================================================================================ [response] aksTypeCompletion at (6,10) -retrieved 36 members +retrieved 35 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -67,7 +66,6 @@ retrieved 36 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> Object` [accessible: true] `method →[B](y: B)(Object, B)` [accessible: true] `value __leftOfArrowObject` [accessible: true] `value __resultOfEnsuringObject` @@ -79,7 +77,7 @@ retrieved 36 members askTypeCompletion at Foo.scala(7,7) ================================================================================ [response] aksTypeCompletion at (7,7) -retrieved 36 members +retrieved 35 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -105,7 +103,6 @@ retrieved 36 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> Object` [accessible: true] `method →[B](y: B)(Object, B)` [accessible: true] `value __leftOfArrowObject` [accessible: true] `value __resultOfEnsuringObject` diff --git a/test/files/presentation/ide-bug-1000531.check b/test/files/presentation/ide-bug-1000531.check index 4be98a6b21..7fa550179f 100644 --- a/test/files/presentation/ide-bug-1000531.check +++ b/test/files/presentation/ide-bug-1000531.check @@ -3,7 +3,7 @@ reload: CrashOnLoad.scala askTypeCompletion at CrashOnLoad.scala(6,12) ================================================================================ [response] aksTypeCompletion at (6,12) -retrieved 126 members +retrieved 124 members [accessible: true] `class GroupedIteratorIterator[B]#GroupedIterator` [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` @@ -12,14 +12,13 @@ retrieved 126 members [accessible: true] `method ++[B >: B](that: => scala.collection.GenTraversableOnce[B])Iterator[B]` [accessible: true] `method ->[B](y: B)(java.util.Iterator[B], B)` [accessible: true] `method /:[B](z: B)(op: (B, B) => B)B` -[accessible: true] `method /:\[A1 >: B](z: A1)(op: (A1, A1) => A1)A1` [accessible: true] `method :\[B](z: B)(op: (B, B) => B)B` [accessible: true] `method ==(x$1: Any)Boolean` [accessible: true] `method ==(x$1: AnyRef)Boolean` [accessible: true] `method addString(b: StringBuilder)StringBuilder` [accessible: true] `method addString(b: StringBuilder, sep: String)StringBuilder` [accessible: true] `method addString(b: StringBuilder, start: String, sep: String, end: String)StringBuilder` -[accessible: true] `method aggregate[B](z: B)(seqop: (B, B) => B, combop: (B, B) => B)B` +[accessible: true] `method aggregate[B](z: => B)(seqop: (B, B) => B, combop: (B, B) => B)B` [accessible: true] `method asInstanceOf[T0]=> T0` [accessible: true] `method buffered=> scala.collection.BufferedIterator[B]` [accessible: true] `method collectFirst[B](pf: PartialFunction[B,B])Option[B]` @@ -115,7 +114,6 @@ retrieved 126 members [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` [accessible: true] `method withFilter(p: B => Boolean)Iterator[B]` -[accessible: true] `method x=> java.util.Iterator[B]` [accessible: true] `method zipAll[B, A1 >: B, B1 >: B](that: Iterator[B], thisElem: A1, thatElem: B1)Iterator[(A1, B1)]` [accessible: true] `method zipWithIndex=> Iterator[(B, Int)]` [accessible: true] `method zip[B](that: Iterator[B])Iterator[(B, B)]` diff --git a/test/files/presentation/implicit-member.check b/test/files/presentation/implicit-member.check index 05d6f61699..7b4f792bf3 100644 --- a/test/files/presentation/implicit-member.check +++ b/test/files/presentation/implicit-member.check @@ -3,7 +3,7 @@ reload: ImplicitMember.scala askTypeCompletion at ImplicitMember.scala(7,7) ================================================================================ [response] aksTypeCompletion at (7,7) -retrieved 39 members +retrieved 38 members [accessible: true] `class AppliedImplicitImplicit.AppliedImplicit` [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` @@ -33,7 +33,6 @@ retrieved 39 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> Implicit.type` [accessible: true] `method →[B](y: B)(Implicit.type, B)` [accessible: true] `value __leftOfArrowImplicit.type` [accessible: true] `value __resultOfEnsuringImplicit.type` diff --git a/test/files/presentation/ping-pong.check b/test/files/presentation/ping-pong.check index b666d51de5..c85f6cc21a 100644 --- a/test/files/presentation/ping-pong.check +++ b/test/files/presentation/ping-pong.check @@ -3,7 +3,7 @@ reload: PingPong.scala askTypeCompletion at PingPong.scala(10,23) ================================================================================ [response] aksTypeCompletion at (10,23) -retrieved 40 members +retrieved 39 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -30,7 +30,6 @@ retrieved 40 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> Pong` [accessible: true] `method →[B](y: B)(Pong, B)` [accessible: true] `value __leftOfArrowPong` [accessible: true] `value __resultOfEnsuringPong` @@ -44,7 +43,7 @@ retrieved 40 members askTypeCompletion at PingPong.scala(19,20) ================================================================================ [response] aksTypeCompletion at (19,20) -retrieved 40 members +retrieved 39 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -73,7 +72,6 @@ retrieved 40 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> Ping` [accessible: true] `method →[B](y: B)(Ping, B)` [accessible: true] `value __leftOfArrowPing` [accessible: true] `value __resultOfEnsuringPing` diff --git a/test/files/presentation/t5708.check b/test/files/presentation/t5708.check index c6d4762635..572f404cf4 100644 --- a/test/files/presentation/t5708.check +++ b/test/files/presentation/t5708.check @@ -3,7 +3,7 @@ reload: Completions.scala askTypeCompletion at Completions.scala(17,9) ================================================================================ [response] aksTypeCompletion at (17,9) -retrieved 44 members +retrieved 43 members [accessible: true] `lazy value fooInt` [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` @@ -31,7 +31,6 @@ retrieved 44 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> test.Compat.type` [accessible: true] `method →[B](y: B)(test.Compat.type, B)` [accessible: true] `value CONST_STRINGString("constant")` [accessible: true] `value __leftOfArrowtest.Compat.type` diff --git a/test/files/presentation/visibility.check b/test/files/presentation/visibility.check index 3026e58f7e..87b4463bf7 100644 --- a/test/files/presentation/visibility.check +++ b/test/files/presentation/visibility.check @@ -3,7 +3,7 @@ reload: Completions.scala askTypeCompletion at Completions.scala(14,12) ================================================================================ [response] aksTypeCompletion at (14,12) -retrieved 42 members +retrieved 41 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -36,7 +36,6 @@ retrieved 42 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> accessibility.Foo` [accessible: true] `method →[B](y: B)(accessibility.Foo, B)` [accessible: true] `value __leftOfArrowaccessibility.Foo` [accessible: true] `value __resultOfEnsuringaccessibility.Foo` @@ -47,7 +46,7 @@ retrieved 42 members askTypeCompletion at Completions.scala(16,11) ================================================================================ [response] aksTypeCompletion at (16,11) -retrieved 42 members +retrieved 41 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -81,7 +80,6 @@ retrieved 42 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> accessibility.Foo` [accessible: true] `method →[B](y: B)(accessibility.Foo, B)` [accessible: true] `value __leftOfArrowaccessibility.Foo` [accessible: true] `value __resultOfEnsuringaccessibility.Foo` @@ -91,7 +89,7 @@ retrieved 42 members askTypeCompletion at Completions.scala(22,11) ================================================================================ [response] aksTypeCompletion at (22,11) -retrieved 42 members +retrieved 41 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -124,7 +122,6 @@ retrieved 42 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> accessibility.AccessibilityChecks` [accessible: true] `method →[B](y: B)(accessibility.AccessibilityChecks, B)` [accessible: true] `value __leftOfArrowaccessibility.AccessibilityChecks` [accessible: true] `value __resultOfEnsuringaccessibility.AccessibilityChecks` @@ -135,7 +132,7 @@ retrieved 42 members askTypeCompletion at Completions.scala(28,10) ================================================================================ [response] aksTypeCompletion at (28,10) -retrieved 42 members +retrieved 41 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -164,7 +161,6 @@ retrieved 42 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> accessibility.Foo` [accessible: true] `method →[B](y: B)(accessibility.Foo, B)` [accessible: true] `value __leftOfArrowaccessibility.Foo` [accessible: true] `value __resultOfEnsuringaccessibility.Foo` @@ -179,7 +175,7 @@ retrieved 42 members askTypeCompletion at Completions.scala(37,8) ================================================================================ [response] aksTypeCompletion at (37,8) -retrieved 42 members +retrieved 41 members [accessible: true] `method !=(x$1: Any)Boolean` [accessible: true] `method !=(x$1: AnyRef)Boolean` [accessible: true] `method ##()Int` @@ -207,7 +203,6 @@ retrieved 42 members [accessible: true] `method wait()Unit` [accessible: true] `method wait(x$1: Long)Unit` [accessible: true] `method wait(x$1: Long, x$2: Int)Unit` -[accessible: true] `method x=> accessibility.Foo` [accessible: true] `method →[B](y: B)(accessibility.Foo, B)` [accessible: true] `value __leftOfArrowaccessibility.Foo` [accessible: true] `value __resultOfEnsuringaccessibility.Foo` diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala index 27395683b4..bdeb1fd811 100644 --- a/test/files/run/bitsets.scala +++ b/test/files/run/bitsets.scala @@ -85,8 +85,8 @@ object TestImmutable { import scala.collection.immutable.BitSet val is0 = BitSet() - val is1 = BitSet.fromArray(Array()) - val is2 = BitSet.fromArray(Array(4)) + val is1 = BitSet.fromBitMask(Array()) + val is2 = BitSet.fromBitMask(Array(4)) val is3 = BitSet.empty Console.println("is0 = " + is0) diff --git a/test/files/run/caseclasses.scala b/test/files/run/caseclasses.scala index 5aafea59e3..668c984f3d 100644 --- a/test/files/run/caseclasses.scala +++ b/test/files/run/caseclasses.scala @@ -1,6 +1,6 @@ case class Foo(x: Int)(y: Int) -case class Bar +case class Bar() abstract class Base abstract case class Abs(x: Int) extends Base diff --git a/test/files/run/collection-stacks.check b/test/files/run/collection-stacks.check new file mode 100644 index 0000000000..aa25cd1fa6 --- /dev/null +++ b/test/files/run/collection-stacks.check @@ -0,0 +1,14 @@ +3-2-1: true +3-2-1: true +apply +3: true +3: true +1: true +1: true +top +3: true +3: true +pop +2-1: true +3: true +2-1: true diff --git a/test/files/run/collection-stacks.scala b/test/files/run/collection-stacks.scala new file mode 100644 index 0000000000..be9fbbf1ae --- /dev/null +++ b/test/files/run/collection-stacks.scala @@ -0,0 +1,38 @@ +import scala.collection.{ immutable, mutable } + +object Test extends App { + def mutableStack[T](xs: T*): mutable.Stack[T] = { + val s = new mutable.Stack[T] + s.pushAll(xs) + s + } + + def immutableStack[T](xs: T*): immutable.Stack[T] = { + immutable.Stack.empty[T] pushAll xs + } + + def check[T](expected: T, got: T) { + println(got + ": " + (expected == got)) + } + + // check #957 + check("3-2-1", immutableStack(1, 2, 3).iterator.mkString("-")) + check("3-2-1", mutableStack(1, 2, 3).iterator.mkString("-")) + + println("apply") + check(3, immutableStack(1, 2, 3).apply(0)) + check(3, mutableStack(1, 2, 3).apply(0)) + check(1, immutableStack(1, 2, 3).apply(2)) + check(1, mutableStack(1, 2, 3).apply(2)) + + println("top") + check(3, immutableStack(1, 2, 3).top) + check(3, mutableStack(1, 2, 3).top) + + println("pop") + check("2-1", immutableStack(1, 2, 3).pop.mkString("-")) + check(3, mutableStack(1, 2, 3).pop()) + check("2-1", { val s = mutableStack(1, 2, 3); s.pop(); s.toList.mkString("-") }) +} + +// vim: set ts=2 sw=2 et: diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala index 19feb45101..0d4b504d3c 100644 --- a/test/files/run/compiler-asSeenFrom.scala +++ b/test/files/run/compiler-asSeenFrom.scala @@ -47,10 +47,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+$""", "") } @@ -61,7 +61,7 @@ package ll { } def permuteAsSeenFrom(targs: List[Type]) = ( - for { + for { tp <- typeRefs(targs filterNot (_ eq NoType)) prefix <- asSeenPrefixes if tp.prefix != prefix @@ -72,11 +72,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 } @@ -84,7 +84,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) => @@ -95,7 +95,7 @@ package ll { } } } - + def pretty(xs: List[_]) = if (xs.isEmpty) "" else xs.mkString("\n ", "\n ", "\n") def signaturesIn(info: Type): List[String] = ( @@ -103,11 +103,11 @@ 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._ - afterTyper { + exitingTyper { val typeArgs = List[Type](IntClass.tpe, ListClass[Int]) ++ tparams.map(_.tpe) permute(typeArgs) foreach println } diff --git a/test/files/run/constant-type.check b/test/files/run/constant-type.check index dfd8be5297..4eededb8ba 100644 --- a/test/files/run/constant-type.check +++ b/test/files/run/constant-type.check @@ -13,16 +13,16 @@ scala> :power scala> val s = transformedType(StringClass.toType).asInstanceOf[Type] s: $r.intp.global.Type = String -scala> { println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } +scala> { println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } Class[String](classOf[java.lang.String]) -scala> { afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } +scala> { exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } Class(classOf[java.lang.String]) -scala> { ConstantType(Constant(s)); println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } +scala> { ConstantType(Constant(s)); println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } Class[String](classOf[java.lang.String]) -scala> { ConstantType(Constant(s)); afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } +scala> { ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } Class(classOf[java.lang.String]) scala> diff --git a/test/files/run/constant-type.scala b/test/files/run/constant-type.scala index 84539e2895..373746af4a 100644 --- a/test/files/run/constant-type.scala +++ b/test/files/run/constant-type.scala @@ -9,9 +9,9 @@ object Test extends ReplTest { def code = """ :power val s = transformedType(StringClass.toType).asInstanceOf[Type] -{ println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } -{ afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } -{ ConstantType(Constant(s)); println(afterPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } -{ ConstantType(Constant(s)); afterPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } +{ println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))) } +{ exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))) } +{ ConstantType(Constant(s)); println(exitingPhase(currentRun.erasurePhase)(ConstantType(Constant(s)))); } +{ ConstantType(Constant(s)); exitingPhase(currentRun.erasurePhase)(println(ConstantType(Constant(s)))); } """ } diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index da97a378e6..d4b8692fa3 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -37,7 +37,7 @@ scala> object Stuff { val x = "hello" val y : Int @Annot(x) = 10 } -defined module Stuff +defined object Stuff scala> @@ -127,7 +127,7 @@ defined class rep scala> scala> object A { val x = "hello" : String @ rep } -defined module A +defined object A warning: previously defined class A is not a companion to object A. Companions must be defined together; you may wish to use :paste mode for this. diff --git a/test/files/run/ctries-new/iterator.scala b/test/files/run/ctries-new/iterator.scala index b953a40e00..bb1175e61b 100644 --- a/test/files/run/ctries-new/iterator.scala +++ b/test/files/run/ctries-new/iterator.scala @@ -1,144 +1,134 @@ - - - - import collection._ import collection.concurrent.TrieMap - - 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) - // println(a) - // println(b) - // println(a.toSeq.sortBy((x: (Wrap, Int)) => x._1.i)) - // println(b.toSeq.sortBy((x: (Wrap, Int)) => x._1.i)) } assert(a == b) } - + "be consistent when taken with concurrent modifications" in { val sz = 25000 val W = 15 @@ -146,40 +136,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 @@ -187,17 +177,16 @@ 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) { assert(ct.remove(new Wrap(i)) == Some(i)) for (i <- 0 until removerslowdown) ct.get(new Wrap(i)) // slow down, mate } - //println("done removing") } } - + def consistentIteration(it: Iterator[(Wrap, Int)]) = { class Iter extends Thread { override def run() { @@ -210,7 +199,7 @@ object IteratorSpec extends Spec { } new Iter } - + val remover = new Remover remover.start() for (_ <- 0 until sgroupnum) { @@ -218,27 +207,25 @@ object IteratorSpec extends Spec { iters.foreach(_.start()) iters.foreach(_.join()) } - //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) { assert(ct.put(new Wrap(i), i) == None) for (i <- 0 until inserterslowdown) ct.get(new Wrap(i)) // slow down, mate } - //println("done inserting") } } - + def consistentIteration(it: Iterator[(Wrap, Int)]) = { class Iter extends Thread { override def run() { @@ -251,7 +238,7 @@ object IteratorSpec extends Spec { } new Iter } - + val inserter = new Inserter inserter.start() for (_ <- 0 until sgroupnum) { @@ -259,31 +246,30 @@ object IteratorSpec extends Spec { iters.foreach(_.start()) iters.foreach(_.join()) } - //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/deeps.check b/test/files/run/deeps.check new file mode 100644 index 0000000000..a68e474f62 --- /dev/null +++ b/test/files/run/deeps.check @@ -0,0 +1,87 @@ +testEquals1 +false +false +true + +testEquals2 +false +false +true + +testEquals3 +x=Array(1) +y=Array(1) +false +false +true + +x=Array(Array(1), Array(1)) +y=Array(Array(1), Array(1)) +false +false +true + +x=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1))) +y=Array(Array(Array(1), Array(1)), Array(Array(1), Array(1))) +false +false +true + +testEquals4 +false +false +true +false +false +true +Array(true, false) +Array(true, false) +[true;false] +true;false + +Array(Array(true, false), Array(true, false)) +Array(Array(true, false), Array(true, false)) +[Array(true, false);Array(true, false)] +Array(true, false);Array(true, false) + +Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false))) +Array(Array(Array(true, false), Array(true, false)), Array(Array(true, false), Array(true, false))) +[Array(Array(true, false), Array(true, false));Array(Array(true, false), Array(true, false))] +Array(Array(true, false), Array(true, false));Array(Array(true, false), Array(true, false)) + +Array(1.0, 0.0) +Array(1.0, 0.0) +[1.0;0.0] +1.0;0.0 + +Array(Array(1.0, 0.0), Array(1.0, 0.0)) +Array(Array(1.0, 0.0), Array(1.0, 0.0)) +[Array(1.0, 0.0);Array(1.0, 0.0)] +Array(1.0, 0.0);Array(1.0, 0.0) + +Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0))) +Array(Array(Array(1.0, 0.0), Array(1.0, 0.0)), Array(Array(1.0, 0.0), Array(1.0, 0.0))) +[Array(Array(1.0, 0.0), Array(1.0, 0.0));Array(Array(1.0, 0.0), Array(1.0, 0.0))] +Array(Array(1.0, 0.0), Array(1.0, 0.0));Array(Array(1.0, 0.0), Array(1.0, 0.0)) + +Array(a, b) +Array(a, b) +[a;b] +a;b + +Array(Array(a, b), Array(a, b)) +Array(Array(a, b), Array(a, b)) +[Array(a, b);Array(a, b)] +Array(a, b);Array(a, b) + +Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b))) +Array(Array(Array(a, b), Array(a, b)), Array(Array(a, b), Array(a, b))) +[Array(Array(a, b), Array(a, b));Array(Array(a, b), Array(a, b))] +Array(Array(a, b), Array(a, b));Array(Array(a, b), Array(a, b)) + +[Array(true, false); Array(false)] +[Array(1, 2); Array(3)] +[Array(1, 2); Array(3)] + +Array(boo, and, foo) +Array(a) diff --git a/test/files/run/deeps.scala b/test/files/run/deeps.scala new file mode 100644 index 0000000000..6049cc6024 --- /dev/null +++ b/test/files/run/deeps.scala @@ -0,0 +1,114 @@ +//############################################################################ +// deepEquals / deep.toString +//############################################################################ + +//############################################################################ +// need to revisit array equqality +object Test { + + def testEquals1 { + println(Array(1) == Array(1)) + println(Array(1) equals Array(1)) + println(Array(1).deep == Array(1).deep) + println + } + + def testEquals2 { + println(Array(Array(1), Array(2)) == Array(Array(1), Array(2))) + println(Array(Array(1), Array(2)) equals Array(Array(1), Array(2))) + println(Array(Array(1), Array(2)).deep equals Array(Array(1), Array(2)).deep) + println + } + + def testEquals3 { + val a1 = Array(1) + val b1 = Array(1) + val a2 = Array(a1, b1) + val b2 = Array(a1, b1) + val a3 = Array(a2, b2) + val b3 = Array(a2, b2) + def test[T](x: Array[T], y: Array[T]) { + println("x=" + x.deep.toString) + println("y=" + y.deep.toString) + println(x == y) + println(x equals y) + println(x.deep == y.deep) + println + } + test(a1, b1) + test(a2, b2) + test(a3, b3) + } + + def testEquals4 { + println("boo:and:foo".split(':') == "boo:and:foo".split(':')) + println("boo:and:foo".split(':') equals "boo:and:foo".split(':')) + println("boo:and:foo".split(':').deep == "boo:and:foo".split(':').deep) + + val xs = new java.util.ArrayList[String](); xs.add("a") + val ys = new java.util.ArrayList[String](); ys.add("a") + println(xs.toArray == ys.toArray) + println(xs.toArray equals ys.toArray) + println(xs.toArray.deep == ys.toArray.deep) + } + + def testToString1 { + def sweep(s: String) = ( + s.replaceAll("D@[0-9a-fA-F]+", "D@0000000") + .replaceAll("Z@[0-9a-fA-F]+", "Z@0000000") + .replaceAll(";@[0-9a-fA-F]+", ";@0000000") + ) + def test[T](a: Array[T]) { + println(sweep(a.deep.toString)) + println(a.deep.toString) + println(a.deep.mkString("[", ";", "]")) + println(a.deep.mkString(";")) + println + } + + val ba1 = Array(true, false) + val ba2 = Array(ba1, ba1) + val ba3 = Array(ba2, ba2) + test(ba1) + test(ba2) + test(ba3) + + val da1 = Array(1.0d, 0.0d) + val da2 = Array(da1, da1) + val da3 = Array(da2, da2) + test(da1) + test(da2) + test(da3) + + val sa1 = Array("a", "b") + val sa2 = Array(sa1, sa1) + val sa3 = Array(sa2, sa2) + test(sa1) + test(sa2) + test(sa3) + } + + def testToString2 { + println(Array(Array(true, false), Array(false)).deep.mkString("[", "; ", "]")) + println(Array(Array('1', '2'), Array('3')).deep.mkString("[", "; ", "]")) + println(Array(Array(1, 2), Array(3)).deep.mkString("[", "; ", "]")) + println + } + + def testToString3 { + println("boo:and:foo".split(':').deep.toString) + + val xs = new java.util.ArrayList[String](); xs.add("a") + println(xs.toArray.deep.toString) + } + + def main(args: Array[String]): Unit = { + println("testEquals1") ; testEquals1 + println("testEquals2") ; testEquals2 + println("testEquals3") ; testEquals3 + println("testEquals4") ; testEquals4 + testToString1 + testToString2 + testToString3 + } +} diff --git a/test/files/run/enums.scala b/test/files/run/enums.scala index 9cdeed2691..3aad7ec320 100644 --- a/test/files/run/enums.scala +++ b/test/files/run/enums.scala @@ -36,8 +36,11 @@ object Test2 { object Test3 { - object Direction extends Enumeration("North", "South", "East", "West") { - val North, South, East, West = Value; + object Direction extends Enumeration { + val North = Value("North") + val South = Value("South") + val East = Value("East") + val West = Value("West") } def run: Int = { @@ -48,8 +51,11 @@ object Test3 { object Test4 { - object Direction extends Enumeration("North", "South", "East", "West") { - val North, South, East, West = Value; + object Direction extends Enumeration { + val North = Value("North") + val South = Value("South") + val East = Value("East") + val West = Value("West") } def run: Int = { diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala index c69d1217fd..14c25849cb 100644 --- a/test/files/run/existentials-in-compiler.scala +++ b/test/files/run/existentials-in-compiler.scala @@ -73,7 +73,7 @@ package extest { def check(source: String, unit: global.CompilationUnit) = { getRequiredPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz => - afterTyper { + exitingTyper { clazz.info println(clazz.defString) println(" " + classExistentialType(clazz) + "\n") diff --git a/test/files/run/hashset.check b/test/files/run/hashset.check new file mode 100644 index 0000000000..9542a1ff48 --- /dev/null +++ b/test/files/run/hashset.check @@ -0,0 +1,26 @@ +*** HashSet primitives +0 true,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true +20 false,21 false,22 false,23 false,24 false,25 false,26 false,27 false,28 false,29 false,30 false,31 false,32 false,33 false,34 false,35 false,36 false,37 false,38 false,39 false +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 + +*** HashSet Strings with null +null true +0 true,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true +20 false,21 false,22 false,23 false,24 false,25 false,26 false,27 false,28 false,29 false,30 false,31 false,32 false,33 false,34 false,35 false,36 false,37 false,38 false,39 false +0,1,10,11,12,13,14,15,16,17,18,19,2,3,4,5,6,7,8,9,null +null false +0 false,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true + +*** ParHashSet primitives +0 true,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true +20 false,21 false,22 false,23 false,24 false,25 false,26 false,27 false,28 false,29 false,30 false,31 false,32 false,33 false,34 false,35 false,36 false,37 false,38 false,39 false +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 + +*** ParHashSet Strings with null +null true +0 true,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true +20 false,21 false,22 false,23 false,24 false,25 false,26 false,27 false,28 false,29 false,30 false,31 false,32 false,33 false,34 false,35 false,36 false,37 false,38 false,39 false +0,1,10,11,12,13,14,15,16,17,18,19,2,3,4,5,6,7,8,9,null +null false +0 false,1 true,10 true,11 true,12 true,13 true,14 true,15 true,16 true,17 true,18 true,19 true,2 true,3 true,4 true,5 true,6 true,7 true,8 true,9 true + diff --git a/test/files/run/hashset.scala b/test/files/run/hashset.scala new file mode 100644 index 0000000000..299dce3aec --- /dev/null +++ b/test/files/run/hashset.scala @@ -0,0 +1,48 @@ +import scala.collection.generic.{Growable, Shrinkable} +import scala.collection.GenSet +import scala.collection.mutable.FlatHashTable +import scala.collection.mutable.HashSet +import scala.collection.parallel.mutable.ParHashSet + +object Test extends App { + test(new Creator{ + def create[A] = new HashSet[A] + def hashSetType = "HashSet" + }) + + test(new Creator{ + def create[A] = new ParHashSet[A] + def hashSetType = "ParHashSet" + }) + + + def test(creator : Creator) { + println("*** " + creator.hashSetType + " primitives") + val h1 = creator.create[Int] + for (i <- 0 until 20) h1 += i + println((for (i <- 0 until 20) yield i + " " + (h1 contains i)).toList.sorted mkString(",")) + println((for (i <- 20 until 40) yield i + " " + (h1 contains i)).toList.sorted mkString(",")) + println(h1.toList.sorted mkString ",") + println + + println("*** " + creator.hashSetType + " Strings with null") + val h2 = creator.create[String] + h2 += null + for (i <- 0 until 20) h2 += "" + i + println("null " + (h2 contains null)) + println((for (i <- 0 until 20) yield i + " " + (h2 contains ("" + i))).toList.sorted mkString(",")) + println((for (i <- 20 until 40) yield i + " " + (h2 contains ("" + i))).toList.sorted mkString(",")) + println((h2.toList map {x => "" + x}).sorted mkString ",") + + h2 -= null + h2 -= "" + 0 + println("null " + (h2 contains null)) + 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 hashSetType : String + } +}
\ No newline at end of file diff --git a/test/files/run/hashsetremove.check b/test/files/run/hashsetremove.check new file mode 100644 index 0000000000..8de9826895 --- /dev/null +++ b/test/files/run/hashsetremove.check @@ -0,0 +1,6 @@ +remove 0 should be false, was false +contains 1 should be true, was true +remove 1 should be true, was true +contains 1 should be false, was false +remove 1 should be false, was false +contains 1 should be false, was false diff --git a/test/files/run/hashsetremove.scala b/test/files/run/hashsetremove.scala new file mode 100644 index 0000000000..7b82a9909b --- /dev/null +++ b/test/files/run/hashsetremove.scala @@ -0,0 +1,13 @@ +import scala.collection.mutable.HashSet + + +object Test extends App { + val h = new HashSet[Int] + h += 1 + println(s"remove 0 should be false, was ${h remove 0}") + println(s"contains 1 should be true, was ${h contains 1}") + println(s"remove 1 should be true, was ${h remove 1}") + println(s"contains 1 should be false, was ${h contains 1}") + println(s"remove 1 should be false, was ${h remove 1}") + println(s"contains 1 should be false, was ${h contains 1}") + }
\ No newline at end of file diff --git a/test/files/run/idempotency-this.check b/test/files/run/idempotency-this.check index 08738c4565..efabaf1ec4 100644 --- a/test/files/run/idempotency-this.check +++ b/test/files/run/idempotency-this.check @@ -1,4 +1,4 @@ List() immutable.this.List.apply[String]("") -Apply(TypeApply(Select(Select(This(newTypeName("immutable")), scala.collection.immutable.List), newTermName("apply")), List(TypeTree().setOriginal(Ident(newTypeName("String"))))), List(Literal(Constant("")))) +Apply(TypeApply(Select(Select(This(TypeName("immutable")), scala.collection.immutable.List), TermName("apply")), List(TypeTree().setOriginal(Ident(TypeName("String"))))), List(Literal(Constant("")))) error! diff --git a/test/files/run/inline-ex-handlers.scala b/test/files/run/inline-ex-handlers.scala index a96b938e13..33e794b940 100644 --- a/test/files/run/inline-ex-handlers.scala +++ b/test/files/run/inline-ex-handlers.scala @@ -1,7 +1,7 @@ import scala.tools.partest.IcodeTest object Test extends IcodeTest { - override def printIcodeAfterPhase = "inlineExceptionHandlers" + override def printIcodeAfterPhase = "inlinehandlers" } import scala.util.Random._ diff --git a/test/files/run/lazy-locals.scala b/test/files/run/lazy-locals.scala index aca15d0357..8d4c61be8c 100644 --- a/test/files/run/lazy-locals.scala +++ b/test/files/run/lazy-locals.scala @@ -120,7 +120,7 @@ object Test extends App { t } - /** test recursive method with lazy vals and a all vals forced */ + /** test recursive method with lazy vals and all vals forced */ def testLazyRecMany(n: Int): Int = { lazy val t = { println("forced lazy val t at n = " + n); 42 } if (n > 0) { diff --git a/test/files/run/lub-visibility.check b/test/files/run/lub-visibility.check index 3461d1bf6b..f3a6bef215 100644 --- a/test/files/run/lub-visibility.check +++ b/test/files/run/lub-visibility.check @@ -8,7 +8,7 @@ scala> // should infer List[scala.collection.immutable.Seq[Nothing]] scala> // but reverted that for SI-5534. scala> val x = List(List(), Vector()) -x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq{def dropRight(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def takeRight(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def drop(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def take(n: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[Any] with scala.collection.AbstractSeq[Any]}]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.Ab... +x: List[scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]{def dropRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]; def takeRight(n: Int): scala.collection.immutable.Seq[Nothing] with scala.collection.AbstractSeq[Nothing]; def drop(n: Int): scala.collecti... scala> scala> diff --git a/test/files/run/macro-abort-fresh/Macros_1.scala b/test/files/run/macro-abort-fresh/Macros_1.scala index af1e292588..415b76852f 100644 --- a/test/files/run/macro-abort-fresh/Macros_1.scala +++ b/test/files/run/macro-abort-fresh/Macros_1.scala @@ -5,7 +5,7 @@ object Impls { import c.universe._ println(c.fresh()) println(c.fresh("qwe")) - println(c.fresh(newTypeName("qwe"))) + println(c.fresh(TypeName("qwe"))) c.abort(NoPosition, "blargh") } } diff --git a/test/files/run/macro-abort-fresh/Test_2.scala b/test/files/run/macro-abort-fresh/Test_2.scala index 0b9986e9f6..61f0bdfadc 100644 --- a/test/files/run/macro-abort-fresh/Test_2.scala +++ b/test/files/run/macro-abort-fresh/Test_2.scala @@ -2,7 +2,7 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Select(Ident(newTermName("Macros")), newTermName("foo")) + val tree = Select(Ident(TermName("Macros")), TermName("foo")) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala index 646634c972..ce30366c61 100644 --- a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala +++ b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala @@ -3,19 +3,19 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) c.Expr[Int](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala index aa1e52e4aa..a601af6dde 100644 --- a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala +++ b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala @@ -3,19 +3,19 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) c.Expr[Int](body) } } diff --git a/test/files/run/macro-basic-mamd-mi/Impls_1.scala b/test/files/run/macro-basic-mamd-mi/Impls_1.scala index 061aa2d4a3..6e5983bdec 100644 --- a/test/files/run/macro-basic-mamd-mi/Impls_1.scala +++ b/test/files/run/macro-basic-mamd-mi/Impls_1.scala @@ -3,17 +3,17 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))) + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))) } def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))) + c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))) } def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) c.Expr[Int](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala index 0ca0be5a48..9c1e4ee46d 100644 --- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala +++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala @@ -6,7 +6,7 @@ object Impls { def refToFoo(dummy: Int) = macro refToFoo_impl def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = { import c.universe._ - val body = Select(Ident(newTermName("Impls")), newTermName("foo")) + val body = Select(Ident(TermName("Impls")), TermName("foo")) c.Expr[Int](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-declared-in-annotation/Impls_1.scala index a11ee2907a..1ea06de679 100644 --- a/test/files/run/macro-declared-in-annotation/Impls_1.scala +++ b/test/files/run/macro-declared-in-annotation/Impls_1.scala @@ -4,7 +4,7 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Literal(Constant("this is deprecated"))) c.Expr[String](body) } diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-declared-in-anonymous/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-anonymous/Impls_1.scala +++ b/test/files/run/macro-declared-in-anonymous/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-declared-in-block/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-block/Impls_1.scala +++ b/test/files/run/macro-declared-in-block/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-class/Impls_1.scala b/test/files/run/macro-declared-in-class-class/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-class-class/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-class-object/Impls_1.scala b/test/files/run/macro-declared-in-class-object/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-class-object/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-class/Impls_1.scala b/test/files/run/macro-declared-in-class/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-class/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-declared-in-default-param/Impls_1.scala index db1e5c7435..4380f40b04 100644 --- a/test/files/run/macro-declared-in-default-param/Impls_1.scala +++ b/test/files/run/macro-declared-in-default-param/Impls_1.scala @@ -4,7 +4,7 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) val body = Block(List(printPrefix), Literal(Constant("it works"))) c.Expr[String](body) } diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala index 837b306976..4c009cc367 100644 --- a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala +++ b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala @@ -4,8 +4,8 @@ object Impls { def toOptionOfInt(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, newTermName("x")), newTermName("toInt"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, TermName("x")), TermName("toInt"))))) c.Expr[Option[Int]](body) } } diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-declared-in-method/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-method/Impls_1.scala +++ b/test/files/run/macro-declared-in-method/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-class/Impls_1.scala b/test/files/run/macro-declared-in-object-class/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object-class/Impls_1.scala +++ b/test/files/run/macro-declared-in-object-class/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-object-object/Impls_1.scala b/test/files/run/macro-declared-in-object-object/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-object-object/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-object/Impls_1.scala b/test/files/run/macro-declared-in-object/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-object/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-package-object/Impls_1.scala b/test/files/run/macro-declared-in-package-object/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-package-object/Impls_1.scala +++ b/test/files/run/macro-declared-in-package-object/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-refinement/Impls_1.scala b/test/files/run/macro-declared-in-refinement/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-refinement/Impls_1.scala +++ b/test/files/run/macro-declared-in-refinement/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-declared-in-trait/Impls_1.scala index 6f06f6d3f0..348f3420f2 100644 --- a/test/files/run/macro-declared-in-trait/Impls_1.scala +++ b/test/files/run/macro-declared-in-trait/Impls_1.scala @@ -4,8 +4,8 @@ object Impls { def foo(c: Ctx) = { import c.{prefix => prefix} import c.universe._ - val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix)))) - val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))) + val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix)))) + val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-def-infer-return-type-b/Test_2.scala b/test/files/run/macro-def-infer-return-type-b/Test_2.scala index ea0fd4bbff..9e57b90b57 100644 --- a/test/files/run/macro-def-infer-return-type-b/Test_2.scala +++ b/test/files/run/macro-def-infer-return-type-b/Test_2.scala @@ -2,7 +2,7 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42)))) + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-duplicate.check b/test/files/run/macro-duplicate.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/macro-duplicate.check diff --git a/test/files/run/macro-duplicate.flags b/test/files/run/macro-duplicate.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-duplicate.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-duplicate/Impls_Macros_1.scala b/test/files/run/macro-duplicate/Impls_Macros_1.scala new file mode 100644 index 0000000000..af80147a90 --- /dev/null +++ b/test/files/run/macro-duplicate/Impls_Macros_1.scala @@ -0,0 +1,29 @@ +import scala.reflect.macros.Context + +object Macros { + def impl(c: Context) = { + import c.universe._ + val Expr(Block((cdef: ClassDef) :: Nil, _)) = reify { class C { def x = 2 } } + val cdef1 = + new Transformer { + override def transform(tree: Tree): Tree = tree match { + case Template(_, _, ctor :: defs) => + val defs1 = defs collect { + case ddef @ DefDef(mods, name, tparams, vparamss, tpt, body) => + val future = Select(Select(Select(Ident(TermName("scala")), TermName("concurrent")), TermName("package")), TermName("future")) + val Future = Select(Select(Ident(TermName("scala")), TermName("concurrent")), TypeName("Future")) + val tpt1 = if (tpt.isEmpty) tpt else AppliedTypeTree(Future, List(tpt)) + val body1 = Apply(future, List(body)) + val name1 = TermName("async" + name.toString.capitalize) + DefDef(mods, name1, tparams, vparamss, tpt1, body1) + } + Template(Nil, emptyValDef, ctor +: defs ::: defs1) + case _ => + super.transform(tree) + } + } transform cdef + c.Expr[Unit](Block(cdef1 :: Nil, Literal(Constant(())))) + } + + def foo = macro impl +}
\ No newline at end of file diff --git a/test/files/run/macro-duplicate/Test_2.scala b/test/files/run/macro-duplicate/Test_2.scala new file mode 100644 index 0000000000..6dbd4382d3 --- /dev/null +++ b/test/files/run/macro-duplicate/Test_2.scala @@ -0,0 +1,6 @@ +import scala.concurrent._ +import ExecutionContext.Implicits.global + +object Test extends App { + Macros.foo +}
\ No newline at end of file diff --git a/test/files/run/macro-enclosures.check b/test/files/run/macro-enclosures.check new file mode 100644 index 0000000000..36bb67e194 --- /dev/null +++ b/test/files/run/macro-enclosures.check @@ -0,0 +1,32 @@ +enclosingPackage = package test { + object Test extends scala.AnyRef { + def <init>() = { + super.<init>(); + () + }; + def test = Macros.foo + } +} +enclosingClass = object Test extends scala.AnyRef { + def <init>() = { + super.<init>(); + () + }; + def test = Macros.foo +} +enclosingImpl = object Test extends scala.AnyRef { + def <init>() = { + super.<init>(); + () + }; + def test = Macros.foo +} +enclosingTemplate = scala.AnyRef { + def <init>() = { + super.<init>(); + () + }; + def test = Macros.foo +} +enclosingMethod = def test = Macros.foo +enclosingDef = def test = Macros.foo diff --git a/test/files/run/macro-enclosures.flags b/test/files/run/macro-enclosures.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-enclosures.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-enclosures/Impls_Macros_1.scala b/test/files/run/macro-enclosures/Impls_Macros_1.scala new file mode 100644 index 0000000000..cd54028676 --- /dev/null +++ b/test/files/run/macro-enclosures/Impls_Macros_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.Context + +object Macros { + def impl(c: Context) = c.universe.reify { + println("enclosingPackage = " + c.literal(c.enclosingPackage.toString).splice) + println("enclosingClass = " + c.literal(c.enclosingClass.toString).splice) + println("enclosingImpl = " + c.literal(c.enclosingImpl.toString).splice) + println("enclosingTemplate = " + c.literal(c.enclosingTemplate.toString).splice) + println("enclosingMethod = " + c.literal(c.enclosingMethod.toString).splice) + println("enclosingDef = " + c.literal(c.enclosingDef.toString).splice) + } + + def foo = macro impl +}
\ No newline at end of file diff --git a/test/files/run/macro-enclosures/Test_2.scala b/test/files/run/macro-enclosures/Test_2.scala new file mode 100644 index 0000000000..779fe5211e --- /dev/null +++ b/test/files/run/macro-enclosures/Test_2.scala @@ -0,0 +1,11 @@ +object Test extends App { + test.Test.test +} + +package test { + object Test { + def test = { + Macros.foo + } + } +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-argument/Macros_1.scala b/test/files/run/macro-expand-implicit-argument/Macros_1.scala index d9fd5b8cb0..b2c7b4d6ca 100644 --- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala +++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala @@ -41,14 +41,14 @@ object Macros { def const(x:Int) = Literal(Constant(x)) val n = as.length - val arr = newTermName("arr") + val arr = TermName("arr") - val create = Apply(Select(ct.tree, newTermName("newArray")), List(const(n))) + val create = Apply(Select(ct.tree, TermName("newArray")), List(const(n))) val arrtpe = TypeTree(implicitly[c.WeakTypeTag[Array[A]]].tpe) val valdef = ValDef(Modifiers(), arr, arrtpe, create) val updates = (0 until n).map { - i => Apply(Select(Ident(arr), newTermName("update")), List(const(i), as(i).tree)) + i => Apply(Select(Ident(arr), TermName("update")), List(const(i), as(i).tree)) } val exprs = (Seq(valdef) ++ updates ++ Seq(Ident(arr))).toList diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala index 082e6b2efe..ac1e55c9b2 100644 --- a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(x.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(x.tree)) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala index cceb038f05..aa1fc7a358 100644 --- a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { import c.universe._ - val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt")))) + val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt")))) c.Expr[Option[Int]](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala index cceb038f05..aa1fc7a358 100644 --- a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala +++ b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = { import c.universe._ - val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt")))) + val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt")))) c.Expr[Option[Int]](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala index 11e07932c3..4fddc13d68 100644 --- a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala +++ b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala @@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._ - val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) + val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum)) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala index 1180c83a40..39a9db0e14 100644 --- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala @@ -4,7 +4,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def impl[T: c.WeakTypeTag](c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]])))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]])))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala index c6bd1cdbf1..41e50acc86 100644 --- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala +++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def impl(c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-overload/Impls_1.scala b/test/files/run/macro-expand-overload/Impls_1.scala index f7c240d9ca..1c672f6040 100644 --- a/test/files/run/macro-expand-overload/Impls_1.scala +++ b/test/files/run/macro-expand-overload/Impls_1.scala @@ -4,7 +4,7 @@ object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-override/Impls_1.scala b/test/files/run/macro-expand-override/Impls_1.scala index ec93dd4111..69ef57d18d 100644 --- a/test/files/run/macro-expand-override/Impls_1.scala +++ b/test/files/run/macro-expand-override/Impls_1.scala @@ -4,7 +4,7 @@ object Impls { def impl(c: Ctx)(tag: String, x: c.Expr[_]) = { import c.{prefix => prefix} import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree)) c.Expr[Unit](body) } diff --git a/test/files/run/macro-expand-recursive/Impls_1.scala b/test/files/run/macro-expand-recursive/Impls_1.scala index 61db5c4a9b..47dd398454 100644 --- a/test/files/run/macro-expand-recursive/Impls_1.scala +++ b/test/files/run/macro-expand-recursive/Impls_1.scala @@ -3,13 +3,13 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))) c.Expr[Unit](body) } def fooFoo(c: Ctx) = { import c.universe._ - val body = Select(Ident(newTermName("Macros")), newTermName("foo")) + val body = Select(Ident(TermName("Macros")), TermName("foo")) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala index 72b420d92f..f748ab855f 100644 --- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala @@ -5,7 +5,7 @@ object Impls { def foo[U: c.WeakTypeTag](c: Ctx) = { import c.universe._ val U = implicitly[c.WeakTypeTag[U]] - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala index 33770516df..c729aada51 100644 --- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala @@ -5,7 +5,7 @@ object Impls { def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { import c.universe._ val U = implicitly[c.WeakTypeTag[U]] - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-optional/Impls_1.scala b/test/files/run/macro-expand-tparams-optional/Impls_1.scala index 3b829e2e09..ace7a6cd26 100644 --- a/test/files/run/macro-expand-tparams-optional/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-optional/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U](c: Ctx) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("don't know U")))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("don't know U")))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala index 33770516df..c729aada51 100644 --- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala @@ -5,7 +5,7 @@ object Impls { def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = { import c.universe._ val U = implicitly[c.WeakTypeTag[U]] - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString)))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString)))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala index 9378e67712..8880d13b04 100644 --- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala @@ -6,7 +6,7 @@ object Impls { import c.universe._ val T = implicitly[c.WeakTypeTag[T]] val U = implicitly[c.WeakTypeTag[U]] - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString)))) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala index afdd7d4f7a..2df42e969f 100644 --- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala @@ -5,9 +5,9 @@ object Impls { def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala index 3c2838208a..08817708d4 100644 --- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala @@ -5,9 +5,9 @@ object Impls { def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } } diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala index afdd7d4f7a..2df42e969f 100644 --- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala +++ b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala @@ -5,9 +5,9 @@ object Impls { def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ c.Expr(Block(List( - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(())))) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-unapply-a.check b/test/files/run/macro-expand-unapply-a.check new file mode 100644 index 0000000000..7c2976e51e --- /dev/null +++ b/test/files/run/macro-expand-unapply-a.check @@ -0,0 +1,2 @@ +(1,2) +(1,2,3) diff --git a/test/files/run/macro-expand-unapply-a.flags b/test/files/run/macro-expand-unapply-a.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-expand-unapply-a.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala b/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala new file mode 100644 index 0000000000..61d6345f16 --- /dev/null +++ b/test/files/run/macro-expand-unapply-a/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.Context + +object Helper { + def unapplySeq[T](x: List[T]): Option[Seq[T]] = List.unapplySeq[T](x) +} + +object Macros { + def impl[T: c.WeakTypeTag](c: Context)(x: c.Expr[List[T]]) = { + c.universe.reify(Helper.unapplySeq(x.splice)) + } + + object UnapplyMacro { + def unapplySeq[T](x: List[T]): Option[Seq[T]] = macro impl[T] + } +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-unapply-a/Test_2.scala b/test/files/run/macro-expand-unapply-a/Test_2.scala new file mode 100644 index 0000000000..6169d86b19 --- /dev/null +++ b/test/files/run/macro-expand-unapply-a/Test_2.scala @@ -0,0 +1,6 @@ +import Macros._ + +object Test extends App { + List(1, 2) match { case UnapplyMacro(x, y) => println((x, y)) } + List(1, 2, 3) match { case UnapplyMacro(x, y, z) => println((x, y, z)) } +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-unapply-b.check b/test/files/run/macro-expand-unapply-b.check new file mode 100644 index 0000000000..5272f0d00a --- /dev/null +++ b/test/files/run/macro-expand-unapply-b.check @@ -0,0 +1,2 @@ +(1,List(2)) +List(1) diff --git a/test/files/run/macro-expand-unapply-b.flags b/test/files/run/macro-expand-unapply-b.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-expand-unapply-b.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-unapply-b/Impls_Macros_1.scala b/test/files/run/macro-expand-unapply-b/Impls_Macros_1.scala new file mode 100644 index 0000000000..d0300bdf7e --- /dev/null +++ b/test/files/run/macro-expand-unapply-b/Impls_Macros_1.scala @@ -0,0 +1,37 @@ +import language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + implicit class ContextExtensions(c: StringContext) { + object q { + def unapply(x: Any): Option[Any] = macro impl + } + } + + def impl(c: Context)(x: c.Expr[Any]): c.Expr[Option[Any]] = { + import c.universe._ + import Flag._ + + // parts here will be string literals - static parts of the string interpolation + // e.g. for q"$x, $y" parts will be Literal(Constant("")), Literal(Constant(", ")) and Literal(Constant("")) + val Apply(Select(Select(Apply(_, List(Apply(_, parts))), _), _), _) = c.macroApplication + val nresults = parts.length - 1 + + def results() = + ((1 to (nresults - 1)).toList map (i => Literal(Constant(i)))) :+ // (n - 1) results of type Int + Apply(Ident(TermName("List")), List(Literal(Constant(nresults)))) // and also one result of a different type + def extractorBody() = + if (nresults == 0) Literal(Constant(true)) + else if (nresults == 1) Apply(Ident(TermName("Some")), results()) + else Apply(Ident(TermName("Some")), List(Apply(Ident(TermName("Tuple" + nresults)), results()))) + + val name = TermName(java.util.UUID.randomUUID().toString.replace("-", "")) + val mdef = ModuleDef(NoMods, name, Template(List(Select(Ident(TermName("scala")), TypeName("AnyRef"))), emptyValDef, List( + DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), + Block(List(pendingSuperCall), Literal(Constant(())))), + DefDef(Modifiers(), TermName("unapply"), List(), List(List(ValDef(Modifiers(PARAM), TermName("x"), Ident(TypeName("Any")), EmptyTree))), TypeTree(), + extractorBody())))) + c.introduceTopLevel(nme.EMPTY_PACKAGE_NAME.toString, mdef) + c.Expr[Option[Any]](Apply(Select(Ident(name), TermName("unapply")), List(x.tree))) + } +}
\ No newline at end of file diff --git a/test/files/run/macro-expand-unapply-b/Test_2.scala b/test/files/run/macro-expand-unapply-b/Test_2.scala new file mode 100644 index 0000000000..5352160dfe --- /dev/null +++ b/test/files/run/macro-expand-unapply-b/Test_2.scala @@ -0,0 +1,8 @@ +object Test extends App { + import Macros._ + def whatever() = null + val q"$x1, $y1" = whatever() + println(x1, y1) + val q"$x2" = whatever() + println(x2) +} diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala index 2ef8f04be9..f6c1d27d54 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala index c832826d64..b844012d53 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala @@ -6,7 +6,7 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(tpnme.WILDCARD_STAR)))) + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(tpnme.WILDCARD_STAR)))) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala index 3c7f94f605..363ff0e0aa 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala @@ -7,7 +7,7 @@ object Impls { case List(Typed(stripped, Ident(wildstar))) if wildstar == tpnme.WILDCARD_STAR => List(stripped) case _ => ??? } - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), stripped_xs) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), stripped_xs) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala index 2066893bdc..0b61ab2f9b 100644 --- a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala @@ -7,7 +7,7 @@ object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { import c.universe._ - val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList) + val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala index 2ef8f04be9..f6c1d27d54 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala index 2066893bdc..0b61ab2f9b 100644 --- a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala +++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala @@ -7,7 +7,7 @@ object Impls { def foo(c: Ctx)(xs: c.Expr[Int]*) = { import c.universe._ - val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList) + val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList) c.Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala index 7c40045c0f..95d746980e 100644 --- a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala +++ b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala @@ -7,10 +7,10 @@ object Impls { import c.universe._ val U = implicitly[c.WeakTypeTag[U]] val body = Block(List( - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + U.tpe))))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo_targs...")))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("U is: " + U.tpe))))), Literal(Constant(()))) c.Expr[Unit](body) } diff --git a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala index 56c23f5faf..738c88bbc8 100644 --- a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala +++ b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala @@ -4,7 +4,7 @@ object Impls { def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = { import unconventionalName.universe._ val body = Block(List( - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo..."))))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo..."))))), Literal(Constant(()))) unconventionalName.Expr[Unit](body) } diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala index 0b9986e9f6..61f0bdfadc 100644 --- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala +++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala @@ -2,7 +2,7 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Select(Ident(newTermName("Macros")), newTermName("foo")) + val tree = Select(Ident(TermName("Macros")), TermName("foo")) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala index fb0d55208c..869a5a41fa 100644 --- a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx) = { import c.universe._ - val body = Ident(newTermName("IDoNotExist")) + val body = Ident(TermName("IDoNotExist")) c.Expr[Int](body) } } diff --git a/test/files/run/macro-invalidret-nontypeable/Test_2.scala b/test/files/run/macro-invalidret-nontypeable/Test_2.scala index 0daee49a08..7cd474ff52 100644 --- a/test/files/run/macro-invalidret-nontypeable/Test_2.scala +++ b/test/files/run/macro-invalidret-nontypeable/Test_2.scala @@ -2,7 +2,7 @@ import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Select(Ident(newTermName("Macros")), newTermName("foo")) + val tree = Select(Ident(TermName("Macros")), TermName("foo")) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-invalidusage-badret/Test_2.scala b/test/files/run/macro-invalidusage-badret/Test_2.scala index 5cb0be5ddd..fc71353f54 100644 --- a/test/files/run/macro-invalidusage-badret/Test_2.scala +++ b/test/files/run/macro-invalidusage-badret/Test_2.scala @@ -2,7 +2,7 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Typed(Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42)))), Ident(newTypeName("String"))) + val tree = Typed(Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))), Ident(TypeName("String"))) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala index 4583a726cf..8a93161af5 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[T]) = { import c.universe._ - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(x.tree.toString)))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(x.tree.toString)))) c.Expr[Unit](body) } } diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala index e453d0b70c..9a34c62e0f 100644 --- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala +++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala @@ -2,7 +2,7 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Select(Ident(newTermName("Macros")), newTermName("foo")) + val tree = Select(Ident(TermName("Macros")), TermName("foo")) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala index 5866469499..3ac9cd2a8d 100644 --- a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala +++ b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala @@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = { import c.universe._ - val sum = Apply(Select(x.tree, newTermName("$plus")), List(y.tree)) - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) + val sum = Apply(Select(x.tree, TermName("$plus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum)) c.Expr[Unit](body) } } diff --git a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala index dc48c127f4..75b8c139d4 100644 --- a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala +++ b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala @@ -2,7 +2,7 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(40)))) + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(40)))) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala index b863ac048b..50a1782431 100644 --- a/test/files/run/macro-openmacros/Impls_Macros_1.scala +++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala @@ -14,7 +14,7 @@ object Macros { } import c.universe._ - val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), newTermName("foo"))) else c.literalUnit + val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), TermName("foo"))) else c.literalUnit c.universe.reify { println(c.literal(normalizePaths(c.enclosingMacros.toString)).splice) next.splice diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala index 5c4bc211fc..4083e6126e 100644 --- a/test/files/run/macro-range/Common_1.scala +++ b/test/files/run/macro-range/Common_1.scala @@ -43,5 +43,5 @@ abstract class Utils { LabelDef(lname, Nil, rhs) } def makeBinop(left: Tree, op: String, right: Tree): Tree = - Apply(Select(left, newTermName(op)), List(right)) + Apply(Select(left, TermName(op)), List(right)) } diff --git a/test/files/run/macro-range/Expansion_Impossible_2.scala b/test/files/run/macro-range/Expansion_Impossible_2.scala index 57e0cee97f..ca0db48822 100644 --- a/test/files/run/macro-range/Expansion_Impossible_2.scala +++ b/test/files/run/macro-range/Expansion_Impossible_2.scala @@ -16,11 +16,11 @@ object Impls { // scala"($_this: RangeDefault).foreach($f)" c.Expr(c.prefix.tree match { case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" => - val iname = newTermName("$i") - val hname = newTermName("$h") + val iname = TermName("$i") + val hname = TermName("$h") def iref = Ident(iname) def href = Ident(hname) - val labelname = newTermName("$while") + val labelname = TermName("$while") val cond = makeBinop(iref, "$less", href) val body = Block( List(makeApply(f.tree, List(iref))), @@ -37,8 +37,8 @@ object Impls { case _ => Apply( Select( - Typed(c.prefix.tree, Ident(newTypeName("RangeDefault"))), - newTermName("foreach")), + Typed(c.prefix.tree, Ident(TypeName("RangeDefault"))), + TermName("foreach")), List(f.tree)) }) } diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala index fa559334d4..51e0264ed5 100644 --- a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) c.Expr[Int](body) } } diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala index 2e64c01e35..267d1bc7b0 100644 --- a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala +++ b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala @@ -2,6 +2,6 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42)))) + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) println(cm.mkToolBox().eval(tree)) } diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala index 5d7e077731..4261a6d45d 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala @@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) c.Expr[Int](body) } }
\ No newline at end of file diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala index 70560009b1..13cd953bde 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala @@ -8,12 +8,12 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val macrobody = Select(Ident(newTermName("Impls")), newTermName("foo")) - val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree) - val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) + val macrobody = Select(Ident(TermName("Impls")), TermName("foo")) + val macroparam = ValDef(NoMods, TermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree) + val macrodef = DefDef(Modifiers(MACRO), TermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(())))) - val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef))) - val macroapp = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42)))) + val module = ModuleDef(NoMods, TermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef))) + val macroapp = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) val tree = Block(List(macrodef, module), macroapp) val toolbox = cm.mkToolBox(options = "-language:experimental.macros") println(toolbox.eval(tree)) diff --git a/test/files/run/macro-reify-freevars/Test_2.scala b/test/files/run/macro-reify-freevars/Test_2.scala index 7af9d89bdb..c2d0118e17 100644 --- a/test/files/run/macro-reify-freevars/Test_2.scala +++ b/test/files/run/macro-reify-freevars/Test_2.scala @@ -2,10 +2,10 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val q = New(AppliedTypeTree(Select(Select(Select(Ident(newTermName("scala")), newTermName("collection")), newTermName("slick")), newTypeName("Queryable")), List(Ident(newTermName("Int"))))) - val x = ValDef(NoMods, newTermName("x"), Ident(newTermName("Int")), EmptyTree) - val fn = Function(List(x), Apply(Select(Ident(newTermName("x")), newTermName("$plus")), List(Literal(Constant("5"))))) - val tree = Apply(Select(q, newTermName("map")), List(fn)) + val q = New(AppliedTypeTree(Select(Select(Select(Ident(TermName("scala")), TermName("collection")), TermName("slick")), TypeName("Queryable")), List(Ident(TermName("Int"))))) + val x = ValDef(NoMods, TermName("x"), Ident(TermName("Int")), EmptyTree) + val fn = Function(List(x), Apply(Select(Ident(TermName("x")), TermName("$plus")), List(Literal(Constant("5"))))) + val tree = Apply(Select(q, TermName("map")), List(fn)) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } }
\ No newline at end of file diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala index b4351c2c53..bb6a45e11e 100644 --- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala @@ -28,7 +28,7 @@ object QueryableMacros{ val foo = c.Expr[ru.Expr[Queryable[S]]]( c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( - Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) ).asInstanceOf[Tree] ))) c.universe.reify{ Queryable.factory[S]( foo.splice )} diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala index b4351c2c53..bb6a45e11e 100644 --- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala +++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala @@ -28,7 +28,7 @@ object QueryableMacros{ val foo = c.Expr[ru.Expr[Queryable[S]]]( c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck( Utils[c.type](c).removeDoubleReify( - Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree )) + Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree )) ).asInstanceOf[Tree] ))) c.universe.reify{ Queryable.factory[S]( foo.splice )} diff --git a/test/files/run/macro-reify-splice-outside-reify/Test_2.scala b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala index 54bd03fcd2..dbc17e7c15 100644 --- a/test/files/run/macro-reify-splice-outside-reify/Test_2.scala +++ b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala @@ -2,7 +2,7 @@ object Test extends App { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox - val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42)))) + val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))) try println(cm.mkToolBox().eval(tree)) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-reify-tagless-a/Test_2.scala b/test/files/run/macro-reify-tagless-a/Test_2.scala index 584c4bdf5b..afb418a755 100644 --- a/test/files/run/macro-reify-tagless-a/Test_2.scala +++ b/test/files/run/macro-reify-tagless-a/Test_2.scala @@ -6,9 +6,9 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass))) - val rhs = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant("hello world")))) - val list = ValDef(NoMods, newTermName("list"), tpt, rhs) - val tree = Block(List(list), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name)))) + val rhs = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant("hello world")))) + val list = ValDef(NoMods, TermName("list"), tpt, rhs) + val tree = Block(List(list), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Ident(list.name)))) try cm.mkToolBox().eval(tree) catch { case ex: Throwable => println(ex.getMessage) } } diff --git a/test/files/run/macro-reify-type/Macros_1.scala b/test/files/run/macro-reify-type/Macros_1.scala index 06de05735d..c4d1d9f8ad 100644 --- a/test/files/run/macro-reify-type/Macros_1.scala +++ b/test/files/run/macro-reify-type/Macros_1.scala @@ -8,7 +8,7 @@ object StaticReflect { import c.universe._ val nameName: TermName = name.tree match { - case Literal(Constant(str: String)) => newTermName(str) + case Literal(Constant(str: String)) => TermName(str) case _ => c.error(c.enclosingPosition, s"Method name not constant.") ; return reify(ru.NoType) } val clazz = weakTypeOf[A] @@ -17,8 +17,8 @@ object StaticReflect { case NoSymbol => c.error(c.enclosingPosition, s"No member called $nameName in $clazz.") ; reify(ru.NoType) case member => val mtpe = member typeSignatureIn clazz - val mtag = c.reifyType(treeBuild.mkRuntimeUniverseRef, Select(treeBuild.mkRuntimeUniverseRef, newTermName("rootMirror")), mtpe) - val mtree = Select(mtag, newTermName("tpe")) + val mtag = c.reifyType(treeBuild.mkRuntimeUniverseRef, Select(treeBuild.mkRuntimeUniverseRef, TermName("rootMirror")), mtpe) + val mtree = Select(mtag, TermName("tpe")) c.Expr[ru.Type](mtree) } diff --git a/test/files/run/macro-reify-type/Test_2.scala b/test/files/run/macro-reify-type/Test_2.scala index 9beaf98681..1f35973531 100644 --- a/test/files/run/macro-reify-type/Test_2.scala +++ b/test/files/run/macro-reify-type/Test_2.scala @@ -7,10 +7,10 @@ object Test extends App { //val $m: $u.Mirror = scala.reflect.runtime.universe.rootMirror; //import $u._, $m._, Flag._ //val tpe = { - // val symdef$B2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTypeName("B"), NoPosition, DEFERRED | PARAM, false); - // val symdef$That2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTypeName("That"), NoPosition, DEFERRED | PARAM, false); - // val symdef$f2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTermName("f"), NoPosition, PARAM, false); - // val symdef$bf2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTermName("bf"), NoPosition, IMPLICIT | PARAM, false); + // val symdef$B2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TypeName("B"), NoPosition, DEFERRED | PARAM, false); + // val symdef$That2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TypeName("That"), NoPosition, DEFERRED | PARAM, false); + // val symdef$f2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TermName("f"), NoPosition, PARAM, false); + // val symdef$bf2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TermName("bf"), NoPosition, IMPLICIT | PARAM, false); // build.setTypeSignature(symdef$B2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor)); // build.setTypeSignature(symdef$That2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor)); // build.setTypeSignature(symdef$f2, TypeRef(ThisType(staticPackage("scala").asModule.moduleClass), staticClass("scala.Function1"), List(staticClass("scala.Int").asType.toTypeConstructor, TypeRef(NoPrefix, symdef$B2, List())))); diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala index 9f04c13014..25ed352cca 100644 --- a/test/files/run/macro-reify-unreify/Macros_1.scala +++ b/test/files/run/macro-reify-unreify/Macros_1.scala @@ -9,7 +9,7 @@ object Macros { import treeBuild._ val world = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, s.tree) - val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world))))) + val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world))))) val typedGreeting = c.Expr[String](greeting) c.universe.reify { diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check index 7deed4a878..8d43a3aa16 100644 --- a/test/files/run/macro-repl-basic.check +++ b/test/files/run/macro-repl-basic.check @@ -14,23 +14,23 @@ scala> scala> object Impls { def foo(c: Ctx)(x: c.Expr[Int]) = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) c.Expr[Int](body) } def bar(c: Ctx)(x: c.Expr[Int]) = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) c.Expr[Int](body) } def quux(c: Ctx)(x: c.Expr[Int]) = { import c.universe._ - val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) c.Expr[Int](body) } } -defined module Impls +defined object Impls scala> object Macros { object Shmacros { @@ -40,7 +40,7 @@ scala> object Macros { }; class Macros { def quux(x: Int): Int = macro Impls.quux } -defined module Macros +defined object Macros defined class Macros scala> diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala index eae1febb3a..3c22c13dc7 100644 --- a/test/files/run/macro-repl-basic.scala +++ b/test/files/run/macro-repl-basic.scala @@ -8,19 +8,19 @@ object Test extends ReplTest { |object Impls { | def foo(c: Ctx)(x: c.Expr[Int]) = { | import c.universe._ - | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))) + | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))) | c.Expr[Int](body) | } | | def bar(c: Ctx)(x: c.Expr[Int]) = { | import c.universe._ - | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))) + | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))) | c.Expr[Int](body) | } | | def quux(c: Ctx)(x: c.Expr[Int]) = { | import c.universe._ - | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))) + | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))) | c.Expr[Int](body) | } |} diff --git a/test/files/run/macro-repl-dontexpand.check b/test/files/run/macro-repl-dontexpand.check index 628a9146c4..99b70ea3dc 100644 --- a/test/files/run/macro-repl-dontexpand.check +++ b/test/files/run/macro-repl-dontexpand.check @@ -7,6 +7,6 @@ scala> def bar(c: scala.reflect.macros.Context) = ??? bar: (c: scala.reflect.macros.Context)Nothing scala> def foo = macro bar -foo: Any +defined term macro foo: Any scala> diff --git a/test/files/run/macro-toplevel-companion-a.check b/test/files/run/macro-toplevel-companion-a.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/macro-toplevel-companion-a.check diff --git a/test/files/run/macro-toplevel-companion-a.flags b/test/files/run/macro-toplevel-companion-a.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-toplevel-companion-a.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-a/Impls_Macros_1.scala b/test/files/run/macro-toplevel-companion-a/Impls_Macros_1.scala new file mode 100644 index 0000000000..23e8694ddc --- /dev/null +++ b/test/files/run/macro-toplevel-companion-a/Impls_Macros_1.scala @@ -0,0 +1,14 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + val synthetic = reify{ class C { override def toString = "C" }; object C { implicit val c = new C } }.tree + val defs = synthetic.asInstanceOf[Block].stats.asInstanceOf[List[ImplDef]] + if (c.topLevelRef(TypeName("C")).isEmpty) c.introduceTopLevel(nme.EMPTY_PACKAGE_NAME.toString, defs: _*) + c.literalUnit + } + + def foo = macro impl +}
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-a/Test_2.scala b/test/files/run/macro-toplevel-companion-a/Test_2.scala new file mode 100644 index 0000000000..78b65b5b1f --- /dev/null +++ b/test/files/run/macro-toplevel-companion-a/Test_2.scala @@ -0,0 +1,8 @@ +import Macros._ + +object Test extends App { + foo; + implicitly[C]; + foo; + implicitly[C]; +}
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-b.check b/test/files/run/macro-toplevel-companion-b.check new file mode 100644 index 0000000000..bd30dc75d3 --- /dev/null +++ b/test/files/run/macro-toplevel-companion-b.check @@ -0,0 +1,4 @@ +reflective compilation has failed: + +Companions 'class C' and 'object C' must be defined in same file: + Found in <synthetic file name> and <synthetic file name> diff --git a/test/files/run/macro-toplevel-companion-b.flags b/test/files/run/macro-toplevel-companion-b.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-toplevel-companion-b.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala b/test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala new file mode 100644 index 0000000000..f30adc2965 --- /dev/null +++ b/test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + val Block(List(cdef: ClassDef), _) = reify{ class C }.tree + val classRef = c.topLevelRef(TypeName("C")) orElse c.introduceTopLevel(nme.EMPTY_PACKAGE_NAME.toString, cdef) + val Block(List(mdef: ModuleDef), _) = reify{ object C }.tree + val moduleRef = c.topLevelRef(TermName("C")) orElse c.introduceTopLevel(nme.EMPTY_PACKAGE_NAME.toString, mdef) + c.literalUnit + } + + def foo = macro impl +}
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-b/Test_2.scala b/test/files/run/macro-toplevel-companion-b/Test_2.scala new file mode 100644 index 0000000000..ca202d053f --- /dev/null +++ b/test/files/run/macro-toplevel-companion-b/Test_2.scala @@ -0,0 +1,11 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, ToolBoxError} +import Macros._ + +object Test extends App { + val tb = cm.mkToolBox() + try tb.compile(Select(Ident(TermName("Macros")), TermName("foo"))) + catch { case ToolBoxError(message, _) => println("""macroSynthetic-.*?\.scala""".r.replaceAllIn(message, "<synthetic file name>")) } +}
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-c.check b/test/files/run/macro-toplevel-companion-c.check new file mode 100644 index 0000000000..8b422c2061 --- /dev/null +++ b/test/files/run/macro-toplevel-companion-c.check @@ -0,0 +1,3 @@ +error: Companions 'class C' and 'object C' must be defined in same file: + Found in <synthetic file name> and newSource1 + diff --git a/test/files/run/macro-toplevel-companion-c.flags b/test/files/run/macro-toplevel-companion-c.flags new file mode 100644 index 0000000000..cd66464f2f --- /dev/null +++ b/test/files/run/macro-toplevel-companion-c.flags @@ -0,0 +1 @@ +-language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-toplevel-companion-c.scala b/test/files/run/macro-toplevel-companion-c.scala new file mode 100644 index 0000000000..0e99903158 --- /dev/null +++ b/test/files/run/macro-toplevel-companion-c.scala @@ -0,0 +1,51 @@ +import scala.tools.partest._ +import java.io._ + +object Test extends DirectTest { + def code = ??? + + def macros_1 = """ + package test + + import scala.reflect.macros.Context + import language.experimental.macros + + object Macros { + def impl(c: Context) = { + import c.universe._ + val Block(List(cdef: ClassDef), _) = reify{ class C }.tree + val ref = c.topLevelRef(TypeName("test.C")) orElse c.introduceTopLevel("test", cdef) + c.literalUnit + } + + def foo = macro impl + } + """ + def compileMacros() = { + val classpath = List(sys.props("partest.lib"), sys.props("partest.reflect")) mkString sys.props("path.separator") + compileString(newCompiler("-language:experimental.macros", "-cp", classpath, "-d", testOutput.path))(macros_1) + } + + def test_2 = """ + package test + object C { Macros.foo } + """ + def compileTest() = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(test_2) + } + + def show(): Unit = { + // redirect err to string, for logging + val prevErr = System.err + val baos = new ByteArrayOutputStream() + System.setErr(new PrintStream(baos)) + log("Compiling Macros_1...") + if (compileMacros()) { + log("Compiling Test_2...") + if (compileTest()) log("Success!") else log("Failed...") + } + println("""macroSynthetic-.*?\.scala""".r.replaceAllIn(baos.toString, "<synthetic file name>")) + System.setErr(prevErr) + } +}
\ No newline at end of file diff --git a/test/files/run/macro-toplevel.check b/test/files/run/macro-toplevel.check new file mode 100644 index 0000000000..257c3764fd --- /dev/null +++ b/test/files/run/macro-toplevel.check @@ -0,0 +1,2 @@ +I've been created from Macros.foo +I've been created from Macros.foo diff --git a/test/files/run/macro-toplevel/Macros_1.scala b/test/files/run/macro-toplevel/Macros_1.scala new file mode 100644 index 0000000000..f681c86735 --- /dev/null +++ b/test/files/run/macro-toplevel/Macros_1.scala @@ -0,0 +1,15 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + val msg = "I've been created from " + c.macroApplication + val Block(List(synthetic: ClassDef), _) = reify{ class SomeUniqueName { def hello = c.literal(msg).splice } }.tree + val ref = c.topLevelRef(synthetic.name) orElse c.introduceTopLevel(nme.EMPTY_PACKAGE_NAME.toString, synthetic) + c.Expr[String](Select(Apply(Select(New(ref), nme.CONSTRUCTOR), List()), TermName("hello"))) + } + + def foo = macro impl + def foo2 = macro impl +} diff --git a/test/files/run/macro-toplevel/Test_2.scala b/test/files/run/macro-toplevel/Test_2.scala new file mode 100644 index 0000000000..eee2d6ae13 --- /dev/null +++ b/test/files/run/macro-toplevel/Test_2.scala @@ -0,0 +1,6 @@ +import Macros._ + +object Test extends App { + println(Macros.foo) + println(Macros.foo2) +}
\ No newline at end of file diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala index 633cb930fc..dbeb7efbc0 100644 --- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala @@ -4,7 +4,7 @@ object Macros { def impl_with_implicits_enabled(c: Context) = { import c.universe._ - val tree1 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) + val tree1 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false) c.literal(ttree1.toString) } @@ -15,7 +15,7 @@ object Macros { import c.universe._ try { - val tree2 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) + val tree2 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) val ttree2 = c.typeCheck(tree2, withImplicitViewsDisabled = true) c.literal(ttree2.toString) } catch { diff --git a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala index f693ad78cc..ff535fea8d 100644 --- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala @@ -4,8 +4,8 @@ object Macros { def impl_with_macros_enabled(c: Context) = { import c.universe._ - val ru = Select(Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("package")), newTermName("universe")) - val tree1 = Apply(Select(ru, newTermName("reify")), List(Literal(Constant(2)))) + val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe")) + val tree1 = Apply(Select(ru, TermName("reify")), List(Literal(Constant(2)))) val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) c.literal(ttree1.toString) } @@ -21,7 +21,7 @@ object Macros { val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe) build.setTypeSignature(ru, rutpe) - val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) + val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) c.literal(ttree2.toString) } diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check index 7bdd1d6a3a..b958a95552 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2.check +++ b/test/files/run/macro-typecheck-macrosdisabled2.check @@ -10,7 +10,7 @@ def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; - $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) + $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.TermName.apply("Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) } }; new $treecreator1() diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala index 1dbf5a1a87..a96e0c53b6 100644 --- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala +++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala @@ -4,8 +4,8 @@ object Macros { def impl_with_macros_enabled(c: Context) = { import c.universe._ - val ru = Select(Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("package")), newTermName("universe")) - val tree1 = Apply(Select(ru, newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe")) + val tree1 = Apply(Select(ru, TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false) c.literal(ttree1.toString) } @@ -21,7 +21,7 @@ object Macros { val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe) build.setTypeSignature(ru, rutpe) - val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true) c.literal(ttree2.toString) } diff --git a/test/files/run/map_java_conversions.scala b/test/files/run/map_java_conversions.scala index 7714b2cc74..751167c04d 100644 --- a/test/files/run/map_java_conversions.scala +++ b/test/files/run/map_java_conversions.scala @@ -19,7 +19,7 @@ object Test { val concMap = new java.util.concurrent.ConcurrentHashMap[String, String] test(concMap) - val cmap = asScalaConcurrentMap(concMap) + val cmap = mapAsScalaConcurrentMap(concMap) cmap.putIfAbsent("absentKey", "absentValue") cmap.put("somekey", "somevalue") assert(cmap.remove("somekey", "somevalue") == true) diff --git a/test/files/run/no-pickle-skolems.check b/test/files/run/no-pickle-skolems.check new file mode 100644 index 0000000000..d64066171a --- /dev/null +++ b/test/files/run/no-pickle-skolems.check @@ -0,0 +1 @@ +OK! diff --git a/test/files/run/no-pickle-skolems/Source_1.scala b/test/files/run/no-pickle-skolems/Source_1.scala new file mode 100644 index 0000000000..1b4cbfa788 --- /dev/null +++ b/test/files/run/no-pickle-skolems/Source_1.scala @@ -0,0 +1,5 @@ +package s + +trait Foo { def to[CC[X]](implicit cc: CC[Int]): Unit } + +class Bar extends Foo { def to[CC[X]](implicit cc: CC[Int]): Unit = ??? } diff --git a/test/files/run/no-pickle-skolems/Test_2.scala b/test/files/run/no-pickle-skolems/Test_2.scala new file mode 100644 index 0000000000..90bb4c4f88 --- /dev/null +++ b/test/files/run/no-pickle-skolems/Test_2.scala @@ -0,0 +1,37 @@ +import scala.reflect.runtime.universe._ + +object Test { + /** Collects symbols by the given name, even if they're not + * named CC. + */ + def collectSymbols[T: TypeTag](inMethod: TermName, name: String): List[String] = { + val m = typeOf[T] member inMethod typeSignatureIn typeOf[T] + var buf: List[Symbol] = Nil + var seen: Set[Symbol] = Set() + def id(s: Symbol): Int = s.asInstanceOf[{ def id: Int }].id + + def check(s: Symbol) { + if (!seen(s)) { + seen += s + if (s.name.toString == name) buf ::= s + } + } + def loop(t: Type) { + t match { + case TypeRef(pre, sym, args) => loop(pre) ; check(sym) ; args foreach loop + case PolyType(tparams, restpe) => tparams foreach { tp => check(tp) ; check(tp.owner) ; loop(tp.typeSignature) } ; loop(restpe) + case MethodType(params, restpe) => params foreach { p => check(p) ; loop(p.typeSignature) } ; loop(restpe) + case _ => + } + } + loop(m) + + buf.reverse.distinct map (s => s.name + "#" + id(s)) + } + + def main(args: Array[String]): Unit = { + val syms = collectSymbols[s.Bar]("to", "CC") + assert(syms.size == 1, syms) + println("OK!") + } +} diff --git a/test/files/run/parserJavaIdent.check b/test/files/run/parserJavaIdent.check new file mode 100644 index 0000000000..597ddbee47 --- /dev/null +++ b/test/files/run/parserJavaIdent.check @@ -0,0 +1,26 @@ +[1.7] parsed: simple +[1.8] parsed: with123 +[1.6] parsed: with$ +[1.10] parsed: withøßöèæ +[1.6] parsed: with_ +[1.6] parsed: _with +[1.1] failure: java identifier expected + +3start +^ +[1.1] failure: java identifier expected + +-start +^ +[1.5] failure: java identifier expected + +with-s + ^ +[1.3] failure: java identifier expected + +we♥scala + ^ +[1.6] failure: java identifier expected + +with space + ^ diff --git a/test/files/run/parserJavaIdent.scala b/test/files/run/parserJavaIdent.scala new file mode 100644 index 0000000000..c068075e4e --- /dev/null +++ b/test/files/run/parserJavaIdent.scala @@ -0,0 +1,26 @@ +object Test extends scala.util.parsing.combinator.JavaTokenParsers { + + def test[A](s: String) { + val res = parseAll(ident, s) match { + case Failure(_, in) => Failure("java identifier expected", in) + case o => o + } + println(res) + } + + def main(args: Array[String]) { + // Happy tests + test("simple") + test("with123") + test("with$") + test("withøßöèæ") + test("with_") + test("_with") + // Sad tests + test("3start") + test("-start") + test("with-s") + test("we♥scala") + test("with space") + } +} diff --git a/test/files/run/patmat_unapp_abstype-old.check b/test/files/run/patmat_unapp_abstype-old.check deleted file mode 100644 index 72239d16cd..0000000000 --- a/test/files/run/patmat_unapp_abstype-old.check +++ /dev/null @@ -1,4 +0,0 @@ -TypeRef -none of the above -Bar -Foo diff --git a/test/files/run/patmat_unapp_abstype-old.flags b/test/files/run/patmat_unapp_abstype-old.flags deleted file mode 100644 index ba80cad69b..0000000000 --- a/test/files/run/patmat_unapp_abstype-old.flags +++ /dev/null @@ -1 +0,0 @@ --Xoldpatmat diff --git a/test/files/run/patmat_unapp_abstype-old.scala b/test/files/run/patmat_unapp_abstype-old.scala deleted file mode 100644 index 45496f08a2..0000000000 --- a/test/files/run/patmat_unapp_abstype-old.scala +++ /dev/null @@ -1,83 +0,0 @@ -// abstract types and extractors, oh my! -trait TypesAPI { - trait Type - - // an alternative fix (implemented in the virtual pattern matcher, is to replace the isInstanceOf by a manifest-based run-time test) - // that's what typeRefMani is for - type TypeRef <: Type //; implicit def typeRefMani: Manifest[TypeRef] - val TypeRef: TypeRefExtractor; trait TypeRefExtractor { - def apply(x: Int): TypeRef - def unapply(x: TypeRef): Option[(Int)] - } - - // just for illustration, should follow the same pattern as TypeRef - case class MethodType(n: Int) extends Type -} - -// user should not be exposed to the implementation -trait TypesUser extends TypesAPI { - def shouldNotCrash(tp: Type): Unit = { - tp match { - case TypeRef(x) => println("TypeRef") - // the above checks tp.isInstanceOf[TypeRef], which is erased to tp.isInstanceOf[Type] - // before calling TypeRef.unapply(tp), which will then crash unless tp.isInstanceOf[TypesImpl#TypeRef] (which is not implied by tp.isInstanceOf[Type]) - // tp.isInstanceOf[TypesImpl#TypeRef] is equivalent to classOf[TypesImpl#TypeRef].isAssignableFrom(tp.getClass) - // this is equivalent to manifest - // it is NOT equivalent to manifest[Type] <:< typeRefMani - case MethodType(x) => println("MethodType") - case _ => println("none of the above") - } - } -} - -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 - // --> the cast in the bridge will fail because the pattern matcher can't type test against the abstract types in TypesUser - //lazy val typeRefMani = manifest[TypeRef] -} - -trait Foos { - trait Bar - type Foo <: Bar - trait FooExtractor { - def unapply(foo: Foo): Option[Int] - } - val Foo: FooExtractor -} - -trait RealFoos extends Foos { - class Foo(val x: Int) extends Bar - object Foo extends FooExtractor { - def unapply(foo: Foo): Option[Int] = Some(foo.x) - } -} - -trait Intermed extends Foos { - def crash(bar: Bar): Unit = - bar match { - case Foo(x) => println("Foo") - case _ => println("Bar") - } -} - -object TestUnappStaticallyKnownSynthetic extends TypesImpl with TypesUser { - def test() = { - shouldNotCrash(TypeRef(10)) // should and does print "TypeRef" - // once #1697/#2337 are fixed, this should generate the correct output - shouldNotCrash(MethodType(10)) // should print "MethodType" but prints "none of the above" -- good one, pattern matcher! - } -} - -object TestUnappDynamicSynth extends RealFoos with Intermed { - case class FooToo(n: Int) extends Bar - def test() = { - crash(FooToo(10)) - crash(new Foo(5)) - } -} - -object Test extends App { - TestUnappStaticallyKnownSynthetic.test() - TestUnappDynamicSynth.test() -} diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check index bdf76ddce1..d472c569d2 100644 --- a/test/files/run/programmatic-main.check +++ b/test/files/run/programmatic-main.check @@ -1,31 +1,31 @@ - phase name id description - ---------- -- ----------- - parser 1 parse source into ASTs, perform simple desugaring - namer 2 resolve names, attach symbols to named trees - packageobjects 3 load package objects - typer 4 the meat and potatoes: type the trees - patmat 5 translate match expressions - superaccessors 6 add super accessors in traits and nested classes - extmethods 7 add extension methods for inline classes - pickler 8 serialize symbol tables - refchecks 9 reference/override checking, translate nested objects - uncurry 10 uncurry, translate function values to anonymous classes - tailcalls 11 replace tail calls by jumps - specialize 12 @specialized-driven class and method specialization - explicitouter 13 this refs to outer pointers, translate patterns - erasure 14 erase types, add interfaces for traits - posterasure 15 clean up erased inline classes - lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs - lambdalift 17 move nested functions to top level - constructors 18 move field definitions into constructors - flatten 19 eliminate inner classes - mixin 20 mixin composition - cleanup 21 platform-specific cleanups, generate reflective calls - icode 22 generate portable intermediate code - inliner 23 optimization: do inlining -inlineExceptionHandlers 24 optimization: inline exception handlers - closelim 25 optimization: eliminate uncalled closures - dce 26 optimization: eliminate dead code - jvm 27 generate JVM bytecode - terminal 28 The last phase in the compiler chain + phase name id description + ---------- -- ----------- + parser 1 parse source into ASTs, perform simple desugaring + namer 2 resolve names, attach symbols to named trees +packageobjects 3 load package objects + typer 4 the meat and potatoes: type the trees + patmat 5 translate match expressions +superaccessors 6 add super accessors in traits and nested classes + extmethods 7 add extension methods for inline classes + pickler 8 serialize symbol tables + refchecks 9 reference/override checking, translate nested objects + uncurry 10 uncurry, translate function values to anonymous classes + tailcalls 11 replace tail calls by jumps + specialize 12 @specialized-driven class and method specialization + explicitouter 13 this refs to outer pointers, translate patterns + erasure 14 erase types, add interfaces for traits + posterasure 15 clean up erased inline classes + lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs + lambdalift 17 move nested functions to top level + constructors 18 move field definitions into constructors + flatten 19 eliminate inner classes + mixin 20 mixin composition + cleanup 21 platform-specific cleanups, generate reflective calls + icode 22 generate portable intermediate code + inliner 23 optimization: do inlining +inlinehandlers 24 optimization: inline exception handlers + closelim 25 optimization: eliminate uncalled closures + dce 26 optimization: eliminate dead code + jvm 27 generate JVM bytecode + terminal 28 The last phase in the compiler chain diff --git a/test/files/run/reflection-allmirrors-tostring.scala b/test/files/run/reflection-allmirrors-tostring.scala index 73afff291c..0ca387a6b1 100644 --- a/test/files/run/reflection-allmirrors-tostring.scala +++ b/test/files/run/reflection-allmirrors-tostring.scala @@ -26,18 +26,18 @@ object Test extends App { println(cm.reflect(new C)) val im = cm.reflect(new C) - println(im.reflectField(typeOf[C].member(newTermName("f1")).asTerm)) - println(im.reflectField(typeOf[C].member(newTermName("f2")).asTerm)) - println(im.reflectMethod(typeOf[C].member(newTermName("m1")).asMethod)) - println(im.reflectMethod(typeOf[C].member(newTermName("m2")).asMethod)) - println(im.reflectMethod(typeOf[C].member(newTermName("m3")).asMethod)) - println(im.reflectMethod(typeOf[C].member(newTermName("m4")).asMethod)) - println(im.reflectMethod(typeOf[C].member(newTermName("m5")).asMethod)) - println(im.reflectClass(typeOf[C].member(newTypeName("C")).asClass)) - println(im.reflectModule(typeOf[C].member(newTermName("M")).asModule)) + println(im.reflectField(typeOf[C].member(TermName("f1")).asTerm)) + println(im.reflectField(typeOf[C].member(TermName("f2")).asTerm)) + println(im.reflectMethod(typeOf[C].member(TermName("m1")).asMethod)) + println(im.reflectMethod(typeOf[C].member(TermName("m2")).asMethod)) + println(im.reflectMethod(typeOf[C].member(TermName("m3")).asMethod)) + println(im.reflectMethod(typeOf[C].member(TermName("m4")).asMethod)) + println(im.reflectMethod(typeOf[C].member(TermName("m5")).asMethod)) + println(im.reflectClass(typeOf[C].member(TypeName("C")).asClass)) + println(im.reflectModule(typeOf[C].member(TermName("M")).asModule)) val c = cm.staticClass("C") - val cc = typeOf[C].member(newTypeName("C")).asClass + val cc = typeOf[C].member(TypeName("C")).asClass println(cm.reflectClass(c).reflectConstructor(c.typeSignature.member(nme.CONSTRUCTOR).asMethod)) println(im.reflectClass(cc).reflectConstructor(cc.typeSignature.member(nme.CONSTRUCTOR).asMethod)) }
\ No newline at end of file diff --git a/test/files/run/reflection-enclosed-basic.scala b/test/files/run/reflection-enclosed-basic.scala index 1dcb6c2a27..7b9e0c20dc 100644 --- a/test/files/run/reflection-enclosed-basic.scala +++ b/test/files/run/reflection-enclosed-basic.scala @@ -12,7 +12,7 @@ private object B6 extends B2 { override def toString = "B6"; override def foo = object Test extends App { def testMethodInvocation(instance: Any) = { val instanceMirror = cm.reflect(instance) - val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod val methodMirror = instanceMirror.reflectMethod(method) println(methodMirror()) } @@ -20,7 +20,7 @@ object Test extends App { def testNestedClass(name: String) = { val sym = cm.staticClass(name) println(sym) - val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor) val instance = ctorMirror() println(instance) diff --git a/test/files/run/reflection-enclosed-inner-basic.scala b/test/files/run/reflection-enclosed-inner-basic.scala index 2b2c701993..c1cf9bc336 100644 --- a/test/files/run/reflection-enclosed-inner-basic.scala +++ b/test/files/run/reflection-enclosed-inner-basic.scala @@ -18,15 +18,15 @@ object Test extends App { def testMethodInvocation(instance: Any) = { val instanceMirror = cm.reflect(instance) - val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod val methodMirror = instanceMirror.reflectMethod(method) println(methodMirror()) } def testInnerClass(name: String) = { - val sym = b.typeSignature.declaration(newTypeName(name)).asClass + val sym = b.typeSignature.declaration(TypeName(name)).asClass println(sym) - val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod val ctorMirror = cm.reflect(new B).reflectClass(sym).reflectConstructor(ctor) val instance = ctorMirror() println(instance) @@ -37,7 +37,7 @@ object Test extends App { testInnerClass("B2") def testInnerModule(name: String) = { - val sym = b.typeSignature.declaration(newTermName(name)).asModule + val sym = b.typeSignature.declaration(TermName(name)).asModule println(sym) val moduleMirror = cm.reflect(new B).reflectModule(sym) val instance = moduleMirror.instance diff --git a/test/files/run/reflection-enclosed-inner-inner-basic.scala b/test/files/run/reflection-enclosed-inner-inner-basic.scala index 1b9e19d37d..8a73fac522 100644 --- a/test/files/run/reflection-enclosed-inner-inner-basic.scala +++ b/test/files/run/reflection-enclosed-inner-inner-basic.scala @@ -20,15 +20,15 @@ object Test extends App { def testMethodInvocation(instance: Any) = { val instanceMirror = cm.reflect(instance) - val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod val methodMirror = instanceMirror.reflectMethod(method) println(methodMirror()) } def testInnerClass(name: String) = { - val sym = b.typeSignature.declaration(newTypeName(name)).asClass + val sym = b.typeSignature.declaration(TypeName(name)).asClass println(sym) - val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod val outer1 = new B val outer2 = new outer1.BB val ctorMirror = cm.reflect(outer2).reflectClass(sym).reflectConstructor(ctor) @@ -41,7 +41,7 @@ object Test extends App { testInnerClass("B2") def testInnerModule(name: String) = { - val sym = b.typeSignature.declaration(newTermName(name)).asModule + val sym = b.typeSignature.declaration(TermName(name)).asModule println(sym) val outer1 = new B val outer2 = new outer1.BB diff --git a/test/files/run/reflection-enclosed-inner-nested-basic.scala b/test/files/run/reflection-enclosed-inner-nested-basic.scala index 2800ee2548..6c2fc6df7a 100644 --- a/test/files/run/reflection-enclosed-inner-nested-basic.scala +++ b/test/files/run/reflection-enclosed-inner-nested-basic.scala @@ -21,15 +21,15 @@ object Test extends App { def testMethodInvocation(instance: Any) = { val instanceMirror = cm.reflect(instance) - val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod val methodMirror = instanceMirror.reflectMethod(method) println(methodMirror()) } def testNestedClass(name: String) = { - val sym = b.typeSignature.declaration(newTypeName(name)).asClass + val sym = b.typeSignature.declaration(TypeName(name)).asClass println(sym) - val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod val ctorMirror = cm.reflect(outer1.BB).reflectClass(sym).reflectConstructor(ctor) val instance = ctorMirror() println(instance) @@ -40,7 +40,7 @@ object Test extends App { testNestedClass("B2") def testNestedModule(name: String) = { - val sym = b.typeSignature.declaration(newTermName(name)).asModule + val sym = b.typeSignature.declaration(TermName(name)).asModule println(sym) val moduleMirror = cm.reflect(outer1.BB).reflectModule(sym) val instance = moduleMirror.instance diff --git a/test/files/run/reflection-enclosed-nested-basic.scala b/test/files/run/reflection-enclosed-nested-basic.scala index 8b740c2da2..180ac4ebee 100644 --- a/test/files/run/reflection-enclosed-nested-basic.scala +++ b/test/files/run/reflection-enclosed-nested-basic.scala @@ -18,15 +18,15 @@ object Test extends App { def testMethodInvocation(instance: Any) = { val instanceMirror = cm.reflect(instance) - val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod val methodMirror = instanceMirror.reflectMethod(method) println(methodMirror()) } def testNestedClass(name: String) = { - val sym = b.typeSignature.declaration(newTypeName(name)).asClass + val sym = b.typeSignature.declaration(TypeName(name)).asClass println(sym) - val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor) val instance = ctorMirror() println(instance) @@ -37,7 +37,7 @@ object Test extends App { testNestedClass("B2") def testNestedModule(name: String) = { - val sym = b.typeSignature.declaration(newTermName(name)).asModule + val sym = b.typeSignature.declaration(TermName(name)).asModule println(sym) val moduleMirror = cm.reflectModule(sym) val instance = moduleMirror.instance diff --git a/test/files/run/reflection-enclosed-nested-inner-basic.scala b/test/files/run/reflection-enclosed-nested-inner-basic.scala index 7466733d37..2558b8035a 100644 --- a/test/files/run/reflection-enclosed-nested-inner-basic.scala +++ b/test/files/run/reflection-enclosed-nested-inner-basic.scala @@ -20,15 +20,15 @@ object Test extends App { def testMethodInvocation(instance: Any) = { val instanceMirror = cm.reflect(instance) - val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod val methodMirror = instanceMirror.reflectMethod(method) println(methodMirror()) } def testInnerClass(name: String) = { - val sym = b.typeSignature.declaration(newTypeName(name)).asClass + val sym = b.typeSignature.declaration(TypeName(name)).asClass println(sym) - val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod val ctorMirror = cm.reflect(new B.BB).reflectClass(sym).reflectConstructor(ctor) val instance = ctorMirror() println(instance) @@ -39,7 +39,7 @@ object Test extends App { testInnerClass("B2") def testInnerModule(name: String) = { - val sym = b.typeSignature.declaration(newTermName(name)).asModule + val sym = b.typeSignature.declaration(TermName(name)).asModule println(sym) val moduleMirror = cm.reflect(new B.BB).reflectModule(sym) val instance = moduleMirror.instance diff --git a/test/files/run/reflection-enclosed-nested-nested-basic.scala b/test/files/run/reflection-enclosed-nested-nested-basic.scala index 8335ea482a..b4711c9a8c 100644 --- a/test/files/run/reflection-enclosed-nested-nested-basic.scala +++ b/test/files/run/reflection-enclosed-nested-nested-basic.scala @@ -20,15 +20,15 @@ object Test extends App { def testMethodInvocation(instance: Any) = { val instanceMirror = cm.reflect(instance) - val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod + val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod val methodMirror = instanceMirror.reflectMethod(method) println(methodMirror()) } def testNestedClass(name: String) = { - val sym = b.typeSignature.declaration(newTypeName(name)).asClass + val sym = b.typeSignature.declaration(TypeName(name)).asClass println(sym) - val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod + val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor) val instance = ctorMirror() println(instance) @@ -39,7 +39,7 @@ object Test extends App { testNestedClass("B2") def testNestedModule(name: String) = { - val sym = b.typeSignature.declaration(newTermName(name)).asModule + val sym = b.typeSignature.declaration(TermName(name)).asModule println(sym) val moduleMirror = cm.reflectModule(sym) val instance = moduleMirror.instance diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check index 65b525731f..b3b66f48d6 100644 --- a/test/files/run/reflection-equality.check +++ b/test/files/run/reflection-equality.check @@ -29,7 +29,7 @@ scala.AnyRef { def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int } -scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod +scala> val ms: MethodSymbol = ts.declaration(TermName("methodIntIntInt")).asMethod ms: reflect.runtime.universe.MethodSymbol = method methodIntIntInt scala> val MethodType( _, t1 ) = ms.typeSignature diff --git a/test/files/run/reflection-equality.scala b/test/files/run/reflection-equality.scala index 8fc82721e7..40f116bb53 100644 --- a/test/files/run/reflection-equality.scala +++ b/test/files/run/reflection-equality.scala @@ -11,7 +11,7 @@ object Test extends ReplTest { |def im: InstanceMirror = cm.reflect(new X) |val cs: ClassSymbol = im.symbol |val ts: Type = cs.typeSignature - |val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod + |val ms: MethodSymbol = ts.declaration(TermName("methodIntIntInt")).asMethod |val MethodType( _, t1 ) = ms.typeSignature |val t2 = typeOf[scala.Int] |t1 == t2 diff --git a/test/files/run/reflection-fieldmirror-accessorsareokay.scala b/test/files/run/reflection-fieldmirror-accessorsareokay.scala index 16354025f3..3926ab7835 100644 --- a/test/files/run/reflection-fieldmirror-accessorsareokay.scala +++ b/test/files/run/reflection-fieldmirror-accessorsareokay.scala @@ -24,6 +24,6 @@ object Test extends App { } } - test(cs.typeSignature.declaration(newTermName("x")).asTerm) - test(cs.typeSignature.declaration(newTermName("x_$eq")).asTerm) + test(cs.typeSignature.declaration(TermName("x")).asTerm) + test(cs.typeSignature.declaration(TermName("x_$eq")).asTerm) } diff --git a/test/files/run/reflection-fieldmirror-ctorparam.scala b/test/files/run/reflection-fieldmirror-ctorparam.scala index b9d50fe97b..608adad27b 100644 --- a/test/files/run/reflection-fieldmirror-ctorparam.scala +++ b/test/files/run/reflection-fieldmirror-ctorparam.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x")).asTerm + val f = cs.typeSignature.declaration(TermName("x")).asTerm try { val fm: FieldMirror = im.reflectField(f) println(fm.get) diff --git a/test/files/run/reflection-fieldmirror-getsetval.scala b/test/files/run/reflection-fieldmirror-getsetval.scala index 67c54d9708..9cacb7080b 100644 --- a/test/files/run/reflection-fieldmirror-getsetval.scala +++ b/test/files/run/reflection-fieldmirror-getsetval.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm + val f = cs.typeSignature.declaration(TermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm val fm: FieldMirror = im.reflectField(f) try { println(fm.get) diff --git a/test/files/run/reflection-fieldmirror-getsetvar.scala b/test/files/run/reflection-fieldmirror-getsetvar.scala index abcf396dd1..52c13a73bb 100644 --- a/test/files/run/reflection-fieldmirror-getsetvar.scala +++ b/test/files/run/reflection-fieldmirror-getsetvar.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm + val f = cs.typeSignature.declaration(TermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm val fm: FieldMirror = im.reflectField(f) println(fm.get) fm.set(2) diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala index 2b4a9bb55e..e070cdcfa3 100644 --- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala +++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm + val f = cs.typeSignature.declaration(TermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm val fm: FieldMirror = im.reflectField(f) println(fm.symbol.isVar) } diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala index ab838dbb1b..89948772b1 100644 --- a/test/files/run/reflection-fieldmirror-privatethis.scala +++ b/test/files/run/reflection-fieldmirror-privatethis.scala @@ -10,7 +10,7 @@ object Test extends App { val im: InstanceMirror = cm.reflect(a) val cs = im.symbol - val f = cs.typeSignature.declaration(newTermName("x")).asTerm + val f = cs.typeSignature.declaration(TermName("x")).asTerm val fm: FieldMirror = im.reflectField(f) println(fm.symbol.isVar) println(fm.get) diff --git a/test/files/run/reflection-fieldsymbol-navigation.scala b/test/files/run/reflection-fieldsymbol-navigation.scala index 4448724988..33dc18a7e3 100644 --- a/test/files/run/reflection-fieldsymbol-navigation.scala +++ b/test/files/run/reflection-fieldsymbol-navigation.scala @@ -5,7 +5,7 @@ class C { } object Test extends App { - val x = typeOf[C].member(newTermName("x")).asTerm + val x = typeOf[C].member(TermName("x")).asTerm println(x) println(x.isVar) println(x.accessed) diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala index b3c0081ccf..db211fd9a8 100644 --- a/test/files/run/reflection-implClass.scala +++ b/test/files/run/reflection-implClass.scala @@ -10,19 +10,19 @@ object Test extends App with Outer { import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} - assert(cm.classSymbol(classTag[Foo].runtimeClass).typeSignature.declaration(newTermName("bar")).typeSignature == - cm.classSymbol(classTag[Bar].runtimeClass).typeSignature.declaration(newTermName("foo")).typeSignature) + assert(cm.classSymbol(classTag[Foo].runtimeClass).typeSignature.declaration(TermName("bar")).typeSignature == + cm.classSymbol(classTag[Bar].runtimeClass).typeSignature.declaration(TermName("foo")).typeSignature) val s1 = implClass(classTag[Foo].runtimeClass) assert(s1 != NoSymbol) assert(s1.typeSignature != NoType) assert(s1.companionSymbol.typeSignature != NoType) - assert(s1.companionSymbol.typeSignature.declaration(newTermName("bar")) != NoSymbol) + assert(s1.companionSymbol.typeSignature.declaration(TermName("bar")) != NoSymbol) val s2 = implClass(classTag[Bar].runtimeClass) assert(s2 != NoSymbol) assert(s2.typeSignature != NoType) assert(s2.companionSymbol.typeSignature != NoType) - assert(s2.companionSymbol.typeSignature.declaration(newTermName("foo")) != NoSymbol) + assert(s2.companionSymbol.typeSignature.declaration(TermName("foo")) != NoSymbol) def implClass(clazz: Class[_]) = { val implClass = Class.forName(clazz.getName + "$class") cm.classSymbol(implClass) diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala index 5f39370708..ff3992709f 100644 --- a/test/files/run/reflection-magicsymbols-invoke.scala +++ b/test/files/run/reflection-magicsymbols-invoke.scala @@ -28,7 +28,7 @@ object Test extends App { val ctor = tpe.declaration(nme.CONSTRUCTOR).asMethod cm.reflectClass(ctor.owner.asClass).reflectConstructor(ctor)(args: _*) } else { - val meth = tpe.declaration(newTermName(method).encodedName.toTermName).asMethod + val meth = tpe.declaration(TermName(method).encodedName.toTermName).asMethod cm.reflect(receiver).reflectMethod(meth)(args: _*) } }) @@ -54,7 +54,7 @@ object Test extends App { println("it's important to print the list of AnyVal's members") println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test") typeOf[AnyVal].declarations.toList.sortBy(key).foreach(sym => println(key(sym))) - test(typeOf[AnyVal], null, "<init>") + test(typeOf[AnyVal], null, nme.CONSTRUCTOR.toString) test(typeOf[AnyVal], 2, "getClass") println("============\nAnyRef") diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check index d3cd26f25f..85a1f63f01 100644 --- a/test/files/run/reflection-magicsymbols-repl.check +++ b/test/files/run/reflection-magicsymbols-repl.check @@ -19,7 +19,7 @@ scala> class A { defined class A scala> def test(n: Int): Unit = { - val sig = typeOf[A] member newTermName("foo" + n) typeSignature + val sig = typeOf[A] member TermName("foo" + n) typeSignature val x = sig.asInstanceOf[MethodType].params.head println(x.typeSignature) } diff --git a/test/files/run/reflection-magicsymbols-repl.scala b/test/files/run/reflection-magicsymbols-repl.scala index 26127b8661..6a432c2664 100644 --- a/test/files/run/reflection-magicsymbols-repl.scala +++ b/test/files/run/reflection-magicsymbols-repl.scala @@ -14,7 +14,7 @@ object Test extends ReplTest { | def foo8(x: Singleton) = ??? |} |def test(n: Int): Unit = { - | val sig = typeOf[A] member newTermName("foo" + n) typeSignature + | val sig = typeOf[A] member TermName("foo" + n) typeSignature | val x = sig.asInstanceOf[MethodType].params.head | println(x.typeSignature) |} diff --git a/test/files/run/reflection-magicsymbols-vanilla.scala b/test/files/run/reflection-magicsymbols-vanilla.scala index 32819dcc46..26b70460eb 100644 --- a/test/files/run/reflection-magicsymbols-vanilla.scala +++ b/test/files/run/reflection-magicsymbols-vanilla.scala @@ -12,7 +12,7 @@ class A { object Test extends App { import scala.reflect.runtime.universe._ def test(n: Int): Unit = { - val sig = typeOf[A] member newTermName("foo" + n) typeSignature + val sig = typeOf[A] member TermName("foo" + n) typeSignature val x = sig.asInstanceOf[MethodType].params.head println(x.typeSignature) } diff --git a/test/files/run/reflection-methodsymbol-params.scala b/test/files/run/reflection-methodsymbol-params.scala index 45b1f9628f..baad8d6b9b 100644 --- a/test/files/run/reflection-methodsymbol-params.scala +++ b/test/files/run/reflection-methodsymbol-params.scala @@ -13,12 +13,12 @@ class C { } object Test extends App { - println(typeOf[C].member(newTermName("x1")).asMethod.paramss) - println(typeOf[C].member(newTermName("x2")).asMethod.paramss) - println(typeOf[C].member(newTermName("x3")).asMethod.paramss) - println(typeOf[C].member(newTermName("x4")).asMethod.paramss) - println(typeOf[C].member(newTermName("y1")).asMethod.paramss) - println(typeOf[C].member(newTermName("y2")).asMethod.paramss) - println(typeOf[C].member(newTermName("y3")).asMethod.paramss) - println(typeOf[C].member(newTermName("y4")).asMethod.paramss) + println(typeOf[C].member(TermName("x1")).asMethod.paramss) + println(typeOf[C].member(TermName("x2")).asMethod.paramss) + println(typeOf[C].member(TermName("x3")).asMethod.paramss) + println(typeOf[C].member(TermName("x4")).asMethod.paramss) + println(typeOf[C].member(TermName("y1")).asMethod.paramss) + println(typeOf[C].member(TermName("y2")).asMethod.paramss) + println(typeOf[C].member(TermName("y3")).asMethod.paramss) + println(typeOf[C].member(TermName("y4")).asMethod.paramss) }
\ No newline at end of file diff --git a/test/files/run/reflection-methodsymbol-returntype.scala b/test/files/run/reflection-methodsymbol-returntype.scala index 392754dbe4..74a9e5dac0 100644 --- a/test/files/run/reflection-methodsymbol-returntype.scala +++ b/test/files/run/reflection-methodsymbol-returntype.scala @@ -13,12 +13,12 @@ class C { } object Test extends App { - println(typeOf[C].member(newTermName("x1")).asMethod.returnType) - println(typeOf[C].member(newTermName("x2")).asMethod.returnType) - println(typeOf[C].member(newTermName("x3")).asMethod.returnType) - println(typeOf[C].member(newTermName("x4")).asMethod.returnType) - println(typeOf[C].member(newTermName("y1")).asMethod.returnType) - println(typeOf[C].member(newTermName("y2")).asMethod.returnType) - println(typeOf[C].member(newTermName("y3")).asMethod.returnType) - println(typeOf[C].member(newTermName("y4")).asMethod.returnType) + println(typeOf[C].member(TermName("x1")).asMethod.returnType) + println(typeOf[C].member(TermName("x2")).asMethod.returnType) + println(typeOf[C].member(TermName("x3")).asMethod.returnType) + println(typeOf[C].member(TermName("x4")).asMethod.returnType) + println(typeOf[C].member(TermName("y1")).asMethod.returnType) + println(typeOf[C].member(TermName("y2")).asMethod.returnType) + println(typeOf[C].member(TermName("y3")).asMethod.returnType) + println(typeOf[C].member(TermName("y4")).asMethod.returnType) }
\ No newline at end of file diff --git a/test/files/run/reflection-methodsymbol-typeparams.scala b/test/files/run/reflection-methodsymbol-typeparams.scala index bb0a3c3aec..56d37ebeaa 100644 --- a/test/files/run/reflection-methodsymbol-typeparams.scala +++ b/test/files/run/reflection-methodsymbol-typeparams.scala @@ -13,12 +13,12 @@ class C { } object Test extends App { - println(typeOf[C].member(newTermName("x1")).asMethod.typeParams) - println(typeOf[C].member(newTermName("x2")).asMethod.typeParams) - println(typeOf[C].member(newTermName("x3")).asMethod.typeParams) - println(typeOf[C].member(newTermName("x4")).asMethod.typeParams) - println(typeOf[C].member(newTermName("y1")).asMethod.typeParams) - println(typeOf[C].member(newTermName("y2")).asMethod.typeParams) - println(typeOf[C].member(newTermName("y3")).asMethod.typeParams) - println(typeOf[C].member(newTermName("y4")).asMethod.typeParams) + println(typeOf[C].member(TermName("x1")).asMethod.typeParams) + println(typeOf[C].member(TermName("x2")).asMethod.typeParams) + println(typeOf[C].member(TermName("x3")).asMethod.typeParams) + println(typeOf[C].member(TermName("x4")).asMethod.typeParams) + println(typeOf[C].member(TermName("y1")).asMethod.typeParams) + println(typeOf[C].member(TermName("y2")).asMethod.typeParams) + println(typeOf[C].member(TermName("y3")).asMethod.typeParams) + println(typeOf[C].member(TermName("y4")).asMethod.typeParams) }
\ No newline at end of file diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check index 2dd96a93bf..d70db59b85 100644 --- a/test/files/run/reflection-repl-classes.check +++ b/test/files/run/reflection-repl-classes.check @@ -19,10 +19,10 @@ scala> object defs { val cm = reflect.runtime.currentMirror val u = cm.universe val im = cm.reflect(new B) - val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod + val method = im.symbol.typeSignature.member(u.TermName("foo")).asMethod val mm = im.reflectMethod(method) } -defined module defs +defined object defs scala> import defs._ import defs._ diff --git a/test/files/run/reflection-repl-classes.scala b/test/files/run/reflection-repl-classes.scala index 80e332cde3..4bfb980498 100644 --- a/test/files/run/reflection-repl-classes.scala +++ b/test/files/run/reflection-repl-classes.scala @@ -12,7 +12,7 @@ object Test extends ReplTest { | val cm = reflect.runtime.currentMirror | val u = cm.universe | val im = cm.reflect(new B) - | val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod + | val method = im.symbol.typeSignature.member(u.TermName("foo")).asMethod | val mm = im.reflectMethod(method) |} |import defs._ diff --git a/test/files/run/reflection-sanitychecks.scala b/test/files/run/reflection-sanitychecks.scala index f817f23731..6d3daff1f7 100644 --- a/test/files/run/reflection-sanitychecks.scala +++ b/test/files/run/reflection-sanitychecks.scala @@ -32,14 +32,14 @@ object Test extends App { def test(tpe: Type): Unit = { def failsafe(action: => Any): Any = try action catch { case ex: Throwable => ex.toString } println(s"=========members of ${tpe.typeSymbol.name} in a mirror of D=========") - println("field #1: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTerm).get)) - println("method #1: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethod)())) - println("field #2: " + failsafe(im.reflectField(tpe.member(newTermName("quux")).asTerm).get)) - println("method #2: " + failsafe(im.reflectMethod(tpe.member(newTermName("baz")).asMethod)())) - println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("bar")).asMethod)())) - println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("<init>")).asMethod)())) - println("class: " + failsafe(im.reflectClass(tpe.member(newTypeName("C")).asClass).reflectConstructor(typeOf[C].member(newTypeName("C")).asClass.typeSignature.member(newTermName("<init>")).asMethod)())) - println("object: " + failsafe(im.reflectModule(tpe.member(newTermName("O")).asModule).instance)) + println("field #1: " + failsafe(im.reflectField(tpe.member(TermName("foo")).asTerm).get)) + println("method #1: " + failsafe(im.reflectMethod(tpe.member(TermName("bar")).asMethod)())) + println("field #2: " + failsafe(im.reflectField(tpe.member(TermName("quux")).asTerm).get)) + println("method #2: " + failsafe(im.reflectMethod(tpe.member(TermName("baz")).asMethod)())) + println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(TermName("bar")).asMethod)())) + println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(TermName("<init>")).asMethod)())) + println("class: " + failsafe(im.reflectClass(tpe.member(TypeName("C")).asClass).reflectConstructor(typeOf[C].member(TypeName("C")).asClass.typeSignature.member(nme.CONSTRUCTOR).asMethod)())) + println("object: " + failsafe(im.reflectModule(tpe.member(TermName("O")).asModule).instance)) println() } diff --git a/test/files/run/reflection-valueclasses-derived.scala b/test/files/run/reflection-valueclasses-derived.scala index 6b08f987ba..8d25e2929c 100644 --- a/test/files/run/reflection-valueclasses-derived.scala +++ b/test/files/run/reflection-valueclasses-derived.scala @@ -6,7 +6,7 @@ class C(val x: Int) extends AnyVal { } object Test extends App { - println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)(2)) - println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("getClass")).asMethod)()) - println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("toString")).asMethod)()) + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("foo")).asMethod)(2)) + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("getClass")).asMethod)()) + println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("toString")).asMethod)()) }
\ No newline at end of file diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala index c4a26e460a..33d4634397 100644 --- a/test/files/run/reflection-valueclasses-magic.scala +++ b/test/files/run/reflection-valueclasses-magic.scala @@ -44,7 +44,7 @@ object Test extends App { val realex = scala.ExceptionUtils.unwrapThrowable(ex) println(realex.getClass + ": " + realex.getMessage) } - val meth = tpe.declaration(newTermName(method).encodedName.toTermName) + val meth = tpe.declaration(TermName(method).encodedName.toTermName) val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod) testees foreach (testee => { val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.paramss.flatten.apply(i).typeSignature) } diff --git a/test/files/run/reflection-valueclasses-standard.scala b/test/files/run/reflection-valueclasses-standard.scala index 18a3d1fa04..b6b5a2ede2 100644 --- a/test/files/run/reflection-valueclasses-standard.scala +++ b/test/files/run/reflection-valueclasses-standard.scala @@ -5,8 +5,8 @@ import scala.reflect.{ClassTag, classTag} object Test extends App { def test[T: ClassTag: TypeTag](x: T) = { println(s"========${classTag[T].runtimeClass}========") - println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("getClass")).asMethod)()) - println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("toString")).asMethod)()) + println(cm.reflect(x).reflectMethod(typeOf[T].member(TermName("getClass")).asMethod)()) + println(cm.reflect(x).reflectMethod(typeOf[T].member(TermName("toString")).asMethod)()) } test(2.toByte) diff --git a/test/files/run/reify-aliases.check b/test/files/run/reify-aliases.check index aa846b9bc6..da784227af 100644 --- a/test/files/run/reify-aliases.check +++ b/test/files/run/reify-aliases.check @@ -1 +1 @@ -TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List()) +TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List()) diff --git a/test/files/run/reify_copypaste1.scala b/test/files/run/reify_copypaste1.scala index c597b7af19..b2eef28026 100644 --- a/test/files/run/reify_copypaste1.scala +++ b/test/files/run/reify_copypaste1.scala @@ -9,8 +9,8 @@ object Test extends App { val output = new java.io.ByteArrayOutputStream() System.setOut(new java.io.PrintStream(output)) val toolBox = currentMirror.mkToolBox(options = "-Yreify-copypaste") - val reify = Select(Select(Select(Select(Ident(ScalaPackage), newTermName("reflect")), newTermName("runtime")), newTermName("universe")), newTermName("reify")) - val reifee = Block(List(ValDef(Modifiers(LAZY), newTermName("x"), TypeTree(), Apply(Ident(ListModule), List(Literal(Constant(1)), Literal(Constant(2)))))), Ident(newTermName("x"))) + val reify = Select(Select(Select(Select(Ident(ScalaPackage), TermName("reflect")), TermName("runtime")), TermName("universe")), TermName("reify")) + val reifee = Block(List(ValDef(Modifiers(LAZY), TermName("x"), TypeTree(), Apply(Ident(ListModule), List(Literal(Constant(1)), Literal(Constant(2)))))), Ident(TermName("x"))) toolBox.eval(Apply(reify, List(reifee))) val Block(List(tpeCopypaste), exprCopypaste @ ModuleDef(_, _, Template(_, _, (_ :: stats) :+ expr))) = toolBox.parse(output.toString()) output.reset() diff --git a/test/pending/run/reify_implicits-new.check b/test/files/run/reify_implicits-new.check index e3aeb20f6b..e3aeb20f6b 100644 --- a/test/pending/run/reify_implicits-new.check +++ b/test/files/run/reify_implicits-new.check diff --git a/test/pending/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala index 42a1deef26..42a1deef26 100644 --- a/test/pending/run/reify_implicits-new.scala +++ b/test/files/run/reify_implicits-new.scala diff --git a/test/pending/run/reify_implicits-old.check b/test/files/run/reify_implicits-old.check index e3aeb20f6b..e3aeb20f6b 100644 --- a/test/pending/run/reify_implicits-old.check +++ b/test/files/run/reify_implicits-old.check diff --git a/test/pending/run/reify_implicits-old.scala b/test/files/run/reify_implicits-old.scala index 8ff256d2d4..8ff256d2d4 100644 --- a/test/pending/run/reify_implicits-old.scala +++ b/test/files/run/reify_implicits-old.scala diff --git a/test/files/run/reify_newimpl_11.check b/test/files/run/reify_newimpl_11.check index 2f5cb581e6..c019c6db2d 100644 --- a/test/files/run/reify_newimpl_11.check +++ b/test/files/run/reify_newimpl_11.check @@ -1,2 +1,4 @@ -scala.tools.reflect.ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_11.scala:6:11). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_11.scala:6:11 +have you forgotten to use TypeTag annotations for type parameters external to a reifee? +if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_13.check b/test/files/run/reify_newimpl_13.check index d518cd7b84..13e3c9af1e 100644 --- a/test/files/run/reify_newimpl_13.check +++ b/test/files/run/reify_newimpl_13.check @@ -1,2 +1,4 @@ -scala.tools.reflect.ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_13.scala:7:13). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_13.scala:7:13 +have you forgotten to use TypeTag annotations for type parameters external to a reifee? +if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_19.check b/test/files/run/reify_newimpl_19.check index 8b8652f92c..c749d4f106 100644 --- a/test/files/run/reify_newimpl_19.check +++ b/test/files/run/reify_newimpl_19.check @@ -1,2 +1,4 @@ -scala.tools.reflect.ToolBoxError: reflective toolbox has failed: -unresolved free type variables (namely: T defined by C in reify_newimpl_19.scala:7:10). have you forgot to use TypeTag annotations for type parameters external to a reifee? if you have troubles tracking free type variables, consider using -Xlog-free-types +scala.tools.reflect.ToolBoxError: reflective toolbox failed due to unresolved free type variables: + T defined by C in reify_newimpl_19.scala:7:10 +have you forgotten to use TypeTag annotations for type parameters external to a reifee? +if you have troubles tracking free type variables, consider using -Xlog-free-types diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check index dcb3e2889b..e68fe2f6b1 100644 --- a/test/files/run/reify_newimpl_22.check +++ b/test/files/run/reify_newimpl_22.check @@ -19,7 +19,7 @@ scala> { } println(code.eval) } -<console>:15: free term: Ident(newTermName("x")) defined by res0 in <console>:14:21 +<console>:15: free term: Ident(TermName("x")) defined by res0 in <console>:14:21 val code = reify { ^ 2 diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check index 882124657e..38c95646a8 100644 --- a/test/files/run/reify_newimpl_23.check +++ b/test/files/run/reify_newimpl_23.check @@ -18,7 +18,7 @@ scala> def foo[T]{ } println(code.eval) } -<console>:13: free type: Ident(newTypeName("T")) defined by foo in <console>:12:16 +<console>:13: free type: Ident(TypeName("T")) defined by foo in <console>:12:16 val code = reify { ^ foo: [T]=> Unit diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check index d1028b94c7..86f6abce02 100644 --- a/test/files/run/reify_newimpl_25.check +++ b/test/files/run/reify_newimpl_25.check @@ -9,7 +9,7 @@ scala> { val tt = implicitly[TypeTag[x.type]] println(tt) } -<console>:11: free term: Ident(newTermName("x")) defined by res0 in <console>:10:21 +<console>:11: free term: Ident(TermName("x")) defined by res0 in <console>:10:21 val tt = implicitly[TypeTag[x.type]] ^ TypeTag[x.type] diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check index 347f6365aa..d3e2540de0 100644 --- a/test/files/run/reify_newimpl_26.check +++ b/test/files/run/reify_newimpl_26.check @@ -8,7 +8,7 @@ scala> def foo[T]{ val tt = implicitly[WeakTypeTag[List[T]]] println(tt) } -<console>:9: free type: Ident(newTypeName("T")) defined by foo in <console>:7:16 +<console>:9: free type: Ident(TypeName("T")) defined by foo in <console>:7:16 val tt = implicitly[WeakTypeTag[List[T]]] ^ foo: [T]=> Unit diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index 272856b962..9932a58dfa 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -23,7 +23,7 @@ object Test extends App { */ var i = 0 - def gensym(name: String) = { i += 1; newTermName(name + i) } + def gensym(name: String) = { i += 1; TermName(name + i) } def createTempValDef( value : Tree, tpe : Type ) : (Option[Tree],Tree) = { val local = gensym("temp") @@ -59,10 +59,10 @@ object Test extends App { Apply( Select( Select( - Ident( newTermName("scala") ) - , newTermName("Predef") + Ident( TermName("scala") ) + , TermName("Predef") ) - , newTermName("print") + , TermName("print") ) , List(ref) ): Tree diff --git a/test/files/run/repl-bare-expr.check b/test/files/run/repl-bare-expr.check index 8b6434e986..a92243c7c0 100644 --- a/test/files/run/repl-bare-expr.check +++ b/test/files/run/repl-bare-expr.check @@ -31,7 +31,7 @@ scala> 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Mooo <console>:7: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses 5 ; 10 ; case object Cow ; 20 ; class Moo { override def toString = "Moooooo" } ; 30 ; def bippy = { ^ -defined module Cow +defined object Cow defined class Moo bippy: Int res2: Int = 105 @@ -39,7 +39,7 @@ res2: Int = 105 scala> scala> object Bovine { var x: List[_] = null } ; case class Ruminant(x: Int) ; bippy * bippy * bippy -defined module Bovine +defined object Bovine defined class Ruminant res3: Int = 216 diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check index 56ddd74375..4cd0e1d588 100644 --- a/test/files/run/repl-colon-type.check +++ b/test/files/run/repl-colon-type.check @@ -14,7 +14,6 @@ scala> :type List[1, 2, 3] List[1, 2, 3] ^ - scala> :type List(1, 2, 3) List[Int] @@ -52,10 +51,9 @@ scala> :type protected lazy val f = 5 Access to protected value f not permitted because enclosing object $eval in package $line19 is not a subclass of object $iw where target is defined - lazy val $result = `f` + lazy val $result = f ^ - scala> :type def f = 5 => Int diff --git a/test/files/run/repl-javap-def.scala b/test/files/run/repl-javap-def.scala new file mode 100644 index 0000000000..dbd769613a --- /dev/null +++ b/test/files/run/repl-javap-def.scala @@ -0,0 +1,17 @@ +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |def f = 7 + |:javap -public -raw f + """.stripMargin + + // it should find f wrapped in repl skins. replstiltskin. + override def yah(res: Seq[String]) = { + // replstiltskin: what be my name? + val keywords = List("public", "class", "line") + def isLineClass(s: String) = keywords forall (s contains _) + def filtered = res filter isLineClass + 1 == filtered.size + } +} diff --git a/test/files/run/repl-javap-fun.scala b/test/files/run/repl-javap-fun.scala new file mode 100644 index 0000000000..5c9a6b7691 --- /dev/null +++ b/test/files/run/repl-javap-fun.scala @@ -0,0 +1,16 @@ +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |object Betty { + | List(1,2,3) filter (_ % 2 != 0) map (_ * 2) + |} + |:javap -fun Betty + """.stripMargin + + // two anonfuns of Betty + override def yah(res: Seq[String]) = { + def filtered = res filter (_ contains "public final class Betty") + 2 == filtered.size + } +} diff --git a/test/files/run/repl-javap-mem.scala b/test/files/run/repl-javap-mem.scala new file mode 100644 index 0000000000..8db30e835c --- /dev/null +++ b/test/files/run/repl-javap-mem.scala @@ -0,0 +1,19 @@ +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |object Betty { + | val ds = List(1,2,3) filter (_ % 2 == 0) map (_ * 3) + | def m(vs: List[Int]) = vs filter (_ % 2 != 0) map (_ * 2) + |} + |:javap Betty#m + """.stripMargin + + // filter for requested method member + override def yah(res: Seq[String]) = { + // cheaply, methods end in arg list + val p = """.*m\(.*\);""".r + def filtered = res filter (_ match { case p() => true case _ => false }) + 1 == filtered.size + } +} diff --git a/test/files/run/repl-javap-memfun.scala b/test/files/run/repl-javap-memfun.scala new file mode 100644 index 0000000000..d2b4243c8b --- /dev/null +++ b/test/files/run/repl-javap-memfun.scala @@ -0,0 +1,18 @@ +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |object Betty { + | List(1,2,3) count (_ % 2 != 0) + | def f = List(1,2,3) filter (_ % 2 != 0) map (_ * 2) + | def g = List(1,2,3) filter (_ % 2 == 0) map (_ * 3) map (_ + 1) + |} + |:javap -fun Betty#g + """.stripMargin + + // three anonfuns of Betty#g + override def yah(res: Seq[String]) = { + def filtered = res filter (_ contains "public final class Betty") + 3 == filtered.size + } +} diff --git a/test/files/run/repl-javap-more-fun.scala b/test/files/run/repl-javap-more-fun.scala new file mode 100644 index 0000000000..e603faf75a --- /dev/null +++ b/test/files/run/repl-javap-more-fun.scala @@ -0,0 +1,17 @@ +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |object Betty { + | val ds = List(1,2,3) filter (_ % 2 == 0) map (_ * 3) + | def m(vs: List[Int]) = vs filter (_ % 2 != 0) map (_ * 2) + |} + |:javap -fun Betty + """.stripMargin + + // two anonfuns of Betty + override def yah(res: Seq[String]) = { + def filtered = res filter (_ contains "public final class Betty") + 4 == filtered.size + } +} diff --git a/test/files/run/repl-javap-outdir-funs/foo_1.scala b/test/files/run/repl-javap-outdir-funs/foo_1.scala new file mode 100644 index 0000000000..9b98e94733 --- /dev/null +++ b/test/files/run/repl-javap-outdir-funs/foo_1.scala @@ -0,0 +1,6 @@ + +package disktest + +class Foo { + def m(vs: List[Int]) = vs map (_ + 1) +} diff --git a/test/files/run/repl-javap-outdir-funs/run-repl_7.scala b/test/files/run/repl-javap-outdir-funs/run-repl_7.scala new file mode 100644 index 0000000000..dfe3dae270 --- /dev/null +++ b/test/files/run/repl-javap-outdir-funs/run-repl_7.scala @@ -0,0 +1,12 @@ +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |:javap -fun disktest/Foo.class + """.stripMargin + + override def yah(res: Seq[String]) = { + def filtered = res filter (_ contains "public final class disktest.Foo") + 1 == filtered.size + } +} diff --git a/test/files/run/repl-javap-outdir/foo_1.scala b/test/files/run/repl-javap-outdir/foo_1.scala new file mode 100644 index 0000000000..9b98e94733 --- /dev/null +++ b/test/files/run/repl-javap-outdir/foo_1.scala @@ -0,0 +1,6 @@ + +package disktest + +class Foo { + def m(vs: List[Int]) = vs map (_ + 1) +} diff --git a/test/files/run/repl-javap-outdir/run-repl_7.scala b/test/files/run/repl-javap-outdir/run-repl_7.scala new file mode 100644 index 0000000000..dc2c5719ff --- /dev/null +++ b/test/files/run/repl-javap-outdir/run-repl_7.scala @@ -0,0 +1,12 @@ +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |:javap disktest/Foo.class + """.stripMargin + + override def yah(res: Seq[String]) = { + def filtered = res filter (_ contains "public class disktest.Foo") + 1 == filtered.size + } +} diff --git a/test/files/run/repl-javap.scala b/test/files/run/repl-javap.scala new file mode 100644 index 0000000000..7a19852d4e --- /dev/null +++ b/test/files/run/repl-javap.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.JavapTest + +object Test extends JavapTest { + def code = """ + |case class Betty(i: Int) { def next = Betty(i+1) } + |:javap Betty + """.stripMargin + + override def yah(res: Seq[String]) = { + def filtered = res filter (_ contains "public class Betty") + 1 == filtered.size + } +} diff --git a/test/files/run/repl-out-dir.check b/test/files/run/repl-out-dir.check new file mode 100644 index 0000000000..a96f9ba9d9 --- /dev/null +++ b/test/files/run/repl-out-dir.check @@ -0,0 +1,53 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> + +scala> case class Bippy(x: Int) +defined class Bippy + +scala> val x = Bippy(1) +x: Bippy = Bippy(1) + +scala> $intp.showDirectory +repl-out-dir-run.obj + $line1 + $eval$.class + $eval.class + $line2 + $eval$.class + $eval.class + $read$$iw$$iw$.class + $read$$iw$.class + $read$.class + $read.class + $line3 + $eval$.class + $eval.class + $read$$iw$$iw$.class + $read$$iw$$iw$Bippy$.class + $read$$iw$$iw$Bippy.class + $read$$iw$.class + $read$.class + $read.class + $line4 + $eval$.class + $eval.class + $read$$iw$$iw$.class + $read$$iw$.class + $read$.class + $read.class + $line5 + $eval$.class + $eval.class + $read$$iw$$iw$.class + $read$$iw$.class + $read$.class + $read.class + $repl_$init.class + Test$.class + Test.class + +scala> + +scala> diff --git a/test/files/run/repl-out-dir.scala b/test/files/run/repl-out-dir.scala new file mode 100644 index 0000000000..33c823aa2d --- /dev/null +++ b/test/files/run/repl-out-dir.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest +import scala.tools.nsc.Settings + +object Test extends ReplTest { + override def extraSettings = s"-Yrepl-outdir ${testOutput.path}" + + def code = s""" +case class Bippy(x: Int) +val x = Bippy(1) +$$intp.showDirectory + """ + +} diff --git a/test/files/run/repl-paste.check b/test/files/run/repl-paste.check index d3e171fbfb..e4c407c6e8 100644 --- a/test/files/run/repl-paste.check +++ b/test/files/run/repl-paste.check @@ -21,7 +21,7 @@ val x = (new Dingus).y // Exiting paste mode, now interpreting. defined class Dingus -defined module Dingus +defined object Dingus x: Int = 110 scala> diff --git a/test/files/run/search.check b/test/files/run/search.check new file mode 100644 index 0000000000..a885696509 --- /dev/null +++ b/test/files/run/search.check @@ -0,0 +1,6 @@ +Found(2) +Found(4) +InsertionPoint(9) +Found(2) +Found(4) +InsertionPoint(9) diff --git a/test/files/run/search.scala b/test/files/run/search.scala new file mode 100644 index 0000000000..ed7fed54a7 --- /dev/null +++ b/test/files/run/search.scala @@ -0,0 +1,14 @@ +object Test extends App { + import scala.collection.{LinearSeq, IndexedSeq} + import scala.collection.Searching.search + + val ls = LinearSeq(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13) + println(ls.search(3)) + println(ls.search(5, 3, 8)) + println(ls.search(12)) + + val is = IndexedSeq(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13) + println(is.search(3)) + println(is.search(5, 3, 8)) + println(is.search(12)) +} diff --git a/test/files/run/settings-parse.check b/test/files/run/settings-parse.check new file mode 100644 index 0000000000..18145c9100 --- /dev/null +++ b/test/files/run/settings-parse.check @@ -0,0 +1,566 @@ +0) List(-cp, ) ==> Settings { + -d = . + -classpath = "" +} + +1) List(-cp, , ) ==> Settings { + -d = . + -classpath = "" +} + +2) List(, -cp, ) ==> Settings { + -d = . + -classpath = "" +} + +3) List(-cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +4) List(-cp, , , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +5) List(-cp, , -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +6) List(, -cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +7) List(-cp, , -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +8) List(-cp, , , -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +9) List(-cp, , -deprecation, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +10) List(-cp, , -deprecation, foo.scala, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +11) List(, -cp, , -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +12) List(-cp, , foo.scala) ==> Settings { + -d = . + -classpath = "" +} + +13) List(-cp, , , foo.scala) ==> Settings { + -d = . + -classpath = "" +} + +14) List(-cp, , foo.scala, ) ==> Settings { + -d = . + -classpath = "" +} + +15) List(, -cp, , foo.scala) ==> Settings { + -d = . + -classpath = "" +} + +16) List(-cp, , foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +17) List(-cp, , , foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +18) List(-cp, , foo.scala, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +19) List(-cp, , foo.scala, -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +20) List(, -cp, , foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +21) List(-deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +22) List(, -deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +23) List(-deprecation, -cp, , ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +24) List(-deprecation, , -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +25) List(-deprecation, -cp, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +26) List(, -deprecation, -cp, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +27) List(-deprecation, -cp, , , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +28) List(-deprecation, -cp, , foo.scala, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +29) List(-deprecation, , -cp, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +30) List(-deprecation, foo.scala, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +31) List(, -deprecation, foo.scala, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +32) List(-deprecation, , foo.scala, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +33) List(-deprecation, foo.scala, -cp, , ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +34) List(-deprecation, foo.scala, , -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +35) List(foo.scala, -cp, ) ==> Settings { + -d = . + -classpath = "" +} + +36) List(, foo.scala, -cp, ) ==> Settings { + -d = . + -classpath = "" +} + +37) List(foo.scala, -cp, , ) ==> Settings { + -d = . + -classpath = "" +} + +38) List(foo.scala, , -cp, ) ==> Settings { + -d = . + -classpath = "" +} + +39) List(foo.scala, -cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +40) List(, foo.scala, -cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +41) List(foo.scala, -cp, , , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +42) List(foo.scala, -cp, , -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +43) List(foo.scala, , -cp, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +44) List(foo.scala, -deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +45) List(, foo.scala, -deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +46) List(foo.scala, , -deprecation, -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +47) List(foo.scala, -deprecation, -cp, , ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +48) List(foo.scala, -deprecation, , -cp, ) ==> Settings { + -d = . + -deprecation = true + -classpath = "" +} + +0) List(-cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +1) List(-cp, /tmp:/bippy, ) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +2) List(, -cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +3) List(-cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +4) List(-cp, /tmp:/bippy, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +5) List(-cp, /tmp:/bippy, -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +6) List(, -cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +7) List(-cp, /tmp:/bippy, -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +8) List(-cp, /tmp:/bippy, , -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +9) List(-cp, /tmp:/bippy, -deprecation, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +10) List(-cp, /tmp:/bippy, -deprecation, foo.scala, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +11) List(, -cp, /tmp:/bippy, -deprecation, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +12) List(-cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +13) List(-cp, /tmp:/bippy, , foo.scala) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +14) List(-cp, /tmp:/bippy, foo.scala, ) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +15) List(, -cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +16) List(-cp, /tmp:/bippy, foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +17) List(-cp, /tmp:/bippy, , foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +18) List(-cp, /tmp:/bippy, foo.scala, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +19) List(-cp, /tmp:/bippy, foo.scala, -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +20) List(, -cp, /tmp:/bippy, foo.scala, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +21) List(-deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +22) List(, -deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +23) List(-deprecation, -cp, /tmp:/bippy, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +24) List(-deprecation, , -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +25) List(-deprecation, -cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +26) List(, -deprecation, -cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +27) List(-deprecation, -cp, /tmp:/bippy, , foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +28) List(-deprecation, -cp, /tmp:/bippy, foo.scala, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +29) List(-deprecation, , -cp, /tmp:/bippy, foo.scala) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +30) List(-deprecation, foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +31) List(, -deprecation, foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +32) List(-deprecation, , foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +33) List(-deprecation, foo.scala, -cp, /tmp:/bippy, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +34) List(-deprecation, foo.scala, , -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +35) List(foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +36) List(, foo.scala, -cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +37) List(foo.scala, -cp, /tmp:/bippy, ) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +38) List(foo.scala, , -cp, /tmp:/bippy) ==> Settings { + -d = . + -classpath = /tmp:/bippy +} + +39) List(foo.scala, -cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +40) List(, foo.scala, -cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +41) List(foo.scala, -cp, /tmp:/bippy, , -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +42) List(foo.scala, -cp, /tmp:/bippy, -deprecation, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +43) List(foo.scala, , -cp, /tmp:/bippy, -deprecation) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +44) List(foo.scala, -deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +45) List(, foo.scala, -deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +46) List(foo.scala, , -deprecation, -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +47) List(foo.scala, -deprecation, -cp, /tmp:/bippy, ) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + +48) List(foo.scala, -deprecation, , -cp, /tmp:/bippy) ==> Settings { + -d = . + -deprecation = true + -classpath = /tmp:/bippy +} + diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala new file mode 100644 index 0000000000..2b04f55b24 --- /dev/null +++ b/test/files/run/settings-parse.scala @@ -0,0 +1,27 @@ +import scala.tools.nsc._ + +object Test { + val tokens = List("", "-deprecation", "foo.scala") + val subsets = tokens.toSet.subsets.toList + val permutations0 = subsets.flatMap(_.toList.permutations).distinct + + def runWithCp(cp: String) = { + val permutations = permutations0 flatMap ("-cp CPTOKEN" :: _ permutations) + + for ((p, i) <- permutations.distinct.sortBy(_ mkString "").zipWithIndex) { + val args = p flatMap (_ split "\\s+") map (x => if (x == "CPTOKEN") cp else x) + val s = new settings.MutableSettings(println) + val (ok, residual) = s.processArguments(args, processAll = true) + + val expected = args filter (_ == "foo.scala") + assert(residual == expected, residual) + assert(ok, args) + println(s"$i) $args ==> $s") + } + } + + def main(args0: Array[String]): Unit = { + runWithCp("") + runWithCp("/tmp:/bippy") + } +} diff --git a/test/files/run/shortClass.check b/test/files/run/shortClass.check new file mode 100644 index 0000000000..fbdb725cca --- /dev/null +++ b/test/files/run/shortClass.check @@ -0,0 +1,10 @@ +bippity.bop.Foo +bippity.bop.Foo$Bar +bippity.bop.Foo$Bar$ +Test$$anon$1 +Test$$anon$2 +Foo +Bar +Bar$ +Foo with DingDongBippy +Bar with DingDongBippy diff --git a/test/files/run/shortClass.scala b/test/files/run/shortClass.scala new file mode 100644 index 0000000000..b7bb016896 --- /dev/null +++ b/test/files/run/shortClass.scala @@ -0,0 +1,24 @@ +import scala.reflect.internal.util._ + +package bippity { + trait DingDongBippy + + package bop { + class Foo { + class Bar + object Bar + } + } +} + +object Test { + import bippity._ + import bop._ + + def main(args: Array[String]): Unit = { + val f = new Foo + val instances = List(f, new f.Bar, f.Bar, new Foo with DingDongBippy, new f.Bar with DingDongBippy) + instances map (_.getClass.getName) foreach println + instances map shortClassOfInstance foreach println + } +} diff --git a/test/files/run/showraw_aliases.check b/test/files/run/showraw_aliases.check index aebd354031..d6a198b1cb 100644 --- a/test/files/run/showraw_aliases.check +++ b/test/files/run/showraw_aliases.check @@ -1,2 +1,2 @@ -Block(List(Import(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), List(ImportSelector(newTermName("universe"), <offset>, newTermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), scala.reflect.runtime.package), [newTermName("universe") aka newTermName("ru")])) -Block(List(Import(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), List(ImportSelector(newTermName("universe"), <offset>, newTermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), scala.reflect.runtime.package#<id>), [newTermName("universe")#<id> aka newTermName("ru")])) +Block(List(Import(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), List(ImportSelector(TermName("universe"), <offset>, TermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), scala.reflect.runtime.package), [TermName("universe") aka TermName("ru")])) +Block(List(Import(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), List(ImportSelector(TermName("universe"), <offset>, TermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), scala.reflect.runtime.package#<id>), [TermName("universe")#<id> aka TermName("ru")])) diff --git a/test/files/run/showraw_mods.check b/test/files/run/showraw_mods.check index 7fca027614..3ec868542d 100644 --- a/test/files/run/showraw_mods.check +++ b/test/files/run/showraw_mods.check @@ -1 +1 @@ -Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), newTypeName("C"), List(), Template(List(Ident(newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), newTermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), newTermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), newTermName("y"), TypeTree(), Select(This(newTypeName("C")), newTermName("x"))), ValDef(Modifiers(LAZY), newTermName("z"), TypeTree(), Select(This(newTypeName("C")), newTermName("y"))))))), Literal(Constant(()))) +Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), TypeName("C"), List(), Template(List(Ident(TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), TermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), TermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), TermName("y"), TypeTree(), Select(This(TypeName("C")), TermName("x"))), ValDef(Modifiers(LAZY), TermName("z"), TypeTree(), Select(This(TypeName("C")), TermName("y"))))))), Literal(Constant(()))) diff --git a/test/files/run/showraw_tree.check b/test/files/run/showraw_tree.check index dca272684e..0416b12568 100644 --- a/test/files/run/showraw_tree.check +++ b/test/files/run/showraw_tree.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List()) -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(TypeName("String")), Ident(TypeName("String"))))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(TypeName("String")), Ident(TypeName("String"))))), nme.CONSTRUCTOR), List()) diff --git a/test/files/run/showraw_tree_ids.check b/test/files/run/showraw_tree_ids.check index d25599c7fc..6e17bf2fb4 100644 --- a/test/files/run/showraw_tree_ids.check +++ b/test/files/run/showraw_tree_ids.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List()) -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Ident(TypeName("String")#<id>), Ident(TypeName("String")#<id>)))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Ident(TypeName("String")#<id>), Ident(TypeName("String")#<id>)))), nme.CONSTRUCTOR), List()) diff --git a/test/files/run/showraw_tree_kinds.check b/test/files/run/showraw_tree_kinds.check index d0d4cd0058..16147a64f4 100644 --- a/test/files/run/showraw_tree_kinds.check +++ b/test/files/run/showraw_tree_kinds.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List()) -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Ident(TypeName("String")#TPE), Ident(TypeName("String")#TPE)))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Ident(TypeName("String")#TPE), Ident(TypeName("String")#TPE)))), nme.CONSTRUCTOR), List()) diff --git a/test/files/run/showraw_tree_types_ids.check b/test/files/run/showraw_tree_types_ids.check index 92ee45a1e6..c98b16e956 100644 --- a/test/files/run/showraw_tree_types_ids.check +++ b/test/files/run/showraw_tree_types_ids.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List()) -[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))) -[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))) +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List()) +[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List())))) [3] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List()) -[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()) -Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List()) -[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()) -[5] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))) -[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))) +[4] TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()) +Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List()) +[4] TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()) +[5] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()))) +[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List())))) [7] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List()) diff --git a/test/files/run/showraw_tree_types_typed.check b/test/files/run/showraw_tree_types_typed.check index c6c20409dc..30dda7d18b 100644 --- a/test/files/run/showraw_tree_types_typed.check +++ b/test/files/run/showraw_tree_types_typed.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List()) -[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))) -[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))) +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String"))), TypeTree[4]().setOriginal(Ident[4](TypeName("String"))))))), nme.CONSTRUCTOR), List()) +[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), TypeName("String"), List()), TypeRef(ThisType(scala.Predef), TypeName("String"), List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), TypeName("String"), List()), TypeRef(ThisType(scala.Predef), TypeName("String"), List())))) [3] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List()) -[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List()) -Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List()) -[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List()) -[5] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))) -[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))) +[4] TypeRef(ThisType(scala.Predef), TypeName("String"), List()) +Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String"))), TypeTree[4]().setOriginal(Ident[4](TypeName("String"))))))), nme.CONSTRUCTOR), List()) +[4] TypeRef(ThisType(scala.Predef), TypeName("String"), List()) +[5] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), TypeName("String"), List()), TypeRef(ThisType(scala.Predef), TypeName("String"), List()))) +[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), TypeName("String"), List()), TypeRef(ThisType(scala.Predef), TypeName("String"), List())))) [7] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List()) diff --git a/test/files/run/showraw_tree_types_untyped.check b/test/files/run/showraw_tree_types_untyped.check index dca272684e..0416b12568 100644 --- a/test/files/run/showraw_tree_types_untyped.check +++ b/test/files/run/showraw_tree_types_untyped.check @@ -1,2 +1,2 @@ -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List()) -Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(TypeName("String")), Ident(TypeName("String"))))), nme.CONSTRUCTOR), List()) +Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(TypeName("String")), Ident(TypeName("String"))))), nme.CONSTRUCTOR), List()) diff --git a/test/files/run/showraw_tree_ultimate.check b/test/files/run/showraw_tree_ultimate.check index 46ccd4df8f..991ecc5410 100644 --- a/test/files/run/showraw_tree_ultimate.check +++ b/test/files/run/showraw_tree_ultimate.check @@ -1,10 +1,10 @@ -Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#PCTOR), List()) -[1] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))) -[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))) +Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#PCTOR), List()) +[1] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()))) +[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List())))) [3] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List()) -[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()) -Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#CTOR), List()) -[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()) -[5] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))) -[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))) +[4] TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()) +Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#CTOR), List()) +[4] TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()) +[5] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()))) +[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List())))) [7] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List()) diff --git a/test/files/run/structural.scala b/test/files/run/structural.scala index 36af8c4bfc..3a703d2cf1 100644 --- a/test/files/run/structural.scala +++ b/test/files/run/structural.scala @@ -152,7 +152,7 @@ object test2 { object test3 { - case class Exc extends Exception + case class Exc() extends Exception object Rec { def f = throw Exc() diff --git a/test/files/run/t0091.check b/test/files/run/t0091.check index 7ed6ff82de..fd3c81a4d7 100644 --- a/test/files/run/t0091.check +++ b/test/files/run/t0091.check @@ -1 +1,2 @@ 5 +5 diff --git a/test/files/run/t0091.scala b/test/files/run/t0091.scala index eaddde0dbf..45235eb77b 100644 --- a/test/files/run/t0091.scala +++ b/test/files/run/t0091.scala @@ -4,10 +4,13 @@ object C extends B { object m extends A { def x = 5 } } object Test { - // The type annotation here is necessary, otherwise - // the compiler would reference C$m$ directly. - def o : B = C - def main(argv : Array[String]) : Unit = { - println(o.m.x) - } + // The type annotation here is necessary, otherwise + // the compiler would reference C$m$ directly. + def o1 : B = C + def o2 = C + + def main(argv : Array[String]) : Unit = { + println(o1.m.x) + println(o2.m.x) + } } diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala index ab132b724f..6d2e7ee05f 100644 --- a/test/files/run/t1500.scala +++ b/test/files/run/t1500.scala @@ -21,7 +21,7 @@ object Test { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") val tool = new interpreter.IMain(settings) - val global = tool.compiler + val global = tool.global import global._ import definitions._ diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala index aba206bc7a..a2f7bb3a65 100644 --- a/test/files/run/t1501.scala +++ b/test/files/run/t1501.scala @@ -31,7 +31,7 @@ object Test { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") val tool = new interpreter.IMain(settings) - val global = tool.compiler + val global = tool.global import global._ import definitions._ diff --git a/test/files/run/t1505.scala b/test/files/run/t1505.scala index a246e8a35b..d7feb30ce3 100644 --- a/test/files/run/t1505.scala +++ b/test/files/run/t1505.scala @@ -1,5 +1,3 @@ -object P extends Enumeration(0, "A", "B", "C") { val A, B, C = Value } - object Q extends Enumeration { val A = Value("A") val B = Value("B") @@ -11,9 +9,14 @@ object R extends Enumeration { } object Test extends App { - assert(P(0) == P.withName("A")) - assert(P.C == P.withName("C")) - assert(Q(0) == Q.withName("A")) assert(Q.C == Q.withName("C")) + + assert(R(0) == R.withName("A")) + assert(R.C == R.withName("C")) + + var failed = false + try { Q.withName("x") } catch { case _: NoSuchElementException => failed = true } + assert(failed) + } diff --git a/test/files/run/t2251.check b/test/files/run/t2251.check new file mode 100644 index 0000000000..55ad2a5857 --- /dev/null +++ b/test/files/run/t2251.check @@ -0,0 +1 @@ +Set(List(List(C), Stream(D, ?))) diff --git a/test/files/run/t2251.scala b/test/files/run/t2251.scala new file mode 100644 index 0000000000..00c5619b49 --- /dev/null +++ b/test/files/run/t2251.scala @@ -0,0 +1,19 @@ +class A +trait B[T <: B[T]] extends A +class C extends B[C] { override def toString = "C" } +class D extends B[D] { override def toString = "D" } + +class E { + val ys = List(List(new C), Stream(new D)) +} + +object Test { + def trav = List(List(), Stream()) + + def main(args: Array[String]): Unit = { + val f = (new E).ys _ + var xs: Set[List[_ <: Seq[B[_]]]] = Set() + xs += f() + println(xs) + } +} diff --git a/test/files/run/t2251b.check b/test/files/run/t2251b.check new file mode 100644 index 0000000000..42b0be457a --- /dev/null +++ b/test/files/run/t2251b.check @@ -0,0 +1,11 @@ +TypeTag[List[scala.collection.immutable.LinearSeq[B[_ >: D with C <: B[_ >: D with C <: A]]] with scala.collection.AbstractSeq[B[_ >: D with C <: B[_ >: D with C <: A]]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def dropRight(n: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def takeRight(n: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def drop(n: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def take(n: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.LinearSeq with scala.collection.AbstractSeq]; def reverse: scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def dropRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A]}; def splitAt(n: Int): (scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A], scala.collection.immutable.LinearSeq[A] with scala.collection.AbstractSeq[A])}]] +TypeTag[List[scala.collection.immutable.Iterable[B[_ >: F with E with D with C <: B[_ >: F with E with D with C <: A]]] with F with Int => Any]] +TypeTag[List[scala.collection.immutable.Seq[B[_ >: D with C <: B[_ >: D with C <: A]]] with scala.collection.AbstractSeq[B[_ >: D with C <: B[_ >: D with C <: A]]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def takeRight(n: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def drop(n: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def take(n: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def slice(from: Int,until: Int): scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}; def splitAt(n: Int): (scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A], scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]); def init: scala.collection.immutable.Seq[B[_ >: D with C <: A]] with scala.collection.AbstractSeq[B[_ >: D with C <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.immutable.Seq with scala.collection.AbstractSeq]; def dropRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def takeRight(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def drop(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def take(n: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def slice(from: Int,until: Int): scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]; def init: scala.collection.immutable.Seq[A] with scala.collection.AbstractSeq[A]}}]] +TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[scala.collection.Set[_ >: G with F <: B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[scala.collection.Map[_ >: F with C <: B[_ >: F with C <: B[_ >: F with C <: A]], B[_ >: G with D <: B[_ >: G with D <: A]]]]] +TypeTag[List[scala.collection.AbstractSeq[B[_ >: G with F <: B[_ >: G with F <: A]]] with scala.collection.LinearSeq[B[_ >: G with F <: B[_ >: G with F <: A]]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def drop(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def take(n: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}; def slice(from: Int,until: Int): scala.collection.AbstractSeq[B[_ >: G with F <: A]] with scala.collection.LinearSeq[B[_ >: G with F <: A]]{def companion: scala.collection.generic.GenericCompanion[scala.collection.AbstractSeq with scala.collection.LinearSeq]; def dropRight(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def drop(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def take(n: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]; def slice(from: Int,until: Int): scala.collection.AbstractSeq[A] with scala.collection.LinearSeq[A]}}]] +TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] +TypeTag[List[Seq[B[_ >: G with F <: B[_ >: G with F <: A]]]]] diff --git a/test/files/run/t2251b.scala b/test/files/run/t2251b.scala new file mode 100644 index 0000000000..b67b3aec1e --- /dev/null +++ b/test/files/run/t2251b.scala @@ -0,0 +1,48 @@ +class A +trait B[T <: B[T]] extends A +class B1[T <: B1[T]] extends B[T] +class C extends B[C] { override def toString = "C" } +class D extends B[D] { override def toString = "D" } +class E extends B[E] { override def toString = "E" } +class F extends B[F] { override def toString = "F" } +class G extends B1[G] { override def toString = "G" } + +object Test { + import scala.collection.{ mutable, immutable } + import scala.collection.immutable.{ Vector } + import scala.reflect.runtime.universe._ + def what[T: TypeTag](x: T) = println(typeTag[T]) + + def main(args: Array[String]): Unit = { + what(List(List(new C), Stream(new D))) + what(List(List(new C), Stream(new D), Vector(new E), Set(new F))) + what(List(immutable.Vector(new C), Stream(new D))) + what(List(collection.Set(new F), mutable.Set(new G))) + what(List(collection.Set(new F), immutable.Set(new G))) + what(List(mutable.Set(new F), immutable.Set(new G))) + what(List(mutable.Seq(new F), immutable.Seq(new G))) + what(List(mutable.Map(new C -> new D), immutable.Map(new F -> new G))) + what(List(mutable.MutableList(new F), immutable.List(new G))) + what(List(mutable.Seq(new F), collection.Seq(new G))) + what(List(mutable.LinearSeq(new F), collection.IndexedSeq(new G))) + } +} + + +// class D extends B[D] { override def toString = "D" } + + +// class E { +// val ys = List(List(new C), Stream(new D)) +// } + +// object Test { +// def trav = List(List(), Stream()) + +// def main(args: Array[String]): Unit = { +// val f = (new E).ys _ +// var xs: Set[List[_ <: Seq[B[_]]]] = Set() +// xs += f() +// println(xs) +// } +// } diff --git a/test/pending/run/t2318.check b/test/files/run/t2318.check index a486f1ac47..a486f1ac47 100644 --- a/test/pending/run/t2318.check +++ b/test/files/run/t2318.check diff --git a/test/pending/run/t2318.scala b/test/files/run/t2318.scala index e42cbb9680..47d083eb9d 100644 --- a/test/pending/run/t2318.scala +++ b/test/files/run/t2318.scala @@ -7,7 +7,8 @@ object Test { override def checkPermission(perm: Permission) = perm match { case _: java.lang.RuntimePermission => () case _: java.io.FilePermission => () - case x: java.security.AccessControlException if x.getName contains ".networkaddress." => () // generality ftw + case x: java.security.SecurityPermission if x.getName contains ".networkaddress." => () // generality ftw + case x: java.util.PropertyPermission if x.getName == "sun.net.inetaddr.ttl" => () case _ => super.checkPermission(perm) } } diff --git a/test/files/run/t2418.check b/test/files/run/t2418.check new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/files/run/t2418.check @@ -0,0 +1 @@ +10 diff --git a/test/files/run/t2418.scala b/test/files/run/t2418.scala new file mode 100644 index 0000000000..f330bef60a --- /dev/null +++ b/test/files/run/t2418.scala @@ -0,0 +1,10 @@ +class Foo { + @volatile final var x=10 + override def toString = "" + x +} + +object Test { + def main(args: Array[String]): Unit = { + println((new Foo)) + } +} diff --git a/test/files/run/t2873.check b/test/files/run/t2873.check index 9198280f61..209b679c07 100644 --- a/test/files/run/t2873.check +++ b/test/files/run/t2873.check @@ -1 +1 @@ -scala.collection.immutable.RedBlack<A>.Empty$ +RedBlack<A>.Empty$ diff --git a/test/files/run/t2873.scala b/test/files/run/t2873.scala index 8d48a8dbb4..3a3cc59b46 100644 --- a/test/files/run/t2873.scala +++ b/test/files/run/t2873.scala @@ -1,5 +1,10 @@ +abstract class RedBlack[A] extends Serializable { + abstract class Tree[+B] extends Serializable + case object Empty extends Tree[Nothing] +} + object Test { def main(args: Array[String]): Unit = { - println(classOf[scala.collection.immutable.RedBlack[_]].getMethod("Empty").getGenericReturnType) + println(classOf[RedBlack[_]].getMethod("Empty").getGenericReturnType) } } diff --git a/test/files/run/t2886.check b/test/files/run/t2886.check index ce31bc7408..cb0db8a6dc 100644 --- a/test/files/run/t2886.check +++ b/test/files/run/t2886.check @@ -1,5 +1,5 @@ ((x: String) => { - val x$1 = x; - val x$2 = x; + <artifact> val x$1 = x; + <artifact> val x$2 = x; Test.this.test(x$2, x$1) }) diff --git a/test/files/run/t3038d.scala b/test/files/run/t3038d.scala index 6cd2d83776..9550165235 100644 --- a/test/files/run/t3038d.scala +++ b/test/files/run/t3038d.scala @@ -16,9 +16,7 @@ trait Foo { } } - -@serializable -class Bar extends Foo { +class Bar extends Foo with Serializable { @transient protected var first: Any = null def size = a @transient var second: Any = null diff --git a/test/files/run/t3667.check b/test/files/run/t3667.check index bbe5d1bc48..6375c88997 100644 --- a/test/files/run/t3667.check +++ b/test/files/run/t3667.check @@ -1,6 +1,3 @@ -1 -2 -3 4 2 3 diff --git a/test/files/run/t3667.scala b/test/files/run/t3667.scala index f30d57ce3a..ada09d5886 100644 --- a/test/files/run/t3667.scala +++ b/test/files/run/t3667.scala @@ -1,27 +1,9 @@ object Test { def main(args: Array[String]) { - val o1 = new Outer1 - val o2 = new Outer2 - val o3 = new Outer3 val o4 = new Outer4 val o5 = new Outer5 val o6 = new Outer6 - println(1) - ser(new o1.Inner(1)) - o1.Inner // make sure the Inner$module field of the Outer1 instance is initialized! - ser(new o1.Inner(1)) - - println(2) - ser(new o2.Inner(1)) - o2.Inner - ser(new o2.Inner(1)) - - println(3) - ser(new o3.Inner(1)) - o3.Inner - ser(new o3.Inner(1)) - println(4) ser(new o4.Inner(1)) o4.Inner @@ -54,23 +36,6 @@ object Test { } -@serializable -class Outer1 { - @serializable - class Inner(x: Int = 1) -} - -@serializable -class Outer2 { - case class Inner(x: Int = 1) -} - -@serializable -class Outer3 { - case class Inner(x: Int) -} - - class Outer4 extends Serializable { class Inner(x: Int = 1) extends Serializable } diff --git a/test/files/run/t3835.scala b/test/files/run/t3835.scala index c120a61f6e..766b6ddc2e 100644 --- a/test/files/run/t3835.scala +++ b/test/files/run/t3835.scala @@ -1,6 +1,6 @@ object Test extends App { // work around optimizer bug SI-5672 -- generates wrong bytecode for switches in arguments - // virtpatmat happily emits a switch for a one-case switch, whereas -Xoldpatmat did not + // virtpatmat happily emits a switch for a one-case switch // this is not the focus of this test, hence the temporary workaround def a = (1, 2, 3) match { case (r, \u03b8, \u03c6) => r + \u03b8 + \u03c6 } println(a) diff --git a/test/pending/run/t3897.check b/test/files/run/t3897.check index 244b83716f..244b83716f 100644 --- a/test/pending/run/t3897.check +++ b/test/files/run/t3897.check diff --git a/test/pending/run/t3897/J_2.java b/test/files/run/t3897/J_2.java index 178412dc92..178412dc92 100644 --- a/test/pending/run/t3897/J_2.java +++ b/test/files/run/t3897/J_2.java diff --git a/test/pending/run/t3897/a_1.scala b/test/files/run/t3897/a_1.scala index 4da959e2ac..4da959e2ac 100644 --- a/test/pending/run/t3897/a_1.scala +++ b/test/files/run/t3897/a_1.scala diff --git a/test/pending/run/t3897/a_2.scala b/test/files/run/t3897/a_2.scala index 4d9e59ef05..4d9e59ef05 100644 --- a/test/pending/run/t3897/a_2.scala +++ b/test/files/run/t3897/a_2.scala diff --git a/test/files/run/t4023.check b/test/files/run/t4023.check new file mode 100644 index 0000000000..05f867c397 --- /dev/null +++ b/test/files/run/t4023.check @@ -0,0 +1,21 @@ +Try 1: (6 classes) +class Test$C$B1 +class Test$C$B2 +class Test$C$B3$ +class Test$C$B4$ +class Test$C$B5$ +class Test$C$B6$ +Try 2: (6 classes) +class Test$C$B1 +class Test$C$B2 +class Test$C$B3$ +class Test$C$B4$ +class Test$C$B5$ +class Test$C$B6$ +Try 3: (6 classes) +class Test$C$B1 +class Test$C$B2 +class Test$C$B3$ +class Test$C$B4$ +class Test$C$B5$ +class Test$C$B6$ diff --git a/test/files/run/t4023.scala b/test/files/run/t4023.scala new file mode 100644 index 0000000000..4846fa31b4 --- /dev/null +++ b/test/files/run/t4023.scala @@ -0,0 +1,23 @@ +object Test { + object C { + class B1 + private class B2 + object B3 + private object B4 + object B5 extends B1 + private object B6 extends B2 + + val valuesTry1 = this.getClass.getDeclaredClasses + val valuesTry2 = C.getClass.getDeclaredClasses + val valuesTry3 = getClass.getDeclaredClasses + } + + def main(args: Array[String]) { + println("Try 1: (" + C.valuesTry1.length + " classes)") + C.valuesTry1.foreach(println) + println("Try 2: (" + C.valuesTry2.length + " classes)") + C.valuesTry2.foreach(println) + println("Try 3: (" + C.valuesTry3.length + " classes)") + C.valuesTry3.foreach(println) + } +}
\ No newline at end of file diff --git a/test/files/run/t4047.scala b/test/files/run/t4047.scala index cd42a8b4df..08989bd278 100644 --- a/test/files/run/t4047.scala +++ b/test/files/run/t4047.scala @@ -18,7 +18,7 @@ class D extends Bar[Unit]{ def foo = println("Unit: called D.foo") } -object Test extends Application { +object Test extends App { val a: Foo[Unit] = new A a.foo a.foo diff --git a/test/files/pos/t4351.check b/test/files/run/t4351.check index cb5d407e13..cb5d407e13 100644 --- a/test/files/pos/t4351.check +++ b/test/files/run/t4351.check diff --git a/test/files/pos/t4351.scala b/test/files/run/t4351.scala index 2d57588793..d954d748b7 100644 --- a/test/files/pos/t4351.scala +++ b/test/files/run/t4351.scala @@ -1,7 +1,8 @@ object Test { def main(args: Array[String]): Unit = { - try new BooleanPropImpl() value + try new BooleanPropImpl().value catch { + // was: StackOverflowError case e: RuntimeException => println("runtime exception") } } diff --git a/test/files/run/t4415.scala b/test/files/run/t4415.scala index f96031d650..caf1609b9e 100644 --- a/test/files/run/t4415.scala +++ b/test/files/run/t4415.scala @@ -39,7 +39,7 @@ class SecondProperty extends TopProperty class SubclassSecondProperty extends StandardProperty trait MyProp[T] -case class MyPropImpl[T] extends MyProp[T] +case class MyPropImpl[T]() extends MyProp[T] object SubclassMatch { diff --git a/test/files/run/t4537.check b/test/files/run/t4537.check new file mode 100644 index 0000000000..63739ca64a --- /dev/null +++ b/test/files/run/t4537.check @@ -0,0 +1 @@ +b.Settings diff --git a/test/files/neg/t4537/a.scala b/test/files/run/t4537/a.scala index 65e183c5f8..125e223e13 100644 --- a/test/files/neg/t4537/a.scala +++ b/test/files/run/t4537/a.scala @@ -1,5 +1,5 @@ package a private[a] object Settings { - val X = 0 -}
\ No newline at end of file + val X = "a.Settings" +} diff --git a/test/files/neg/t4537/b.scala b/test/files/run/t4537/b.scala index bb9dd4e15a..c709d49b04 100644 --- a/test/files/neg/t4537/b.scala +++ b/test/files/run/t4537/b.scala @@ -1,5 +1,5 @@ package b object Settings { - val Y = 0 -}
\ No newline at end of file + val Y = "b.Settings" +} diff --git a/test/files/run/t4537/c.scala b/test/files/run/t4537/c.scala new file mode 100644 index 0000000000..ee05d4bbfb --- /dev/null +++ b/test/files/run/t4537/c.scala @@ -0,0 +1,8 @@ +package b +package c + +import a._ + +object Unambiguous { + println(Settings.Y) +} diff --git a/test/files/run/t4537/d.scala b/test/files/run/t4537/d.scala new file mode 100644 index 0000000000..dd1d2045ed --- /dev/null +++ b/test/files/run/t4537/d.scala @@ -0,0 +1,6 @@ +import a._ +import b._ + +object Test extends App { + println(Settings.Y) +} diff --git a/test/files/run/t4671.check b/test/files/run/t4671.check index 4699818cd4..d4f8af480a 100644 --- a/test/files/run/t4671.check +++ b/test/files/run/t4671.check @@ -2,7 +2,7 @@ Type in expressions to have them evaluated. Type :help for more information. scala> object o { val file = sys.props("partest.cwd") + "/t4671.scala" } -defined module o +defined object o scala> val s = scala.io.Source.fromFile(o.file) s: scala.io.BufferedSource = non-empty iterator diff --git a/test/files/run/t4729.check b/test/files/run/t4729.check new file mode 100644 index 0000000000..9a2aa56d99 --- /dev/null +++ b/test/files/run/t4729.check @@ -0,0 +1,4 @@ +WrappedArray(1, 2) +WrappedArray(1, 2) +WrappedArray(1, 2) +WrappedArray(1, 2) diff --git a/test/files/run/t4729/J_1.java b/test/files/run/t4729/J_1.java new file mode 100644 index 0000000000..2ffb5a88d1 --- /dev/null +++ b/test/files/run/t4729/J_1.java @@ -0,0 +1,4 @@ +// Java Interface: +public interface J_1 { + public void method(String... s); +} diff --git a/test/files/run/t4729/S_2.scala b/test/files/run/t4729/S_2.scala new file mode 100644 index 0000000000..a80afb0257 --- /dev/null +++ b/test/files/run/t4729/S_2.scala @@ -0,0 +1,29 @@ + // Scala class: +class ScalaVarArgs extends J_1 { + // -- no problem on overriding it using ordinary class + def method(s: String*) { println(s) } +} + +object Test { + def main(args: Array[String]) { + //[1] Ok - no problem using inferred type + val varArgs = new J_1 { + def method(s: String*) { println(s) } + } + varArgs.method("1", "2") + + //[2] Ok -- no problem when explicit set its type after construction + val b: J_1 = varArgs + b.method("1", "2") + + //[3] Ok -- no problem on calling its method + (new ScalaVarArgs).method("1", "2") + (new ScalaVarArgs: J_1).method("1", "2") + + //[4] Not Ok -- error when assigning anonymous class to an explictly typed val + // Compiler error: object creation impossible, since method method in trait VarArgs of type (s: <repeated...>[java.lang.String])Unit is not defined + val tagged: J_1 = new J_1 { + def method(s: String*) { println(s) } + } + } +} diff --git a/test/files/run/t4935.flags b/test/files/run/t4935.flags index ac14fe5dbd..49d036a887 100644 --- a/test/files/run/t4935.flags +++ b/test/files/run/t4935.flags @@ -1 +1 @@ --optimize
+-optimize diff --git a/test/files/run/t4996.check b/test/files/run/t4996.check new file mode 100644 index 0000000000..8d45b413c9 --- /dev/null +++ b/test/files/run/t4996.check @@ -0,0 +1,4 @@ +B.foo +M.foo +B.foo +M.foo
\ No newline at end of file diff --git a/test/files/run/t4996.scala b/test/files/run/t4996.scala new file mode 100644 index 0000000000..8e7636aaac --- /dev/null +++ b/test/files/run/t4996.scala @@ -0,0 +1,47 @@ + + + + + + +trait A[@specialized(Int) T] { + def foo(t: T) +} + + +trait B extends A[Int] { + def foo(t: Int) { + println("B.foo") + } +} + + +trait M extends B { + abstract override def foo(t: Int) { + super.foo(t) + println("M.foo") + } +} + + +object C extends B with M + + +object D extends B { + override def foo(t: Int) { + super.foo(t) + println("M.foo") + } +} + + +object Test { + + def main(args: Array[String]) { + D.foo(42) // OK, prints B.foo M.foo + C.foo(42) // was StackOverflowError + } + +} + + diff --git a/test/files/run/t5225_2.check b/test/files/run/t5225_2.check index 8ed54a14bb..477ea4eb6d 100644 --- a/test/files/run/t5225_2.check +++ b/test/files/run/t5225_2.check @@ -1,4 +1,4 @@ { - def foo(@new cloneable() x: Int) = ""; + def foo(@new elidable(0) x: Int) = ""; () } diff --git a/test/files/run/t5225_2.scala b/test/files/run/t5225_2.scala index d1b607499c..cf0f23a5c8 100644 --- a/test/files/run/t5225_2.scala +++ b/test/files/run/t5225_2.scala @@ -1,6 +1,6 @@ import scala.reflect.runtime.universe._ object Test extends App { - val tree = reify{def foo(@cloneable x: Int) = ""}.tree + val tree = reify{def foo(@annotation.elidable(0) x: Int) = ""}.tree println(tree.toString) }
\ No newline at end of file diff --git a/test/pending/run/t5293-map.scala b/test/files/run/t5293-map.scala index 2707aed07e..2707aed07e 100644 --- a/test/pending/run/t5293-map.scala +++ b/test/files/run/t5293-map.scala diff --git a/test/pending/run/t5293.scala b/test/files/run/t5293.scala index 01ead45d2a..01ead45d2a 100644 --- a/test/pending/run/t5293.scala +++ b/test/files/run/t5293.scala diff --git a/test/files/run/t5353.check b/test/files/run/t5353.check new file mode 100644 index 0000000000..a2906793ed --- /dev/null +++ b/test/files/run/t5353.check @@ -0,0 +1,2 @@ +1 +[Ljava.lang.Object; cannot be cast to [Ljava.lang.String; diff --git a/test/files/run/t5353.scala b/test/files/run/t5353.scala new file mode 100644 index 0000000000..5208fe527f --- /dev/null +++ b/test/files/run/t5353.scala @@ -0,0 +1,9 @@ +object Test extends App { + def f(x: Boolean) = if (x) Array("abc") else Array() + try { + println(f(true).length) + println(f(false).length) + } catch { + case ex: Throwable => println(ex.getMessage) + } +} diff --git a/test/files/run/t5374.check b/test/files/run/t5374.check index 6be88d77ec..c1cd843080 100644 --- a/test/files/run/t5374.check +++ b/test/files/run/t5374.check @@ -2,5 +2,4 @@ ListBuffer(1, 2, 3, 1) ListBuffer(1, 2, 3, 1) ListBuffer() List(1, 2, 3, 4, 5) -List(1, 2, 3) -ok
\ No newline at end of file +ok diff --git a/test/files/run/t5374.scala b/test/files/run/t5374.scala index 9b1671e795..f6a913e35c 100644 --- a/test/files/run/t5374.scala +++ b/test/files/run/t5374.scala @@ -7,15 +7,15 @@ import java.io._ object Test { - + def main(args: Array[String]) { ticketExample() emptyListBuffer() list() - legacyList() + // legacyList() objectWithMultipleLists() } - + def inAndOut[T <: AnyRef](obj: T): T = { val baos = new ByteArrayOutputStream val oos = new ObjectOutputStream(baos) @@ -24,53 +24,53 @@ object Test { val ois = new ObjectInputStream(bais) ois.readObject.asInstanceOf[T] } - + def ticketExample() { val lb = inAndOut(ListBuffer(1, 2, 3)) val lb2 = ListBuffer[Int]() ++= lb - + lb2 ++= List(1) lb ++= List(1) println(lb) println(lb2) } - + def emptyListBuffer() { val lb = inAndOut(ListBuffer[Int]()) - + println(lb) } - + def list() { val l = inAndOut(List(1, 2, 3, 4, 5)) - + println(l) } - + // this byte array corresponds to what List(1, 2, 3) used to be serialized to prior to this fix val listBytes = Array[Byte](-84, -19, 0, 5, 115, 114, 0, 39, 115, 99, 97, 108, 97, 46, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 46, 105, 109, 109, 117, 116, 97, 98, 108, 101, 46, 36, 99, 111, 108, 111, 110, 36, 99, 111, 108, 111, 110, -118, 92, 99, 91, -10, -40, -7, 109, 3, 0, 2, 76, 0, 43, 115, 99, 97, 108, 97, 36, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 36, 105, 109, 109, 117, 116, 97, 98, 108, 101, 36, 36, 99, 111, 108, 111, 110, 36, 99, 111, 108, 111, 110, 36, 36, 104, 100, 116, 0, 18, 76, 106, 97, 118, 97, 47, 108, 97, 110, 103, 47, 79, 98, 106, 101, 99, 116, 59, 76, 0, 2, 116, 108, 116, 0, 33, 76, 115, 99, 97, 108, 97, 47, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 47, 105, 109, 109, 117, 116, 97, 98, 108, 101, 47, 76, 105, 115, 116, 59, 120, 112, 115, 114, 0, 17, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 73, 110, 116, 101, 103, 101, 114, 18, -30, -96, -92, -9, -127, -121, 56, 2, 0, 1, 73, 0, 5, 118, 97, 108, 117, 101, 120, 114, 0, 16, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 78, 117, 109, 98, 101, 114, -122, -84, -107, 29, 11, -108, -32, -117, 2, 0, 0, 120, 112, 0, 0, 0, 1, 115, 113, 0, 126, 0, 4, 0, 0, 0, 2, 115, 113, 0, 126, 0, 4, 0, 0, 0, 3, 115, 114, 0, 44, 115, 99, 97, 108, 97, 46, 99, 111, 108, 108, 101, 99, 116, 105, 111, 110, 46, 105, 109, 109, 117, 116, 97, 98, 108, 101, 46, 76, 105, 115, 116, 83, 101, 114, 105, 97, 108, 105, 122, 101, 69, 110, 100, 36, -118, 92, 99, 91, -9, 83, 11, 109, 2, 0, 0, 120, 112, 120) - - def legacyList() { - val bais = new ByteArrayInputStream(listBytes) - val ois = new ObjectInputStream(bais) - val l = ois.readObject() - - println(l) - } - + + // def legacyList() { + // val bais = new ByteArrayInputStream(listBytes) + // val ois = new ObjectInputStream(bais) + // val l = ois.readObject() + + // println(l) + // } + class Foo extends Serializable { val head = List(1, 2, 3) val last = head.tail.tail def structuralSharing: Boolean = head.tail.tail eq last - + assert(structuralSharing) } - + def objectWithMultipleLists() { val foo = inAndOut(new Foo) - + if (foo.structuralSharing) println("ok") else println("no structural sharing") } - + } diff --git a/test/files/run/t5418.check b/test/files/run/t5418.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/t5418.check diff --git a/test/pending/run/t5418.scala b/test/files/run/t5418.scala index e3cb20cf82..e3cb20cf82 100644 --- a/test/pending/run/t5418.scala +++ b/test/files/run/t5418.scala diff --git a/test/files/run/t5418b.check b/test/files/run/t5418b.check index 48d82a2aae..f036a4be84 100644 --- a/test/files/run/t5418b.check +++ b/test/files/run/t5418b.check @@ -1,2 +1,2 @@ new Object().getClass() -TypeRef(ThisType(java.lang), java.lang.Class, List(TypeRef(NoPrefix, newTypeName("?0"), List()))) +TypeRef(ThisType(java.lang), java.lang.Class, List(TypeRef(NoPrefix, TypeName("?0"), List()))) diff --git a/test/files/run/t5604.check b/test/files/run/t5604.check new file mode 100644 index 0000000000..53a2fc8894 --- /dev/null +++ b/test/files/run/t5604.check @@ -0,0 +1,8 @@ +long +double +long +double +long +double +long +double diff --git a/test/files/run/t5604.scala b/test/files/run/t5604.scala new file mode 100644 index 0000000000..a06c8aab3e --- /dev/null +++ b/test/files/run/t5604.scala @@ -0,0 +1,50 @@ +// a.scala +// Fri Jan 13 11:31:47 PST 2012 + +package foo { + object regular extends Duh { + def buh(n: Long) = println("long") + def buh(n: Double) = println("double") + } + class regular { + import regular._ + + duh(33L) + duh(3.0d) + foo.regular.duh(33L) + foo.regular.duh(3.0d) + buh(66L) + buh(6.0d) + foo.regular.buh(66L) + foo.regular.buh(6.0d) + } + + trait Duh { + def duh(n: Long) = println("long") + def duh(n: Double) = println("double") + } + package object bar extends Duh { + def buh(n: Long) = println("long") + def buh(n: Double) = println("double") + } + package bar { + object Main { + def main(args:Array[String]) { + duh(33L) + duh(3.0d) + foo.bar.duh(33L) + foo.bar.duh(3.0d) + buh(66L) + buh(6.0d) + foo.bar.buh(66L) + foo.bar.buh(6.0d) + } + } + } +} + +object Test { + def main(args: Array[String]): Unit = { + foo.bar.Main.main(null) + } +} diff --git a/test/pending/run/t5610a.check b/test/files/run/t5610a.check index 2aa46b3b91..2aa46b3b91 100644 --- a/test/pending/run/t5610a.check +++ b/test/files/run/t5610a.check diff --git a/test/pending/run/t5610a.scala b/test/files/run/t5610a.scala index f20b295762..f20b295762 100644 --- a/test/pending/run/t5610a.scala +++ b/test/files/run/t5610a.scala diff --git a/test/files/run/t5655.check b/test/files/run/t5655.check index 43ebd50e7a..1103b0e36f 100644 --- a/test/files/run/t5655.check +++ b/test/files/run/t5655.check @@ -4,7 +4,7 @@ Type :help for more information. scala> scala> object x { def x={} } -defined module x +defined object x scala> import x._ import x._ diff --git a/test/files/run/t5879.check b/test/files/run/t5879.check index b6cbda35a7..4bdf3f5fcf 100644 --- a/test/files/run/t5879.check +++ b/test/files/run/t5879.check @@ -1,16 +1,8 @@ Map(1 -> 1) 1 -Map(1 -> 1) -1 -(1,1) -Map(1 -> 1) -1 (1,1) Map(1 -> 1) 1 (1,2) Map(1 -> 2) 2 -(1,2) -Map(1 -> 2) -2
\ No newline at end of file diff --git a/test/files/run/t5879.scala b/test/files/run/t5879.scala index e1c07fc4c2..18dd94289d 100644 --- a/test/files/run/t5879.scala +++ b/test/files/run/t5879.scala @@ -17,10 +17,6 @@ object Test { val r = a.merged(b)(null) println(r) println(r(1)) - - val rold = a.merge(b) - println(rold) - println(rold(1)) } def resolveFirst() { @@ -34,10 +30,6 @@ object Test { val r = a.merged(b) { collision } println(r) println(r(1)) - - val rold = a.merge(b, collision) - println(rold) - println(rold(1)) } def resolveSecond() { @@ -51,10 +43,6 @@ object Test { val r = a.merged(b) { collision } println(r) println(r(1)) - - val rold = a.merge(b, collision) - println(rold) - println(rold(1)) } def resolveMany() { @@ -66,9 +54,6 @@ object Test { val r = a.merged(b) { collision } for ((k, v) <- r) assert(v == 100 + 2 * k, (k, v)) - - val rold = a.merge(b, collision) - for ((k, v) <- r) assert(v == 100 + 2 * k, (k, v)) } } diff --git a/test/files/run/t6028.check b/test/files/run/t6028.check index 34f4b22134..42921ae2f5 100644 --- a/test/files/run/t6028.check +++ b/test/files/run/t6028.check @@ -31,14 +31,14 @@ package <empty> { }; final def apply(): Int = $anonfun$foo$1.this.apply$mcI$sp(); <specialized> def apply$mcI$sp(): Int = $anonfun$foo$1.this.$outer.T$$classParam.+($anonfun$foo$1.this.$outer.field()).+($anonfun$foo$1.this.methodParam$1).+($anonfun$foo$1.this.methodLocal$1); - <synthetic> <paramaccessor> private[this] val $outer: T = _; - <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer; - final <bridge> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply()); + <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _; + <synthetic> <stable> <artifact> def T$$anonfun$$$outer(): T = $anonfun$foo$1.this.$outer; + final <bridge> <artifact> def apply(): Object = scala.Int.box($anonfun$foo$1.this.apply()); <synthetic> <paramaccessor> private[this] val methodParam$1: Int = _; <synthetic> <paramaccessor> private[this] val methodLocal$1: Int = _ }; abstract trait MethodLocalTrait$1 extends Object { - <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T + <synthetic> <stable> <artifact> def T$MethodLocalTrait$$$outer(): T }; object MethodLocalObject$2 extends Object with T#MethodLocalTrait$1 { def <init>($outer: T, barParam$1: Int): T#MethodLocalObject$2.type = { @@ -46,9 +46,9 @@ package <empty> { MethodLocalObject$2.this.$asInstanceOf[T#MethodLocalTrait$1$class]()./*MethodLocalTrait$1$class*/$init$(barParam$1); () }; - <synthetic> <paramaccessor> private[this] val $outer: T = _; - <synthetic> <stable> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer; - <synthetic> <stable> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer + <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _; + <synthetic> <stable> <artifact> def T$MethodLocalObject$$$outer(): T = MethodLocalObject$2.this.$outer; + <synthetic> <stable> <artifact> def T$MethodLocalTrait$$$outer(): T = MethodLocalObject$2.this.$outer }; final <stable> private[this] def MethodLocalObject$1(barParam$1: Int, MethodLocalObject$module$1: runtime.VolatileObjectRef): T#MethodLocalObject$2.type = { MethodLocalObject$module$1.elem = new T#MethodLocalObject$2.type(T.this, barParam$1); @@ -69,9 +69,9 @@ package <empty> { <specialized> def apply$mcV$sp(): Unit = try { $anonfun$tryy$1.this.tryyLocal$1.elem = $anonfun$tryy$1.this.tryyParam$1 } finally (); - <synthetic> <paramaccessor> private[this] val $outer: T = _; - <synthetic> <stable> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer; - final <bridge> def apply(): Object = { + <synthetic> <paramaccessor> <artifact> private[this] val $outer: T = _; + <synthetic> <stable> <artifact> def T$$anonfun$$$outer(): T = $anonfun$tryy$1.this.$outer; + final <bridge> <artifact> def apply(): Object = { $anonfun$tryy$1.this.apply(); scala.runtime.BoxedUnit.UNIT }; diff --git a/test/files/run/t6064.scala b/test/files/run/t6064.scala new file mode 100644 index 0000000000..fc184dd92d --- /dev/null +++ b/test/files/run/t6064.scala @@ -0,0 +1,9 @@ +object Test extends App { + assert(Option(42) contains 42) + assert(Some(42) contains 42) + assert(Option(BigInt(42)) contains 42) + assert(Option(42) contains BigInt(42)) + assert(!(None contains 42)) + assert(Some(null) contains null) + assert(!(Option(null) contains null)) +}
\ No newline at end of file diff --git a/test/files/run/t6150.scala b/test/files/run/t6150.scala index bd8af5d460..f3e83e1549 100644 --- a/test/files/run/t6150.scala +++ b/test/files/run/t6150.scala @@ -1,7 +1,3 @@ - - - - object Test { import collection.{ immutable, mutable, generic } def TheOneTrueCBF = collection.IndexedSeq.ReusableCBF @@ -38,7 +34,3 @@ object Test { check(iv.:+(4)(cbf3)) } } - - - - diff --git a/test/files/run/t6154.check b/test/files/run/t6154.check new file mode 100644 index 0000000000..9766475a41 --- /dev/null +++ b/test/files/run/t6154.check @@ -0,0 +1 @@ +ok diff --git a/test/files/run/t6154.scala b/test/files/run/t6154.scala new file mode 100644 index 0000000000..02ef62905f --- /dev/null +++ b/test/files/run/t6154.scala @@ -0,0 +1,10 @@ +object Test { + def foo(a: Int) { + var bar: Int = 0 + bar = try { 0 } catch { case ex: Throwable => 0 } + new { foo(bar) } + } + + def main(args: Array[String]): Unit = + try foo(0) catch { case _: java.lang.StackOverflowError => println("ok") } +} diff --git a/test/files/run/t6178.scala b/test/files/run/t6178.scala index 0b4cf0bbf5..41e148af91 100644 --- a/test/files/run/t6178.scala +++ b/test/files/run/t6178.scala @@ -2,6 +2,6 @@ import scala.reflect.runtime.universe._ import scala.reflect.runtime.{currentMirror => cm} object Test extends App { - val plus = typeOf[java.lang.String].member(newTermName("$plus")).asMethod + val plus = typeOf[java.lang.String].member(TermName("$plus")).asMethod println(cm.reflect("").reflectMethod(plus).apply("2")) }
\ No newline at end of file diff --git a/test/files/run/t6181.scala b/test/files/run/t6181.scala index fb23eaff63..eaa7340178 100644 --- a/test/files/run/t6181.scala +++ b/test/files/run/t6181.scala @@ -3,6 +3,6 @@ import scala.reflect.runtime.{currentMirror => cm} object Test extends App { class C { def test(x: => Int) = println(x) } - val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("test")).asMethod) + val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(TermName("test")).asMethod) mm(2) }
\ No newline at end of file diff --git a/test/files/run/t6199-mirror.scala b/test/files/run/t6199-mirror.scala index 772a384542..3fda56bf7c 100644 --- a/test/files/run/t6199-mirror.scala +++ b/test/files/run/t6199-mirror.scala @@ -3,5 +3,5 @@ import scala.reflect.runtime.{currentMirror => cm} object Test extends App { class C { def foo = () } - println(cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)()) + println(cm.reflect(new C).reflectMethod(typeOf[C].member(TermName("foo")).asMethod)()) }
\ No newline at end of file diff --git a/test/files/run/t6206.check b/test/files/run/t6206.check new file mode 100644 index 0000000000..8064573667 --- /dev/null +++ b/test/files/run/t6206.check @@ -0,0 +1,4 @@ +outer +outer +inner +inner diff --git a/test/files/run/t6206.scala b/test/files/run/t6206.scala new file mode 100644 index 0000000000..07ff246d02 --- /dev/null +++ b/test/files/run/t6206.scala @@ -0,0 +1,37 @@ +class Outer { + def apply( position : Inner ) {} + class Inner + + this.apply(new Inner) + this (new Inner) // error, +} + + +class Outer1 { + + self => + + def apply( position : Inner ) : String = "outer" + + class Inner( ) { + + def apply(arg: Inner): String = "inner" + + def testMe = { + List( + self.apply( this ), // a) this works + self( this ), // b) this does not work! + this apply this, + this(this) + ) foreach println + } + } +} + +object Test { + def main(args: Array[String]): Unit = { + val o = new Outer1 + val i = new o.Inner + i.testMe + } +} diff --git a/test/files/run/t6223.check b/test/files/run/t6223.check index 90ec019407..4a09d1930f 100644 --- a/test/files/run/t6223.check +++ b/test/files/run/t6223.check @@ -1,4 +1,4 @@ bar -bar$mcI$sp bar$mIc$sp bar$mIcI$sp +bar$mcI$sp diff --git a/test/files/run/t6223.scala b/test/files/run/t6223.scala index 4ab7c832e6..fb176e32e6 100644 --- a/test/files/run/t6223.scala +++ b/test/files/run/t6223.scala @@ -5,7 +5,7 @@ class Foo[@specialized(Int) A](a:A) { object Test { def main(args:Array[String]) { val f = new Foo(333) - val ms = f.getClass().getDeclaredMethods() + val ms = f.getClass().getDeclaredMethods().sortBy(_.getName) ms.foreach(m => println(m.getName)) } } diff --git a/test/files/run/t6288.check b/test/files/run/t6288.check index af6bd5d269..0a8ff0b92d 100644 --- a/test/files/run/t6288.check +++ b/test/files/run/t6288.check @@ -66,7 +66,7 @@ [273]case5()[293]{ [293]<synthetic> val o7: [293]Option[List[Int]] = [293][293]Case4.unapplySeq([293]x1); [293]if ([293]o7.isEmpty.unary_!) - [293]if ([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([195]0))) + [293]if ([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([293]0))) [304][304]matchEnd4([304]()) else [293][293]case6() diff --git a/test/files/run/t6329_repl.check b/test/files/run/t6329_repl.check index 8663184bde..55d689f2fb 100644 --- a/test/files/run/t6329_repl.check +++ b/test/files/run/t6329_repl.check @@ -3,11 +3,37 @@ Type :help for more information. scala> -scala> classManifest[List[_]] +scala> import scala.reflect.classTag +import scala.reflect.classTag + +scala> classManifest[scala.List[_]] warning: there were 1 deprecation warnings; re-run with -deprecation for details -res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[Any] +res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>] -scala> scala.reflect.classTag[List[_]] +scala> classTag[scala.List[_]] res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List +scala> classManifest[scala.collection.immutable.List[_]] +warning: there were 1 deprecation warnings; re-run with -deprecation for details +res2: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>] + +scala> classTag[scala.collection.immutable.List[_]] +res3: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List + +scala> classManifest[Predef.Set[_]] +warning: there were 1 deprecation warnings; re-run with -deprecation for details +res4: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set[<?>] + +scala> classTag[Predef.Set[_]] +res5: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set + +scala> classManifest[scala.collection.immutable.Set[_]] +warning: there were 1 deprecation warnings; re-run with -deprecation for details +res6: scala.reflect.ClassTag[scala.collection.immutable.Set[_]] = scala.collection.immutable.Set[<?>] + +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/t6329_repl.scala b/test/files/run/t6329_repl.scala index add6d64962..f210d6512c 100644 --- a/test/files/run/t6329_repl.scala +++ b/test/files/run/t6329_repl.scala @@ -2,7 +2,14 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { def code = """ - |classManifest[List[_]] - |scala.reflect.classTag[List[_]] - |""".stripMargin + |import scala.reflect.classTag + |classManifest[scala.List[_]] + |classTag[scala.List[_]] + |classManifest[scala.collection.immutable.List[_]] + |classTag[scala.collection.immutable.List[_]] + |classManifest[Predef.Set[_]] + |classTag[Predef.Set[_]] + |classManifest[scala.collection.immutable.Set[_]] + |classTag[scala.collection.immutable.Set[_]] + """.stripMargin } diff --git a/test/files/run/t6329_vanilla.check b/test/files/run/t6329_vanilla.check index 8282afaeba..ad8f4b5c77 100644 --- a/test/files/run/t6329_vanilla.check +++ b/test/files/run/t6329_vanilla.check @@ -1,2 +1,8 @@ -scala.collection.immutable.List[Any] +scala.collection.immutable.List[<?>] scala.collection.immutable.List +scala.collection.immutable.List[<?>] +scala.collection.immutable.List +scala.collection.immutable.Set[<?>] +scala.collection.immutable.Set +scala.collection.immutable.Set[<?>] +scala.collection.immutable.Set diff --git a/test/files/run/t6329_vanilla.scala b/test/files/run/t6329_vanilla.scala index a31cd5c72e..f2d843896d 100644 --- a/test/files/run/t6329_vanilla.scala +++ b/test/files/run/t6329_vanilla.scala @@ -1,4 +1,12 @@ +import scala.reflect.classTag + object Test extends App { - println(classManifest[List[_]]) - println(scala.reflect.classTag[List[_]]) -}
\ No newline at end of file + println(classManifest[scala.List[_]]) + println(classTag[scala.List[_]]) + println(classManifest[scala.collection.immutable.List[_]]) + println(classTag[scala.collection.immutable.List[_]]) + println(classManifest[Predef.Set[_]]) + println(classTag[Predef.Set[_]]) + println(classManifest[scala.collection.immutable.Set[_]]) + println(classTag[scala.collection.immutable.Set[_]]) +} diff --git a/test/files/run/t6381.check b/test/files/run/t6381.check new file mode 100644 index 0000000000..5070b67e46 --- /dev/null +++ b/test/files/run/t6381.check @@ -0,0 +1,17 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> import language.experimental.macros +import language.experimental.macros + +scala> def pos_impl(c: reflect.macros.Context): c.Expr[String] = + c.literal(c.enclosingPosition.getClass.toString) +pos_impl: (c: scala.reflect.macros.Context)c.Expr[String] + +scala> def pos = macro pos_impl +defined term macro pos: String + +scala> pos +res0: String = class scala.reflect.internal.util.RangePosition + +scala> diff --git a/test/files/run/t6381.scala b/test/files/run/t6381.scala new file mode 100644 index 0000000000..859ec3cb30 --- /dev/null +++ b/test/files/run/t6381.scala @@ -0,0 +1,13 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + def code = """ + |import language.experimental.macros + |def pos_impl(c: reflect.macros.Context): c.Expr[String] = + | c.literal(c.enclosingPosition.getClass.toString) + |def pos = macro pos_impl + |pos + |""".stripMargin.trim + + override def extraSettings: String = "-Yrangepos" +} diff --git a/test/files/run/t6392b.check b/test/files/run/t6392b.check index e9c7ecaa34..2afc48495f 100644 --- a/test/files/run/t6392b.check +++ b/test/files/run/t6392b.check @@ -1 +1 @@ -ModuleDef(Modifiers(), newTermName("C"), Template(List(Select(Ident(scala#PK), newTypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(newTypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(()))))))) +ModuleDef(Modifiers(), TermName("C"), Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(()))))))) diff --git a/test/files/run/t6394a/Macros_1.scala b/test/files/run/t6394a/Macros_1.scala index 3d39d3e40a..5aa07e7f41 100644 --- a/test/files/run/t6394a/Macros_1.scala +++ b/test/files/run/t6394a/Macros_1.scala @@ -4,7 +4,7 @@ object Macros { def impl(c:Context): c.Expr[Any] = { import c.universe._ - val selfTree = This(c.enclosingClass.symbol.asModule.moduleClass) + val selfTree = This(c.enclosingImpl.symbol.asModule.moduleClass) c.Expr[AnyRef](selfTree) } diff --git a/test/files/run/t6406-regextract.check b/test/files/run/t6406-regextract.check new file mode 100644 index 0000000000..88c5a52eb3 --- /dev/null +++ b/test/files/run/t6406-regextract.check @@ -0,0 +1,4 @@ +List(1, 3) +List(1, 3) +List(1, 3) +Some(2011) Some(2011) diff --git a/test/files/run/t6406-regextract.scala b/test/files/run/t6406-regextract.scala new file mode 100644 index 0000000000..83679a5167 --- /dev/null +++ b/test/files/run/t6406-regextract.scala @@ -0,0 +1,30 @@ + +object Test extends App { + import util.matching._ + import Regex._ + + val r = "(\\d+)".r + val q = """(\d)""".r + val ns = List("1,2","x","3,4") + val u = r.unanchored + + val is = ns collect { case u(x) => x } map { case r(x) => x } + println(is) + // Match from same pattern + val js = (ns map { u findFirstMatchIn _ }).flatten map { case r(x) => x } + println(js) + // Match not from same pattern + val ks = (ns map { q findFirstMatchIn _ }).flatten map { case r(x) => x } + println(ks) + + val t = "Last modified 2011-07-15" + val p1 = """(\d\d\d\d)-(\d\d)-(\d\d)""".r + val y1: Option[String] = for { + p1(year, month, day) <- p1 findFirstIn t + } yield year + val y2: Option[String] = for { + p1(year, month, day) <- p1 findFirstMatchIn t + } yield year + println(s"$y1 $y2") + +} diff --git a/test/files/run/t6439.check b/test/files/run/t6439.check index 178ea739f5..3f5f7dc8a4 100644 --- a/test/files/run/t6439.check +++ b/test/files/run/t6439.check @@ -7,7 +7,7 @@ scala> class A defined class A scala> object A // warn -defined module A +defined object A warning: previously defined class A is not a companion to object A. Companions must be defined together; you may wish to use :paste mode for this. @@ -15,15 +15,15 @@ scala> trait B defined trait B scala> object B // warn -defined module B +defined object B warning: previously defined trait B is not a companion to object B. Companions must be defined together; you may wish to use :paste mode for this. scala> object C -defined module C +defined object C scala> object Bippy -defined module Bippy +defined object Bippy scala> class C // warn defined class C @@ -40,13 +40,13 @@ scala> val D = 0 // no warn D: Int = 0 scala> object E -defined module E +defined object E scala> var E = 0 // no warn E: Int = 0 scala> object F -defined module F +defined object F scala> type F = Int // no warn defined type alias F @@ -58,7 +58,18 @@ scala> :power ** global._, definitions._ also imported ** ** Try :help, :vals, power.<tab> ** -scala> intp("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols +scala> object lookup { + import intp._ + def apply(name: String): Symbol = types(name) orElse terms(name) + def types(name: String): Symbol = replScope lookup (name: TypeName) orElse getClassIfDefined(name) + def terms(name: String): Symbol = replScope lookup (name: TermName) orElse getModuleIfDefined(name) + def types[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol + def terms[T: global.TypeTag] : Symbol = typeOf[T].termSymbol + def apply[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol +} +defined object lookup + +scala> lookup("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols res0: $r.intp.global.Symbol = type F scala> diff --git a/test/files/run/t6439.scala b/test/files/run/t6439.scala index 70a2dbafaf..175a1d134f 100644 --- a/test/files/run/t6439.scala +++ b/test/files/run/t6439.scala @@ -1,6 +1,7 @@ import scala.tools.partest.ReplTest object Test extends ReplTest { + def code = """ class A object A // warn @@ -17,6 +18,15 @@ var E = 0 // no warn object F type F = Int // no warn :power -intp("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols +object lookup { + import intp._ + def apply(name: String): Symbol = types(name) orElse terms(name) + def types(name: String): Symbol = replScope lookup (name: TypeName) orElse getClassIfDefined(name) + def terms(name: String): Symbol = replScope lookup (name: TermName) orElse getModuleIfDefined(name) + def types[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol + def terms[T: global.TypeTag] : Symbol = typeOf[T].termSymbol + def apply[T: global.TypeTag] : Symbol = typeOf[T].typeSymbol +} +lookup("F") // this now works as a result of changing .typeSymbol to .typeSymbolDirect in IMain#Request#definedSymbols """ } diff --git a/test/files/run/t6448.check b/test/files/run/t6448.check new file mode 100644 index 0000000000..9401568319 --- /dev/null +++ b/test/files/run/t6448.check @@ -0,0 +1,32 @@ + +=List.collect= +f(1) +f(2) +List(1) + +=List.collectFirst= +f(1) +Some(1) + +=Option.collect= +f(1) +Some(1) + +=Option.collect= +f(2) +None + +=Stream.collect= +f(1) +f(2) +List(1) + +=Stream.collectFirst= +f(1) +Some(1) + +=ParVector.collect= +(ParVector(1),2) + +=ParArray.collect= +(ParArray(1),2) diff --git a/test/files/run/t6448.scala b/test/files/run/t6448.scala new file mode 100644 index 0000000000..4d1528e500 --- /dev/null +++ b/test/files/run/t6448.scala @@ -0,0 +1,61 @@ +// Tests to show that various `collect` functions avoid calling +// both `PartialFunction#isDefinedAt` and `PartialFunction#apply`. +// +object Test { + def f(i: Int) = { println("f(" + i + ")"); true } + class Counter { + var count = 0 + def apply(i: Int) = synchronized {count += 1; true} + } + + def testing(label: String)(body: => Any) { + println(s"\n=$label=") + println(body) + } + + def main(args: Array[String]) { + testing("List.collect")(List(1, 2) collect { case x if f(x) && x < 2 => x}) + testing("List.collectFirst")(List(1, 2) collectFirst { case x if f(x) && x < 2 => x}) + testing("Option.collect")(Some(1) collect { case x if f(x) && x < 2 => x}) + testing("Option.collect")(Some(2) collect { case x if f(x) && x < 2 => x}) + testing("Stream.collect")((Stream(1, 2).collect { case x if f(x) && x < 2 => x}).toList) + testing("Stream.collectFirst")(Stream.continually(1) collectFirst { case x if f(x) && x < 2 => x}) + + import collection.parallel.ParIterable + import collection.parallel.immutable.ParVector + import collection.parallel.mutable.ParArray + testing("ParVector.collect") { + val counter = new Counter() + (ParVector(1, 2) collect { case x if counter(x) && x < 2 => x}, counter.synchronized(counter.count)) + } + + testing("ParArray.collect") { + val counter = new Counter() + (ParArray(1, 2) collect { case x if counter(x) && x < 2 => x}, counter.synchronized(counter.count)) + } + + object PendingTests { + testing("Iterator.collect")((Iterator(1, 2) collect { case x if f(x) && x < 2 => x}).toList) + + testing("List.view.collect")((List(1, 2).view collect { case x if f(x) && x < 2 => x}).force) + + // This would do the trick in Future.collect, but I haven't added this yet as there is a tradeoff + // with extra allocations to consider. + // + // pf.lift(v) match { + // case Some(x) => p success x + // case None => fail(v) + // } + testing("Future.collect") { + import concurrent.ExecutionContext.Implicits.global + import concurrent.Await + import concurrent.duration.Duration + val result = concurrent.future(1) collect { case x if f(x) => x} + Await.result(result, Duration.Inf) + } + + // TODO Future.{onSuccess, onFailure, recoverWith, andThen} + } + + } +} diff --git a/test/files/run/t6467.scala b/test/files/run/t6467.scala new file mode 100644 index 0000000000..dc93b69fdc --- /dev/null +++ b/test/files/run/t6467.scala @@ -0,0 +1,20 @@ + + + + +import collection._ + + + +object Test extends App { + + def compare(s1: String, s2: String) { + assert(s1 == s2, s1 + "\nvs.\n" + s2) + } + + compare(List(1, 2, 3, 4).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234") + compare(List(1, 2, 3, 4).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234") + compare(Seq(0 until 100: _*).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString) + compare(Seq(0 until 100: _*).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString) + +}
\ No newline at end of file diff --git a/test/files/run/t6548.scala b/test/files/run/t6548.scala index be3eb5b932..b4d09fd8f6 100644 --- a/test/files/run/t6548.scala +++ b/test/files/run/t6548.scala @@ -8,5 +8,5 @@ class Bean { object Test extends App { println(cm.staticClass("Bean").isCaseClass) - println(typeOf[Bean].declaration(newTermName("value")).annotations) + println(typeOf[Bean].declaration(TermName("value")).annotations) } diff --git a/test/files/run/t6584.check b/test/files/run/t6584.check new file mode 100644 index 0000000000..35c8688751 --- /dev/null +++ b/test/files/run/t6584.check @@ -0,0 +1,8 @@ +Array: 102400 +Vector: 102400 +List: 102400 +Stream: 102400 +Array: 102400 +Vector: 102400 +List: 102400 +Stream: 102400 diff --git a/test/files/run/t6584.scala b/test/files/run/t6584.scala new file mode 100644 index 0000000000..24c236ef35 --- /dev/null +++ b/test/files/run/t6584.scala @@ -0,0 +1,16 @@ +object Test { + def main(args: Array[String]): Unit = { + val size = 100 * 1024 + val doubled = (1 to size) ++ (1 to size) + + println("Array: " + Array.tabulate(size)(x => x).distinct.size) + println("Vector: " + Vector.tabulate(size)(x => x).distinct.size) + println("List: " + List.tabulate(size)(x => x).distinct.size) + println("Stream: " + Stream.tabulate(size)(x => x).distinct.size) + + println("Array: " + doubled.toArray.distinct.size) + println("Vector: " + doubled.toVector.distinct.size) + println("List: " + doubled.toList.distinct.size) + println("Stream: " + doubled.toStream.distinct.size) + } +} diff --git a/test/files/run/t6611.scala b/test/files/run/t6611.scala index 0947a48f90..c295368aea 100644 --- a/test/files/run/t6611.scala +++ b/test/files/run/t6611.scala @@ -7,55 +7,55 @@ object Test extends App { locally { val a = Array("1": Object) - val a2 = Array[Object](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } locally { val a = Array(true) - val a2 = Array[Boolean](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } locally { val a = Array(1: Short) - val a2 = Array[Short](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } locally { val a = Array(1: Byte) - val a2 = Array[Byte](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } locally { val a = Array(1) - val a2 = Array[Int](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } locally { val a = Array(1L) - val a2 = Array[Long](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } locally { val a = Array(1f) - val a2 = Array[Float](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } locally { val a = Array(1d) - val a2 = Array[Double](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } locally { val a = Array(()) - val a2 = Array[Unit](a: _*) + val a2 = Array(a: _*) assert(a ne a2) } } diff --git a/test/files/run/t6745-2.scala b/test/files/run/t6745-2.scala new file mode 100644 index 0000000000..31ecd42bd1 --- /dev/null +++ b/test/files/run/t6745-2.scala @@ -0,0 +1,22 @@ +import scala.tools.nsc._ +import scala.tools.partest.CompilerTest +import scala.collection.{ mutable, immutable, generic } + +object Test extends CompilerTest { + import global._ + import rootMirror._ + import definitions._ + import global.analyzer.{Context, ImportInfo} + + override def code = """ +package context { +} + """ + + def check(source: String, unit: global.CompilationUnit) = { + val context: Context = global.analyzer.rootContext(unit) + val importInfo: ImportInfo = context.imports.head // Predef._ + val importedSym = importInfo.importedSymbol(nme.CONSTRUCTOR) + assert(importedSym == NoSymbol, importedSym) // was "constructor Predef" + } +} diff --git a/test/files/run/t6955.scala b/test/files/run/t6955.scala index 2610acdec4..980aa420cc 100644 --- a/test/files/run/t6955.scala +++ b/test/files/run/t6955.scala @@ -1,5 +1,6 @@ import scala.tools.partest.IcodeTest +// this class should compile to code that uses switches (twice) class Switches { type Tag = Byte @@ -10,7 +11,8 @@ class Switches { case _ => 0 } - def switchOkay(i: Byte): Int = i match { // notice type of i is Byte + // this worked before, should keep working + def switchOkay(i: Byte): Int = i match { case 1 => 1 case 2 => 2 case 3 => 3 diff --git a/test/files/run/test-cpp.scala b/test/files/run/test-cpp.scala index 5b3bc7b746..f9fa85c4d0 100644 --- a/test/files/run/test-cpp.scala +++ b/test/files/run/test-cpp.scala @@ -3,7 +3,7 @@ * in the copy-propagation performed before ClosureElimination. * * In the general case, the local variable 'l' is connected through - * a 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 diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.scala b/test/files/run/toolbox_typecheck_implicitsdisabled.scala index 8a3d433142..95a7056279 100644 --- a/test/files/run/toolbox_typecheck_implicitsdisabled.scala +++ b/test/files/run/toolbox_typecheck_implicitsdisabled.scala @@ -7,16 +7,16 @@ object Test extends App { val toolbox = cm.mkToolBox() val tree1 = Block(List( - Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))), - Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) + Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))), + Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) ) val ttree1 = toolbox.typeCheck(tree1, withImplicitViewsDisabled = false) println(ttree1) try { val tree2 = Block(List( - Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))), - Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2)))) + Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))), + Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2)))) ) val ttree2 = toolbox.typeCheck(tree2, withImplicitViewsDisabled = true) println(ttree2) diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala index 51eb63f294..1f7fda8575 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala @@ -15,11 +15,11 @@ object Test extends App { val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe) build.setTypeSignature(ru, rutpe) - val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) + val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) println(ttree1) - val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2)))) + val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2)))) val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) println(ttree2) } diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check index f5c9b6eeab..74dfb03666 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.check +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check @@ -19,7 +19,7 @@ def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = { val $u: U = $m$untyped.universe; val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror]; - $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) + $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.TermName.apply("Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2)))) } }; new $treecreator1() diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala index 74fd09d9fd..7bfe3ba8a4 100644 --- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala +++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala @@ -15,11 +15,11 @@ object Test extends App { val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe) build.setTypeSignature(ru, rutpe) - val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false) println(ttree1) - val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2)))))) + val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2)))))) val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true) println(ttree2) } diff --git a/test/files/scalacheck/ReflectionExtractors.scala b/test/files/scalacheck/ReflectionExtractors.scala new file mode 100644 index 0000000000..a2615feb3e --- /dev/null +++ b/test/files/scalacheck/ReflectionExtractors.scala @@ -0,0 +1,52 @@ +import org.scalacheck._ +import Prop._ +import Gen._ +import Arbitrary._ + +import scala.reflect.runtime.universe._ +import Flag._ + +object Test extends Properties("reflection extractors") { + + val genFlag = oneOf( + TRAIT, INTERFACE, MUTABLE, MACRO, DEFERRED, ABSTRACT, FINAL, SEALED, + IMPLICIT, LAZY, OVERRIDE, PRIVATE, PROTECTED, LOCAL, CASE, ABSOVERRIDE, + BYNAMEPARAM, PARAM, COVARIANT, CONTRAVARIANT, DEFAULTPARAM, PRESUPER, + DEFAULTINIT + ) + val genModifiers = + for(flag <- genFlag; privateWithin <- genName) + yield Modifiers(flag, privateWithin, Nil) + val genTermName = for(name <- arbitrary[String]) yield TermName(name) + val genTypeName = for(name <- arbitrary[String]) yield TypeName(name) + val genName = oneOf(genTermName, genTypeName) + + implicit val arbTermName: Arbitrary[TermName] = Arbitrary(genTermName) + implicit val arbTypeName: Arbitrary[TypeName] = Arbitrary(genTypeName) + implicit val arbName: Arbitrary[Name] = Arbitrary(genName) + implicit val arbMods: Arbitrary[Modifiers] = Arbitrary(genModifiers) + + property("extract term name") = forAll { (name: TermName) => + val TermName(s) = name + s == name.toString + } + + property("extract type name") = forAll { (name: TypeName) => + val TypeName(s) = name + s == name.toString + } + + property("extract term or type name") = forAll { (name: Name) => + name match { + case TermName(s) => s == name.toString + case TypeName(s) => s == name.toString + } + } + + property("extract modifiers") = forAll { (mods: Modifiers) => + val Modifiers(flags, priv, annots) = mods + flags == mods.flags && + priv == mods.privateWithin && + annots == mods.annotations + } +}
\ No newline at end of file diff --git a/test/files/scalacheck/redblack.scala b/test/files/scalacheck/redblack.scala deleted file mode 100644 index bbc6504f58..0000000000 --- a/test/files/scalacheck/redblack.scala +++ /dev/null @@ -1,213 +0,0 @@ -import org.scalacheck._ -import Prop._ -import Gen._ - -/* -Properties of a Red & Black Tree: - -A node is either red or black. -The root is black. (This rule is used in some definitions and not others. Since the -root can always be changed from red to black but not necessarily vice-versa this -rule has little effect on analysis.) -All leaves are black. -Both children of every red node are black. -Every simple path from a given node to any of its descendant leaves contains the same number of black nodes. -*/ - -abstract class RedBlackTest extends Properties("RedBlack") { - def minimumSize = 0 - def maximumSize = 5 - - object RedBlackTest extends scala.collection.immutable.RedBlack[String] { - def isSmaller(x: String, y: String) = x < y - } - - import RedBlackTest._ - - def nodeAt[A](tree: Tree[A], n: Int): Option[(String, A)] = if (n < tree.iterator.size && n >= 0) - Some(tree.iterator.drop(n).next) - else - None - - def treeContains[A](tree: Tree[A], key: String) = tree.iterator.map(_._1) contains key - - def mkTree(level: Int, parentIsBlack: Boolean = false, label: String = ""): Gen[Tree[Int]] = - if (level == 0) { - value(Empty) - } else { - for { - oddOrEven <- choose(0, 2) - tryRed = oddOrEven.sample.get % 2 == 0 // work around arbitrary[Boolean] bug - isRed = parentIsBlack && tryRed - nextLevel = if (isRed) level else level - 1 - left <- mkTree(nextLevel, !isRed, label + "L") - right <- mkTree(nextLevel, !isRed, label + "R") - } yield { - if (isRed) - RedTree(label + "N", 0, left, right) - else - BlackTree(label + "N", 0, left, right) - } - } - - def genTree = for { - depth <- choose(minimumSize, maximumSize + 1) - tree <- mkTree(depth) - } yield tree - - type ModifyParm - def genParm(tree: Tree[Int]): Gen[ModifyParm] - def modify(tree: Tree[Int], parm: ModifyParm): Tree[Int] - - def genInput: Gen[(Tree[Int], ModifyParm, Tree[Int])] = for { - tree <- genTree - parm <- genParm(tree) - } yield (tree, parm, modify(tree, parm)) -} - -trait RedBlackInvariants { - self: RedBlackTest => - - import RedBlackTest._ - - def rootIsBlack[A](t: Tree[A]) = t.isBlack - - def areAllLeavesBlack[A](t: Tree[A]): Boolean = t match { - case Empty => t.isBlack - case ne: NonEmpty[_] => List(ne.left, ne.right) forall areAllLeavesBlack - } - - def areRedNodeChildrenBlack[A](t: Tree[A]): Boolean = t match { - case RedTree(_, _, left, right) => List(left, right) forall (t => t.isBlack && areRedNodeChildrenBlack(t)) - case BlackTree(_, _, left, right) => List(left, right) forall areRedNodeChildrenBlack - case Empty => true - } - - def blackNodesToLeaves[A](t: Tree[A]): List[Int] = t match { - case Empty => List(1) - case BlackTree(_, _, left, right) => List(left, right) flatMap blackNodesToLeaves map (_ + 1) - case RedTree(_, _, left, right) => List(left, right) flatMap blackNodesToLeaves - } - - def areBlackNodesToLeavesEqual[A](t: Tree[A]): Boolean = t match { - case Empty => true - case ne: NonEmpty[_] => - ( - blackNodesToLeaves(ne).distinct.size == 1 - && areBlackNodesToLeavesEqual(ne.left) - && areBlackNodesToLeavesEqual(ne.right) - ) - } - - def orderIsPreserved[A](t: Tree[A]): Boolean = - t.iterator zip t.iterator.drop(1) forall { case (x, y) => isSmaller(x._1, y._1) } - - def setup(invariant: Tree[Int] => Boolean) = forAll(genInput) { case (tree, parm, newTree) => - invariant(newTree) - } - - property("root is black") = setup(rootIsBlack) - property("all leaves are black") = setup(areAllLeavesBlack) - property("children of red nodes are black") = setup(areRedNodeChildrenBlack) - property("black nodes are balanced") = setup(areBlackNodesToLeavesEqual) - property("ordering of keys is preserved") = setup(orderIsPreserved) -} - -object TestInsert extends RedBlackTest with RedBlackInvariants { - import RedBlackTest._ - - override type ModifyParm = Int - override def genParm(tree: Tree[Int]): Gen[ModifyParm] = choose(0, tree.iterator.size + 1) - override def modify(tree: Tree[Int], parm: ModifyParm): Tree[Int] = tree update (generateKey(tree, parm), 0) - - def generateKey(tree: Tree[Int], parm: ModifyParm): String = nodeAt(tree, parm) match { - case Some((key, _)) => key.init.mkString + "MN" - case None => nodeAt(tree, parm - 1) match { - case Some((key, _)) => key.init.mkString + "RN" - case None => "N" - } - } - - property("update adds elements") = forAll(genInput) { case (tree, parm, newTree) => - treeContains(newTree, generateKey(tree, parm)) - } -} - -object TestModify extends RedBlackTest { - import RedBlackTest._ - - def newValue = 1 - override def minimumSize = 1 - override type ModifyParm = Int - override def genParm(tree: Tree[Int]): Gen[ModifyParm] = choose(0, tree.iterator.size) - override def modify(tree: Tree[Int], parm: ModifyParm): Tree[Int] = nodeAt(tree, parm) map { - case (key, _) => tree update (key, newValue) - } getOrElse tree - - property("update modifies values") = forAll(genInput) { case (tree, parm, newTree) => - nodeAt(tree,parm) forall { case (key, _) => - newTree.iterator contains (key, newValue) - } - } -} - -object TestDelete extends RedBlackTest with RedBlackInvariants { - import RedBlackTest._ - - override def minimumSize = 1 - override type ModifyParm = Int - override def genParm(tree: Tree[Int]): Gen[ModifyParm] = choose(0, tree.iterator.size) - override def modify(tree: Tree[Int], parm: ModifyParm): Tree[Int] = nodeAt(tree, parm) map { - case (key, _) => tree delete key - } getOrElse tree - - property("delete removes elements") = forAll(genInput) { case (tree, parm, newTree) => - nodeAt(tree, parm) forall { case (key, _) => - !treeContains(newTree, key) - } - } -} - -object TestRange extends RedBlackTest with RedBlackInvariants { - import RedBlackTest._ - - override type ModifyParm = (Option[Int], Option[Int]) - override def genParm(tree: Tree[Int]): Gen[ModifyParm] = for { - from <- choose(0, tree.iterator.size) - to <- choose(0, tree.iterator.size) suchThat (from <=) - optionalFrom <- oneOf(Some(from), None, Some(from)) // Double Some(n) to get around a bug - optionalTo <- oneOf(Some(to), None, Some(to)) // Double Some(n) to get around a bug - } yield (optionalFrom, optionalTo) - - override def modify(tree: Tree[Int], parm: ModifyParm): Tree[Int] = { - val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) - val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) - tree range (from, to) - } - - property("range boundaries respected") = forAll(genInput) { case (tree, parm, newTree) => - val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) - val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) - ("lower boundary" |: (from forall ( key => newTree.iterator.map(_._1) forall (key <=)))) && - ("upper boundary" |: (to forall ( key => newTree.iterator.map(_._1) forall (key >)))) - } - - property("range returns all elements") = forAll(genInput) { case (tree, parm, newTree) => - val from = parm._1 flatMap (nodeAt(tree, _) map (_._1)) - val to = parm._2 flatMap (nodeAt(tree, _) map (_._1)) - val filteredTree = (tree.iterator - .map(_._1) - .filter(key => from forall (key >=)) - .filter(key => to forall (key <)) - .toList) - filteredTree == newTree.iterator.map(_._1).toList - } -} - -object Test extends Properties("RedBlack") { - include(TestInsert) - include(TestModify) - include(TestDelete) - include(TestRange) -} - diff --git a/test/flaky/pos/t2868.cmds b/test/flaky/pos/t2868.cmds deleted file mode 100644 index ed8124a9e0..0000000000 --- a/test/flaky/pos/t2868.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac Jann.java Nest.java -scalac pick_1.scala -scalac test_2.scala diff --git a/test/instrumented/library/scala/runtime/BoxesRunTime.java b/test/instrumented/library/scala/runtime/BoxesRunTime.java index 172ed8ee14..673c047dfe 100644 --- a/test/instrumented/library/scala/runtime/BoxesRunTime.java +++ b/test/instrumented/library/scala/runtime/BoxesRunTime.java @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2006-2011, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2006-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/instrumented/library/scala/runtime/ScalaRunTime.scala b/test/instrumented/library/scala/runtime/ScalaRunTime.scala index 5a3f83015f..d8d093e93b 100644 --- a/test/instrumented/library/scala/runtime/ScalaRunTime.scala +++ b/test/instrumented/library/scala/runtime/ScalaRunTime.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/osgi/src/BasicReflection.scala b/test/osgi/src/BasicReflection.scala index 8a0a05d531..68fedb7c83 100644 --- a/test/osgi/src/BasicReflection.scala +++ b/test/osgi/src/BasicReflection.scala @@ -1,10 +1,10 @@ package tools.test.osgi package reflection package basic - + import org.junit.Assert._ import org.ops4j.pax.exam.CoreOptions._ - + import org.junit.Test import org.junit.runner.RunWith import org.ops4j.pax.exam @@ -41,15 +41,15 @@ object M class BasicReflectionTest extends ScalaOsgiHelper { @Configuration - def config(): Array[exam.Option] = + def config(): Array[exam.Option] = justReflectionOptions // Ensure Pax-exam requires C/M in our module def dummy = { new C - M.toString + M.toString } - + @Test def basicMirrorThroughOsgi(): Unit = { // Note for now just assert that we can do this stuff. @@ -57,10 +57,10 @@ class BasicReflectionTest extends ScalaOsgiHelper { val cm = runtimeMirror(classOf[C].getClassLoader) val im = cm.reflect(new C) assertEquals("Unable to reflect field name!", - "value f1", - im.reflectField(typeOf[C].member(newTermName("f1")).asTerm).symbol.toString) + "value f1", + im.reflectField(typeOf[C].member(TermName("f1")).asTerm).symbol.toString) assertEquals("Unable to reflect value!", - 2, - im.reflectField(typeOf[C].member(newTermName("f1")).asTerm).get) + 2, + im.reflectField(typeOf[C].member(TermName("f1")).asTerm).get) } } diff --git a/test/partest b/test/partest index 186c0d1580..2bd8ce94f3 100755 --- a/test/partest +++ b/test/partest @@ -3,7 +3,7 @@ ############################################################################## # Scala test runner 2.8.0 ############################################################################## -# (c) 2002-2011 LAMP/EPFL +# (c) 2002-2013 LAMP/EPFL # # This is free software; see the distribution for copying conditions. # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A @@ -70,6 +70,12 @@ if $cygwin; then else format=windows fi + if [ -n "${JAVA_HOME}" ] ; then + JAVA_HOME=`cygpath --$format "$JAVA_HOME"` + fi + if [ -n "${JAVACMD}" ] ; then + JAVACMD=`cygpath --$format "$JAVACMD"` + fi SCALA_HOME=`cygpath --$format "$SCALA_HOME"` EXT_CLASSPATH=`cygpath --path --$format "$EXT_CLASSPATH"` fi @@ -77,13 +83,17 @@ fi # last arg wins, so if JAVA_OPTS already contains -Xmx or -Xms the # supplied argument will be used. JAVA_OPTS="-Xmx1024M -Xms64M $JAVA_OPTS" +# the ant task doesn't supply any options by default, +# so don't to that here either -- note that you may want to pass -optimise +# to mimic what happens during nightlies +# [ -n "$SCALAC_OPTS" ] || SCALAC_OPTS="-deprecation" partestDebugStr="" if [ ! -z "${PARTEST_DEBUG}" ] ; then partestDebugStr="-Dpartest.debug=${PARTEST_DEBUG}" fi -${JAVACMD:=java} \ +"${JAVACMD:=java}" \ $JAVA_OPTS -cp "$EXT_CLASSPATH" \ ${partestDebugStr} \ -Dscala.home="${SCALA_HOME}" \ diff --git a/test/partest.bat b/test/partest.bat index b64347ce13..1806e80888 100755 --- a/test/partest.bat +++ b/test/partest.bat @@ -3,7 +3,7 @@ rem ########################################################################## rem # Scala code runner 2.9.1.final rem ########################################################################## -rem # (c) 2002-2011 LAMP/EPFL +rem # (c) 2002-2013 LAMP/EPFL rem # rem # This is free software; see the distribution for copying conditions. rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A diff --git a/test/pending/jvm/cf-attributes.scala b/test/pending/jvm/cf-attributes.scala index 9e0e9d95de..f4964b63b1 100644 --- a/test/pending/jvm/cf-attributes.scala +++ b/test/pending/jvm/cf-attributes.scala @@ -52,14 +52,14 @@ object anonymousFunctions { } object anonymousClasses { - //InnerClass: + //InnerClass: // public abstract #_= #_ of #_; //Foo=class anonymousClasses$Foo of class anonymousClasses$ // public abstract #_= #_ of #_; //Foo$class=class anonymousClasses$Foo$class of class anonymousClasses$ trait Foo { def foo() { println("foo"); } override def toString = getClass.getName } - //InnerClass: + //InnerClass: // public final #_; //class anonymousClasses$$anon$1 of class anonymousClasses$ val x = new Foo() { override def foo() { println("foo (overriden)"); } @@ -88,16 +88,16 @@ trait Test1 { trait Test2 { @throws(classOf[Exception]) - def printInnerClasses(cls: Class[_]) { - import java.io._, ch.epfl.lamp.fjbg._ - val fjbgContext = new FJBGContext(49, 0) - val outDir = System.getProperty("partest.output", "cf-attributes.obj") - val fileName = outDir+File.separator+cls.getName+".class" - val in = new DataInputStream(new FileInputStream(fileName)) - val jclass = fjbgContext.JClass(in) - println(jclass.getInnerClasses) - in.close() - } + // def printInnerClasses(cls: Class[_]) { + // import java.io._, ch.epfl.lamp.fjbg._ + // val fjbgContext = new FJBGContext(49, 0) + // val outDir = System.getProperty("partest.output", "cf-attributes.obj") + // val fileName = outDir+File.separator+cls.getName+".class" + // val in = new DataInputStream(new FileInputStream(fileName)) + // val jclass = fjbgContext.JClass(in) + // println(jclass.getInnerClasses) + // in.close() + // } def printClass(name: String) { try { printClass(Class.forName(name)) } catch { case e: Exception => println(e) } @@ -105,7 +105,7 @@ trait Test2 { def printClass(cls: Class[_]) { println("\n[[ "+cls.getName+" ]]"); try { printInnerClasses(cls) } - catch { case e: Exception => println(e) } + catch { case e: Exception => println(e) } } } diff --git a/test/pending/neg/t5378.scala b/test/pending/neg/t5378.scala deleted file mode 100644 index cada29b0a0..0000000000 --- a/test/pending/neg/t5378.scala +++ /dev/null @@ -1,19 +0,0 @@ -import language.reflectiveCalls - -class Coll[+T] { - def contains = new { def apply[T1 <: T](value: T1) = ??? } -} - -object Test { - def main(args: Array[String]): Unit = { - val xs = new Coll[List[String]] - val ys: Coll[Traversable[String]] = xs - - println(ys contains Nil) - // java.lang.NoSuchMethodException: Coll$$anon$1.apply(scala.collection.Traversable) - // at java.lang.Class.getMethod(Class.java:1605) - // at Test$.reflMethod$Method1(a.scala:14) - // at Test$.main(a.scala:14) - // at Test.main(a.scala) - } -} diff --git a/test/pending/pos/overloading-boundaries.scala b/test/pending/pos/overloading-boundaries.scala new file mode 100644 index 0000000000..d2e9fdbb12 --- /dev/null +++ b/test/pending/pos/overloading-boundaries.scala @@ -0,0 +1,37 @@ +package bar { + object bippy extends (Double => String) { + def apply(x: Double): String = "Double" + } +} + +package object bar { + def bippy(x: Int, y: Int, z: Int) = "(Int, Int, Int)" +} + +object Test { + def main(args: Array[String]): Unit = { + println(bar.bippy(5.5d)) + println(bar.bippy(1, 2, 3)) + } +} + +/**** + +% scalac3 a.scala +a.scala:13: error: not enough arguments for method bippy: (x: Int, y: Int, z: Int)String. +Unspecified value parameters y, z. + println(bar.bippy(5.5d)) + ^ +one error found + +# Comment out the call to bar.bippy(5.5d) - compiles +% scalac3 a.scala + +# Compiles only from pure source though - if classes are present, fails. +% scalac3 a.scala +a.scala:2: error: bippy is already defined as method bippy in package object bar + object bippy extends (Double => String) { + ^ +one error found + +****/ diff --git a/test/pending/pos/t1751.cmds b/test/pending/pos/t1751.cmds deleted file mode 100644 index d4a4898ffd..0000000000 --- a/test/pending/pos/t1751.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac SuiteClasses.java -scalac A2_1.scala -scalac A1_2.scala diff --git a/test/pending/pos/t1782.cmds b/test/pending/pos/t1782.cmds deleted file mode 100644 index 61f3d3788e..0000000000 --- a/test/pending/pos/t1782.cmds +++ /dev/null @@ -1,2 +0,0 @@ -javac Ann.java Days.java ImplementedBy.java -scalac Test_1.scala diff --git a/test/pending/pos/t1832.scala b/test/pending/pos/t1832.scala deleted file mode 100644 index bca863f4bd..0000000000 --- a/test/pending/pos/t1832.scala +++ /dev/null @@ -1,10 +0,0 @@ -// Edit by paulp: reduced. -trait Cloning { - trait Foo - def fn(g: Int => Unit): Foo - - implicit def mkStar(i: Int) = new { def *(a: Foo): Foo = null } - - val pool1 = 4 * fn { case i => i * 2 } - val pool2 = 4 * fn { case i: Int => i * 2 } -} diff --git a/test/pending/pos/t294.cmds b/test/pending/pos/t294.cmds deleted file mode 100644 index 62c9a5a068..0000000000 --- a/test/pending/pos/t294.cmds +++ /dev/null @@ -1,3 +0,0 @@ -javac Ann.java Ann2.java -scalac Test_1.scala -scalac Test_2.scala diff --git a/test/pending/pos/t4612.scala b/test/pending/pos/t4612.scala new file mode 100644 index 0000000000..a93c12ef01 --- /dev/null +++ b/test/pending/pos/t4612.scala @@ -0,0 +1,15 @@ +class CyclicReferenceCompilerBug { + trait Trait[A] { + def foo: A + } + + class Class extends Trait[Class] { + def foo = new Class + + trait OtherTrait extends Trait[OtherTrait] { + self: Class => + + def foo = new Class + } + } +} diff --git a/test/pending/pos/t4695/T_1.scala b/test/pending/pos/t4695/T_1.scala new file mode 100644 index 0000000000..70fb1a7f21 --- /dev/null +++ b/test/pending/pos/t4695/T_1.scala @@ -0,0 +1,4 @@ +package foo + +class Bar { } +package object Bar { } diff --git a/test/pending/pos/t4695/T_2.scala b/test/pending/pos/t4695/T_2.scala new file mode 100644 index 0000000000..70fb1a7f21 --- /dev/null +++ b/test/pending/pos/t4695/T_2.scala @@ -0,0 +1,4 @@ +package foo + +class Bar { } +package object Bar { } diff --git a/test/pending/pos/t4717.scala b/test/pending/pos/t4717.scala deleted file mode 100644 index 7eaa3dd487..0000000000 --- a/test/pending/pos/t4717.scala +++ /dev/null @@ -1,7 +0,0 @@ -trait Bounds[@specialized A] { - // okay without `>: A` - def x[B >: A]: Unit = new Bounds[B] { - lazy val it = ??? // def or val okay - it - } -}
\ No newline at end of file diff --git a/test/pending/pos/t5082.scala b/test/pending/pos/t5082.scala new file mode 100644 index 0000000000..20a6cfc55f --- /dev/null +++ b/test/pending/pos/t5082.scala @@ -0,0 +1,8 @@ +object Test { + sealed trait A + case object A1 extends A +} + +trait Something[T] + +case class Test() extends Something[Test.A] diff --git a/test/pending/pos/t5259.scala b/test/pending/pos/t5259.scala deleted file mode 100644 index 317e28a9dc..0000000000 --- a/test/pending/pos/t5259.scala +++ /dev/null @@ -1,14 +0,0 @@ -object DefaultArgBogusTypeMismatch { - - class A[T] - class B { - type T = this.type - def m(implicit a : A[T] = new A[T]) = a - } - - def newB = new B - val a1 = newB.m // Bogus type mismatch - - val stableB = new B - val a2 = stableB.m // OK -} diff --git a/test/pending/pos/t5399.scala b/test/pending/pos/t5399.scala deleted file mode 100644 index 89caba39c1..0000000000 --- a/test/pending/pos/t5399.scala +++ /dev/null @@ -1,8 +0,0 @@ -class Test { - class A[T] - class B[T](val a: A[T]) - - case class CaseClass[T](x: T) - - def break(existB: B[_]) = CaseClass(existB.a) match { case CaseClass(_) => } -} diff --git a/test/pending/pos/t5626.scala b/test/pending/pos/t5626.scala deleted file mode 100644 index 7ab3881827..0000000000 --- a/test/pending/pos/t5626.scala +++ /dev/null @@ -1,12 +0,0 @@ -object Test { - val blob0 = new { - case class Foo(i : Int) - } - val foo0 = blob0.Foo(22) - - val blob1 = new { - class Foo(i: Int) - object Foo { def apply(i: Int): Foo = new Foo(i) } - } - val foo1 = blob1.Foo(22) -} diff --git a/test/pending/pos/t5654.scala b/test/pending/pos/t5654.scala deleted file mode 100644 index eb711a5f37..0000000000 --- a/test/pending/pos/t5654.scala +++ /dev/null @@ -1,4 +0,0 @@ -case class Bomb(a: Array[_]) -case class Bomb2(a: Array[T] forSome { type T }) -class Okay1(a: Array[_]) -case class Okay2(s: Seq[_])
\ No newline at end of file diff --git a/test/pending/pos/t5877.scala b/test/pending/pos/t5877.scala new file mode 100644 index 0000000000..b77605f7f2 --- /dev/null +++ b/test/pending/pos/t5877.scala @@ -0,0 +1,5 @@ +package foo { } + +package object foo { + implicit class Foo(val s: String) { } +} diff --git a/test/pending/pos/t5954/T_1.scala b/test/pending/pos/t5954/T_1.scala new file mode 100644 index 0000000000..0064c596b6 --- /dev/null +++ b/test/pending/pos/t5954/T_1.scala @@ -0,0 +1,8 @@ +package p { + package base { + class X + } + package object base { + case class B() + } +} diff --git a/test/pending/pos/t5954/T_2.scala b/test/pending/pos/t5954/T_2.scala new file mode 100644 index 0000000000..0064c596b6 --- /dev/null +++ b/test/pending/pos/t5954/T_2.scala @@ -0,0 +1,8 @@ +package p { + package base { + class X + } + package object base { + case class B() + } +} diff --git a/test/pending/pos/t5954/T_3.scala b/test/pending/pos/t5954/T_3.scala new file mode 100644 index 0000000000..0064c596b6 --- /dev/null +++ b/test/pending/pos/t5954/T_3.scala @@ -0,0 +1,8 @@ +package p { + package base { + class X + } + package object base { + case class B() + } +} diff --git a/test/pending/pos/t6225.scala b/test/pending/pos/t6225.scala new file mode 100644 index 0000000000..d7dff3c419 --- /dev/null +++ b/test/pending/pos/t6225.scala @@ -0,0 +1,11 @@ +package library.x { + class X { + class Foo + implicit val foo = new Foo + } +} +package library { package object x extends X } +package app { + import library.x._ + object App { implicitly[Foo] } +} diff --git a/test/pending/pos/z1720.scala b/test/pending/pos/z1720.scala deleted file mode 100644 index 6050f3ff88..0000000000 --- a/test/pending/pos/z1720.scala +++ /dev/null @@ -1,16 +0,0 @@ -package test - -class Thing { - def info: Info[this.type] = InfoRepository.getInfo(this) - def info2: Info[this.type] = { - def self: this.type = this - InfoRepository.getInfo(self) - } -} - -trait Info[T] -case class InfoImpl[T](thing: T) extends Info[T] - -object InfoRepository { - def getInfo(t: Thing): Info[t.type] = InfoImpl(t) -}
\ No newline at end of file diff --git a/test/pending/run/hk-lub-fail.scala b/test/pending/run/hk-lub-fail.scala index b58a86ee75..0ac4fdd841 100644 --- a/test/pending/run/hk-lub-fail.scala +++ b/test/pending/run/hk-lub-fail.scala @@ -25,12 +25,12 @@ object Test { // A repl session to get you started. /* - val quux1 = EmptyPackageClass.tpe.member(newTermName("Quux1")) - val quux2 = EmptyPackageClass.tpe.member(newTermName("Quux2")) + val quux1 = EmptyPackageClass.tpe.member(TermName("Quux1")) + val quux2 = EmptyPackageClass.tpe.member(TermName("Quux2")) val tps = List(quux1, quux2) map (_.tpe) - val test = EmptyPackageClass.tpe.member(newTermName("Test")) - val f = test.tpe.member(newTypeName("F")).tpe - + val test = EmptyPackageClass.tpe.member(TermName("Test")) + val f = test.tpe.member(TypeName("F")).tpe + val fn = f.normalize.asInstanceOf[ExistentialType] val fn2 = fn.underlying.asInstanceOf[TypeRef] */ diff --git a/test/pending/run/macro-expand-default/Impls_1.scala b/test/pending/run/macro-expand-default/Impls_1.scala index 7cf8d59c75..bb55f02ab2 100644 --- a/test/pending/run/macro-expand-default/Impls_1.scala +++ b/test/pending/run/macro-expand-default/Impls_1.scala @@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._ - val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) + val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum)) Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala index be00fd0d8a..eed68280cd 100644 --- a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala +++ b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala @@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = { import c.universe._ - val plusOne = Apply(Select(evidence.tree, newTermName("plus")), List(x.tree, Literal(Constant(1)))) - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusOne)) + val plusOne = Apply(Select(evidence.tree, TermName("plus")), List(x.tree, Literal(Constant(1)))) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(plusOne)) Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/pending/run/macro-expand-named/Impls_1.scala b/test/pending/run/macro-expand-named/Impls_1.scala index 7cf8d59c75..bb55f02ab2 100644 --- a/test/pending/run/macro-expand-named/Impls_1.scala +++ b/test/pending/run/macro-expand-named/Impls_1.scala @@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx} object Impls { def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = { import c.universe._ - val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree)) - val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum)) + val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree)) + val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum)) Expr[Unit](body) } }
\ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala index 26de70cc12..487ac79673 100644 --- a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala +++ b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala @@ -4,9 +4,9 @@ object Impls { def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ Block(List( - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(()))) } }
\ No newline at end of file diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala index 26de70cc12..487ac79673 100644 --- a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala +++ b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala @@ -4,9 +4,9 @@ object Impls { def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = { import c.universe._ Block(List( - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))), + Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))), Literal(Constant(()))) } }
\ No newline at end of file diff --git a/test/pending/run/macro-reify-tagless-b/Test_2.scala b/test/pending/run/macro-reify-tagless-b/Test_2.scala index 10487b1515..09ca6ba30e 100644 --- a/test/pending/run/macro-reify-tagless-b/Test_2.scala +++ b/test/pending/run/macro-reify-tagless-b/Test_2.scala @@ -6,8 +6,8 @@ object Test extends App { import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.ToolBox val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass))) - val rhs = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant("hello world")))) - val list = ValDef(NoMods, newTermName("list"), tpt, rhs) - val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name)))) + val rhs = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant("hello world")))) + val list = ValDef(NoMods, TermName("list"), tpt, rhs) + val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Ident(list.name)))) println(cm.mkToolBox().eval(tree)) } diff --git a/test/pending/run/t5427a.scala b/test/pending/run/t5427a.scala index f7cd05158d..a7d20922db 100644 --- a/test/pending/run/t5427a.scala +++ b/test/pending/run/t5427a.scala @@ -4,7 +4,7 @@ object Foo { val bar = 2 } object Test extends App { val tpe = getType(Foo) - val bar = tpe.nonPrivateMember(newTermName("bar")) + val bar = tpe.nonPrivateMember(TermName("bar")) val value = getValue(Foo, bar) println(value) }
\ No newline at end of file diff --git a/test/pending/run/t5427b.scala b/test/pending/run/t5427b.scala index e80bd12369..af1ae6ea2f 100644 --- a/test/pending/run/t5427b.scala +++ b/test/pending/run/t5427b.scala @@ -5,7 +5,7 @@ class Foo { val bar = 2 } object Test extends App { val foo = new Foo val tpe = getType(foo) - val bar = tpe.nonPrivateMember(newTermName("bar")) + val bar = tpe.nonPrivateMember(TermName("bar")) val value = getValue(foo, bar) println(value) }
\ No newline at end of file diff --git a/test/pending/run/t5427c.scala b/test/pending/run/t5427c.scala index 7095158e85..ba71803080 100644 --- a/test/pending/run/t5427c.scala +++ b/test/pending/run/t5427c.scala @@ -5,7 +5,7 @@ class Foo(bar: Int) object Test extends App { val foo = new Foo(2) val tpe = getType(foo) - val bar = tpe.nonPrivateMember(newTermName("bar")) + val bar = tpe.nonPrivateMember(TermName("bar")) bar match { case NoSymbol => println("no public member") case _ => println("i'm screwed") diff --git a/test/pending/run/t5427d.scala b/test/pending/run/t5427d.scala index f0cc07d27e..1d37dbdde3 100644 --- a/test/pending/run/t5427d.scala +++ b/test/pending/run/t5427d.scala @@ -5,7 +5,7 @@ class Foo(val bar: Int) object Test extends App { val foo = new Foo(2) val tpe = getType(foo) - val bar = tpe.nonPrivateMember(newTermName("bar")) + val bar = tpe.nonPrivateMember(TermName("bar")) val value = getValue(foo, bar) println(value) }
\ No newline at end of file diff --git a/test/postreview.py b/test/postreview.py deleted file mode 100644 index 2e2518f7ee..0000000000 --- a/test/postreview.py +++ /dev/null @@ -1,2540 +0,0 @@ -#!/usr/bin/env python -import cookielib -import difflib -import getpass -import marshal -import mimetools -import ntpath -import os -import re -import socket -import stat -import subprocess -import sys -import tempfile -import urllib -import urllib2 -from optparse import OptionParser -from tempfile import mkstemp -from urlparse import urljoin, urlparse - -try: - from hashlib import md5 -except ImportError: - # Support Python versions before 2.5. - from md5 import md5 - -try: - import json -except ImportError: - import simplejson as json - -# This specific import is necessary to handle the paths for -# cygwin enabled machines. -if (sys.platform.startswith('win') - or sys.platform.startswith('cygwin')): - import ntpath as cpath -else: - import posixpath as cpath - -### -# Default configuration -- user-settable variables follow. -### - -# The following settings usually aren't needed, but if your Review -# Board crew has specific preferences and doesn't want to express -# them with command line switches, set them here and you're done. -# In particular, setting the REVIEWBOARD_URL variable will allow -# you to make it easy for people to submit reviews regardless of -# their SCM setup. -# -# Note that in order for this script to work with a reviewboard site -# that uses local paths to access a repository, the 'Mirror path' -# in the repository setup page must be set to the remote URL of the -# repository. - -# -# Reviewboard URL. -# -# Set this if you wish to hard-code a default server to always use. -# It's generally recommended to set this using your SCM repository -# (for those that support it -- currently only SVN, Git, and Perforce). -# -# For example, on SVN: -# $ svn propset reviewboard:url http://reviewboard.example.com . -# -# Or with Git: -# $ git config reviewboard.url http://reviewboard.example.com -# -# On Perforce servers version 2008.1 and above: -# $ p4 counter reviewboard.url http://reviewboard.example.com -# -# Older Perforce servers only allow numerical counters, so embedding -# the url in the counter name is also supported: -# $ p4 counter reviewboard.url.http:\|\|reviewboard.example.com 1 -# -# Note that slashes are not allowed in Perforce counter names, so replace them -# with pipe characters (they are a safe substitute as they are not used -# unencoded in URLs). You may need to escape them when issuing the p4 counter -# command as above. -# -# If this is not possible or desired, setting the value here will let -# you get started quickly. -# -# For all other repositories, a .reviewboardrc file present at the top of -# the checkout will also work. For example: -# -# $ cat .reviewboardrc -# REVIEWBOARD_URL = "http://reviewboard.example.com" -# -REVIEWBOARD_URL = None - -# Default submission arguments. These are all optional; run this -# script with --help for descriptions of each argument. -TARGET_GROUPS = None -TARGET_PEOPLE = None -SUBMIT_AS = None -PUBLISH = False -OPEN_BROWSER = False - -# Debugging. For development... -DEBUG = False - -### -# End user-settable variables. -### - - -VERSION = "0.8" - -user_config = None -tempfiles = [] -options = None - - -class APIError(Exception): - pass - - -class RepositoryInfo: - """ - A representation of a source code repository. - """ - def __init__(self, path=None, base_path=None, supports_changesets=False, - supports_parent_diffs=False): - self.path = path - self.base_path = base_path - self.supports_changesets = supports_changesets - self.supports_parent_diffs = supports_parent_diffs - debug("repository info: %s" % self) - - def __str__(self): - return "Path: %s, Base path: %s, Supports changesets: %s" % \ - (self.path, self.base_path, self.supports_changesets) - - def set_base_path(self, base_path): - if not base_path.startswith('/'): - base_path = '/' + base_path - debug("changing repository info base_path from %s to %s" % \ - (self.base_path, base_path)) - self.base_path = base_path - - def find_server_repository_info(self, server): - """ - Try to find the repository from the list of repositories on the server. - For Subversion, this could be a repository with a different URL. For - all other clients, this is a noop. - """ - return self - - -class SvnRepositoryInfo(RepositoryInfo): - """ - A representation of a SVN source code repository. This version knows how to - find a matching repository on the server even if the URLs differ. - """ - def __init__(self, path, base_path, uuid, supports_parent_diffs=False): - RepositoryInfo.__init__(self, path, base_path, - supports_parent_diffs=supports_parent_diffs) - self.uuid = uuid - - def find_server_repository_info(self, server): - """ - The point of this function is to find a repository on the server that - matches self, even if the paths aren't the same. (For example, if self - uses an 'http' path, but the server uses a 'file' path for the same - repository.) It does this by comparing repository UUIDs. If the - repositories use the same path, you'll get back self, otherwise you'll - get a different SvnRepositoryInfo object (with a different path). - """ - repositories = server.get_repositories() - - for repository in repositories: - if repository['tool'] != 'Subversion': - continue - - info = self._get_repository_info(server, repository) - - if not info or self.uuid != info['uuid']: - continue - - repos_base_path = info['url'][len(info['root_url']):] - relpath = self._get_relative_path(self.base_path, repos_base_path) - if relpath: - return SvnRepositoryInfo(info['url'], relpath, self.uuid) - - # We didn't find a matching repository on the server. We'll just return - # self and hope for the best. - return self - - def _get_repository_info(self, server, repository): - try: - return server.get_repository_info(repository['id']) - except APIError, e: - # If the server couldn't fetch the repository info, it will return - # code 210. Ignore those. - # Other more serious errors should still be raised, though. - rsp = e.args[0] - if rsp['err']['code'] == 210: - return None - - raise e - - def _get_relative_path(self, path, root): - pathdirs = self._split_on_slash(path) - rootdirs = self._split_on_slash(root) - - # root is empty, so anything relative to that is itself - if len(rootdirs) == 0: - return path - - # If one of the directories doesn't match, then path is not relative - # to root. - if rootdirs != pathdirs: - return None - - # All the directories matched, so the relative path is whatever - # directories are left over. The base_path can't be empty, though, so - # if the paths are the same, return '/' - if len(pathdirs) == len(rootdirs): - return '/' - else: - return '/'.join(pathdirs[len(rootdirs):]) - - def _split_on_slash(self, path): - # Split on slashes, but ignore multiple slashes and throw away any - # trailing slashes. - split = re.split('/*', path) - if split[-1] == '': - split = split[0:-1] - return split - - -class ReviewBoardHTTPPasswordMgr(urllib2.HTTPPasswordMgr): - """ - Adds HTTP authentication support for URLs. - - Python 2.4's password manager has a bug in http authentication when the - target server uses a non-standard port. This works around that bug on - Python 2.4 installs. This also allows post-review to prompt for passwords - in a consistent way. - - See: http://bugs.python.org/issue974757 - """ - def __init__(self, reviewboard_url): - self.passwd = {} - self.rb_url = reviewboard_url - self.rb_user = None - self.rb_pass = None - - def find_user_password(self, realm, uri): - if uri.startswith(self.rb_url): - if self.rb_user is None or self.rb_pass is None: - print "==> HTTP Authentication Required" - print 'Enter username and password for "%s" at %s' % \ - (realm, urlparse(uri)[1]) - self.rb_user = raw_input('Username: ') - self.rb_pass = getpass.getpass('Password: ') - - return self.rb_user, self.rb_pass - else: - # If this is an auth request for some other domain (since HTTP - # handlers are global), fall back to standard password management. - return urllib2.HTTPPasswordMgr.find_user_password(self, realm, uri) - - -class ReviewBoardServer(object): - """ - An instance of a Review Board server. - """ - def __init__(self, url, info, cookie_file): - self.url = url - if self.url[-1] != '/': - self.url += '/' - self._info = info - self._server_info = None - self.cookie_file = cookie_file - self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) - - # Set up the HTTP libraries to support all of the features we need. - cookie_handler = urllib2.HTTPCookieProcessor(self.cookie_jar) - password_mgr = ReviewBoardHTTPPasswordMgr(self.url) - auth_handler = urllib2.HTTPBasicAuthHandler(password_mgr) - - opener = urllib2.build_opener(cookie_handler, auth_handler) - opener.addheaders = [('User-agent', 'post-review/' + VERSION)] - urllib2.install_opener(opener) - - def login(self, force=False): - """ - Logs in to a Review Board server, prompting the user for login - information if needed. - """ - if not force and self.has_valid_cookie(): - return - - print "==> Review Board Login Required" - print "Enter username and password for Review Board at %s" % self.url - if options.username: - username = options.username - elif options.submit_as: - username = options.submit_as - else: - username = raw_input('Username: ') - - if not options.password: - password = getpass.getpass('Password: ') - else: - password = options.password - - debug('Logging in with username "%s"' % username) - try: - self.api_post('api/json/accounts/login/', { - 'username': username, - 'password': password, - }) - except APIError, e: - rsp, = e.args - - die("Unable to log in: %s (%s)" % (rsp["err"]["msg"], - rsp["err"]["code"])) - - debug("Logged in.") - - def has_valid_cookie(self): - """ - Load the user's cookie file and see if they have a valid - 'rbsessionid' cookie for the current Review Board server. Returns - true if so and false otherwise. - """ - try: - parsed_url = urlparse(self.url) - host = parsed_url[1] - path = parsed_url[2] or '/' - - # Cookie files don't store port numbers, unfortunately, so - # get rid of the port number if it's present. - host = host.split(":")[0] - - debug("Looking for '%s %s' cookie in %s" % \ - (host, path, self.cookie_file)) - self.cookie_jar.load(self.cookie_file, ignore_expires=True) - - try: - cookie = self.cookie_jar._cookies[host][path]['rbsessionid'] - - if not cookie.is_expired(): - debug("Loaded valid cookie -- no login required") - return True - - debug("Cookie file loaded, but cookie has expired") - except KeyError: - debug("Cookie file loaded, but no cookie for this server") - except IOError, error: - debug("Couldn't load cookie file: %s" % error) - - return False - - def new_review_request(self, changenum, submit_as=None): - """ - Creates a review request on a Review Board server, updating an - existing one if the changeset number already exists. - - If submit_as is provided, the specified user name will be recorded as - the submitter of the review request (given that the logged in user has - the appropriate permissions). - """ - try: - debug("Attempting to create review request for %s" % changenum) - data = { 'repository_path': self.info.path } - - if changenum: - data['changenum'] = changenum - - if submit_as: - debug("Submitting the review request as %s" % submit_as) - data['submit_as'] = submit_as - - rsp = self.api_post('api/json/reviewrequests/new/', data) - except APIError, e: - rsp, = e.args - - if not options.diff_only: - if rsp['err']['code'] == 204: # Change number in use - debug("Review request already exists. Updating it...") - rsp = self.api_post( - 'api/json/reviewrequests/%s/update_from_changenum/' % - rsp['review_request']['id']) - else: - raise e - - debug("Review request created") - return rsp['review_request'] - - def set_review_request_field(self, review_request, field, value): - """ - Sets a field in a review request to the specified value. - """ - rid = review_request['id'] - - debug("Attempting to set field '%s' to '%s' for review request '%s'" % - (field, value, rid)) - - self.api_post('api/json/reviewrequests/%s/draft/set/' % rid, { - field: value, - }) - - def get_review_request(self, rid): - """ - Returns the review request with the specified ID. - """ - rsp = self.api_get('api/json/reviewrequests/%s/' % rid) - return rsp['review_request'] - - def get_repositories(self): - """ - Returns the list of repositories on this server. - """ - rsp = self.api_get('/api/json/repositories/') - return rsp['repositories'] - - def get_repository_info(self, rid): - """ - Returns detailed information about a specific repository. - """ - rsp = self.api_get('/api/json/repositories/%s/info/' % rid) - return rsp['info'] - - def save_draft(self, review_request): - """ - Saves a draft of a review request. - """ - self.api_post("api/json/reviewrequests/%s/draft/save/" % - review_request['id']) - debug("Review request draft saved") - - def upload_diff(self, review_request, diff_content, parent_diff_content): - """ - Uploads a diff to a Review Board server. - """ - debug("Uploading diff, size: %d" % len(diff_content)) - - if parent_diff_content: - debug("Uploading parent diff, size: %d" % len(parent_diff_content)) - - fields = {} - files = {} - - if self.info.base_path: - fields['basedir'] = self.info.base_path - - files['path'] = { - 'filename': 'diff', - 'content': diff_content - } - - if parent_diff_content: - files['parent_diff_path'] = { - 'filename': 'parent_diff', - 'content': parent_diff_content - } - - self.api_post('api/json/reviewrequests/%s/diff/new/' % - review_request['id'], fields, files) - - def publish(self, review_request): - """ - Publishes a review request. - """ - debug("Publishing") - self.api_post('api/json/reviewrequests/%s/publish/' % - review_request['id']) - - def _get_server_info(self): - if not self._server_info: - self._server_info = self._info.find_server_repository_info(self) - - return self._server_info - - info = property(_get_server_info) - - def process_json(self, data): - """ - Loads in a JSON file and returns the data if successful. On failure, - APIError is raised. - """ - rsp = json.loads(data) - - if rsp['stat'] == 'fail': - raise APIError, rsp - - return rsp - - def http_get(self, path): - """ - Performs an HTTP GET on the specified path, storing any cookies that - were set. - """ - debug('HTTP GETting %s' % path) - - url = self._make_url(path) - - try: - rsp = urllib2.urlopen(url).read() - self.cookie_jar.save(self.cookie_file) - return rsp - except urllib2.HTTPError, e: - print "Unable to access %s (%s). The host path may be invalid" % \ - (url, e.code) - try: - debug(e.read()) - except AttributeError: - pass - die() - - def _make_url(self, path): - """Given a path on the server returns a full http:// style url""" - app = urlparse(self.url)[2] - if path[0] == '/': - url = urljoin(self.url, app[:-1] + path) - else: - url = urljoin(self.url, app + path) - - if not url.startswith('http'): - url = 'http://%s' % url - return url - - def api_get(self, path): - """ - Performs an API call using HTTP GET at the specified path. - """ - return self.process_json(self.http_get(path)) - - def http_post(self, path, fields, files=None): - """ - Performs an HTTP POST on the specified path, storing any cookies that - were set. - """ - if fields: - debug_fields = fields.copy() - else: - debug_fields = {} - - if 'password' in debug_fields: - debug_fields["password"] = "**************" - url = self._make_url(path) - debug('HTTP POSTing to %s: %s' % (url, debug_fields)) - - content_type, body = self._encode_multipart_formdata(fields, files) - headers = { - 'Content-Type': content_type, - 'Content-Length': str(len(body)) - } - - try: - r = urllib2.Request(url, body, headers) - data = urllib2.urlopen(r).read() - self.cookie_jar.save(self.cookie_file) - return data - except urllib2.URLError, e: - try: - debug(e.read()) - except AttributeError: - pass - - die("Unable to access %s. The host path may be invalid\n%s" % \ - (url, e)) - except urllib2.HTTPError, e: - die("Unable to access %s (%s). The host path may be invalid\n%s" % \ - (url, e.code, e.read())) - - def api_post(self, path, fields=None, files=None): - """ - Performs an API call using HTTP POST at the specified path. - """ - return self.process_json(self.http_post(path, fields, files)) - - def _encode_multipart_formdata(self, fields, files): - """ - Encodes data for use in an HTTP POST. - """ - BOUNDARY = mimetools.choose_boundary() - content = "" - - fields = fields or {} - files = files or {} - - for key in fields: - content += "--" + BOUNDARY + "\r\n" - content += "Content-Disposition: form-data; name=\"%s\"\r\n" % key - content += "\r\n" - content += fields[key] + "\r\n" - - for key in files: - filename = files[key]['filename'] - value = files[key]['content'] - content += "--" + BOUNDARY + "\r\n" - content += "Content-Disposition: form-data; name=\"%s\"; " % key - content += "filename=\"%s\"\r\n" % filename - content += "\r\n" - content += value + "\r\n" - - content += "--" + BOUNDARY + "--\r\n" - content += "\r\n" - - content_type = "multipart/form-data; boundary=%s" % BOUNDARY - - return content_type, content - - -class SCMClient(object): - """ - A base representation of an SCM tool for fetching repository information - and generating diffs. - """ - def get_repository_info(self): - return None - - def scan_for_server(self, repository_info): - """ - Scans the current directory on up to find a .reviewboard file - containing the server path. - """ - server_url = self._get_server_from_config(user_config, repository_info) - if server_url: - return server_url - - for path in walk_parents(os.getcwd()): - filename = os.path.join(path, ".reviewboardrc") - if os.path.exists(filename): - config = load_config_file(filename) - server_url = self._get_server_from_config(config, - repository_info) - if server_url: - return server_url - - return None - - def diff(self, args): - """ - Returns the generated diff and optional parent diff for this - repository. - - The returned tuple is (diff_string, parent_diff_string) - """ - return (None, None) - - def diff_between_revisions(self, revision_range, args, repository_info): - """ - Returns the generated diff between revisions in the repository. - """ - return None - - def _get_server_from_config(self, config, repository_info): - if 'REVIEWBOARD_URL' in config: - return config['REVIEWBOARD_URL'] - elif 'TREES' in config: - trees = config['TREES'] - if not isinstance(trees, dict): - die("Warning: 'TREES' in config file is not a dict!") - - if repository_info.path in trees and \ - 'REVIEWBOARD_URL' in trees[repository_info.path]: - return trees[repository_info.path]['REVIEWBOARD_URL'] - - return None - - -class CVSClient(SCMClient): - """ - A wrapper around the cvs tool that fetches repository - information and generates compatible diffs. - """ - def get_repository_info(self): - if not check_install("cvs"): - return None - - cvsroot_path = os.path.join("CVS", "Root") - - if not os.path.exists(cvsroot_path): - return None - - fp = open(cvsroot_path, "r") - repository_path = fp.read().strip() - fp.close() - - i = repository_path.find("@") - if i != -1: - repository_path = repository_path[i + 1:] - - i = repository_path.find(":") - if i != -1: - host = repository_path[:i] - try: - canon = socket.getfqdn(host) - repository_path = repository_path.replace('%s:' % host, - '%s:' % canon) - except socket.error, msg: - debug("failed to get fqdn for %s, msg=%s" % (host, msg)) - - return RepositoryInfo(path=repository_path) - - def diff(self, files): - """ - Performs a diff across all modified files in a CVS repository. - - CVS repositories do not support branches of branches in a way that - makes parent diffs possible, so we never return a parent diff - (the second value in the tuple). - """ - return (self.do_diff(files), None) - - def diff_between_revisions(self, revision_range, args, repository_info): - """ - Performs a diff between 2 revisions of a CVS repository. - """ - revs = [] - - for rev in revision_range.split(":"): - revs += ["-r", rev] - - return self.do_diff(revs) - - def do_diff(self, params): - """ - Performs the actual diff operation through cvs diff, handling - fake errors generated by CVS. - """ - # Diff returns "1" if differences were found. - return execute(["cvs", "diff", "-uN"] + params, - extra_ignore_errors=(1,)) - - -class ClearCaseClient(SCMClient): - """ - A wrapper around the clearcase tool that fetches repository - information and generates compatible diffs. - This client assumes that cygwin is installed on windows. - """ - ccroot_path = "/view/reviewboard.diffview/vobs/" - viewinfo = "" - viewtype = "snapshot" - - def get_filename_hash(self, fname): - # Hash the filename string so its easy to find the file later on. - return md5(fname).hexdigest() - - def get_repository_info(self): - if not check_install('cleartool help'): - return None - - # We must be running this from inside a view. - # Otherwise it doesn't make sense. - self.viewinfo = execute(["cleartool", "pwv", "-short"]) - if self.viewinfo.startswith('\*\* NONE'): - return None - - # Returning the hardcoded clearcase root path to match the server - # respository path. - # There is no reason to have a dynamic path unless you have - # multiple clearcase repositories. This should be implemented. - return RepositoryInfo(path=self.ccroot_path, - base_path=self.ccroot_path, - supports_parent_diffs=False) - - def get_previous_version(self, files): - file = [] - curdir = os.getcwd() - - # Cygwin case must transform a linux-like path to windows like path - # including drive letter. - if 'cygdrive' in curdir: - where = curdir.index('cygdrive') + 9 - drive_letter = curdir[where:where+1] - curdir = drive_letter + ":\\" + curdir[where+2:len(curdir)] - - for key in files: - # Sometimes there is a quote in the filename. It must be removed. - key = key.replace('\'', '') - elem_path = cpath.normpath(os.path.join(curdir, key)) - - # Removing anything before the last /vobs - # because it may be repeated. - elem_path_idx = elem_path.rfind("/vobs") - if elem_path_idx != -1: - elem_path = elem_path[elem_path_idx:len(elem_path)].strip("\"") - - # Call cleartool to get this version and the previous version - # of the element. - curr_version, pre_version = execute( - ["cleartool", "desc", "-pre", elem_path]) - curr_version = cpath.normpath(curr_version) - pre_version = pre_version.split(':')[1].strip() - - # If a specific version was given, remove it from the path - # to avoid version duplication - if "@@" in elem_path: - elem_path = elem_path[:elem_path.rfind("@@")] - file.append(elem_path + "@@" + pre_version) - file.append(curr_version) - - # Determnine if the view type is snapshot or dynamic. - if os.path.exists(file[0]): - self.viewtype = "dynamic" - - return file - - def get_extended_namespace(self, files): - """ - Parses the file path to get the extended namespace - """ - versions = self.get_previous_version(files) - - evfiles = [] - hlist = [] - - for vkey in versions: - # Verify if it is a checkedout file. - if "CHECKEDOUT" in vkey: - # For checkedout files just add it to the file list - # since it cannot be accessed outside the view. - splversions = vkey[:vkey.rfind("@@")] - evfiles.append(splversions) - else: - # For checkedin files. - ext_path = [] - ver = [] - fname = "" # fname holds the file name without the version. - (bpath, fpath) = cpath.splitdrive(vkey) - if bpath : - # Windows. - # The version (if specified like file.c@@/main/1) - # should be kept as a single string - # so split the path and concat the file name - # and version in the last position of the list. - ver = fpath.split("@@") - splversions = fpath[:vkey.rfind("@@")].split("\\") - fname = splversions.pop() - splversions.append(fname + ver[1]) - else : - # Linux. - bpath = vkey[:vkey.rfind("vobs")+4] - fpath = vkey[vkey.rfind("vobs")+5:] - ver = fpath.split("@@") - splversions = ver[0][:vkey.rfind("@@")].split("/") - fname = splversions.pop() - splversions.append(fname + ver[1]) - - filename = splversions.pop() - bpath = cpath.normpath(bpath + "/") - elem_path = bpath - - for key in splversions: - # For each element (directory) in the path, - # get its version from clearcase. - elem_path = cpath.join(elem_path, key) - - # This is the version to be appended to the extended - # path list. - this_version = execute( - ["cleartool", "desc", "-fmt", "%Vn", - cpath.normpath(elem_path)]) - if this_version: - ext_path.append(key + "/@@" + this_version + "/") - else: - ext_path.append(key + "/") - - # This must be done in case we haven't specified - # the version on the command line. - ext_path.append(cpath.normpath(fname + "/@@" + - vkey[vkey.rfind("@@")+2:len(vkey)])) - epstr = cpath.join(bpath, cpath.normpath(''.join(ext_path))) - evfiles.append(epstr) - - """ - In windows, there is a problem with long names(> 254). - In this case, we hash the string and copy the unextended - filename to a temp file whose name is the hash. - This way we can get the file later on for diff. - The same problem applies to snapshot views where the - extended name isn't available. - The previous file must be copied from the CC server - to a local dir. - """ - if cpath.exists(epstr) : - pass - else: - if len(epstr) > 254 or self.viewtype == "snapshot": - name = self.get_filename_hash(epstr) - # Check if this hash is already in the list - try: - i = hlist.index(name) - die("ERROR: duplicate value %s : %s" % - (name, epstr)) - except ValueError: - hlist.append(name) - - normkey = cpath.normpath(vkey) - td = tempfile.gettempdir() - # Cygwin case must transform a linux-like path to - # windows like path including drive letter - if 'cygdrive' in td: - where = td.index('cygdrive') + 9 - drive_letter = td[where:where+1] + ":" - td = cpath.join(drive_letter, td[where+1:]) - tf = cpath.normpath(cpath.join(td, name)) - if cpath.exists(tf): - debug("WARNING: FILE EXISTS") - os.unlink(tf) - execute(["cleartool", "get", "-to", tf, normkey]) - else: - die("ERROR: FILE NOT FOUND : %s" % epstr) - - return evfiles - - def get_files_from_label(self, label): - voblist=[] - # Get the list of vobs for the current view - allvoblist = execute(["cleartool", "lsvob", "-short"]).split() - # For each vob, find if the label is present - for vob in allvoblist: - try: - execute(["cleartool", "describe", "-local", - "lbtype:%s@%s" % (label, vob)]).split() - voblist.append(vob) - except: - pass - - filelist=[] - # For each vob containing the label, get the file list - for vob in voblist: - try: - res = execute(["cleartool", "find", vob, "-all", "-version", - "lbtype(%s)" % label, "-print"]) - filelist.extend(res.split()) - except : - pass - - # Return only the unique itens - return set(filelist) - - def diff(self, files): - """ - Performs a diff of the specified file and its previous version. - """ - # We must be running this from inside a view. - # Otherwise it doesn't make sense. - return self.do_diff(self.get_extended_namespace(files)) - - def diff_label(self, label): - """ - Get the files that are attached to a label and diff them - TODO - """ - return self.diff(self.get_files_from_label(label)) - - def diff_between_revisions(self, revision_range, args, repository_info): - """ - Performs a diff between 2 revisions of a CC repository. - """ - rev_str = '' - - for rev in revision_range.split(":"): - rev_str += "-r %s " % rev - - return self.do_diff(rev_str) - - def do_diff(self, params): - # Diff returns "1" if differences were found. - # Add the view name and view type to the description - if options.description: - options.description = ("VIEW: " + self.viewinfo + - "VIEWTYPE: " + self.viewtype + "\n" + options.description) - else: - options.description = (self.viewinfo + - "VIEWTYPE: " + self.viewtype + "\n") - - o = [] - Feol = False - while len(params) > 0: - # Read both original and modified files. - onam = params.pop(0) - mnam = params.pop(0) - file_data = [] - do_rem = False - # If the filename length is greater than 254 char for windows, - # we copied the file to a temp file - # because the open will not work for path greater than 254. - # This is valid for the original and - # modified files if the name size is > 254. - for filenam in (onam, mnam) : - if cpath.exists(filenam) and self.viewtype == "dynamic": - do_rem = False - fn = filenam - elif len(filenam) > 254 or self.viewtype == "snapshot": - fn = self.get_filename_hash(filenam) - fn = cpath.join(tempfile.gettempdir(), fn) - do_rem = True - fd = open(cpath.normpath(fn)) - fdata = fd.readlines() - fd.close() - file_data.append(fdata) - # If the file was temp, it should be removed. - if do_rem: - os.remove(filenam) - - modi = file_data.pop() - orig = file_data.pop() - - # For snapshot views, the local directories must be removed because - # they will break the diff on the server. Just replacing - # everything before the view name (including the view name) for - # vobs do the work. - if (self.viewtype == "snapshot" - and (sys.platform.startswith('win') - or sys.platform.startswith('cygwin'))): - vinfo = self.viewinfo.rstrip("\r\n") - mnam = "c:\\\\vobs" + mnam[mnam.rfind(vinfo) + len(vinfo):] - onam = "c:\\\\vobs" + onam[onam.rfind(vinfo) + len(vinfo):] - # Call the diff lib to generate a diff. - # The dates are bogus, since they don't natter anyway. - # The only thing is that two spaces are needed to the server - # so it can identify the heades correctly. - diff = difflib.unified_diff(orig, modi, onam, mnam, - ' 2002-02-21 23:30:39.942229878 -0800', - ' 2002-02-21 23:30:50.442260588 -0800', lineterm=' \n') - # Transform the generator output into a string output - # Use a comprehension instead of a generator, - # so 2.3.x doesn't fail to interpret. - diffstr = ''.join([str(l) for l in diff]) - # Workaround for the difflib no new line at end of file - # problem. - if not diffstr.endswith('\n'): - diffstr = diffstr + ("\n\\ No newline at end of file\n") - o.append(diffstr) - - ostr = ''.join(o) - return (ostr, None) # diff, parent_diff (not supported) - - -class SVNClient(SCMClient): - """ - A wrapper around the svn Subversion tool that fetches repository - information and generates compatible diffs. - """ - def get_repository_info(self): - if not check_install('svn help'): - return None - - # Get the SVN repository path (either via a working copy or - # a supplied URI) - svn_info_params = ["svn", "info"] - if options.repository_url: - svn_info_params.append(options.repository_url) - data = execute(svn_info_params, - ignore_errors=True) - m = re.search(r'^Repository Root: (.+)$', data, re.M) - if not m: - return None - - path = m.group(1) - - m = re.search(r'^URL: (.+)$', data, re.M) - if not m: - return None - - base_path = m.group(1)[len(path):] or "/" - - m = re.search(r'^Repository UUID: (.+)$', data, re.M) - if not m: - return None - - return SvnRepositoryInfo(path, base_path, m.group(1)) - - def scan_for_server(self, repository_info): - # Scan first for dot files, since it's faster and will cover the - # user's $HOME/.reviewboardrc - server_url = super(SVNClient, self).scan_for_server(repository_info) - if server_url: - return server_url - - return self.scan_for_server_property(repository_info) - - def scan_for_server_property(self, repository_info): - def get_url_prop(path): - url = execute(["svn", "propget", "reviewboard:url", path]).strip() - return url or None - - for path in walk_parents(os.getcwd()): - if not os.path.exists(os.path.join(path, ".svn")): - break - - prop = get_url_prop(path) - if prop: - return prop - - return get_url_prop(repository_info.path) - - def diff(self, files): - """ - Performs a diff across all modified files in a Subversion repository. - - SVN repositories do not support branches of branches in a way that - makes parent diffs possible, so we never return a parent diff - (the second value in the tuple). - """ - return (self.do_diff(["svn", "diff", "--diff-cmd=diff"] + files), - None) - - def diff_between_revisions(self, revision_range, args, repository_info): - """ - Performs a diff between 2 revisions of a Subversion repository. - """ - if options.repository_url: - revisions = revision_range.split(':') - if len(revisions) < 1: - return None - elif len(revisions) == 1: - revisions.append('HEAD') - - # if a new path was supplied at the command line, set it - if len(args): - repository_info.set_base_path(args[0]) - - url = repository_info.path + repository_info.base_path - - old_url = url + '@' + revisions[0] - new_url = url + '@' + revisions[1] - - return self.do_diff(["svn", "diff", "--diff-cmd=diff", old_url, - new_url], - repository_info) - # Otherwise, perform the revision range diff using a working copy - else: - return self.do_diff(["svn", "diff", "--diff-cmd=diff", "-r", - revision_range], - repository_info) - - def do_diff(self, cmd, repository_info=None): - """ - Performs the actual diff operation, handling renames and converting - paths to absolute. - """ - diff = execute(cmd, split_lines=True) - diff = self.handle_renames(diff) - diff = self.convert_to_absolute_paths(diff, repository_info) - - return ''.join(diff) - - def handle_renames(self, diff_content): - """ - The output of svn diff is incorrect when the file in question came - into being via svn mv/cp. Although the patch for these files are - relative to its parent, the diff header doesn't reflect this. - This function fixes the relevant section headers of the patch to - portray this relationship. - """ - - # svn diff against a repository URL on two revisions appears to - # handle moved files properly, so only adjust the diff file names - # if they were created using a working copy. - if options.repository_url: - return diff_content - - result = [] - - from_line = "" - for line in diff_content: - if line.startswith('--- '): - from_line = line - continue - - # This is where we decide how mangle the previous '--- ' - if line.startswith('+++ '): - to_file, _ = self.parse_filename_header(line[4:]) - info = self.svn_info(to_file) - if info.has_key("Copied From URL"): - url = info["Copied From URL"] - root = info["Repository Root"] - from_file = urllib.unquote(url[len(root):]) - result.append(from_line.replace(to_file, from_file)) - else: - result.append(from_line) #as is, no copy performed - - # We only mangle '---' lines. All others get added straight to - # the output. - result.append(line) - - return result - - - def convert_to_absolute_paths(self, diff_content, repository_info): - """ - Converts relative paths in a diff output to absolute paths. - This handles paths that have been svn switched to other parts of the - repository. - """ - - result = [] - - for line in diff_content: - front = None - if line.startswith('+++ ') or line.startswith('--- ') or line.startswith('Index: '): - front, line = line.split(" ", 1) - - if front: - if line.startswith('/'): #already absolute - line = front + " " + line - else: - # filename and rest of line (usually the revision - # component) - file, rest = self.parse_filename_header(line) - - # If working with a diff generated outside of a working - # copy, then file paths are already absolute, so just - # add initial slash. - if options.repository_url: - path = urllib.unquote( - "%s/%s" % (repository_info.base_path, file)) - else: - info = self.svn_info(file) - url = info["URL"] - root = info["Repository Root"] - path = urllib.unquote(url[len(root):]) - - line = front + " " + path + rest - - result.append(line) - - return result - - def svn_info(self, path): - """Return a dict which is the result of 'svn info' at a given path.""" - svninfo = {} - for info in execute(["svn", "info", path], - split_lines=True): - parts = info.strip().split(": ", 1) - if len(parts) == 2: - key, value = parts - svninfo[key] = value - - return svninfo - - # Adapted from server code parser.py - def parse_filename_header(self, s): - parts = None - if "\t" in s: - # There's a \t separating the filename and info. This is the - # best case scenario, since it allows for filenames with spaces - # without much work. - parts = s.split("\t") - - # There's spaces being used to separate the filename and info. - # This is technically wrong, so all we can do is assume that - # 1) the filename won't have multiple consecutive spaces, and - # 2) there's at least 2 spaces separating the filename and info. - if " " in s: - parts = re.split(r" +", s) - - if parts: - parts[1] = '\t' + parts[1] - return parts - - # strip off ending newline, and return it as the second component - return [s.split('\n')[0], '\n'] - - -class PerforceClient(SCMClient): - """ - A wrapper around the p4 Perforce tool that fetches repository information - and generates compatible diffs. - """ - def get_repository_info(self): - if not check_install('p4 help'): - return None - - data = execute(["p4", "info"], ignore_errors=True) - - m = re.search(r'^Server address: (.+)$', data, re.M) - if not m: - return None - - repository_path = m.group(1).strip() - - try: - hostname, port = repository_path.split(":") - info = socket.gethostbyaddr(hostname) - repository_path = "%s:%s" % (info[0], port) - except (socket.gaierror, socket.herror): - pass - - return RepositoryInfo(path=repository_path, supports_changesets=True) - - def scan_for_server(self, repository_info): - # Scan first for dot files, since it's faster and will cover the - # user's $HOME/.reviewboardrc - server_url = \ - super(PerforceClient, self).scan_for_server(repository_info) - - if server_url: - return server_url - - return self.scan_for_server_counter(repository_info) - - def scan_for_server_counter(self, repository_info): - """ - Checks the Perforce counters to see if the Review Board server's url - is specified. Since Perforce only started supporting non-numeric - counter values in server version 2008.1, we support both a normal - counter 'reviewboard.url' with a string value and embedding the url in - a counter name like 'reviewboard.url.http:||reviewboard.example.com'. - Note that forward slashes aren't allowed in counter names, so - pipe ('|') characters should be used. These should be safe because they - should not be used unencoded in urls. - """ - - counters_text = execute(["p4", "counters"]) - - # Try for a "reviewboard.url" counter first. - m = re.search(r'^reviewboard.url = (\S+)', counters_text, re.M) - - if m: - return m.group(1) - - # Next try for a counter of the form: - # reviewboard_url.http:||reviewboard.example.com - m2 = re.search(r'^reviewboard.url\.(\S+)', counters_text, re.M) - - if m2: - return m2.group(1).replace('|', '/') - - return None - - def get_changenum(self, args): - if len(args) == 1: - try: - return str(int(args[0])) - except ValueError: - pass - return None - - def diff(self, args): - """ - Goes through the hard work of generating a diff on Perforce in order - to take into account adds/deletes and to provide the necessary - revision information. - """ - # set the P4 enviroment: - if options.p4_client: - os.environ['P4CLIENT'] = options.p4_client - - if options.p4_port: - os.environ['P4PORT'] = options.p4_port - - changenum = self.get_changenum(args) - if changenum is None: - return self._path_diff(args) - else: - return self._changenum_diff(changenum) - - - def _path_diff(self, args): - """ - Process a path-style diff. See _changenum_diff for the alternate - version that handles specific change numbers. - - Multiple paths may be specified in `args`. The path styles supported - are: - - //path/to/file - Upload file as a "new" file. - - //path/to/dir/... - Upload all files as "new" files. - - //path/to/file[@#]rev - Upload file from that rev as a "new" file. - - //path/to/file[@#]rev,[@#]rev - Upload a diff between revs. - - //path/to/dir/...[@#]rev,[@#]rev - Upload a diff of all files between revs in that directory. - """ - r_revision_range = re.compile(r'^(?P<path>//[^@#]+)' + - r'(?P<revision1>[#@][^,]+)?' + - r'(?P<revision2>,[#@][^,]+)?$') - - empty_filename = make_tempfile() - tmp_diff_from_filename = make_tempfile() - tmp_diff_to_filename = make_tempfile() - - diff_lines = [] - - for path in args: - m = r_revision_range.match(path) - - if not m: - die('Path %r does not match a valid Perforce path.' % (path,)) - revision1 = m.group('revision1') - revision2 = m.group('revision2') - first_rev_path = m.group('path') - - if revision1: - first_rev_path += revision1 - records = self._run_p4(['files', first_rev_path]) - - # Make a map for convenience. - files = {} - - # Records are: - # 'rev': '1' - # 'func': '...' - # 'time': '1214418871' - # 'action': 'edit' - # 'type': 'ktext' - # 'depotFile': '...' - # 'change': '123456' - for record in records: - if record['action'] != 'delete': - if revision2: - files[record['depotFile']] = [record, None] - else: - files[record['depotFile']] = [None, record] - - if revision2: - # [1:] to skip the comma. - second_rev_path = m.group('path') + revision2[1:] - records = self._run_p4(['files', second_rev_path]) - for record in records: - if record['action'] != 'delete': - try: - m = files[record['depotFile']] - m[1] = record - except KeyError: - files[record['depotFile']] = [None, record] - - old_file = new_file = empty_filename - changetype_short = None - - for depot_path, (first_record, second_record) in files.items(): - old_file = new_file = empty_filename - if first_record is None: - self._write_file(depot_path + '#' + second_record['rev'], - tmp_diff_to_filename) - new_file = tmp_diff_to_filename - changetype_short = 'A' - base_revision = 0 - elif second_record is None: - self._write_file(depot_path + '#' + first_record['rev'], - tmp_diff_from_filename) - old_file = tmp_diff_from_filename - changetype_short = 'D' - base_revision = int(first_record['rev']) - else: - self._write_file(depot_path + '#' + first_record['rev'], - tmp_diff_from_filename) - self._write_file(depot_path + '#' + second_record['rev'], - tmp_diff_to_filename) - new_file = tmp_diff_to_filename - old_file = tmp_diff_from_filename - changetype_short = 'M' - base_revision = int(first_record['rev']) - - dl = self._do_diff(old_file, new_file, depot_path, - base_revision, changetype_short, - ignore_unmodified=True) - diff_lines += dl - - os.unlink(empty_filename) - os.unlink(tmp_diff_from_filename) - os.unlink(tmp_diff_to_filename) - return (''.join(diff_lines), None) - - def _run_p4(self, command): - """Execute a perforce command using the python marshal API. - - - command: A list of strings of the command to execute. - - The return type depends on the command being run. - """ - command = ['p4', '-G'] + command - p = subprocess.Popen(command, stdout=subprocess.PIPE) - result = [] - has_error = False - - while 1: - try: - data = marshal.load(p.stdout) - except EOFError: - break - else: - result.append(data) - if data.get('code', None) == 'error': - has_error = True - - rc = p.wait() - - if rc or has_error: - for record in result: - if 'data' in record: - print record['data'] - die('Failed to execute command: %s\n' % (command,)) - - return result - - def _changenum_diff(self, changenum): - """ - Process a diff for a particular change number. This handles both - pending and submitted changelists. - - See _path_diff for the alternate version that does diffs of depot - paths. - """ - # TODO: It might be a good idea to enhance PerforceDiffParser to - # understand that newFile could include a revision tag for post-submit - # reviewing. - cl_is_pending = False - - debug("Generating diff for changenum %s" % changenum) - - description = execute(["p4", "describe", "-s", changenum], - split_lines=True) - - if '*pending*' in description[0]: - cl_is_pending = True - - # Get the file list - for line_num, line in enumerate(description): - if 'Affected files ...' in line: - break - else: - # Got to the end of all the description lines and didn't find - # what we were looking for. - die("Couldn't find any affected files for this change.") - - description = description[line_num+2:] - - diff_lines = [] - - empty_filename = make_tempfile() - tmp_diff_from_filename = make_tempfile() - tmp_diff_to_filename = make_tempfile() - - for line in description: - line = line.strip() - if not line: - continue - - m = re.search(r'\.\.\. ([^#]+)#(\d+) (add|edit|delete|integrate|branch)', line) - if not m: - die("Unsupported line from p4 opened: %s" % line) - - depot_path = m.group(1) - base_revision = int(m.group(2)) - if not cl_is_pending: - # If the changelist is pending our base revision is the one that's - # currently in the depot. If we're not pending the base revision is - # actually the revision prior to this one - base_revision -= 1 - - changetype = m.group(3) - - debug('Processing %s of %s' % (changetype, depot_path)) - - old_file = new_file = empty_filename - old_depot_path = new_depot_path = None - changetype_short = None - - if changetype == 'edit' or changetype == 'integrate': - # A big assumption - new_revision = base_revision + 1 - - # We have an old file, get p4 to take this old version from the - # depot and put it into a plain old temp file for us - old_depot_path = "%s#%s" % (depot_path, base_revision) - self._write_file(old_depot_path, tmp_diff_from_filename) - old_file = tmp_diff_from_filename - - # Also print out the new file into a tmpfile - if cl_is_pending: - new_file = self._depot_to_local(depot_path) - else: - new_depot_path = "%s#%s" %(depot_path, new_revision) - self._write_file(new_depot_path, tmp_diff_to_filename) - new_file = tmp_diff_to_filename - - changetype_short = "M" - - elif changetype == 'add' or changetype == 'branch': - # We have a new file, get p4 to put this new file into a pretty - # temp file for us. No old file to worry about here. - if cl_is_pending: - new_file = self._depot_to_local(depot_path) - else: - self._write_file(depot_path, tmp_diff_to_filename) - new_file = tmp_diff_to_filename - changetype_short = "A" - - elif changetype == 'delete': - # We've deleted a file, get p4 to put the deleted file into a temp - # file for us. The new file remains the empty file. - old_depot_path = "%s#%s" % (depot_path, base_revision) - self._write_file(old_depot_path, tmp_diff_from_filename) - old_file = tmp_diff_from_filename - changetype_short = "D" - else: - die("Unknown change type '%s' for %s" % (changetype, depot_path)) - - dl = self._do_diff(old_file, new_file, depot_path, base_revision, changetype_short) - diff_lines += dl - - os.unlink(empty_filename) - os.unlink(tmp_diff_from_filename) - os.unlink(tmp_diff_to_filename) - return (''.join(diff_lines), None) - - def _do_diff(self, old_file, new_file, depot_path, base_revision, - changetype_short, ignore_unmodified=False): - """ - Do the work of producing a diff for Perforce. - - old_file - The absolute path to the "old" file. - new_file - The absolute path to the "new" file. - depot_path - The depot path in Perforce for this file. - base_revision - The base perforce revision number of the old file as - an integer. - changetype_short - The change type as a single character string. - ignore_unmodified - If True, will return an empty list if the file - is not changed. - - Returns a list of strings of diff lines. - """ - if hasattr(os, 'uname') and os.uname()[0] == 'SunOS': - diff_cmd = ["gdiff", "-urNp", old_file, new_file] - else: - diff_cmd = ["diff", "-urNp", old_file, new_file] - # Diff returns "1" if differences were found. - dl = execute(diff_cmd, extra_ignore_errors=(1,2), - translate_newlines=False) - - # If the input file has ^M characters at end of line, lets ignore them. - dl = dl.replace('\r\r\n', '\r\n') - dl = dl.splitlines(True) - - cwd = os.getcwd() - if depot_path.startswith(cwd): - local_path = depot_path[len(cwd) + 1:] - else: - local_path = depot_path - - # Special handling for the output of the diff tool on binary files: - # diff outputs "Files a and b differ" - # and the code below expects the output to start with - # "Binary files " - if len(dl) == 1 and \ - dl[0] == ('Files %s and %s differ'% (old_file, new_file)): - dl = ['Binary files %s and %s differ'% (old_file, new_file)] - - if dl == [] or dl[0].startswith("Binary files "): - if dl == []: - if ignore_unmodified: - return [] - else: - print "Warning: %s in your changeset is unmodified" % \ - local_path - - dl.insert(0, "==== %s#%s ==%s== %s ====\n" % \ - (depot_path, base_revision, changetype_short, local_path)) - dl.append('\n') - else: - m = re.search(r'(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)', dl[1]) - if m: - timestamp = m.group(1) - else: - # Thu Sep 3 11:24:48 2007 - m = re.search(r'(\w+)\s+(\w+)\s+(\d+)\s+(\d\d:\d\d:\d\d)\s+(\d\d\d\d)', dl[1]) - if not m: - die("Unable to parse diff header: %s" % dl[1]) - - month_map = { - "Jan": "01", - "Feb": "02", - "Mar": "03", - "Apr": "04", - "May": "05", - "Jun": "06", - "Jul": "07", - "Aug": "08", - "Sep": "09", - "Oct": "10", - "Nov": "11", - "Dec": "12", - } - month = month_map[m.group(2)] - day = m.group(3) - timestamp = m.group(4) - year = m.group(5) - - timestamp = "%s-%s-%s %s" % (year, month, day, timestamp) - - dl[0] = "--- %s\t%s#%s\n" % (local_path, depot_path, base_revision) - dl[1] = "+++ %s\t%s\n" % (local_path, timestamp) - - return dl - - def _write_file(self, depot_path, tmpfile): - """ - Grabs a file from Perforce and writes it to a temp file. p4 print sets - the file readonly and that causes a later call to unlink fail. So we - make the file read/write. - """ - debug('Writing "%s" to "%s"' % (depot_path, tmpfile)) - execute(["p4", "print", "-o", tmpfile, "-q", depot_path]) - os.chmod(tmpfile, stat.S_IREAD | stat.S_IWRITE) - - def _depot_to_local(self, depot_path): - """ - Given a path in the depot return the path on the local filesystem to - the same file. If there are multiple results, take only the last - result from the where command. - """ - where_output = self._run_p4(['where', depot_path]) - return where_output[-1]['path'] - - -class MercurialClient(SCMClient): - """ - A wrapper around the hg Mercurial tool that fetches repository - information and generates compatible diffs. - """ - def get_repository_info(self): - if not check_install('hg --help'): - return None - - data = execute(["hg", "root"], ignore_errors=True) - if data.startswith('abort:'): - # hg aborted => no mercurial repository here. - return None - - # Elsewhere, hg root output give us the repository path. - - # We save data here to use it as a fallback. See below - local_data = data.strip() - - svn = execute(["hg", "svn", "info", ], ignore_errors=True) - - if (not svn.startswith('abort:') and - not svn.startswith("hg: unknown command")): - self.type = 'svn' - m = re.search(r'^Repository Root: (.+)$', svn, re.M) - - if not m: - return None - - path = m.group(1) - m2 = re.match(r'^(svn\+ssh|http|https)://([-a-zA-Z0-9.]*@)(.*)$', - path) - if m2: - path = '%s://%s' % (m2.group(1), m2.group(3)) - - m = re.search(r'^URL: (.+)$', svn, re.M) - - if not m: - return None - - base_path = m.group(1)[len(path):] or "/" - return RepositoryInfo(path=path, - base_path=base_path, - supports_parent_diffs=True) - - self.type = 'hg' - - # We are going to search .hg/hgrc for the default path. - file_name = os.path.join(local_data,'.hg', 'hgrc') - - if not os.path.exists(file_name): - return RepositoryInfo(path=local_data, base_path='/', - supports_parent_diffs=True) - - f = open(file_name) - data = f.read() - f.close() - - m = re.search(r'^default\s+=\s+(.+)$', data, re.M) - - if not m: - # Return the local path, if no default value is found. - return RepositoryInfo(path=local_data, base_path='/', - supports_parent_diffs=True) - - path = m.group(1).strip() - - return RepositoryInfo(path=path, base_path='', - supports_parent_diffs=True) - - def diff(self, files): - """ - Performs a diff across all modified files in a Mercurial repository. - """ - # We don't support parent diffs with Mercurial yet, so we always - # return None for the parent diff. - if self.type == 'svn': - parent = execute(['hg', 'parent', '--svn', '--template', - '{node}\n']).strip() - - if options.parent_branch: - parent = options.parent_branch - - if options.guess_summary and not options.summary: - options.summary = execute(['hg', 'log', '-r.', '--template', - r'{desc|firstline}\n']) - - if options.guess_description and not options.description: - numrevs = len(execute(['hg', 'log', '-r.:%s' % parent, - '--follow', '--template', - r'{rev}\n']).strip().split('\n')) - options.description = execute(['hg', 'log', '-r.:%s' % parent, - '--follow', '--template', - r'{desc}\n\n', '--limit', - str(numrevs-1)]).strip() - - return (execute(["hg", "diff", "--svn", '-r%s:.' % parent]), None) - - return (execute(["hg", "diff"] + files), None) - - def diff_between_revisions(self, revision_range, args, repository_info): - """ - Performs a diff between 2 revisions of a Mercurial repository. - """ - if self.type != 'hg': - raise NotImplementedError - - r1, r2 = revision_range.split(':') - return execute(["hg", "diff", "-r", r1, "-r", r2]) - - -class GitClient(SCMClient): - """ - A wrapper around git that fetches repository information and generates - compatible diffs. This will attempt to generate a diff suitable for the - remote repository, whether git, SVN or Perforce. - """ - def get_repository_info(self): - if not check_install('git --help'): - return None - - git_dir = execute(["git", "rev-parse", "--git-dir"], - ignore_errors=True).strip() - - if git_dir.startswith("fatal:") or not os.path.isdir(git_dir): - return None - - # post-review in directories other than the top level of - # of a work-tree would result in broken diffs on the server - os.chdir(os.path.dirname(os.path.abspath(git_dir))) - - # We know we have something we can work with. Let's find out - # what it is. We'll try SVN first. - data = execute(["git", "svn", "info"], ignore_errors=True) - - m = re.search(r'^Repository Root: (.+)$', data, re.M) - if m: - path = m.group(1) - m = re.search(r'^URL: (.+)$', data, re.M) - - if m: - base_path = m.group(1)[len(path):] or "/" - m = re.search(r'^Repository UUID: (.+)$', data, re.M) - - if m: - uuid = m.group(1) - self.type = "svn" - - return SvnRepositoryInfo(path=path, base_path=base_path, - uuid=uuid, - supports_parent_diffs=True) - else: - # Versions of git-svn before 1.5.4 don't (appear to) support - # 'git svn info'. If we fail because of an older git install, - # here, figure out what version of git is installed and give - # the user a hint about what to do next. - version = execute(["git", "svn", "--version"], ignore_errors=True) - version_parts = re.search('version (\d+)\.(\d+)\.(\d+)', - version) - svn_remote = execute(["git", "config", "--get", - "svn-remote.svn.url"], ignore_errors=True) - - if (version_parts and - not self.is_valid_version((int(version_parts.group(1)), - int(version_parts.group(2)), - int(version_parts.group(3))), - (1, 5, 4)) and - svn_remote): - die("Your installation of git-svn must be upgraded to " + \ - "version 1.5.4 or later") - - # Okay, maybe Perforce. - # TODO - - # Nope, it's git then. - origin = execute(["git", "remote", "show", "origin"]) - m = re.search(r'URL: (.+)', origin) - if m: - url = m.group(1).rstrip('/') - if url: - self.type = "git" - return RepositoryInfo(path=url, base_path='', - supports_parent_diffs=True) - - return None - - def is_valid_version(self, actual, expected): - """ - Takes two tuples, both in the form: - (major_version, minor_version, micro_version) - Returns true if the actual version is greater than or equal to - the expected version, and false otherwise. - """ - return (actual[0] > expected[0]) or \ - (actual[0] == expected[0] and actual[1] > expected[1]) or \ - (actual[0] == expected[0] and actual[1] == expected[1] and \ - actual[2] >= expected[2]) - - def scan_for_server(self, repository_info): - # Scan first for dot files, since it's faster and will cover the - # user's $HOME/.reviewboardrc - server_url = super(GitClient, self).scan_for_server(repository_info) - - if server_url: - return server_url - - # TODO: Maybe support a server per remote later? Is that useful? - url = execute(["git", "config", "--get", "reviewboard.url"], - ignore_errors=True).strip() - if url: - return url - - if self.type == "svn": - # Try using the reviewboard:url property on the SVN repo, if it - # exists. - prop = SVNClient().scan_for_server_property(repository_info) - - if prop: - return prop - - return None - - def diff(self, args): - """ - Performs a diff across all modified files in the branch, taking into - account a parent branch. - """ - parent_branch = options.parent_branch or "master" - - diff_lines = self.make_diff(parent_branch) - - if parent_branch != "master": - parent_diff_lines = self.make_diff("master", parent_branch) - else: - parent_diff_lines = None - - if options.guess_summary and not options.summary: - options.summary = execute(["git", "log", "--pretty=format:%s", - "HEAD^.."], ignore_errors=True).strip() - - if options.guess_description and not options.description: - options.description = execute( - ["git", "log", "--pretty=format:%s%n%n%b", parent_branch + ".."], - ignore_errors=True).strip() - - return (diff_lines, parent_diff_lines) - - def make_diff(self, parent_branch, source_branch=""): - """ - Performs a diff on a particular branch range. - """ - if self.type == "svn": - diff_lines = execute(["git", "diff", "--no-color", "--no-prefix", - "-r", "-u", "%s..%s" % (parent_branch, - source_branch)], - split_lines=True) - return self.make_svn_diff(parent_branch, diff_lines) - elif self.type == "git": - return execute(["git", "diff", "--no-color", "--full-index", - parent_branch]) - - return None - - def make_svn_diff(self, parent_branch, diff_lines): - """ - Formats the output of git diff such that it's in a form that - svn diff would generate. This is needed so the SVNTool in Review - Board can properly parse this diff. - """ - rev = execute(["git", "svn", "find-rev", "master"]).strip() - - if not rev: - return None - - diff_data = "" - filename = "" - revision = "" - newfile = False - - for line in diff_lines: - if line.startswith("diff "): - # Grab the filename and then filter this out. - # This will be in the format of: - # - # diff --git a/path/to/file b/path/to/file - info = line.split(" ") - diff_data += "Index: %s\n" % info[2] - diff_data += "=" * 67 - diff_data += "\n" - elif line.startswith("index "): - # Filter this out. - pass - elif line.strip() == "--- /dev/null": - # New file - newfile = True - elif line.startswith("--- "): - newfile = False - diff_data += "--- %s\t(revision %s)\n" % \ - (line[4:].strip(), rev) - elif line.startswith("+++ "): - filename = line[4:].strip() - if newfile: - diff_data += "--- %s\t(revision 0)\n" % filename - diff_data += "+++ %s\t(revision 0)\n" % filename - else: - # We already printed the "--- " line. - diff_data += "+++ %s\t(working copy)\n" % filename - else: - diff_data += line - - return diff_data - - def diff_between_revisions(self, revision_range, args, repository_info): - pass - - -SCMCLIENTS = ( - SVNClient(), - CVSClient(), - GitClient(), - MercurialClient(), - PerforceClient(), - ClearCaseClient(), -) - -def debug(s): - """ - Prints debugging information if post-review was run with --debug - """ - if DEBUG or options and options.debug: - print ">>> %s" % s - - -def make_tempfile(): - """ - Creates a temporary file and returns the path. The path is stored - in an array for later cleanup. - """ - fd, tmpfile = mkstemp() - os.close(fd) - tempfiles.append(tmpfile) - return tmpfile - - -def check_install(command): - """ - Try executing an external command and return a boolean indicating whether - that command is installed or not. The 'command' argument should be - something that executes quickly, without hitting the network (for - instance, 'svn help' or 'git --version'). - """ - try: - p = subprocess.Popen(command.split(' '), - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - return True - except OSError: - return False - - -def execute(command, env=None, split_lines=False, ignore_errors=False, - extra_ignore_errors=(), translate_newlines=True): - """ - Utility function to execute a command and return the output. - """ - if isinstance(command, list): - debug(subprocess.list2cmdline(command)) - else: - debug(command) - - if env: - env.update(os.environ) - else: - env = os.environ.copy() - - env['LC_ALL'] = 'en_US.UTF-8' - env['LANGUAGE'] = 'en_US.UTF-8' - - if sys.platform.startswith('win'): - p = subprocess.Popen(command, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - shell=False, - universal_newlines=translate_newlines, - env=env) - else: - p = subprocess.Popen(command, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - shell=False, - close_fds=True, - universal_newlines=translate_newlines, - env=env) - if split_lines: - data = p.stdout.readlines() - else: - data = p.stdout.read() - rc = p.wait() - if rc and not ignore_errors and rc not in extra_ignore_errors: - die('Failed to execute command: %s\n%s' % (command, data)) - - return data - - -def die(msg=None): - """ - Cleanly exits the program with an error message. Erases all remaining - temporary files. - """ - for tmpfile in tempfiles: - try: - os.unlink(tmpfile) - except: - pass - - if msg: - print msg - - sys.exit(1) - - -def walk_parents(path): - """ - Walks up the tree to the root directory. - """ - while os.path.splitdrive(path)[1] != os.sep: - yield path - path = os.path.dirname(path) - - -def load_config_file(filename): - """ - Loads data from a config file. - """ - config = { - 'TREES': {}, - } - - if os.path.exists(filename): - try: - execfile(filename, config) - except: - pass - - return config - - -def tempt_fate(server, tool, changenum, diff_content=None, - parent_diff_content=None, submit_as=None, retries=3): - """ - Attempts to create a review request on a Review Board server and upload - a diff. On success, the review request path is displayed. - """ - try: - save_draft = False - - if options.rid: - review_request = server.get_review_request(options.rid) - else: - review_request = server.new_review_request(changenum, submit_as) - - if options.target_groups: - server.set_review_request_field(review_request, 'target_groups', - options.target_groups) - save_draft = True - - if options.target_people: - server.set_review_request_field(review_request, 'target_people', - options.target_people) - save_draft = True - - if options.summary: - server.set_review_request_field(review_request, 'summary', - options.summary) - save_draft = True - - if options.branch: - server.set_review_request_field(review_request, 'branch', - options.branch) - save_draft = True - - if options.bugs_closed: - server.set_review_request_field(review_request, 'bugs_closed', - options.bugs_closed) - save_draft = True - - if options.description: - server.set_review_request_field(review_request, 'description', - options.description) - save_draft = True - - if options.testing_done: - server.set_review_request_field(review_request, 'testing_done', - options.testing_done) - save_draft = True - - if save_draft: - server.save_draft(review_request) - except APIError, e: - rsp, = e.args - if rsp['err']['code'] == 103: # Not logged in - retries = retries - 1 - - # We had an odd issue where the server ended up a couple of - # years in the future. Login succeeds but the cookie date was - # "odd" so use of the cookie appeared to fail and eventually - # ended up at max recursion depth :-(. Check for a maximum - # number of retries. - if retries >= 0: - server.login(force=True) - tempt_fate(server, tool, changenum, diff_content, - parent_diff_content, submit_as, retries=retries) - return - - if options.rid: - die("Error getting review request %s: %s (code %s)" % \ - (options.rid, rsp['err']['msg'], rsp['err']['code'])) - else: - die("Error creating review request: %s (code %s)" % \ - (rsp['err']['msg'], rsp['err']['code'])) - - - if not server.info.supports_changesets or not options.change_only: - try: - server.upload_diff(review_request, diff_content, - parent_diff_content) - except APIError, e: - rsp, = e.args - print "Error uploading diff: %s (%s)" % (rsp['err']['msg'], - rsp['err']['code']) - debug(rsp) - die("Your review request still exists, but the diff is not " + - "attached.") - - if options.publish: - server.publish(review_request) - - request_url = 'r/' + str(review_request['id']) - review_url = urljoin(server.url, request_url) - - if not review_url.startswith('http'): - review_url = 'http://%s' % review_url - - print "Review request #%s posted." % (review_request['id'],) - print - print review_url - - return review_url - - -def parse_options(args): - parser = OptionParser(usage="%prog [-pond] [-r review_id] [changenum]", - version="%prog " + VERSION) - - parser.add_option("-p", "--publish", - dest="publish", action="store_true", default=PUBLISH, - help="publish the review request immediately after " - "submitting") - parser.add_option("-r", "--review-request-id", - dest="rid", metavar="ID", default=None, - help="existing review request ID to update") - parser.add_option("-o", "--open", - dest="open_browser", action="store_true", - default=OPEN_BROWSER, - help="open a web browser to the review request page") - parser.add_option("-n", "--output-diff", - dest="output_diff_only", action="store_true", - default=False, - help="outputs a diff to the console and exits. " - "Does not post") - parser.add_option("--server", - dest="server", default=REVIEWBOARD_URL, - metavar="SERVER", - help="specify a different Review Board server " - "to use") - parser.add_option("--diff-only", - dest="diff_only", action="store_true", default=False, - help="uploads a new diff, but does not update " - "info from changelist") - parser.add_option("--target-groups", - dest="target_groups", default=TARGET_GROUPS, - help="names of the groups who will perform " - "the review") - parser.add_option("--target-people", - dest="target_people", default=TARGET_PEOPLE, - help="names of the people who will perform " - "the review") - parser.add_option("--summary", - dest="summary", default=None, - help="summary of the review ") - parser.add_option("--description", - dest="description", default=None, - help="description of the review ") - parser.add_option("--description-file", - dest="description_file", default=None, - help="text file containing a description of the review") - parser.add_option("--guess-summary", - dest="guess_summary", action="store_true", - default=False, - help="guess summary from the latest commit (git/" - "hgsubversion only)") - parser.add_option("--guess-description", - dest="guess_description", action="store_true", - default=False, - help="guess description based on commits on this branch " - "(git/hgsubversion only)") - parser.add_option("--testing-done", - dest="testing_done", default=None, - help="details of testing done ") - parser.add_option("--testing-done-file", - dest="testing_file", default=None, - help="text file containing details of testing done ") - parser.add_option("--branch", - dest="branch", default=None, - help="affected branch ") - parser.add_option("--bugs-closed", - dest="bugs_closed", default=None, - help="list of bugs closed ") - parser.add_option("--revision-range", - dest="revision_range", default=None, - help="generate the diff for review based on given " - "revision range") - parser.add_option("--label", - dest="label", default=None, - help="label (ClearCase Only) ") - parser.add_option("--submit-as", - dest="submit_as", default=SUBMIT_AS, metavar="USERNAME", - help="user name to be recorded as the author of the " - "review request, instead of the logged in user") - parser.add_option("--username", - dest="username", default=None, metavar="USERNAME", - help="user name to be supplied to the reviewboard server") - parser.add_option("--password", - dest="password", default=None, metavar="PASSWORD", - help="password to be supplied to the reviewboard server") - parser.add_option("--change-only", - dest="change_only", action="store_true", - default=False, - help="updates info from changelist, but does " - "not upload a new diff (only available if your " - "repository supports changesets)") - parser.add_option("--parent", - dest="parent_branch", default=None, - metavar="PARENT_BRANCH", - help="the parent branch this diff should be against " - "(only available if your repository supports " - "parent diffs)") - parser.add_option("--p4-client", - dest="p4_client", default=None, - help="the Perforce client name that the review is in") - parser.add_option("--p4-port", - dest="p4_port", default=None, - help="the Perforce servers IP address that the review is on") - parser.add_option("--repository-url", - dest="repository_url", default=None, - help="the url for a repository for creating a diff " - "outside of a working copy (currently only supported " - "by Subversion). Requires --revision-range") - parser.add_option("-d", "--debug", - action="store_true", dest="debug", default=DEBUG, - help="display debug output") - - (globals()["options"], args) = parser.parse_args(args) - - if options.description and options.description_file: - sys.stderr.write("The --description and --description-file options " - "are mutually exclusive.\n") - sys.exit(1) - - if options.description_file: - if os.path.exists(options.description_file): - fp = open(options.description_file, "r") - options.description = fp.read() - fp.close() - else: - sys.stderr.write("The description file %s does not exist.\n" % - options.description_file) - sys.exit(1) - - if options.testing_done and options.testing_file: - sys.stderr.write("The --testing-done and --testing-done-file options " - "are mutually exclusive.\n") - sys.exit(1) - - if options.testing_file: - if os.path.exists(options.testing_file): - fp = open(options.testing_file, "r") - options.testing_done = fp.read() - fp.close() - else: - sys.stderr.write("The testing file %s does not exist.\n" % - options.testing_file) - sys.exit(1) - - if options.repository_url and not options.revision_range: - sys.stderr.write("The --repository-url option requires the " - "--revision-range option.\n") - sys.exit(1) - - return args - -def determine_client(): - - repository_info = None - tool = None - - # Try to find the SCM Client we're going to be working with. - for tool in SCMCLIENTS: - repository_info = tool.get_repository_info() - - if repository_info: - break - - if not repository_info: - if options.repository_url: - print "No supported repository could be access at the supplied url." - else: - print "The current directory does not contain a checkout from a" - print "supported source code repository." - sys.exit(1) - - # Verify that options specific to an SCM Client have not been mis-used. - if options.change_only and not repository_info.supports_changesets: - sys.stderr.write("The --change-only option is not valid for the " - "current SCM client.\n") - sys.exit(1) - - if options.parent_branch and not repository_info.supports_parent_diffs: - sys.stderr.write("The --parent option is not valid for the " - "current SCM client.\n") - sys.exit(1) - - if ((options.p4_client or options.p4_port) and \ - not isinstance(tool, PerforceClient)): - sys.stderr.write("The --p4-client and --p4-port options are not valid " - "for the current SCM client.\n") - sys.exit(1) - - return (repository_info, tool) - -def main(): - if 'USERPROFILE' in os.environ: - homepath = os.path.join(os.environ["USERPROFILE"], "Local Settings", - "Application Data") - elif 'HOME' in os.environ: - homepath = os.environ["HOME"] - else: - homepath = '' - - # Load the config and cookie files - globals()['user_config'] = \ - load_config_file(os.path.join(homepath, ".reviewboardrc")) - cookie_file = os.path.join(homepath, ".post-review-cookies.txt") - - args = parse_options(sys.argv[1:]) - - repository_info, tool = determine_client() - - # Try to find a valid Review Board server to use. - if options.server: - server_url = options.server - else: - server_url = tool.scan_for_server(repository_info) - - if not server_url: - print "Unable to find a Review Board server for this source code tree." - sys.exit(1) - - server = ReviewBoardServer(server_url, repository_info, cookie_file) - - if repository_info.supports_changesets: - changenum = tool.get_changenum(args) - else: - changenum = None - - if options.revision_range: - diff = tool.diff_between_revisions(options.revision_range, args, - repository_info) - parent_diff = None - elif options.label and isinstance(tool, ClearCaseClient): - diff, parent_diff = tool.diff_label(options.label) - else: - diff, parent_diff = tool.diff(args) - - if options.output_diff_only: - print diff - sys.exit(0) - - # Let's begin. - server.login() - - review_url = tempt_fate(server, tool, changenum, diff_content=diff, - parent_diff_content=parent_diff, - submit_as=options.submit_as) - - # Load the review up in the browser if requested to: - if options.open_browser: - try: - import webbrowser - if 'open_new_tab' in dir(webbrowser): - # open_new_tab is only in python 2.5+ - webbrowser.open_new_tab(review_url) - elif 'open_new' in dir(webbrowser): - webbrowser.open_new(review_url) - else: - os.system( 'start %s' % review_url ) - except: - print 'Error opening review URL: %s' % review_url - - -if __name__ == "__main__": - main() diff --git a/test/review b/test/review deleted file mode 100755 index e1ccb9c0af..0000000000 --- a/test/review +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -if [ -z $1 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "-help" ] || [ "$1" = "-?" ]; then - echo "Usage: `basename $0` [rev] [args]\n" - echo " [rev] : either the revision number without leading 'r' (post-commit)," - echo " or '-loc' to create a review from current local changes (pre-commit)\n" - echo " [args] : optional arguments:" - echo " -r ID existing review request ID to update\n" - exit 1 -fi - -POSTREVIEW=`dirname $0`/postreview.py - -if [ "$1" = "-loc" ]; then - echo "creating review request from local changes..." - REVARG="" - LOG="" - SUMMARY="local changes" - REPO="" -else - REV=$1 - PREV=`expr $REV - 1` - if [ $? -ne 0 ]; then - echo "argument revision not a number: $REV" - exit 1 - fi - - echo "creating review request for changeset $REV..." - - LOG="`svn log http://lampsvn.epfl.ch/svn-repos/scala -c $REV`" - if [ $? -ne 0 ]; then - echo "could not get svn log for revision $REV" - exit 1 - fi - - REVARG="--revision-range=$PREV:$REV" - SUMMARY="r$REV" - REPO="--repository-url=http://lampsvn.epfl.ch/svn-repos/scala" -fi - - -shift # remove parameter $1 (revision) - -python $POSTREVIEW --server="https://chara2.epfl.ch" $REVARG --summary="$SUMMARY" --description="$LOG" $REPO -o $@ diff --git a/test/scaladoc/resources/Trac4325.scala b/test/scaladoc/resources/Trac4325.scala index ffb968d571..ccc2f1900a 100644 --- a/test/scaladoc/resources/Trac4325.scala +++ b/test/scaladoc/resources/Trac4325.scala @@ -1,5 +1,5 @@ -case class WithSynthetic +case class WithSynthetic() -case class WithObject +case class WithObject() object WithObject diff --git a/test/scaladoc/resources/doc-root/Any.scala b/test/scaladoc/resources/doc-root/Any.scala index 031b7d9d8c..fd4c287b4f 100644 --- a/test/scaladoc/resources/doc-root/Any.scala +++ b/test/scaladoc/resources/doc-root/Any.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/scaladoc/resources/doc-root/AnyRef.scala b/test/scaladoc/resources/doc-root/AnyRef.scala index 7d8b9f9e76..362fbcf0f5 100644 --- a/test/scaladoc/resources/doc-root/AnyRef.scala +++ b/test/scaladoc/resources/doc-root/AnyRef.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/scaladoc/resources/doc-root/Nothing.scala b/test/scaladoc/resources/doc-root/Nothing.scala index eed6066039..57f6fac3f9 100644 --- a/test/scaladoc/resources/doc-root/Nothing.scala +++ b/test/scaladoc/resources/doc-root/Nothing.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/scaladoc/resources/doc-root/Null.scala b/test/scaladoc/resources/doc-root/Null.scala index 7455e78ae7..931beb2d1a 100644 --- a/test/scaladoc/resources/doc-root/Null.scala +++ b/test/scaladoc/resources/doc-root/Null.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2010, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/test/scaladoc/resources/implicits-base-res.scala b/test/scaladoc/resources/implicits-base-res.scala index d6c0332c10..1d17e9a6d3 100644 --- a/test/scaladoc/resources/implicits-base-res.scala +++ b/test/scaladoc/resources/implicits-base-res.scala @@ -11,21 +11,21 @@ trait MyNumeric[R] * - tests the complete type inference * - the following inherited methods should appear: * {{{ - * def convToGtColonDoubleA(x: Double) // pimpA3: with a constraint that T <: Double - * def convToIntA(x: Int) // pimpA2: with a constraint that T = Int - * def convToManifestA(x: T) // pimpA7: with 2 constraints: T: Manifest and T <: Double - * def convToMyNumericA(x: T) // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope - * def convToNumericA(x: T) // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope - * def convToPimpedA(x: Bar[Foo[T]]) // pimpA5: no constraints, SHADOWED - * def convToPimpedA(x: S) // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar, SHADOWED - * def convToPimpedA(x: T) // pimpA0: with no constraints, SHADOWED - * def convToTraversableOps(x: T) // pimpA7: with 2 constraints: T: Manifest and T <: Double + * def convToGtColonDoubleA(x: Double) // enrichA3: with a constraint that T <: Double + * def convToIntA(x: Int) // enrichA2: with a constraint that T = Int + * def convToManifestA(x: T) // enrichA7: with 2 constraints: T: Manifest and T <: Double + * def convToMyNumericA(x: T) // enrichA6: with a constraint that there is x: MyNumeric[T] implicit in scope + * def convToNumericA(x: T) // enrichA1: with a constraint that there is x: Numeric[T] implicit in scope + * def convToEnrichedA(x: Bar[Foo[T]]) // enrichA5: no constraints, SHADOWED + * def convToEnrichedA(x: S) // enrichA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar, SHADOWED + * def convToEnrichedA(x: T) // enrichA0: with no constraints, SHADOWED + * def convToTraversableOps(x: T) // enrichA7: with 2 constraints: T: Manifest and T <: Double * // should not be abstract! * }}} */ class A[T] { - /** This should prevent the implicitly inherited `def convToPimpedA: T` from `pimpA0` from showing up */ - def convToPimpedA(x: T): T = sys.error("Let's check it out!") + /** This should prevent the implicitly inherited `def convToEnrichedA: T` from `enrichA0` from showing up */ + def convToEnrichedA(x: T): T = sys.error("Let's check it out!") /** This should check implicit member elimination in the case of subtyping */ def foo(a: T, b: AnyRef): T } @@ -33,15 +33,15 @@ class A[T] { object A { import language.implicitConversions // according to SIP18 - implicit def pimpA0[V](a: A[V]) = new PimpedA(a) - implicit def pimpA1[ZBUR: Numeric](a: A[ZBUR]) = new NumericA[ZBUR](a) - implicit def pimpA2(a: A[Int]) = new IntA(a) - implicit def pimpA3(a: A[T] forSome { type T <: Double }) = new GtColonDoubleA(a) - implicit def pimpA4[S](a: A[Foo[Bar[S]]])(implicit foo: Foo[S], bar: Bar[S]): PimpedA[S] = sys.error("not implemented") - implicit def pimpA5[Z](a: A[Z]): PimpedA[Bar[Foo[Z]]] = sys.error("not implemented") - implicit def pimpA6[Z: MyNumeric](a: A[Z]) = new MyNumericA[Z](a) + implicit def enrichA0[V](a: A[V]) = new EnrichedA(a) + implicit def enrichA1[ZBUR: Numeric](a: A[ZBUR]) = new NumericA[ZBUR](a) + implicit def enrichA2(a: A[Int]) = new IntA(a) + implicit def enrichA3(a: A[T] forSome { type T <: Double }) = new GtColonDoubleA(a) + implicit def enrichA4[S](a: A[Foo[Bar[S]]])(implicit foo: Foo[S], bar: Bar[S]): EnrichedA[S] = sys.error("not implemented") + implicit def enrichA5[Z](a: A[Z]): EnrichedA[Bar[Foo[Z]]] = sys.error("not implemented") + implicit def enrichA6[Z: MyNumeric](a: A[Z]) = new MyNumericA[Z](a) // TODO: Add H <: Double and see why it crashes for C and D -- context bounds, need to check! - implicit def pimpA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps(x: H): H = sys.error("no") } + implicit def enrichA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps(x: H): H = sys.error("no") } } @@ -49,14 +49,14 @@ object A { * - tests the existential type solving * - the following inherited methods should appear: * {{{ - * def convToGtColonDoubleA(x: Double) // pimpA3: no constraints - * def convToManifestA(x: Double) // pimpA7: no constraints - * def convToMyNumericA(x: Double) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope - * def convToNumericA(x: Double) // pimpA1: no constraintsd - * def convToPimpedA(x: Bar[Foo[Double]]) // pimpA5: no constraints, SHADOWED - * def convToPimpedA(x: Double) // pimpA0: no constraints, SHADOWED - * def convToTraversableOps(x: Double) // pimpA7: no constraints - * // should not be abstract! + * def convToGtColonDoubleA(x: Double) // enrichA3: no constraints + * def convToManifestA(x: Double) // enrichA7: no constraints + * def convToMyNumericA(x: Double) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope + * def convToNumericA(x: Double) // enrichA1: no constraintsd + * def convToEnrichedA(x: Bar[Foo[Double]]) // enrichA5: no constraints, SHADOWED + * def convToEnrichedA(x: Double) // enrichA0: no constraints, SHADOWED + * def convToTraversableOps(x: Double) // enrichA7: no constraints + * // should not be abstract! * }}} */ class B extends A[Double] @@ -67,11 +67,11 @@ object B extends A * - tests asSeenFrom * - the following inherited methods should appear: * {{{ - * def convToIntA(x: Int) // pimpA2: no constraints - * def convToMyNumericA(x: Int) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope - * def convToNumericA(x: Int) // pimpA1: no constraints - * def convToPimpedA(x: Int) // pimpA0: no constraints, SHADOWED - * def convToPimpedA(x: Bar[Foo[Int]]) // pimpA5: no constraints, SHADOWED + * def convToIntA(x: Int) // enrichA2: no constraints + * def convToMyNumericA(x: Int) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope + * def convToNumericA(x: Int) // enrichA1: no constraints + * def convToEnrichedA(x: Int) // enrichA0: no constraints, SHADOWED + * def convToEnrichedA(x: Bar[Foo[Int]]) // enrichA5: no constraints, SHADOWED * }}} */ class C extends A[Int] @@ -82,10 +82,10 @@ object C extends A * - tests implicit elimination * - the following inherited methods should appear: * {{{ - * def convToMyNumericA(x: String) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope - * def convToNumericA(x: String) // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope - * def convToPimpedA(x: Bar[Foo[String]]) // pimpA5: no constraints, SHADOWED - * def convToPimpedA(x: String) // pimpA0: no constraints, SHADOWED + * def convToMyNumericA(x: String) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope + * def convToNumericA(x: String) // enrichA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope + * def convToEnrichedA(x: Bar[Foo[String]]) // enrichA5: no constraints, SHADOWED + * def convToEnrichedA(x: String) // enrichA0: no constraints, SHADOWED * }}} */ class D extends A[String] @@ -93,12 +93,12 @@ class D extends A[String] object D extends A -/** PimpedA class <br/> +/** EnrichedA class <br/> * - tests simple inheritance and asSeenFrom * - A, B and C should be implicitly converted to this */ -class PimpedA[V](a: A[V]) { - /** The convToPimpedA: V documentation... */ - def convToPimpedA(x: V): V = sys.error("Not implemented") +class EnrichedA[V](a: A[V]) { + /** The convToEnrichedA: V documentation... */ + def convToEnrichedA(x: V): V = sys.error("Not implemented") } /** NumericA class <br/> diff --git a/test/scaladoc/resources/links.scala b/test/scaladoc/resources/links.scala index bd69665357..ecac9c63cf 100644 --- a/test/scaladoc/resources/links.scala +++ b/test/scaladoc/resources/links.scala @@ -25,6 +25,7 @@ package scala.test.scaladoc.links { object Target { type T = Int => Int type S = Int + type ::[X] = scala.collection.immutable.::[X] class C def foo(i: Int) = 2 def foo(z: String) = 3 @@ -46,6 +47,7 @@ package scala.test.scaladoc.links { * - [[[[Target!.foo[A[_[_]]]* trait Target -> def foo with 3 nested tparams]]]] (should exercise nested parens) * - [[Target$.T object Target -> type T]] * - [[Target$.S object Target -> type S]] + * - [[Target$.:: object Target -> type ::]] * - [[Target$.foo(z:Str* object Target -> def foo]] * - [[Target$.bar object Target -> def bar]] * - [[[[Target$.foo[A[_[_]]]* trait Target -> def foo with 3 nested tparams]]]] (should exercise nested parens) diff --git a/test/scaladoc/run/implicits-base.scala b/test/scaladoc/run/implicits-base.scala index 3d57306f5d..8f8652cdb3 100644 --- a/test/scaladoc/run/implicits-base.scala +++ b/test/scaladoc/run/implicits-base.scala @@ -25,54 +25,54 @@ object Test extends ScaladocModelTest { val A = base._class("A") - // def convToPimpedA(x: T) // pimpA0: with no constraints, SHADOWED - conv = A._conversion(A.qualifiedName + ".pimpA0") + // def convToEnrichedA(x: T) // enrichA0: with no constraints, SHADOWED + conv = A._conversion(A.qualifiedName + ".enrichA0") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "T") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "T") - // def convToNumericA: T // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope - conv = A._conversion(A.qualifiedName + ".pimpA1") + // def convToNumericA: T // enrichA1: with a constraint that there is x: Numeric[T] implicit in scope + conv = A._conversion(A.qualifiedName + ".enrichA1") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToNumericA").resultType.name == "T") - // def convToIntA: Int // pimpA2: with a constraint that T = Int - conv = A._conversion(A.qualifiedName + ".pimpA2") + // def convToIntA: Int // enrichA2: with a constraint that T = Int + conv = A._conversion(A.qualifiedName + ".enrichA2") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToIntA").resultType.name == "Int") - // def convToGtColonDoubleA: Double // pimpA3: with a constraint that T <: Double - conv = A._conversion(A.qualifiedName + ".pimpA3") + // def convToGtColonDoubleA: Double // enrichA3: with a constraint that T <: Double + conv = A._conversion(A.qualifiedName + ".enrichA3") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToGtColonDoubleA").resultType.name == "Double") - // def convToPimpedA: S // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar - conv = A._conversion(A.qualifiedName + ".pimpA4") + // def convToEnrichedA: S // enrichA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar + conv = A._conversion(A.qualifiedName + ".enrichA4") assert(conv.members.length == 1) assert(conv.constraints.length == 3) - assert(conv._member("convToPimpedA").resultType.name == "S") + assert(conv._member("convToEnrichedA").resultType.name == "S") - // def convToPimpedA: Bar[Foo[T]] // pimpA5: no constraints - conv = A._conversion(A.qualifiedName + ".pimpA5") + // def convToEnrichedA: Bar[Foo[T]] // enrichA5: no constraints + conv = A._conversion(A.qualifiedName + ".enrichA5") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[T]]") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[T]]") - // def convToMyNumericA: T // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope - conv = A._conversion(A.qualifiedName + ".pimpA6") + // def convToMyNumericA: T // enrichA6: with a constraint that there is x: MyNumeric[T] implicit in scope + conv = A._conversion(A.qualifiedName + ".enrichA6") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToMyNumericA").resultType.name == "T") - // def convToManifestA: T // pimpA7: with 2 constraints: T: Manifest and T <: Double - // def convToTraversableOps: T // pimpA7: with 2 constraints: T: Manifest and T <: Double + // def convToManifestA: T // enrichA7: with 2 constraints: T: Manifest and T <: Double + // def convToTraversableOps: T // enrichA7: with 2 constraints: T: Manifest and T <: Double // should not be abstract! - conv = A._conversion(A.qualifiedName + ".pimpA7") + conv = A._conversion(A.qualifiedName + ".enrichA7") assert(conv.members.length == 2) assert(conv.constraints.length == 2) assert(conv._member("convToManifestA").resultType.name == "T") @@ -84,45 +84,45 @@ object Test extends ScaladocModelTest { val B = base._class("B") // these conversions should not affect B - assert(B._conversions(A.qualifiedName + ".pimpA2").isEmpty) - assert(B._conversions(A.qualifiedName + ".pimpA4").isEmpty) + assert(B._conversions(A.qualifiedName + ".enrichA2").isEmpty) + assert(B._conversions(A.qualifiedName + ".enrichA4").isEmpty) - // def convToPimpedA(x: Double) // pimpA0: no constraints, SHADOWED - conv = B._conversion(A.qualifiedName + ".pimpA0") + // def convToEnrichedA(x: Double) // enrichA0: no constraints, SHADOWED + conv = B._conversion(A.qualifiedName + ".enrichA0") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Double") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Double") - // def convToNumericA: Double // pimpA1: no constraintsd - conv = B._conversion(A.qualifiedName + ".pimpA1") + // def convToNumericA: Double // enrichA1: no constraintsd + conv = B._conversion(A.qualifiedName + ".enrichA1") assert(conv.members.length == 1) assert(conv.constraints.length == 0) assert(conv._member("convToNumericA").resultType.name == "Double") - // def convToGtColonDoubleA: Double // pimpA3: no constraints - conv = B._conversion(A.qualifiedName + ".pimpA3") + // def convToGtColonDoubleA: Double // enrichA3: no constraints + conv = B._conversion(A.qualifiedName + ".enrichA3") assert(conv.members.length == 1) assert(conv.constraints.length == 0) assert(conv._member("convToGtColonDoubleA").resultType.name == "Double") - // def convToPimpedA: Bar[Foo[Double]] // pimpA5: no constraints - conv = B._conversion(A.qualifiedName + ".pimpA5") + // def convToEnrichedA: Bar[Foo[Double]] // enrichA5: no constraints + conv = B._conversion(A.qualifiedName + ".enrichA5") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Double]]") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[Double]]") - // def convToMyNumericA: Double // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope - conv = B._conversion(A.qualifiedName + ".pimpA6") + // def convToMyNumericA: Double // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope + conv = B._conversion(A.qualifiedName + ".enrichA6") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToMyNumericA").resultType.name == "Double") - // def convToManifestA: Double // pimpA7: no constraints - // def convToTraversableOps: Double // pimpA7: no constraints + // def convToManifestA: Double // enrichA7: no constraints + // def convToTraversableOps: Double // enrichA7: no constraints // // should not be abstract! - conv = B._conversion(A.qualifiedName + ".pimpA7") + conv = B._conversion(A.qualifiedName + ".enrichA7") assert(conv.members.length == 2) assert(conv.constraints.length == 0) assert(conv._member("convToManifestA").resultType.name == "Double") @@ -134,38 +134,38 @@ object Test extends ScaladocModelTest { val C = base._class("C") // these conversions should not affect C - assert(C._conversions(A.qualifiedName + ".pimpA3").isEmpty) - assert(C._conversions(A.qualifiedName + ".pimpA4").isEmpty) - assert(C._conversions(A.qualifiedName + ".pimpA7").isEmpty) + assert(C._conversions(A.qualifiedName + ".enrichA3").isEmpty) + assert(C._conversions(A.qualifiedName + ".enrichA4").isEmpty) + assert(C._conversions(A.qualifiedName + ".enrichA7").isEmpty) - // def convToPimpedA(x: Int) // pimpA0: no constraints, SHADOWED - conv = C._conversion(A.qualifiedName + ".pimpA0") + // def convToEnrichedA(x: Int) // enrichA0: no constraints, SHADOWED + conv = C._conversion(A.qualifiedName + ".enrichA0") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Int") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Int") - // def convToNumericA: Int // pimpA1: no constraints - conv = C._conversion(A.qualifiedName + ".pimpA1") + // def convToNumericA: Int // enrichA1: no constraints + conv = C._conversion(A.qualifiedName + ".enrichA1") assert(conv.members.length == 1) assert(conv.constraints.length == 0) assert(conv._member("convToNumericA").resultType.name == "Int") - // def convToIntA: Int // pimpA2: no constraints - conv = C._conversion(A.qualifiedName + ".pimpA2") + // def convToIntA: Int // enrichA2: no constraints + conv = C._conversion(A.qualifiedName + ".enrichA2") assert(conv.members.length == 1) assert(conv.constraints.length == 0) assert(conv._member("convToIntA").resultType.name == "Int") - // def convToPimpedA: Bar[Foo[Int]] // pimpA5: no constraints - conv = C._conversion(A.qualifiedName + ".pimpA5") + // def convToEnrichedA: Bar[Foo[Int]] // enrichA5: no constraints + conv = C._conversion(A.qualifiedName + ".enrichA5") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Int]]") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[Int]]") - // def convToMyNumericA: Int // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope - conv = C._conversion(A.qualifiedName + ".pimpA6") + // def convToMyNumericA: Int // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope + conv = C._conversion(A.qualifiedName + ".enrichA6") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToMyNumericA").resultType.name == "Int") @@ -175,33 +175,33 @@ object Test extends ScaladocModelTest { val D = base._class("D") // these conversions should not affect D - assert(D._conversions(A.qualifiedName + ".pimpA2").isEmpty) - assert(D._conversions(A.qualifiedName + ".pimpA3").isEmpty) - assert(D._conversions(A.qualifiedName + ".pimpA4").isEmpty) - assert(D._conversions(A.qualifiedName + ".pimpA7").isEmpty) + assert(D._conversions(A.qualifiedName + ".enrichA2").isEmpty) + assert(D._conversions(A.qualifiedName + ".enrichA3").isEmpty) + assert(D._conversions(A.qualifiedName + ".enrichA4").isEmpty) + assert(D._conversions(A.qualifiedName + ".enrichA7").isEmpty) - // def convToPimpedA(x: String) // pimpA0: no constraints, SHADOWED - conv = D._conversion(A.qualifiedName + ".pimpA0") + // def convToEnrichedA(x: String) // enrichA0: no constraints, SHADOWED + conv = D._conversion(A.qualifiedName + ".enrichA0") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "String") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "String") - // def convToNumericA: String // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope - conv = D._conversion(A.qualifiedName + ".pimpA1") + // def convToNumericA: String // enrichA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope + conv = D._conversion(A.qualifiedName + ".enrichA1") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToNumericA").resultType.name == "String") - // def convToPimpedA: Bar[Foo[String]] // pimpA5: no constraints - conv = D._conversion(A.qualifiedName + ".pimpA5") + // def convToEnrichedA: Bar[Foo[String]] // enrichA5: no constraints + conv = D._conversion(A.qualifiedName + ".enrichA5") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[String]]") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[String]]") - // def convToMyNumericA: String // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope - conv = D._conversion(A.qualifiedName + ".pimpA6") + // def convToMyNumericA: String // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope + conv = D._conversion(A.qualifiedName + ".enrichA6") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToMyNumericA").resultType.name == "String") diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala index fde24edb2a..64441c2d95 100644 --- a/test/scaladoc/run/links.scala +++ b/test/scaladoc/run/links.scala @@ -26,7 +26,7 @@ object Test extends ScaladocModelTest { val memberLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToMember[_, _]]) val templateLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToTpl[_]]) - assert(memberLinks == 17, memberLinks + " == 17 (the member links in object TEST)") + assert(memberLinks == 18, memberLinks + " == 18 (the member links in object TEST)") assert(templateLinks == 6, templateLinks + " == 6 (the template links in object TEST)") } } diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala index 13eacf79a5..d7b5e48288 100644 --- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala +++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala @@ -680,7 +680,7 @@ object Test extends Properties("HtmlFactory") { property("package object") = files("com/example/p1/package.html") match { case node: scala.xml.Node => - node.toString contains "com.example.p1.package#packageObjectMethod" + node.toString contains "com.example.p1#packageObjectMethod" case _ => false } diff --git a/test/script-tests/jar-manifest/run-test.check b/test/script-tests/jar-manifest/run-test.check index ef59a6cbac..546bf6be9d 100644 --- a/test/script-tests/jar-manifest/run-test.check +++ b/test/script-tests/jar-manifest/run-test.check @@ -1,4 +1,4 @@ -Scala code runner version 2.10.0.r26038-b20111121102734 -- Copyright 2002-2011, LAMP/EPFL +Scala code runner version 2.10.0.r26038-b20111121102734 -- Copyright 2002-2013, LAMP/EPFL % pwd /scala/trunk/test/script-tests/jar-manifest/target |