summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/ant/README42
-rw-r--r--test/files/ant/fsc001-build.check14
-rw-r--r--test/files/ant/fsc001-build.xml26
-rw-r--r--test/files/ant/fsc001.scala7
-rw-r--r--test/files/ant/fsc002-build.check14
-rw-r--r--test/files/ant/fsc002-build.xml28
-rw-r--r--test/files/ant/fsc002.scala6
-rw-r--r--test/files/ant/fsc003-build.check14
-rw-r--r--test/files/ant/fsc003-build.xml25
-rw-r--r--test/files/ant/fsc003.scala7
-rw-r--r--test/files/ant/imported.xml150
-rw-r--r--test/files/ant/scalac001-build.check14
-rw-r--r--test/files/ant/scalac001-build.xml26
-rw-r--r--test/files/ant/scalac001.scala6
-rw-r--r--test/files/ant/scalac002-build.check14
-rw-r--r--test/files/ant/scalac002-build.xml28
-rw-r--r--test/files/ant/scalac002.scala7
-rw-r--r--test/files/ant/scalac003-build.check14
-rw-r--r--test/files/ant/scalac003-build.xml25
-rw-r--r--test/files/ant/scalac003.scala7
-rw-r--r--test/files/ant/scalac004-build.check24
-rw-r--r--test/files/ant/scalac004-build.xml26
-rw-r--r--test/files/ant/scalac004.scala11
-rw-r--r--test/files/ant/scaladoc-build.check15
-rw-r--r--test/files/ant/scaladoc-build.xml26
-rw-r--r--test/files/ant/scaladoc.scala7
-rw-r--r--test/files/jvm/opt_value_class.check2
-rw-r--r--test/files/jvm/opt_value_class/Value_1.scala28
-rw-r--r--test/files/jvm/opt_value_class/test.scala16
-rw-r--r--test/files/lib/scalacheck.jar.desired.sha11
-rw-r--r--test/files/neg/compile-time-only-a.check49
-rw-r--r--test/files/neg/compile-time-only-a.scala57
-rw-r--r--test/files/neg/compile-time-only-b.check7
-rw-r--r--test/files/neg/compile-time-only-b.scala15
-rw-r--r--test/files/neg/javac-error.check10
-rw-r--r--test/files/neg/t4425.check13
-rw-r--r--test/files/neg/t4425.scala10
-rw-r--r--test/files/neg/t4425b.check61
-rw-r--r--test/files/neg/t4425b.scala38
-rw-r--r--test/files/neg/t5903a.check7
-rw-r--r--test/files/neg/t5903a/Macros_1.scala28
-rw-r--r--test/files/neg/t5903a/Test_2.scala6
-rw-r--r--test/files/neg/t5903b.check9
-rw-r--r--test/files/neg/t5903b/Macros_1.scala23
-rw-r--r--test/files/neg/t5903b/Test_2.scala6
-rw-r--r--test/files/neg/t5903c.check7
-rw-r--r--test/files/neg/t5903c/Macros_1.scala26
-rw-r--r--test/files/neg/t5903c/Test_2.scala6
-rw-r--r--test/files/neg/t5903d.check7
-rw-r--r--test/files/neg/t5903d/Macros_1.scala23
-rw-r--r--test/files/neg/t5903d/Test_2.scala6
-rw-r--r--test/files/neg/t5903e.check4
-rw-r--r--test/files/neg/t5903e/Macros_1.scala25
-rw-r--r--test/files/neg/t5903e/Test_2.scala6
-rw-r--r--test/files/neg/t6289.check10
-rw-r--r--test/files/neg/t6289.flags (renamed from test/files/neg/javac-error.flags)0
-rw-r--r--test/files/neg/t6289/J.java (renamed from test/files/neg/javac-error/J.java)0
-rw-r--r--test/files/neg/t6289/SUT_5.scala (renamed from test/files/neg/javac-error/SUT_5.scala)0
-rw-r--r--test/files/neg/t6675.check2
-rw-r--r--test/files/neg/t7214neg.check7
-rw-r--r--test/files/neg/t7214neg.scala57
-rw-r--r--test/files/neg/t7721.check21
-rw-r--r--test/files/neg/t7721.flags1
-rw-r--r--test/files/neg/t7721.scala140
-rw-r--r--test/files/neg/t7756a.check7
-rw-r--r--test/files/neg/t7756a.scala11
-rw-r--r--test/files/neg/t7756b.check6
-rw-r--r--test/files/neg/t7756b.flags1
-rw-r--r--test/files/neg/t7756b.scala5
-rw-r--r--test/files/neg/t7757a.check4
-rw-r--r--test/files/neg/t7757a.scala1
-rw-r--r--test/files/neg/t7757b.check4
-rw-r--r--test/files/neg/t7757b.scala2
-rw-r--r--test/files/neg/t997.check7
-rw-r--r--test/files/pos/annotated-treecopy/Impls_Macros_1.scala2
-rw-r--r--test/files/pos/extractor-types.scala30
-rw-r--r--test/files/pos/optmatch.scala33
-rw-r--r--test/files/pos/overloaded-unapply.scala8
-rw-r--r--test/files/pos/patmat-extract-tparam.scala13
-rw-r--r--test/files/pos/t6797.scala4
-rw-r--r--test/files/run/matchonseq.scala10
-rw-r--r--test/files/run/name-based-patmat.check10
-rw-r--r--test/files/run/name-based-patmat.scala75
-rw-r--r--test/files/run/patmat-behavior-2.check24
-rw-r--r--test/files/run/patmat-behavior-2.scala50
-rw-r--r--test/files/run/patmat-behavior.check90
-rw-r--r--test/files/run/patmat-behavior.scala95
-rw-r--r--test/files/run/patmat-bind-typed.check1
-rw-r--r--test/files/run/patmat-bind-typed.scala8
-rw-r--r--test/files/run/repl-trim-stack-trace.scala33
-rw-r--r--test/files/run/string-extractor.check9
-rw-r--r--test/files/run/string-extractor.scala60
-rw-r--r--test/files/run/t5903a.check1
-rw-r--r--test/files/run/t5903a.flags1
-rw-r--r--test/files/run/t5903a/Macros_1.scala28
-rw-r--r--test/files/run/t5903a/Test_2.scala6
-rw-r--r--test/files/run/t5903b.check1
-rw-r--r--test/files/run/t5903b.flags1
-rw-r--r--test/files/run/t5903b/Macros_1.scala25
-rw-r--r--test/files/run/t5903b/Test_2.scala6
-rw-r--r--test/files/run/t5903c.check1
-rw-r--r--test/files/run/t5903c.flags1
-rw-r--r--test/files/run/t5903c/Macros_1.scala23
-rw-r--r--test/files/run/t5903c/Test_2.scala6
-rw-r--r--test/files/run/t5903d.check1
-rw-r--r--test/files/run/t5903d.flags1
-rw-r--r--test/files/run/t5903d/Macros_1.scala25
-rw-r--r--test/files/run/t5903d/Test_2.scala6
-rw-r--r--test/files/run/t6331b.scala2
-rw-r--r--test/files/run/t7214.scala2
-rw-r--r--test/files/run/value-class-extractor-2.check8
-rw-r--r--test/files/run/value-class-extractor-2.scala108
-rw-r--r--test/files/run/value-class-extractor-seq.check3
-rw-r--r--test/files/run/value-class-extractor-seq.scala59
-rw-r--r--test/files/run/value-class-extractor.check9
-rw-r--r--test/files/run/value-class-extractor.scala91
116 files changed, 1728 insertions, 607 deletions
diff --git a/test/files/ant/README b/test/files/ant/README
deleted file mode 100644
index 8cd8745970..0000000000
--- a/test/files/ant/README
+++ /dev/null
@@ -1,42 +0,0 @@
-README
-======
-
-Test cases in directory test/files/ant/ are executed by invoking an
-Ant script whose name ends with "build.xml" (eg. "fsc001-build.xml").
-
-The Scala Ant tasks fsc/scalac/scaladoc are instantiated from various
-binaries (quick/pack/latest/installed) and are executed with different
-combinations of Ant attributes/elements:
-
- +---------------------------+--------------------------+
- | Attributes | Nested elements |
-------------+---------------------------+--------------------------+
-fsc001 | srcdir,classpath (1) | compilerarg |
-fsc002 | srcref,classpathref (1) | compilerarg |
-fsc003 | (2) | compilerarg,src,include |
-------------+---------------------------+--------------------------+
-scalac001 | srcdir,classpath (1) | |
-scalac002 | srcref,classpathref (1) | |
-scalac003 | (2) | src,include |
-scalac004 | deprecation,unchecked (3) | |
-------------+---------------------------+--------------------------+
-scaladoc | srcdir,classpathref | |
-------------+---------------------------+--------------------------+
-
-Other attributes:
-(1) includes,destdir
-(2) destdir,classpathref
-(3) srcdir,includes,destdir,classpath
-
-
-The above test cases can also be run from the command prompt using one of
-the following shell commands:
-
-1) For quick/pack/latest binaries (-Dbinary=quick|pack|latest)
-
-$ ant -Dbinary=quick -Dproject.dir=$HOME/workspace/scala -f scalac001-build.xml
-
-2) For installed binaries (-Dbinary=installed)
-
-$ ant -Dbinary=installed -Dinstalled.dir=/opt/scala -f scalac001-build.xml
-
diff --git a/test/files/ant/fsc001-build.check b/test/files/ant/fsc001-build.check
deleted file mode 100644
index b5141f587b..0000000000
--- a/test/files/ant/fsc001-build.check
+++ /dev/null
@@ -1,14 +0,0 @@
-
-quick.init:
-
-pack.init:
-
-latest.init:
-
-installed.init:
-
-init:
-
-build:
- [mkdir] Created dir: [...]/files/ant/fsc001-ant.obj
- [fsc] Compiling 1 source file to [...]/files/ant/fsc001-ant.obj
diff --git a/test/files/ant/fsc001-build.xml b/test/files/ant/fsc001-build.xml
deleted file mode 100644
index 0130f3615c..0000000000
--- a/test/files/ant/fsc001-build.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="fsc001" default="run">
-
- <import file="${basedir}/imported.xml"/>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="init">
- <echo level="verbose" message="build.dir=${build.dir}"/>
- <mkdir dir="${build.dir}"/>
- <pathconvert property="classpath" refid="build.classpath"/>
- <fsc
- srcdir="${source.dir}"
- includes="**/${ant.project.name}*.scala"
- destdir="${build.dir}"
- classpath="${classpath}">
- </fsc>
- <echo level="verbose" message="log.file=${log.file}"/>
- <replace file="${log.file}" token="${log.dir}" value="[...]/files/ant"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/fsc001.scala b/test/files/ant/fsc001.scala
deleted file mode 100644
index 6ede5981ce..0000000000
--- a/test/files/ant/fsc001.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-package test
-
-object Main {
- def main(args: Array[String]) {
- println(args mkString " ")
- }
-}
diff --git a/test/files/ant/fsc002-build.check b/test/files/ant/fsc002-build.check
deleted file mode 100644
index 0c9c30dbfa..0000000000
--- a/test/files/ant/fsc002-build.check
+++ /dev/null
@@ -1,14 +0,0 @@
-
-quick.init:
-
-pack.init:
-
-latest.init:
-
-installed.init:
-
-init:
-
-build:
- [mkdir] Created dir: [...]/files/ant/fsc002-ant.obj
- [fsc] Compiling 1 source file to [...]/files/ant/fsc002-ant.obj
diff --git a/test/files/ant/fsc002-build.xml b/test/files/ant/fsc002-build.xml
deleted file mode 100644
index db91070fa1..0000000000
--- a/test/files/ant/fsc002-build.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="fsc002" default="run">
-
- <import file="${basedir}/imported.xml"/>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="init">
- <echo level="verbose" message="build.dir=${build.dir}"/>
- <mkdir dir="${build.dir}"/>
- <path id="source.ref">
- <pathelement location="${source.dir}"/>
- </path>
- <fsc
- srcref="source.ref"
- includes="**/${ant.project.name}*.scala"
- destdir="${build.dir}"
- classpathref="build.classpath">
- </fsc>
- <echo level="verbose" message="log.file=${log.file}"/>
- <replace file="${log.file}" token="${log.dir}" value="[...]/files/ant"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/fsc002.scala b/test/files/ant/fsc002.scala
deleted file mode 100644
index 47131daac6..0000000000
--- a/test/files/ant/fsc002.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package test
-
-object Main {
- def main(args: Array[String]): Unit =
- Console.println(args.toList)
-}
diff --git a/test/files/ant/fsc003-build.check b/test/files/ant/fsc003-build.check
deleted file mode 100644
index c8c9ed857e..0000000000
--- a/test/files/ant/fsc003-build.check
+++ /dev/null
@@ -1,14 +0,0 @@
-
-quick.init:
-
-pack.init:
-
-latest.init:
-
-installed.init:
-
-init:
-
-build:
- [mkdir] Created dir: [...]/files/ant/fsc003-ant.obj
- [fsc] Compiling 1 source file to [...]/files/ant/fsc003-ant.obj
diff --git a/test/files/ant/fsc003-build.xml b/test/files/ant/fsc003-build.xml
deleted file mode 100644
index 5f71770bf2..0000000000
--- a/test/files/ant/fsc003-build.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="fsc003" default="run">
-
- <import file="${basedir}/imported.xml"/>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="init">
- <echo level="verbose" message="build.dir=${build.dir}"/>
- <mkdir dir="${build.dir}"/>
- <fsc
- destdir="${build.dir}"
- classpathref="build.classpath">
- <src path="${source.dir}"/>
- <include name="**/${ant.project.name}*.scala"/>
- </fsc>
- <echo level="verbose" message="log.file=${log.file}"/>
- <replace file="${log.file}" token="${log.dir}" value="[...]/files/ant"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/fsc003.scala b/test/files/ant/fsc003.scala
deleted file mode 100644
index 6ede5981ce..0000000000
--- a/test/files/ant/fsc003.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-package test
-
-object Main {
- def main(args: Array[String]) {
- println(args mkString " ")
- }
-}
diff --git a/test/files/ant/imported.xml b/test/files/ant/imported.xml
deleted file mode 100644
index 182c80aadf..0000000000
--- a/test/files/ant/imported.xml
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="imported">
-
- <!-- This file is imported by the main Ant script. -->
-
- <!-- Prevents system classpath from being used -->
- <property name="build.sysclasspath" value="ignore"/>
-
-<!-- ===========================================================================
-PROPERTIES
-============================================================================ -->
-
- <property name="source.dir" value="${basedir}"/>
-
- <property file="${basedir}/build.properties"/>
-
- <property name="build.dir" location="${source.dir}/${ant.project.name}-ant.obj"/>
- <property name="log.dir" location="${source.dir}"/>
- <property name="log.file" value="${log.dir}/${ant.project.name}-build-ant.log"/>
- <property name="project.dir" value="../../.."/>
-
- <condition property="quick.binary">
- <equals arg1="${binary}" arg2="quick"/>
- </condition>
- <condition property="pack.binary">
- <equals arg1="${binary}" arg2="pack"/>
- </condition>
- <condition property="latest.binary">
- <equals arg1="${binary}" arg2="latest"/>
- </condition>
- <condition property="installed.binary">
- <equals arg1="${binary}" arg2="installed"/>
- </condition>
-
- <fail message="Property 'binary' must be set to either 'quick', 'pack', 'latest' or 'installed'.">
- <condition><not><or>
- <isset property="quick.binary"/>
- <isset property="pack.binary"/>
- <isset property="latest.binary"/>
- <isset property="installed.binary"/>
- </or></not></condition>
- </fail>
- <echo level="verbose" message="binary=${binary}"/>
- <echo level="verbose" message="build.dir=${build.dir}"/>
-
-<!-- ===========================================================================
-INITIALISATION
-============================================================================ -->
-
- <target name="quick.init" if="quick.binary">
- <property name="quick.dir" value="${project.dir}/build/quick"/>
- <fail message="Quick build could not be found.">
- <condition><not><available file="${quick.dir}"/></not></condition>
- </fail>
- <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/"/>
- </target>
-
- <target name="pack.init" if="pack.binary">
- <property name="pack.dir" value="${project.dir}/build/pack"/>
- <fail message="Pack build could not be found.">
- <condition><not><available file="${pack.dir}"/></not></condition>
- </fail>
- <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"/>
- </target>
-
- <target name="latest.init" if="latest.binary">
- <property name="latest.dir" value="${project.dir}/dists/latest"/>
- <fail message="Latest build could not be found.">
- <condition><not><available file="${latest.dir}"/></not></condition>
- </fail>
- <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"/>
- </target>
-
- <target name="installed.init" if="installed.binary">
- <property name="installed.dir" value="/opt/scala"/>
- <fail message="Installed distribution could not be found.">
- <condition><not><available file="${installed.dir}"/></not></condition>
- </fail>
- <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"/>
- </target>
-
- <target name="init" depends="quick.init, pack.init, latest.init, installed.init">
- <echo level="verbose" message="scala.dir=${scala.dir}"/>
-
- <path id="scala.classpath">
- <pathelement location="${scala-library.lib}"/>
- <pathelement location="${scala-compiler.lib}"/>
- </path>
-
- <fail message="Scala library '${scala-library.lib}' or '${scala-compiler.lib}' is missing/broken">
- <condition><not><and>
- <available classname="scala.Predef"
- classpathref="scala.classpath"/>
- <available classname="scala.Option"
- classpathref="scala.classpath"/>
- <available classname="scala.runtime.ObjectRef"
- classpathref="scala.classpath"/>
- <available classname="scala.tools.ant.Scalac"
- classpathref="scala.classpath"/>
- <available classname="scala.tools.nsc.Main"
- classpathref="scala.classpath"/>
- <available classname="scala.tools.util.StringOps"
- classpathref="scala.classpath"/>
- </and></not></condition>
- </fail>
- <taskdef resource="scala/tools/ant/antlib.xml" classpathref="scala.classpath"/>
-
- <path id="build.classpath">
- <!--<pathelement location="${scala-actors.lib}"/>-->
- <pathelement location="${scala-library.lib}"/>
- <pathelement location="${build.dir}"/>
- </path>
-
- <!-- make sure the log file exists when the Ant build scripts -->
- <!-- are run manually from the command prompt -->
- <touch file="${log.file}"/>
- </target>
-
-<!-- ===========================================================================
-RUN
-============================================================================ -->
-
- <target name="run" depends="build, clean"/>
-
-<!-- ===========================================================================
-CLEAN
-============================================================================ -->
-
- <macrodef name="remove">
- <attribute name="dir"/>
- <sequential>
- <delete dir="@{dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
- </sequential>
- </macrodef>
-
- <target name="clean">
- <remove dir="${build.dir}"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/scalac001-build.check b/test/files/ant/scalac001-build.check
deleted file mode 100644
index 05a43ba572..0000000000
--- a/test/files/ant/scalac001-build.check
+++ /dev/null
@@ -1,14 +0,0 @@
-
-quick.init:
-
-pack.init:
-
-latest.init:
-
-installed.init:
-
-init:
-
-build:
- [mkdir] Created dir: [...]/files/ant/scalac001-ant.obj
- [scalac] Compiling 1 source file to [...]/files/ant/scalac001-ant.obj
diff --git a/test/files/ant/scalac001-build.xml b/test/files/ant/scalac001-build.xml
deleted file mode 100644
index 4ec7fc833c..0000000000
--- a/test/files/ant/scalac001-build.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="scalac001" default="run">
-
- <import file="${basedir}/imported.xml"/>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="init">
- <echo level="verbose" message="build.dir=${build.dir}"/>
- <mkdir dir="${build.dir}"/>
- <pathconvert property="classpath" refid="build.classpath"/>
- <scalac
- srcdir="${source.dir}"
- includes="**/${ant.project.name}*.scala"
- destdir="${build.dir}"
- classpath="${classpath}"
- />
- <echo level="verbose" message="log.file=${log.file}"/>
- <replace file="${log.file}" token="${log.dir}" value="[...]/files/ant"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/scalac001.scala b/test/files/ant/scalac001.scala
deleted file mode 100644
index 47131daac6..0000000000
--- a/test/files/ant/scalac001.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-package test
-
-object Main {
- def main(args: Array[String]): Unit =
- Console.println(args.toList)
-}
diff --git a/test/files/ant/scalac002-build.check b/test/files/ant/scalac002-build.check
deleted file mode 100644
index e7b3670a0c..0000000000
--- a/test/files/ant/scalac002-build.check
+++ /dev/null
@@ -1,14 +0,0 @@
-
-quick.init:
-
-pack.init:
-
-latest.init:
-
-installed.init:
-
-init:
-
-build:
- [mkdir] Created dir: [...]/files/ant/scalac002-ant.obj
- [scalac] Compiling 1 source file to [...]/files/ant/scalac002-ant.obj
diff --git a/test/files/ant/scalac002-build.xml b/test/files/ant/scalac002-build.xml
deleted file mode 100644
index 07628afa64..0000000000
--- a/test/files/ant/scalac002-build.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="scalac002" default="run">
-
- <import file="${basedir}/imported.xml"/>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="init">
- <echo level="verbose" message="build.dir=${build.dir}"/>
- <mkdir dir="${build.dir}"/>
- <path id="source.ref">
- <pathelement location="${source.dir}"/>
- </path>
- <scalac
- srcref="source.ref"
- includes="**/${ant.project.name}*.scala"
- destdir="${build.dir}"
- classpathref="build.classpath"
- />
- <echo level="verbose" message="log.file=${log.file}"/>
- <replace file="${log.file}" token="${log.dir}" value="[...]/files/ant"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/scalac002.scala b/test/files/ant/scalac002.scala
deleted file mode 100644
index 6ede5981ce..0000000000
--- a/test/files/ant/scalac002.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-package test
-
-object Main {
- def main(args: Array[String]) {
- println(args mkString " ")
- }
-}
diff --git a/test/files/ant/scalac003-build.check b/test/files/ant/scalac003-build.check
deleted file mode 100644
index 7b0d3367ed..0000000000
--- a/test/files/ant/scalac003-build.check
+++ /dev/null
@@ -1,14 +0,0 @@
-
-quick.init:
-
-pack.init:
-
-latest.init:
-
-installed.init:
-
-init:
-
-build:
- [mkdir] Created dir: [...]/files/ant/scalac003-ant.obj
- [scalac] Compiling 1 source file to [...]/files/ant/scalac003-ant.obj
diff --git a/test/files/ant/scalac003-build.xml b/test/files/ant/scalac003-build.xml
deleted file mode 100644
index 1d70aa115e..0000000000
--- a/test/files/ant/scalac003-build.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="scalac003" default="run">
-
- <import file="${basedir}/imported.xml"/>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="init">
- <echo level="verbose" message="build.dir=${build.dir}"/>
- <mkdir dir="${build.dir}"/>
- <scalac
- destdir="${build.dir}"
- classpathref="build.classpath">
- <src path="${source.dir}"/>
- <include name="**/${ant.project.name}*.scala"/>
- </scalac>
- <echo level="verbose" message="log.file=${log.file}"/>
- <replace file="${log.file}" token="${log.dir}" value="[...]/files/ant"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/scalac003.scala b/test/files/ant/scalac003.scala
deleted file mode 100644
index 6ede5981ce..0000000000
--- a/test/files/ant/scalac003.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-package test
-
-object Main {
- def main(args: Array[String]) {
- println(args mkString " ")
- }
-}
diff --git a/test/files/ant/scalac004-build.check b/test/files/ant/scalac004-build.check
deleted file mode 100644
index ffe9e8c79a..0000000000
--- a/test/files/ant/scalac004-build.check
+++ /dev/null
@@ -1,24 +0,0 @@
-
-quick.init:
-
-pack.init:
-
-latest.init:
-
-installed.init:
-
-init:
-
-build:
- [mkdir] Created dir: [...]/files/ant/scalac004-ant.obj
- [scalac] Compiling 1 source file to [...]/files/ant/scalac004-ant.obj
- [scalac] [...]/files/ant/scalac004.scala:9: warning: method exit in object Predef is deprecated: Use sys.exit(status) instead
- [scalac] Predef.exit(0) //deprecated in 2.9.0
- [scalac] ^
- [scalac] [...]/files/ant/scalac004.scala:6: warning: match is not exhaustive!
- [scalac] missing combination Nil
- [scalac]
- [scalac] xs match { //(xs: @unchecked) match {
- [scalac] ^
- [scalac] two warnings found
- [scalac] Compile succeeded with 2 warnings; see the compiler output for details.
diff --git a/test/files/ant/scalac004-build.xml b/test/files/ant/scalac004-build.xml
deleted file mode 100644
index 66c19a39fb..0000000000
--- a/test/files/ant/scalac004-build.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="scalac004" default="run">
-
- <import file="${basedir}/imported.xml"/>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="init">
- <echo level="verbose" message="build.dir=${build.dir}"/>
- <mkdir dir="${build.dir}"/>
- <scalac
- deprecation="yes" unchecked="yes"
- srcdir="${source.dir}"
- includes="**/${ant.project.name}*.scala"
- destdir="${build.dir}"
- classpathref="build.classpath"
- />
- <echo level="verbose" message="log.file=${log.file}"/>
- <replace file="${log.file}" token="${log.dir}" value="[...]/files/ant"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/scalac004.scala b/test/files/ant/scalac004.scala
deleted file mode 100644
index 66b2ba7985..0000000000
--- a/test/files/ant/scalac004.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-package test
-
-object Main {
- def main(args: Array[String]) {
- val xs = List(1, 2, 3, 4)
- xs match { //(xs: @unchecked) match {
- case x::xs => println(x)
- }
- Predef.exit(0) //deprecated in 2.9.0
- }
-}
diff --git a/test/files/ant/scaladoc-build.check b/test/files/ant/scaladoc-build.check
deleted file mode 100644
index 1c82456ad0..0000000000
--- a/test/files/ant/scaladoc-build.check
+++ /dev/null
@@ -1,15 +0,0 @@
-
-quick.init:
-
-pack.init:
-
-latest.init:
-
-installed.init:
-
-init:
-
-build:
- [mkdir] Created dir: [...]/files/ant/scaladoc-ant.obj
- [scaladoc] Documenting 1 source file to [...]/files/ant/scaladoc-ant.obj
- [scaladoc] model contains 3 documentable templates
diff --git a/test/files/ant/scaladoc-build.xml b/test/files/ant/scaladoc-build.xml
deleted file mode 100644
index fb4dc6fe69..0000000000
--- a/test/files/ant/scaladoc-build.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project name="scaladoc" default="run">
-
- <import file="${basedir}/imported.xml"/>
-
-<!-- ===========================================================================
-BUILD
-============================================================================ -->
-
- <target name="build" depends="init">
- <echo level="verbose" message="build.dir=${build.dir}"/>
- <mkdir dir="${build.dir}"/>
- <scaladoc
- srcdir="${source.dir}"
- includes="**/${ant.project.name}*.scala"
- deprecation="yes" unchecked="yes"
- destdir="${build.dir}"
- classpathref="build.classpath"
- />
- <echo level="verbose" message="log.file=${log.file}"/>
- <replace file="${log.file}" token="${log.dir}" value="[...]/files/ant"/>
- </target>
-
-</project>
-
diff --git a/test/files/ant/scaladoc.scala b/test/files/ant/scaladoc.scala
deleted file mode 100644
index 6ede5981ce..0000000000
--- a/test/files/ant/scaladoc.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-package test
-
-object Main {
- def main(args: Array[String]) {
- println(args mkString " ")
- }
-}
diff --git a/test/files/jvm/opt_value_class.check b/test/files/jvm/opt_value_class.check
new file mode 100644
index 0000000000..a0c18c5ca0
--- /dev/null
+++ b/test/files/jvm/opt_value_class.check
@@ -0,0 +1,2 @@
+[ok] <init> ()V public
+[ok] unapply (Ljava/lang/Object;)Ljava/lang/String; public (Ljava/lang/Object;)Ljava/lang/String;
diff --git a/test/files/jvm/opt_value_class/Value_1.scala b/test/files/jvm/opt_value_class/Value_1.scala
new file mode 100644
index 0000000000..2440609b9e
--- /dev/null
+++ b/test/files/jvm/opt_value_class/Value_1.scala
@@ -0,0 +1,28 @@
+final class Opt[+A >: Null](val value: A) extends AnyVal {
+ def get: A = value
+ def isEmpty = value == null
+}
+object Opt {
+ final val None = new Opt[Null](null)
+ def unapply[A >: Null](x: A): Opt[A] = if (x == null) None else Opt(x)
+ def empty[A >: Null] = None
+ def apply[A >: Null](value: A): Opt[A] = if (value == null) None else new Opt[A](value)
+}
+
+class ValueExtract {
+ def unapply(x: Any): Opt[String] = x match {
+ case _: String => Opt("String")
+ case _: List[_] => Opt("List")
+ case _: Int => Opt("Int")
+ case _ => Opt.None
+ }
+}
+
+class Direct {
+ def unapply(x: Any): String = x match {
+ case _: String => "String"
+ case _: List[_] => "List"
+ case _: Int => "Int"
+ case _ => null
+ }
+}
diff --git a/test/files/jvm/opt_value_class/test.scala b/test/files/jvm/opt_value_class/test.scala
new file mode 100644
index 0000000000..7aea7deb99
--- /dev/null
+++ b/test/files/jvm/opt_value_class/test.scala
@@ -0,0 +1,16 @@
+import scala.tools.partest.BytecodeTest
+
+// import scala.tools.nsc.util.JavaClassPath
+// import java.io.InputStream
+// import scala.tools.asm
+// import asm.ClassReader
+// import asm.tree.{ClassNode, InsnList}
+// import scala.collection.JavaConverters._
+
+object Test extends BytecodeTest {
+ def show: Unit = {
+ val classNode1 = loadClassNode("ValueExtract")
+ val classNode2 = loadClassNode("Direct")
+ sameMethodAndFieldDescriptors(classNode1, classNode2)
+ }
+}
diff --git a/test/files/lib/scalacheck.jar.desired.sha1 b/test/files/lib/scalacheck.jar.desired.sha1
deleted file mode 100644
index 2f15402d18..0000000000
--- a/test/files/lib/scalacheck.jar.desired.sha1
+++ /dev/null
@@ -1 +0,0 @@
-b6f4dbb29f0c2ec1eba682414f60d52fea84f703 *scalacheck.jar
diff --git a/test/files/neg/compile-time-only-a.check b/test/files/neg/compile-time-only-a.check
new file mode 100644
index 0000000000..1c4c72171f
--- /dev/null
+++ b/test/files/neg/compile-time-only-a.check
@@ -0,0 +1,49 @@
+compile-time-only-a.scala:9: error: C3
+@compileTimeOnly("C3") case class C3(x: Int)
+ ^
+compile-time-only-a.scala:11: error: C4
+@compileTimeOnly("C4") case class C4(x: Int)
+ ^
+compile-time-only-a.scala:16: error: C5
+ implicit class C5(val x: Int) {
+ ^
+compile-time-only-a.scala:28: error: C1
+ new C1()
+ ^
+compile-time-only-a.scala:32: error: C2
+ C2
+ ^
+compile-time-only-a.scala:34: error: C3
+ new C3(2)
+ ^
+compile-time-only-a.scala:37: error: C4
+ new C4(2)
+ ^
+compile-time-only-a.scala:41: error: C5
+ 2.ext
+ ^
+compile-time-only-a.scala:42: error: C5
+ C5(2)
+ ^
+compile-time-only-a.scala:45: error: C6.x
+ val _ = c6.x
+ ^
+compile-time-only-a.scala:46: error: C6.foo
+ c6.foo
+ ^
+compile-time-only-a.scala:48: error: C6.y
+ c6.y = c6.y
+ ^
+compile-time-only-a.scala:48: error: C6.y
+ c6.y = c6.y
+ ^
+compile-time-only-a.scala:54: error: placebo
+@placebo
+ ^
+compile-time-only-a.scala:56: error: placebo
+ @placebo def x = (2: @placebo)
+ ^
+compile-time-only-a.scala:56: error: placebo
+ @placebo def x = (2: @placebo)
+ ^
+16 errors found
diff --git a/test/files/neg/compile-time-only-a.scala b/test/files/neg/compile-time-only-a.scala
new file mode 100644
index 0000000000..43d36dfab1
--- /dev/null
+++ b/test/files/neg/compile-time-only-a.scala
@@ -0,0 +1,57 @@
+import scala.annotation.compileTimeOnly
+
+@compileTimeOnly("C1") class C1
+object C1
+
+class C2
+@compileTimeOnly("C2") object C2
+
+@compileTimeOnly("C3") case class C3(x: Int)
+
+@compileTimeOnly("C4") case class C4(x: Int)
+object C4
+
+object pkg {
+ @compileTimeOnly("C5")
+ implicit class C5(val x: Int) {
+ def ext = ???
+ }
+}
+
+class C6(@compileTimeOnly("C6.x") val x: Int) {
+ @compileTimeOnly("C6.foo") def foo = 2
+ @compileTimeOnly("C6.Foo") type Foo = Int
+ @compileTimeOnly("C6.y") var y = 3
+}
+
+object Test extends App {
+ new C1()
+ C1
+
+ new C2()
+ C2
+
+ new C3(2)
+ C3(2)
+
+ new C4(2)
+ C4(2)
+
+ import pkg._
+ 2.ext
+ C5(2)
+
+ val c6 = new C6(2)
+ val _ = c6.x
+ c6.foo
+ type Foo = c6.Foo
+ c6.y = c6.y
+}
+
+@compileTimeOnly("placebo")
+class placebo extends scala.annotation.StaticAnnotation
+
+@placebo
+class Test {
+ @placebo def x = (2: @placebo)
+} \ No newline at end of file
diff --git a/test/files/neg/compile-time-only-b.check b/test/files/neg/compile-time-only-b.check
new file mode 100644
index 0000000000..8292a0ddeb
--- /dev/null
+++ b/test/files/neg/compile-time-only-b.check
@@ -0,0 +1,7 @@
+compile-time-only-b.scala:13: error: splice must be enclosed within a reify {} block
+ val ignored3 = reify(fortyTwo).splice
+ ^
+compile-time-only-b.scala:14: error: cannot use value except for signatures of macro implementations
+ val ignored4 = reify(fortyTwo).value
+ ^
+two errors found
diff --git a/test/files/neg/compile-time-only-b.scala b/test/files/neg/compile-time-only-b.scala
new file mode 100644
index 0000000000..d5568dbe67
--- /dev/null
+++ b/test/files/neg/compile-time-only-b.scala
@@ -0,0 +1,15 @@
+import scala.reflect.runtime.universe._
+
+object Test extends App {
+ // HAHA!!!
+ // no compileTimeOnly errors here, because scalac does constant folding
+ // the type of reify(42) is Expr[42.type]
+ // therefore the type of expr.splice is 42.type, which is then constfolded
+ val expr = reify(42)
+ val ignored1 = expr.splice
+ val ignored2 = expr.value
+
+ val fortyTwo = 42
+ val ignored3 = reify(fortyTwo).splice
+ val ignored4 = reify(fortyTwo).value
+} \ No newline at end of file
diff --git a/test/files/neg/javac-error.check b/test/files/neg/javac-error.check
deleted file mode 100644
index e7d1ccc1a1..0000000000
--- a/test/files/neg/javac-error.check
+++ /dev/null
@@ -1,10 +0,0 @@
-#partest java6
-javac-error/J.java:2: method does not override or implement a method from a supertype
- @Override public void foo() { }
- ^
-1 error
-#partest java7
-javac-error/J.java:2: error: method does not override or implement a method from a supertype
- @Override public void foo() { }
- ^
-1 error
diff --git a/test/files/neg/t4425.check b/test/files/neg/t4425.check
index 0f2fe6f2d1..95b88a6b3d 100644
--- a/test/files/neg/t4425.check
+++ b/test/files/neg/t4425.check
@@ -1,4 +1,13 @@
-t4425.scala:3: error: isInstanceOf cannot test if value types are references.
+t4425.scala:3: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: Int)(y: Option[Int]): None.type exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
42 match { case _ X _ => () }
^
-one error found
+t4425.scala:8: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: Int)(y: Int): Some[(Int, Int)] exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ 42 match { case _ X _ => () }
+ ^
+t4425.scala:13: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: String)(y: String): Some[(Int, Int)] exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ "" match { case _ X _ => () }
+ ^
+three errors found
diff --git a/test/files/neg/t4425.scala b/test/files/neg/t4425.scala
index d8cc6922f7..1714955c27 100644
--- a/test/files/neg/t4425.scala
+++ b/test/files/neg/t4425.scala
@@ -2,3 +2,13 @@ object Foo {
object X { def unapply(x : Int)(y : Option[Int] = None) = None }
42 match { case _ X _ => () }
}
+
+object Foo2 {
+ object X { def unapply(x : Int)(y: Int) = Some((2,2)) }
+ 42 match { case _ X _ => () }
+}
+
+object Foo3 {
+ object X { def unapply(x : String)(y: String) = Some((2,2)) }
+ "" match { case _ X _ => () }
+} \ No newline at end of file
diff --git a/test/files/neg/t4425b.check b/test/files/neg/t4425b.check
new file mode 100644
index 0000000000..1186e8b609
--- /dev/null
+++ b/test/files/neg/t4425b.check
@@ -0,0 +1,61 @@
+t4425b.scala:5: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:6: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:7: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println( "" match { case X(_) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:8: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println((X: Any) match { case X(_) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:9: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:10: error: object X is not a case class constructor, nor does it have an unapply/unapplySeq method
+Note: def unapply(x: String)(y: String): Nothing exists in object X, but it cannot be used as an extractor due to its second non-implicit parameter list
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:18: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:19: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:22: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:22: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:23: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:23: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:31: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:32: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:35: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:35: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:36: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+t4425b.scala:36: error: wrong number of patterns for object X offering Nothing: expected 1, found 2
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ ^
+18 errors found
diff --git a/test/files/neg/t4425b.scala b/test/files/neg/t4425b.scala
new file mode 100644
index 0000000000..861e9521f6
--- /dev/null
+++ b/test/files/neg/t4425b.scala
@@ -0,0 +1,38 @@
+object Test1 {
+ object X { def unapply(x : String)(y: String) = throw new Exception }
+
+ def f1() {
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ println( "" match { case X(_) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_) => "ok" ; case _ => "fail" })
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ }
+}
+
+object Test2 {
+ object X { def unapply(x : String) = throw new Exception }
+
+ def f1() {
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ println( "" match { case X(_) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_) => "ok" ; case _ => "fail" })
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ }
+}
+
+object Test3 {
+ object X { def unapply(x : String) = None }
+
+ def f1() {
+ println( "" match { case _ X _ => "ok" ; case _ => "fail" })
+ println((X: Any) match { case _ X _ => "ok" ; case _ => "fail" })
+ println( "" match { case X(_) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_) => "ok" ; case _ => "fail" })
+ println( "" match { case X(_, _) => "ok" ; case _ => "fail" })
+ println((X: Any) match { case X(_, _) => "ok" ; case _ => "fail" })
+ }
+}
diff --git a/test/files/neg/t5903a.check b/test/files/neg/t5903a.check
new file mode 100644
index 0000000000..cbdcfd1bdd
--- /dev/null
+++ b/test/files/neg/t5903a.check
@@ -0,0 +1,7 @@
+Test_2.scala:4: error: wrong number of patterns for <$anon: AnyRef> offering (SomeTree.type, SomeTree.type): expected 2, found 3
+ case nq"$x + $y + $z" => println((x, y))
+ ^
+Test_2.scala:4: error: not found: value x
+ case nq"$x + $y + $z" => println((x, y))
+ ^
+two errors found
diff --git a/test/files/neg/t5903a/Macros_1.scala b/test/files/neg/t5903a/Macros_1.scala
new file mode 100644
index 0000000000..e82be0fc68
--- /dev/null
+++ b/test/files/neg/t5903a/Macros_1.scala
@@ -0,0 +1,28 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+trait Tree
+case object SomeTree extends Tree
+
+object NewQuasiquotes {
+ implicit class QuasiquoteInterpolation(c: StringContext) {
+ object nq {
+ def unapply(t: Tree) = macro QuasiquoteMacros.unapplyImpl
+ }
+ }
+}
+
+object QuasiquoteMacros {
+ def unapplyImpl(c: Context)(t: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = this
+ def _1 = SomeTree
+ def _2 = SomeTree
+ def unapply(t: Tree) = this
+ }.unapply($t)
+ """
+ }
+}
diff --git a/test/files/neg/t5903a/Test_2.scala b/test/files/neg/t5903a/Test_2.scala
new file mode 100644
index 0000000000..4d78dfb5e5
--- /dev/null
+++ b/test/files/neg/t5903a/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import NewQuasiquotes._
+ SomeTree match {
+ case nq"$x + $y + $z" => println((x, y))
+ }
+}
diff --git a/test/files/neg/t5903b.check b/test/files/neg/t5903b.check
new file mode 100644
index 0000000000..faeb73ad03
--- /dev/null
+++ b/test/files/neg/t5903b.check
@@ -0,0 +1,9 @@
+Test_2.scala:4: error: type mismatch;
+ found : Int
+ required: String
+ case t"$x" => println(x)
+ ^
+Test_2.scala:4: error: not found: value x
+ case t"$x" => println(x)
+ ^
+two errors found
diff --git a/test/files/neg/t5903b/Macros_1.scala b/test/files/neg/t5903b/Macros_1.scala
new file mode 100644
index 0000000000..b1b875969d
--- /dev/null
+++ b/test/files/neg/t5903b/Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply[T](x: T) = macro Macros.unapplyImpl[T]
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = "2"
+ def unapply(x: String) = this
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/neg/t5903b/Test_2.scala b/test/files/neg/t5903b/Test_2.scala
new file mode 100644
index 0000000000..0f6f80d327
--- /dev/null
+++ b/test/files/neg/t5903b/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 2 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/neg/t5903c.check b/test/files/neg/t5903c.check
new file mode 100644
index 0000000000..c9476edd11
--- /dev/null
+++ b/test/files/neg/t5903c.check
@@ -0,0 +1,7 @@
+Test_2.scala:4: error: String is not supported
+ case t"$x" => println(x)
+ ^
+Test_2.scala:4: error: not found: value x
+ case t"$x" => println(x)
+ ^
+two errors found
diff --git a/test/files/neg/t5903c/Macros_1.scala b/test/files/neg/t5903c/Macros_1.scala
new file mode 100644
index 0000000000..70efab3101
--- /dev/null
+++ b/test/files/neg/t5903c/Macros_1.scala
@@ -0,0 +1,26 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply[T](x: T) = macro Macros.unapplyImpl[T]
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
+ import c.universe._
+ if (!(c.weakTypeOf[Int] =:= c.weakTypeOf[T])) c.abort(c.enclosingPosition, s"${c.weakTypeOf[T]} is not supported")
+ else {
+ q"""
+ new {
+ def isEmpty = false
+ def get = 2
+ def unapply(x: Int) = this
+ }.unapply($x)
+ """
+ }
+ }
+}
diff --git a/test/files/neg/t5903c/Test_2.scala b/test/files/neg/t5903c/Test_2.scala
new file mode 100644
index 0000000000..a1fd31dd49
--- /dev/null
+++ b/test/files/neg/t5903c/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ "2" match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/neg/t5903d.check b/test/files/neg/t5903d.check
new file mode 100644
index 0000000000..d5d3fdcc28
--- /dev/null
+++ b/test/files/neg/t5903d.check
@@ -0,0 +1,7 @@
+Test_2.scala:4: error: extractor macros can only expand into extractor calls
+ case t"$x" => println(x)
+ ^
+Test_2.scala:4: error: not found: value x
+ case t"$x" => println(x)
+ ^
+two errors found
diff --git a/test/files/neg/t5903d/Macros_1.scala b/test/files/neg/t5903d/Macros_1.scala
new file mode 100644
index 0000000000..15ff226cff
--- /dev/null
+++ b/test/files/neg/t5903d/Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply(x: Int) = macro Macros.unapplyImpl
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ new { def unapply(x: Int) = new Match(x) }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/neg/t5903d/Test_2.scala b/test/files/neg/t5903d/Test_2.scala
new file mode 100644
index 0000000000..95c717a9d8
--- /dev/null
+++ b/test/files/neg/t5903d/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 42 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/neg/t5903e.check b/test/files/neg/t5903e.check
new file mode 100644
index 0000000000..3bdeb091a0
--- /dev/null
+++ b/test/files/neg/t5903e.check
@@ -0,0 +1,4 @@
+Test_2.scala:4: error: value class may not be a member of another class
+ case t"$x" => println(x)
+ ^
+one error found
diff --git a/test/files/neg/t5903e/Macros_1.scala b/test/files/neg/t5903e/Macros_1.scala
new file mode 100644
index 0000000000..4e1ce89c9f
--- /dev/null
+++ b/test/files/neg/t5903e/Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply(x: Int) = macro Macros.unapplyImpl
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ class Match(x: Int) extends AnyVal {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/neg/t5903e/Test_2.scala b/test/files/neg/t5903e/Test_2.scala
new file mode 100644
index 0000000000..d69d472436
--- /dev/null
+++ b/test/files/neg/t5903e/Test_2.scala
@@ -0,0 +1,6 @@
+class C {
+ import Interpolation._
+ 42 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/neg/t6289.check b/test/files/neg/t6289.check
new file mode 100644
index 0000000000..f6f43cabd3
--- /dev/null
+++ b/test/files/neg/t6289.check
@@ -0,0 +1,10 @@
+#partest java6
+t6289/J.java:2: method does not override or implement a method from a supertype
+ @Override public void foo() { }
+ ^
+1 error
+#partest java7
+t6289/J.java:2: error: method does not override or implement a method from a supertype
+ @Override public void foo() { }
+ ^
+1 error
diff --git a/test/files/neg/javac-error.flags b/test/files/neg/t6289.flags
index 85d8eb2ba2..85d8eb2ba2 100644
--- a/test/files/neg/javac-error.flags
+++ b/test/files/neg/t6289.flags
diff --git a/test/files/neg/javac-error/J.java b/test/files/neg/t6289/J.java
index 83f50c9ae2..83f50c9ae2 100644
--- a/test/files/neg/javac-error/J.java
+++ b/test/files/neg/t6289/J.java
diff --git a/test/files/neg/javac-error/SUT_5.scala b/test/files/neg/t6289/SUT_5.scala
index 0a996352c0..0a996352c0 100644
--- a/test/files/neg/javac-error/SUT_5.scala
+++ b/test/files/neg/t6289/SUT_5.scala
diff --git a/test/files/neg/t6675.check b/test/files/neg/t6675.check
index 3a277af866..aecf04cb68 100644
--- a/test/files/neg/t6675.check
+++ b/test/files/neg/t6675.check
@@ -1,4 +1,4 @@
-t6675.scala:10: warning: extractor pattern binds a single value to a Product3 of type (Int, Int, Int)
+t6675.scala:10: warning: object X expects 3 patterns to hold (Int, Int, Int) but crushing into 3-tuple to fit single pattern (SI-6675)
"" 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.
diff --git a/test/files/neg/t7214neg.check b/test/files/neg/t7214neg.check
new file mode 100644
index 0000000000..0660cccd02
--- /dev/null
+++ b/test/files/neg/t7214neg.check
@@ -0,0 +1,7 @@
+t7214neg.scala:28: error: wrong number of patterns for object Extractor offering Any: expected 1, found 0
+ case Extractor() =>
+ ^
+t7214neg.scala:28: error: wrong number of patterns for object Extractor offering Any: expected 1, found 0
+ case Extractor() =>
+ ^
+two errors found
diff --git a/test/files/neg/t7214neg.scala b/test/files/neg/t7214neg.scala
new file mode 100644
index 0000000000..ff1ea8082d
--- /dev/null
+++ b/test/files/neg/t7214neg.scala
@@ -0,0 +1,57 @@
+// pattern matcher crashes here trying to synthesize an uneeded outer test.
+// no-symbol does not have an owner
+// at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:49)
+// at scala.tools.nsc.Global.abort(Global.scala:253)
+// at scala.reflect.internal.Symbols$NoSymbol.owner(Symbols.scala:3248)
+// at scala.reflect.internal.Symbols$Symbol.effectiveOwner(Symbols.scala:678)
+// at scala.reflect.internal.Symbols$Symbol.isDefinedInPackage(Symbols.scala:664)
+// at scala.reflect.internal.TreeGen.mkAttributedSelect(TreeGen.scala:188)
+// at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:124)
+// at scala.tools.nsc.ast.TreeDSL$CODE$.REF(TreeDSL.scala:308)
+// at scala.tools.nsc.typechecker.PatternMatching$TreeMakers$TypeTestTreeMaker$treeCondStrategy$.outerTest(PatternMatching.scala:1209)
+class Crash {
+ type Alias = C#T
+
+ val c = new C
+ val t = new c.T
+
+ // Crash via a Typed Pattern...
+ (t: Any) match {
+ case e: Alias =>
+ }
+
+ // ... or via a Typed Extractor Pattern.
+ object Extractor {
+ def unapply(a: Alias): Option[Any] = None
+ }
+ (t: Any) match {
+ case Extractor() =>
+ case _ =>
+ }
+
+ // checking that correct outer tests are applied when
+ // aliases for path dependent types are involved.
+ val c2 = new C
+ type CdotT = c.T
+ type C2dotT = c2.T
+
+ val outerField = t.getClass.getDeclaredFields.find(_.getName contains ("outer")).get
+ outerField.setAccessible(true)
+
+ (t: Any) match {
+ case _: C2dotT =>
+ println(s"!!! wrong match. t.outer=${outerField.get(t)} / c2 = $c2") // this matches on 2.10.0
+ case _: CdotT =>
+ case _ =>
+ println(s"!!! wrong match. t.outer=${outerField.get(t)} / c = $c")
+ }
+}
+
+class C {
+ class T
+}
+
+object Test extends App {
+ new Crash
+}
+
diff --git a/test/files/neg/t7721.check b/test/files/neg/t7721.check
new file mode 100644
index 0000000000..e056b9a293
--- /dev/null
+++ b/test/files/neg/t7721.check
@@ -0,0 +1,21 @@
+t7721.scala:11: warning: abstract type pattern A.this.Foo is unchecked since it is eliminated by erasure
+ case x: Foo with Concrete => x.bippy + x.conco
+ ^
+t7721.scala:15: warning: abstract type pattern A.this.Foo is unchecked since it is eliminated by erasure
+ case x: Concrete with Foo => x.bippy + x.conco
+ ^
+t7721.scala:19: warning: abstract type pattern A.this.Foo is unchecked since it is eliminated by erasure
+ case x: Foo with Bar => x.bippy + x.barry
+ ^
+t7721.scala:39: warning: abstract type pattern B.this.Foo is unchecked since it is eliminated by erasure
+ case x: Foo with Concrete => x.bippy + x.dingo + x.conco
+ ^
+t7721.scala:43: warning: abstract type pattern B.this.Foo is unchecked since it is eliminated by erasure
+ case x: Concrete with Foo => x.bippy + x.dingo + x.conco
+ ^
+t7721.scala:47: warning: abstract type pattern B.this.Foo is unchecked since it is eliminated by erasure
+ case x: Foo with Bar with Concrete => x.bippy + x.barry + x.dingo + x.conco + x.bongo
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+6 warnings found
+one error found
diff --git a/test/files/neg/t7721.flags b/test/files/neg/t7721.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t7721.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7721.scala b/test/files/neg/t7721.scala
new file mode 100644
index 0000000000..27884c9e35
--- /dev/null
+++ b/test/files/neg/t7721.scala
@@ -0,0 +1,140 @@
+import scala.language.reflectiveCalls
+
+trait A {
+ trait Concrete { def conco: Int = 1 }
+ type Foo <: { def bippy: Int }
+ type Bar <: { def barry: Int }
+
+ implicit def barTag: scala.reflect.ClassTag[Bar]
+
+ def f1(x: Any) = x match {
+ case x: Foo with Concrete => x.bippy + x.conco
+ case _ => -1
+ }
+ def f2(x: Any) = x match {
+ case x: Concrete with Foo => x.bippy + x.conco
+ case _ => -1
+ }
+ def f3(x: Any) = x match {
+ case x: Foo with Bar => x.bippy + x.barry
+ case _ => -1
+ }
+ def f4(x: Any) = x match {
+ case x: (Foo @unchecked) => x.bippy // warns, suppressed
+ case _ => -1
+ }
+ def f5(x: Any) = x match {
+ case x: (Bar @unchecked) => x.barry // warns (but about the "outer reference"), suppressed
+ case _ => -1
+ }
+}
+
+trait B extends A {
+ type Foo <: { def bippy: Int ; def dingo: Int }
+ type Bar <: { def barry: Int ; def bongo: Int }
+
+ override implicit def barTag: scala.reflect.ClassTag[Bar]
+
+ override def f1(x: Any) = x match {
+ case x: Foo with Concrete => x.bippy + x.dingo + x.conco
+ case _ => -1
+ }
+ override def f2(x: Any) = x match {
+ case x: Concrete with Foo => x.bippy + x.dingo + x.conco
+ case _ => -1
+ }
+ override def f3(x: Any) = x match {
+ case x: Foo with Bar with Concrete => x.bippy + x.barry + x.dingo + x.conco + x.bongo
+ case _ => -1
+ }
+ override def f4(x: Any) = x match {
+ case x: (Foo @unchecked) => x.bippy + x.dingo // warns, suppressed
+ case _ => -1
+ }
+ override def f5(x: Any) = x match {
+ case x: (Bar @unchecked) => x.barry + x.bongo // warns (but about the "outer reference"), suppressed
+ case _ => -1
+ }
+}
+
+object Test {
+ abstract class Base extends A {
+ trait Foo {
+ def bippy = 2
+ def dingo = 3
+ }
+ trait Bar {
+ def barry = 2
+ def bongo = 3
+ }
+ implicit def barTag: scala.reflect.ClassTag[Bar] = scala.reflect.ClassTag(classOf[Bar])
+
+ def run() {
+ println("f1")
+ wrap(f1(new Concrete {}))
+ wrap(f1(new Foo {}))
+ wrap(f1(new Bar {}))
+ wrap(f1(new Foo with Concrete {}))
+ wrap(f1(new Concrete with Foo {}))
+
+ println("\nf2")
+ wrap(f2(new Concrete {}))
+ wrap(f2(new Foo {}))
+ wrap(f2(new Bar {}))
+ wrap(f2(new Foo with Concrete {}))
+ wrap(f2(new Concrete with Foo {}))
+ wrap(f2(new Bar with Concrete {}))
+ wrap(f2(new Concrete with Bar {}))
+ wrap(f2(new Concrete with Foo with Bar {}))
+ wrap(f2(new Foo with Bar with Concrete {}))
+
+ println("\nf3")
+ wrap(f3(new Concrete {}))
+ wrap(f3(new Foo {}))
+ wrap(f3(new Bar {}))
+ wrap(f3(new Foo with Concrete {}))
+ wrap(f3(new Concrete with Foo {}))
+ wrap(f3(new Bar with Concrete {}))
+ wrap(f3(new Concrete with Bar {}))
+ wrap(f3(new Concrete with Foo with Bar {}))
+ wrap(f3(new Foo with Bar with Concrete {}))
+
+ println("\nf4")
+ wrap(f4(new Concrete {}))
+ wrap(f4(new Foo {}))
+ wrap(f4(new Bar {}))
+ wrap(f4(new Foo with Concrete {}))
+ wrap(f4(new Concrete with Foo {}))
+ wrap(f4(new Bar with Concrete {}))
+ wrap(f4(new Concrete with Bar {}))
+ wrap(f4(new Concrete with Foo with Bar {}))
+ wrap(f4(new Foo with Bar with Concrete {}))
+
+ println("\nf5")
+ wrap(f5(new Concrete {}))
+ wrap(f5(new Foo {}))
+ wrap(f5(new Bar {}))
+ wrap(f5(new Foo with Concrete {}))
+ wrap(f5(new Concrete with Foo {}))
+ wrap(f5(new Bar with Concrete {}))
+ wrap(f5(new Concrete with Bar {}))
+ wrap(f5(new Concrete with Foo with Bar {}))
+ wrap(f5(new Foo with Bar with Concrete {}))
+ }
+ }
+
+ object ao extends Base
+ object bo extends Base with B
+
+ private def wrap(body: => Any) {
+ try println(body)
+ catch { case ex: NoSuchMethodException => println(ex) }
+ }
+
+ def main(args: Array[String]) {
+ ao.run()
+ bo.run()
+ }
+}
+
+// java.lang.NoSuchMethodException: Test$$anon$1.bippy() \ No newline at end of file
diff --git a/test/files/neg/t7756a.check b/test/files/neg/t7756a.check
new file mode 100644
index 0000000000..8d42717e47
--- /dev/null
+++ b/test/files/neg/t7756a.check
@@ -0,0 +1,7 @@
+t7756a.scala:7: error: type arguments [Object] do not conform to trait TA's type parameter bounds [X <: CharSequence]
+ locally(null: TA[Object])
+ ^
+t7756a.scala:7: error: type arguments [Object] do not conform to trait TA's type parameter bounds [X <: CharSequence]
+ locally(null: TA[Object])
+ ^
+two errors found
diff --git a/test/files/neg/t7756a.scala b/test/files/neg/t7756a.scala
new file mode 100644
index 0000000000..4453e84963
--- /dev/null
+++ b/test/files/neg/t7756a.scala
@@ -0,0 +1,11 @@
+object Test {
+ def test: Unit = {
+ trait TA[X <: CharSequence]
+ 0 match {
+ case _ =>
+ // the bounds violation isn't reported. RefChecks seems to be too broadly disabled under virtpatmat: see 65340ed4ad2e
+ locally(null: TA[Object])
+ ()
+ }
+ }
+}
diff --git a/test/files/neg/t7756b.check b/test/files/neg/t7756b.check
new file mode 100644
index 0000000000..2817a7e230
--- /dev/null
+++ b/test/files/neg/t7756b.check
@@ -0,0 +1,6 @@
+t7756b.scala:3: warning: comparing values of types Int and String using `==' will always yield false
+ case _ => 0 == ""
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t7756b.flags b/test/files/neg/t7756b.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t7756b.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t7756b.scala b/test/files/neg/t7756b.scala
new file mode 100644
index 0000000000..a2de29c8e7
--- /dev/null
+++ b/test/files/neg/t7756b.scala
@@ -0,0 +1,5 @@
+object Test {
+ 0 match {
+ case _ => 0 == ""
+ }
+}
diff --git a/test/files/neg/t7757a.check b/test/files/neg/t7757a.check
new file mode 100644
index 0000000000..de24e23004
--- /dev/null
+++ b/test/files/neg/t7757a.check
@@ -0,0 +1,4 @@
+t7757a.scala:1: error: ';' expected but '@' found.
+trait Foo @annot
+ ^
+one error found
diff --git a/test/files/neg/t7757a.scala b/test/files/neg/t7757a.scala
new file mode 100644
index 0000000000..24f6c16cb4
--- /dev/null
+++ b/test/files/neg/t7757a.scala
@@ -0,0 +1 @@
+trait Foo @annot \ No newline at end of file
diff --git a/test/files/neg/t7757b.check b/test/files/neg/t7757b.check
new file mode 100644
index 0000000000..3e5a0f1fa6
--- /dev/null
+++ b/test/files/neg/t7757b.check
@@ -0,0 +1,4 @@
+t7757b.scala:2: error: expected start of definition
+@annot2
+ ^
+one error found
diff --git a/test/files/neg/t7757b.scala b/test/files/neg/t7757b.scala
new file mode 100644
index 0000000000..e9a537dba1
--- /dev/null
+++ b/test/files/neg/t7757b.scala
@@ -0,0 +1,2 @@
+trait Foo2
+@annot2 \ No newline at end of file
diff --git a/test/files/neg/t997.check b/test/files/neg/t997.check
index 186095f44a..be1e92c369 100644
--- a/test/files/neg/t997.check
+++ b/test/files/neg/t997.check
@@ -1,7 +1,10 @@
-t997.scala:13: error: wrong number of arguments for object Foo
+t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3
+"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
+ ^
+t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3
"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
^
t997.scala:13: error: not found: value a
"x" match { case Foo(a, b, c) => Console.println((a,b,c)) }
^
-two errors found
+three errors found
diff --git a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
index cf58bc3dfd..ecf8916c46 100644
--- a/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
+++ b/test/files/pos/annotated-treecopy/Impls_Macros_1.scala
@@ -22,7 +22,7 @@ object Macros {
var b1 = new Transformer {
override def transform(tree: Tree): Tree = tree match {
case Ident(x) if (x==n) => Ident(TermName("_arg"))
- case tt @ TypeTree() if tt.original != null => TypeTree(tt.tpe) setOriginal transform(tt.original)
+ 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>))
// with the original of the TypeTree being Annotated(<@unchecked>, Ident(<x>))
diff --git a/test/files/pos/extractor-types.scala b/test/files/pos/extractor-types.scala
new file mode 100644
index 0000000000..bb9659a13c
--- /dev/null
+++ b/test/files/pos/extractor-types.scala
@@ -0,0 +1,30 @@
+package p1 {
+ object Ex { def unapply(p: Any): Option[_ <: Int] = null }
+ object Foo { val Ex(_) = null }
+}
+// a.scala:2: error: error during expansion of this match (this is a scalac bug).
+// The underlying error was: type mismatch;
+// found : Some[_$1(in value x$1)] where type _$1(in value x$1)
+// required: Some[_$1(in method unapply)]
+// object Foo { val Ex(_) = null }
+// ^
+// one error found
+
+package p2 {
+ trait Other {
+ class Quux
+ object Baz { def unapply(x: Any): Option[Quux] = None }
+ }
+ trait Reifiers {
+ def f() {
+ val u2: Other = null
+ (null: Any) match { case u2.Baz(x) => println(x) } //: u2.Quux) }
+ // The underlying error was: type mismatch;
+ // found : Other#Quux
+ // required: u2.Quux
+ // x match { case u2.Baz(x) => println(x: u2.Quux) }
+ // ^
+ // one error found
+ }
+ }
+}
diff --git a/test/files/pos/optmatch.scala b/test/files/pos/optmatch.scala
new file mode 100644
index 0000000000..354be65da7
--- /dev/null
+++ b/test/files/pos/optmatch.scala
@@ -0,0 +1,33 @@
+// final case class NonZeroLong(value: Long) extends AnyVal {
+// def get: Long = value
+// def isEmpty: Boolean = get == 0l
+// }
+
+class NonZeroLong(val value: Long) extends AnyVal {
+ def get: Long = value
+ def isEmpty: Boolean = get == 0l
+}
+object NonZeroLong {
+ def unapply(value: Long): NonZeroLong = new NonZeroLong(value)
+}
+
+
+object Foo {
+ def unapply(x: Int): NonZeroLong = new NonZeroLong(1L << x)
+ // public long unapply(int);
+ // 0: lconst_1
+ // 1: iload_1
+ // 2: lshl
+ // 3: lreturn
+}
+
+object Test {
+ def f(x: Int): Int = x match {
+ case Foo(1024l) => 1
+ case _ => 2
+ }
+ def main(args: Array[String]): Unit = {
+ println(f(10))
+ println(f(11))
+ }
+}
diff --git a/test/files/pos/overloaded-unapply.scala b/test/files/pos/overloaded-unapply.scala
new file mode 100644
index 0000000000..4105a25f10
--- /dev/null
+++ b/test/files/pos/overloaded-unapply.scala
@@ -0,0 +1,8 @@
+trait Baz {
+ type Type >: Null
+
+ case class HoleType(a: String, b: String, c: String)
+ object HoleType { def unapply(tpe: Type): Option[HoleType] = ??? }
+
+ (null: Type) match { case HoleType(holeTpe) => holeTpe }
+}
diff --git a/test/files/pos/patmat-extract-tparam.scala b/test/files/pos/patmat-extract-tparam.scala
new file mode 100644
index 0000000000..6417b49c2b
--- /dev/null
+++ b/test/files/pos/patmat-extract-tparam.scala
@@ -0,0 +1,13 @@
+trait Bip[T] { def h: T }
+trait BoolBip extends Bip[Boolean]
+
+class A {
+ def g(x: Boolean): Unit = ()
+ def f(xs: List[Bip[_]]) = xs foreach { case x: BoolBip => g(x.h) }
+}
+
+class B {
+ def g(x: Boolean): Unit = ()
+ def g(x: Int): Unit = ()
+ def f(xs: List[Bip[_]]) = xs foreach { case x: BoolBip => g(x.h) }
+}
diff --git a/test/files/pos/t6797.scala b/test/files/pos/t6797.scala
new file mode 100644
index 0000000000..ef1afa1eb3
--- /dev/null
+++ b/test/files/pos/t6797.scala
@@ -0,0 +1,4 @@
+object Test extends App /* workaround: don't extend App */ {
+ private class Matcher(aParam: Option[String] = None)
+ private val stringMatcher = new Matcher
+}
diff --git a/test/files/run/matchonseq.scala b/test/files/run/matchonseq.scala
index 49b406a6ec..f6f320245a 100644
--- a/test/files/run/matchonseq.scala
+++ b/test/files/run/matchonseq.scala
@@ -1,8 +1,8 @@
-object Test extends App{
- Vector(1,2,3) match {
- case head +: tail => println("It worked! head=" + head)
+object Test extends App {
+ Vector(1,2,3) match {
+ case head +: tail => println("It worked! head=" + head)
}
- Vector(1,2,3) match {
- case init :+ last => println("It worked! last=" + last)
+ Vector(1,2,3) match {
+ case init :+ last => println("It worked! last=" + last)
}
}
diff --git a/test/files/run/name-based-patmat.check b/test/files/run/name-based-patmat.check
new file mode 100644
index 0000000000..1cc605ea3d
--- /dev/null
+++ b/test/files/run/name-based-patmat.check
@@ -0,0 +1,10 @@
+catdog
+2 catdogs! A ha ha!
+3 catdogs! A ha ha!
+catdog
+2 catdogs! A ha ha!
+3 catdogs! A ha ha!
+1
+1
+2
+3
diff --git a/test/files/run/name-based-patmat.scala b/test/files/run/name-based-patmat.scala
new file mode 100644
index 0000000000..2c429c141f
--- /dev/null
+++ b/test/files/run/name-based-patmat.scala
@@ -0,0 +1,75 @@
+final class MiniSome[T](val get: T) extends AnyVal { def isEmpty = false }
+
+package p1 {
+ class Triple(val x: Any) extends AnyRef with Product3[String, String, String] {
+ private def s = "" + x
+ override def canEqual(x: Any) = this eq x.asInstanceOf[AnyRef]
+ def isEmpty = false
+ def get = this
+ def _1 = s
+ def _2 = "2 " + s + "s! A ha ha!"
+ def _3 = "3 " + s + "s! A ha ha!"
+
+ override def toString = s"Triple(${_1}, ${_2}, ${_3})"
+ }
+
+ object Triple {
+ def unapply(x: Any): Triple = new Triple(x)
+ }
+}
+
+package p2 {
+ class Triple(val x: Any) {
+ private def s = "" + x
+ def isEmpty = false
+ def get = this
+ def _1 = s
+ def _2 = "2 " + s + "s! A ha ha!"
+ def _3 = "3 " + s + "s! A ha ha!"
+ override def toString = s"Triple(${_1}, ${_2}, ${_3})"
+ }
+
+ object Triple {
+ def unapply(x: Any): Triple = new Triple(x)
+ }
+}
+
+package p3 {
+ case class Foo(x: Int, y: Int, zs: Int*)
+
+ object Bar {
+ def f(x: Foo) = x match {
+ case Foo(5, 10, 15, 20, _*) => 1
+ case Foo(5, 10, 15, _*) => 2
+ case Foo(5, 10, _*) => 3
+ case Foo(5, 10) => 4 // should warn unreachable
+ case _ => 5
+ }
+ }
+}
+
+object Test {
+
+ // def f(x: Any) = x match {
+ // case p1.Foo(x, y, z) => println((x, y, z))
+ // case x => println(x)
+ // }
+
+ def main(args: Array[String]): Unit = {
+ "catdog" match {
+ case p1.Triple(x, y, z) => List(x, y, z) foreach println
+ case x => println("fail: " + x)
+ }
+ // TODO
+ "catdog" match {
+ case p2.Triple(x, y, z) => List(x, y, z) foreach println
+ case x => println("fail: " + x)
+ }
+
+ println(p3.Bar.f(p3.Foo(5, 10, 15, 20, 25)))
+ println(p3.Bar.f(p3.Foo(5, 10, 15, 20)))
+ println(p3.Bar.f(p3.Foo(5, 10, 15)))
+ println(p3.Bar.f(p3.Foo(5, 10)))
+ // println(p3.Bar.f(p3.Foo(5)))
+ }
+}
diff --git a/test/files/run/patmat-behavior-2.check b/test/files/run/patmat-behavior-2.check
new file mode 100644
index 0000000000..a928fe7918
--- /dev/null
+++ b/test/files/run/patmat-behavior-2.check
@@ -0,0 +1,24 @@
+f1(Foo(1)) == true
+f1(Foo(1, 2)) == false
+f1(Foo(1, 2, 3)) == false
+
+f2(Foo(1)) == false
+f2(Foo(1, 2)) == true
+f2(Foo(1, 2, 3)) == false
+
+f3(Foo(1)) == false
+f3(Foo(1, 2)) == false
+f3(Foo(1, 2, 3)) == true
+
+f1seq(Foo(1)) == true
+f1seq(Foo(1, 2)) == true
+f1seq(Foo(1, 2, 3)) == true
+
+f2seq(Foo(1)) == false
+f2seq(Foo(1, 2)) == true
+f2seq(Foo(1, 2, 3)) == true
+
+f3seq(Foo(1)) == false
+f3seq(Foo(1, 2)) == false
+f3seq(Foo(1, 2, 3)) == true
+
diff --git a/test/files/run/patmat-behavior-2.scala b/test/files/run/patmat-behavior-2.scala
new file mode 100644
index 0000000000..b31f773772
--- /dev/null
+++ b/test/files/run/patmat-behavior-2.scala
@@ -0,0 +1,50 @@
+case class Foo(x: Int, ys: Int*) {
+ // We write our own toString because of SI-7735
+ override def toString = (x +: ys).mkString("Foo(", ", ", ")")
+}
+
+object Test {
+ def f1(x: Any) = x match {
+ case Foo(x) => true
+ case _ => false
+ }
+ def f2(x: Any) = x match {
+ case Foo(x, y) => true
+ case _ => false
+ }
+ def f3(x: Any) = x match {
+ case Foo(x, y, z) => true
+ case _ => false
+ }
+ def f1seq(x: Any) = x match {
+ case Foo(x, ys @ _*) => true
+ case _ => false
+ }
+ def f2seq(x: Any) = x match {
+ case Foo(x, y, zs @ _*) => true
+ case _ => false
+ }
+ def f3seq(x: Any) = x match {
+ case Foo(x, y, z, qs @ _*) => true
+ case _ => false
+ }
+
+ val x1 = Foo(1)
+ val x2 = Foo(1, 2)
+ val x3 = Foo(1, 2, 3)
+
+ val fs = List[Any => Boolean](f1, f2, f3)
+ val fseqs = List[Any => Boolean](f1seq, f2seq, f3seq)
+ val xs = List[Foo](x1, x2, x3)
+
+ def main(args: Array[String]): Unit = {
+ for ((f, i) <- fs.zipWithIndex) {
+ xs foreach (x => println(s"f${i+1}($x) == ${f(x)}"))
+ println("")
+ }
+ for ((f, i) <- fseqs.zipWithIndex) {
+ xs foreach (x => println(s"f${i+1}seq($x) == ${f(x)}"))
+ println("")
+ }
+ }
+}
diff --git a/test/files/run/patmat-behavior.check b/test/files/run/patmat-behavior.check
new file mode 100644
index 0000000000..273a1434fb
--- /dev/null
+++ b/test/files/run/patmat-behavior.check
@@ -0,0 +1,90 @@
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C10[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C20[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C01[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C11[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:82: warning: fruitless type test: a value of type s.C00[A] cannot also be a s.C21[A]
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C00[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C20[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C01[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C11[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:83: warning: fruitless type test: a value of type s.C10[A] cannot also be a s.C21[A]
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C00[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C10[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C01[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C11[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:84: warning: fruitless type test: a value of type s.C20[A] cannot also be a s.C21[A]
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C00[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C10[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C20[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C11[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:85: warning: fruitless type test: a value of type s.C01[A] cannot also be a s.C21[A]
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C00[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C10[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C20[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C01[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:86: warning: fruitless type test: a value of type s.C11[A] cannot also be a s.C21[A]
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C00[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C10[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C20[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C01[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
+patmat-behavior.scala:87: warning: fruitless type test: a value of type s.C21[A] cannot also be a s.C11[A]
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ ^
diff --git a/test/files/run/patmat-behavior.scala b/test/files/run/patmat-behavior.scala
new file mode 100644
index 0000000000..8b6370d796
--- /dev/null
+++ b/test/files/run/patmat-behavior.scala
@@ -0,0 +1,95 @@
+package s {
+ sealed trait C[+A]
+
+ case class C00[+A]() extends C[A]
+ case class C10[+A](x: A) extends C[A]
+ case class C20[+A](x: A, y: A) extends C[A]
+ case class C01[+A](xs: A*) extends C[A]
+ case class C11[+A](x: A, ys: A*) extends C[A]
+ case class C21[+A](x: A, y: A, zs: A*) extends C[A]
+
+ object E00 { def unapply[A](x: Any): Boolean = ??? }
+ object E10 { def unapply[A](x: Any): Option[A] = ??? }
+ object E20 { def unapply[A](x: Any): Option[(A, A)] = ??? }
+ object E01 { def unapplySeq[A](x: Any): Option[Seq[A]] = ??? }
+ object E11 { def unapplySeq[A](x: Any): Option[(A, Seq[A])] = ??? }
+ object E21 { def unapplySeq[A](x: Any): Option[(A, A, Seq[A])] = ??? }
+
+ object F00 { def unapply[A](x: C[A]): Boolean = ??? }
+ object F10 { def unapply[A](x: C[A]): Option[A] = ??? }
+ object F20 { def unapply[A](x: C[A]): Option[(A, A)] = ??? }
+ object F01 { def unapplySeq[A](x: C[A]): Option[Seq[A]] = ??? }
+ object F11 { def unapplySeq[A](x: C[A]): Option[(A, Seq[A])] = ??? }
+ object F21 { def unapplySeq[A](x: C[A]): Option[(A, A, Seq[A])] = ??? }
+
+ object G00 { def unapply[A](x: C00[A]): Boolean = ??? }
+ object G10 { def unapply[A](x: C10[A]): Option[A] = ??? }
+ object G20 { def unapply[A](x: C20[A]): Option[(A, A)] = ??? }
+ object G01 { def unapplySeq[A](x: C01[A]): Option[Seq[A]] = ??? }
+ object G11 { def unapplySeq[A](x: C11[A]): Option[(A, Seq[A])] = ??? }
+ object G21 { def unapplySeq[A](x: C21[A]): Option[(A, A, Seq[A])] = ??? }
+}
+import s._
+
+package pos {
+ object Test {
+ def ga1(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga2(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga3(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga4(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga5(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+ def ga6(x: Any) = x match { case C00() => 1 ; case C10(x) => 2 ; case C20(x, y) => 3 ; case C01(xs) => 4 ; case C11(x, ys) => 5 ; case C21(x, y, zs) => 6 }
+
+ def gb1[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb2[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb3[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb4[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb5[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb6[A](x: C[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+
+ def gc1[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc2[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc3[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc4[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc5[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc6[A](x: C[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+
+ def gd1[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd2[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd3[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd4[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd5[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gd6[A, B <: C[A]](x: B) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ }
+}
+
+package neg {
+ object Fail {
+ def gb1[A](x: C00[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb2[A](x: C10[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb3[A](x: C20[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb4[A](x: C01[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb5[A](x: C11[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+ def gb6[A](x: C21[A]) = x match { case E00() => ??? ; case E10(x) => x ; case E20(x, y) => x ; case E01(xs @ _*) => xs.head ; case E11(x, ys @ _*) => x ; case E21(x, y, zs @ _*) => x }
+
+ def gc1[A](x: C00[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc2[A](x: C10[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc3[A](x: C20[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc4[A](x: C01[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc5[A](x: C11[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+ def gc6[A](x: C21[A]) = x match { case F00() => ??? ; case F10(x) => x ; case F20(x, y) => x ; case F01(xs @ _*) => xs.head ; case F11(x, ys @ _*) => x ; case F21(x, y, zs @ _*) => x }
+
+ def gd1[A](x: C00[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd2[A](x: C10[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd3[A](x: C20[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd4[A](x: C01[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd5[A](x: C11[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ def gd6[A](x: C21[A]) = x match { case G00() => ??? ; case G10(x) => x ; case G20(x, y) => x ; case G01(xs @ _*) => xs.head ; case G11(x, ys @ _*) => x ; case G21(x, y, zs @ _*) => x }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+
+ }
+}
diff --git a/test/files/run/patmat-bind-typed.check b/test/files/run/patmat-bind-typed.check
new file mode 100644
index 0000000000..8baef1b4ab
--- /dev/null
+++ b/test/files/run/patmat-bind-typed.check
@@ -0,0 +1 @@
+abc
diff --git a/test/files/run/patmat-bind-typed.scala b/test/files/run/patmat-bind-typed.scala
new file mode 100644
index 0000000000..10de921c51
--- /dev/null
+++ b/test/files/run/patmat-bind-typed.scala
@@ -0,0 +1,8 @@
+object Test {
+ def f(xs: List[Any]) = for (key @ (dummy: String) <- xs) yield key
+
+ def main(args: Array[String]): Unit = {
+ f("abc" :: Nil) foreach println
+ f(5 :: Nil) foreach println
+ }
+}
diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala
new file mode 100644
index 0000000000..bbf46f2f19
--- /dev/null
+++ b/test/files/run/repl-trim-stack-trace.scala
@@ -0,0 +1,33 @@
+
+import scala.tools.partest.SessionTest
+
+// SI-7740
+object Test extends SessionTest {
+ def session =
+"""Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> def f = throw new Exception("Uh-oh")
+f: Nothing
+
+scala> f
+java.lang.Exception: Uh-oh
+ at .f(<console>:7)
+
+scala> def f = throw new Exception("")
+f: Nothing
+
+scala> f
+java.lang.Exception:
+ at .f(<console>:7)
+
+scala> def f = throw new Exception
+f: Nothing
+
+scala> f
+java.lang.Exception
+ at .f(<console>:7)
+
+scala> """
+
+}
diff --git a/test/files/run/string-extractor.check b/test/files/run/string-extractor.check
new file mode 100644
index 0000000000..47f3722c86
--- /dev/null
+++ b/test/files/run/string-extractor.check
@@ -0,0 +1,9 @@
+by
+BY
+oTheClown
+nope
+1: ob
+2: obby
+2: OBBY
+3: BOBO
+3: TomTomTheClown
diff --git a/test/files/run/string-extractor.scala b/test/files/run/string-extractor.scala
new file mode 100644
index 0000000000..c0fe911ff3
--- /dev/null
+++ b/test/files/run/string-extractor.scala
@@ -0,0 +1,60 @@
+final class StringExtract(val s: String) extends AnyVal {
+ def isEmpty = (s eq null) || (s == "")
+ def get = this
+ def length = s.length
+ def lengthCompare(n: Int) = s.length compare n
+ def apply(idx: Int): Char = s charAt idx
+ def head: Char = s charAt 0
+ def tail: String = s drop 1
+ def drop(n: Int): StringExtract = new StringExtract(s drop n)
+
+ override def toString = s
+}
+
+final class ThreeStringExtract(val s: String) extends AnyVal {
+ def isEmpty = (s eq null) || (s == "")
+ def get: (List[Int], Double, ThreeStringExtract) = ((s.length :: Nil, s.length.toDouble, this))
+ def length = s.length
+ def lengthCompare(n: Int) = s.length compare n
+ def apply(idx: Int): Char = s charAt idx
+ def head: Char = s charAt 0
+ def tail: String = s drop 1
+ def drop(n: Int): ThreeStringExtract = new ThreeStringExtract(s drop n)
+
+ override def toString = s
+}
+
+
+object Bippy {
+ def unapplySeq(x: Any): StringExtract = new StringExtract("" + x)
+}
+object TripleBippy {
+ def unapplySeq(x: Any): ThreeStringExtract = new ThreeStringExtract("" + x)
+}
+
+object Test {
+ def f(x: Any) = x match {
+ case Bippy('B' | 'b', 'O' | 'o', 'B' | 'b', xs @ _*) => xs
+ case _ => "nope"
+ }
+
+ def g(x: Any): String = x match {
+ case TripleBippy(3 :: Nil, 3.0, 'b', chars @ _*) => "1: " + chars
+ case TripleBippy(5 :: Nil, 5.0, 'b' | 'B', chars @ _*) => "2: " + chars
+ case TripleBippy(_, _, chars @ _*) => "3: " + chars
+ case _ => "nope"
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f("Bobby"))
+ println(f("BOBBY"))
+ println(f("BoBoTheClown"))
+ println(f("TomTomTheClown"))
+
+ println(g("bob"))
+ println(g("bobby"))
+ println(g("BOBBY"))
+ println(g("BOBO"))
+ println(g("TomTomTheClown"))
+ }
+}
diff --git a/test/files/run/t5903a.check b/test/files/run/t5903a.check
new file mode 100644
index 0000000000..ce6efd812d
--- /dev/null
+++ b/test/files/run/t5903a.check
@@ -0,0 +1 @@
+(SomeTree,SomeTree)
diff --git a/test/files/run/t5903a.flags b/test/files/run/t5903a.flags
new file mode 100644
index 0000000000..02ecab49e7
--- /dev/null
+++ b/test/files/run/t5903a.flags
@@ -0,0 +1 @@
+-Xlog-reflective-calls \ No newline at end of file
diff --git a/test/files/run/t5903a/Macros_1.scala b/test/files/run/t5903a/Macros_1.scala
new file mode 100644
index 0000000000..e82be0fc68
--- /dev/null
+++ b/test/files/run/t5903a/Macros_1.scala
@@ -0,0 +1,28 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+trait Tree
+case object SomeTree extends Tree
+
+object NewQuasiquotes {
+ implicit class QuasiquoteInterpolation(c: StringContext) {
+ object nq {
+ def unapply(t: Tree) = macro QuasiquoteMacros.unapplyImpl
+ }
+ }
+}
+
+object QuasiquoteMacros {
+ def unapplyImpl(c: Context)(t: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = this
+ def _1 = SomeTree
+ def _2 = SomeTree
+ def unapply(t: Tree) = this
+ }.unapply($t)
+ """
+ }
+}
diff --git a/test/files/run/t5903a/Test_2.scala b/test/files/run/t5903a/Test_2.scala
new file mode 100644
index 0000000000..3a0b68b568
--- /dev/null
+++ b/test/files/run/t5903a/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import NewQuasiquotes._
+ SomeTree match {
+ case nq"$x + $y" => println((x, y))
+ }
+}
diff --git a/test/files/run/t5903b.check b/test/files/run/t5903b.check
new file mode 100644
index 0000000000..75891bc672
--- /dev/null
+++ b/test/files/run/t5903b.check
@@ -0,0 +1 @@
+oops
diff --git a/test/files/run/t5903b.flags b/test/files/run/t5903b.flags
new file mode 100644
index 0000000000..02ecab49e7
--- /dev/null
+++ b/test/files/run/t5903b.flags
@@ -0,0 +1 @@
+-Xlog-reflective-calls \ No newline at end of file
diff --git a/test/files/run/t5903b/Macros_1.scala b/test/files/run/t5903b/Macros_1.scala
new file mode 100644
index 0000000000..c0124850b8
--- /dev/null
+++ b/test/files/run/t5903b/Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply[T](x: T) = macro Macros.unapplyImpl[T]
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = this
+ def _1 = 2
+ def unapply(x: Int) = this
+ override def toString = "oops"
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/t5903b/Test_2.scala b/test/files/run/t5903b/Test_2.scala
new file mode 100644
index 0000000000..0f6f80d327
--- /dev/null
+++ b/test/files/run/t5903b/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 2 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/run/t5903c.check b/test/files/run/t5903c.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/files/run/t5903c.check
@@ -0,0 +1 @@
+2
diff --git a/test/files/run/t5903c.flags b/test/files/run/t5903c.flags
new file mode 100644
index 0000000000..02ecab49e7
--- /dev/null
+++ b/test/files/run/t5903c.flags
@@ -0,0 +1 @@
+-Xlog-reflective-calls \ No newline at end of file
diff --git a/test/files/run/t5903c/Macros_1.scala b/test/files/run/t5903c/Macros_1.scala
new file mode 100644
index 0000000000..f8baa2275b
--- /dev/null
+++ b/test/files/run/t5903c/Macros_1.scala
@@ -0,0 +1,23 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply[T](x: T) = macro Macros.unapplyImpl[T]
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ def isEmpty = false
+ def get = 2
+ def unapply(x: Int) = this
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/t5903c/Test_2.scala b/test/files/run/t5903c/Test_2.scala
new file mode 100644
index 0000000000..0f6f80d327
--- /dev/null
+++ b/test/files/run/t5903c/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 2 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/run/t5903d.check b/test/files/run/t5903d.check
new file mode 100644
index 0000000000..d81cc0710e
--- /dev/null
+++ b/test/files/run/t5903d.check
@@ -0,0 +1 @@
+42
diff --git a/test/files/run/t5903d.flags b/test/files/run/t5903d.flags
new file mode 100644
index 0000000000..02ecab49e7
--- /dev/null
+++ b/test/files/run/t5903d.flags
@@ -0,0 +1 @@
+-Xlog-reflective-calls \ No newline at end of file
diff --git a/test/files/run/t5903d/Macros_1.scala b/test/files/run/t5903d/Macros_1.scala
new file mode 100644
index 0000000000..88d714e17b
--- /dev/null
+++ b/test/files/run/t5903d/Macros_1.scala
@@ -0,0 +1,25 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Interpolation {
+ implicit class TestInterpolation(c: StringContext) {
+ object t {
+ def unapply(x: Int) = macro Macros.unapplyImpl
+ }
+ }
+}
+
+object Macros {
+ def unapplyImpl(c: Context)(x: c.Tree) = {
+ import c.universe._
+ q"""
+ new {
+ class Match(x: Int) {
+ def isEmpty = false
+ def get = x
+ }
+ def unapply(x: Int) = new Match(x)
+ }.unapply($x)
+ """
+ }
+}
diff --git a/test/files/run/t5903d/Test_2.scala b/test/files/run/t5903d/Test_2.scala
new file mode 100644
index 0000000000..95c717a9d8
--- /dev/null
+++ b/test/files/run/t5903d/Test_2.scala
@@ -0,0 +1,6 @@
+object Test extends App {
+ import Interpolation._
+ 42 match {
+ case t"$x" => println(x)
+ }
+}
diff --git a/test/files/run/t6331b.scala b/test/files/run/t6331b.scala
index 3e09965ee8..3a560ea64b 100644
--- a/test/files/run/t6331b.scala
+++ b/test/files/run/t6331b.scala
@@ -1,4 +1,4 @@
-import scala.tools.partest.trace
+import scala.tools.partest.Util.trace
import scala.util.control.Exception.allCatch
diff --git a/test/files/run/t7214.scala b/test/files/run/t7214.scala
index ff1ea8082d..15c2c24fa0 100644
--- a/test/files/run/t7214.scala
+++ b/test/files/run/t7214.scala
@@ -25,7 +25,7 @@ class Crash {
def unapply(a: Alias): Option[Any] = None
}
(t: Any) match {
- case Extractor() =>
+ case Extractor(_) =>
case _ =>
}
diff --git a/test/files/run/value-class-extractor-2.check b/test/files/run/value-class-extractor-2.check
new file mode 100644
index 0000000000..5903b996b6
--- /dev/null
+++ b/test/files/run/value-class-extractor-2.check
@@ -0,0 +1,8 @@
+String
+List
+Int
+Something else
+String
+List
+Int
+Something else
diff --git a/test/files/run/value-class-extractor-2.scala b/test/files/run/value-class-extractor-2.scala
new file mode 100644
index 0000000000..d776c35eda
--- /dev/null
+++ b/test/files/run/value-class-extractor-2.scala
@@ -0,0 +1,108 @@
+final class Opt[+A >: Null](val value: A) extends AnyVal {
+ def get: A = value
+ def isEmpty = value == null
+}
+object Opt {
+ final val None = new Opt[Null](null)
+ def apply[A >: Null](value: A): Opt[A] = if (value == null) None else new Opt[A](value)
+}
+
+object ValueOpt {
+ // public java.lang.String unapply(java.lang.Object);
+ // 0: aload_1
+ // 1: instanceof #16 // class java/lang/String
+ // 4: ifeq 21
+ // 7: getstatic #21 // Field Opt$.MODULE$:LOpt$;
+ // 10: astore_2
+ // 11: ldc #23 // String String
+ // 13: checkcast #16 // class java/lang/String
+ // 16: astore 5
+ // 18: goto 71
+ // 21: aload_1
+ // 22: instanceof #25 // class scala/collection/immutable/List
+ // 25: ifeq 42
+ // 28: getstatic #21 // Field Opt$.MODULE$:LOpt$;
+ // 31: astore_3
+ // 32: ldc #27 // String List
+ // 34: checkcast #16 // class java/lang/String
+ // 37: astore 5
+ // 39: goto 71
+ // 42: aload_1
+ // 43: instanceof #29 // class java/lang/Integer
+ // 46: ifeq 64
+ // 49: getstatic #21 // Field Opt$.MODULE$:LOpt$;
+ // 52: astore 4
+ // 54: ldc #31 // String Int
+ // 56: checkcast #16 // class java/lang/String
+ // 59: astore 5
+ // 61: goto 71
+ // 64: getstatic #21 // Field Opt$.MODULE$:LOpt$;
+ // 67: pop
+ // 68: aconst_null
+ // 69: astore 5
+ // 71: aload 5
+ // 73: areturn
+ def unapply(x: Any): Opt[String] = x match {
+ case _: String => Opt("String")
+ case _: List[_] => Opt("List")
+ case _: Int => Opt("Int")
+ case _ => Opt.None
+ }
+}
+object RegularOpt {
+ // public scala.Option<java.lang.String> unapply(java.lang.Object);
+ // 0: aload_1
+ // 1: instanceof #16 // class java/lang/String
+ // 4: ifeq 20
+ // 7: new #18 // class scala/Some
+ // 10: dup
+ // 11: ldc #20 // String String
+ // 13: invokespecial #23 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 16: astore_2
+ // 17: goto 64
+ // 20: aload_1
+ // 21: instanceof #25 // class scala/collection/immutable/List
+ // 24: ifeq 40
+ // 27: new #18 // class scala/Some
+ // 30: dup
+ // 31: ldc #27 // String List
+ // 33: invokespecial #23 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 36: astore_2
+ // 37: goto 64
+ // 40: aload_1
+ // 41: instanceof #29 // class java/lang/Integer
+ // 44: ifeq 60
+ // 47: new #18 // class scala/Some
+ // 50: dup
+ // 51: ldc #31 // String Int
+ // 53: invokespecial #23 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 56: astore_2
+ // 57: goto 64
+ // 60: getstatic #36 // Field scala/None$.MODULE$:Lscala/None$;
+ // 63: astore_2
+ // 64: aload_2
+ // 65: areturn
+ def unapply(x: Any): Option[String] = x match {
+ case _: String => Some("String")
+ case _: List[_] => Some("List")
+ case _: Int => Some("Int")
+ case _ => None
+ }
+}
+
+object Test {
+ def f(x: Any) = x match {
+ case ValueOpt(s) => s
+ case _ => "Something else"
+ }
+ def g(x: Any) = x match {
+ case RegularOpt(s) => s
+ case _ => "Something else"
+ }
+ val xs = List("abc", Nil, 5, Test)
+
+ def main(args: Array[String]): Unit = {
+ xs map f foreach println
+ xs map g foreach println
+ }
+}
diff --git a/test/files/run/value-class-extractor-seq.check b/test/files/run/value-class-extractor-seq.check
new file mode 100644
index 0000000000..84552a7aa5
--- /dev/null
+++ b/test/files/run/value-class-extractor-seq.check
@@ -0,0 +1,3 @@
+Bip(1, 2, 3)
+Bip(1, 2, c @ Array(3, 4, 5): _*)
+class [I
diff --git a/test/files/run/value-class-extractor-seq.scala b/test/files/run/value-class-extractor-seq.scala
new file mode 100644
index 0000000000..f17a5314f2
--- /dev/null
+++ b/test/files/run/value-class-extractor-seq.scala
@@ -0,0 +1,59 @@
+import scala.runtime.ScalaRunTime.stringOf
+
+final class ArrayOpt[T](val xs: Array[T]) extends AnyVal {
+ def isEmpty = xs == null
+ def get = xs
+}
+
+object Bip {
+ def mkInts(xs: Array[Short]) = xs map (_.toInt)
+ def unapplySeq(x: Any): ArrayOpt[Int] = x match {
+ case xs: Array[Int] => new ArrayOpt(xs)
+ case xs: Array[Short] => new ArrayOpt(mkInts(xs))
+ case _ => new ArrayOpt(null)
+ }
+ // public int[] unapplySeq(java.lang.Object);
+ // 0: aload_1
+ // 1: astore_2
+ // 2: aload_2
+ // 3: instanceof #52 // class "[I"
+ // 6: ifeq 20
+ // 9: aload_2
+ // 10: checkcast #52 // class "[I"
+ // 13: astore_3
+ // 14: aload_3
+ // 15: astore 4
+ // 17: goto 47
+ // 20: aload_2
+ // 21: instanceof #58 // class "[S"
+ // 24: ifeq 44
+ // 27: aload_2
+ // 28: checkcast #58 // class "[S"
+ // 31: astore 5
+ // 33: aload_0
+ // 34: aload 5
+ // 36: invokevirtual #60 // Method mkInts:([S)[I
+ // 39: astore 4
+ // 41: goto 47
+ // 44: aconst_null
+ // 45: astore 4
+ // 47: aload 4
+ // 49: areturn
+}
+
+object Test {
+ def f(x: Any) = x match {
+ case Bip(a, b, c) => s"Bip($a, $b, $c)"
+ case Bip(a, b, c @ _*) => s"Bip($a, $b, c @ ${stringOf(c)}: _*)"
+ case _ => "" + x.getClass
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f(Array[Int](1,2,3)))
+ println(f(Array[Int](1,2,3,4,5)))
+ println(f(Array[Int](1)))
+ }
+ // Bip(1, 2, 3)
+ // Bip(1, 2, c @ [I@782be20e: _*)
+ // class [I
+}
diff --git a/test/files/run/value-class-extractor.check b/test/files/run/value-class-extractor.check
new file mode 100644
index 0000000000..e16447118c
--- /dev/null
+++ b/test/files/run/value-class-extractor.check
@@ -0,0 +1,9 @@
+'a'
+'b'
+'c'
+NoChar
+Some(a)
+Some(b)
+Some(c)
+None
+9
diff --git a/test/files/run/value-class-extractor.scala b/test/files/run/value-class-extractor.scala
new file mode 100644
index 0000000000..3eaffa0c23
--- /dev/null
+++ b/test/files/run/value-class-extractor.scala
@@ -0,0 +1,91 @@
+final class NonNullChar(val get: Char) extends AnyVal {
+ def isEmpty = get == 0.toChar
+ override def toString = if (isEmpty) "NoChar" else s"'$get'"
+}
+object NonNullChar {
+ @inline final val None = new NonNullChar(0.toChar)
+}
+
+final class SomeProduct extends Product3[String, Int, List[String]] {
+ def canEqual(x: Any) = x.isInstanceOf[SomeProduct]
+ def _1 = "abc"
+ def _2 = 5
+ def _3 = List("bippy")
+ def isEmpty = false
+ def get = this
+}
+object SomeProduct {
+ def unapply(x: SomeProduct) = x
+}
+
+object Test {
+ def prod(x: SomeProduct): Int = x match {
+ case SomeProduct(x, y, z) => x.length + y + z.length
+ case _ => -1
+ }
+
+ def f(x: Char): NonNullChar = x match {
+ case 'a' => new NonNullChar('a')
+ case 'b' => new NonNullChar('b')
+ case 'c' => new NonNullChar('c')
+ case _ => NonNullChar.None
+ }
+ // public char f(char);
+ // 0: iload_1
+ // 1: tableswitch { // 97 to 99
+ // 97: 47
+ // 98: 42
+ // 99: 37
+ // default: 28
+ // }
+ // 28: getstatic #19 // Field NonNullChar$.MODULE$:LNonNullChar$;
+ // 31: invokevirtual #23 // Method NonNullChar$.None:()C
+ // 34: goto 49
+ // 37: bipush 99
+ // 39: goto 49
+ // 42: bipush 98
+ // 44: goto 49
+ // 47: bipush 97
+ // 49: ireturn
+ def g(x: Char): Option[Char] = x match {
+ case 'a' => Some('a')
+ case 'b' => Some('b')
+ case 'c' => Some('c')
+ case _ => None
+ }
+ // public scala.Option<java.lang.Object> g(char);
+ // 0: iload_1
+ // 1: tableswitch { // 97 to 99
+ // 97: 64
+ // 98: 49
+ // 99: 34
+ // default: 28
+ // }
+ // 28: getstatic #33 // Field scala/None$.MODULE$:Lscala/None$;
+ // 31: goto 76
+ // 34: new #35 // class scala/Some
+ // 37: dup
+ // 38: bipush 99
+ // 40: invokestatic #41 // Method scala/runtime/BoxesRunTime.boxToCharacter:(C)Ljava/lang/Character;
+ // 43: invokespecial #44 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 46: goto 76
+ // 49: new #35 // class scala/Some
+ // 52: dup
+ // 53: bipush 98
+ // 55: invokestatic #41 // Method scala/runtime/BoxesRunTime.boxToCharacter:(C)Ljava/lang/Character;
+ // 58: invokespecial #44 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 61: goto 76
+ // 64: new #35 // class scala/Some
+ // 67: dup
+ // 68: bipush 97
+ // 70: invokestatic #41 // Method scala/runtime/BoxesRunTime.boxToCharacter:(C)Ljava/lang/Character;
+ // 73: invokespecial #44 // Method scala/Some."<init>":(Ljava/lang/Object;)V
+ // 76: areturn
+ def main(args: Array[String]): Unit = {
+ "abcd" foreach (ch => println(f(ch)))
+ "abcd" foreach (ch => println(g(ch)))
+ println(prod(new SomeProduct))
+ }
+}
+
+