summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/reflect/macros/runtime/Names.scala13
-rw-r--r--src/compiler/scala/reflect/reify/codegen/GenNames.scala2
-rw-r--r--src/compiler/scala/reflect/reify/utils/NodePrinters.scala6
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala8
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/IMain.scala2
-rw-r--r--src/compiler/scala/tools/nsc/matching/MatchSupport.scala115
-rw-r--r--src/compiler/scala/tools/nsc/matching/Matrix.scala232
-rw-r--r--src/compiler/scala/tools/nsc/matching/MatrixAdditions.scala191
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala866
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternBindings.scala126
-rw-r--r--src/compiler/scala/tools/nsc/matching/Patterns.scala457
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala82
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala163
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala45
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala113
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala15
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala15
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala89
-rw-r--r--src/compiler/scala/tools/nsc/util/package.scala2
-rw-r--r--src/compiler/scala/tools/reflect/FastTrack.scala48
-rw-r--r--src/compiler/scala/tools/reflect/MacroImplementations.scala2
-rwxr-xr-xsrc/library/scala/reflect/NameTransformer.scala2
-rw-r--r--src/reflect/scala/reflect/api/Names.scala30
-rw-r--r--src/reflect/scala/reflect/api/Trees.scala14
-rw-r--r--src/reflect/scala/reflect/internal/AnnotationInfos.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Names.scala10
-rw-r--r--src/reflect/scala/reflect/internal/Printers.scala2
-rw-r--r--src/reflect/scala/reflect/internal/StdNames.scala4
-rw-r--r--src/reflect/scala/reflect/internal/TreeInfo.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala11
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala60
-rw-r--r--src/reflect/scala/reflect/internal/settings/MutableSettings.scala1
-rw-r--r--src/reflect/scala/reflect/macros/Names.scala14
-rw-r--r--src/reflect/scala/reflect/runtime/Settings.scala1
-rw-r--r--test/files/continuations-neg/function2.check2
-rw-r--r--test/files/continuations-neg/t5314-type-error.check4
-rw-r--r--test/files/jvm/annotations.check12
-rw-r--r--test/files/jvm/annotations.scala6
-rw-r--r--test/files/jvm/interpreter.check6
-rw-r--r--test/files/jvm/interpreter.scala2
-rw-r--r--test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala6
-rw-r--r--test/files/neg/macro-invalidimpl-f/Impls_1.scala2
-rw-r--r--test/files/neg/macro-invalidimpl-g/Impls_1.scala2
-rw-r--r--test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala6
-rw-r--r--test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala2
-rw-r--r--test/files/neg/macro-override-method-overrides-macro/Impls_1.scala2
-rw-r--r--test/files/neg/macro-without-xmacros-a/Impls_1.scala6
-rw-r--r--test/files/neg/macro-without-xmacros-b/Impls_1.scala6
-rw-r--r--test/files/neg/override-object-no.check4
-rw-r--r--test/files/neg/pat_unreachable.check19
-rw-r--r--test/files/neg/pat_unreachable.flags2
-rw-r--r--test/files/neg/t2078.check2
-rw-r--r--test/files/neg/t2336.check2
-rw-r--r--test/files/neg/t3691.check2
-rw-r--r--test/files/neg/t3692-new.check11
-rw-r--r--test/files/neg/t3692-new.flags2
-rw-r--r--test/files/neg/t3692-old.check14
-rw-r--r--test/files/neg/t3692-old.flags1
-rw-r--r--test/files/neg/t3692-old.scala19
-rw-r--r--test/files/neg/t4460a.check4
-rw-r--r--test/files/neg/t4460a.scala7
-rw-r--r--test/files/neg/t4460b.check4
-rw-r--r--test/files/neg/t4460b.scala9
-rw-r--r--test/files/neg/t4460c.check7
-rw-r--r--test/files/neg/t4460c.scala7
-rw-r--r--test/files/neg/t4877.check6
-rw-r--r--test/files/neg/t5060.check4
-rw-r--r--test/files/neg/t5063.check2
-rw-r--r--test/files/neg/t6436.check4
-rw-r--r--test/files/neg/t6436b.check4
-rw-r--r--test/files/neg/t963.check2
-rw-r--r--test/files/neg/unreachablechar.check7
-rw-r--r--test/files/neg/unreachablechar.flags2
-rw-r--r--test/files/pos/t1439.flags2
-rw-r--r--test/files/pos/t6745.scala4
-rw-r--r--test/files/pos/t6846.scala28
-rw-r--r--test/files/run/existentials-in-compiler.check104
-rw-r--r--test/files/run/existentials3-new.check4
-rw-r--r--test/files/run/existentials3-old.check4
-rw-r--r--test/files/run/idempotency-this.check2
-rw-r--r--test/files/run/macro-abort-fresh/Macros_1.scala2
-rw-r--r--test/files/run/macro-abort-fresh/Test_2.scala2
-rw-r--r--test/files/run/macro-basic-ma-md-mi/Impls_1.scala6
-rw-r--r--test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-basic-mamd-mi/Impls_1.scala6
-rw-r--r--test/files/run/macro-bodyexpandstoimpl/Impls_1.scala2
-rw-r--r--test/files/run/macro-declared-in-annotation/Impls_1.scala2
-rw-r--r--test/files/run/macro-declared-in-anonymous/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-block/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-class-class/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-class-object/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-class/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-default-param/Impls_1.scala2
-rw-r--r--test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-declared-in-method/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-object-class/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-object-object/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-object/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-package-object/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-refinement/Impls_1.scala4
-rw-r--r--test/files/run/macro-declared-in-trait.check2
-rw-r--r--test/files/run/macro-declared-in-trait/Impls_1.scala4
-rw-r--r--test/files/run/macro-def-infer-return-type-b/Test_2.scala2
-rw-r--r--test/files/run/macro-duplicate.check0
-rw-r--r--test/files/run/macro-duplicate.flags1
-rw-r--r--test/files/run/macro-duplicate/Impls_Macros_1.scala29
-rw-r--r--test/files/run/macro-duplicate/Test_2.scala6
-rw-r--r--test/files/run/macro-expand-implicit-argument/Macros_1.scala6
-rw-r--r--test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-multiple-arglists/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-nullary-generic/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-overload/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-override/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-recursive/Impls_1.scala4
-rw-r--r--test/files/run/macro-expand-tparams-explicit/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-tparams-implicit/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-tparams-optional/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala6
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala2
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala2
-rw-r--r--test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala2
-rw-r--r--test/files/run/macro-impl-default-params/Impls_Macros_1.scala8
-rw-r--r--test/files/run/macro-impl-rename-context/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala2
-rw-r--r--test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-invalidret-nontypeable/Test_2.scala2
-rw-r--r--test/files/run/macro-invalidusage-badret/Test_2.scala2
-rw-r--r--test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala2
-rw-r--r--test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-invalidusage-partialapplication/Test_2.scala2
-rw-r--r--test/files/run/macro-openmacros/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-range/Common_1.scala2
-rw-r--r--test/files/run/macro-range/Expansion_Impossible_2.scala10
-rw-r--r--test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala2
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala2
-rw-r--r--test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala10
-rw-r--r--test/files/run/macro-reify-freevars/Test_2.scala8
-rw-r--r--test/files/run/macro-reify-nested-a/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-nested-b/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-splice-outside-reify/Test_2.scala2
-rw-r--r--test/files/run/macro-reify-tagless-a/Test_2.scala6
-rw-r--r--test/files/run/macro-reify-type/Macros_1.scala6
-rw-r--r--test/files/run/macro-reify-type/Test_2.scala8
-rw-r--r--test/files/run/macro-reify-unreify/Macros_1.scala2
-rw-r--r--test/files/run/macro-repl-basic.check6
-rw-r--r--test/files/run/macro-repl-basic.scala6
-rw-r--r--test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala6
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2.check2
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala6
-rw-r--r--test/files/run/patmat_unapp_abstype-old.check4
-rw-r--r--test/files/run/patmat_unapp_abstype-old.flags1
-rw-r--r--test/files/run/patmat_unapp_abstype-old.scala83
-rw-r--r--test/files/run/reflection-allmirrors-tostring.scala20
-rw-r--r--test/files/run/reflection-enclosed-basic.scala4
-rw-r--r--test/files/run/reflection-enclosed-inner-basic.scala8
-rw-r--r--test/files/run/reflection-enclosed-inner-inner-basic.scala8
-rw-r--r--test/files/run/reflection-enclosed-inner-nested-basic.scala8
-rw-r--r--test/files/run/reflection-enclosed-nested-basic.scala8
-rw-r--r--test/files/run/reflection-enclosed-nested-inner-basic.scala8
-rw-r--r--test/files/run/reflection-enclosed-nested-nested-basic.scala8
-rw-r--r--test/files/run/reflection-equality.check4
-rw-r--r--test/files/run/reflection-equality.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-accessorsareokay.scala4
-rw-r--r--test/files/run/reflection-fieldmirror-ctorparam.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-getsetval.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-getsetvar.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala2
-rw-r--r--test/files/run/reflection-fieldmirror-privatethis.scala2
-rw-r--r--test/files/run/reflection-fieldsymbol-navigation.scala2
-rw-r--r--test/files/run/reflection-implClass.scala8
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.scala4
-rw-r--r--test/files/run/reflection-magicsymbols-repl.check2
-rw-r--r--test/files/run/reflection-magicsymbols-repl.scala2
-rw-r--r--test/files/run/reflection-magicsymbols-vanilla.scala2
-rw-r--r--test/files/run/reflection-methodsymbol-params.scala16
-rw-r--r--test/files/run/reflection-methodsymbol-returntype.scala16
-rw-r--r--test/files/run/reflection-methodsymbol-typeparams.scala16
-rw-r--r--test/files/run/reflection-repl-classes.check2
-rw-r--r--test/files/run/reflection-repl-classes.scala2
-rw-r--r--test/files/run/reflection-sanitychecks.scala16
-rw-r--r--test/files/run/reflection-valueclasses-derived.scala6
-rw-r--r--test/files/run/reflection-valueclasses-magic.scala2
-rw-r--r--test/files/run/reflection-valueclasses-standard.scala4
-rw-r--r--test/files/run/reify-aliases.check2
-rw-r--r--test/files/run/reify_copypaste1.scala4
-rw-r--r--test/files/run/reify_newimpl_22.check2
-rw-r--r--test/files/run/reify_newimpl_23.check2
-rw-r--r--test/files/run/reify_newimpl_25.check2
-rw-r--r--test/files/run/reify_newimpl_26.check2
-rw-r--r--test/files/run/reify_printf.scala8
-rw-r--r--test/files/run/repl-colon-type.check8
-rw-r--r--test/files/run/repl-parens.check2
-rw-r--r--test/files/run/showraw_aliases.check4
-rw-r--r--test/files/run/showraw_mods.check2
-rw-r--r--test/files/run/showraw_tree.check4
-rw-r--r--test/files/run/showraw_tree_ids.check4
-rw-r--r--test/files/run/showraw_tree_kinds.check4
-rw-r--r--test/files/run/showraw_tree_types_ids.check16
-rw-r--r--test/files/run/showraw_tree_types_typed.check16
-rw-r--r--test/files/run/showraw_tree_types_untyped.check4
-rw-r--r--test/files/run/showraw_tree_ultimate.check16
-rw-r--r--test/files/run/t3835.scala2
-rw-r--r--test/files/run/t4172.check2
-rw-r--r--test/files/run/t5256a.check2
-rw-r--r--test/files/run/t5256b.check2
-rw-r--r--test/files/run/t5256d.check2
-rw-r--r--test/files/run/t5256e.check2
-rw-r--r--test/files/run/t5256f.check4
-rw-r--r--test/files/run/t5418b.check2
-rw-r--r--test/files/run/t6178.scala2
-rw-r--r--test/files/run/t6181.scala2
-rw-r--r--test/files/run/t6199-mirror.scala2
-rw-r--r--test/files/run/t6392b.check2
-rw-r--r--test/files/run/toolbox_typecheck_implicitsdisabled.scala8
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled.scala4
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled2.check2
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled2.scala4
-rw-r--r--test/files/scalacheck/ReflectionExtractors.scala52
-rw-r--r--test/files/scalap/abstractClass/result.test2
-rw-r--r--test/files/scalap/abstractMethod/result.test2
-rw-r--r--test/files/scalap/cbnParam/result.test2
-rw-r--r--test/files/scalap/classPrivate/result.test4
-rw-r--r--test/files/scalap/classWithExistential/result.test2
-rw-r--r--test/files/scalap/classWithSelfAnnotation/result.test2
-rw-r--r--test/files/scalap/covariantParam/result.test2
-rw-r--r--test/files/scalap/defaultParameter/result.test4
-rw-r--r--test/files/scalap/implicitParam/result.test2
-rw-r--r--test/files/scalap/packageObject/result.test2
-rw-r--r--test/files/scalap/paramClauses/result.test2
-rw-r--r--test/files/scalap/paramNames/result.test2
-rw-r--r--test/files/scalap/sequenceParam/result.test2
-rw-r--r--test/files/scalap/simpleClass/result.test2
-rw-r--r--test/files/scalap/traitObject/result.test4
-rw-r--r--test/files/scalap/typeAnnotations/result.test2
-rw-r--r--test/files/scalap/valAndVar/result.test2
-rw-r--r--test/files/scalap/wildcardType/result.test2
-rw-r--r--test/osgi/src/BasicReflection.scala18
-rw-r--r--test/pending/run/hk-lub-fail.scala10
-rw-r--r--test/pending/run/macro-expand-default/Impls_1.scala4
-rw-r--r--test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala4
-rw-r--r--test/pending/run/macro-expand-named/Impls_1.scala4
-rw-r--r--test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala6
-rw-r--r--test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala6
-rw-r--r--test/pending/run/macro-reify-tagless-b/Test_2.scala6
-rw-r--r--test/pending/run/t5427a.scala2
-rw-r--r--test/pending/run/t5427b.scala2
-rw-r--r--test/pending/run/t5427c.scala2
-rw-r--r--test/pending/run/t5427d.scala2
263 files changed, 939 insertions, 3068 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Names.scala b/src/compiler/scala/reflect/macros/runtime/Names.scala
index ee9f3a56d3..635e8bcd45 100644
--- a/src/compiler/scala/reflect/macros/runtime/Names.scala
+++ b/src/compiler/scala/reflect/macros/runtime/Names.scala
@@ -7,11 +7,20 @@ trait Names {
lazy val freshNameCreator = callsiteTyper.context.unit.fresh
def fresh(): String =
- freshNameCreator.newName()
+ freshName()
def fresh(name: String): String =
- freshNameCreator.newName(name)
+ freshName(name)
def fresh[NameType <: Name](name: NameType): NameType =
+ freshName[NameType](name)
+
+ def freshName(): String =
+ freshNameCreator.newName()
+
+ def freshName(name: String): String =
+ freshNameCreator.newName(name)
+
+ def freshName[NameType <: Name](name: NameType): NameType =
name.mapName(freshNameCreator.newName(_)).asInstanceOf[NameType]
} \ No newline at end of file
diff --git a/src/compiler/scala/reflect/reify/codegen/GenNames.scala b/src/compiler/scala/reflect/reify/codegen/GenNames.scala
index 7c3c1d1149..4266c6f8d6 100644
--- a/src/compiler/scala/reflect/reify/codegen/GenNames.scala
+++ b/src/compiler/scala/reflect/reify/codegen/GenNames.scala
@@ -7,7 +7,7 @@ trait GenNames {
import global._
def reifyName(name: Name) = {
- val factory = if (name.isTypeName) nme.nmeNewTypeName else nme.nmeNewTermName
+ val factory = if (name.isTypeName) nme.TypeName else nme.TermName
mirrorCall(factory, Literal(Constant(name.toString)))
}
}
diff --git a/src/compiler/scala/reflect/reify/utils/NodePrinters.scala b/src/compiler/scala/reflect/reify/utils/NodePrinters.scala
index 86e50e0a68..0740f8d0b6 100644
--- a/src/compiler/scala/reflect/reify/utils/NodePrinters.scala
+++ b/src/compiler/scala/reflect/reify/utils/NodePrinters.scala
@@ -36,8 +36,8 @@ trait NodePrinters {
flagsAreUsed = true
show(m.group(1).toLong)
})
- s = s.replace("Modifiers(0L, newTypeName(\"\"), List())", "Modifiers()")
- s = """Modifiers\((\d+)[lL], newTypeName\("(.*?)"\), List\((.*?)\)\)""".r.replaceAllIn(s, m => {
+ s = s.replace("Modifiers(0L, TypeName(\"\"), List())", "Modifiers()")
+ s = """Modifiers\((\d+)[lL], TypeName\("(.*?)"\), List\((.*?)\)\)""".r.replaceAllIn(s, m => {
val buf = new scala.collection.mutable.ListBuffer[String]
val annotations = m.group(3)
@@ -46,7 +46,7 @@ trait NodePrinters {
val privateWithin = "" + m.group(2)
if (buf.nonEmpty || privateWithin != "")
- buf.append("newTypeName(\"" + privateWithin + "\")")
+ buf.append("TypeName(\"" + privateWithin + "\")")
val bits = m.group(1)
if (buf.nonEmpty || bits != "0L") {
diff --git a/src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala b/src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala
index c647ef6f51..c5bb8494ce 100644
--- a/src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala
@@ -37,7 +37,7 @@ trait CompletionOutput {
val pkg = method.ownerChain find (_.isPackageClass) map (_.fullName) getOrElse ""
def relativize(str: String): String = quietString(str stripPrefix (pkg + "."))
- def relativize(tp: Type): String = relativize(tp.normalize.toString)
+ def relativize(tp: Type): String = relativize(tp.dealiasWiden.toString)
def braceList(tparams: List[String]) = if (tparams.isEmpty) "" else (tparams map relativize).mkString("[", ", ", "]")
def parenList(params: List[Any]) = params.mkString("(", ", ", ")")
@@ -55,8 +55,8 @@ trait CompletionOutput {
}
)
- def tupleString(tp: Type) = parenList(tp.normalize.typeArgs map relativize)
- def functionString(tp: Type) = tp.normalize.typeArgs match {
+ def tupleString(tp: Type) = parenList(tp.dealiasWiden.typeArgs map relativize)
+ def functionString(tp: Type) = tp.dealiasWiden.typeArgs match {
case List(t, r) => t + " => " + r
case xs => parenList(xs.init) + " => " + xs.last
}
@@ -64,7 +64,7 @@ trait CompletionOutput {
def tparamsString(tparams: List[Symbol]) = braceList(tparams map (_.defString))
def paramsString(params: List[Symbol]) = {
def paramNameString(sym: Symbol) = if (sym.isSynthetic) "" else sym.nameString + ": "
- def paramString(sym: Symbol) = paramNameString(sym) + typeToString(sym.info.normalize)
+ def paramString(sym: Symbol) = paramNameString(sym) + typeToString(sym.info.dealiasWiden)
val isImplicit = params.nonEmpty && params.head.isImplicit
val strs = (params map paramString) match {
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
index 91e909b1f1..36f012229e 100644
--- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
@@ -523,7 +523,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends
// normalize non-public types so we don't see protected aliases like Self
def normalizeNonPublic(tp: Type) = tp match {
- case TypeRef(_, sym, _) if sym.isAliasType && !sym.isPublic => tp.normalize
+ case TypeRef(_, sym, _) if sym.isAliasType && !sym.isPublic => tp.dealias
case _ => tp
}
diff --git a/src/compiler/scala/tools/nsc/matching/MatchSupport.scala b/src/compiler/scala/tools/nsc/matching/MatchSupport.scala
deleted file mode 100644
index 3c26997cfe..0000000000
--- a/src/compiler/scala/tools/nsc/matching/MatchSupport.scala
+++ /dev/null
@@ -1,115 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2013 LAMP/EPFL
- * Author: Paul Phillips
- */
-
-package scala.tools.nsc
-package matching
-
-import scala.annotation.elidable
-import scala.language.postfixOps
-
-/** Ancillary bits of ParallelMatching which are better off
- * out of the way.
- */
-trait MatchSupport extends ast.TreeDSL { self: ParallelMatching =>
-
- import global.{ typer => _, _ }
- import CODE._
-
- /** Debugging support: enable with -Ypmat-debug **/
- private final def trace = settings.Ypmatdebug.value
-
- def impossible: Nothing = abort("this never happens")
-
- object Types {
- import definitions._
-
- val subrangeTypes = Set[Symbol](ByteClass, ShortClass, CharClass, IntClass)
-
- implicit class RichType(undecodedTpe: Type) {
- def tpe = decodedEqualsType(undecodedTpe)
- def isAnyRef = tpe <:< AnyRefClass.tpe
-
- // These tests for final classes can inspect the typeSymbol
- private def is(s: Symbol) = tpe.typeSymbol eq s
- def isInt = is(IntClass)
- def isNothing = is(NothingClass)
- }
- }
-
- object Debug {
- def treeToString(t: Tree): String = treeInfo.unbind(t) match {
- case EmptyTree => "?"
- case WILD() => "_"
- case Literal(Constant(x)) => "LIT(%s)".format(x)
- case Apply(fn, args) => "%s(%s)".format(treeToString(fn), args map treeToString mkString ",")
- case Typed(expr, tpt) => "%s: %s".format(treeToString(expr), treeToString(tpt))
- case x => x.toString + " (" + x.getClass + ")"
- }
-
- // Formatting for some error messages
- private val NPAD = 15
- def pad(s: String): String = "%%%ds" format (NPAD-1) format s
-
- // pretty print for debugging
- def pp(x: Any): String = pp(x, false)
- def pp(x: Any, newlines: Boolean): String = {
- val stripStrings = List("""java\.lang\.""", """\$iw\.""")
-
- def clean(s: String): String =
- stripStrings.foldLeft(s)((s, x) => s.replaceAll(x, ""))
-
- def pplist(xs: List[Any]): String =
- if (newlines) (xs map (" " + _ + "\n")).mkString("\n", "", "")
- else xs.mkString("(", ", ", ")")
-
- pp(x match {
- case s: String => return clean(s)
- case x: Tree => asCompactString(x)
- case xs: List[_] => pplist(xs map pp)
- case x: Tuple2[_,_] => "%s -> %s".format(pp(x._1), pp(x._2))
- case x => x.toString
- })
- }
-
- @elidable(elidable.FINE) def TRACE(f: String, xs: Any*): Unit = {
- if (trace) {
- val msg = if (xs.isEmpty) f else f.format(xs map pp: _*)
- println(msg)
- }
- }
- @elidable(elidable.FINE) def traceCategory(cat: String, f: String, xs: Any*) = {
- if (trace)
- TRACE("[" + """%10s""".format(cat) + "] " + f, xs: _*)
- }
- def tracing[T](s: String)(x: T): T = {
- if (trace)
- println(("[" + """%10s""".format(s) + "] %s") format pp(x))
-
- x
- }
- private[nsc] def printing[T](fmt: String, xs: Any*)(x: T): T = {
- println(fmt.format(xs: _*) + " == " + x)
- x
- }
- private[nsc] def debugging[T](fmt: String, xs: Any*)(x: T): T = {
- if (settings.debug.value) printing(fmt, xs: _*)(x)
- else x
- }
-
- def indentAll(s: Seq[Any]) = s map (" " + _.toString() + "\n") mkString
- }
-
- /** Drops the 'i'th element of a list.
- */
- def dropIndex[T](xs: List[T], n: Int) = {
- val (l1, l2) = xs splitAt n
- l1 ::: (l2 drop 1)
- }
-
- /** Extract the nth element of a list and return it and the remainder.
- */
- def extractIndex[T](xs: List[T], n: Int): (T, List[T]) =
- (xs(n), dropIndex(xs, n))
-}
diff --git a/src/compiler/scala/tools/nsc/matching/Matrix.scala b/src/compiler/scala/tools/nsc/matching/Matrix.scala
deleted file mode 100644
index ba966acf34..0000000000
--- a/src/compiler/scala/tools/nsc/matching/Matrix.scala
+++ /dev/null
@@ -1,232 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2013 LAMP/EPFL
- * Author: Paul Phillips
- */
-
-package scala.tools.nsc
-package matching
-
-import transform.ExplicitOuter
-import symtab.Flags
-import scala.collection.mutable
-import scala.language.implicitConversions
-
-trait Matrix extends MatrixAdditions {
- self: ExplicitOuter with ParallelMatching =>
-
- import global.{ typer => _, _ }
- import analyzer.Typer
- import CODE._
- import Debug._
- import Flags.{ SYNTHETIC, MUTABLE }
-
- private[matching] val NO_EXHAUSTIVE = Flags.TRANS_FLAG
-
- /** Translation of match expressions.
- *
- * `p`: pattern
- * `g`: guard
- * `bx`: body index
- *
- * internal representation is (tvars:List[Symbol], rows:List[Row])
- *
- * tmp1 tmp_n
- * Row( p_11 ... p_1n g_1 b_1 ) + subst
- *
- * Row( p_m1 ... p_mn g_m b_m ) + subst
- *
- * Implementation based on the algorithm described in
- *
- * "A Term Pattern-Match Compiler Inspired by Finite Automata Theory"
- * Mikael Pettersson
- * ftp://ftp.ida.liu.se/pub/labs/pelab/papers/cc92pmc.ps.gz
- *
- * @author Burak Emir
- */
-
- /** "The Mixture Rule"
-
- {v=pat1, pats1 .. } {q1}
- match {.. } {..}
- {v=patn, patsn .. } {qn}
-
- The is the real work-horse of the algorithm. There is some column whose top-most pattern is a
- constructor. (Forsimplicity, itisdepicted above asthe left-most column, but anycolumn will do.)
- The goal is to build a test state with the variablevand some outgoing arcs (one for each construc-
- tor and possibly a default arc). Foreach constructor in the selected column, its arc is defined as
- follows:
-
- Let {i1,...,ij} be the rows-indices of the patterns in the column that match c. Since the pat-
- terns are viewed as regular expressions, this will be the indices of the patterns that either
- have the same constructor c, or are wildcards.
-
- Let {pat1,...,patj} be the patterns in the column corresponding to the indices computed
- above, and let nbe the arity of the constructor c, i.e. the number of sub-patterns it has. For
- eachpati, its n sub-patterns are extracted; if pat i is a wildcard, nwildcards are produced
- instead, each tagged with the right path variable. This results in a pattern matrix with n
- columns and j rows. This matrix is then appended to the result of selecting, from each col-
- umn in the rest of the original matrix, those rows whose indices are in {i1,...,ij}. Finally
- the indices are used to select the corresponding final states that go with these rows. Note
- that the order of the indices is significant; selected rows do not change their relative orders.
- The arc for the constructor c is now defined as (c’,state), where c’ is cwith any
- immediate sub-patterns replaced by their path variables (thus c’ is a simple pattern), and
- state is the result of recursively applying match to the new matrix and the new sequence
- of final states.
-
- Finally, the possibility for matching failure is considered. If the set of constructors is exhaustive,
- then no more arcs are computed. Otherwise, a default arc(_,state)is the last arc. If there are
- any wildcard patterns in the selected column, then their rows are selected from the rest of the
- matrix and the final states, and the state is the result of applying match to the new matrix and
- states. Otherwise,the error state is used after its reference count has been incremented.
- **/
-
- /** Handles all translation of pattern matching.
- */
- def handlePattern(
- selector: Tree, // tree being matched upon (called scrutinee after this)
- cases: List[CaseDef], // list of cases in the match
- isChecked: Boolean, // whether exhaustiveness checking is enabled (disabled with @unchecked)
- context: MatrixContext): Tree =
- {
- import context._
- TRACE("handlePattern", "(%s: %s) match { %s cases }", selector, selector.tpe, cases.size)
-
- val matrixInit: MatrixInit = {
- val v = copyVar(selector, isChecked, selector.tpe, "temp")
- MatrixInit(List(v), cases, atPos(selector.pos)(MATCHERROR(v.ident)))
- }
- val matrix = new MatchMatrix(context) { lazy val data = matrixInit }
- val mch = typer typed matrix.expansion.toTree
- val dfatree = typer typed Block(matrix.data.valDefs, mch)
-
- // redundancy check
- matrix.targets filter (_.unreached) foreach (cs => cunit.error(cs.body.pos, "unreachable code"))
- // optimize performs squeezing and resets any remaining NO_EXHAUSTIVE
- tracing("handlePattern")(matrix optimize dfatree)
- }
-
- case class MatrixContext(
- cunit: CompilationUnit, // current unit
- handleOuter: Tree => Tree, // for outer pointer
- typer: Typer, // a local typer
- owner: Symbol, // the current owner
- matchResultType: Type) // the expected result type of the whole match
- extends Squeezer
- {
- private def ifNull[T](x: T, alt: T) = if (x == null) alt else x
-
- // NO_EXHAUSTIVE communicates there should be no exhaustiveness checking
- private def flags(checked: Boolean) = if (checked) Nil else List(NO_EXHAUSTIVE)
-
- // Recording the symbols of the synthetics we create so we don't go clearing
- // anyone else's mutable flags.
- private val _syntheticSyms = mutable.HashSet[Symbol]()
- def clearSyntheticSyms() = {
- _syntheticSyms foreach (_ resetFlag (NO_EXHAUSTIVE|MUTABLE))
- debuglog("Cleared NO_EXHAUSTIVE/MUTABLE on " + _syntheticSyms.size + " synthetic symbols.")
- _syntheticSyms.clear()
- }
- def recordSyntheticSym(sym: Symbol): Symbol = {
- _syntheticSyms += sym
- if (_syntheticSyms.size > 25000) {
- cunit.error(owner.pos, "Sanity check failed: over 25000 symbols created for pattern match.")
- abort("This is a bug in the pattern matcher.")
- }
- sym
- }
-
- case class MatrixInit(
- roots: List[PatternVar],
- cases: List[CaseDef],
- default: Tree
- ) {
- def valDefs = roots map (_.valDef)
- override def toString() = "MatrixInit(roots = %s, %d cases)".format(pp(roots), cases.size)
- }
-
- implicit def pvlist2pvgroup(xs: List[PatternVar]): PatternVarGroup =
- PatternVarGroup(xs)
-
- object PatternVarGroup {
- def apply(xs: PatternVar*) = new PatternVarGroup(xs.toList)
- def apply(xs: List[PatternVar]) = new PatternVarGroup(xs)
- }
-
- val emptyPatternVarGroup = PatternVarGroup()
- class PatternVarGroup(val pvs: List[PatternVar]) {
- def syms = pvs map (_.sym)
- def valDefs = pvs map (_.valDef)
-
- def extractIndex(index: Int): (PatternVar, PatternVarGroup) = {
- val (t, ts) = self.extractIndex(pvs, index)
- (t, PatternVarGroup(ts))
- }
-
- def isEmpty = pvs.isEmpty
- def size = pvs.size
- def :::(ts: List[PatternVar]) = PatternVarGroup(ts ::: pvs)
-
- def apply(i: Int) = pvs(i)
- def zipWithIndex = pvs.zipWithIndex
- def indices = pvs.indices
-
- override def toString() = pp(pvs)
- }
-
- /** Every temporary variable allocated is put in a PatternVar.
- */
- class PatternVar(val lhs: Symbol, val rhs: Tree, val checked: Boolean) {
- def sym = lhs
- def tpe = lhs.tpe
- if (checked)
- lhs resetFlag NO_EXHAUSTIVE
- else
- lhs setFlag NO_EXHAUSTIVE
-
- // See #1427 for an example of a crash which occurs unless we retype:
- // in that instance there is an existential in the pattern.
- lazy val ident = typer typed Ident(lhs)
- lazy val valDef = typer typedValDef ValDef(lhs, rhs)
-
- override def toString() = "%s: %s = %s".format(lhs, tpe, rhs)
- }
-
- /** Given a tree, creates a new synthetic variable of the same type
- * and assigns the tree to it.
- */
- def copyVar(
- root: Tree,
- checked: Boolean,
- _tpe: Type = null,
- label: String = "temp"): PatternVar =
- {
- val tpe = ifNull(_tpe, root.tpe)
- val name = cunit.freshTermName(label)
- val sym = newVar(root.pos, tpe, flags(checked), name)
-
- tracing("copy")(new PatternVar(sym, root, checked))
- }
-
- /** Creates a new synthetic variable of the specified type and
- * assigns the result of f(symbol) to it.
- */
- def createVar(tpe: Type, f: Symbol => Tree, checked: Boolean) = {
- val lhs = newVar(owner.pos, tpe, flags(checked))
- val rhs = f(lhs)
-
- tracing("create")(new PatternVar(lhs, rhs, checked))
- }
-
- private def newVar(
- pos: Position,
- tpe: Type,
- flags: List[Long],
- name: TermName = null): Symbol =
- {
- val n = if (name == null) cunit.freshTermName("temp") else name
- // careful: pos has special meaning
- val flagsLong = (SYNTHETIC.toLong /: flags)(_|_)
- recordSyntheticSym(owner.newVariable(n, pos, flagsLong) setInfo tpe)
- }
- }
-}
diff --git a/src/compiler/scala/tools/nsc/matching/MatrixAdditions.scala b/src/compiler/scala/tools/nsc/matching/MatrixAdditions.scala
deleted file mode 100644
index b1ca6e7b5a..0000000000
--- a/src/compiler/scala/tools/nsc/matching/MatrixAdditions.scala
+++ /dev/null
@@ -1,191 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2013 LAMP/EPFL
- * Author: Paul Phillips
- */
-
-package scala.tools.nsc
-package matching
-
-import transform.ExplicitOuter
-
-/** Traits which are mixed into MatchMatrix, but separated out as
- * (somewhat) independent components to keep them on the sidelines.
- */
-trait MatrixAdditions extends ast.TreeDSL {
- self: ExplicitOuter with ParallelMatching =>
-
- import global.{ typer => _, _ }
- import symtab.Flags
- import Debug._
- import treeInfo._
- import definitions.{ isPrimitiveValueClass }
-
- /** The Squeezer, responsible for all the squeezing.
- */
- private[matching] trait Squeezer {
- self: MatrixContext =>
-
- private val settings_squeeze = !settings.Ynosqueeze.value
-
- class RefTraverser(vd: ValDef) extends Traverser {
- private val targetSymbol = vd.symbol
- private var safeRefs = 0
- private var isSafe = true
-
- def canDrop = isSafe && safeRefs == 0
- def canInline = isSafe && safeRefs == 1
-
- override def traverse(tree: Tree): Unit = tree match {
- case t: Ident if t.symbol eq targetSymbol =>
- // target symbol's owner should match currentOwner
- if (targetSymbol.owner == currentOwner) safeRefs += 1
- else isSafe = false
-
- case LabelDef(_, params, rhs) =>
- if (params exists (_.symbol eq targetSymbol)) // cannot substitute this one
- isSafe = false
-
- traverse(rhs)
- case _ if safeRefs > 1 => ()
- case _ =>
- super.traverse(tree)
- }
- }
-
- /** Compresses multiple Blocks. */
- private def combineBlocks(stats: List[Tree], expr: Tree): Tree = expr match {
- case Block(stats1, expr1) if stats.isEmpty => combineBlocks(stats1, expr1)
- case _ => Block(stats, expr)
- }
- def squeezedBlock(vds: List[Tree], exp: Tree): Tree =
- if (settings_squeeze) combineBlocks(Nil, squeezedBlock1(vds, exp))
- else combineBlocks(vds, exp)
-
- private def squeezedBlock1(vds: List[Tree], exp: Tree): Tree = {
- lazy val squeezedTail = squeezedBlock(vds.tail, exp)
- def default = squeezedTail match {
- case Block(vds2, exp2) => Block(vds.head :: vds2, exp2)
- case exp2 => Block(vds.head :: Nil, exp2)
- }
-
- if (vds.isEmpty) exp
- else vds.head match {
- case vd: ValDef =>
- val rt = new RefTraverser(vd)
- rt.atOwner(owner)(rt traverse squeezedTail)
-
- if (rt.canDrop)
- squeezedTail
- else if (isConstantType(vd.symbol.tpe) || rt.canInline)
- new TreeSubstituter(List(vd.symbol), List(vd.rhs)) transform squeezedTail
- else
- default
- case _ => default
- }
- }
- }
-
- /** The Optimizer, responsible for some of the optimizing.
- */
- private[matching] trait MatchMatrixOptimizer {
- self: MatchMatrix =>
-
- import self.context._
-
- final def optimize(tree: Tree): Tree = {
- // Uses treeInfo extractors rather than looking at trees directly
- // because the many Blocks obscure our vision.
- object lxtt extends Transformer {
- override def transform(tree: Tree): Tree = tree match {
- case Block(stats, ld @ LabelDef(_, _, body)) if targets exists (_ shouldInline ld.symbol) =>
- squeezedBlock(transformStats(stats, currentOwner), body)
- case IsIf(cond, IsTrue(), IsFalse()) =>
- transform(cond)
- case IsIf(cond1, IsIf(cond2, thenp, elsep1), elsep2) if elsep1 equalsStructure elsep2 =>
- transform(typer typed If(gen.mkAnd(cond1, cond2), thenp, elsep2))
- case If(cond1, IsIf(cond2, thenp, Apply(jmp, Nil)), ld: LabelDef) if jmp.symbol eq ld.symbol =>
- transform(typer typed If(gen.mkAnd(cond1, cond2), thenp, ld))
- case _ =>
- super.transform(tree)
- }
- }
- try lxtt transform tree
- finally clearSyntheticSyms()
- }
- }
-
- /** The Exhauster.
- */
- private[matching] trait MatrixExhaustiveness {
- self: MatchMatrix =>
-
- import self.context._
-
- /** Exhaustiveness checking requires looking for sealed classes
- * and if found, making sure all children are covered by a pattern.
- */
- class ExhaustivenessChecker(rep: Rep, matchPos: Position) {
- val Rep(tvars, rows) = rep
-
- import Flags.{ MUTABLE, ABSTRACT, SEALED }
-
- private case class Combo(index: Int, sym: Symbol) { }
-
- /* True if the patterns in 'row' cover the given type symbol combination, and has no guard. */
- private def rowCoversCombo(row: Row, combos: List[Combo]) =
- row.guard.isEmpty && combos.forall(c => row.pats(c.index) covers c.sym)
-
- private def requiresExhaustive(sym: Symbol) = {
- (sym.isMutable) && // indicates that have not yet checked exhaustivity
- !(sym hasFlag NO_EXHAUSTIVE) && // indicates @unchecked
- (sym.tpe.typeSymbol.isSealed) &&
- !isPrimitiveValueClass(sym.tpe.typeSymbol) // make sure it's not a primitive, else (5: Byte) match { case 5 => ... } sees no Byte
- }
-
- private lazy val inexhaustives: List[List[Combo]] = {
- // let's please not get too clever side-effecting the mutable flag.
- val toCollect = tvars.zipWithIndex filter { case (pv, i) => requiresExhaustive(pv.sym) }
- val collected = toCollect map { case (pv, i) =>
- // okay, now reset the flag
- pv.sym resetFlag MUTABLE
-
- i -> (
- pv.tpe.typeSymbol.sealedDescendants.toList sortBy (_.sealedSortName)
- // symbols which are both sealed and abstract need not be covered themselves, because
- // all of their children must be and they cannot otherwise be created.
- filterNot (x => x.isSealed && x.isAbstractClass && !isPrimitiveValueClass(x))
- // have to filter out children which cannot match: see ticket #3683 for an example
- filter (_.tpe matchesPattern pv.tpe)
- )
- }
-
- val folded =
- collected.foldRight(List[List[Combo]]())((c, xs) => {
- val (i, syms) = c match { case (i, set) => (i, set.toList) }
- xs match {
- case Nil => syms map (s => List(Combo(i, s)))
- case _ => for (s <- syms ; rest <- xs) yield Combo(i, s) :: rest
- }
- })
-
- folded filterNot (combo => rows exists (r => rowCoversCombo(r, combo)))
- }
-
- private def mkPad(xs: List[Combo], i: Int): String = xs match {
- case Nil => pad("*")
- case Combo(j, sym) :: rest => if (j == i) pad(sym.name.toString) else mkPad(rest, i)
- }
- private def mkMissingStr(open: List[Combo]) =
- "missing combination %s\n" format tvars.indices.map(mkPad(open, _)).mkString
-
- /** The only public method. */
- def check = {
- def errMsg = (inexhaustives map mkMissingStr).mkString
- if (inexhaustives.nonEmpty)
- cunit.warning(matchPos, "match is not exhaustive!\n" + errMsg)
-
- rep
- }
- }
- }
-}
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
deleted file mode 100644
index b5e25f3809..0000000000
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ /dev/null
@@ -1,866 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2013 LAMP/EPFL
- * Copyright 2007 Google Inc. All Rights Reserved.
- * Author: bqe@google.com (Burak Emir)
- */
-
-package scala.tools.nsc
-package matching
-
-import PartialFunction._
-import scala.collection.{ mutable }
-import transform.ExplicitOuter
-import mutable.ListBuffer
-import scala.language.postfixOps
-
-trait ParallelMatching extends ast.TreeDSL
- with MatchSupport
- with Matrix
- with Patterns
- with PatternBindings
-{
- self: ExplicitOuter =>
-
- import global.{ typer => _, _ }
- import definitions.{
- IntClass, BooleanClass, SomeClass, OptionClass,
- getProductArgs, productProj, Object_eq, Any_asInstanceOf
- }
- import CODE._
- import Types._
- import Debug._
-
- /** Transition **/
- def toPats(xs: List[Tree]): List[Pattern] = xs map Pattern.apply
-
- /** The umbrella matrix class. **/
- abstract class MatchMatrix(val context: MatrixContext) extends MatchMatrixOptimizer with MatrixExhaustiveness {
- import context._
-
- def data: MatrixContext#MatrixInit
-
- lazy val MatrixInit(roots, cases, failTree) = data
- lazy val (rows, targets) = expand(roots, cases).unzip
- lazy val expansion: Rep = make(roots, rows)
-
- private val shortCuts = perRunCaches.newMap[Int, Symbol]()
-
- final def createShortCut(theLabel: Symbol): Int = {
- val key = shortCuts.size + 1
- shortCuts(key) = theLabel
- -key
- }
- def createLabelDef(namePrefix: String, body: Tree, params: List[Symbol] = Nil, restpe: Type = matchResultType) = {
- val labelName = cunit.freshTermName(namePrefix)
- val labelSym = owner.newLabel(labelName, owner.pos)
- val labelInfo = MethodType(params, restpe)
-
- LabelDef(labelSym setInfo labelInfo, params, body setType restpe)
- }
-
- /** This is the recursively focal point for translating the current
- * list of pattern variables and a list of pattern match rows into
- * a tree suitable for entering erasure.
- *
- * The first time it is called, the variables are (copies of) the
- * original pattern matcher roots, and the rows correspond to the
- * original casedefs.
- */
- final def make(roots1: PatternVarGroup, rows1: List[Row]): Rep = {
- traceCategory("New Match", "%sx%s (%s)", roots1.size, rows1.size, roots1.syms.mkString(", "))
- def classifyPat(opat: Pattern, j: Int): Pattern = opat simplify roots1(j)
-
- val newRows = rows1 flatMap (_ expandAlternatives classifyPat)
- if (rows1.length != newRows.length) make(roots1, newRows) // recursive call if any change
- else {
- val rep = Rep(roots1, newRows)
- new ExhaustivenessChecker(rep, roots.head.sym.pos).check
- rep
- }
- }
-
- override def toString() = "MatchMatrix(%s) { %s }".format(matchResultType, indentAll(targets))
-
- /**
- * Encapsulates a symbol being matched on. It is created from a
- * PatternVar, which encapsulates the symbol's creation and assignment.
- *
- * We never match on trees directly - a temporary variable is created
- * (in a PatternVar) for any expression being matched on.
- */
- class Scrutinee(val pv: PatternVar) {
- import definitions._
-
- // presenting a face of our symbol
- def sym = pv.sym
- def tpe = sym.tpe
- def pos = sym.pos
- def id = ID(sym) setPos pos // attributed ident
-
- def accessors = if (isCaseClass) sym.caseFieldAccessors else Nil
- def accessorTypes = accessors map (x => (tpe memberType x).resultType)
-
- lazy val accessorPatternVars = PatternVarGroup(
- for ((accessor, tpe) <- accessors zip accessorTypes) yield
- createVar(tpe, _ => fn(id, accessor))
- )
-
- private def extraValDefs = if (pv.rhs.isEmpty) Nil else List(pv.valDef)
- def allValDefs = extraValDefs ::: accessorPatternVars.valDefs
-
- // tests
- def isDefined = sym ne NoSymbol
- def isSubrangeType = subrangeTypes(tpe.typeSymbol)
- def isCaseClass = tpe.typeSymbol.isCase
-
- // sequences
- def seqType = tpe.widen baseType SeqClass
- def elemType = tpe typeArgs 0
-
- private def elemAt(i: Int) = (id DOT (tpe member nme.apply))(LIT(i))
- private def createElemVar(i: Int) = createVar(elemType, _ => elemAt(i))
- private def createSeqVar(drop: Int) = createVar(seqType, _ => id DROP drop)
-
- def createSequenceVars(count: Int): List[PatternVar] =
- (0 to count).toList map (i => if (i < count) createElemVar(i) else createSeqVar(i))
-
- // for propagating "unchecked" to synthetic vars
- def isChecked = !(sym hasFlag NO_EXHAUSTIVE)
- // def flags: List[Long] = List(NO_EXHAUSTIVE) filter (sym hasFlag _)
-
- // this is probably where this actually belongs
- def createVar(tpe: Type, f: Symbol => Tree) = context.createVar(tpe, f, isChecked)
-
- def castedTo(headType: Type) =
- if (tpe =:= headType) this
- else new Scrutinee(createVar(headType, lhs => gen.mkAsInstanceOf(id, lhs.tpe)))
-
- override def toString() = "(%s: %s)".format(id, tpe)
- }
-
- def isPatternSwitch(scrut: Scrutinee, ps: List[Pattern]): Option[PatternSwitch] = {
- def isSwitchableConst(x: Pattern) = cond(x) { case x: LiteralPattern if x.isSwitchable => true }
- def isSwitchableDefault(x: Pattern) = isSwitchableConst(x) || x.isDefault
-
- // TODO - scala> (5: Any) match { case 5 => 5 ; case 6 => 7 }
- // ... should compile to a switch. It doesn't because the scrut isn't Int/Char, but
- // that could be handle in an if/else since every pattern requires an Int.
- // More immediately, Byte and Short scruts should also work.
- if (!scrut.isSubrangeType) None
- else {
- val (_lits, others) = ps span isSwitchableConst
- val lits = _lits collect { case x: LiteralPattern => x }
-
- condOpt(others) {
- case Nil => new PatternSwitch(scrut, lits, None)
- // TODO: This needs to also allow the case that the last is a compatible type pattern.
- case List(x) if isSwitchableDefault(x) => new PatternSwitch(scrut, lits, Some(x))
- }
- }
- }
-
- class PatternSwitch(
- scrut: Scrutinee,
- override val ps: List[LiteralPattern],
- val defaultPattern: Option[Pattern]
- ) extends PatternMatch(scrut, ps) {
- require(scrut.isSubrangeType && (ps forall (_.isSwitchable)))
- }
-
- case class PatternMatch(scrut: Scrutinee, ps: List[Pattern]) {
- def head = ps.head
- def tail = ps.tail
- // def size = ps.length
-
- def headType = head.necessaryType
- private val dummyCount = if (head.isCaseClass) headType.typeSymbol.caseFieldAccessors.length else 0
- def dummies = emptyPatterns(dummyCount)
-
- def apply(i: Int): Pattern = ps(i)
- def pzip() = ps.zipWithIndex
- def pzip[T](others: List[T]) = {
- assert(ps.size == others.size, "Internal error: ps = %s, others = %s".format(ps, others))
- ps zip others
- }
-
- // Any unapply - returns Some(true) if a type test is needed before the unapply can
- // be called (e.g. def unapply(x: Foo) = { ... } but our scrutinee is type Any.)
- object AnyUnapply {
- def unapply(x: Pattern): Option[Boolean] = condOpt(x.tree) {
- case UnapplyParamType(tpe) => !(scrut.tpe <:< tpe)
- }
- }
-
- def mkRule(rest: Rep): RuleApplication = {
- tracing("Rule")(head match {
- case x if isEquals(x.tree.tpe) => new MixEquals(this, rest)
- case x: SequencePattern => new MixSequence(this, rest, x)
- case AnyUnapply(false) => new MixUnapply(this, rest)
- case _ =>
- isPatternSwitch(scrut, ps) match {
- case Some(x) => new MixLiteralInts(x, rest)
- case _ => new MixTypes(this, rest)
- }
- })
- }
- override def toString() = "%s match {%s}".format(scrut, indentAll(ps))
- } // PatternMatch
-
- /***** Rule Applications *****/
-
- sealed abstract class RuleApplication {
- def pmatch: PatternMatch
- def rest: Rep
- def cond: Tree
- def success: Tree
- def failure: Tree
-
- lazy val PatternMatch(scrut, patterns) = pmatch
- lazy val head = pmatch.head
- lazy val codegen: Tree = IF (cond) THEN (success) ELSE (failure)
-
- def mkFail(xs: List[Row]): Tree =
- if (xs.isEmpty) failTree
- else remake(xs).toTree
-
- def remake(
- rows: List[Row],
- pvgroup: PatternVarGroup = emptyPatternVarGroup,
- includeScrut: Boolean = true): Rep =
- {
- val scrutpvs = if (includeScrut) List(scrut.pv) else Nil
- make(pvgroup.pvs ::: scrutpvs ::: rest.tvars, rows)
- }
-
- /** translate outcome of the rule application into code (possible involving recursive application of rewriting) */
- def tree(): Tree
-
- override def toString =
- "Rule/%s (%s =^= %s)".format(getClass.getSimpleName, scrut, head)
- }
-
- /** {case ... if guard => bx} else {guardedRest} */
- /** VariableRule: The top-most rows has only variable (non-constructor) patterns. */
- case class VariableRule(subst: Bindings, guard: Tree, guardedRest: Rep, bx: Int) extends RuleApplication {
- def pmatch: PatternMatch = impossible
- def rest: Rep = guardedRest
-
- private lazy val (valDefs, successTree) = targets(bx) applyBindings subst.toMap
- lazy val cond = guard
- lazy val success = successTree
- lazy val failure = guardedRest.toTree
-
- final def tree(): Tree =
- if (bx < 0) REF(shortCuts(-bx))
- else squeezedBlock(
- valDefs,
- if (cond.isEmpty) success else codegen
- )
-
- override def toString = "(case %d) {\n Bindings: %s\n\n if (%s) { %s }\n else { %s }\n}".format(
- bx, subst, guard, success, guardedRest
- )
- }
-
- class MixLiteralInts(val pmatch: PatternSwitch, val rest: Rep) extends RuleApplication {
- val literals = pmatch.ps
- val defaultPattern = pmatch.defaultPattern
-
- private lazy val casted: Tree =
- if (!scrut.tpe.isInt) scrut.id DOT nme.toInt else scrut.id
-
- // creates a row transformer for injecting the default case bindings at a given index
- private def addDefaultVars(index: Int): Row => Row =
- if (defaultVars.isEmpty) identity
- else rebindAll(_, pmatch(index).boundVariables, scrut.sym)
-
- // add bindings for all the given vs to the given tvar
- private def rebindAll(r: Row, vs: Iterable[Symbol], tvar: Symbol) =
- r rebind r.subst.add(vs, tvar)
-
- private def bindVars(Tag: Int, orig: Bindings): Bindings = {
- def myBindVars(rest: List[(Int, List[Symbol])], bnd: Bindings): Bindings = rest match {
- case Nil => bnd
- case (Tag,vs)::xs => myBindVars(xs, bnd.add(vs, scrut.sym))
- case (_, vs)::xs => myBindVars(xs, bnd)
- }
- myBindVars(varMap, orig)
- }
-
- // bound vars and rows for default pattern (only one row, but a list is easier to use later)
- lazy val (defaultVars, defaultRows) = defaultPattern match {
- case None => (Nil, Nil)
- case Some(p) => (p.boundVariables, List(rebindAll(rest rows literals.size, p.boundVariables, scrut.sym)))
- }
-
- // literalMap is a map from each literal to a list of row indices.
- // varMap is a list from each literal to a list of the defined vars.
- lazy val (litPairs, varMap) = (
- literals.zipWithIndex map {
- case (lit, index) =>
- val tag = lit.intValue
- (tag -> index, tag -> lit.boundVariables)
- } unzip
- )
- def literalMap = litPairs groupBy (_._1) map {
- case (k, vs) => (k, vs map (_._2))
- }
-
- lazy val cases =
- for ((tag, indices) <- literalMap.toList.sortBy(_._1)) yield {
- val newRows = indices map (i => addDefaultVars(i)(rest rows i))
- val r = remake(newRows ++ defaultRows, includeScrut = false)
- val r2 = make(r.tvars, r.rows map (x => x rebind bindVars(tag, x.subst)))
-
- CASE(Literal(Constant(tag))) ==> r2.toTree
- }
-
- lazy val defaultTree = remake(defaultRows, includeScrut = false).toTree
- def defaultCase = CASE(WILD(IntClass.tpe)) ==> defaultTree
-
- // cond/success/failure only used if there is exactly one case.
- lazy val cond = scrut.id MEMBER_== cases.head.pat
- lazy val success = cases.head.body
- lazy val failure = defaultTree
-
- // only one case becomes if/else, otherwise match
- def tree() =
- if (cases.size == 1) codegen
- else casted MATCH (cases :+ defaultCase: _*)
- }
-
- /** mixture rule for unapply pattern
- */
- class MixUnapply(val pmatch: PatternMatch, val rest: Rep) extends RuleApplication {
- val Pattern(UnApply(unMethod, unArgs)) = head
- val Apply(unTarget, _ :: trailing) = unMethod
-
- object SameUnapplyCall {
- def isSame(t: Tree) = isEquivalentTree(unTarget, t)
- def unapply(x: Pattern) = /*tracing("SameUnapplyCall (%s vs. %s)".format(unTarget, x))*/(x match {
- case Pattern(UnApply(Apply(fn, _), args)) if isSame(fn) => Some(args)
- case _ => None
- })
- }
- object SameUnapplyPattern {
- def isSame(t: Tree) = isEquivalentTree(unMethod, t)
- def apply(x: Pattern) = unapply(x).isDefined
- def unapply(x: Pattern) = /*tracing("SameUnapplyPattern (%s vs. %s)".format(unMethod, x))*/(x match {
- case Pattern(UnApply(t, _)) if isSame(t) => Some(unArgs)
- case _ => None
- })
- }
-
- private lazy val zipped = pmatch pzip rest.rows
-
- lazy val unapplyResult: PatternVar =
- scrut.createVar(unMethod.tpe, Apply(unTarget, scrut.id :: trailing) setType _.tpe)
-
- lazy val cond: Tree = unapplyResult.tpe.normalize match {
- case TypeRef(_, BooleanClass, _) => unapplyResult.ident
- case TypeRef(_, SomeClass, _) => TRUE
- case _ => NOT(unapplyResult.ident DOT nme.isEmpty)
- }
-
- lazy val failure =
- mkFail(zipped.tail filterNot (x => SameUnapplyPattern(x._1)) map { case (pat, r) => r insert pat })
-
- private def doSuccess: (List[PatternVar], List[PatternVar], List[Row]) = {
- // pattern variable for the unapply result of Some(x).get
- def unMethodTypeArg = unMethod.tpe.baseType(OptionClass).typeArgs match {
- case Nil => log("No type argument for unapply result! " + unMethod.tpe) ; NoType
- case arg :: _ => arg
- }
- lazy val pv = scrut.createVar(unMethodTypeArg, _ => fn(ID(unapplyResult.lhs), nme.get))
- def tuple = pv.lhs
-
- // at this point it's Some[T1,T2...]
- lazy val tpes = getProductArgs(tuple.tpe)
-
- // one pattern variable per tuple element
- lazy val tuplePVs =
- for ((tpe, i) <- tpes.zipWithIndex) yield
- scrut.createVar(tpe, _ => fn(ID(tuple), productProj(tuple, i + 1)))
-
- // the filter prevents infinite unapply recursion
- def mkNewRows(sameFilter: (List[Tree]) => List[Tree]) = {
- val dum = if (unArgs.length <= 1) unArgs.length else tpes.size
- for ((pat, r) <- zipped) yield pat match {
- case SameUnapplyCall(xs) => r.insert2(toPats(sameFilter(xs)) :+ NoPattern, pat.boundVariables, scrut.sym)
- case _ => r insert (emptyPatterns(dum) :+ pat)
- }
- }
-
- // 0 is Boolean, 1 is Option[T], 2+ is Option[(T1,T2,...)]
- unArgs.length match {
- case 0 => (Nil, Nil, mkNewRows((xs) => Nil))
- case 1 => (List(pv), List(pv), mkNewRows(xs => List(xs.head)))
- case _ => (pv :: tuplePVs, tuplePVs, mkNewRows(identity))
- }
- }
-
- lazy val success = {
- val (squeezePVs, pvs, rows) = doSuccess
- val srep = remake(rows, pvs).toTree
-
- squeezedBlock(squeezePVs map (_.valDef), srep)
- }
-
- final def tree() =
- squeezedBlock(List(handleOuter(unapplyResult.valDef)), codegen)
- }
-
- /** Handle Sequence patterns (including Star patterns.)
- * Note: pivot == head, just better typed.
- */
- sealed class MixSequence(val pmatch: PatternMatch, val rest: Rep, pivot: SequencePattern) extends RuleApplication {
- require(scrut.tpe <:< head.tpe)
-
- def hasStar = pivot.hasStar
- private def pivotLen = pivot.nonStarLength
- private def seqDummies = emptyPatterns(pivot.elems.length + 1)
-
- // Should the given pattern join the expanded pivot in the success matrix? If so,
- // this partial function will be defined for the pattern, and the result of the apply
- // is the expanded sequence of new patterns.
- lazy val successMatrixFn = new PartialFunction[Pattern, List[Pattern]] {
- private def seqIsDefinedAt(x: SequenceLikePattern) = (hasStar, x.hasStar) match {
- case (true, true) => true
- case (true, false) => pivotLen <= x.nonStarLength
- case (false, true) => pivotLen >= x.nonStarLength
- case (false, false) => pivotLen == x.nonStarLength
- }
-
- def isDefinedAt(pat: Pattern) = pat match {
- case x: SequenceLikePattern => seqIsDefinedAt(x)
- case WildcardPattern() => true
- case _ => false
- }
-
- def apply(pat: Pattern): List[Pattern] = pat match {
- case x: SequenceLikePattern =>
- def isSameLength = pivotLen == x.nonStarLength
- def rebound = x.nonStarPatterns :+ (x.elemPatterns.last rebindTo WILD(scrut.seqType))
-
- (pivot.hasStar, x.hasStar, isSameLength) match {
- case (true, true, true) => rebound :+ NoPattern
- case (true, true, false) => (seqDummies drop 1) :+ x
- case (true, false, true) => x.elemPatterns ++ List(NilPattern, NoPattern)
- case (false, true, true) => rebound
- case (false, false, true) => x.elemPatterns :+ NoPattern
- case _ => seqDummies
- }
-
- case _ => seqDummies
- }
- }
-
- // Should the given pattern be in the fail matrix? This is true of any sequences
- // as long as the result of the length test on the pivot doesn't make it impossible:
- // for instance if neither sequence is right ignoring and they are of different
- // lengths, the later one cannot match since its length must be wrong.
- def failureMatrixFn(c: Pattern) = (pivot ne c) && (c match {
- case x: SequenceLikePattern =>
- (hasStar, x.hasStar) match {
- case (_, true) => true
- case (true, false) => pivotLen > x.nonStarLength
- case (false, false) => pivotLen != x.nonStarLength
- }
- case WildcardPattern() => true
- case _ => false
- })
-
- // divide the remaining rows into success/failure branches, expanding subsequences of patterns
- val successRows = pmatch pzip rest.rows collect {
- case (c, row) if successMatrixFn isDefinedAt c => row insert successMatrixFn(c)
- }
- val failRows = pmatch pzip rest.rows collect {
- case (c, row) if failureMatrixFn(c) => row insert c
- }
-
- // the discrimination test for sequences is a call to lengthCompare. Note that
- // this logic must be fully consistent wiith successMatrixFn and failureMatrixFn above:
- // any inconsistency will (and frequently has) manifested as pattern matcher crashes.
- lazy val cond = {
- // the method call symbol
- val methodOp: Symbol = head.tpe member nme.lengthCompare
-
- // the comparison to perform. If the pivot is right ignoring, then a scrutinee sequence
- // of >= pivot length could match it; otherwise it must be exactly equal.
- val compareOp: (Tree, Tree) => Tree = if (hasStar) _ INT_>= _ else _ INT_== _
-
- // scrutinee.lengthCompare(pivotLength) [== | >=] 0
- val compareFn: Tree => Tree = (t: Tree) => compareOp((t DOT methodOp)(LIT(pivotLen)), ZERO)
-
- // wrapping in a null check on the scrutinee
- // XXX this needs to use the logic in "def condition"
- nullSafe(compareFn, FALSE)(scrut.id)
- // condition(head.tpe, scrut.id, head.boundVariables.nonEmpty)
- }
- lazy val success = {
- // one pattern var per sequence element up to elemCount, and one more for the rest of the sequence
- lazy val pvs = scrut createSequenceVars pivotLen
-
- squeezedBlock(pvs map (_.valDef), remake(successRows, pvs, hasStar).toTree)
- }
- lazy val failure = remake(failRows).toTree
-
- final def tree(): Tree = codegen
- }
-
- class MixEquals(val pmatch: PatternMatch, val rest: Rep) extends RuleApplication {
- private lazy val rhs =
- decodedEqualsType(head.tpe) match {
- case SingleType(pre, sym) => REF(pre, sym)
- case PseudoType(o) => o
- }
- private lazy val labelDef =
- createLabelDef("fail%", remake((rest.rows.tail, pmatch.tail).zipped map (_ insert _)).toTree)
-
- lazy val cond = handleOuter(rhs MEMBER_== scrut.id)
- lazy val successOne = rest.rows.head.insert2(List(NoPattern), head.boundVariables, scrut.sym)
- lazy val successTwo = Row(emptyPatterns(1 + rest.tvars.size), NoBinding, EmptyTree, createShortCut(labelDef.symbol))
- lazy val success = remake(List(successOne, successTwo)).toTree
- lazy val failure = labelDef
-
- final def tree() = codegen
- override def toString() = "MixEquals(%s == %s)".format(scrut, head)
- }
-
- /** Mixture rule for type tests.
- * moreSpecific: more specific patterns
- * subsumed: more general patterns (subsuming current), rows index and subpatterns
- * remaining: remaining, rows index and pattern
- */
- class MixTypes(val pmatch: PatternMatch, val rest: Rep) extends RuleApplication {
- case class Yes(bx: Int, moreSpecific: Pattern, subsumed: List[Pattern])
- case class No(bx: Int, remaining: Pattern)
-
- val (yeses, noes) = {
- val _ys = new ListBuffer[Yes]
- val _ns = new ListBuffer[No]
-
- for ((pattern, j) <- pmatch.pzip()) {
- // scrutinee, head of pattern group
- val (s, p) = (pattern.tpe, head.necessaryType)
-
- def isEquivalent = head.necessaryType =:= pattern.tpe
- def isObjectTest = pattern.isObject && (p =:= pattern.necessaryType)
-
- def sMatchesP = matches(s, p)
- def pMatchesS = matches(p, s)
-
- def ifEquiv(yes: Pattern): Pattern = if (isEquivalent) yes else pattern
-
- def passl(p: Pattern = NoPattern, ps: List[Pattern] = pmatch.dummies) = Some(Yes(j, p, ps))
- def passr() = Some( No(j, pattern))
-
- def typed(pp: Tree) = passl(ifEquiv(Pattern(pp)))
- def subs() = passl(ifEquiv(NoPattern), pattern subpatterns pmatch)
-
- val (oneY, oneN) = pattern match {
- case Pattern(LIT(null)) if !(p =:= s) => (None, passr) // (1)
- case x if isObjectTest => (passl(), None) // (2)
- case Pattern(Typed(pp, _)) if sMatchesP => (typed(pp), None) // (4)
- // The next line used to be this which "fixed" 1697 but introduced
- // numerous regressions including #3136.
- // case Pattern(_: UnApply, _) => (passl(), passr)
- case Pattern(_: UnApply) => (None, passr)
- case x if !x.isDefault && sMatchesP => (subs(), None)
- case x if x.isDefault || pMatchesS => (passl(), passr)
- case _ => (None, passr)
- }
- oneY map (_ys +=)
- oneN map (_ns +=)
- }
- (_ys.toList, _ns.toList)
- }
-
- // val moreSpecific = yeses map (_.moreSpecific)
- val subsumed = yeses map (x => (x.bx, x.subsumed))
- val remaining = noes map (x => (x.bx, x.remaining))
-
- private def mkZipped =
- for (Yes(j, moreSpecific, subsumed) <- yeses) yield
- j -> (moreSpecific :: subsumed)
-
- lazy val casted = scrut castedTo pmatch.headType
- lazy val cond = condition(casted.tpe, scrut, head.boundVariables.nonEmpty)
-
- private def isAnyMoreSpecific = yeses exists (x => !x.moreSpecific.isEmpty)
- lazy val (subtests, subtestVars) =
- if (isAnyMoreSpecific) (mkZipped, List(casted.pv))
- else (subsumed, Nil)
-
- lazy val newRows =
- for ((j, ps) <- subtests) yield
- (rest rows j).insert2(ps, pmatch(j).boundVariables, casted.sym)
-
- lazy val success = {
- val srep = remake(newRows, subtestVars ::: casted.accessorPatternVars, includeScrut = false)
- squeezedBlock(casted.allValDefs, srep.toTree)
- }
-
- lazy val failure =
- mkFail(remaining map { case (p1, p2) => rest rows p1 insert p2 })
-
- final def tree(): Tree = codegen
- }
-
- /*** States, Rows, Etc. ***/
-
- case class Row(pats: List[Pattern], subst: Bindings, guard: Tree, bx: Int) {
- private def nobindings = subst.get().isEmpty
- private def bindstr = if (nobindings) "" else pp(subst)
-
- /** Extracts the 'i'th pattern. */
- def extractColumn(i: Int) = {
- val (x, xs) = extractIndex(pats, i)
- (x, copy(pats = xs))
- }
-
- /** Replaces the 'i'th pattern with the argument. */
- def replaceAt(i: Int, p: Pattern) = {
- val newps = (pats take i) ::: p :: (pats drop (i + 1))
- copy(pats = newps)
- }
-
- def insert(h: Pattern) = copy(pats = h :: pats)
- def insert(hs: List[Pattern]) = copy(pats = hs ::: pats) // prepends supplied pattern
- def rebind(b: Bindings) = copy(subst = b) // substitutes for bindings
-
- def insert2(hs: List[Pattern], vs: Iterable[Symbol], tvar: Symbol) =
- tracing("insert2")(copy(pats = hs ::: pats, subst = subst.add(vs, tvar)))
-
- // returns this rows with alternatives expanded
- def expandAlternatives(classifyPat: (Pattern, Int) => Pattern): List[Row] = {
- def isNotAlternative(p: Pattern) = !cond(p.tree) { case _: Alternative => true }
-
- // classify all the top level patterns - alternatives come back unaltered
- val newPats: List[Pattern] = pats.zipWithIndex map classifyPat.tupled
- // see if any alternatives were in there
- val (ps, others) = newPats span isNotAlternative
- // make a new row for each alternative, with it spliced into the original position
- if (others.isEmpty) List(copy(pats = ps))
- else extractBindings(others.head) map (x => replaceAt(ps.size, x))
- }
- override def toString() = {
- val bs = if (nobindings) "" else "\n" + bindstr
- "Row(%d)(%s%s)".format(bx, pp(pats), bs)
- }
- }
- abstract class State {
- def bx: Int // index into the list of rows
- def params: List[Symbol] // bound names to be supplied as arguments to labeldef
- def body: Tree // body to execute upon match
- def label: Option[LabelDef] // label definition for this state
-
- // Called with a bindings map when a match is achieved.
- // Returns a list of variable declarations based on the labeldef parameters
- // and the given substitution, and the body to execute.
- protected def applyBindingsImpl(subst: Map[Symbol, Symbol]): (List[ValDef], Tree)
-
- final def applyBindings(subst: Map[Symbol, Symbol]): (List[ValDef], Tree) = {
- _referenceCount += 1
- applyBindingsImpl(subst)
- }
-
- private var _referenceCount = 0
- def referenceCount = _referenceCount
- def unreached = referenceCount == 0
- def shouldInline(sym: Symbol) = referenceCount == 1 && label.exists(_.symbol == sym)
-
- // Creates a simple Ident if the symbol's type conforms to
- // the val definition's type, or a casted Ident if not.
- private def newValIdent(lhs: Symbol, rhs: Symbol) =
- if (rhs.tpe <:< lhs.tpe) Ident(rhs)
- else gen.mkTypeApply(Ident(rhs), Any_asInstanceOf, List(lhs.tpe))
-
- protected def newValDefinition(lhs: Symbol, rhs: Symbol) =
- typer typedValDef ValDef(lhs, newValIdent(lhs, rhs))
-
- protected def newValReference(lhs: Symbol, rhs: Symbol) =
- typer typed newValIdent(lhs, rhs)
-
- protected def valDefsFor(subst: Map[Symbol, Symbol]) = mapSubst(subst)(newValDefinition)
- protected def identsFor(subst: Map[Symbol, Symbol]) = mapSubst(subst)(newValReference)
-
- protected def mapSubst[T](subst: Map[Symbol, Symbol])(f: (Symbol, Symbol) => T): List[T] =
- params flatMap { lhs =>
- subst get lhs map (rhs => f(lhs, rhs)) orElse {
- // This should not happen; the code should be structured so it is
- // impossible, but that still lies ahead.
- cunit.warning(lhs.pos, "No binding")
- None
- }
- }
-
- // typer is not able to digest a body of type Nothing being assigned result type Unit
- protected def caseResultType =
- if (body.tpe.isNothing) body.tpe else matchResultType
- }
-
- case class LiteralState(bx: Int, params: List[Symbol], body: Tree) extends State {
- def label = None
-
- protected def applyBindingsImpl(subst: Map[Symbol, Symbol]) =
- (valDefsFor(subst), body.duplicate setType caseResultType)
- }
-
- case class FinalState(bx: Int, params: List[Symbol], body: Tree) extends State {
- traceCategory("Final State", "(%s) => %s", paramsString, body)
- def label = Some(labelDef)
-
- private lazy val labelDef = createLabelDef("body%" + bx, body, params, caseResultType)
-
- protected def applyBindingsImpl(subst: Map[Symbol, Symbol]) = {
- val tree =
- if (referenceCount > 1) ID(labelDef.symbol) APPLY identsFor(subst)
- else labelDef
-
- (valDefsFor(subst), tree)
- }
-
- private def paramsString = params map (s => s.name + ": " + s.tpe) mkString ", "
- override def toString() = pp("(%s) => %s".format(pp(params), body))
- }
-
- case class Rep(val tvars: PatternVarGroup, val rows: List[Row]) {
- lazy val Row(pats, subst, guard, index) = rows.head
- lazy val guardedRest = if (guard.isEmpty) Rep(Nil, Nil) else make(tvars, rows.tail)
- lazy val (defaults, others) = pats span (_.isDefault)
-
- /** Cut out the column containing the non-default pattern. */
- class Cut(index: Int) {
- /** The first two separate out the 'i'th pattern in each row from the remainder. */
- private val (_column, _rows) = rows map (_ extractColumn index) unzip
-
- /** Now the 'i'th tvar is separated out and used as a new Scrutinee. */
- private val (_pv, _tvars) = tvars extractIndex index
-
- /** The non-default pattern (others.head) replaces the column head. */
- private val (_ncol, _nrep) =
- (others.head :: _column.tail, make(_tvars, _rows))
-
- def mix() = {
- val newScrut = new Scrutinee(new PatternVar(_pv.sym, EmptyTree, _pv.checked))
- PatternMatch(newScrut, _ncol) mkRule _nrep
- }
- }
-
- /** Converts this to a tree - recursively acquires subreps. */
- final def toTree(): Tree = tracing("toTree")(typer typed applyRule())
-
- /** The VariableRule. */
- private def variable() = {
- val binding = (defaults map (_.boundVariables) zip tvars.pvs) .
- foldLeft(subst)((b, pair) => b.add(pair._1, pair._2.lhs))
-
- VariableRule(binding, guard, guardedRest, index)
- }
- /** The MixtureRule: picks a rewrite rule to apply. */
- private def mixture() = new Cut(defaults.size) mix()
-
- /** Applying the rule will result in one of:
- *
- * VariableRule - if all patterns are default patterns
- * MixtureRule - if one or more patterns are not default patterns
- * Error - no rows remaining
- */
- final def applyRule(): Tree =
- if (rows.isEmpty) failTree
- else if (others.isEmpty) variable.tree()
- else mixture.tree()
-
- def ppn(x: Any) = pp(x, newlines = true)
- override def toString() =
- if (tvars.isEmpty) "Rep(%d) = %s".format(rows.size, ppn(rows))
- else "Rep(%dx%d)%s%s".format(tvars.size, rows.size, ppn(tvars), ppn(rows))
- }
-
- /** Expands the patterns recursively. */
- final def expand(roots: List[PatternVar], cases: List[CaseDef]) = tracing("expand") {
- for ((CaseDef(pat, guard, body), bx) <- cases.zipWithIndex) yield {
- val subtrees = pat match {
- case x if roots.length <= 1 => List(x)
- case Apply(_, args) => args
- case WILD() => emptyTrees(roots.length)
- }
- val params = pat filter (_.isInstanceOf[Bind]) map (_.symbol) distinct
- val row = Row(toPats(subtrees), NoBinding, guard, bx)
- val state = body match {
- case x: Literal => LiteralState(bx, params, body)
- case _ => FinalState(bx, params, body)
- }
-
- row -> state
- }
- }
-
- /** returns the condition in "if (cond) k1 else k2"
- */
- final def condition(tpe: Type, scrut: Scrutinee, isBound: Boolean): Tree = {
- assert(scrut.isDefined)
- val cond = handleOuter(condition(tpe, scrut.id, isBound))
-
- if (!needsOuterTest(tpe, scrut.tpe, owner)) cond
- else addOuterCondition(cond, tpe, scrut.id)
- }
-
- final def condition(tpe: Type, scrutTree: Tree, isBound: Boolean): Tree = {
- assert((tpe ne NoType) && (scrutTree.tpe ne NoType))
- def isMatchUnlessNull = scrutTree.tpe <:< tpe && tpe.isAnyRef
- def isRef = scrutTree.tpe.isAnyRef
-
- // See ticket #1503 for the motivation behind checking for a binding.
- // The upshot is that it is unsound to assume equality means the right
- // type, but if the value doesn't appear on the right hand side of the
- // match that's unimportant; so we add an instance check only if there
- // is a binding.
- def bindingWarning() = {
- if (isBound && settings.Xmigration28.value) {
- cunit.warning(scrutTree.pos,
- "A bound pattern such as 'x @ Pattern' now matches fewer cases than the same pattern with no binding.")
- }
- }
-
- def genEquals(sym: Symbol): Tree = {
- val t1: Tree = REF(sym) MEMBER_== scrutTree
-
- if (isBound) {
- bindingWarning()
- t1 AND (scrutTree IS tpe.widen)
- }
- else t1
- }
-
- typer typed {
- tpe match {
- case ConstantType(Constant(null)) if isRef => scrutTree OBJ_EQ NULL
- case ConstantType(const) => scrutTree MEMBER_== Literal(const)
- case SingleType(NoPrefix, sym) => genEquals(sym)
- case SingleType(pre, sym) if sym.isStable => genEquals(sym)
- case ThisType(sym) if sym.isModule => genEquals(sym)
- case _ if isMatchUnlessNull => scrutTree OBJ_NE NULL
- case _ => scrutTree IS tpe
- }
- }
- }
-
- /** adds a test comparing the dynamic outer to the static outer */
- final def addOuterCondition(cond: Tree, tpe2test: Type, scrut: Tree) = {
- val TypeRef(prefix, _, _) = tpe2test
- val theRef = handleOuter(prefix match {
- case NoPrefix => abort("assertion failed: NoPrefix")
- case ThisType(clazz) => THIS(clazz)
- case pre => REF(pre.prefix, pre.termSymbol)
- })
- outerAccessor(tpe2test.typeSymbol) match {
- case NoSymbol => ifDebug(cunit.warning(scrut.pos, "no outer acc for " + tpe2test.typeSymbol)) ; cond
- case outerAcc =>
- val casted = gen.mkAsInstanceOf(scrut, tpe2test, any = true, wrapInApply = true)
- cond AND ((casted DOT outerAcc)() OBJ_EQ theRef)
- }
- }
- }
-}
diff --git a/src/compiler/scala/tools/nsc/matching/PatternBindings.scala b/src/compiler/scala/tools/nsc/matching/PatternBindings.scala
deleted file mode 100644
index c6fa6f6ba0..0000000000
--- a/src/compiler/scala/tools/nsc/matching/PatternBindings.scala
+++ /dev/null
@@ -1,126 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2013 LAMP/EPFL
- * Author: Paul Phillips
- */
-
-package scala.tools.nsc
-package matching
-
-import transform.ExplicitOuter
-import scala.language.postfixOps
-
-trait PatternBindings extends ast.TreeDSL
-{
- self: ExplicitOuter with ParallelMatching =>
-
- import global.{ typer => _, _ }
- import definitions.{ EqualsPatternClass }
- import CODE._
-
- /** EqualsPattern **/
- def isEquals(tpe: Type) = tpe.typeSymbol == EqualsPatternClass
- def mkEqualsRef(tpe: Type) = typeRef(NoPrefix, EqualsPatternClass, List(tpe))
- def decodedEqualsType(tpe: Type) =
- if (tpe.typeSymbol == EqualsPatternClass) tpe.typeArgs.head else tpe
-
- // A subtype test which creates fresh existentials for type
- // parameters on the right hand side.
- def matches(arg1: Type, arg2: Type) = decodedEqualsType(arg1) matchesPattern decodedEqualsType(arg2)
-
- // For spotting duplicate unapplies
- def isEquivalentTree(t1: Tree, t2: Tree) = (t1.symbol == t2.symbol) && (t1 equalsStructure t2)
-
- // Reproduce the Bind trees wrapping oldTree around newTree
- def moveBindings(oldTree: Tree, newTree: Tree): Tree = oldTree match {
- case b @ Bind(x, body) => Bind(b.symbol, moveBindings(body, newTree))
- case _ => newTree
- }
-
- // used as argument to `EqualsPatternClass`
- case class PseudoType(o: Tree) extends SimpleTypeProxy {
- override def underlying: Type = o.tpe
- override def safeToString: String = "PseudoType("+o+")"
- }
-
- // If the given pattern contains alternatives, return it as a list of patterns.
- // Makes typed copies of any bindings found so all alternatives point to final state.
- def extractBindings(p: Pattern): List[Pattern] =
- toPats(_extractBindings(p.boundTree, identity))
-
- private def _extractBindings(p: Tree, prevBindings: Tree => Tree): List[Tree] = {
- def newPrev(b: Bind) = (x: Tree) => treeCopy.Bind(b, b.name, x) setType x.tpe
-
- p match {
- case b @ Bind(_, body) => _extractBindings(body, newPrev(b))
- case Alternative(ps) => ps map prevBindings
- }
- }
-
- trait PatternBindingLogic {
- self: Pattern =>
-
- // The outermost Bind(x1, Bind(x2, ...)) surrounding the tree.
- private var _boundTree: Tree = tree
- def boundTree = _boundTree
- def setBound(x: Bind): Pattern = {
- _boundTree = x
- this
- }
- def boundVariables = strip(boundTree)
-
- // If a tree has bindings, boundTree looks something like
- // Bind(v3, Bind(v2, Bind(v1, tree)))
- // This takes the given tree and creates a new pattern
- // using the same bindings.
- def rebindTo(t: Tree): Pattern = Pattern(moveBindings(boundTree, t))
-
- // Wrap this pattern's bindings around (_: Type)
- def rebindToType(tpe: Type, ascription: Type = null): Pattern = {
- val aType = if (ascription == null) tpe else ascription
- rebindTo(Typed(WILD(tpe), TypeTree(aType)) setType tpe)
- }
-
- // Wrap them around _
- def rebindToEmpty(tpe: Type): Pattern =
- rebindTo(Typed(EmptyTree, TypeTree(tpe)) setType tpe)
-
- // Wrap them around a singleton type for an EqualsPattern check.
- def rebindToEqualsCheck(): Pattern =
- rebindToType(equalsCheck)
-
- // Like rebindToEqualsCheck, but subtly different. Not trying to be
- // mysterious -- I haven't sorted it all out yet.
- def rebindToObjectCheck(): Pattern =
- rebindToType(mkEqualsRef(sufficientType), sufficientType)
-
- /** Helpers **/
- private def wrapBindings(vs: List[Symbol], pat: Tree): Tree = vs match {
- case Nil => pat
- case x :: xs => Bind(x, wrapBindings(xs, pat)) setType pat.tpe
- }
- private def strip(t: Tree): List[Symbol] = t match {
- case b @ Bind(_, pat) => b.symbol :: strip(pat)
- case _ => Nil
- }
- }
-
- case class Binding(pvar: Symbol, tvar: Symbol) {
- override def toString() = pvar.name + " -> " + tvar.name
- }
-
- class Bindings(private val vlist: List[Binding]) {
- def get() = vlist
- def toMap = vlist map (x => (x.pvar, x.tvar)) toMap
-
- def add(vs: Iterable[Symbol], tvar: Symbol): Bindings = {
- val newBindings = vs.toList map (v => Binding(v, tvar))
- new Bindings(newBindings ++ vlist)
- }
-
- override def toString() =
- if (vlist.isEmpty) "<none>"
- else vlist.mkString(", ")
- }
-
- val NoBinding: Bindings = new Bindings(Nil)
-}
diff --git a/src/compiler/scala/tools/nsc/matching/Patterns.scala b/src/compiler/scala/tools/nsc/matching/Patterns.scala
deleted file mode 100644
index df536da108..0000000000
--- a/src/compiler/scala/tools/nsc/matching/Patterns.scala
+++ /dev/null
@@ -1,457 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2013 LAMP/EPFL
- * Author: Paul Phillips
- */
-
-package scala.tools.nsc
-package matching
-
-import PartialFunction._
-
-/** Patterns are wrappers for Trees with enhanced semantics.
- *
- * @author Paul Phillips
- */
-
-trait Patterns extends ast.TreeDSL {
- self: transform.ExplicitOuter =>
-
- import global.{ typer => _, _ }
- import definitions._
- import CODE._
- import Debug._
- import treeInfo.{ unbind, isStar, isVarPattern }
-
- type PatternMatch = MatchMatrix#PatternMatch
- private type PatternVar = MatrixContext#PatternVar
-
- // Fresh patterns
- def emptyPatterns(i: Int): List[Pattern] = List.fill(i)(NoPattern)
- def emptyTrees(i: Int): List[Tree] = List.fill(i)(EmptyTree)
-
- // An empty pattern
- def NoPattern = WildcardPattern()
-
- // The Nil pattern
- def NilPattern = Pattern(gen.mkNil)
-
- // 8.1.1
- case class VariablePattern(tree: Ident) extends NamePattern {
- lazy val Ident(name) = tree
- require(isVarPattern(tree) && name != nme.WILDCARD)
- override def covers(sym: Symbol) = true
- override def description = "%s".format(name)
- }
-
- // 8.1.1 (b)
- case class WildcardPattern() extends Pattern {
- def tree = EmptyTree
- override def covers(sym: Symbol) = true
- override def isDefault = true
- override def description = "_"
- }
-
- // 8.1.2
- case class TypedPattern(tree: Typed) extends Pattern {
- lazy val Typed(expr, tpt) = tree
-
- override def covers(sym: Symbol) = newMatchesPattern(sym, tpt.tpe)
- override def sufficientType = tpt.tpe
- override def simplify(pv: PatternVar) = Pattern(expr) match {
- case ExtractorPattern(ua) if pv.sym.tpe <:< tpt.tpe => this rebindTo expr
- case _ => this
- }
- override def description = "%s: %s".format(Pattern(expr), tpt)
- }
-
- // 8.1.3
- case class LiteralPattern(tree: Literal) extends Pattern {
- lazy val Literal(const @ Constant(value)) = tree
-
- def isSwitchable = cond(const.tag) { case ByteTag | ShortTag | IntTag | CharTag => true }
- def intValue = const.intValue
- override def description = {
- val s = if (value == null) "null" else value.toString
- "Lit(%s)".format(s)
- }
- }
-
- // 8.1.4 (a)
- case class ApplyIdentPattern(tree: Apply) extends ApplyPattern with NamePattern {
- // XXX - see bug 3411 for code which violates this assumption
- // require (!isVarPattern(fn) && args.isEmpty)
- lazy val ident @ Ident(name) = fn
-
- override def sufficientType = Pattern(ident).equalsCheck
- override def simplify(pv: PatternVar) = this.rebindToObjectCheck()
- override def description = "Id(%s)".format(name)
- }
- // 8.1.4 (b)
- case class ApplySelectPattern(tree: Apply) extends ApplyPattern with SelectPattern {
- require (args.isEmpty)
- lazy val Apply(select: Select, _) = tree
-
- override lazy val sufficientType = qualifier.tpe match {
- case t: ThisType => singleType(t, sym) // this.X
- case _ =>
- qualifier match {
- case _: Apply => PseudoType(tree)
- case _ => singleType(Pattern(qualifier).necessaryType, sym)
- }
- }
-
- override def covers(sym: Symbol) = newMatchesPattern(sym, sufficientType)
- override def simplify(pv: PatternVar) = this.rebindToObjectCheck()
- override def description = backticked match {
- case Some(s) => "this." + s
- case _ => "Sel(%s.%s)".format(Pattern(qualifier), name)
- }
-
- }
- // 8.1.4 (c)
- case class StableIdPattern(tree: Select) extends SelectPattern {
- def select = tree
- override def description = "St(%s)".format(printableSegments.mkString(" . "))
- private def printableSegments =
- pathSegments filter (x => !x.isEmpty && (x.toString != "$iw"))
- }
- // 8.1.4 (d)
- case class ObjectPattern(tree: Apply) extends ApplyPattern { // NamePattern?
- require(!fn.isType && isModule)
-
- override def covers(sym: Symbol) = newMatchesPattern(sym, sufficientType)
- override def sufficientType = tpe.narrow
- override def simplify(pv: PatternVar) = this.rebindToObjectCheck()
- override def description = "Obj(%s)".format(fn)
- }
- // 8.1.4 (e)
- case class SimpleIdPattern(tree: Ident) extends NamePattern {
- val Ident(name) = tree
- override def covers(sym: Symbol) = newMatchesPattern(sym, tpe.narrow)
- override def description = "Id(%s)".format(name)
- }
-
- // 8.1.5
- case class ConstructorPattern(tree: Apply) extends ApplyPattern with NamePattern {
- require(fn.isType && this.isCaseClass, "tree: " + tree + " fn: " + fn)
- def name = tpe.typeSymbol.name
- def cleanName = tpe.typeSymbol.decodedName
-
- private def isColonColon = cleanName == "::"
-
- override def subpatterns(pm: MatchMatrix#PatternMatch) =
- if (pm.head.isCaseClass) toPats(args)
- else super.subpatterns(pm)
-
- override def simplify(pv: PatternVar) =
- if (args.isEmpty) this rebindToEmpty tree.tpe
- else this
-
- override def covers(sym: Symbol) = {
- debugging("[constructor] Does " + this + " cover " + sym + " ? ") {
- sym.tpe.typeSymbol == this.tpe.typeSymbol
- }
- }
- override def description = {
- if (isColonColon) "%s :: %s".format(Pattern(args(0)), Pattern(args(1)))
- else "%s(%s)".format(name, toPats(args).mkString(", "))
- }
- }
- // 8.1.6
- case class TuplePattern(tree: Apply) extends ApplyPattern {
- override def description = "((%s))".format(args.size, toPats(args).mkString(", "))
- }
-
- // 8.1.7 / 8.1.8 (unapply and unapplySeq calls)
- case class ExtractorPattern(tree: UnApply) extends UnapplyPattern {
- private def uaTyped = Typed(tree, TypeTree(arg.tpe)) setType arg.tpe
-
- override def simplify(pv: PatternVar) = {
- if (pv.tpe <:< arg.tpe) this
- else this rebindTo uaTyped
- }
- override def description = "Unapply(%s => %s)".format(necessaryType, resTypesString)
- }
-
- // Special List handling. It was like that when I got here.
- case class ListExtractorPattern(tree: UnApply, tpt: Tree, elems: List[Tree]) extends UnapplyPattern with SequenceLikePattern {
- // As yet I can't testify this is doing any good relative to using
- // tpt.tpe, but it doesn't seem to hurt either.
- private lazy val packedType = global.typer.computeType(tpt, tpt.tpe)
- private lazy val consRef = appliedType(ConsClass, packedType)
- private lazy val listRef = appliedType(ListClass, packedType)
-
- // Fold a list into a well-typed x :: y :: etc :: tree.
- private def listFolder(hd: Tree, tl: Tree): Tree = unbind(hd) match {
- case t @ Star(_) => moveBindings(hd, WILD(t.tpe))
- case _ =>
- val dummyMethod = NoSymbol.newTermSymbol(newTermName("matching$dummy"))
- val consType = MethodType(dummyMethod newSyntheticValueParams List(packedType, listRef), consRef)
-
- Apply(TypeTree(consType), List(hd, tl)) setType consRef
- }
- private def foldedPatterns = elems.foldRight(gen.mkNil)((x, y) => listFolder(x, y))
- override def necessaryType = if (nonStarPatterns.nonEmpty) consRef else listRef
-
- override def simplify(pv: PatternVar) = {
- if (pv.tpe <:< necessaryType)
- Pattern(foldedPatterns)
- else
- this rebindTo (Typed(tree, TypeTree(necessaryType)) setType necessaryType)
- }
- override def description = "List(%s => %s)".format(packedType, resTypesString)
- }
-
- trait SequenceLikePattern extends Pattern {
- def elems: List[Tree]
- override def hasStar = elems.nonEmpty && isStar(elems.last)
-
- def elemPatterns = toPats(elems)
- def nonStarElems = if (hasStar) elems.init else elems
- def nonStarPatterns = toPats(nonStarElems)
- def nonStarLength = nonStarElems.length
- }
-
- // 8.1.8 (b) (literal ArrayValues)
- case class SequencePattern(tree: ArrayValue) extends Pattern with SequenceLikePattern {
- lazy val ArrayValue(_, elems) = tree
-
- override def description = "Seq(%s)".format(elemPatterns mkString ", ")
- }
-
- // 8.1.8 (c)
- case class StarPattern(tree: Star) extends Pattern {
- override def description = "_*"
- }
- // XXX temporary?
- case class ThisPattern(tree: This) extends NamePattern {
- lazy val This(name) = tree
- override def description = "this"
- }
-
- // 8.1.9
- // InfixPattern ... subsumed by Constructor/Extractor Patterns
-
- // 8.1.10
- case class AlternativePattern(tree: Alternative) extends Pattern {
- private lazy val Alternative(subtrees) = tree
- private def alts = toPats(subtrees)
- override def description = "Alt(%s)".format(alts mkString " | ")
- }
-
- // 8.1.11
- // XMLPattern ... for now, subsumed by SequencePattern, but if we want
- // to make it work right, it probably needs special handling.
-
- private def abortUnknownTree(tree: Tree) =
- abort("Unknown Tree reached pattern matcher: %s/%s".format(tree, tree.getClass))
-
- object Pattern {
- // a small tree -> pattern cache
- private val cache = perRunCaches.newMap[Tree, Pattern]()
-
- def apply(tree: Tree): Pattern = {
- if (cache contains tree)
- return cache(tree)
-
- val p = tree match {
- case x: Bind => apply(unbind(tree)) setBound x
- case EmptyTree => WildcardPattern()
- case Ident(nme.WILDCARD) => WildcardPattern()
- case x @ Alternative(ps) => AlternativePattern(x)
- case x: Apply => ApplyPattern(x)
- case x: Typed => TypedPattern(x)
- case x: Literal => LiteralPattern(x)
- case x: UnApply => UnapplyPattern(x)
- case x: Ident => if (isVarPattern(x)) VariablePattern(x) else SimpleIdPattern(x)
- case x: ArrayValue => SequencePattern(x)
- case x: Select => StableIdPattern(x)
- case x: Star => StarPattern(x)
- case x: This => ThisPattern(x) // XXX ?
- case _ => abortUnknownTree(tree)
- }
- cache(tree) = p
-
- // limiting the trace output
- p match {
- case WildcardPattern() => p
- case _: LiteralPattern => p
- case _ => tracing("Pattern")(p)
- }
- }
- // matching on Pattern(...) always skips the bindings.
- def unapply(other: Any): Option[Tree] = other match {
- case x: Tree => unapply(Pattern(x))
- case x: Pattern => Some(x.tree)
- case _ => None
- }
- }
-
- object UnapplyPattern {
- private object UnapplySeq {
- def unapply(x: UnApply) = x match {
- case UnApply(
- Apply(TypeApply(Select(qual, nme.unapplySeq), List(tpt)), _),
- List(ArrayValue(_, elems))) =>
- Some((qual.symbol, tpt, elems))
- case _ =>
- None
- }
- }
-
- def apply(x: UnApply): Pattern = x match {
- case UnapplySeq(ListModule, tpt, elems) =>
- ListExtractorPattern(x, tpt, elems)
- case _ =>
- ExtractorPattern(x)
- }
- }
-
- // right now a tree like x @ Apply(fn, Nil) where !fn.isType
- // is handled by creating a singleton type:
- //
- // val stype = Types.singleType(x.tpe.prefix, x.symbol)
- //
- // and then passing that as a type argument to EqualsPatternClass:
- //
- // val tpe = typeRef(NoPrefix, EqualsPatternClass, List(stype))
- //
- // then creating a Typed pattern and rebinding.
- //
- // val newpat = Typed(EmptyTree, TypeTree(tpe)) setType tpe)
- //
- // This is also how Select(qual, name) is handled.
- object ApplyPattern {
- def apply(x: Apply): Pattern = {
- val Apply(fn, args) = x
- def isModule = x.symbol.isModule || x.tpe.termSymbol.isModule
-
- if (fn.isType) {
- if (isTupleType(fn.tpe)) TuplePattern(x)
- else ConstructorPattern(x)
- }
- else if (args.isEmpty) {
- if (isModule) ObjectPattern(x)
- else fn match {
- case _: Ident => ApplyIdentPattern(x)
- case _: Select => ApplySelectPattern(x)
- }
- }
- else abortUnknownTree(x)
- }
- }
-
- /** Some intermediate pattern classes with shared structure **/
-
- sealed trait SelectPattern extends NamePattern {
- def select: Select
- lazy val Select(qualifier, name) = select
- def pathSegments = getPathSegments(tree)
- def backticked: Option[String] = qualifier match {
- case _: This if nme.isVariableName(name) => Some("`%s`".format(name))
- case _ => None
- }
- override def covers(sym: Symbol) = newMatchesPattern(sym, tree.tpe)
- protected def getPathSegments(t: Tree): List[Name] = t match {
- case Select(q, name) => name :: getPathSegments(q)
- case Apply(f, Nil) => getPathSegments(f)
- case _ => Nil
- }
- }
-
- sealed trait NamePattern extends Pattern {
- def name: Name
- override def sufficientType = tpe.narrow
- override def simplify(pv: PatternVar) = this.rebindToEqualsCheck()
- override def description = name.toString
- }
-
- sealed trait UnapplyPattern extends Pattern {
- lazy val UnApply(unfn, args) = tree
- lazy val Apply(fn, _) = unfn
- lazy val MethodType(List(arg, _*), _) = fn.tpe
-
- // Covers if the symbol matches the unapply method's argument type,
- // and the return type of the unapply is Some.
- override def covers(sym: Symbol) = newMatchesPattern(sym, arg.tpe)
- override def necessaryType = arg.tpe
-
- def resTypes = analyzer.unapplyTypeList(unfn.symbol, unfn.tpe, args.length)
- def resTypesString = resTypes match {
- case Nil => "Boolean"
- case xs => xs.mkString(", ")
- }
- }
-
- sealed trait ApplyPattern extends Pattern {
- lazy val Apply(fn, args) = tree
-
- override def covers(sym: Symbol) = newMatchesPattern(sym, fn.tpe)
- }
-
- sealed abstract class Pattern extends PatternBindingLogic {
- def tree: Tree
-
- // returns either a simplification of this pattern or identity.
- def simplify(pv: PatternVar): Pattern = this
-
- // Is this a default pattern (untyped "_" or an EmptyTree inserted by the matcher)
- def isDefault = false
-
- // what type must a scrutinee have to have any chance of matching this pattern?
- def necessaryType = tpe
-
- // what type could a scrutinee have which would automatically indicate a match?
- // (nullness and guards will still be checked.)
- def sufficientType = tpe
-
- // the subpatterns for this pattern (at the moment, that means constructor arguments)
- def subpatterns(pm: MatchMatrix#PatternMatch): List[Pattern] = pm.dummies
-
- // if this pattern should be considered to cover the given symbol
- def covers(sym: Symbol): Boolean = newMatchesPattern(sym, sufficientType)
- def newMatchesPattern(sym: Symbol, pattp: Type) = {
- debugging("[" + kindString + "] Does " + pattp + " cover " + sym + " ? ") {
- (sym.isModuleClass && (sym.tpe.typeSymbol eq pattp.typeSymbol)) ||
- (sym.tpe.baseTypeSeq exists (_ matchesPattern pattp))
- }
- }
-
- def sym = tree.symbol
- def tpe = tree.tpe
- def isEmpty = tree.isEmpty
-
- def isModule = sym.isModule || tpe.termSymbol.isModule
- def isCaseClass = tpe.typeSymbol.isCase
- def isObject = (sym != null) && (sym != NoSymbol) && tpe.prefix.isStable // XXX not entire logic
- def hasStar = false
-
- def equalsCheck =
- tracing("equalsCheck")(
- if (sym.isValue) singleType(NoPrefix, sym)
- else tpe.narrow
- )
-
- /** Standard methods **/
- override def equals(other: Any) = other match {
- case x: Pattern => this.boundTree == x.boundTree
- case _ => super.equals(other)
- }
- override def hashCode() = boundTree.hashCode()
- def description = super.toString
-
- final override def toString = description
-
- def kindString = ""
- }
-
- /*** Extractors ***/
-
- object UnapplyParamType {
- def unapply(x: Tree): Option[Type] = condOpt(unbind(x)) {
- case UnApply(Apply(fn, _), _) => fn.tpe match {
- case m: MethodType => m.paramTypes.head
- }
- }
- }
-}
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index 8f964cf9e1..9c8ffc5ae3 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -104,7 +104,6 @@ trait ScalaSettings extends AbsScalaSettings
val showPhases = BooleanSetting ("-Xshow-phases", "Print a synopsis of compiler phases.")
val sourceReader = StringSetting ("-Xsource-reader", "classname", "Specify a custom method for reading source files.", "")
- val XoldPatmat = BooleanSetting ("-Xoldpatmat", "Use the pre-2.10 pattern matcher. Otherwise, the 'virtualizing' pattern matcher is used in 2.10.")
val XnoPatmatAnalysis = BooleanSetting ("-Xno-patmat-analysis", "Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation.")
val XfullLubs = BooleanSetting ("-Xfull-lubs", "Retains pre 2.10 behavior of less aggressive truncation of least upper bounds.")
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 01c22245cb..9696692146 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -9,7 +9,6 @@ package transform
import symtab._
import Flags.{ CASE => _, _ }
import scala.collection.mutable.ListBuffer
-import matching.{ Patterns, ParallelMatching }
/** This class ...
*
@@ -17,15 +16,12 @@ import matching.{ Patterns, ParallelMatching }
* @version 1.0
*/
abstract class ExplicitOuter extends InfoTransform
- with Patterns
- with ParallelMatching
with TypingTransformers
with ast.TreeDSL
{
import global._
import definitions._
import CODE._
- import Debug.TRACE
/** The following flags may be set by this phase: */
override def phaseNewFlags: Long = notPROTECTED
@@ -76,9 +72,7 @@ abstract class ExplicitOuter extends InfoTransform
class RemoveBindingsTransformer(toRemove: Set[Symbol]) extends Transformer {
override def transform(tree: Tree) = tree match {
- case Bind(_, body) if toRemove(tree.symbol) =>
- TRACE("Dropping unused binding: " + tree.symbol)
- super.transform(body)
+ case Bind(_, body) if toRemove(tree.symbol) => super.transform(body)
case _ => super.transform(tree)
}
}
@@ -363,74 +357,6 @@ abstract class ExplicitOuter extends InfoTransform
}
}
- // requires settings.XoldPatmat.value
- def matchTranslation(tree: Match) = {
- val Match(selector, cases) = tree
- var nselector = transform(selector)
-
- def makeGuardDef(vs: List[Symbol], guard: Tree) = {
- val gdname = unit.freshTermName("gd")
- val method = currentOwner.newMethod(gdname, tree.pos, SYNTHETIC)
- val params = method newSyntheticValueParams vs.map(_.tpe)
- method setInfo new MethodType(params, BooleanClass.tpe)
-
- localTyper typed {
- DEF(method) === guard.changeOwner(currentOwner -> method).substituteSymbols(vs, params)
- }
- }
-
- val nguard = new ListBuffer[Tree]
- val ncases =
- for (CaseDef(pat, guard, body) <- cases) yield {
- // Strip out any unused pattern bindings up front
- val patternIdents = for (b @ Bind(_, _) <- pat) yield b.symbol
- val references: Set[Symbol] = Set(guard, body) flatMap { t => for (id @ Ident(name) <- t) yield id.symbol }
- val (used, unused) = patternIdents partition references
- val strippedPat = if (unused.isEmpty) pat else new RemoveBindingsTransformer(unused.toSet) transform pat
-
- val gdcall =
- if (guard == EmptyTree) EmptyTree
- else {
- val guardDef = makeGuardDef(used, guard)
- nguard += transform(guardDef) // building up list of guards
-
- localTyper typed (Ident(guardDef.symbol) APPLY (used map Ident))
- }
-
- (CASE(transform(strippedPat)) IF gdcall) ==> transform(body)
- }
-
- val (checkExhaustive, requireSwitch) = nselector match {
- case Typed(nselector1, tpt) =>
- val unchecked = tpt.tpe hasAnnotation UncheckedClass
- if (unchecked)
- nselector = nselector1
-
- // Don't require a tableswitch if there are 1-2 casedefs
- // since the matcher intentionally emits an if-then-else.
- (!unchecked, treeInfo.isSwitchAnnotation(tpt.tpe) && ncases.size > 2)
- case _ =>
- (true, false)
- }
-
- val t = atPos(tree.pos) {
- val context = MatrixContext(currentUnit, transform, localTyper, currentOwner, tree.tpe)
- val t_untyped = handlePattern(nselector, ncases, checkExhaustive, context)
-
- /* if @switch annotation is present, verify the resulting tree is a Match */
- if (requireSwitch) t_untyped match {
- case Block(_, Match(_, _)) => // ok
- case _ =>
- unit.error(tree.pos, "could not emit switch for @switch annotated match")
- }
-
- localTyper.typed(t_untyped, context.matchResultType)
- }
-
- if (nguard.isEmpty) t
- else Block(nguard.toList, t) setType t.tpe
- }
-
/** The main transformation method */
override def transform(tree: Tree): Tree = {
val sym = tree.symbol
@@ -512,14 +438,10 @@ abstract class ExplicitOuter extends InfoTransform
})
super.transform(treeCopy.Apply(tree, sel, outerVal :: args))
- // entry point for pattern matcher translation
- case m: Match if settings.XoldPatmat.value => // the new pattern matcher runs in its own phase right after typer
- matchTranslation(m)
-
// for the new pattern matcher
// base.<outer>.eq(o) --> base.$outer().eq(o) if there's an accessor, else the whole tree becomes TRUE
// TODO remove the synthetic `<outer>` method from outerFor??
- case Apply(eqsel@Select(eqapp@Apply(sel@Select(base, nme.OUTER_SYNTH), Nil), eq), args) if !settings.XoldPatmat.value =>
+ case Apply(eqsel@Select(eqapp@Apply(sel@Select(base, nme.OUTER_SYNTH), Nil), eq), args) =>
val outerFor = sel.symbol.owner.toInterface // TODO: toInterface necessary?
val acc = outerAccessor(outerFor)
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index b94ae99263..6e89f6387e 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -211,16 +211,11 @@ abstract class UnCurry extends InfoTransform
* }
* new $anon()
*
- * If `settings.XoldPatmat.value`, also synthesized AbstractPartialFunction subclasses (see synthPartialFunction).
- *
*/
def transformFunction(fun: Function): Tree =
deEta(fun) match {
// nullary or parameterless
case fun1 if fun1 ne fun => fun1
- case _ if fun.tpe.typeSymbol == PartialFunctionClass =>
- // only get here when running under -Xoldpatmat
- synthPartialFunction(fun)
case _ =>
val parents = (
if (isFunctionType(fun.tpe)) addSerializable(abstractFunctionForFunctionType(fun.tpe))
@@ -259,131 +254,6 @@ abstract class UnCurry extends InfoTransform
}
- /** Transform a function node (x => body) of type PartialFunction[T, R] where
- * body = expr match { case P_i if G_i => E_i }_i=1..n
- * to (assuming none of the cases is a default case):
- *
- * class $anon() extends AbstractPartialFunction[T, R] with Serializable {
- * def applyOrElse[A1 <: A, B1 >: B](x: A1, default: A1 => B1): B1 = (expr: @unchecked) match {
- * case P_1 if G_1 => E_1
- * ...
- * case P_n if G_n => E_n
- * case _ => default(expr)
- * }
- * def isDefinedAt(x: T): boolean = (x: @unchecked) match {
- * case P_1 if G_1 => true
- * ...
- * case P_n if G_n => true
- * case _ => false
- * }
- * }
- * new $anon()
- *
- * If there's a default case, the original match is used for applyOrElse, and isDefinedAt returns `true`
- */
- def synthPartialFunction(fun: Function) = {
- if (!settings.XoldPatmat.value)
- devWarning("Under the new pattern matching scheme, PartialFunction should have been synthesized during typers.")
-
- val targs = fun.tpe.typeArgs
- val (formals, restpe) = (targs.init, targs.last)
-
- val anonClass = fun.symbol.owner newAnonymousFunctionClass(fun.pos, inConstructorFlag) addAnnotation serialVersionUIDAnnotation
- val parents = addSerializable(appliedType(AbstractPartialFunctionClass, targs: _*))
- anonClass setInfo ClassInfoType(parents, newScope, anonClass)
-
- // duplicate before applyOrElseMethodDef is run so that it does not mess up our trees and label symbols (we have a fresh set)
- // otherwise `TreeSymSubstituter(fun.vparams map (_.symbol), params)` won't work as the subst has been run already
- val bodyForIDA = {
- val duped = fun.body.duplicate
- val oldParams = new mutable.ListBuffer[Symbol]()
- val newParams = new mutable.ListBuffer[Symbol]()
-
- val oldSyms0 =
- duped filter {
- case l@LabelDef(_, params, _) =>
- params foreach {p =>
- val oldSym = p.symbol
- p.symbol = oldSym.cloneSymbol
- oldParams += oldSym
- newParams += p.symbol
- }
- true
- case _ => false
- } map (_.symbol)
- val oldSyms = oldParams.toList ++ oldSyms0
- val newSyms = newParams.toList ++ (oldSyms0 map (_.cloneSymbol))
- // println("duping "+ oldSyms +" --> "+ (newSyms map (_.ownerChain)))
-
- val substLabels = new TreeSymSubstituter(oldSyms, newSyms)
-
- substLabels(duped)
- }
-
- // def applyOrElse[A1 <: A, B1 >: B](x: A1, default: A1 => B1): B1 =
- val applyOrElseMethodDef = {
- val methSym = anonClass.newMethod(nme.applyOrElse, fun.pos, newFlags = FINAL | OVERRIDE | SYNTHETIC)
-
- val List(argtpe) = formals
- val A1 = methSym newTypeParameter(newTypeName("A1")) setInfo TypeBounds.upper(argtpe)
- val B1 = methSym newTypeParameter(newTypeName("B1")) setInfo TypeBounds.lower(restpe)
- val methFormals = List(A1.tpe, functionType(List(A1.tpe), B1.tpe))
- val params@List(x, default) = methSym newSyntheticValueParams methFormals
- methSym setInfoAndEnter polyType(List(A1, B1), MethodType(params, B1.tpe))
-
- val substParam = new TreeSymSubstituter(fun.vparams map (_.symbol), List(x))
- val body = localTyper.typedPos(fun.pos) { import CODE._
- def defaultAction(scrut: Tree) = REF(default) APPLY (REF(x))
-
- substParam(fun.body) match {
- case orig@Match(selector, cases) =>
- if (cases exists treeInfo.isDefaultCase) orig
- else {
- val defaultCase = CaseDef(Ident(nme.WILDCARD), EmptyTree, defaultAction(selector.duplicate))
- Match(/*gen.mkUnchecked*/(selector), cases :+ defaultCase)
- }
-
- }
- }
- body.changeOwner(fun.symbol -> methSym)
-
- val methDef = DefDef(methSym, body)
-
- // Have to repack the type to avoid mismatches when existentials
- // appear in the result - see SI-4869.
- methDef.tpt setType localTyper.packedType(body, methSym)
- methDef
- }
-
- val isDefinedAtMethodDef = {
- val methSym = anonClass.newMethod(nme.isDefinedAt, fun.pos, FINAL | SYNTHETIC)
- val params = methSym newSyntheticValueParams formals
- methSym setInfoAndEnter MethodType(params, BooleanClass.tpe)
-
- val substParam = new TreeSymSubstituter(fun.vparams map (_.symbol), params)
- def doSubst(x: Tree) = substParam(resetLocalAttrsKeepLabels(x)) // see pos/t1761 for why `resetLocalAttrs`, but must keep label symbols around
-
- val body = bodyForIDA match {
- case Match(selector, cases) =>
- if (cases exists treeInfo.isDefaultCase) TRUE
- else
- doSubst(Match(/*gen.mkUnchecked*/(selector),
- (cases map (c => deriveCaseDef(c)(x => TRUE))) :+ (
- DEFAULT ==> FALSE)))
-
- }
- body.changeOwner(fun.symbol -> methSym)
-
- DefDef(methSym, body)
- }
-
- localTyper.typedPos(fun.pos) {
- Block(
- List(ClassDef(anonClass, NoMods, ListOfNil, List(applyOrElseMethodDef, isDefinedAtMethodDef), fun.pos)),
- Typed(New(anonClass.tpe), TypeTree(fun.tpe)))
- }
- }
-
def transformArgs(pos: Position, fun: Symbol, args: List[Tree], formals: List[Type]) = {
val isJava = fun.isJavaDefined
def transformVarargs(varargsElemType: Type) = {
@@ -674,35 +544,6 @@ abstract class UnCurry extends InfoTransform
def isDefaultCatch(cdef: CaseDef) = isThrowable(cdef.pat) && cdef.guard.isEmpty
- def postTransformTry(tree: Try) = {
- val body = tree.block
- val catches = tree.catches
- val finalizer = tree.finalizer
- if (!settings.XoldPatmat.value) {
- if (catches exists (cd => !treeInfo.isCatchCase(cd)))
- devWarning("VPM BUG - illegal try/catch " + catches)
- tree
- } else if (catches forall treeInfo.isCatchCase) {
- tree
- } else {
- val exname = unit.freshTermName("ex$")
- val cases =
- if ((catches exists treeInfo.isDefaultCase) || isDefaultCatch(catches.last)) catches
- else catches :+ CaseDef(Ident(nme.WILDCARD), EmptyTree, Throw(Ident(exname)))
- val catchall =
- atPos(tree.pos) {
- CaseDef(
- Bind(exname, Ident(nme.WILDCARD)),
- EmptyTree,
- Match(Ident(exname), cases))
- }
- debuglog("rewrote try: " + catches + " ==> " + catchall);
- val catches1 = localTyper.typedCases(
- List(catchall), ThrowableClass.tpe, WildcardType)
- treeCopy.Try(tree, body, catches1, finalizer)
- }
- }
-
tree match {
/* Some uncurry post transformations add members to templates.
*
@@ -734,7 +575,9 @@ abstract class UnCurry extends InfoTransform
addJavaVarargsForwarders(dd, flatdd)
case tree: Try =>
- postTransformTry(tree)
+ if (tree.catches exists (cd => !treeInfo.isCatchCase(cd)))
+ devWarning("VPM BUG - illegal try/catch " + tree.catches)
+ tree
case Apply(Apply(fn, args), args1) =>
treeCopy.Apply(tree, fn, args ::: args1)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index e8c48184b0..e24f0bca1d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -793,6 +793,12 @@ trait Contexts { self: Analyzer =>
case _ => LookupSucceeded(qual, sym)
}
)
+ def finishDefSym(sym: Symbol, pre0: Type): NameLookup =
+ if (requiresQualifier(sym))
+ finish(gen.mkAttributedQualifier(pre0), sym)
+ else
+ finish(EmptyTree, sym)
+
def isPackageOwnedInDifferentUnit(s: Symbol) = (
s.isDefinedInPackage && (
!currentRun.compiles(s)
@@ -816,17 +822,36 @@ trait Contexts { self: Analyzer =>
found1
}
+
+ def lookupInScope(scope: Scope) =
+ (scope lookupUnshadowedEntries name filter (e => qualifies(e.sym))).toList
+
+ def newOverloaded(owner: Symbol, pre: Type, entries: List[ScopeEntry]) =
+ logResult(s"!!! lookup overloaded")(owner.newOverloaded(pre, entries map (_.sym)))
+
+ // Constructor lookup should only look in the decls of the enclosing class
+ // not in the self-type, nor in the enclosing context, nor in imports (SI-4460, SI-6745)
+ if (name == nme.CONSTRUCTOR) return {
+ val enclClassSym = cx.enclClass.owner
+ val scope = cx.enclClass.prefix.baseType(enclClassSym).decls
+ val constructorSym = lookupInScope(scope) match {
+ case Nil => NoSymbol
+ case hd :: Nil => hd.sym
+ case entries => newOverloaded(enclClassSym, cx.enclClass.prefix, entries)
+ }
+ finishDefSym(constructorSym, cx.enclClass.prefix)
+ }
+
// cx.scope eq null arises during FixInvalidSyms in Duplicators
while (defSym == NoSymbol && (cx ne NoContext) && (cx.scope ne null)) {
- pre = cx.enclClass.prefix
- val entries = (cx.scope lookupUnshadowedEntries name filter (e => qualifies(e.sym))).toList
- defSym = entries match {
- case Nil => searchPrefix
- case hd :: tl =>
+ pre = cx.enclClass.prefix
+ defSym = lookupInScope(cx.scope) match {
+ case Nil => searchPrefix
+ case entries @ (hd :: tl) =>
// we have a winner: record the symbol depth
symbolDepth = (cx.depth - cx.scope.nestingLevel) + hd.depth
if (tl.isEmpty) hd.sym
- else logResult(s"!!! lookup overloaded")(cx.owner.newOverloaded(pre, entries map (_.sym)))
+ else newOverloaded(cx.owner, pre, entries)
}
if (!defSym.exists)
cx = cx.outer // push further outward
@@ -864,12 +889,8 @@ trait Contexts { self: Analyzer =>
}
// At this point only one or the other of defSym and impSym might be set.
- if (defSym.exists) {
- if (requiresQualifier(defSym))
- finish(gen.mkAttributedQualifier(pre), defSym)
- else
- finish(EmptyTree, defSym)
- }
+ if (defSym.exists)
+ finishDefSym(defSym, pre)
else if (impSym.exists) {
// We continue walking down the imports as long as the tail is non-empty, which gives us:
// imports == imp1 :: imp2 :: _
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index 8d869b669c..ed1e6d01e8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -439,8 +439,8 @@ trait Implicits {
val start = if (Statistics.canEnable) Statistics.startTimer(matchesPtNanos) else null
val result = normSubType(tp, pt) || isView && {
pt match {
- case TypeRef(_, Function1.Sym, args) =>
- matchesPtView(tp, args.head, args.tail.head, undet)
+ case TypeRef(_, Function1.Sym, arg1 :: arg2 :: Nil) =>
+ matchesPtView(tp, arg1, arg2, undet)
case _ =>
false
}
@@ -484,7 +484,7 @@ trait Implicits {
loop(restpe, pt)
else pt match {
case tr @ TypeRef(pre, sym, args) =>
- if (sym.isAliasType) loop(tp, pt.normalize)
+ if (sym.isAliasType) loop(tp, pt.dealias)
else if (sym.isAbstractType) loop(tp, pt.bounds.lo)
else {
val len = args.length - 1
@@ -528,18 +528,15 @@ trait Implicits {
* to a final true or false.
*/
private def isPlausiblySubType(tp1: Type, tp2: Type) = !isImpossibleSubType(tp1, tp2)
- private def isImpossibleSubType(tp1: Type, tp2: Type) = tp1.normalize.widen match {
- case tr1 @ TypeRef(_, sym1, _) =>
- // We can only rule out a subtype relationship if the left hand
- // side is a class, else we may not know enough.
- sym1.isClass && (tp2.normalize.widen match {
- case TypeRef(_, sym2, _) =>
- sym2.isClass && !(sym1 isWeakSubClass sym2)
- case RefinedType(parents, decls) =>
- decls.nonEmpty &&
- tr1.member(decls.head.name) == NoSymbol
- case _ => false
- })
+ private def isImpossibleSubType(tp1: Type, tp2: Type) = tp1.dealiasWiden match {
+ // We can only rule out a subtype relationship if the left hand
+ // side is a class, else we may not know enough.
+ case tr1 @ TypeRef(_, sym1, _) if sym1.isClass =>
+ tp2.dealiasWiden match {
+ case TypeRef(_, sym2, _) => sym2.isClass && !(sym1 isWeakSubClass sym2)
+ case RefinedType(parents, decls) => decls.nonEmpty && tr1.member(decls.head.name) == NoSymbol
+ case _ => false
+ }
case _ => false
}
@@ -1010,7 +1007,7 @@ trait Implicits {
args foreach (getParts(_))
}
} else if (sym.isAliasType) {
- getParts(tp.normalize)
+ getParts(tp.dealias)
} else if (sym.isAbstractType) {
getParts(tp.bounds.hi)
}
@@ -1041,88 +1038,6 @@ trait Implicits {
infoMap
}
- /** The parts of a type is the smallest set of types that contains
- * - the type itself
- * - the parts of its immediate components (prefix and argument)
- * - the parts of its base types
- * - for alias types and abstract types, we take instead the parts
- * - of their upper bounds.
- * @return For those parts that refer to classes with companion objects that
- * can be accessed with unambiguous stable prefixes, the implicits infos
- * which are members of these companion objects.
-
- private def companionImplicits(tp: Type): Infoss = {
- val partMap = new LinkedHashMap[Symbol, Type]
- val seen = mutable.HashSet[Type]() // cycle detection
-
- /** Enter all parts of `tp` into `parts` set.
- * This method is performance critical: about 2-4% of all type checking is spent here
- */
- def getParts(tp: Type) {
- if (seen(tp))
- return
- seen += tp
- tp match {
- case TypeRef(pre, sym, args) =>
- if (sym.isClass) {
- if (!((sym.name == tpnme.REFINE_CLASS_NAME) ||
- (sym.name startsWith tpnme.ANON_CLASS_NAME) ||
- (sym.name == tpnme.ROOT)))
- partMap get sym match {
- case Some(pre1) =>
- if (!(pre =:= pre1)) partMap(sym) = NoType // ambiguous prefix - ignore implicit members
- case None =>
- if (pre.isStable) partMap(sym) = pre
- val bts = tp.baseTypeSeq
- var i = 1
- while (i < bts.length) {
- getParts(bts(i))
- i += 1
- }
- getParts(pre)
- args foreach getParts
- }
- } else if (sym.isAliasType) {
- getParts(tp.normalize)
- } else if (sym.isAbstractType) {
- getParts(tp.bounds.hi)
- }
- case ThisType(_) =>
- getParts(tp.widen)
- case _: SingletonType =>
- getParts(tp.widen)
- case RefinedType(ps, _) =>
- for (p <- ps) getParts(p)
- case AnnotatedType(_, t, _) =>
- getParts(t)
- case ExistentialType(_, t) =>
- getParts(t)
- case PolyType(_, t) =>
- getParts(t)
- case _ =>
- }
- }
-
- getParts(tp)
-
- val buf = new ListBuffer[Infos]
- for ((clazz, pre) <- partMap) {
- if (pre != NoType) {
- val companion = clazz.companionModule
- companion.moduleClass match {
- case mc: ModuleClassSymbol =>
- buf += (mc.implicitMembers map (im =>
- new ImplicitInfo(im.name, singleType(pre, companion), im)))
- case _ =>
- }
- }
- }
- //println("companion implicits of "+tp+" = "+buf.toList) // DEBUG
- buf.toList
- }
-
-*/
-
/** The implicits made available by type `pt`.
* These are all implicits found in companion objects of classes C
* such that some part of `tp` has C as one of its superclasses.
@@ -1250,7 +1165,7 @@ trait Implicits {
implicit def wrapResult(tree: Tree): SearchResult =
if (tree == EmptyTree) SearchFailure else new SearchResult(tree, if (from.isEmpty) EmptyTreeTypeSubstituter else new TreeTypeSubstituter(from, to))
- val tp1 = tp0.normalize
+ val tp1 = tp0.dealias
tp1 match {
case ThisType(_) | SingleType(_, _) =>
// can't generate a reference to a value that's abstracted over by an existential
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index a541906a99..7188290688 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -43,7 +43,7 @@ trait Infer extends Checkable {
case formal => formal
} else formals
if (isVarArgTypes(formals1) && (removeRepeated || formals.length != nargs)) {
- val ft = formals1.last.normalize.typeArgs.head
+ val ft = formals1.last.dealiasWiden.typeArgs.head
formals1.init ::: (for (i <- List.range(formals1.length - 1, nargs)) yield ft)
} else formals1
}
@@ -575,14 +575,13 @@ trait Infer extends Checkable {
&& (restpe.isWildcard || (varianceInType(restpe)(tparam) & COVARIANT) == 0) // don't retract covariant occurrences
)
- // checks !settings.XoldPatmat.value directly so one need not run under -Xexperimental to use virtpatmat
buf += ((tparam,
if (retract) None
else Some(
if (targ.typeSymbol == RepeatedParamClass) targ.baseType(SeqClass)
else if (targ.typeSymbol == JavaRepeatedParamClass) targ.baseType(ArrayClass)
// this infers Foo.type instead of "object Foo" (see also widenIfNecessary)
- else if (targ.typeSymbol.isModuleClass || ((settings.Xexperimental.value || !settings.XoldPatmat.value) && tvar.constr.avoidWiden)) targ
+ else if (targ.typeSymbol.isModuleClass || tvar.constr.avoidWiden) targ
else targ.widen
)
))
@@ -1123,15 +1122,17 @@ trait Infer extends Checkable {
*/
def inferExprInstance(tree: Tree, tparams: List[Symbol], pt: Type = WildcardType, treeTp0: Type = null, keepNothings: Boolean = true, useWeaklyCompatible: Boolean = false): List[Symbol] = {
val treeTp = if(treeTp0 eq null) tree.tpe else treeTp0 // can't refer to tree in default for treeTp0
+ val (targs, tvars) = exprTypeArgs(tparams, treeTp, pt, useWeaklyCompatible)
printInference(
ptBlock("inferExprInstance",
"tree" -> tree,
"tree.tpe"-> tree.tpe,
"tparams" -> tparams,
- "pt" -> pt
+ "pt" -> pt,
+ "targs" -> targs,
+ "tvars" -> tvars
)
)
- val (targs, tvars) = exprTypeArgs(tparams, treeTp, pt, useWeaklyCompatible)
if (keepNothings || (targs eq null)) { //@M: adjustTypeArgs fails if targs==null, neg/t0226
substExpr(tree, tparams, targs, pt)
@@ -1438,9 +1439,9 @@ trait Infer extends Checkable {
}
object approximateAbstracts extends TypeMap {
- def apply(tp: Type): Type = tp.normalize match {
+ def apply(tp: Type): Type = tp.dealiasWiden match {
case TypeRef(pre, sym, _) if sym.isAbstractType => WildcardType
- case _ => mapOver(tp)
+ case _ => mapOver(tp)
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 4d1ab98fa0..768d739b4b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -546,6 +546,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
/** Calculate the arguments to pass to a macro implementation when expanding the provided tree.
*/
case class MacroArgs(c: MacroContext, others: List[Any])
+
private def macroArgs(typer: Typer, expandee: Tree): MacroArgs = {
val macroDef = expandee.symbol
val prefixTree = expandee.collect{ case Select(qual, name) => qual }.headOption.getOrElse(EmptyTree)
@@ -574,9 +575,11 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
val preparedArgss: List[List[Any]] =
if (fastTrack contains macroDef) {
- if (fastTrack(macroDef) validate context) argss
+ // Take a dry run of the fast track implementation
+ if (fastTrack(macroDef) validate expandee) argss
else typer.TyperErrorGen.MacroPartialApplicationError(expandee)
- } else {
+ }
+ else {
// if paramss have typetag context bounds, add an arglist to argss if necessary and instantiate the corresponding evidences
// consider the following example:
//
@@ -691,9 +694,11 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces {
var expectedTpe = expandee.tpe
if (isNullaryInvocation(expandee)) expectedTpe = expectedTpe.finalResultType
- var typechecked = typecheck("macro def return type", expanded, expectedTpe)
- typechecked = typecheck("expected type", typechecked, pt)
- typechecked
+ // also see http://groups.google.com/group/scala-internals/browse_thread/thread/492560d941b315cc
+ val expanded0 = duplicateAndKeepPositions(expanded)
+ val expanded1 = typecheck("macro def return type", expanded0, expectedTpe)
+ val expanded2 = typecheck("expected type", expanded1, pt)
+ expanded2
} finally {
popMacroContext()
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
index dba2f25e32..49eca828a9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
@@ -67,9 +67,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
}
}
- def newTransformer(unit: CompilationUnit): Transformer =
- if (!settings.XoldPatmat.value) new MatchTransformer(unit)
- else noopTransformer
+ def newTransformer(unit: CompilationUnit): Transformer = new MatchTransformer(unit)
// duplicated from CPSUtils (avoid dependency from compiler -> cps plugin...)
private lazy val MarkerCPSAdaptPlus = rootMirror.getClassIfDefined("scala.util.continuations.cpsPlus")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index f68c7dbc6c..d72978cb1a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -13,7 +13,7 @@ package scala.tools.nsc
package typechecker
import scala.collection.mutable
-import scala.reflect.internal.util.{ BatchSourceFile, Statistics }
+import scala.reflect.internal.util.{ BatchSourceFile, Statistics, shortClassOfInstance }
import mutable.ListBuffer
import symtab.Flags._
@@ -96,8 +96,8 @@ trait Typers extends Modes with Adaptations with Tags {
// when true:
// - we may virtualize matches (if -Xexperimental and there's a suitable __match in scope)
// - we synthesize PartialFunction implementations for `x => x match {...}` and `match {...}` when the expected type is PartialFunction
- // this is disabled by: -Xoldpatmat or interactive compilation (we run it for scaladoc due to SI-5933)
- private def newPatternMatching = !settings.XoldPatmat.value && !forInteractive //&& !forScaladoc && (phase.id < currentRun.uncurryPhase.id)
+ // this is disabled by: interactive compilation (we run it for scaladoc due to SI-5933)
+ private def newPatternMatching = !forInteractive //&& !forScaladoc && (phase.id < currentRun.uncurryPhase.id)
abstract class Typer(context0: Context) extends TyperDiagnostics with Adaptation with Tag with TyperContextErrors {
import context0.unit
@@ -227,7 +227,7 @@ trait Typers extends Modes with Adaptations with Tags {
case ExistentialType(tparams, tpe) =>
new SubstWildcardMap(tparams).apply(tp)
case TypeRef(_, sym, _) if sym.isAliasType =>
- val tp0 = tp.normalize
+ val tp0 = tp.dealias
val tp1 = dropExistential(tp0)
if (tp1 eq tp0) tp else tp1
case _ => tp
@@ -413,7 +413,7 @@ trait Typers extends Modes with Adaptations with Tags {
if (!hiddenSymbols.isEmpty && hiddenSymbols.head == sym &&
sym.isAliasType && sameLength(sym.typeParams, args)) {
hiddenSymbols = hiddenSymbols.tail
- t.normalize
+ t.dealias
} else t
case SingleType(_, sym) =>
checkNoEscape(sym)
@@ -1033,9 +1033,9 @@ trait Typers extends Modes with Adaptations with Tags {
adapt(tree setType restpe, mode, pt, original)
case TypeRef(_, ByNameParamClass, List(arg)) if ((mode & EXPRmode) != 0) => // (2)
adapt(tree setType arg, mode, pt, original)
- case tr @ TypeRef(_, sym, _) if sym.isAliasType && tr.normalize.isInstanceOf[ExistentialType] &&
+ case tr @ TypeRef(_, sym, _) if sym.isAliasType && tr.dealias.isInstanceOf[ExistentialType] &&
((mode & (EXPRmode | LHSmode)) == EXPRmode) =>
- adapt(tree setType tr.normalize.skolemizeExistential(context.owner, tree), mode, pt, original)
+ adapt(tree setType tr.dealias.skolemizeExistential(context.owner, tree), mode, pt, original)
case et @ ExistentialType(_, _) if ((mode & (EXPRmode | LHSmode)) == EXPRmode) =>
adapt(tree setType et.skolemizeExistential(context.owner, tree), mode, pt, original)
case PolyType(tparams, restpe) if inNoModes(mode, TAPPmode | PATTERNmode | HKmode) => // (3)
@@ -1105,7 +1105,7 @@ trait Typers extends Modes with Adaptations with Tags {
if (tree1.tpe <:< pt) adapt(tree1, mode, pt, original)
else {
if (inExprModeButNot(mode, FUNmode)) {
- pt.normalize match {
+ pt.dealias match {
case TypeRef(_, sym, _) =>
// note: was if (pt.typeSymbol == UnitClass) but this leads to a potentially
// infinite expansion if pt is constant type ()
@@ -1251,7 +1251,7 @@ trait Typers extends Modes with Adaptations with Tags {
def adaptToMember(qual: Tree, searchTemplate: Type, reportAmbiguous: Boolean = true, saveErrors: Boolean = true): Tree = {
if (isAdaptableWithView(qual)) {
- qual.tpe.widen.normalize match {
+ qual.tpe.dealiasWiden match {
case et: ExistentialType =>
qual setType et.skolemizeExistential(context.owner, qual) // open the existential
case _ =>
@@ -1766,7 +1766,7 @@ trait Typers extends Modes with Adaptations with Tags {
_.typedTemplate(cdef.impl, parentTypes(cdef.impl))
}
val impl2 = finishMethodSynthesis(impl1, clazz, context)
- if (clazz.isTrait && clazz.info.parents.nonEmpty && clazz.info.firstParent.normalize.typeSymbol == AnyClass)
+ if (clazz.isTrait && clazz.info.parents.nonEmpty && clazz.info.firstParent.typeSymbol == AnyClass)
checkEphemeral(clazz, impl2.body)
if ((clazz != ClassfileAnnotationClass) &&
(clazz isNonBottomSubClass ClassfileAnnotationClass))
@@ -2440,18 +2440,14 @@ trait Typers extends Modes with Adaptations with Tags {
val selectorTp = packCaptured(selector1.tpe.widen).skolemizeExistential(context.owner, selector)
val casesTyped = typedCases(cases, selectorTp, pt)
- val (resTp, needAdapt) =
- if (!settings.XoldPatmat.value) ptOrLubPacked(casesTyped, pt)
- else ptOrLub(casesTyped map (_.tpe), pt)
+ val (resTp, needAdapt) = ptOrLubPacked(casesTyped, pt)
val casesAdapted = if (!needAdapt) casesTyped else casesTyped map (adaptCase(_, mode, resTp))
treeCopy.Match(tree, selector1, casesAdapted) setType resTp
}
- // match has been typed -- virtualize it if we're feeling experimental
- // (virtualized matches are expanded during type checking so they have the full context available)
- // otherwise, do nothing: matches are translated during phase `patmat` (unless -Xoldpatmat)
+ // match has been typed -- virtualize it during type checking so the full context is available
def virtualizedMatch(match_ : Match, mode: Int, pt: Type) = {
import patmat.{ vpmName, PureMatchTranslator }
@@ -3333,7 +3329,7 @@ trait Typers extends Modes with Adaptations with Tags {
// if there's a ClassTag that allows us to turn the unchecked type test for `pt` into a checked type test
// return the corresponding extractor (an instance of ClassTag[`pt`])
- def extractorForUncheckedType(pos: Position, pt: Type): Option[Tree] = if (settings.XoldPatmat.value || isPastTyper) None else {
+ def extractorForUncheckedType(pos: Position, pt: Type): Option[Tree] = if (isPastTyper) None else {
// only look at top-level type, can't (reliably) do anything about unchecked type args (in general)
pt.normalize.typeConstructor match {
// if at least one of the types in an intersection is checkable, use the checkable ones
@@ -3359,14 +3355,13 @@ trait Typers extends Modes with Adaptations with Tags {
* @param annClass the expected annotation class
*/
def typedAnnotation(ann: Tree, mode: Int = EXPRmode, selfsym: Symbol = NoSymbol, annClass: Symbol = AnnotationClass, requireJava: Boolean = false): AnnotationInfo = {
- lazy val annotationError = AnnotationInfo(ErrorType, Nil, Nil)
var hasError: Boolean = false
val pending = ListBuffer[AbsTypeError]()
def reportAnnotationError(err: AbsTypeError) = {
pending += err
hasError = true
- annotationError
+ ErroneousAnnotation
}
/** Calling constfold right here is necessary because some trees (negated
@@ -3446,12 +3441,12 @@ trait Typers extends Modes with Adaptations with Tags {
extract(ann, List())
}
- val res = if (fun.isErroneous) annotationError
+ val res = if (fun.isErroneous) ErroneousAnnotation
else {
val typedFun @ Select(New(tpt), _) = typed(fun, forFunMode(mode), WildcardType)
val annType = tpt.tpe
- if (typedFun.isErroneous) annotationError
+ if (typedFun.isErroneous) ErroneousAnnotation
else if (annType.typeSymbol isNonBottomSubClass ClassfileAnnotationClass) {
// annotation to be saved as java classfile annotation
val isJava = typedFun.symbol.owner.isJavaDefined
@@ -3496,7 +3491,7 @@ trait Typers extends Modes with Adaptations with Tags {
reportAnnotationError(AnnotationMissingArgError(ann, annType, sym))
}
- if (hasError) annotationError
+ if (hasError) ErroneousAnnotation
else AnnotationInfo(annType, List(), nvPairs map {p => (p._1, p._2.get)}).setOriginal(Apply(typedFun, args).setPos(ann.pos))
}
} else if (requireJava) {
@@ -3548,14 +3543,14 @@ trait Typers extends Modes with Adaptations with Tags {
if (annType.typeSymbol == DeprecatedAttr && argss.flatten.size < 2)
unit.deprecationWarning(ann.pos, "@deprecated now takes two arguments; see the scaladoc.")
- if ((typedAnn.tpe == null) || typedAnn.tpe.isErroneous) annotationError
+ if ((typedAnn.tpe == null) || typedAnn.tpe.isErroneous) ErroneousAnnotation
else annInfo(typedAnn)
}
}
if (hasError) {
pending.foreach(ErrorUtils.issueTypeError)
- annotationError
+ ErroneousAnnotation
} else res
}
@@ -3679,7 +3674,7 @@ trait Typers extends Modes with Adaptations with Tags {
val normalizeLocals = new TypeMap {
def apply(tp: Type): Type = tp match {
case TypeRef(pre, sym, args) =>
- if (sym.isAliasType && containsLocal(tp)) apply(tp.normalize)
+ if (sym.isAliasType && containsLocal(tp)) apply(tp.dealias)
else {
if (pre.isVolatile)
InferTypeWithVolatileTypeSelectionError(tree, pre)
@@ -4142,8 +4137,7 @@ trait Typers extends Modes with Adaptations with Tags {
// in the special (though common) case where the types are equal, it pays to pack before comparing
// especially virtpatmat needs more aggressive unification of skolemized types
// this breaks src/library/scala/collection/immutable/TrieIterator.scala
- if ( !settings.XoldPatmat.value && !isPastTyper
- && thenp1.tpe.annotations.isEmpty && elsep1.tpe.annotations.isEmpty // annotated types need to be lubbed regardless (at least, continations break if you by pass them like this)
+ if (!isPastTyper && thenp1.tpe.annotations.isEmpty && elsep1.tpe.annotations.isEmpty // annotated types need to be lubbed regardless (at least, continations break if you by pass them like this)
&& thenTp =:= elseTp
) (thenp1.tpe.deconst, false) // use unpacked type. Important to deconst, as is done in ptOrLub, otherwise `if (???) 0 else 0` evaluates to 0 (SI-6331)
// TODO: skolemize (lub of packed types) when that no longer crashes on files/pos/t4070b.scala
@@ -4157,7 +4151,7 @@ trait Typers extends Modes with Adaptations with Tags {
}
}
- // under -Xexperimental (and not -Xoldpatmat), and when there's a suitable __match in scope, virtualize the pattern match
+ // When there's a suitable __match in scope, virtualize the pattern match
// otherwise, type the Match and leave it until phase `patmat` (immediately after typer)
// empty-selector matches are transformed into synthetic PartialFunction implementations when the expected type demands it
def typedVirtualizedMatch(tree: Match): Tree = {
@@ -4213,7 +4207,13 @@ trait Typers extends Modes with Adaptations with Tags {
def typedNew(tree: New) = {
val tpt = tree.tpt
val tpt1 = {
- val tpt0 = typedTypeConstructor(tpt)
+ // This way typedNew always returns a dealiased type. This used to happen by accident
+ // for instantiations without type arguments due to ad hoc code in typedTypeConstructor,
+ // and annotations depended on it (to the extent that they worked, which they did
+ // not when given a parameterized type alias which dealiased to an annotation.)
+ // typedTypeConstructor dealiases nothing now, but it makes sense for a "new" to always be
+ // given a dealiased type.
+ val tpt0 = typedTypeConstructor(tpt) modifyType (_.dealias)
if (checkStablePrefixClassType(tpt0))
if (tpt0.hasSymbolField && !tpt0.symbol.typeParams.isEmpty) {
context.undetparams = cloneSymbols(tpt0.symbol.typeParams)
@@ -5312,29 +5312,18 @@ trait Typers extends Modes with Adaptations with Tags {
def typedTypeConstructor(tree: Tree, mode: Int): Tree = {
val result = typed(tree, forTypeMode(mode) | FUNmode, WildcardType)
- val restpe = result.tpe.normalize // normalize to get rid of type aliases for the following check (#1241)
- if (!phase.erasedTypes && restpe.isInstanceOf[TypeRef] && !restpe.prefix.isStable && !context.unit.isJava) {
- // The isJava exception if OK only because the only type constructors scalac gets
- // to see are those in the signatures. These do not need a unique object as a prefix.
- // The situation is different for new's and super's, but scalac does not look deep
- // enough to see those. See #3938
- ConstructorPrefixError(tree, restpe)
- } else {
- //@M fix for #2208
- // if there are no type arguments, normalization does not bypass any checks, so perform it to get rid of AnyRef
- if (result.tpe.typeArgs.isEmpty) {
- // minimal check: if(result.tpe.typeSymbolDirect eq AnyRefClass) {
- // must expand the fake AnyRef type alias, because bootstrapping (init in Definitions) is not
- // designed to deal with the cycles in the scala package (ScalaObject extends
- // AnyRef, but the AnyRef type alias is entered after the scala package is
- // loaded and completed, so that ScalaObject is unpickled while AnyRef is not
- // yet defined )
- // !!! TODO - revisit now that ScalaObject is gone.
- result setType(restpe)
- } else { // must not normalize: type application must be (bounds-)checked (during RefChecks), see #2208
+ // get rid of type aliases for the following check (#1241)
+ result.tpe.dealias match {
+ case restpe @ TypeRef(pre, _, _) if !phase.erasedTypes && !pre.isStable && !context.unit.isJava =>
+ // The isJava exception if OK only because the only type constructors scalac gets
+ // to see are those in the signatures. These do not need a unique object as a prefix.
+ // The situation is different for new's and super's, but scalac does not look deep
+ // enough to see those. See #3938
+ ConstructorPrefixError(tree, restpe)
+ case _ =>
+ // must not normalize: type application must be (bounds-)checked (during RefChecks), see #2208
// during uncurry (after refchecks), all types are normalized
result
- }
}
}
diff --git a/src/compiler/scala/tools/nsc/util/package.scala b/src/compiler/scala/tools/nsc/util/package.scala
index 792a659ad6..039fec8605 100644
--- a/src/compiler/scala/tools/nsc/util/package.scala
+++ b/src/compiler/scala/tools/nsc/util/package.scala
@@ -69,7 +69,7 @@ package object util {
* (to exclude assert, require, etc.)
*/
def stackTraceHeadString(ex: Throwable): String = {
- val frame = ex.getStackTrace.dropWhile(_.getClassName contains "Predef").head
+ val frame = ex.getStackTrace.dropWhile(_.getClassName contains "Predef") take 1 mkString ""
val msg = ex.getMessage match { case null | "" => "" ; case s => s"""("$s")""" }
val clazz = ex.getClass.getName.split('.').last
diff --git a/src/compiler/scala/tools/reflect/FastTrack.scala b/src/compiler/scala/tools/reflect/FastTrack.scala
index d35ac43424..ac50324fa9 100644
--- a/src/compiler/scala/tools/reflect/FastTrack.scala
+++ b/src/compiler/scala/tools/reflect/FastTrack.scala
@@ -2,7 +2,9 @@ package scala.tools
package reflect
import scala.reflect.reify.Taggers
-import scala.tools.nsc.typechecker.{Analyzer, Macros}
+import scala.tools.nsc.typechecker.{ Analyzer, Macros }
+import scala.reflect.runtime.Macros.currentMirror
+import scala.reflect.api.Universe
/** Optimizes system macro expansions by hardwiring them directly to their implementations
* bypassing standard reflective load and invoke to avoid the overhead of Java/Scala reflection.
@@ -12,30 +14,32 @@ trait FastTrack {
import global._
import definitions._
-
import scala.language.implicitConversions
- private implicit def context2taggers(c0: MacroContext): Taggers { val c: c0.type } = new { val c: c0.type = c0 } with Taggers
- private implicit def context2macroimplementations(c0: MacroContext): MacroImplementations { val c: c0.type } = new { val c: c0.type = c0 } with MacroImplementations
+ import treeInfo.Applied
+
+ private implicit def context2taggers(c0: MacroContext): Taggers { val c: c0.type } =
+ new { val c: c0.type = c0 } with Taggers
+ private implicit def context2macroimplementations(c0: MacroContext): MacroImplementations { val c: c0.type } =
+ new { val c: c0.type = c0 } with MacroImplementations
+ private def make(sym: Symbol)(pf: PartialFunction[Applied, MacroContext => Tree]) =
+ sym -> new FastTrackEntry(pf)
- implicit def fastTrackEntry2MacroRuntime(entry: FastTrackEntry): MacroRuntime = args => entry.run(args.c)
- type FastTrackExpander = PartialFunction[(MacroContext, Tree), Tree]
- case class FastTrackEntry(sym: Symbol, expander: FastTrackExpander) {
- def validate(c: MacroContext): Boolean = expander.isDefinedAt((c, c.expandee))
- def run(c: MacroContext): Any = {
- val result = expander((c, c.expandee))
- c.Expr[Nothing](result)(c.WeakTypeTag.Nothing)
+ final class FastTrackEntry(pf: PartialFunction[Applied, MacroContext => Tree]) extends (MacroArgs => Any) {
+ def validate(tree: Tree) = pf isDefinedAt Applied(tree)
+ def apply(margs: MacroArgs) = {
+ val MacroArgs(c, args) = margs
+ // Macros validated that the pf is defined here - and there's not much we could do if it weren't.
+ c.Expr[Nothing](pf(Applied(c.expandee))(c))(c.WeakTypeTag.Nothing)
}
}
- lazy val fastTrack: Map[Symbol, FastTrackEntry] = {
- var registry = Map[Symbol, FastTrackEntry]()
- implicit class BindTo(sym: Symbol) { def bindTo(expander: FastTrackExpander): Unit = if (sym != NoSymbol) registry += sym -> FastTrackEntry(sym, expander) }
- materializeClassTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List())) => c.materializeClassTag(tt.tpe) }
- materializeWeakTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = false) }
- materializeTypeTag bindTo { case (c, Apply(TypeApply(_, List(tt)), List(u))) => c.materializeTypeTag(u, EmptyTree, tt.tpe, concrete = true) }
- ApiUniverseReify bindTo { case (c, Apply(TypeApply(_, List(tt)), List(expr))) => c.materializeExpr(c.prefix.tree, EmptyTree, expr) }
- ReflectRuntimeCurrentMirror bindTo { case (c, _) => scala.reflect.runtime.Macros.currentMirror(c).tree }
- StringContext_f bindTo { case (c, app@Apply(Select(Apply(_, parts), _), args)) => c.macro_StringInterpolation_f(parts, args, app.pos) }
- registry
- }
+ /** A map from a set of pre-established macro symbols to their implementations. */
+ lazy val fastTrack = Map[Symbol, FastTrackEntry](
+ make( materializeClassTag) { case Applied(_, ttag :: Nil, _) => _.materializeClassTag(ttag.tpe) },
+ make( materializeWeakTypeTag) { case Applied(_, ttag :: Nil, (u :: _) :: _) => _.materializeTypeTag(u, EmptyTree, ttag.tpe, concrete = false) },
+ make( materializeTypeTag) { case Applied(_, ttag :: Nil, (u :: _) :: _) => _.materializeTypeTag(u, EmptyTree, ttag.tpe, concrete = true) },
+ make( ApiUniverseReify) { case Applied(_, ttag :: Nil, (expr :: _) :: _) => c => c.materializeExpr(c.prefix.tree, EmptyTree, expr) },
+ make( StringContext_f) { case Applied(Select(Apply(_, ps), _), _, args) => c => c.macro_StringInterpolation_f(ps, args.flatten, c.expandee.pos) },
+ make(ReflectRuntimeCurrentMirror) { case _ => c => currentMirror(c).tree }
+ )
}
diff --git a/src/compiler/scala/tools/reflect/MacroImplementations.scala b/src/compiler/scala/tools/reflect/MacroImplementations.scala
index d7c50504a8..ab967496c4 100644
--- a/src/compiler/scala/tools/reflect/MacroImplementations.scala
+++ b/src/compiler/scala/tools/reflect/MacroImplementations.scala
@@ -37,7 +37,7 @@ abstract class MacroImplementations {
val argsStack = Stack(args : _*)
def defval(value: Tree, tpe: Type): Unit = {
- val freshName = newTermName(c.fresh("arg$"))
+ val freshName = newTermName(c.freshName("arg$"))
evals += ValDef(Modifiers(), freshName, TypeTree(tpe) setPos value.pos.focus, value) setPos value.pos
ids += Ident(freshName)
}
diff --git a/src/library/scala/reflect/NameTransformer.scala b/src/library/scala/reflect/NameTransformer.scala
index 384ebc6134..0beb840bed 100755
--- a/src/library/scala/reflect/NameTransformer.scala
+++ b/src/library/scala/reflect/NameTransformer.scala
@@ -93,7 +93,7 @@ object NameTransformer {
*/
def decode(name0: String): String = {
//System.out.println("decode: " + name);//DEBUG
- val name = if (name0.endsWith("<init>")) name0.substring(0, name0.length() - ("<init>").length()) + "this"
+ val name = if (name0.endsWith("<init>")) name0.stripSuffix("<init>") + "this"
else name0;
var buf: StringBuilder = null
val len = name.length()
diff --git a/src/reflect/scala/reflect/api/Names.scala b/src/reflect/scala/reflect/api/Names.scala
index 7c12f180a8..8add98d815 100644
--- a/src/reflect/scala/reflect/api/Names.scala
+++ b/src/reflect/scala/reflect/api/Names.scala
@@ -58,7 +58,7 @@ trait Names {
* Can be used for pattern matching, instance tests, serialization and likes.
* @group Tags
*/
-implicit val TypeNameTag: ClassTag[TypeName]
+ implicit val TypeNameTag: ClassTag[TypeName]
/** The abstract type of names representing types.
* @group Names
@@ -109,10 +109,38 @@ implicit val TypeNameTag: ClassTag[TypeName]
/** Create a new term name.
* @group Names
*/
+ @deprecated("Use TermName instead", "2.11.0")
def newTermName(s: String): TermName
/** Creates a new type name.
* @group Names
*/
+ @deprecated("Use TypeName instead", "2.11.0")
def newTypeName(s: String): TypeName
+
+ /** The constructor/extractor for `TermName` instances.
+ * @group Extractors
+ */
+ val TermName: TermNameExtractor
+
+ /** An extractor class to create and pattern match with syntax `TermName(s)`.
+ * @group Extractors
+ */
+ abstract class TermNameExtractor {
+ def apply(s: String): TermName
+ def unapply(name: TermName): Option[String]
+ }
+
+ /** The constructor/extractor for `TypeName` instances.
+ * @group Extractors
+ */
+ val TypeName: TypeNameExtractor
+
+ /** An extractor class to create and pattern match with syntax `TypeName(s)`.
+ * @group Extractors
+ */
+ abstract class TypeNameExtractor {
+ def apply(s: String): TypeName
+ def unapply(name: TypeName): Option[String]
+ }
}
diff --git a/src/reflect/scala/reflect/api/Trees.scala b/src/reflect/scala/reflect/api/Trees.scala
index cfa6315797..637a7a4c40 100644
--- a/src/reflect/scala/reflect/api/Trees.scala
+++ b/src/reflect/scala/reflect/api/Trees.scala
@@ -89,6 +89,12 @@ trait Trees { self: Universe =>
*/
def isEmpty: Boolean
+ /** Is this tree one of the empty trees?
+ *
+ * @see `isEmpty`
+ */
+ def nonEmpty: Boolean
+
/** Can this tree carry attributes (i.e. symbols, types or positions)?
* Typically the answer is yes, except for the `EmptyTree` null object and
* two special singletons: `emptyValDef` and `pendingSuperCall`.
@@ -3018,15 +3024,19 @@ trait Trees { self: Universe =>
/** The constructor/extractor for `Modifiers` instances.
* @group Traversal
*/
- val Modifiers: ModifiersCreator
+ val Modifiers: ModifiersExtractor
+
+ @deprecated("Use ModifiersExtractor instead", "2.11.0")
+ type ModifiersCreator = ModifiersExtractor
/** An extractor class to create and pattern match with syntax `Modifiers(flags, privateWithin, annotations)`.
* Modifiers encapsulate flags, visibility annotations and Scala annotations for member definitions.
* @group Traversal
*/
- abstract class ModifiersCreator {
+ abstract class ModifiersExtractor {
def apply(): Modifiers = Modifiers(NoFlags, tpnme.EMPTY, List())
def apply(flags: FlagSet, privateWithin: Name, annotations: List[Tree]): Modifiers
+ def unapply(mods: Modifiers): Option[(FlagSet, Name, List[Tree])]
}
/** The factory for `Modifiers` instances.
diff --git a/src/reflect/scala/reflect/internal/AnnotationInfos.scala b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
index cfa4bdf44c..7a972c3f1a 100644
--- a/src/reflect/scala/reflect/internal/AnnotationInfos.scala
+++ b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
@@ -326,6 +326,8 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
object UnmappableAnnotation extends CompleteAnnotationInfo(NoType, Nil, Nil)
+ object ErroneousAnnotation extends CompleteAnnotationInfo(ErrorType, Nil, Nil)
+
/** Extracts symbol of thrown exception from AnnotationInfo.
*
* Supports both “old-style” `@throws(classOf[Exception])`
diff --git a/src/reflect/scala/reflect/internal/Names.scala b/src/reflect/scala/reflect/internal/Names.scala
index cea9215ae2..b60d1e619f 100644
--- a/src/reflect/scala/reflect/internal/Names.scala
+++ b/src/reflect/scala/reflect/internal/Names.scala
@@ -463,6 +463,11 @@ trait Names extends api.Names {
implicit val TermNameTag = ClassTag[TermName](classOf[TermName])
+ object TermName extends TermNameExtractor {
+ def apply(s: String) = newTermName(s)
+ def unapply(name: TermName): Option[String] = Some(name.toString)
+ }
+
sealed abstract class TypeName(index0: Int, len0: Int, hash: Int) extends Name(index0, len0) {
type ThisNameType = TypeName
protected[this] def thisName: TypeName = this
@@ -492,4 +497,9 @@ trait Names extends api.Names {
}
implicit val TypeNameTag = ClassTag[TypeName](classOf[TypeName])
+
+ object TypeName extends TypeNameExtractor {
+ def apply(s: String) = newTypeName(s)
+ def unapply(name: TypeName): Option[String] = Some(name.toString)
+ }
}
diff --git a/src/reflect/scala/reflect/internal/Printers.scala b/src/reflect/scala/reflect/internal/Printers.scala
index 2a3525206f..d36d439077 100644
--- a/src/reflect/scala/reflect/internal/Printers.scala
+++ b/src/reflect/scala/reflect/internal/Printers.scala
@@ -672,7 +672,7 @@ trait Printers extends api.Printers { self: SymbolTable =>
case nme.CONSTRUCTOR => "nme.CONSTRUCTOR"
case nme.ROOTPKG => "nme.ROOTPKG"
case _ =>
- val prefix = if (name.isTermName) "newTermName(\"" else "newTypeName(\""
+ val prefix = if (name.isTermName) "TermName(\"" else "TypeName(\""
prefix + name.toString + "\")"
}
diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala
index c5521ae650..10dd2c82aa 100644
--- a/src/reflect/scala/reflect/internal/StdNames.scala
+++ b/src/reflect/scala/reflect/internal/StdNames.scala
@@ -640,8 +640,6 @@ trait StdNames {
val newFreeType: NameType = "newFreeType"
val newNestedSymbol: NameType = "newNestedSymbol"
val newScopeWith: NameType = "newScopeWith"
- val nmeNewTermName: NameType = "newTermName"
- val nmeNewTypeName: NameType = "newTypeName"
val notifyAll_ : NameType = "notifyAll"
val notify_ : NameType = "notify"
val null_ : NameType = "null"
@@ -672,6 +670,7 @@ trait StdNames {
val staticModule : NameType = "staticModule"
val staticPackage : NameType = "staticPackage"
val synchronized_ : NameType = "synchronized"
+ val TermName: NameType = "TermName"
val this_ : NameType = "this"
val thisPrefix : NameType = "thisPrefix"
val toArray: NameType = "toArray"
@@ -682,6 +681,7 @@ trait StdNames {
val tree : NameType = "tree"
val true_ : NameType = "true"
val typedProductIterator: NameType = "typedProductIterator"
+ val TypeName: NameType = "TypeName"
val typeTagToManifest: NameType = "typeTagToManifest"
val unapply: NameType = "unapply"
val unapplySeq: NameType = "unapplySeq"
diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala
index 13b761086c..9614513458 100644
--- a/src/reflect/scala/reflect/internal/TreeInfo.scala
+++ b/src/reflect/scala/reflect/internal/TreeInfo.scala
@@ -621,6 +621,8 @@ abstract class TreeInfo {
* For advanced use, call `dissectApplied` explicitly and use its methods instead of pattern matching.
*/
object Applied {
+ def apply(tree: Tree): Applied = new Applied(tree)
+
def unapply(applied: Applied): Option[(Tree, List[Tree], List[List[Tree]])] =
Some((applied.core, applied.targs, applied.argss))
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index 9e737528d2..35e10d73c8 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -39,6 +39,8 @@ trait Trees extends api.Trees { self: SymbolTable =>
def isDef = false
def isEmpty = false
+ def nonEmpty = !isEmpty
+
def canHaveAttrs = true
/** The canonical way to test if a Tree represents a term.
@@ -932,7 +934,7 @@ trait Trees extends api.Trees { self: SymbolTable =>
override def toString = "Modifiers(%s, %s, %s)".format(flagString, annotations mkString ", ", positions)
}
- object Modifiers extends ModifiersCreator
+ object Modifiers extends ModifiersExtractor
implicit val ModifiersTag = ClassTag[Modifiers](classOf[Modifiers])
@@ -1499,15 +1501,18 @@ trait Trees extends api.Trees { self: SymbolTable =>
}
}
- private lazy val duplicator = new Transformer {
+ private lazy val duplicator = new Duplicator(focusPositions = true)
+ private class Duplicator(focusPositions: Boolean) extends Transformer {
override val treeCopy = newStrictTreeCopier
override def transform(t: Tree) = {
val t1 = super.transform(t)
- if ((t1 ne t) && t1.pos.isRange) t1 setPos t.pos.focus
+ if ((t1 ne t) && t1.pos.isRange && focusPositions) t1 setPos t.pos.focus
t1
}
}
+ def duplicateAndKeepPositions(tree: Tree) = new Duplicator(focusPositions = false) transform tree
+
// ------ copiers -------------------------------------------
def copyDefDef(tree: Tree)(
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index 282d7e18ac..c121c6020e 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -563,6 +563,26 @@ trait Types extends api.Types { self: SymbolTable =>
/** Expands type aliases. */
def dealias = this
+ /** Repeatedly apply widen and dealias until they have no effect.
+ * This compensates for the fact that type aliases can hide beneath
+ * singleton types and singleton types can hide inside type aliases.
+ */
+ def dealiasWiden: Type = (
+ if (this ne widen) widen.dealiasWiden
+ else if (this ne dealias) dealias.dealiasWiden
+ else this
+ )
+
+ /** All the types encountered in the course of dealiasing/widening,
+ * including each intermediate beta reduction step (whereas calling
+ * dealias applies as many as possible.)
+ */
+ def dealiasWidenChain: List[Type] = this :: (
+ if (this ne widen) widen.dealiasWidenChain
+ else if (this ne betaReduce) betaReduce.dealiasWidenChain
+ else Nil
+ )
+
def etaExpand: Type = this
/** Performs a single step of beta-reduction on types.
@@ -3124,23 +3144,20 @@ trait Types extends api.Types { self: SymbolTable =>
* Checks subtyping of higher-order type vars, and uses variances as defined in the
* type parameter we're trying to infer (the result will be sanity-checked later).
*/
- def unifyFull(tpe: Type) = {
- // The alias/widen variations are often no-ops.
- val tpes = (
- if (isLowerBound) List(tpe, tpe.widen, tpe.dealias, tpe.widen.dealias).distinct
- else List(tpe)
- )
- tpes exists { tp =>
- val lhs = if (isLowerBound) tp.typeArgs else typeArgs
- val rhs = if (isLowerBound) typeArgs else tp.typeArgs
-
- sameLength(lhs, rhs) && {
+ def unifyFull(tpe: Type): Boolean = {
+ def unifySpecific(tp: Type) = {
+ sameLength(typeArgs, tp.typeArgs) && {
+ val lhs = if (isLowerBound) tp.typeArgs else typeArgs
+ val rhs = if (isLowerBound) typeArgs else tp.typeArgs
// this is a higher-kinded type var with same arity as tp.
// side effect: adds the type constructor itself as a bound
addBound(tp.typeConstructor)
isSubArgs(lhs, rhs, params, AnyDepth)
}
}
+ // The type with which we can successfully unify can be hidden
+ // behind singleton types and type aliases.
+ tpe.dealiasWidenChain exists unifySpecific
}
// There's a <: test taking place right now, where tp is a concrete type and this is a typevar
@@ -3236,7 +3253,7 @@ trait Types extends api.Types { self: SymbolTable =>
if (constr.instValid) constr.inst
// get here when checking higher-order subtyping of the typevar by itself
// TODO: check whether this ever happens?
- else if (isHigherKinded) typeFun(params, applyArgs(params map (_.typeConstructor)))
+ else if (isHigherKinded) logResult("Normalizing HK $this")(typeFun(params, applyArgs(params map (_.typeConstructor))))
else super.normalize
)
override def typeSymbol = origin.typeSymbol
@@ -3663,7 +3680,7 @@ trait Types extends api.Types { self: SymbolTable =>
def existentialAbstraction(tparams: List[Symbol], tpe0: Type): Type =
if (tparams.isEmpty) tpe0
else {
- val tpe = deAlias(tpe0)
+ val tpe = normalizeAliases(tpe0)
val tpe1 = new ExistentialExtrapolation(tparams) extrapolate tpe
var tparams0 = tparams
var tparams1 = tparams0 filter tpe1.contains
@@ -3677,13 +3694,16 @@ trait Types extends api.Types { self: SymbolTable =>
newExistentialType(tparams1, tpe1)
}
- /** Remove any occurrences of type aliases from this type */
- object deAlias extends TypeMap {
- def apply(tp: Type): Type = mapOver {
- tp match {
- case TypeRef(pre, sym, args) if sym.isAliasType => tp.normalize
- case _ => tp
- }
+ /** Normalize any type aliases within this type (@see Type#normalize).
+ * Note that this depends very much on the call to "normalize", not "dealias",
+ * so it is no longer carries the too-stealthy name "deAlias".
+ */
+ object normalizeAliases extends TypeMap {
+ def apply(tp: Type): Type = tp match {
+ case TypeRef(_, sym, _) if sym.isAliasType =>
+ def msg = if (tp.isHigherKinded) s"Normalizing type alias function $tp" else s"Dealiasing type alias $tp"
+ mapOver(logResult(msg)(tp.normalize))
+ case _ => mapOver(tp)
}
}
diff --git a/src/reflect/scala/reflect/internal/settings/MutableSettings.scala b/src/reflect/scala/reflect/internal/settings/MutableSettings.scala
index 81ed63bfc6..d5ed9dab5b 100644
--- a/src/reflect/scala/reflect/internal/settings/MutableSettings.scala
+++ b/src/reflect/scala/reflect/internal/settings/MutableSettings.scala
@@ -44,7 +44,6 @@ abstract class MutableSettings extends AbsSettings {
def Yrecursion: IntSetting
def maxClassfileName: IntSetting
def Xexperimental: BooleanSetting
- def XoldPatmat: BooleanSetting
def XnoPatmatAnalysis: BooleanSetting
def XfullLubs: BooleanSetting
def breakCycles: BooleanSetting
diff --git a/src/reflect/scala/reflect/macros/Names.scala b/src/reflect/scala/reflect/macros/Names.scala
index 8bbaa5f848..7e2ac5e02d 100644
--- a/src/reflect/scala/reflect/macros/Names.scala
+++ b/src/reflect/scala/reflect/macros/Names.scala
@@ -11,13 +11,27 @@ trait Names {
self: Context =>
/** Creates a unique string. */
+ @deprecated("Use freshName instead", "2.11.0")
def fresh(): String
/** Creates a unique string having a given prefix. */
+ @deprecated("Use freshName instead", "2.11.0")
def fresh(name: String): String
/** Creates a unique name having a given name as a prefix and
* having the same flavor (term name or type name) as the given name.
*/
+ @deprecated("Use freshName instead", "2.11.0")
def fresh[NameType <: Name](name: NameType): NameType
+
+ /** Creates a unique string. */
+ def freshName(): String
+
+ /** Creates a unique string having a given prefix. */
+ def freshName(name: String): String
+
+ /** Creates a unique name having a given name as a prefix and
+ * having the same flavor (term name or type name) as the given name.
+ */
+ def freshName[NameType <: Name](name: NameType): NameType
}
diff --git a/src/reflect/scala/reflect/runtime/Settings.scala b/src/reflect/scala/reflect/runtime/Settings.scala
index 7d04202455..ba524f4df2 100644
--- a/src/reflect/scala/reflect/runtime/Settings.scala
+++ b/src/reflect/scala/reflect/runtime/Settings.scala
@@ -32,7 +32,6 @@ private[reflect] class Settings extends MutableSettings {
val Xexperimental = new BooleanSetting(false)
val XfullLubs = new BooleanSetting(false)
val XnoPatmatAnalysis = new BooleanSetting(false)
- val XoldPatmat = new BooleanSetting(false)
val Xprintpos = new BooleanSetting(false)
val Ynotnull = new BooleanSetting(false)
val Yshowsymkinds = new BooleanSetting(false)
diff --git a/test/files/continuations-neg/function2.check b/test/files/continuations-neg/function2.check
index 82b81c1444..4b1a6227bc 100644
--- a/test/files/continuations-neg/function2.check
+++ b/test/files/continuations-neg/function2.check
@@ -1,6 +1,6 @@
function2.scala:11: error: type mismatch;
found : () => Int
- required: () => Int @util.continuations.cps[Int]
+ required: () => Int @scala.util.continuations.cpsParam[Int,Int]
val g: () => Int @cps[Int] = f
^
one error found
diff --git a/test/files/continuations-neg/t5314-type-error.check b/test/files/continuations-neg/t5314-type-error.check
index 1f4e46a7f2..e66c9d833f 100644
--- a/test/files/continuations-neg/t5314-type-error.check
+++ b/test/files/continuations-neg/t5314-type-error.check
@@ -1,6 +1,6 @@
t5314-type-error.scala:7: error: type mismatch;
- found : Int @util.continuations.cps[Int]
- required: Int @util.continuations.cps[String]
+ found : Int @scala.util.continuations.cpsParam[Int,Int]
+ required: Int @scala.util.continuations.cpsParam[String,String]
def bar(x:Int): Int @cps[String] = return foo(x)
^
one error found
diff --git a/test/files/jvm/annotations.check b/test/files/jvm/annotations.check
index e307f8930d..a8dc5ecdd1 100644
--- a/test/files/jvm/annotations.check
+++ b/test/files/jvm/annotations.check
@@ -29,8 +29,20 @@ public Test4$Foo8(int)
private int Test4$Foo9.z
@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+private int Test4$Foo9.z2
+
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+private int Test4$Foo9.z3
+
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
public int Test4$Foo9.getZ()
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+public int Test4$Foo9.getZ2()
+
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+public int Test4$Foo9.getZ3()
+
@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://apple.com)
public int Test4$Foo9.x()
diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala
index 66ebde592b..77a45fae89 100644
--- a/test/files/jvm/annotations.scala
+++ b/test/files/jvm/annotations.scala
@@ -101,6 +101,12 @@ object Test4 {
type myAnn = SourceAnnotation @beanGetter @field
@BeanProperty @myAnn("http://eppli.com") var z = 0
+
+ type myAnn2[T] = SourceAnnotation @beanGetter @field
+ @BeanProperty @myAnn2[String]("http://eppli.com") var z2 = 0
+
+ type myAnn3[CC[_]] = SourceAnnotation @beanGetter @field
+ @BeanProperty @myAnn3[List]("http://eppli.com") var z3 = 0
}
class Foo10(@SourceAnnotation("on param 1") val name: String)
class Foo11(@(SourceAnnotation @scala.annotation.meta.field)("on param 2") val name: String)
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check
index 6145b6c4d2..477096fb7e 100644
--- a/test/files/jvm/interpreter.check
+++ b/test/files/jvm/interpreter.check
@@ -357,10 +357,8 @@ defined class Term
scala> def f(e: Exp) = e match { // non-exhaustive warning here
case _:Fact => 3
}
-<console>:18: warning: match is not exhaustive!
-missing combination Exp
-missing combination Term
-
+<console>:18: warning: match may not be exhaustive.
+It would fail on the following inputs: Exp(), Term()
def f(e: Exp) = e match { // non-exhaustive warning here
^
f: (e: Exp)Int
diff --git a/test/files/jvm/interpreter.scala b/test/files/jvm/interpreter.scala
index f45eb034a9..bd1851053f 100644
--- a/test/files/jvm/interpreter.scala
+++ b/test/files/jvm/interpreter.scala
@@ -2,7 +2,7 @@ import scala.tools.nsc._
import scala.tools.partest.ReplTest
object Test extends ReplTest {
- override def extraSettings = "-deprecation -Xoldpatmat"
+ override def extraSettings = "-deprecation"
def code = <code>
// basics
3+4
diff --git a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
index 908438cf65..f9e0ca5077 100644
--- a/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
+++ b/test/files/neg/macro-basic-mamdmi/Impls_Macros_Test_1.scala
@@ -3,19 +3,19 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
}
}
diff --git a/test/files/neg/macro-invalidimpl-f/Impls_1.scala b/test/files/neg/macro-invalidimpl-f/Impls_1.scala
index 334ee714be..0e4da86d22 100644
--- a/test/files/neg/macro-invalidimpl-f/Impls_1.scala
+++ b/test/files/neg/macro-invalidimpl-f/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def fooNullary(c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
c.Expr[Unit](body)
}
diff --git a/test/files/neg/macro-invalidimpl-g/Impls_1.scala b/test/files/neg/macro-invalidimpl-g/Impls_1.scala
index 334ee714be..0e4da86d22 100644
--- a/test/files/neg/macro-invalidimpl-g/Impls_1.scala
+++ b/test/files/neg/macro-invalidimpl-g/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def fooNullary(c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
c.Expr[Unit](body)
}
diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala
index 7a7293422e..8205694768 100644
--- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala
+++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala
@@ -6,9 +6,9 @@ object Impls {
import c.{prefix => prefix}
import c.universe._
val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[U]].tpe))))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo_targs...")))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("U is: " + implicitly[c.WeakTypeTag[U]].tpe))))),
Literal(Constant(())))
c.Expr[Unit](body)
}
diff --git a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
index 8d7fdf3e8a..498bd4f18d 100644
--- a/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
+++ b/test/files/neg/macro-invalidusage-methodvaluesyntax/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
index ec93dd4111..69ef57d18d 100644
--- a/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
+++ b/test/files/neg/macro-override-method-overrides-macro/Impls_1.scala
@@ -4,7 +4,7 @@ object Impls {
def impl(c: Ctx)(tag: String, x: c.Expr[_]) = {
import c.{prefix => prefix}
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
c.Expr[Unit](body)
}
diff --git a/test/files/neg/macro-without-xmacros-a/Impls_1.scala b/test/files/neg/macro-without-xmacros-a/Impls_1.scala
index 8976f8e28d..c6677c4fde 100644
--- a/test/files/neg/macro-without-xmacros-a/Impls_1.scala
+++ b/test/files/neg/macro-without-xmacros-a/Impls_1.scala
@@ -3,16 +3,16 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
}
def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
}
def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))))
}
} \ No newline at end of file
diff --git a/test/files/neg/macro-without-xmacros-b/Impls_1.scala b/test/files/neg/macro-without-xmacros-b/Impls_1.scala
index 8976f8e28d..c6677c4fde 100644
--- a/test/files/neg/macro-without-xmacros-b/Impls_1.scala
+++ b/test/files/neg/macro-without-xmacros-b/Impls_1.scala
@@ -3,16 +3,16 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
}
def bar_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
}
def quux_impl(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3)))))
}
} \ No newline at end of file
diff --git a/test/files/neg/override-object-no.check b/test/files/neg/override-object-no.check
index 52bad2b937..9cfda80fc3 100644
--- a/test/files/neg/override-object-no.check
+++ b/test/files/neg/override-object-no.check
@@ -6,8 +6,8 @@ an overriding object must conform to the overridden object's class bound;
^
override-object-no.scala:21: error: overriding object Bar in trait Quux1 with object Bar in trait Quux2:
an overriding object must conform to the overridden object's class bound;
- found : Object{def g: String}
- required: Object{def g: Int}
+ found : AnyRef{def g: String}
+ required: AnyRef{def g: Int}
trait Quux2 extends Quux1 { override object Bar { def g = "abc" } } // err
^
override-object-no.scala:25: error: overriding object Bar in trait Quux3;
diff --git a/test/files/neg/pat_unreachable.check b/test/files/neg/pat_unreachable.check
index c5706b7fad..b4c0e7e104 100644
--- a/test/files/neg/pat_unreachable.check
+++ b/test/files/neg/pat_unreachable.check
@@ -1,13 +1,14 @@
-pat_unreachable.scala:5: error: unreachable code
- case Seq(x, y, z, w) => List(z,w) // redundant!
- ^
-pat_unreachable.scala:9: error: unreachable code
- case Seq(x, y) => List(x, y)
- ^
-pat_unreachable.scala:23: error: unreachable code
+pat_unreachable.scala:22: warning: patterns after a variable pattern cannot match (SLS 8.1.1)
+If you intended to match against parameter b of method contrivedExample, you must use backticks, like: case `b` =>
+ case b => println("matched b")
+ ^
+pat_unreachable.scala:23: warning: unreachable code due to variable pattern 'b' on line 22
+If you intended to match against parameter c of method contrivedExample, you must use backticks, like: case `c` =>
case c => println("matched c")
^
-pat_unreachable.scala:24: error: unreachable code
+pat_unreachable.scala:24: warning: unreachable code due to variable pattern 'b' on line 22
case _ => println("matched neither")
^
-four errors found
+error: No warnings can be incurred under -Xfatal-warnings.
+three warnings found
+one error found
diff --git a/test/files/neg/pat_unreachable.flags b/test/files/neg/pat_unreachable.flags
index cb8324a345..85d8eb2ba2 100644
--- a/test/files/neg/pat_unreachable.flags
+++ b/test/files/neg/pat_unreachable.flags
@@ -1 +1 @@
--Xoldpatmat \ No newline at end of file
+-Xfatal-warnings
diff --git a/test/files/neg/t2078.check b/test/files/neg/t2078.check
index 3cdaa7d27a..00bb323a0b 100644
--- a/test/files/neg/t2078.check
+++ b/test/files/neg/t2078.check
@@ -1,4 +1,4 @@
-t2078.scala:2: error: contravariant type S occurs in covariant position in type => Object{val x: S} of value f
+t2078.scala:2: error: contravariant type S occurs in covariant position in type => AnyRef{val x: S} of value f
val f = new { val x = y }
^
one error found
diff --git a/test/files/neg/t2336.check b/test/files/neg/t2336.check
index 983717469c..28acd4d179 100644
--- a/test/files/neg/t2336.check
+++ b/test/files/neg/t2336.check
@@ -1,4 +1,4 @@
-t2336.scala:6: error: type Foo[Int] is not a stable prefix
+t2336.scala:6: error: Foo[Int] is not a legal prefix for a constructor
new Foo[Int]#Bar(0)
^
one error found
diff --git a/test/files/neg/t3691.check b/test/files/neg/t3691.check
index bdf6c268b2..6a7e13049a 100644
--- a/test/files/neg/t3691.check
+++ b/test/files/neg/t3691.check
@@ -9,7 +9,7 @@ t3691.scala:5: error: type mismatch;
val c = (new A[String]{}): { type A } // not ok
^
t3691.scala:7: error: type mismatch;
- found : Object{type A = String}
+ found : AnyRef{type A = String}
required: AnyRef{type A[X]}
val x = (new { type A = String }): { type A[X] } // not ok
^
diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check
index 5aa991c105..9b96449930 100644
--- a/test/files/neg/t3692-new.check
+++ b/test/files/neg/t3692-new.check
@@ -7,8 +7,13 @@ t3692-new.scala:15: warning: non-variable type argument Int in type pattern Map[
t3692-new.scala:16: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure
case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
^
-t3692-new.scala:16: error: unreachable code
- case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
+t3692-new.scala:15: warning: unreachable code
+ case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
^
-three warnings found
+t3692-new.scala:4: warning: Tester has a main method with parameter type Array[String], but Tester will not be a runnable program.
+ Reason: main method must have exact signature (Array[String])Unit
+object Tester {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+5 warnings found
one error found
diff --git a/test/files/neg/t3692-new.flags b/test/files/neg/t3692-new.flags
index cb8324a345..85d8eb2ba2 100644
--- a/test/files/neg/t3692-new.flags
+++ b/test/files/neg/t3692-new.flags
@@ -1 +1 @@
--Xoldpatmat \ No newline at end of file
+-Xfatal-warnings
diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check
deleted file mode 100644
index 9f3ae516aa..0000000000
--- a/test/files/neg/t3692-old.check
+++ /dev/null
@@ -1,14 +0,0 @@
-t3692-old.scala:13: warning: non-variable type argument Int in type pattern Map[Int,Int] is unchecked since it is eliminated by erasure
- case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer]
- ^
-t3692-old.scala:14: warning: non-variable type argument Int in type pattern Map[Int,V] is unchecked since it is eliminated by erasure
- case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
- ^
-t3692-old.scala:15: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure
- case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
- ^
-t3692-old.scala:15: error: unreachable code
- case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
- ^
-three warnings found
-one error found
diff --git a/test/files/neg/t3692-old.flags b/test/files/neg/t3692-old.flags
deleted file mode 100644
index cb8324a345..0000000000
--- a/test/files/neg/t3692-old.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xoldpatmat \ No newline at end of file
diff --git a/test/files/neg/t3692-old.scala b/test/files/neg/t3692-old.scala
deleted file mode 100644
index 151535ae94..0000000000
--- a/test/files/neg/t3692-old.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-import java.lang.Integer
-
-object ManifestTester {
- def main(args: Array[String]) = {
- val map = Map("John" -> 1, "Josh" -> 2)
- new ManifestTester().toJavaMap(map)
- }
-}
-
-class ManifestTester {
- private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
- map match {
- case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer]
- case m1: Map[Int, V] => new java.util.HashMap[Integer, V]
- case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
- case _ => new java.util.HashMap[T, V]
- }
- }
-} \ No newline at end of file
diff --git a/test/files/neg/t4460a.check b/test/files/neg/t4460a.check
new file mode 100644
index 0000000000..b711e7acb1
--- /dev/null
+++ b/test/files/neg/t4460a.check
@@ -0,0 +1,4 @@
+t4460a.scala:6: error: called constructor's definition must precede calling constructor's definition
+ def this() = this() // was binding to Predef.<init> !!
+ ^
+one error found
diff --git a/test/files/neg/t4460a.scala b/test/files/neg/t4460a.scala
new file mode 100644
index 0000000000..0a7a22178d
--- /dev/null
+++ b/test/files/neg/t4460a.scala
@@ -0,0 +1,7 @@
+trait A
+
+class B(val x: Int) {
+ self: A =>
+
+ def this() = this() // was binding to Predef.<init> !!
+}
diff --git a/test/files/neg/t4460b.check b/test/files/neg/t4460b.check
new file mode 100644
index 0000000000..f0e703fd10
--- /dev/null
+++ b/test/files/neg/t4460b.check
@@ -0,0 +1,4 @@
+t4460b.scala:7: error: called constructor's definition must precede calling constructor's definition
+ def this() = this() // was binding to Predef.<init> !!
+ ^
+one error found
diff --git a/test/files/neg/t4460b.scala b/test/files/neg/t4460b.scala
new file mode 100644
index 0000000000..1233017dd4
--- /dev/null
+++ b/test/files/neg/t4460b.scala
@@ -0,0 +1,9 @@
+trait A
+
+class Outer() {
+ class B(val x: Int) {
+ self: A =>
+
+ def this() = this() // was binding to Predef.<init> !!
+ }
+}
diff --git a/test/files/neg/t4460c.check b/test/files/neg/t4460c.check
new file mode 100644
index 0000000000..4e96711b8b
--- /dev/null
+++ b/test/files/neg/t4460c.check
@@ -0,0 +1,7 @@
+t4460c.scala:4: error: overloaded method constructor B with alternatives:
+ (a: String)B <and>
+ (x: Int)B
+ cannot be applied to ()
+ def this(a: String) = this()
+ ^
+one error found
diff --git a/test/files/neg/t4460c.scala b/test/files/neg/t4460c.scala
new file mode 100644
index 0000000000..1ae258508e
--- /dev/null
+++ b/test/files/neg/t4460c.scala
@@ -0,0 +1,7 @@
+class B(val x: Int) {
+ self: A =>
+
+ def this(a: String) = this()
+}
+
+class A()
diff --git a/test/files/neg/t4877.check b/test/files/neg/t4877.check
index a4b1e6a50d..5a2413ca8b 100644
--- a/test/files/neg/t4877.check
+++ b/test/files/neg/t4877.check
@@ -1,10 +1,10 @@
t4877.scala:4: error: type mismatch;
- found : Object{def bar: Int}
+ found : AnyRef{def bar: Int}
required: AnyRef{def bar: String}
def foo: AnyRef { def bar: String } = new AnyRef { def bar = 42 }
^
t4877.scala:6: error: type mismatch;
- found : Object{def bar(x: Int): String}
+ found : AnyRef{def bar(x: Int): String}
required: AnyRef{def bar(x: Int): Int}
def foo3: AnyRef { def bar(x: Int): Int } = new AnyRef { def bar(x: Int) = "abc" }
^
@@ -14,7 +14,7 @@ t4877.scala:7: error: type mismatch;
def foo4: C { def bar(x: Int): Int ; def quux(x: Int): Int } = new C { def bar(x: Int) = 5 }
^
t4877.scala:17: error: type mismatch;
- found : Object{type Mom = String; def bar(x: Int): Int; def bippy(): List[Int]}
+ found : AnyRef{type Mom = String; def bar(x: Int): Int; def bippy(): List[Int]}
required: B.this.Bippy
(which expands to) AnyRef{type Mom; def bar(x: Int): this.Mom; def bippy(): List[this.Mom]}
val x: Bippy = new AnyRef {
diff --git a/test/files/neg/t5060.check b/test/files/neg/t5060.check
index e71f30ccdb..09b2d9a4b1 100644
--- a/test/files/neg/t5060.check
+++ b/test/files/neg/t5060.check
@@ -1,7 +1,7 @@
-t5060.scala:2: error: covariant type T occurs in contravariant position in type => Object{def contains(x: T): Unit} of value foo0
+t5060.scala:2: error: covariant type T occurs in contravariant position in type => AnyRef{def contains(x: T): Unit} of value foo0
val foo0 = {
^
-t5060.scala:6: error: covariant type T occurs in contravariant position in type => Object{def contains(x: T): Unit} of method foo1
+t5060.scala:6: error: covariant type T occurs in contravariant position in type => AnyRef{def contains(x: T): Unit} of method foo1
def foo1 = {
^
two errors found
diff --git a/test/files/neg/t5063.check b/test/files/neg/t5063.check
index 84690d0a1d..c6e553c1b5 100644
--- a/test/files/neg/t5063.check
+++ b/test/files/neg/t5063.check
@@ -1,4 +1,4 @@
-t5063.scala:2: error: value + is not a member of Object
+t5063.scala:2: error: value + is not a member of AnyRef
super.+("")
^
one error found
diff --git a/test/files/neg/t6436.check b/test/files/neg/t6436.check
index ecb28f9100..5cee6fb558 100644
--- a/test/files/neg/t6436.check
+++ b/test/files/neg/t6436.check
@@ -2,8 +2,8 @@ t6436.scala:8: error: type mismatch;
found : StringContext
required: ?{def q: ?}
Note that implicit conversions are not applicable because they are ambiguous:
- both method foo1 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
- and method foo2 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ both method foo1 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
are possible conversion functions from StringContext to ?{def q: ?}
println(q"a")
^
diff --git a/test/files/neg/t6436b.check b/test/files/neg/t6436b.check
index b3c2d73739..21ab972b79 100644
--- a/test/files/neg/t6436b.check
+++ b/test/files/neg/t6436b.check
@@ -2,8 +2,8 @@ t6436b.scala:8: error: type mismatch;
found : StringContext
required: ?{def q: ?}
Note that implicit conversions are not applicable because they are ambiguous:
- both method foo1 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
- and method foo2 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ both method foo1 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
are possible conversion functions from StringContext to ?{def q: ?}
println(StringContext("a").q())
^
diff --git a/test/files/neg/t963.check b/test/files/neg/t963.check
index 1f2d0687b3..4dc202c7bd 100644
--- a/test/files/neg/t963.check
+++ b/test/files/neg/t963.check
@@ -5,7 +5,7 @@ t963.scala:17: error: stable identifier required, but Test.this.y4.x found.
val w4 : y4.x.type = y4.x
^
t963.scala:10: error: type mismatch;
- found : Object{def x: Integer}
+ found : AnyRef{def x: Integer}
required: AnyRef{val x: Integer}
val y2 : { val x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) }
^
diff --git a/test/files/neg/unreachablechar.check b/test/files/neg/unreachablechar.check
index 58ce1a7e91..121f12a0c7 100644
--- a/test/files/neg/unreachablechar.check
+++ b/test/files/neg/unreachablechar.check
@@ -1,4 +1,9 @@
-unreachablechar.scala:5: error: unreachable code
+unreachablechar.scala:4: warning: patterns after a variable pattern cannot match (SLS 8.1.1)
+ case _ => println("stuff");
+ ^
+unreachablechar.scala:5: warning: unreachable code due to variable pattern on line 4
case 'f' => println("not stuff?");
^
+error: No warnings can be incurred under -Xfatal-warnings.
+two warnings found
one error found
diff --git a/test/files/neg/unreachablechar.flags b/test/files/neg/unreachablechar.flags
index 809e9ff2f2..85d8eb2ba2 100644
--- a/test/files/neg/unreachablechar.flags
+++ b/test/files/neg/unreachablechar.flags
@@ -1 +1 @@
- -Xoldpatmat
+-Xfatal-warnings
diff --git a/test/files/pos/t1439.flags b/test/files/pos/t1439.flags
index 1e70f5c5c7..bca57e4785 100644
--- a/test/files/pos/t1439.flags
+++ b/test/files/pos/t1439.flags
@@ -1 +1 @@
--unchecked -Xfatal-warnings -Xoldpatmat -language:higherKinds
+-unchecked -Xfatal-warnings -language:higherKinds
diff --git a/test/files/pos/t6745.scala b/test/files/pos/t6745.scala
new file mode 100644
index 0000000000..2ab8e6d39a
--- /dev/null
+++ b/test/files/pos/t6745.scala
@@ -0,0 +1,4 @@
+class Bar(val i: Int) {
+ self: Any with AnyRef =>
+ def this() = this(0)
+}
diff --git a/test/files/pos/t6846.scala b/test/files/pos/t6846.scala
new file mode 100644
index 0000000000..009566493f
--- /dev/null
+++ b/test/files/pos/t6846.scala
@@ -0,0 +1,28 @@
+object Test {
+ class Arb[_]
+ implicit def foo[M[_], A]: Arb[M[A]] = null
+ foo: Arb[List[Int]]
+ type ListInt = List[Int]
+ foo: Arb[ListInt]
+}
+
+object Test2 {
+ import scala.collection.immutable.List
+
+ class Carb[_]
+ implicit def narrow[N, M[_], A](x: Carb[M[A]])(implicit ev: N <:< M[A]): Carb[N] = null
+ implicit def bar[M[_], A]: Carb[M[A]] = null
+
+ type ListInt = List[Int]
+
+ val x: List[Int] = List(1)
+ val y: ListInt = List(1)
+
+ type ListSingletonX = x.type
+ type ListSingletonY = y.type
+
+ bar: Carb[List[Int]]
+ bar: Carb[ListInt]
+ bar: Carb[ListSingletonX]
+ bar: Carb[ListSingletonY]
+}
diff --git a/test/files/run/existentials-in-compiler.check b/test/files/run/existentials-in-compiler.check
index 4df4b0ca96..0d7a9298b4 100644
--- a/test/files/run/existentials-in-compiler.check
+++ b/test/files/run/existentials-in-compiler.check
@@ -1,156 +1,156 @@
-abstract trait Bippy[A <: AnyRef, B] extends Object
+abstract trait Bippy[A <: AnyRef, B] extends AnyRef
extest.Bippy[_ <: AnyRef, _]
-abstract trait BippyBud[A <: AnyRef, B, C <: List[A]] extends Object
+abstract trait BippyBud[A <: AnyRef, B, C <: List[A]] extends AnyRef
extest.BippyBud[A,B,C] forSome { A <: AnyRef; B; C <: List[A] }
-abstract trait BippyLike[A <: AnyRef, B <: List[A], This <: extest.BippyLike[A,B,This] with extest.Bippy[A,B]] extends Object
+abstract trait BippyLike[A <: AnyRef, B <: List[A], This <: extest.BippyLike[A,B,This] with extest.Bippy[A,B]] extends AnyRef
extest.BippyLike[A,B,This] forSome { A <: AnyRef; B <: List[A]; This <: extest.BippyLike[A,B,This] with extest.Bippy[A,B] }
-abstract trait Contra[-A >: AnyRef, -B] extends Object
+abstract trait Contra[-A >: AnyRef, -B] extends AnyRef
extest.Contra[_ >: AnyRef, _]
-abstract trait ContraLike[-A >: AnyRef, -B >: List[A]] extends Object
+abstract trait ContraLike[-A >: AnyRef, -B >: List[A]] extends AnyRef
extest.ContraLike[A,B] forSome { -A >: AnyRef; -B >: List[A] }
-abstract trait Cov01[+A <: AnyRef, +B] extends Object
+abstract trait Cov01[+A <: AnyRef, +B] extends AnyRef
extest.Cov01[_ <: AnyRef, _]
-abstract trait Cov02[+A <: AnyRef, B] extends Object
+abstract trait Cov02[+A <: AnyRef, B] extends AnyRef
extest.Cov02[_ <: AnyRef, _]
-abstract trait Cov03[+A <: AnyRef, -B] extends Object
+abstract trait Cov03[+A <: AnyRef, -B] extends AnyRef
extest.Cov03[_ <: AnyRef, _]
-abstract trait Cov04[A <: AnyRef, +B] extends Object
+abstract trait Cov04[A <: AnyRef, +B] extends AnyRef
extest.Cov04[_ <: AnyRef, _]
-abstract trait Cov05[A <: AnyRef, B] extends Object
+abstract trait Cov05[A <: AnyRef, B] extends AnyRef
extest.Cov05[_ <: AnyRef, _]
-abstract trait Cov06[A <: AnyRef, -B] extends Object
+abstract trait Cov06[A <: AnyRef, -B] extends AnyRef
extest.Cov06[_ <: AnyRef, _]
-abstract trait Cov07[-A <: AnyRef, +B] extends Object
+abstract trait Cov07[-A <: AnyRef, +B] extends AnyRef
extest.Cov07[_ <: AnyRef, _]
-abstract trait Cov08[-A <: AnyRef, B] extends Object
+abstract trait Cov08[-A <: AnyRef, B] extends AnyRef
extest.Cov08[_ <: AnyRef, _]
-abstract trait Cov09[-A <: AnyRef, -B] extends Object
+abstract trait Cov09[-A <: AnyRef, -B] extends AnyRef
extest.Cov09[_ <: AnyRef, _]
-abstract trait Cov11[+A <: AnyRef, +B <: List[_]] extends Object
+abstract trait Cov11[+A <: AnyRef, +B <: List[_]] extends AnyRef
extest.Cov11[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov12[+A <: AnyRef, B <: List[_]] extends Object
+abstract trait Cov12[+A <: AnyRef, B <: List[_]] extends AnyRef
extest.Cov12[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov13[+A <: AnyRef, -B <: List[_]] extends Object
+abstract trait Cov13[+A <: AnyRef, -B <: List[_]] extends AnyRef
extest.Cov13[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov14[A <: AnyRef, +B <: List[_]] extends Object
+abstract trait Cov14[A <: AnyRef, +B <: List[_]] extends AnyRef
extest.Cov14[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov15[A <: AnyRef, B <: List[_]] extends Object
+abstract trait Cov15[A <: AnyRef, B <: List[_]] extends AnyRef
extest.Cov15[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov16[A <: AnyRef, -B <: List[_]] extends Object
+abstract trait Cov16[A <: AnyRef, -B <: List[_]] extends AnyRef
extest.Cov16[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov17[-A <: AnyRef, +B <: List[_]] extends Object
+abstract trait Cov17[-A <: AnyRef, +B <: List[_]] extends AnyRef
extest.Cov17[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov18[-A <: AnyRef, B <: List[_]] extends Object
+abstract trait Cov18[-A <: AnyRef, B <: List[_]] extends AnyRef
extest.Cov18[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov19[-A <: AnyRef, -B <: List[_]] extends Object
+abstract trait Cov19[-A <: AnyRef, -B <: List[_]] extends AnyRef
extest.Cov19[_ <: AnyRef, _ <: List[_]]
-abstract trait Cov21[+A, +B] extends Object
+abstract trait Cov21[+A, +B] extends AnyRef
extest.Cov21[_, _]
-abstract trait Cov22[+A, B] extends Object
+abstract trait Cov22[+A, B] extends AnyRef
extest.Cov22[_, _]
-abstract trait Cov23[+A, -B] extends Object
+abstract trait Cov23[+A, -B] extends AnyRef
extest.Cov23[_, _]
-abstract trait Cov24[A, +B] extends Object
+abstract trait Cov24[A, +B] extends AnyRef
extest.Cov24[_, _]
-abstract trait Cov25[A, B] extends Object
+abstract trait Cov25[A, B] extends AnyRef
extest.Cov25[_, _]
-abstract trait Cov26[A, -B] extends Object
+abstract trait Cov26[A, -B] extends AnyRef
extest.Cov26[_, _]
-abstract trait Cov27[-A, +B] extends Object
+abstract trait Cov27[-A, +B] extends AnyRef
extest.Cov27[_, _]
-abstract trait Cov28[-A, B] extends Object
+abstract trait Cov28[-A, B] extends AnyRef
extest.Cov28[_, _]
-abstract trait Cov29[-A, -B] extends Object
+abstract trait Cov29[-A, -B] extends AnyRef
extest.Cov29[_, _]
-abstract trait Cov31[+A, +B, C <: (A, B)] extends Object
+abstract trait Cov31[+A, +B, C <: (A, B)] extends AnyRef
extest.Cov31[A,B,C] forSome { +A; +B; C <: (A, B) }
-abstract trait Cov32[+A, B, C <: (A, B)] extends Object
+abstract trait Cov32[+A, B, C <: (A, B)] extends AnyRef
extest.Cov32[A,B,C] forSome { +A; B; C <: (A, B) }
-abstract trait Cov33[+A, -B, C <: Tuple2[A, _]] extends Object
+abstract trait Cov33[+A, -B, C <: Tuple2[A, _]] extends AnyRef
extest.Cov33[A,B,C] forSome { +A; -B; C <: Tuple2[A, _] }
-abstract trait Cov34[A, +B, C <: (A, B)] extends Object
+abstract trait Cov34[A, +B, C <: (A, B)] extends AnyRef
extest.Cov34[A,B,C] forSome { A; +B; C <: (A, B) }
-abstract trait Cov35[A, B, C <: (A, B)] extends Object
+abstract trait Cov35[A, B, C <: (A, B)] extends AnyRef
extest.Cov35[A,B,C] forSome { A; B; C <: (A, B) }
-abstract trait Cov36[A, -B, C <: Tuple2[A, _]] extends Object
+abstract trait Cov36[A, -B, C <: Tuple2[A, _]] extends AnyRef
extest.Cov36[A,B,C] forSome { A; -B; C <: Tuple2[A, _] }
-abstract trait Cov37[-A, +B, C <: Tuple2[_, B]] extends Object
+abstract trait Cov37[-A, +B, C <: Tuple2[_, B]] extends AnyRef
extest.Cov37[A,B,C] forSome { -A; +B; C <: Tuple2[_, B] }
-abstract trait Cov38[-A, B, C <: Tuple2[_, B]] extends Object
+abstract trait Cov38[-A, B, C <: Tuple2[_, B]] extends AnyRef
extest.Cov38[A,B,C] forSome { -A; B; C <: Tuple2[_, B] }
-abstract trait Cov39[-A, -B, C <: Tuple2[_, _]] extends Object
+abstract trait Cov39[-A, -B, C <: Tuple2[_, _]] extends AnyRef
extest.Cov39[_, _, _ <: Tuple2[_, _]]
-abstract trait Cov41[+A >: Null, +B] extends Object
+abstract trait Cov41[+A >: Null, +B] extends AnyRef
extest.Cov41[_ >: Null, _]
-abstract trait Cov42[+A >: Null, B] extends Object
+abstract trait Cov42[+A >: Null, B] extends AnyRef
extest.Cov42[_ >: Null, _]
-abstract trait Cov43[+A >: Null, -B] extends Object
+abstract trait Cov43[+A >: Null, -B] extends AnyRef
extest.Cov43[_ >: Null, _]
-abstract trait Cov44[A >: Null, +B] extends Object
+abstract trait Cov44[A >: Null, +B] extends AnyRef
extest.Cov44[_ >: Null, _]
-abstract trait Cov45[A >: Null, B] extends Object
+abstract trait Cov45[A >: Null, B] extends AnyRef
extest.Cov45[_ >: Null, _]
-abstract trait Cov46[A >: Null, -B] extends Object
+abstract trait Cov46[A >: Null, -B] extends AnyRef
extest.Cov46[_ >: Null, _]
-abstract trait Cov47[-A >: Null, +B] extends Object
+abstract trait Cov47[-A >: Null, +B] extends AnyRef
extest.Cov47[_ >: Null, _]
-abstract trait Cov48[-A >: Null, B] extends Object
+abstract trait Cov48[-A >: Null, B] extends AnyRef
extest.Cov48[_ >: Null, _]
-abstract trait Cov49[-A >: Null, -B] extends Object
+abstract trait Cov49[-A >: Null, -B] extends AnyRef
extest.Cov49[_ >: Null, _]
-abstract trait Covariant[+A <: AnyRef, +B] extends Object
+abstract trait Covariant[+A <: AnyRef, +B] extends AnyRef
extest.Covariant[_ <: AnyRef, _]
-abstract trait CovariantLike[+A <: AnyRef, +B <: List[A], +This <: extest.CovariantLike[A,B,This] with extest.Covariant[A,B]] extends Object
+abstract trait CovariantLike[+A <: AnyRef, +B <: List[A], +This <: extest.CovariantLike[A,B,This] with extest.Covariant[A,B]] extends AnyRef
extest.CovariantLike[A,B,This] forSome { +A <: AnyRef; +B <: List[A]; +This <: extest.CovariantLike[A,B,This] with extest.Covariant[A,B] }
diff --git a/test/files/run/existentials3-new.check b/test/files/run/existentials3-new.check
index 00614b19db..8f7dd701ac 100644
--- a/test/files/run/existentials3-new.check
+++ b/test/files/run/existentials3-new.check
@@ -7,7 +7,7 @@ Test.ToS, t=RefinedType, s=f5
() => Test.ToS, t=TypeRef, s=trait Function0
$anon, t=TypeRef, s=type $anon
$anon, t=TypeRef, s=type $anon
-List[java.lang.Object{type T1}#T1], t=TypeRef, s=class List
+List[AnyRef{type T1}#T1], t=TypeRef, s=class List
List[Seq[Int]], t=TypeRef, s=class List
List[Seq[U forSome { type U <: Int }]], t=TypeRef, s=class List
Bar.type, t=TypeRef, s=type Bar.type
@@ -19,6 +19,6 @@ Test.ToS, t=RefinedType, s=g5
() => Test.ToS, t=TypeRef, s=trait Function0
$anon, t=TypeRef, s=type $anon
$anon, t=TypeRef, s=type $anon
-List[java.lang.Object{type T1}#T1], t=TypeRef, s=class List
+List[AnyRef{type T1}#T1], t=TypeRef, s=class List
List[Seq[Int]], t=TypeRef, s=class List
List[Seq[U forSome { type U <: Int }]], t=TypeRef, s=class List
diff --git a/test/files/run/existentials3-old.check b/test/files/run/existentials3-old.check
index 72abfac637..36a458dacc 100644
--- a/test/files/run/existentials3-old.check
+++ b/test/files/run/existentials3-old.check
@@ -5,7 +5,7 @@ Object with Test$ToS
Object with Test$ToS
scala.Function0[Object with Test$ToS]
scala.Function0[Object with Test$ToS]
-_ <: Object with _ <: Object with Test$ToS
+_ <: Object with _ <: Object with Object with Test$ToS
_ <: Object with _ <: Object with _ <: Object with Test$ToS
scala.collection.immutable.List[Object with scala.collection.Seq[Int]]
scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]]
@@ -16,7 +16,7 @@ Object with Test$ToS
Object with Test$ToS
scala.Function0[Object with Test$ToS]
scala.Function0[Object with Test$ToS]
-_ <: Object with _ <: Object with Test$ToS
+_ <: Object with _ <: Object with Object with Test$ToS
_ <: Object with _ <: Object with _ <: Object with Test$ToS
scala.collection.immutable.List[Object with scala.collection.Seq[Int]]
scala.collection.immutable.List[Object with scala.collection.Seq[_ <: Int]]
diff --git a/test/files/run/idempotency-this.check b/test/files/run/idempotency-this.check
index 08738c4565..efabaf1ec4 100644
--- a/test/files/run/idempotency-this.check
+++ b/test/files/run/idempotency-this.check
@@ -1,4 +1,4 @@
List()
immutable.this.List.apply[String]("")
-Apply(TypeApply(Select(Select(This(newTypeName("immutable")), scala.collection.immutable.List), newTermName("apply")), List(TypeTree().setOriginal(Ident(newTypeName("String"))))), List(Literal(Constant(""))))
+Apply(TypeApply(Select(Select(This(TypeName("immutable")), scala.collection.immutable.List), TermName("apply")), List(TypeTree().setOriginal(Ident(TypeName("String"))))), List(Literal(Constant(""))))
error!
diff --git a/test/files/run/macro-abort-fresh/Macros_1.scala b/test/files/run/macro-abort-fresh/Macros_1.scala
index af1e292588..415b76852f 100644
--- a/test/files/run/macro-abort-fresh/Macros_1.scala
+++ b/test/files/run/macro-abort-fresh/Macros_1.scala
@@ -5,7 +5,7 @@ object Impls {
import c.universe._
println(c.fresh())
println(c.fresh("qwe"))
- println(c.fresh(newTypeName("qwe")))
+ println(c.fresh(TypeName("qwe")))
c.abort(NoPosition, "blargh")
}
}
diff --git a/test/files/run/macro-abort-fresh/Test_2.scala b/test/files/run/macro-abort-fresh/Test_2.scala
index 0b9986e9f6..61f0bdfadc 100644
--- a/test/files/run/macro-abort-fresh/Test_2.scala
+++ b/test/files/run/macro-abort-fresh/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val tree = Select(Ident(TermName("Macros")), TermName("foo"))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala
index 646634c972..ce30366c61 100644
--- a/test/files/run/macro-basic-ma-md-mi/Impls_1.scala
+++ b/test/files/run/macro-basic-ma-md-mi/Impls_1.scala
@@ -3,19 +3,19 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala
index aa1e52e4aa..a601af6dde 100644
--- a/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala
+++ b/test/files/run/macro-basic-ma-mdmi/Impls_Macros_1.scala
@@ -3,19 +3,19 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
}
}
diff --git a/test/files/run/macro-basic-mamd-mi/Impls_1.scala b/test/files/run/macro-basic-mamd-mi/Impls_1.scala
index 061aa2d4a3..6e5983bdec 100644
--- a/test/files/run/macro-basic-mamd-mi/Impls_1.scala
+++ b/test/files/run/macro-basic-mamd-mi/Impls_1.scala
@@ -3,17 +3,17 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1)))))
}
def bar(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- c.Expr(Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2)))))
+ c.Expr(Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2)))))
}
def quux(c: Ctx)(x: c.Expr[Int]): c.Expr[Int] = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala
index 0ca0be5a48..9c1e4ee46d 100644
--- a/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala
+++ b/test/files/run/macro-bodyexpandstoimpl/Impls_1.scala
@@ -6,7 +6,7 @@ object Impls {
def refToFoo(dummy: Int) = macro refToFoo_impl
def refToFoo_impl(c: Ctx)(dummy: c.Expr[Int]) = {
import c.universe._
- val body = Select(Ident(newTermName("Impls")), newTermName("foo"))
+ val body = Select(Ident(TermName("Impls")), TermName("foo"))
c.Expr[Int](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-annotation/Impls_1.scala b/test/files/run/macro-declared-in-annotation/Impls_1.scala
index a11ee2907a..1ea06de679 100644
--- a/test/files/run/macro-declared-in-annotation/Impls_1.scala
+++ b/test/files/run/macro-declared-in-annotation/Impls_1.scala
@@ -4,7 +4,7 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
val body = Block(List(printPrefix), Literal(Constant("this is deprecated")))
c.Expr[String](body)
}
diff --git a/test/files/run/macro-declared-in-anonymous/Impls_1.scala b/test/files/run/macro-declared-in-anonymous/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-anonymous/Impls_1.scala
+++ b/test/files/run/macro-declared-in-anonymous/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-block/Impls_1.scala b/test/files/run/macro-declared-in-block/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-block/Impls_1.scala
+++ b/test/files/run/macro-declared-in-block/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-class-class/Impls_1.scala b/test/files/run/macro-declared-in-class-class/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-class-class/Impls_1.scala
+++ b/test/files/run/macro-declared-in-class-class/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-class-object/Impls_1.scala b/test/files/run/macro-declared-in-class-object/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-class-object/Impls_1.scala
+++ b/test/files/run/macro-declared-in-class-object/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-class/Impls_1.scala b/test/files/run/macro-declared-in-class/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-class/Impls_1.scala
+++ b/test/files/run/macro-declared-in-class/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-default-param/Impls_1.scala b/test/files/run/macro-declared-in-default-param/Impls_1.scala
index db1e5c7435..4380f40b04 100644
--- a/test/files/run/macro-declared-in-default-param/Impls_1.scala
+++ b/test/files/run/macro-declared-in-default-param/Impls_1.scala
@@ -4,7 +4,7 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
val body = Block(List(printPrefix), Literal(Constant("it works")))
c.Expr[String](body)
}
diff --git a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala
index 837b306976..4c009cc367 100644
--- a/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala
+++ b/test/files/run/macro-declared-in-implicit-class/Impls_Macros_1.scala
@@ -4,8 +4,8 @@ object Impls {
def toOptionOfInt(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, newTermName("x")), newTermName("toInt")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Ident(definitions.SomeModule), List(Select(Select(prefix.tree, TermName("x")), TermName("toInt")))))
c.Expr[Option[Int]](body)
}
}
diff --git a/test/files/run/macro-declared-in-method/Impls_1.scala b/test/files/run/macro-declared-in-method/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-method/Impls_1.scala
+++ b/test/files/run/macro-declared-in-method/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-object-class/Impls_1.scala b/test/files/run/macro-declared-in-object-class/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-object-class/Impls_1.scala
+++ b/test/files/run/macro-declared-in-object-class/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-object-object/Impls_1.scala b/test/files/run/macro-declared-in-object-object/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-object-object/Impls_1.scala
+++ b/test/files/run/macro-declared-in-object-object/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-object/Impls_1.scala b/test/files/run/macro-declared-in-object/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-object/Impls_1.scala
+++ b/test/files/run/macro-declared-in-object/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-package-object/Impls_1.scala b/test/files/run/macro-declared-in-package-object/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-package-object/Impls_1.scala
+++ b/test/files/run/macro-declared-in-package-object/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-refinement/Impls_1.scala b/test/files/run/macro-declared-in-refinement/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-refinement/Impls_1.scala
+++ b/test/files/run/macro-declared-in-refinement/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-declared-in-trait.check b/test/files/run/macro-declared-in-trait.check
index 104ff1e99b..0d70ac74f3 100644
--- a/test/files/run/macro-declared-in-trait.check
+++ b/test/files/run/macro-declared-in-trait.check
@@ -1,5 +1,5 @@
prefix = Expr[Nothing]({
- final class $anon extends Object with Base {
+ final class $anon extends AnyRef with Base {
def <init>(): anonymous class $anon = {
$anon.super.<init>();
()
diff --git a/test/files/run/macro-declared-in-trait/Impls_1.scala b/test/files/run/macro-declared-in-trait/Impls_1.scala
index 6f06f6d3f0..348f3420f2 100644
--- a/test/files/run/macro-declared-in-trait/Impls_1.scala
+++ b/test/files/run/macro-declared-in-trait/Impls_1.scala
@@ -4,8 +4,8 @@ object Impls {
def foo(c: Ctx) = {
import c.{prefix => prefix}
import c.universe._
- val printPrefix = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("prefix = " + prefix))))
- val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works")))))
+ val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
+ val body = Block(List(printPrefix), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works")))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-def-infer-return-type-b/Test_2.scala b/test/files/run/macro-def-infer-return-type-b/Test_2.scala
index ea0fd4bbff..9e57b90b57 100644
--- a/test/files/run/macro-def-infer-return-type-b/Test_2.scala
+++ b/test/files/run/macro-def-infer-return-type-b/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42))))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-duplicate.check b/test/files/run/macro-duplicate.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/macro-duplicate.check
diff --git a/test/files/run/macro-duplicate.flags b/test/files/run/macro-duplicate.flags
new file mode 100644
index 0000000000..cd66464f2f
--- /dev/null
+++ b/test/files/run/macro-duplicate.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-duplicate/Impls_Macros_1.scala b/test/files/run/macro-duplicate/Impls_Macros_1.scala
new file mode 100644
index 0000000000..de81923330
--- /dev/null
+++ b/test/files/run/macro-duplicate/Impls_Macros_1.scala
@@ -0,0 +1,29 @@
+import scala.reflect.macros.Context
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ val Expr(Block((cdef: ClassDef) :: Nil, _)) = reify { class C { def x = 2 } }
+ val cdef1 =
+ new Transformer {
+ override def transform(tree: Tree): Tree = tree match {
+ case Template(_, _, ctor :: defs) =>
+ val defs1 = defs collect {
+ case ddef @ DefDef(mods, name, tparams, vparamss, tpt, body) =>
+ val future = Select(Select(Select(Ident(newTermName("scala")), newTermName("concurrent")), newTermName("package")), newTermName("future"))
+ val Future = Select(Select(Ident(newTermName("scala")), newTermName("concurrent")), newTypeName("Future"))
+ val tpt1 = if (tpt.isEmpty) tpt else AppliedTypeTree(Future, List(tpt))
+ val body1 = Apply(future, List(body))
+ val name1 = newTermName("async" + name.toString.capitalize)
+ DefDef(mods, name1, tparams, vparamss, tpt1, body1)
+ }
+ Template(Nil, emptyValDef, ctor +: defs ::: defs1)
+ case _ =>
+ super.transform(tree)
+ }
+ } transform cdef
+ c.Expr[Unit](Block(cdef1 :: Nil, Literal(Constant(()))))
+ }
+
+ def foo = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-duplicate/Test_2.scala b/test/files/run/macro-duplicate/Test_2.scala
new file mode 100644
index 0000000000..6dbd4382d3
--- /dev/null
+++ b/test/files/run/macro-duplicate/Test_2.scala
@@ -0,0 +1,6 @@
+import scala.concurrent._
+import ExecutionContext.Implicits.global
+
+object Test extends App {
+ Macros.foo
+} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-argument/Macros_1.scala b/test/files/run/macro-expand-implicit-argument/Macros_1.scala
index d9fd5b8cb0..b2c7b4d6ca 100644
--- a/test/files/run/macro-expand-implicit-argument/Macros_1.scala
+++ b/test/files/run/macro-expand-implicit-argument/Macros_1.scala
@@ -41,14 +41,14 @@ object Macros {
def const(x:Int) = Literal(Constant(x))
val n = as.length
- val arr = newTermName("arr")
+ val arr = TermName("arr")
- val create = Apply(Select(ct.tree, newTermName("newArray")), List(const(n)))
+ val create = Apply(Select(ct.tree, TermName("newArray")), List(const(n)))
val arrtpe = TypeTree(implicitly[c.WeakTypeTag[Array[A]]].tpe)
val valdef = ValDef(Modifiers(), arr, arrtpe, create)
val updates = (0 until n).map {
- i => Apply(Select(Ident(arr), newTermName("update")), List(const(i), as(i).tree))
+ i => Apply(Select(Ident(arr), TermName("update")), List(const(i), as(i).tree))
}
val exprs = (Seq(valdef) ++ updates ++ Seq(Ident(arr))).toList
diff --git a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala
index 082e6b2efe..ac1e55c9b2 100644
--- a/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala
+++ b/test/files/run/macro-expand-implicit-macro-has-implicit/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(x.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(x.tree))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala
index cceb038f05..aa1fc7a358 100644
--- a/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala
+++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = {
import c.universe._
- val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt"))))
+ val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt"))))
c.Expr[Option[Int]](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala
index cceb038f05..aa1fc7a358 100644
--- a/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala
+++ b/test/files/run/macro-expand-implicit-macro-is-view/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[String]): c.Expr[Option[Int]] = {
import c.universe._
- val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, newTermName("toInt"))))
+ val body = Apply(Ident(definitions.SomeModule), List(Select(x.tree, TermName("toInt"))))
c.Expr[Option[Int]](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
index 11e07932c3..4fddc13d68 100644
--- a/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
+++ b/test/files/run/macro-expand-multiple-arglists/Impls_1.scala
@@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = {
import c.universe._
- val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree))
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum))
+ val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-nullary-generic/Impls_1.scala b/test/files/run/macro-expand-nullary-generic/Impls_1.scala
index 1180c83a40..39a9db0e14 100644
--- a/test/files/run/macro-expand-nullary-generic/Impls_1.scala
+++ b/test/files/run/macro-expand-nullary-generic/Impls_1.scala
@@ -4,7 +4,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def impl[T: c.WeakTypeTag](c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]]))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works " + implicitly[c.WeakTypeTag[T]]))))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala
index c6bd1cdbf1..41e50acc86 100644
--- a/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala
+++ b/test/files/run/macro-expand-nullary-nongeneric/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def impl(c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-expand-overload/Impls_1.scala b/test/files/run/macro-expand-overload/Impls_1.scala
index f7c240d9ca..1c672f6040 100644
--- a/test/files/run/macro-expand-overload/Impls_1.scala
+++ b/test/files/run/macro-expand-overload/Impls_1.scala
@@ -4,7 +4,7 @@ object Impls {
def impl(c: Ctx)(tag: String, x: c.Expr[_]) = {
import c.{prefix => prefix}
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-expand-override/Impls_1.scala b/test/files/run/macro-expand-override/Impls_1.scala
index ec93dd4111..69ef57d18d 100644
--- a/test/files/run/macro-expand-override/Impls_1.scala
+++ b/test/files/run/macro-expand-override/Impls_1.scala
@@ -4,7 +4,7 @@ object Impls {
def impl(c: Ctx)(tag: String, x: c.Expr[_]) = {
import c.{prefix => prefix}
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(tag)), Literal(Constant(prefix.toString)), x.tree))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-expand-recursive/Impls_1.scala b/test/files/run/macro-expand-recursive/Impls_1.scala
index 61db5c4a9b..47dd398454 100644
--- a/test/files/run/macro-expand-recursive/Impls_1.scala
+++ b/test/files/run/macro-expand-recursive/Impls_1.scala
@@ -3,13 +3,13 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("it works"))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("it works"))))
c.Expr[Unit](body)
}
def fooFoo(c: Ctx) = {
import c.universe._
- val body = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val body = Select(Ident(TermName("Macros")), TermName("foo"))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
index 72b420d92f..f748ab855f 100644
--- a/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-explicit/Impls_1.scala
@@ -5,7 +5,7 @@ object Impls {
def foo[U: c.WeakTypeTag](c: Ctx) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
index 33770516df..c729aada51 100644
--- a/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-implicit/Impls_1.scala
@@ -5,7 +5,7 @@ object Impls {
def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-optional/Impls_1.scala b/test/files/run/macro-expand-tparams-optional/Impls_1.scala
index 3b829e2e09..ace7a6cd26 100644
--- a/test/files/run/macro-expand-tparams-optional/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-optional/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo[U](c: Ctx) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("don't know U"))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("don't know U"))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala
index 33770516df..c729aada51 100644
--- a/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-a/Impls_1.scala
@@ -5,7 +5,7 @@ object Impls {
def foo[U: c.WeakTypeTag](c: Ctx)(x: c.Expr[U]) = {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(U.toString))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(U.toString))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala
index 9378e67712..8880d13b04 100644
--- a/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-b/Impls_1.scala
@@ -6,7 +6,7 @@ object Impls {
import c.universe._
val T = implicitly[c.WeakTypeTag[T]]
val U = implicitly[c.WeakTypeTag[U]]
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString + " " + U.toString))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString + " " + U.toString))))
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala
index afdd7d4f7a..2df42e969f 100644
--- a/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-c1/Impls_1.scala
@@ -5,9 +5,9 @@ object Impls {
def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
c.Expr(Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(()))))
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala
index 3c2838208a..08817708d4 100644
--- a/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-c2/Impls_Macros_1.scala
@@ -5,9 +5,9 @@ object Impls {
def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
c.Expr(Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(()))))
}
}
diff --git a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala
index afdd7d4f7a..2df42e969f 100644
--- a/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala
+++ b/test/files/run/macro-expand-tparams-prefix-d1/Impls_1.scala
@@ -5,9 +5,9 @@ object Impls {
def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
c.Expr(Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(()))))
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala
index 2ef8f04be9..f6c1d27d54 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(xs: c.Expr[Int]*) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList)
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala
index c832826d64..b844012d53 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-bad/Macros_Test_2.scala
@@ -6,7 +6,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(tpnme.WILDCARD_STAR))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Typed(Apply(Ident(definitions.ListModule), List(Literal(Constant(1)), Literal(Constant(2)))), Ident(tpnme.WILDCARD_STAR))))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala
index 3c7f94f605..363ff0e0aa 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-nonvarargs-good/Impls_1.scala
@@ -7,7 +7,7 @@ object Impls {
case List(Typed(stripped, Ident(wildstar))) if wildstar == tpnme.WILDCARD_STAR => List(stripped)
case _ => ???
}
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), stripped_xs)
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), stripped_xs)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala
index 2066893bdc..0b61ab2f9b 100644
--- a/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-explicit-over-varargs/Impls_1.scala
@@ -7,7 +7,7 @@ object Impls {
def foo(c: Ctx)(xs: c.Expr[Int]*) = {
import c.universe._
- val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList)
+ val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala
index 2ef8f04be9..f6c1d27d54 100644
--- a/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-implicit-over-nonvarargs/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(xs: c.Expr[Int]*) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), xs.map(_.tree).toList)
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), xs.map(_.tree).toList)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala
index 2066893bdc..0b61ab2f9b 100644
--- a/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala
+++ b/test/files/run/macro-expand-varargs-implicit-over-varargs/Impls_1.scala
@@ -7,7 +7,7 @@ object Impls {
def foo(c: Ctx)(xs: c.Expr[Int]*) = {
import c.universe._
- val body = Apply(Select(Ident(newTermName("Impls")), newTermName("myprintln")), xs.map(_.tree).toList)
+ val body = Apply(Select(Ident(TermName("Impls")), TermName("myprintln")), xs.map(_.tree).toList)
c.Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
index 7c40045c0f..95d746980e 100644
--- a/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
+++ b/test/files/run/macro-impl-default-params/Impls_Macros_1.scala
@@ -7,10 +7,10 @@ object Impls {
import c.universe._
val U = implicitly[c.WeakTypeTag[U]]
val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + U.tpe))))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo_targs...")))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("type of prefix tree is: " + prefix.tree.tpe)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("U is: " + U.tpe))))),
Literal(Constant(())))
c.Expr[Unit](body)
}
diff --git a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala
index 56c23f5faf..738c88bbc8 100644
--- a/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala
+++ b/test/files/run/macro-impl-rename-context/Impls_Macros_1.scala
@@ -4,7 +4,7 @@ object Impls {
def foo(unconventionalName: Ctx)(x: unconventionalName.Expr[Int]) = {
import unconventionalName.universe._
val body = Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo..."))))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("invoking foo..."))))),
Literal(Constant(())))
unconventionalName.Expr[Unit](body)
}
diff --git a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala
index 0b9986e9f6..61f0bdfadc 100644
--- a/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala
+++ b/test/files/run/macro-invalidret-doesnt-conform-to-def-rettype/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val tree = Select(Ident(TermName("Macros")), TermName("foo"))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala
index fb0d55208c..869a5a41fa 100644
--- a/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidret-nontypeable/Impls_Macros_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx) = {
import c.universe._
- val body = Ident(newTermName("IDoNotExist"))
+ val body = Ident(TermName("IDoNotExist"))
c.Expr[Int](body)
}
}
diff --git a/test/files/run/macro-invalidret-nontypeable/Test_2.scala b/test/files/run/macro-invalidret-nontypeable/Test_2.scala
index 0daee49a08..7cd474ff52 100644
--- a/test/files/run/macro-invalidret-nontypeable/Test_2.scala
+++ b/test/files/run/macro-invalidret-nontypeable/Test_2.scala
@@ -2,7 +2,7 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val tree = Select(Ident(TermName("Macros")), TermName("foo"))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-invalidusage-badret/Test_2.scala b/test/files/run/macro-invalidusage-badret/Test_2.scala
index 5cb0be5ddd..fc71353f54 100644
--- a/test/files/run/macro-invalidusage-badret/Test_2.scala
+++ b/test/files/run/macro-invalidusage-badret/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Typed(Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42)))), Ident(newTypeName("String")))
+ val tree = Typed(Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42)))), Ident(TypeName("String")))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
index 4583a726cf..8a93161af5 100644
--- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Impls_Macros_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo[T: c.WeakTypeTag](c: Ctx)(x: c.Expr[T]) = {
import c.universe._
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(x.tree.toString))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(x.tree.toString))))
c.Expr[Unit](body)
}
}
diff --git a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala
index e453d0b70c..9a34c62e0f 100644
--- a/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala
+++ b/test/files/run/macro-invalidusage-partialapplication-with-tparams/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Select(Ident(newTermName("Macros")), newTermName("foo"))
+ val tree = Select(Ident(TermName("Macros")), TermName("foo"))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala
index 5866469499..3ac9cd2a8d 100644
--- a/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala
+++ b/test/files/run/macro-invalidusage-partialapplication/Impls_Macros_1.scala
@@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = {
import c.universe._
- val sum = Apply(Select(x.tree, newTermName("$plus")), List(y.tree))
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum))
+ val sum = Apply(Select(x.tree, TermName("$plus")), List(y.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
c.Expr[Unit](body)
}
}
diff --git a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala
index dc48c127f4..75b8c139d4 100644
--- a/test/files/run/macro-invalidusage-partialapplication/Test_2.scala
+++ b/test/files/run/macro-invalidusage-partialapplication/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(40))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(40))))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala
index b863ac048b..50a1782431 100644
--- a/test/files/run/macro-openmacros/Impls_Macros_1.scala
+++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala
@@ -14,7 +14,7 @@ object Macros {
}
import c.universe._
- val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), newTermName("foo"))) else c.literalUnit
+ val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), TermName("foo"))) else c.literalUnit
c.universe.reify {
println(c.literal(normalizePaths(c.enclosingMacros.toString)).splice)
next.splice
diff --git a/test/files/run/macro-range/Common_1.scala b/test/files/run/macro-range/Common_1.scala
index 5c4bc211fc..4083e6126e 100644
--- a/test/files/run/macro-range/Common_1.scala
+++ b/test/files/run/macro-range/Common_1.scala
@@ -43,5 +43,5 @@ abstract class Utils {
LabelDef(lname, Nil, rhs)
}
def makeBinop(left: Tree, op: String, right: Tree): Tree =
- Apply(Select(left, newTermName(op)), List(right))
+ Apply(Select(left, TermName(op)), List(right))
}
diff --git a/test/files/run/macro-range/Expansion_Impossible_2.scala b/test/files/run/macro-range/Expansion_Impossible_2.scala
index 57e0cee97f..ca0db48822 100644
--- a/test/files/run/macro-range/Expansion_Impossible_2.scala
+++ b/test/files/run/macro-range/Expansion_Impossible_2.scala
@@ -16,11 +16,11 @@ object Impls {
// scala"($_this: RangeDefault).foreach($f)"
c.Expr(c.prefix.tree match {
case Apply(Select(New(tpt), initName), List(lo, hi)) if tpt.symbol.fullName == "Range" =>
- val iname = newTermName("$i")
- val hname = newTermName("$h")
+ val iname = TermName("$i")
+ val hname = TermName("$h")
def iref = Ident(iname)
def href = Ident(hname)
- val labelname = newTermName("$while")
+ val labelname = TermName("$while")
val cond = makeBinop(iref, "$less", href)
val body = Block(
List(makeApply(f.tree, List(iref))),
@@ -37,8 +37,8 @@ object Impls {
case _ =>
Apply(
Select(
- Typed(c.prefix.tree, Ident(newTypeName("RangeDefault"))),
- newTermName("foreach")),
+ Typed(c.prefix.tree, Ident(TypeName("RangeDefault"))),
+ TermName("foreach")),
List(f.tree))
})
}
diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala
index fa559334d4..51e0264ed5 100644
--- a/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala
+++ b/test/files/run/macro-reflective-ma-normal-mdmi/Impls_Macros_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
}
diff --git a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala
index 2e64c01e35..267d1bc7b0 100644
--- a/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala
+++ b/test/files/run/macro-reflective-ma-normal-mdmi/Test_2.scala
@@ -2,6 +2,6 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42))))
println(cm.mkToolBox().eval(tree))
}
diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala
index 5d7e077731..4261a6d45d 100644
--- a/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala
+++ b/test/files/run/macro-reflective-mamd-normal-mi/Impls_1.scala
@@ -3,7 +3,7 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
} \ No newline at end of file
diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
index 70560009b1..13cd953bde 100644
--- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
+++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala
@@ -8,12 +8,12 @@ object Test extends App {
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val macrobody = Select(Ident(newTermName("Impls")), newTermName("foo"))
- val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree)
- val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody)
+ val macrobody = Select(Ident(TermName("Impls")), TermName("foo"))
+ val macroparam = ValDef(NoMods, TermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree)
+ val macrodef = DefDef(Modifiers(MACRO), TermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody)
val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(()))))
- val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef)))
- val macroapp = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42))))
+ val module = ModuleDef(NoMods, TermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef)))
+ val macroapp = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42))))
val tree = Block(List(macrodef, module), macroapp)
val toolbox = cm.mkToolBox(options = "-language:experimental.macros")
println(toolbox.eval(tree))
diff --git a/test/files/run/macro-reify-freevars/Test_2.scala b/test/files/run/macro-reify-freevars/Test_2.scala
index 7af9d89bdb..c2d0118e17 100644
--- a/test/files/run/macro-reify-freevars/Test_2.scala
+++ b/test/files/run/macro-reify-freevars/Test_2.scala
@@ -2,10 +2,10 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val q = New(AppliedTypeTree(Select(Select(Select(Ident(newTermName("scala")), newTermName("collection")), newTermName("slick")), newTypeName("Queryable")), List(Ident(newTermName("Int")))))
- val x = ValDef(NoMods, newTermName("x"), Ident(newTermName("Int")), EmptyTree)
- val fn = Function(List(x), Apply(Select(Ident(newTermName("x")), newTermName("$plus")), List(Literal(Constant("5")))))
- val tree = Apply(Select(q, newTermName("map")), List(fn))
+ val q = New(AppliedTypeTree(Select(Select(Select(Ident(TermName("scala")), TermName("collection")), TermName("slick")), TypeName("Queryable")), List(Ident(TermName("Int")))))
+ val x = ValDef(NoMods, TermName("x"), Ident(TermName("Int")), EmptyTree)
+ val fn = Function(List(x), Apply(Select(Ident(TermName("x")), TermName("$plus")), List(Literal(Constant("5")))))
+ val tree = Apply(Select(q, TermName("map")), List(fn))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
} \ No newline at end of file
diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
index b4351c2c53..bb6a45e11e 100644
--- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
@@ -28,7 +28,7 @@ object QueryableMacros{
val foo = c.Expr[ru.Expr[Queryable[S]]](
c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck(
Utils[c.type](c).removeDoubleReify(
- Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree ))
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
).asInstanceOf[Tree]
)))
c.universe.reify{ Queryable.factory[S]( foo.splice )}
diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
index b4351c2c53..bb6a45e11e 100644
--- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
@@ -28,7 +28,7 @@ object QueryableMacros{
val foo = c.Expr[ru.Expr[Queryable[S]]](
c.reifyTree( mkRuntimeUniverseRef, EmptyTree, c.typeCheck(
Utils[c.type](c).removeDoubleReify(
- Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree ))
+ Apply(Select(c.prefix.tree, TermName( name )), List( projection.tree ))
).asInstanceOf[Tree]
)))
c.universe.reify{ Queryable.factory[S]( foo.splice )}
diff --git a/test/files/run/macro-reify-splice-outside-reify/Test_2.scala b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala
index 54bd03fcd2..dbc17e7c15 100644
--- a/test/files/run/macro-reify-splice-outside-reify/Test_2.scala
+++ b/test/files/run/macro-reify-splice-outside-reify/Test_2.scala
@@ -2,7 +2,7 @@ object Test extends App {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
- val tree = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant(42))))
+ val tree = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant(42))))
try println(cm.mkToolBox().eval(tree))
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-reify-tagless-a/Test_2.scala b/test/files/run/macro-reify-tagless-a/Test_2.scala
index 584c4bdf5b..afb418a755 100644
--- a/test/files/run/macro-reify-tagless-a/Test_2.scala
+++ b/test/files/run/macro-reify-tagless-a/Test_2.scala
@@ -6,9 +6,9 @@ object Test extends App {
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass)))
- val rhs = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant("hello world"))))
- val list = ValDef(NoMods, newTermName("list"), tpt, rhs)
- val tree = Block(List(list), Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name))))
+ val rhs = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant("hello world"))))
+ val list = ValDef(NoMods, TermName("list"), tpt, rhs)
+ val tree = Block(List(list), Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Ident(list.name))))
try cm.mkToolBox().eval(tree)
catch { case ex: Throwable => println(ex.getMessage) }
}
diff --git a/test/files/run/macro-reify-type/Macros_1.scala b/test/files/run/macro-reify-type/Macros_1.scala
index 06de05735d..c4d1d9f8ad 100644
--- a/test/files/run/macro-reify-type/Macros_1.scala
+++ b/test/files/run/macro-reify-type/Macros_1.scala
@@ -8,7 +8,7 @@ object StaticReflect {
import c.universe._
val nameName: TermName = name.tree match {
- case Literal(Constant(str: String)) => newTermName(str)
+ case Literal(Constant(str: String)) => TermName(str)
case _ => c.error(c.enclosingPosition, s"Method name not constant.") ; return reify(ru.NoType)
}
val clazz = weakTypeOf[A]
@@ -17,8 +17,8 @@ object StaticReflect {
case NoSymbol => c.error(c.enclosingPosition, s"No member called $nameName in $clazz.") ; reify(ru.NoType)
case member =>
val mtpe = member typeSignatureIn clazz
- val mtag = c.reifyType(treeBuild.mkRuntimeUniverseRef, Select(treeBuild.mkRuntimeUniverseRef, newTermName("rootMirror")), mtpe)
- val mtree = Select(mtag, newTermName("tpe"))
+ val mtag = c.reifyType(treeBuild.mkRuntimeUniverseRef, Select(treeBuild.mkRuntimeUniverseRef, TermName("rootMirror")), mtpe)
+ val mtree = Select(mtag, TermName("tpe"))
c.Expr[ru.Type](mtree)
}
diff --git a/test/files/run/macro-reify-type/Test_2.scala b/test/files/run/macro-reify-type/Test_2.scala
index 9beaf98681..1f35973531 100644
--- a/test/files/run/macro-reify-type/Test_2.scala
+++ b/test/files/run/macro-reify-type/Test_2.scala
@@ -7,10 +7,10 @@ object Test extends App {
//val $m: $u.Mirror = scala.reflect.runtime.universe.rootMirror;
//import $u._, $m._, Flag._
//val tpe = {
- // val symdef$B2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTypeName("B"), NoPosition, DEFERRED | PARAM, false);
- // val symdef$That2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTypeName("That"), NoPosition, DEFERRED | PARAM, false);
- // val symdef$f2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTermName("f"), NoPosition, PARAM, false);
- // val symdef$bf2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), newTermName("bf"), NoPosition, IMPLICIT | PARAM, false);
+ // val symdef$B2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TypeName("B"), NoPosition, DEFERRED | PARAM, false);
+ // val symdef$That2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TypeName("That"), NoPosition, DEFERRED | PARAM, false);
+ // val symdef$f2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TermName("f"), NoPosition, PARAM, false);
+ // val symdef$bf2 = build.newNestedSymbol(build.selectTerm(staticClass("scala.collection.TraversableLike"), "map"), TermName("bf"), NoPosition, IMPLICIT | PARAM, false);
// build.setTypeSignature(symdef$B2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor));
// build.setTypeSignature(symdef$That2, TypeBounds(staticClass("scala.Nothing").asType.toTypeConstructor, staticClass("scala.Any").asType.toTypeConstructor));
// build.setTypeSignature(symdef$f2, TypeRef(ThisType(staticPackage("scala").asModule.moduleClass), staticClass("scala.Function1"), List(staticClass("scala.Int").asType.toTypeConstructor, TypeRef(NoPrefix, symdef$B2, List()))));
diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala
index 9f04c13014..25ed352cca 100644
--- a/test/files/run/macro-reify-unreify/Macros_1.scala
+++ b/test/files/run/macro-reify-unreify/Macros_1.scala
@@ -9,7 +9,7 @@ object Macros {
import treeBuild._
val world = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, s.tree)
- val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world)))))
+ val greeting = c.reifyTree(mkRuntimeUniverseRef, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), TermName("$plus")), List(c.unreifyTree(world)))))
val typedGreeting = c.Expr[String](greeting)
c.universe.reify {
diff --git a/test/files/run/macro-repl-basic.check b/test/files/run/macro-repl-basic.check
index 7deed4a878..5323f429da 100644
--- a/test/files/run/macro-repl-basic.check
+++ b/test/files/run/macro-repl-basic.check
@@ -14,19 +14,19 @@ scala>
scala> object Impls {
def foo(c: Ctx)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
def bar(c: Ctx)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
c.Expr[Int](body)
}
def quux(c: Ctx)(x: c.Expr[Int]) = {
import c.universe._
- val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
c.Expr[Int](body)
}
}
diff --git a/test/files/run/macro-repl-basic.scala b/test/files/run/macro-repl-basic.scala
index eae1febb3a..3c22c13dc7 100644
--- a/test/files/run/macro-repl-basic.scala
+++ b/test/files/run/macro-repl-basic.scala
@@ -8,19 +8,19 @@ object Test extends ReplTest {
|object Impls {
| def foo(c: Ctx)(x: c.Expr[Int]) = {
| import c.universe._
- | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(1))))
+ | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
| c.Expr[Int](body)
| }
|
| def bar(c: Ctx)(x: c.Expr[Int]) = {
| import c.universe._
- | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(2))))
+ | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(2))))
| c.Expr[Int](body)
| }
|
| def quux(c: Ctx)(x: c.Expr[Int]) = {
| import c.universe._
- | val body = Apply(Select(x.tree, newTermName("$plus")), List(Literal(Constant(3))))
+ | val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(3))))
| c.Expr[Int](body)
| }
|}
diff --git a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
index 633cb930fc..dbeb7efbc0 100644
--- a/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-implicitsdisabled/Impls_Macros_1.scala
@@ -4,7 +4,7 @@ object Macros {
def impl_with_implicits_enabled(c: Context) = {
import c.universe._
- val tree1 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2))))
+ val tree1 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
val ttree1 = c.typeCheck(tree1, withImplicitViewsDisabled = false)
c.literal(ttree1.toString)
}
@@ -15,7 +15,7 @@ object Macros {
import c.universe._
try {
- val tree2 = Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2))))
+ val tree2 = Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
val ttree2 = c.typeCheck(tree2, withImplicitViewsDisabled = true)
c.literal(ttree2.toString)
} catch {
diff --git a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
index f693ad78cc..ff535fea8d 100644
--- a/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled/Impls_Macros_1.scala
@@ -4,8 +4,8 @@ object Macros {
def impl_with_macros_enabled(c: Context) = {
import c.universe._
- val ru = Select(Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("package")), newTermName("universe"))
- val tree1 = Apply(Select(ru, newTermName("reify")), List(Literal(Constant(2))))
+ val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe"))
+ val tree1 = Apply(Select(ru, TermName("reify")), List(Literal(Constant(2))))
val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false)
c.literal(ttree1.toString)
}
@@ -21,7 +21,7 @@ object Macros {
val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
build.setTypeSignature(ru, rutpe)
- val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2))))
+ val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
c.literal(ttree2.toString)
}
diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check
index 7bdd1d6a3a..b958a95552 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2.check
+++ b/test/files/run/macro-typecheck-macrosdisabled2.check
@@ -10,7 +10,7 @@
def apply[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.TermName.apply("Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
}
};
new $treecreator1()
diff --git a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
index 1dbf5a1a87..a96e0c53b6 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
+++ b/test/files/run/macro-typecheck-macrosdisabled2/Impls_Macros_1.scala
@@ -4,8 +4,8 @@ object Macros {
def impl_with_macros_enabled(c: Context) = {
import c.universe._
- val ru = Select(Select(Select(Select(Ident(newTermName("scala")), newTermName("reflect")), newTermName("runtime")), newTermName("package")), newTermName("universe"))
- val tree1 = Apply(Select(ru, newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
+ val ru = Select(Select(Select(Select(Ident(TermName("scala")), TermName("reflect")), TermName("runtime")), TermName("package")), TermName("universe"))
+ val tree1 = Apply(Select(ru, TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
val ttree1 = c.typeCheck(tree1, withMacrosDisabled = false)
c.literal(ttree1.toString)
}
@@ -21,7 +21,7 @@ object Macros {
val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
build.setTypeSignature(ru, rutpe)
- val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
+ val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
val ttree2 = c.typeCheck(tree2, withMacrosDisabled = true)
c.literal(ttree2.toString)
}
diff --git a/test/files/run/patmat_unapp_abstype-old.check b/test/files/run/patmat_unapp_abstype-old.check
deleted file mode 100644
index 72239d16cd..0000000000
--- a/test/files/run/patmat_unapp_abstype-old.check
+++ /dev/null
@@ -1,4 +0,0 @@
-TypeRef
-none of the above
-Bar
-Foo
diff --git a/test/files/run/patmat_unapp_abstype-old.flags b/test/files/run/patmat_unapp_abstype-old.flags
deleted file mode 100644
index ba80cad69b..0000000000
--- a/test/files/run/patmat_unapp_abstype-old.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xoldpatmat
diff --git a/test/files/run/patmat_unapp_abstype-old.scala b/test/files/run/patmat_unapp_abstype-old.scala
deleted file mode 100644
index 45496f08a2..0000000000
--- a/test/files/run/patmat_unapp_abstype-old.scala
+++ /dev/null
@@ -1,83 +0,0 @@
-// abstract types and extractors, oh my!
-trait TypesAPI {
- trait Type
-
- // an alternative fix (implemented in the virtual pattern matcher, is to replace the isInstanceOf by a manifest-based run-time test)
- // that's what typeRefMani is for
- type TypeRef <: Type //; implicit def typeRefMani: Manifest[TypeRef]
- val TypeRef: TypeRefExtractor; trait TypeRefExtractor {
- def apply(x: Int): TypeRef
- def unapply(x: TypeRef): Option[(Int)]
- }
-
- // just for illustration, should follow the same pattern as TypeRef
- case class MethodType(n: Int) extends Type
-}
-
-// user should not be exposed to the implementation
-trait TypesUser extends TypesAPI {
- def shouldNotCrash(tp: Type): Unit = {
- tp match {
- case TypeRef(x) => println("TypeRef")
- // the above checks tp.isInstanceOf[TypeRef], which is erased to tp.isInstanceOf[Type]
- // before calling TypeRef.unapply(tp), which will then crash unless tp.isInstanceOf[TypesImpl#TypeRef] (which is not implied by tp.isInstanceOf[Type])
- // tp.isInstanceOf[TypesImpl#TypeRef] is equivalent to classOf[TypesImpl#TypeRef].isAssignableFrom(tp.getClass)
- // this is equivalent to manifest
- // it is NOT equivalent to manifest[Type] <:< typeRefMani
- case MethodType(x) => println("MethodType")
- case _ => println("none of the above")
- }
- }
-}
-
-trait TypesImpl extends TypesAPI {
- object TypeRef extends TypeRefExtractor // this will have a bridged unapply(x: Type) = unapply(x.asInstanceOf[TypeRef])
- case class TypeRef(n: Int) extends Type // this has a bridge from TypesAPI#Type to TypesImpl#TypeRef
- // --> the cast in the bridge will fail because the pattern matcher can't type test against the abstract types in TypesUser
- //lazy val typeRefMani = manifest[TypeRef]
-}
-
-trait Foos {
- trait Bar
- type Foo <: Bar
- trait FooExtractor {
- def unapply(foo: Foo): Option[Int]
- }
- val Foo: FooExtractor
-}
-
-trait RealFoos extends Foos {
- class Foo(val x: Int) extends Bar
- object Foo extends FooExtractor {
- def unapply(foo: Foo): Option[Int] = Some(foo.x)
- }
-}
-
-trait Intermed extends Foos {
- def crash(bar: Bar): Unit =
- bar match {
- case Foo(x) => println("Foo")
- case _ => println("Bar")
- }
-}
-
-object TestUnappStaticallyKnownSynthetic extends TypesImpl with TypesUser {
- def test() = {
- shouldNotCrash(TypeRef(10)) // should and does print "TypeRef"
- // once #1697/#2337 are fixed, this should generate the correct output
- shouldNotCrash(MethodType(10)) // should print "MethodType" but prints "none of the above" -- good one, pattern matcher!
- }
-}
-
-object TestUnappDynamicSynth extends RealFoos with Intermed {
- case class FooToo(n: Int) extends Bar
- def test() = {
- crash(FooToo(10))
- crash(new Foo(5))
- }
-}
-
-object Test extends App {
- TestUnappStaticallyKnownSynthetic.test()
- TestUnappDynamicSynth.test()
-}
diff --git a/test/files/run/reflection-allmirrors-tostring.scala b/test/files/run/reflection-allmirrors-tostring.scala
index 73afff291c..0ca387a6b1 100644
--- a/test/files/run/reflection-allmirrors-tostring.scala
+++ b/test/files/run/reflection-allmirrors-tostring.scala
@@ -26,18 +26,18 @@ object Test extends App {
println(cm.reflect(new C))
val im = cm.reflect(new C)
- println(im.reflectField(typeOf[C].member(newTermName("f1")).asTerm))
- println(im.reflectField(typeOf[C].member(newTermName("f2")).asTerm))
- println(im.reflectMethod(typeOf[C].member(newTermName("m1")).asMethod))
- println(im.reflectMethod(typeOf[C].member(newTermName("m2")).asMethod))
- println(im.reflectMethod(typeOf[C].member(newTermName("m3")).asMethod))
- println(im.reflectMethod(typeOf[C].member(newTermName("m4")).asMethod))
- println(im.reflectMethod(typeOf[C].member(newTermName("m5")).asMethod))
- println(im.reflectClass(typeOf[C].member(newTypeName("C")).asClass))
- println(im.reflectModule(typeOf[C].member(newTermName("M")).asModule))
+ println(im.reflectField(typeOf[C].member(TermName("f1")).asTerm))
+ println(im.reflectField(typeOf[C].member(TermName("f2")).asTerm))
+ println(im.reflectMethod(typeOf[C].member(TermName("m1")).asMethod))
+ println(im.reflectMethod(typeOf[C].member(TermName("m2")).asMethod))
+ println(im.reflectMethod(typeOf[C].member(TermName("m3")).asMethod))
+ println(im.reflectMethod(typeOf[C].member(TermName("m4")).asMethod))
+ println(im.reflectMethod(typeOf[C].member(TermName("m5")).asMethod))
+ println(im.reflectClass(typeOf[C].member(TypeName("C")).asClass))
+ println(im.reflectModule(typeOf[C].member(TermName("M")).asModule))
val c = cm.staticClass("C")
- val cc = typeOf[C].member(newTypeName("C")).asClass
+ val cc = typeOf[C].member(TypeName("C")).asClass
println(cm.reflectClass(c).reflectConstructor(c.typeSignature.member(nme.CONSTRUCTOR).asMethod))
println(im.reflectClass(cc).reflectConstructor(cc.typeSignature.member(nme.CONSTRUCTOR).asMethod))
} \ No newline at end of file
diff --git a/test/files/run/reflection-enclosed-basic.scala b/test/files/run/reflection-enclosed-basic.scala
index 1dcb6c2a27..7b9e0c20dc 100644
--- a/test/files/run/reflection-enclosed-basic.scala
+++ b/test/files/run/reflection-enclosed-basic.scala
@@ -12,7 +12,7 @@ private object B6 extends B2 { override def toString = "B6"; override def foo =
object Test extends App {
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
@@ -20,7 +20,7 @@ object Test extends App {
def testNestedClass(name: String) = {
val sym = cm.staticClass(name)
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
diff --git a/test/files/run/reflection-enclosed-inner-basic.scala b/test/files/run/reflection-enclosed-inner-basic.scala
index 2b2c701993..c1cf9bc336 100644
--- a/test/files/run/reflection-enclosed-inner-basic.scala
+++ b/test/files/run/reflection-enclosed-inner-basic.scala
@@ -18,15 +18,15 @@ object Test extends App {
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testInnerClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.typeSignature.declaration(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflect(new B).reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -37,7 +37,7 @@ object Test extends App {
testInnerClass("B2")
def testInnerModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.typeSignature.declaration(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflect(new B).reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-enclosed-inner-inner-basic.scala b/test/files/run/reflection-enclosed-inner-inner-basic.scala
index 1b9e19d37d..8a73fac522 100644
--- a/test/files/run/reflection-enclosed-inner-inner-basic.scala
+++ b/test/files/run/reflection-enclosed-inner-inner-basic.scala
@@ -20,15 +20,15 @@ object Test extends App {
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testInnerClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.typeSignature.declaration(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod
val outer1 = new B
val outer2 = new outer1.BB
val ctorMirror = cm.reflect(outer2).reflectClass(sym).reflectConstructor(ctor)
@@ -41,7 +41,7 @@ object Test extends App {
testInnerClass("B2")
def testInnerModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.typeSignature.declaration(TermName(name)).asModule
println(sym)
val outer1 = new B
val outer2 = new outer1.BB
diff --git a/test/files/run/reflection-enclosed-inner-nested-basic.scala b/test/files/run/reflection-enclosed-inner-nested-basic.scala
index 2800ee2548..6c2fc6df7a 100644
--- a/test/files/run/reflection-enclosed-inner-nested-basic.scala
+++ b/test/files/run/reflection-enclosed-inner-nested-basic.scala
@@ -21,15 +21,15 @@ object Test extends App {
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testNestedClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.typeSignature.declaration(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflect(outer1.BB).reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -40,7 +40,7 @@ object Test extends App {
testNestedClass("B2")
def testNestedModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.typeSignature.declaration(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflect(outer1.BB).reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-enclosed-nested-basic.scala b/test/files/run/reflection-enclosed-nested-basic.scala
index 8b740c2da2..180ac4ebee 100644
--- a/test/files/run/reflection-enclosed-nested-basic.scala
+++ b/test/files/run/reflection-enclosed-nested-basic.scala
@@ -18,15 +18,15 @@ object Test extends App {
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testNestedClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.typeSignature.declaration(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -37,7 +37,7 @@ object Test extends App {
testNestedClass("B2")
def testNestedModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.typeSignature.declaration(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-enclosed-nested-inner-basic.scala b/test/files/run/reflection-enclosed-nested-inner-basic.scala
index 7466733d37..2558b8035a 100644
--- a/test/files/run/reflection-enclosed-nested-inner-basic.scala
+++ b/test/files/run/reflection-enclosed-nested-inner-basic.scala
@@ -20,15 +20,15 @@ object Test extends App {
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testInnerClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.typeSignature.declaration(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflect(new B.BB).reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -39,7 +39,7 @@ object Test extends App {
testInnerClass("B2")
def testInnerModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.typeSignature.declaration(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflect(new B.BB).reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-enclosed-nested-nested-basic.scala b/test/files/run/reflection-enclosed-nested-nested-basic.scala
index 8335ea482a..b4711c9a8c 100644
--- a/test/files/run/reflection-enclosed-nested-nested-basic.scala
+++ b/test/files/run/reflection-enclosed-nested-nested-basic.scala
@@ -20,15 +20,15 @@ object Test extends App {
def testMethodInvocation(instance: Any) = {
val instanceMirror = cm.reflect(instance)
- val method = instanceMirror.symbol.typeSignature.declaration(newTermName("foo")).asMethod
+ val method = instanceMirror.symbol.typeSignature.declaration(TermName("foo")).asMethod
val methodMirror = instanceMirror.reflectMethod(method)
println(methodMirror())
}
def testNestedClass(name: String) = {
- val sym = b.typeSignature.declaration(newTypeName(name)).asClass
+ val sym = b.typeSignature.declaration(TypeName(name)).asClass
println(sym)
- val ctor = sym.typeSignature.declaration(newTermName("<init>")).asMethod
+ val ctor = sym.typeSignature.declaration(nme.CONSTRUCTOR).asMethod
val ctorMirror = cm.reflectClass(sym).reflectConstructor(ctor)
val instance = ctorMirror()
println(instance)
@@ -39,7 +39,7 @@ object Test extends App {
testNestedClass("B2")
def testNestedModule(name: String) = {
- val sym = b.typeSignature.declaration(newTermName(name)).asModule
+ val sym = b.typeSignature.declaration(TermName(name)).asModule
println(sym)
val moduleMirror = cm.reflectModule(sym)
val instance = moduleMirror.instance
diff --git a/test/files/run/reflection-equality.check b/test/files/run/reflection-equality.check
index 17c1f6dd70..b3b66f48d6 100644
--- a/test/files/run/reflection-equality.check
+++ b/test/files/run/reflection-equality.check
@@ -24,12 +24,12 @@ cs: reflect.runtime.universe.ClassSymbol = class X
scala> val ts: Type = cs.typeSignature
ts: reflect.runtime.universe.Type =
-java.lang.Object {
+scala.AnyRef {
def <init>(): X
def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int
}
-scala> val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod
+scala> val ms: MethodSymbol = ts.declaration(TermName("methodIntIntInt")).asMethod
ms: reflect.runtime.universe.MethodSymbol = method methodIntIntInt
scala> val MethodType( _, t1 ) = ms.typeSignature
diff --git a/test/files/run/reflection-equality.scala b/test/files/run/reflection-equality.scala
index 8fc82721e7..40f116bb53 100644
--- a/test/files/run/reflection-equality.scala
+++ b/test/files/run/reflection-equality.scala
@@ -11,7 +11,7 @@ object Test extends ReplTest {
|def im: InstanceMirror = cm.reflect(new X)
|val cs: ClassSymbol = im.symbol
|val ts: Type = cs.typeSignature
- |val ms: MethodSymbol = ts.declaration(newTermName("methodIntIntInt")).asMethod
+ |val ms: MethodSymbol = ts.declaration(TermName("methodIntIntInt")).asMethod
|val MethodType( _, t1 ) = ms.typeSignature
|val t2 = typeOf[scala.Int]
|t1 == t2
diff --git a/test/files/run/reflection-fieldmirror-accessorsareokay.scala b/test/files/run/reflection-fieldmirror-accessorsareokay.scala
index 16354025f3..3926ab7835 100644
--- a/test/files/run/reflection-fieldmirror-accessorsareokay.scala
+++ b/test/files/run/reflection-fieldmirror-accessorsareokay.scala
@@ -24,6 +24,6 @@ object Test extends App {
}
}
- test(cs.typeSignature.declaration(newTermName("x")).asTerm)
- test(cs.typeSignature.declaration(newTermName("x_$eq")).asTerm)
+ test(cs.typeSignature.declaration(TermName("x")).asTerm)
+ test(cs.typeSignature.declaration(TermName("x_$eq")).asTerm)
}
diff --git a/test/files/run/reflection-fieldmirror-ctorparam.scala b/test/files/run/reflection-fieldmirror-ctorparam.scala
index b9d50fe97b..608adad27b 100644
--- a/test/files/run/reflection-fieldmirror-ctorparam.scala
+++ b/test/files/run/reflection-fieldmirror-ctorparam.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x")).asTerm
+ val f = cs.typeSignature.declaration(TermName("x")).asTerm
try {
val fm: FieldMirror = im.reflectField(f)
println(fm.get)
diff --git a/test/files/run/reflection-fieldmirror-getsetval.scala b/test/files/run/reflection-fieldmirror-getsetval.scala
index 67c54d9708..9cacb7080b 100644
--- a/test/files/run/reflection-fieldmirror-getsetval.scala
+++ b/test/files/run/reflection-fieldmirror-getsetval.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
+ val f = cs.typeSignature.declaration(TermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
val fm: FieldMirror = im.reflectField(f)
try {
println(fm.get)
diff --git a/test/files/run/reflection-fieldmirror-getsetvar.scala b/test/files/run/reflection-fieldmirror-getsetvar.scala
index abcf396dd1..52c13a73bb 100644
--- a/test/files/run/reflection-fieldmirror-getsetvar.scala
+++ b/test/files/run/reflection-fieldmirror-getsetvar.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
+ val f = cs.typeSignature.declaration(TermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
val fm: FieldMirror = im.reflectField(f)
println(fm.get)
fm.set(2)
diff --git a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
index 2b4a9bb55e..e070cdcfa3 100644
--- a/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
+++ b/test/files/run/reflection-fieldmirror-nmelocalsuffixstring.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
+ val f = cs.typeSignature.declaration(TermName("x" + nme.LOCAL_SUFFIX_STRING)).asTerm
val fm: FieldMirror = im.reflectField(f)
println(fm.symbol.isVar)
}
diff --git a/test/files/run/reflection-fieldmirror-privatethis.scala b/test/files/run/reflection-fieldmirror-privatethis.scala
index ab838dbb1b..89948772b1 100644
--- a/test/files/run/reflection-fieldmirror-privatethis.scala
+++ b/test/files/run/reflection-fieldmirror-privatethis.scala
@@ -10,7 +10,7 @@ object Test extends App {
val im: InstanceMirror = cm.reflect(a)
val cs = im.symbol
- val f = cs.typeSignature.declaration(newTermName("x")).asTerm
+ val f = cs.typeSignature.declaration(TermName("x")).asTerm
val fm: FieldMirror = im.reflectField(f)
println(fm.symbol.isVar)
println(fm.get)
diff --git a/test/files/run/reflection-fieldsymbol-navigation.scala b/test/files/run/reflection-fieldsymbol-navigation.scala
index 4448724988..33dc18a7e3 100644
--- a/test/files/run/reflection-fieldsymbol-navigation.scala
+++ b/test/files/run/reflection-fieldsymbol-navigation.scala
@@ -5,7 +5,7 @@ class C {
}
object Test extends App {
- val x = typeOf[C].member(newTermName("x")).asTerm
+ val x = typeOf[C].member(TermName("x")).asTerm
println(x)
println(x.isVar)
println(x.accessed)
diff --git a/test/files/run/reflection-implClass.scala b/test/files/run/reflection-implClass.scala
index b3c0081ccf..db211fd9a8 100644
--- a/test/files/run/reflection-implClass.scala
+++ b/test/files/run/reflection-implClass.scala
@@ -10,19 +10,19 @@ object Test extends App with Outer {
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
- assert(cm.classSymbol(classTag[Foo].runtimeClass).typeSignature.declaration(newTermName("bar")).typeSignature ==
- cm.classSymbol(classTag[Bar].runtimeClass).typeSignature.declaration(newTermName("foo")).typeSignature)
+ assert(cm.classSymbol(classTag[Foo].runtimeClass).typeSignature.declaration(TermName("bar")).typeSignature ==
+ cm.classSymbol(classTag[Bar].runtimeClass).typeSignature.declaration(TermName("foo")).typeSignature)
val s1 = implClass(classTag[Foo].runtimeClass)
assert(s1 != NoSymbol)
assert(s1.typeSignature != NoType)
assert(s1.companionSymbol.typeSignature != NoType)
- assert(s1.companionSymbol.typeSignature.declaration(newTermName("bar")) != NoSymbol)
+ assert(s1.companionSymbol.typeSignature.declaration(TermName("bar")) != NoSymbol)
val s2 = implClass(classTag[Bar].runtimeClass)
assert(s2 != NoSymbol)
assert(s2.typeSignature != NoType)
assert(s2.companionSymbol.typeSignature != NoType)
- assert(s2.companionSymbol.typeSignature.declaration(newTermName("foo")) != NoSymbol)
+ assert(s2.companionSymbol.typeSignature.declaration(TermName("foo")) != NoSymbol)
def implClass(clazz: Class[_]) = {
val implClass = Class.forName(clazz.getName + "$class")
cm.classSymbol(implClass)
diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala
index 5f39370708..ff3992709f 100644
--- a/test/files/run/reflection-magicsymbols-invoke.scala
+++ b/test/files/run/reflection-magicsymbols-invoke.scala
@@ -28,7 +28,7 @@ object Test extends App {
val ctor = tpe.declaration(nme.CONSTRUCTOR).asMethod
cm.reflectClass(ctor.owner.asClass).reflectConstructor(ctor)(args: _*)
} else {
- val meth = tpe.declaration(newTermName(method).encodedName.toTermName).asMethod
+ val meth = tpe.declaration(TermName(method).encodedName.toTermName).asMethod
cm.reflect(receiver).reflectMethod(meth)(args: _*)
}
})
@@ -54,7 +54,7 @@ object Test extends App {
println("it's important to print the list of AnyVal's members")
println("if some of them change (possibly, adding and/or removing magic symbols), we must update this test")
typeOf[AnyVal].declarations.toList.sortBy(key).foreach(sym => println(key(sym)))
- test(typeOf[AnyVal], null, "<init>")
+ test(typeOf[AnyVal], null, nme.CONSTRUCTOR.toString)
test(typeOf[AnyVal], 2, "getClass")
println("============\nAnyRef")
diff --git a/test/files/run/reflection-magicsymbols-repl.check b/test/files/run/reflection-magicsymbols-repl.check
index d3cd26f25f..85a1f63f01 100644
--- a/test/files/run/reflection-magicsymbols-repl.check
+++ b/test/files/run/reflection-magicsymbols-repl.check
@@ -19,7 +19,7 @@ scala> class A {
defined class A
scala> def test(n: Int): Unit = {
- val sig = typeOf[A] member newTermName("foo" + n) typeSignature
+ val sig = typeOf[A] member TermName("foo" + n) typeSignature
val x = sig.asInstanceOf[MethodType].params.head
println(x.typeSignature)
}
diff --git a/test/files/run/reflection-magicsymbols-repl.scala b/test/files/run/reflection-magicsymbols-repl.scala
index 26127b8661..6a432c2664 100644
--- a/test/files/run/reflection-magicsymbols-repl.scala
+++ b/test/files/run/reflection-magicsymbols-repl.scala
@@ -14,7 +14,7 @@ object Test extends ReplTest {
| def foo8(x: Singleton) = ???
|}
|def test(n: Int): Unit = {
- | val sig = typeOf[A] member newTermName("foo" + n) typeSignature
+ | val sig = typeOf[A] member TermName("foo" + n) typeSignature
| val x = sig.asInstanceOf[MethodType].params.head
| println(x.typeSignature)
|}
diff --git a/test/files/run/reflection-magicsymbols-vanilla.scala b/test/files/run/reflection-magicsymbols-vanilla.scala
index 32819dcc46..26b70460eb 100644
--- a/test/files/run/reflection-magicsymbols-vanilla.scala
+++ b/test/files/run/reflection-magicsymbols-vanilla.scala
@@ -12,7 +12,7 @@ class A {
object Test extends App {
import scala.reflect.runtime.universe._
def test(n: Int): Unit = {
- val sig = typeOf[A] member newTermName("foo" + n) typeSignature
+ val sig = typeOf[A] member TermName("foo" + n) typeSignature
val x = sig.asInstanceOf[MethodType].params.head
println(x.typeSignature)
}
diff --git a/test/files/run/reflection-methodsymbol-params.scala b/test/files/run/reflection-methodsymbol-params.scala
index 45b1f9628f..baad8d6b9b 100644
--- a/test/files/run/reflection-methodsymbol-params.scala
+++ b/test/files/run/reflection-methodsymbol-params.scala
@@ -13,12 +13,12 @@ class C {
}
object Test extends App {
- println(typeOf[C].member(newTermName("x1")).asMethod.paramss)
- println(typeOf[C].member(newTermName("x2")).asMethod.paramss)
- println(typeOf[C].member(newTermName("x3")).asMethod.paramss)
- println(typeOf[C].member(newTermName("x4")).asMethod.paramss)
- println(typeOf[C].member(newTermName("y1")).asMethod.paramss)
- println(typeOf[C].member(newTermName("y2")).asMethod.paramss)
- println(typeOf[C].member(newTermName("y3")).asMethod.paramss)
- println(typeOf[C].member(newTermName("y4")).asMethod.paramss)
+ println(typeOf[C].member(TermName("x1")).asMethod.paramss)
+ println(typeOf[C].member(TermName("x2")).asMethod.paramss)
+ println(typeOf[C].member(TermName("x3")).asMethod.paramss)
+ println(typeOf[C].member(TermName("x4")).asMethod.paramss)
+ println(typeOf[C].member(TermName("y1")).asMethod.paramss)
+ println(typeOf[C].member(TermName("y2")).asMethod.paramss)
+ println(typeOf[C].member(TermName("y3")).asMethod.paramss)
+ println(typeOf[C].member(TermName("y4")).asMethod.paramss)
} \ No newline at end of file
diff --git a/test/files/run/reflection-methodsymbol-returntype.scala b/test/files/run/reflection-methodsymbol-returntype.scala
index 392754dbe4..74a9e5dac0 100644
--- a/test/files/run/reflection-methodsymbol-returntype.scala
+++ b/test/files/run/reflection-methodsymbol-returntype.scala
@@ -13,12 +13,12 @@ class C {
}
object Test extends App {
- println(typeOf[C].member(newTermName("x1")).asMethod.returnType)
- println(typeOf[C].member(newTermName("x2")).asMethod.returnType)
- println(typeOf[C].member(newTermName("x3")).asMethod.returnType)
- println(typeOf[C].member(newTermName("x4")).asMethod.returnType)
- println(typeOf[C].member(newTermName("y1")).asMethod.returnType)
- println(typeOf[C].member(newTermName("y2")).asMethod.returnType)
- println(typeOf[C].member(newTermName("y3")).asMethod.returnType)
- println(typeOf[C].member(newTermName("y4")).asMethod.returnType)
+ println(typeOf[C].member(TermName("x1")).asMethod.returnType)
+ println(typeOf[C].member(TermName("x2")).asMethod.returnType)
+ println(typeOf[C].member(TermName("x3")).asMethod.returnType)
+ println(typeOf[C].member(TermName("x4")).asMethod.returnType)
+ println(typeOf[C].member(TermName("y1")).asMethod.returnType)
+ println(typeOf[C].member(TermName("y2")).asMethod.returnType)
+ println(typeOf[C].member(TermName("y3")).asMethod.returnType)
+ println(typeOf[C].member(TermName("y4")).asMethod.returnType)
} \ No newline at end of file
diff --git a/test/files/run/reflection-methodsymbol-typeparams.scala b/test/files/run/reflection-methodsymbol-typeparams.scala
index bb0a3c3aec..56d37ebeaa 100644
--- a/test/files/run/reflection-methodsymbol-typeparams.scala
+++ b/test/files/run/reflection-methodsymbol-typeparams.scala
@@ -13,12 +13,12 @@ class C {
}
object Test extends App {
- println(typeOf[C].member(newTermName("x1")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("x2")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("x3")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("x4")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("y1")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("y2")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("y3")).asMethod.typeParams)
- println(typeOf[C].member(newTermName("y4")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("x1")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("x2")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("x3")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("x4")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("y1")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("y2")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("y3")).asMethod.typeParams)
+ println(typeOf[C].member(TermName("y4")).asMethod.typeParams)
} \ No newline at end of file
diff --git a/test/files/run/reflection-repl-classes.check b/test/files/run/reflection-repl-classes.check
index 2dd96a93bf..606d67ce5e 100644
--- a/test/files/run/reflection-repl-classes.check
+++ b/test/files/run/reflection-repl-classes.check
@@ -19,7 +19,7 @@ scala> object defs {
val cm = reflect.runtime.currentMirror
val u = cm.universe
val im = cm.reflect(new B)
- val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod
+ val method = im.symbol.typeSignature.member(u.TermName("foo")).asMethod
val mm = im.reflectMethod(method)
}
defined module defs
diff --git a/test/files/run/reflection-repl-classes.scala b/test/files/run/reflection-repl-classes.scala
index 80e332cde3..4bfb980498 100644
--- a/test/files/run/reflection-repl-classes.scala
+++ b/test/files/run/reflection-repl-classes.scala
@@ -12,7 +12,7 @@ object Test extends ReplTest {
| val cm = reflect.runtime.currentMirror
| val u = cm.universe
| val im = cm.reflect(new B)
- | val method = im.symbol.typeSignature.member(u.newTermName("foo")).asMethod
+ | val method = im.symbol.typeSignature.member(u.TermName("foo")).asMethod
| val mm = im.reflectMethod(method)
|}
|import defs._
diff --git a/test/files/run/reflection-sanitychecks.scala b/test/files/run/reflection-sanitychecks.scala
index f817f23731..6d3daff1f7 100644
--- a/test/files/run/reflection-sanitychecks.scala
+++ b/test/files/run/reflection-sanitychecks.scala
@@ -32,14 +32,14 @@ object Test extends App {
def test(tpe: Type): Unit = {
def failsafe(action: => Any): Any = try action catch { case ex: Throwable => ex.toString }
println(s"=========members of ${tpe.typeSymbol.name} in a mirror of D=========")
- println("field #1: " + failsafe(im.reflectField(tpe.member(newTermName("foo")).asTerm).get))
- println("method #1: " + failsafe(im.reflectMethod(tpe.member(newTermName("bar")).asMethod)()))
- println("field #2: " + failsafe(im.reflectField(tpe.member(newTermName("quux")).asTerm).get))
- println("method #2: " + failsafe(im.reflectMethod(tpe.member(newTermName("baz")).asMethod)()))
- println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("bar")).asMethod)()))
- println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(newTermName("<init>")).asMethod)()))
- println("class: " + failsafe(im.reflectClass(tpe.member(newTypeName("C")).asClass).reflectConstructor(typeOf[C].member(newTypeName("C")).asClass.typeSignature.member(newTermName("<init>")).asMethod)()))
- println("object: " + failsafe(im.reflectModule(tpe.member(newTermName("O")).asModule).instance))
+ println("field #1: " + failsafe(im.reflectField(tpe.member(TermName("foo")).asTerm).get))
+ println("method #1: " + failsafe(im.reflectMethod(tpe.member(TermName("bar")).asMethod)()))
+ println("field #2: " + failsafe(im.reflectField(tpe.member(TermName("quux")).asTerm).get))
+ println("method #2: " + failsafe(im.reflectMethod(tpe.member(TermName("baz")).asMethod)()))
+ println("constructor #1: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(TermName("bar")).asMethod)()))
+ println("constructor #2: " + failsafe(cm.reflectClass(im.symbol).reflectConstructor(tpe.member(TermName("<init>")).asMethod)()))
+ println("class: " + failsafe(im.reflectClass(tpe.member(TypeName("C")).asClass).reflectConstructor(typeOf[C].member(TypeName("C")).asClass.typeSignature.member(nme.CONSTRUCTOR).asMethod)()))
+ println("object: " + failsafe(im.reflectModule(tpe.member(TermName("O")).asModule).instance))
println()
}
diff --git a/test/files/run/reflection-valueclasses-derived.scala b/test/files/run/reflection-valueclasses-derived.scala
index 6b08f987ba..8d25e2929c 100644
--- a/test/files/run/reflection-valueclasses-derived.scala
+++ b/test/files/run/reflection-valueclasses-derived.scala
@@ -6,7 +6,7 @@ class C(val x: Int) extends AnyVal {
}
object Test extends App {
- println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)(2))
- println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("getClass")).asMethod)())
- println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(newTermName("toString")).asMethod)())
+ println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("foo")).asMethod)(2))
+ println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("getClass")).asMethod)())
+ println(cm.reflect(new C(2)).reflectMethod(typeOf[C].member(TermName("toString")).asMethod)())
} \ No newline at end of file
diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala
index c4a26e460a..33d4634397 100644
--- a/test/files/run/reflection-valueclasses-magic.scala
+++ b/test/files/run/reflection-valueclasses-magic.scala
@@ -44,7 +44,7 @@ object Test extends App {
val realex = scala.ExceptionUtils.unwrapThrowable(ex)
println(realex.getClass + ": " + realex.getMessage)
}
- val meth = tpe.declaration(newTermName(method).encodedName.toTermName)
+ val meth = tpe.declaration(TermName(method).encodedName.toTermName)
val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod)
testees foreach (testee => {
val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.paramss.flatten.apply(i).typeSignature) }
diff --git a/test/files/run/reflection-valueclasses-standard.scala b/test/files/run/reflection-valueclasses-standard.scala
index 18a3d1fa04..b6b5a2ede2 100644
--- a/test/files/run/reflection-valueclasses-standard.scala
+++ b/test/files/run/reflection-valueclasses-standard.scala
@@ -5,8 +5,8 @@ import scala.reflect.{ClassTag, classTag}
object Test extends App {
def test[T: ClassTag: TypeTag](x: T) = {
println(s"========${classTag[T].runtimeClass}========")
- println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("getClass")).asMethod)())
- println(cm.reflect(x).reflectMethod(typeOf[T].member(newTermName("toString")).asMethod)())
+ println(cm.reflect(x).reflectMethod(typeOf[T].member(TermName("getClass")).asMethod)())
+ println(cm.reflect(x).reflectMethod(typeOf[T].member(TermName("toString")).asMethod)())
}
test(2.toByte)
diff --git a/test/files/run/reify-aliases.check b/test/files/run/reify-aliases.check
index aa846b9bc6..da784227af 100644
--- a/test/files/run/reify-aliases.check
+++ b/test/files/run/reify-aliases.check
@@ -1 +1 @@
-TypeRef(SingleType(ThisType(scala), scala.Predef), newTypeName("String"), List())
+TypeRef(SingleType(ThisType(scala), scala.Predef), TypeName("String"), List())
diff --git a/test/files/run/reify_copypaste1.scala b/test/files/run/reify_copypaste1.scala
index c597b7af19..b2eef28026 100644
--- a/test/files/run/reify_copypaste1.scala
+++ b/test/files/run/reify_copypaste1.scala
@@ -9,8 +9,8 @@ object Test extends App {
val output = new java.io.ByteArrayOutputStream()
System.setOut(new java.io.PrintStream(output))
val toolBox = currentMirror.mkToolBox(options = "-Yreify-copypaste")
- val reify = Select(Select(Select(Select(Ident(ScalaPackage), newTermName("reflect")), newTermName("runtime")), newTermName("universe")), newTermName("reify"))
- val reifee = Block(List(ValDef(Modifiers(LAZY), newTermName("x"), TypeTree(), Apply(Ident(ListModule), List(Literal(Constant(1)), Literal(Constant(2)))))), Ident(newTermName("x")))
+ val reify = Select(Select(Select(Select(Ident(ScalaPackage), TermName("reflect")), TermName("runtime")), TermName("universe")), TermName("reify"))
+ val reifee = Block(List(ValDef(Modifiers(LAZY), TermName("x"), TypeTree(), Apply(Ident(ListModule), List(Literal(Constant(1)), Literal(Constant(2)))))), Ident(TermName("x")))
toolBox.eval(Apply(reify, List(reifee)))
val Block(List(tpeCopypaste), exprCopypaste @ ModuleDef(_, _, Template(_, _, (_ :: stats) :+ expr))) = toolBox.parse(output.toString())
output.reset()
diff --git a/test/files/run/reify_newimpl_22.check b/test/files/run/reify_newimpl_22.check
index dcb3e2889b..e68fe2f6b1 100644
--- a/test/files/run/reify_newimpl_22.check
+++ b/test/files/run/reify_newimpl_22.check
@@ -19,7 +19,7 @@ scala> {
}
println(code.eval)
}
-<console>:15: free term: Ident(newTermName("x")) defined by res0 in <console>:14:21
+<console>:15: free term: Ident(TermName("x")) defined by res0 in <console>:14:21
val code = reify {
^
2
diff --git a/test/files/run/reify_newimpl_23.check b/test/files/run/reify_newimpl_23.check
index 882124657e..38c95646a8 100644
--- a/test/files/run/reify_newimpl_23.check
+++ b/test/files/run/reify_newimpl_23.check
@@ -18,7 +18,7 @@ scala> def foo[T]{
}
println(code.eval)
}
-<console>:13: free type: Ident(newTypeName("T")) defined by foo in <console>:12:16
+<console>:13: free type: Ident(TypeName("T")) defined by foo in <console>:12:16
val code = reify {
^
foo: [T]=> Unit
diff --git a/test/files/run/reify_newimpl_25.check b/test/files/run/reify_newimpl_25.check
index d1028b94c7..86f6abce02 100644
--- a/test/files/run/reify_newimpl_25.check
+++ b/test/files/run/reify_newimpl_25.check
@@ -9,7 +9,7 @@ scala> {
val tt = implicitly[TypeTag[x.type]]
println(tt)
}
-<console>:11: free term: Ident(newTermName("x")) defined by res0 in <console>:10:21
+<console>:11: free term: Ident(TermName("x")) defined by res0 in <console>:10:21
val tt = implicitly[TypeTag[x.type]]
^
TypeTag[x.type]
diff --git a/test/files/run/reify_newimpl_26.check b/test/files/run/reify_newimpl_26.check
index 347f6365aa..d3e2540de0 100644
--- a/test/files/run/reify_newimpl_26.check
+++ b/test/files/run/reify_newimpl_26.check
@@ -8,7 +8,7 @@ scala> def foo[T]{
val tt = implicitly[WeakTypeTag[List[T]]]
println(tt)
}
-<console>:9: free type: Ident(newTypeName("T")) defined by foo in <console>:7:16
+<console>:9: free type: Ident(TypeName("T")) defined by foo in <console>:7:16
val tt = implicitly[WeakTypeTag[List[T]]]
^
foo: [T]=> Unit
diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala
index 272856b962..9932a58dfa 100644
--- a/test/files/run/reify_printf.scala
+++ b/test/files/run/reify_printf.scala
@@ -23,7 +23,7 @@ object Test extends App {
*/
var i = 0
- def gensym(name: String) = { i += 1; newTermName(name + i) }
+ def gensym(name: String) = { i += 1; TermName(name + i) }
def createTempValDef( value : Tree, tpe : Type ) : (Option[Tree],Tree) = {
val local = gensym("temp")
@@ -59,10 +59,10 @@ object Test extends App {
Apply(
Select(
Select(
- Ident( newTermName("scala") )
- , newTermName("Predef")
+ Ident( TermName("scala") )
+ , TermName("Predef")
)
- , newTermName("print")
+ , TermName("print")
)
, List(ref)
): Tree
diff --git a/test/files/run/repl-colon-type.check b/test/files/run/repl-colon-type.check
index 7716221f54..4cd0e1d588 100644
--- a/test/files/run/repl-colon-type.check
+++ b/test/files/run/repl-colon-type.check
@@ -75,10 +75,10 @@ scala> :type -v List(1,2,3) filter _
// Internal Type structure
TypeRef(
- TypeSymbol(abstract trait Function1[-T1, +R] extends Object)
+ TypeSymbol(abstract trait Function1[-T1, +R] extends AnyRef)
args = List(
TypeRef(
- TypeSymbol(abstract trait Function1[-T1, +R] extends Object)
+ TypeSymbol(abstract trait Function1[-T1, +R] extends AnyRef)
args = List(
TypeRef(TypeSymbol(final abstract class Int extends AnyVal))
TypeRef(
@@ -145,7 +145,7 @@ Int => Iterator[List[Nothing]]
// Internal Type structure
TypeRef(
- TypeSymbol(abstract trait Function1[-T1, +R] extends Object)
+ TypeSymbol(abstract trait Function1[-T1, +R] extends AnyRef)
args = List(
TypeRef(TypeSymbol(final abstract class Int extends AnyVal))
TypeRef(
@@ -178,7 +178,7 @@ PolyType(
typeParams = List(TypeParam(T <: AnyVal))
resultType = NullaryMethodType(
TypeRef(
- TypeSymbol(abstract trait Function1[-T1, +R] extends Object)
+ TypeSymbol(abstract trait Function1[-T1, +R] extends AnyRef)
args = List(
TypeRef(TypeSymbol(final abstract class Int extends AnyVal))
TypeRef(
diff --git a/test/files/run/repl-parens.check b/test/files/run/repl-parens.check
index 4b7ce6b059..15f4b4524a 100644
--- a/test/files/run/repl-parens.check
+++ b/test/files/run/repl-parens.check
@@ -66,7 +66,7 @@ scala> 55 ; () => 5
res13: () => Int = <function0>
scala> () => { class X ; new X }
-res14: () => Object = <function0>
+res14: () => AnyRef = <function0>
scala>
diff --git a/test/files/run/showraw_aliases.check b/test/files/run/showraw_aliases.check
index aebd354031..d6a198b1cb 100644
--- a/test/files/run/showraw_aliases.check
+++ b/test/files/run/showraw_aliases.check
@@ -1,2 +1,2 @@
-Block(List(Import(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), List(ImportSelector(newTermName("universe"), <offset>, newTermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), scala.reflect.runtime.package), [newTermName("universe") aka newTermName("ru")]))
-Block(List(Import(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), List(ImportSelector(newTermName("universe"), <offset>, newTermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), scala.reflect.runtime.package#<id>), [newTermName("universe")#<id> aka newTermName("ru")]))
+Block(List(Import(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), List(ImportSelector(TermName("universe"), <offset>, TermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala), scala.reflect), scala.reflect.runtime), scala.reflect.runtime.package), [TermName("universe") aka TermName("ru")]))
+Block(List(Import(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), List(ImportSelector(TermName("universe"), <offset>, TermName("ru"), <offset>)))), Select(Select(Select(Select(Ident(scala#<id>), scala.reflect#<id>), scala.reflect.runtime#<id>), scala.reflect.runtime.package#<id>), [TermName("universe")#<id> aka TermName("ru")]))
diff --git a/test/files/run/showraw_mods.check b/test/files/run/showraw_mods.check
index 7fca027614..3ec868542d 100644
--- a/test/files/run/showraw_mods.check
+++ b/test/files/run/showraw_mods.check
@@ -1 +1 @@
-Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), newTypeName("C"), List(), Template(List(Ident(newTypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), newTermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), newTermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), newTermName("y"), TypeTree(), Select(This(newTypeName("C")), newTermName("x"))), ValDef(Modifiers(LAZY), newTermName("z"), TypeTree(), Select(This(newTypeName("C")), newTermName("y"))))))), Literal(Constant(())))
+Block(List(ClassDef(Modifiers(ABSTRACT | DEFAULTPARAM/TRAIT), TypeName("C"), List(), Template(List(Ident(TypeName("AnyRef"))), emptyValDef, List(DefDef(Modifiers(), TermName("$init$"), List(), List(List()), TypeTree(), Block(List(), Literal(Constant(())))), ValDef(Modifiers(PRIVATE | LOCAL), TermName("x"), TypeTree(), Literal(Constant(2))), ValDef(Modifiers(MUTABLE), TermName("y"), TypeTree(), Select(This(TypeName("C")), TermName("x"))), ValDef(Modifiers(LAZY), TermName("z"), TypeTree(), Select(This(TypeName("C")), TermName("y"))))))), Literal(Constant(())))
diff --git a/test/files/run/showraw_tree.check b/test/files/run/showraw_tree.check
index dca272684e..0416b12568 100644
--- a/test/files/run/showraw_tree.check
+++ b/test/files/run/showraw_tree.check
@@ -1,2 +1,2 @@
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(TypeName("String")), Ident(TypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(TypeName("String")), Ident(TypeName("String"))))), nme.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_ids.check b/test/files/run/showraw_tree_ids.check
index d25599c7fc..6e17bf2fb4 100644
--- a/test/files/run/showraw_tree_ids.check
+++ b/test/files/run/showraw_tree_ids.check
@@ -1,2 +1,2 @@
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Ident(newTypeName("String")#<id>), Ident(newTypeName("String")#<id>)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#<id>), List(Ident(TypeName("String")#<id>), Ident(TypeName("String")#<id>)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#<id>), List(Ident(TypeName("String")#<id>), Ident(TypeName("String")#<id>)))), nme.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_kinds.check b/test/files/run/showraw_tree_kinds.check
index d0d4cd0058..16147a64f4 100644
--- a/test/files/run/showraw_tree_kinds.check
+++ b/test/files/run/showraw_tree_kinds.check
@@ -1,2 +1,2 @@
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Ident(newTypeName("String")#TPE), Ident(newTypeName("String")#TPE)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap#CLS), List(Ident(TypeName("String")#TPE), Ident(TypeName("String")#TPE)))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap#CLS), List(Ident(TypeName("String")#TPE), Ident(TypeName("String")#TPE)))), nme.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_types_ids.check b/test/files/run/showraw_tree_types_ids.check
index 92ee45a1e6..c98b16e956 100644
--- a/test/files/run/showraw_tree_types_ids.check
+++ b/test/files/run/showraw_tree_types_ids.check
@@ -1,10 +1,10 @@
-Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
-[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))))
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
+[1] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()))))
[3] TypeRef(ThisType(scala.collection.immutable#<id>), scala.collection.immutable.HashMap#<id>, List())
-[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
-[4] TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())
-[5] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), newTypeName("String")#<id>, List()))))
+[4] TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List())
+Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>)), TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>)))))), nme.CONSTRUCTOR#<id>), List())
+[4] TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List())
+[5] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List())))
+[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List(TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()), TypeRef(ThisType(scala.Predef#<id>), TypeName("String")#<id>, List()))))
[7] TypeRef(ThisType(scala.collection.mutable#<id>), scala.collection.mutable.HashMap#<id>, List())
diff --git a/test/files/run/showraw_tree_types_typed.check b/test/files/run/showraw_tree_types_typed.check
index c6c20409dc..30dda7d18b 100644
--- a/test/files/run/showraw_tree_types_typed.check
+++ b/test/files/run/showraw_tree_types_typed.check
@@ -1,10 +1,10 @@
-Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List())
-[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))))
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String"))), TypeTree[4]().setOriginal(Ident[4](TypeName("String"))))))), nme.CONSTRUCTOR), List())
+[1] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), TypeName("String"), List()), TypeRef(ThisType(scala.Predef), TypeName("String"), List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List(TypeRef(ThisType(scala.Predef), TypeName("String"), List()), TypeRef(ThisType(scala.Predef), TypeName("String"), List()))))
[3] TypeRef(ThisType(scala.collection.immutable), scala.collection.immutable.HashMap, List())
-[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))), TypeTree[4]().setOriginal(Ident[4](newTypeName("String"))))))), nme.CONSTRUCTOR), List())
-[4] TypeRef(ThisType(scala.Predef), newTypeName("String"), List())
-[5] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), newTypeName("String"), List()), TypeRef(ThisType(scala.Predef), newTypeName("String"), List()))))
+[4] TypeRef(ThisType(scala.Predef), TypeName("String"), List())
+Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String"))), TypeTree[4]().setOriginal(Ident[4](TypeName("String"))))))), nme.CONSTRUCTOR), List())
+[4] TypeRef(ThisType(scala.Predef), TypeName("String"), List())
+[5] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), TypeName("String"), List()), TypeRef(ThisType(scala.Predef), TypeName("String"), List())))
+[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List(TypeRef(ThisType(scala.Predef), TypeName("String"), List()), TypeRef(ThisType(scala.Predef), TypeName("String"), List()))))
[7] TypeRef(ThisType(scala.collection.mutable), scala.collection.mutable.HashMap, List())
diff --git a/test/files/run/showraw_tree_types_untyped.check b/test/files/run/showraw_tree_types_untyped.check
index dca272684e..0416b12568 100644
--- a/test/files/run/showraw_tree_types_untyped.check
+++ b/test/files/run/showraw_tree_types_untyped.check
@@ -1,2 +1,2 @@
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
-Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(newTypeName("String")), Ident(newTypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.immutable.HashMap), List(Ident(TypeName("String")), Ident(TypeName("String"))))), nme.CONSTRUCTOR), List())
+Apply(Select(New(AppliedTypeTree(Ident(scala.collection.mutable.HashMap), List(Ident(TypeName("String")), Ident(TypeName("String"))))), nme.CONSTRUCTOR), List())
diff --git a/test/files/run/showraw_tree_ultimate.check b/test/files/run/showraw_tree_ultimate.check
index 46ccd4df8f..991ecc5410 100644
--- a/test/files/run/showraw_tree_ultimate.check
+++ b/test/files/run/showraw_tree_ultimate.check
@@ -1,10 +1,10 @@
-Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#PCTOR), List())
-[1] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))
-[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))))
+Apply[1](Select[2](New[1](TypeTree[1]().setOriginal(AppliedTypeTree(Ident[3](scala.collection.immutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#PCTOR), List())
+[1] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List())))
+[2] MethodType(List(), TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()))))
[3] TypeRef(ThisType(scala.collection.immutable#<id>#PK), scala.collection.immutable.HashMap#<id>#CLS, List())
-[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())
-Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](newTypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#CTOR), List())
-[4] TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())
-[5] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List())))
-[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), newTypeName("String")#<id>#TPE, List()))))
+[4] TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List())
+Apply[5](Select[6](New[5](TypeTree[5]().setOriginal(AppliedTypeTree(Ident[7](scala.collection.mutable.HashMap#<id>#CLS), List(TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>#TPE)), TypeTree[4]().setOriginal(Ident[4](TypeName("String")#<id>#TPE)))))), nme.CONSTRUCTOR#<id>#CTOR), List())
+[4] TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List())
+[5] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List())))
+[6] MethodType(List(), TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List(TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()), TypeRef(ThisType(scala.Predef#<id>#MODC), TypeName("String")#<id>#TPE, List()))))
[7] TypeRef(ThisType(scala.collection.mutable#<id>#PK), scala.collection.mutable.HashMap#<id>#CLS, List())
diff --git a/test/files/run/t3835.scala b/test/files/run/t3835.scala
index c120a61f6e..766b6ddc2e 100644
--- a/test/files/run/t3835.scala
+++ b/test/files/run/t3835.scala
@@ -1,6 +1,6 @@
object Test extends App {
// work around optimizer bug SI-5672 -- generates wrong bytecode for switches in arguments
- // virtpatmat happily emits a switch for a one-case switch, whereas -Xoldpatmat did not
+ // virtpatmat happily emits a switch for a one-case switch
// this is not the focus of this test, hence the temporary workaround
def a = (1, 2, 3) match { case (r, \u03b8, \u03c6) => r + \u03b8 + \u03c6 }
println(a)
diff --git a/test/files/run/t4172.check b/test/files/run/t4172.check
index f16c9e5151..94cdff4870 100644
--- a/test/files/run/t4172.check
+++ b/test/files/run/t4172.check
@@ -5,7 +5,7 @@ scala>
scala> val c = { class C { override def toString = "C" }; ((new C, new C { def f = 2 })) }
warning: there were 1 feature warnings; re-run with -feature for details
-c: (C, C{def f: Int}) forSome { type C <: Object } = (C,C)
+c: (C, C{def f: Int}) forSome { type C <: AnyRef } = (C,C)
scala>
diff --git a/test/files/run/t5256a.check b/test/files/run/t5256a.check
index 7e60139db3..09b5a02831 100644
--- a/test/files/run/t5256a.check
+++ b/test/files/run/t5256a.check
@@ -1,6 +1,6 @@
class A
A
-Object {
+AnyRef {
def <init>(): A
def foo: Nothing
}
diff --git a/test/files/run/t5256b.check b/test/files/run/t5256b.check
index a80df6eb30..ca93aaa706 100644
--- a/test/files/run/t5256b.check
+++ b/test/files/run/t5256b.check
@@ -1,6 +1,6 @@
class A
Test.A
-Object {
+AnyRef {
def <init>(): Test.A
def foo: Nothing
}
diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check
index 9742ae572e..b7617e80a2 100644
--- a/test/files/run/t5256d.check
+++ b/test/files/run/t5256d.check
@@ -22,7 +22,7 @@ scala> println(c.fullName)
$line8.$read.$iw.$iw.$iw.$iw.A
scala> println(c.typeSignature)
-java.lang.Object {
+scala.AnyRef {
def <init>(): A
def foo: scala.Nothing
}
diff --git a/test/files/run/t5256e.check b/test/files/run/t5256e.check
index 011115720c..ed3513183e 100644
--- a/test/files/run/t5256e.check
+++ b/test/files/run/t5256e.check
@@ -1,6 +1,6 @@
class A
Test.C.A
-Object {
+AnyRef {
def <init>(): C.this.A
def foo: Nothing
}
diff --git a/test/files/run/t5256f.check b/test/files/run/t5256f.check
index e0fec85596..6a89d0b86a 100644
--- a/test/files/run/t5256f.check
+++ b/test/files/run/t5256f.check
@@ -1,12 +1,12 @@
class A1
Test.A1
-Object {
+AnyRef {
def <init>(): Test.A1
def foo: Nothing
}
class A2
Test.A2
-Object {
+AnyRef {
def <init>(): Test.this.A2
def foo: Nothing
}
diff --git a/test/files/run/t5418b.check b/test/files/run/t5418b.check
index 48d82a2aae..f036a4be84 100644
--- a/test/files/run/t5418b.check
+++ b/test/files/run/t5418b.check
@@ -1,2 +1,2 @@
new Object().getClass()
-TypeRef(ThisType(java.lang), java.lang.Class, List(TypeRef(NoPrefix, newTypeName("?0"), List())))
+TypeRef(ThisType(java.lang), java.lang.Class, List(TypeRef(NoPrefix, TypeName("?0"), List())))
diff --git a/test/files/run/t6178.scala b/test/files/run/t6178.scala
index 0b4cf0bbf5..41e148af91 100644
--- a/test/files/run/t6178.scala
+++ b/test/files/run/t6178.scala
@@ -2,6 +2,6 @@ import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
- val plus = typeOf[java.lang.String].member(newTermName("$plus")).asMethod
+ val plus = typeOf[java.lang.String].member(TermName("$plus")).asMethod
println(cm.reflect("").reflectMethod(plus).apply("2"))
} \ No newline at end of file
diff --git a/test/files/run/t6181.scala b/test/files/run/t6181.scala
index fb23eaff63..eaa7340178 100644
--- a/test/files/run/t6181.scala
+++ b/test/files/run/t6181.scala
@@ -3,6 +3,6 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class C { def test(x: => Int) = println(x) }
- val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("test")).asMethod)
+ val mm = cm.reflect(new C).reflectMethod(typeOf[C].member(TermName("test")).asMethod)
mm(2)
} \ No newline at end of file
diff --git a/test/files/run/t6199-mirror.scala b/test/files/run/t6199-mirror.scala
index 772a384542..3fda56bf7c 100644
--- a/test/files/run/t6199-mirror.scala
+++ b/test/files/run/t6199-mirror.scala
@@ -3,5 +3,5 @@ import scala.reflect.runtime.{currentMirror => cm}
object Test extends App {
class C { def foo = () }
- println(cm.reflect(new C).reflectMethod(typeOf[C].member(newTermName("foo")).asMethod)())
+ println(cm.reflect(new C).reflectMethod(typeOf[C].member(TermName("foo")).asMethod)())
} \ No newline at end of file
diff --git a/test/files/run/t6392b.check b/test/files/run/t6392b.check
index e9c7ecaa34..2afc48495f 100644
--- a/test/files/run/t6392b.check
+++ b/test/files/run/t6392b.check
@@ -1 +1 @@
-ModuleDef(Modifiers(), newTermName("C"), Template(List(Select(Ident(scala#PK), newTypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(newTypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(())))))))
+ModuleDef(Modifiers(), TermName("C"), Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(())))))))
diff --git a/test/files/run/toolbox_typecheck_implicitsdisabled.scala b/test/files/run/toolbox_typecheck_implicitsdisabled.scala
index 8a3d433142..95a7056279 100644
--- a/test/files/run/toolbox_typecheck_implicitsdisabled.scala
+++ b/test/files/run/toolbox_typecheck_implicitsdisabled.scala
@@ -7,16 +7,16 @@ object Test extends App {
val toolbox = cm.mkToolBox()
val tree1 = Block(List(
- Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))),
- Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2))))
+ Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))),
+ Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
)
val ttree1 = toolbox.typeCheck(tree1, withImplicitViewsDisabled = false)
println(ttree1)
try {
val tree2 = Block(List(
- Import(Select(Ident(newTermName("scala")), newTermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))),
- Apply(Select(Literal(Constant(1)), newTermName("$minus$greater")), List(Literal(Constant(2))))
+ Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))),
+ Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
)
val ttree2 = toolbox.typeCheck(tree2, withImplicitViewsDisabled = true)
println(ttree2)
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled.scala b/test/files/run/toolbox_typecheck_macrosdisabled.scala
index 51eb63f294..1f7fda8575 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled.scala
+++ b/test/files/run/toolbox_typecheck_macrosdisabled.scala
@@ -15,11 +15,11 @@ object Test extends App {
val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
build.setTypeSignature(ru, rutpe)
- val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2))))
+ val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false)
println(ttree1)
- val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Literal(Constant(2))))
+ val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Literal(Constant(2))))
val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true)
println(ttree2)
}
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check
index f5c9b6eeab..74dfb03666 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled2.check
+++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check
@@ -19,7 +19,7 @@
def apply[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.api.Mirror[U]): U#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.TermName.apply("Array")), $u.TermName.apply("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
}
};
new $treecreator1()
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.scala b/test/files/run/toolbox_typecheck_macrosdisabled2.scala
index 74fd09d9fd..7bfe3ba8a4 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled2.scala
+++ b/test/files/run/toolbox_typecheck_macrosdisabled2.scala
@@ -15,11 +15,11 @@ object Test extends App {
val ru = build.newFreeTerm("ru", scala.reflect.runtime.universe)
build.setTypeSignature(ru, rutpe)
- val tree1 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
+ val tree1 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
val ttree1 = toolbox.typeCheck(tree1, withMacrosDisabled = false)
println(ttree1)
- val tree2 = Apply(Select(Ident(ru), newTermName("reify")), List(Apply(Select(Ident(newTermName("scala")), newTermName("Array")), List(Literal(Constant(2))))))
+ val tree2 = Apply(Select(Ident(ru), TermName("reify")), List(Apply(Select(Ident(TermName("scala")), TermName("Array")), List(Literal(Constant(2))))))
val ttree2 = toolbox.typeCheck(tree2, withMacrosDisabled = true)
println(ttree2)
}
diff --git a/test/files/scalacheck/ReflectionExtractors.scala b/test/files/scalacheck/ReflectionExtractors.scala
new file mode 100644
index 0000000000..a2615feb3e
--- /dev/null
+++ b/test/files/scalacheck/ReflectionExtractors.scala
@@ -0,0 +1,52 @@
+import org.scalacheck._
+import Prop._
+import Gen._
+import Arbitrary._
+
+import scala.reflect.runtime.universe._
+import Flag._
+
+object Test extends Properties("reflection extractors") {
+
+ val genFlag = oneOf(
+ TRAIT, INTERFACE, MUTABLE, MACRO, DEFERRED, ABSTRACT, FINAL, SEALED,
+ IMPLICIT, LAZY, OVERRIDE, PRIVATE, PROTECTED, LOCAL, CASE, ABSOVERRIDE,
+ BYNAMEPARAM, PARAM, COVARIANT, CONTRAVARIANT, DEFAULTPARAM, PRESUPER,
+ DEFAULTINIT
+ )
+ val genModifiers =
+ for(flag <- genFlag; privateWithin <- genName)
+ yield Modifiers(flag, privateWithin, Nil)
+ val genTermName = for(name <- arbitrary[String]) yield TermName(name)
+ val genTypeName = for(name <- arbitrary[String]) yield TypeName(name)
+ val genName = oneOf(genTermName, genTypeName)
+
+ implicit val arbTermName: Arbitrary[TermName] = Arbitrary(genTermName)
+ implicit val arbTypeName: Arbitrary[TypeName] = Arbitrary(genTypeName)
+ implicit val arbName: Arbitrary[Name] = Arbitrary(genName)
+ implicit val arbMods: Arbitrary[Modifiers] = Arbitrary(genModifiers)
+
+ property("extract term name") = forAll { (name: TermName) =>
+ val TermName(s) = name
+ s == name.toString
+ }
+
+ property("extract type name") = forAll { (name: TypeName) =>
+ val TypeName(s) = name
+ s == name.toString
+ }
+
+ property("extract term or type name") = forAll { (name: Name) =>
+ name match {
+ case TermName(s) => s == name.toString
+ case TypeName(s) => s == name.toString
+ }
+ }
+
+ property("extract modifiers") = forAll { (mods: Modifiers) =>
+ val Modifiers(flags, priv, annots) = mods
+ flags == mods.flags &&
+ priv == mods.privateWithin &&
+ annots == mods.annotations
+ }
+} \ No newline at end of file
diff --git a/test/files/scalap/abstractClass/result.test b/test/files/scalap/abstractClass/result.test
index 9163346fc6..ef1daac23d 100644
--- a/test/files/scalap/abstractClass/result.test
+++ b/test/files/scalap/abstractClass/result.test
@@ -1,4 +1,4 @@
-abstract class AbstractClass extends java.lang.Object {
+abstract class AbstractClass extends scala.AnyRef {
def this() = { /* compiled code */ }
def foo : scala.Predef.String
}
diff --git a/test/files/scalap/abstractMethod/result.test b/test/files/scalap/abstractMethod/result.test
index 90f572f258..40fa02d408 100644
--- a/test/files/scalap/abstractMethod/result.test
+++ b/test/files/scalap/abstractMethod/result.test
@@ -1,4 +1,4 @@
-trait AbstractMethod extends java.lang.Object {
+trait AbstractMethod extends scala.AnyRef {
def $init$() : scala.Unit = { /* compiled code */ }
def arity : scala.Int
def isCool : scala.Boolean = { /* compiled code */ }
diff --git a/test/files/scalap/cbnParam/result.test b/test/files/scalap/cbnParam/result.test
index fbe035d63c..52ecb6ae66 100644
--- a/test/files/scalap/cbnParam/result.test
+++ b/test/files/scalap/cbnParam/result.test
@@ -1,3 +1,3 @@
-class CbnParam extends java.lang.Object {
+class CbnParam extends scala.AnyRef {
def this(s : => scala.Predef.String) = { /* compiled code */ }
}
diff --git a/test/files/scalap/classPrivate/result.test b/test/files/scalap/classPrivate/result.test
index 5f2e1cc00e..ab2d40cdaf 100644
--- a/test/files/scalap/classPrivate/result.test
+++ b/test/files/scalap/classPrivate/result.test
@@ -1,7 +1,7 @@
-class ClassPrivate extends java.lang.Object {
+class ClassPrivate extends scala.AnyRef {
def this() = { /* compiled code */ }
def baz : scala.Int = { /* compiled code */ }
- class Outer extends java.lang.Object {
+ class Outer extends scala.AnyRef {
def this() = { /* compiled code */ }
private[ClassPrivate] def qux : scala.Int = { /* compiled code */ }
}
diff --git a/test/files/scalap/classWithExistential/result.test b/test/files/scalap/classWithExistential/result.test
index b8ce005da9..caee3fd6de 100644
--- a/test/files/scalap/classWithExistential/result.test
+++ b/test/files/scalap/classWithExistential/result.test
@@ -1,4 +1,4 @@
-class ClassWithExistential extends java.lang.Object {
+class ClassWithExistential extends scala.AnyRef {
def this() = { /* compiled code */ }
def foo[A, B] : scala.Function1[A, B forSome {type A <: scala.Seq[scala.Int]; type B >: scala.Predef.String}] = { /* compiled code */ }
}
diff --git a/test/files/scalap/classWithSelfAnnotation/result.test b/test/files/scalap/classWithSelfAnnotation/result.test
index df7bd86643..82bbd9e8df 100644
--- a/test/files/scalap/classWithSelfAnnotation/result.test
+++ b/test/files/scalap/classWithSelfAnnotation/result.test
@@ -1,4 +1,4 @@
-class ClassWithSelfAnnotation extends java.lang.Object {
+class ClassWithSelfAnnotation extends scala.AnyRef {
this : ClassWithSelfAnnotation with java.lang.CharSequence =>
def this() = { /* compiled code */ }
def foo : scala.Int = { /* compiled code */ }
diff --git a/test/files/scalap/covariantParam/result.test b/test/files/scalap/covariantParam/result.test
index 2f52f1f28e..f7a3c98966 100644
--- a/test/files/scalap/covariantParam/result.test
+++ b/test/files/scalap/covariantParam/result.test
@@ -1,4 +1,4 @@
-class CovariantParam[+A] extends java.lang.Object {
+class CovariantParam[+A] extends scala.AnyRef {
def this() = { /* compiled code */ }
def foo[A](a : A) : scala.Int = { /* compiled code */ }
}
diff --git a/test/files/scalap/defaultParameter/result.test b/test/files/scalap/defaultParameter/result.test
index 38bf6ac4e3..0c775ea7b5 100644
--- a/test/files/scalap/defaultParameter/result.test
+++ b/test/files/scalap/defaultParameter/result.test
@@ -1,3 +1,3 @@
-trait DefaultParameter extends java.lang.Object {
+trait DefaultParameter extends scala.AnyRef {
def foo(s : scala.Predef.String) : scala.Unit
-} \ No newline at end of file
+}
diff --git a/test/files/scalap/implicitParam/result.test b/test/files/scalap/implicitParam/result.test
index 0ea212dda6..a2cfd6092d 100644
--- a/test/files/scalap/implicitParam/result.test
+++ b/test/files/scalap/implicitParam/result.test
@@ -1,4 +1,4 @@
-class ImplicitParam extends java.lang.Object {
+class ImplicitParam extends scala.AnyRef {
def this() = { /* compiled code */ }
def foo(i : scala.Int)(implicit f : scala.Float, d : scala.Double) : scala.Int = { /* compiled code */ }
}
diff --git a/test/files/scalap/packageObject/result.test b/test/files/scalap/packageObject/result.test
index 94c6a01b08..5732d92958 100644
--- a/test/files/scalap/packageObject/result.test
+++ b/test/files/scalap/packageObject/result.test
@@ -1,4 +1,4 @@
-package object PackageObject extends java.lang.Object {
+package object PackageObject extends scala.AnyRef {
def this() = { /* compiled code */ }
type A = scala.Predef.String
def foo(i : scala.Int) : scala.Int = { /* compiled code */ }
diff --git a/test/files/scalap/paramClauses/result.test b/test/files/scalap/paramClauses/result.test
index dc4397386c..3a141e8faf 100644
--- a/test/files/scalap/paramClauses/result.test
+++ b/test/files/scalap/paramClauses/result.test
@@ -1,4 +1,4 @@
-class ParamClauses extends java.lang.Object {
+class ParamClauses extends scala.AnyRef {
def this() = { /* compiled code */ }
def foo(i : scala.Int)(s : scala.Predef.String)(t : scala.Double) : scala.Int = { /* compiled code */ }
}
diff --git a/test/files/scalap/paramNames/result.test b/test/files/scalap/paramNames/result.test
index 4d3c7d0c1e..85e37f858d 100644
--- a/test/files/scalap/paramNames/result.test
+++ b/test/files/scalap/paramNames/result.test
@@ -1,4 +1,4 @@
-class ParamNames extends java.lang.Object {
+class ParamNames extends scala.AnyRef {
def this() = { /* compiled code */ }
def foo(s : => scala.Seq[scala.Int], s2 : => scala.Seq[scala.Any]) : scala.Unit = { /* compiled code */ }
}
diff --git a/test/files/scalap/sequenceParam/result.test b/test/files/scalap/sequenceParam/result.test
index ed47c094fe..142d92fea3 100644
--- a/test/files/scalap/sequenceParam/result.test
+++ b/test/files/scalap/sequenceParam/result.test
@@ -1,3 +1,3 @@
-class SequenceParam extends java.lang.Object {
+class SequenceParam extends scala.AnyRef {
def this(s : scala.Predef.String, i : scala.Int*) = { /* compiled code */ }
}
diff --git a/test/files/scalap/simpleClass/result.test b/test/files/scalap/simpleClass/result.test
index 905046ce52..4fdf25d1cf 100644
--- a/test/files/scalap/simpleClass/result.test
+++ b/test/files/scalap/simpleClass/result.test
@@ -1,4 +1,4 @@
-class SimpleClass extends java.lang.Object {
+class SimpleClass extends scala.AnyRef {
def this() = { /* compiled code */ }
def foo : scala.Int = { /* compiled code */ }
}
diff --git a/test/files/scalap/traitObject/result.test b/test/files/scalap/traitObject/result.test
index d0521043c8..104ba14f1a 100644
--- a/test/files/scalap/traitObject/result.test
+++ b/test/files/scalap/traitObject/result.test
@@ -1,8 +1,8 @@
-trait TraitObject extends java.lang.Object {
+trait TraitObject extends scala.AnyRef {
def $init$() : scala.Unit = { /* compiled code */ }
def foo : scala.Int = { /* compiled code */ }
}
-object TraitObject extends java.lang.Object {
+object TraitObject extends scala.AnyRef {
def this() = { /* compiled code */ }
def bar : scala.Int = { /* compiled code */ }
}
diff --git a/test/files/scalap/typeAnnotations/result.test b/test/files/scalap/typeAnnotations/result.test
index d28712f12b..407b0235c6 100644
--- a/test/files/scalap/typeAnnotations/result.test
+++ b/test/files/scalap/typeAnnotations/result.test
@@ -1,4 +1,4 @@
-abstract class TypeAnnotations[@scala.specialized R] extends java.lang.Object {
+abstract class TypeAnnotations[@scala.specialized R] extends scala.AnyRef {
def this() = { /* compiled code */ }
@scala.specialized
val x : scala.Int = { /* compiled code */ }
diff --git a/test/files/scalap/valAndVar/result.test b/test/files/scalap/valAndVar/result.test
index 90081acade..e940da9801 100644
--- a/test/files/scalap/valAndVar/result.test
+++ b/test/files/scalap/valAndVar/result.test
@@ -1,4 +1,4 @@
-class ValAndVar extends java.lang.Object {
+class ValAndVar extends scala.AnyRef {
def this() = { /* compiled code */ }
val foo : java.lang.String = { /* compiled code */ }
var bar : scala.Int = { /* compiled code */ }
diff --git a/test/files/scalap/wildcardType/result.test b/test/files/scalap/wildcardType/result.test
index 28147b6605..e43261db32 100644
--- a/test/files/scalap/wildcardType/result.test
+++ b/test/files/scalap/wildcardType/result.test
@@ -1,3 +1,3 @@
-class WildcardType extends java.lang.Object {
+class WildcardType extends scala.AnyRef {
def this(f : scala.Function1[scala.Int, _]) = { /* compiled code */ }
}
diff --git a/test/osgi/src/BasicReflection.scala b/test/osgi/src/BasicReflection.scala
index 8a0a05d531..68fedb7c83 100644
--- a/test/osgi/src/BasicReflection.scala
+++ b/test/osgi/src/BasicReflection.scala
@@ -1,10 +1,10 @@
package tools.test.osgi
package reflection
package basic
-
+
import org.junit.Assert._
import org.ops4j.pax.exam.CoreOptions._
-
+
import org.junit.Test
import org.junit.runner.RunWith
import org.ops4j.pax.exam
@@ -41,15 +41,15 @@ object M
class BasicReflectionTest extends ScalaOsgiHelper {
@Configuration
- def config(): Array[exam.Option] =
+ def config(): Array[exam.Option] =
justReflectionOptions
// Ensure Pax-exam requires C/M in our module
def dummy = {
new C
- M.toString
+ M.toString
}
-
+
@Test
def basicMirrorThroughOsgi(): Unit = {
// Note for now just assert that we can do this stuff.
@@ -57,10 +57,10 @@ class BasicReflectionTest extends ScalaOsgiHelper {
val cm = runtimeMirror(classOf[C].getClassLoader)
val im = cm.reflect(new C)
assertEquals("Unable to reflect field name!",
- "value f1",
- im.reflectField(typeOf[C].member(newTermName("f1")).asTerm).symbol.toString)
+ "value f1",
+ im.reflectField(typeOf[C].member(TermName("f1")).asTerm).symbol.toString)
assertEquals("Unable to reflect value!",
- 2,
- im.reflectField(typeOf[C].member(newTermName("f1")).asTerm).get)
+ 2,
+ im.reflectField(typeOf[C].member(TermName("f1")).asTerm).get)
}
}
diff --git a/test/pending/run/hk-lub-fail.scala b/test/pending/run/hk-lub-fail.scala
index b58a86ee75..0ac4fdd841 100644
--- a/test/pending/run/hk-lub-fail.scala
+++ b/test/pending/run/hk-lub-fail.scala
@@ -25,12 +25,12 @@ object Test {
// A repl session to get you started.
/*
- val quux1 = EmptyPackageClass.tpe.member(newTermName("Quux1"))
- val quux2 = EmptyPackageClass.tpe.member(newTermName("Quux2"))
+ val quux1 = EmptyPackageClass.tpe.member(TermName("Quux1"))
+ val quux2 = EmptyPackageClass.tpe.member(TermName("Quux2"))
val tps = List(quux1, quux2) map (_.tpe)
- val test = EmptyPackageClass.tpe.member(newTermName("Test"))
- val f = test.tpe.member(newTypeName("F")).tpe
-
+ val test = EmptyPackageClass.tpe.member(TermName("Test"))
+ val f = test.tpe.member(TypeName("F")).tpe
+
val fn = f.normalize.asInstanceOf[ExistentialType]
val fn2 = fn.underlying.asInstanceOf[TypeRef]
*/
diff --git a/test/pending/run/macro-expand-default/Impls_1.scala b/test/pending/run/macro-expand-default/Impls_1.scala
index 7cf8d59c75..bb55f02ab2 100644
--- a/test/pending/run/macro-expand-default/Impls_1.scala
+++ b/test/pending/run/macro-expand-default/Impls_1.scala
@@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = {
import c.universe._
- val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree))
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum))
+ val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala
index be00fd0d8a..eed68280cd 100644
--- a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala
+++ b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala
@@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = {
import c.universe._
- val plusOne = Apply(Select(evidence.tree, newTermName("plus")), List(x.tree, Literal(Constant(1))))
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusOne))
+ val plusOne = Apply(Select(evidence.tree, TermName("plus")), List(x.tree, Literal(Constant(1))))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(plusOne))
Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/pending/run/macro-expand-named/Impls_1.scala b/test/pending/run/macro-expand-named/Impls_1.scala
index 7cf8d59c75..bb55f02ab2 100644
--- a/test/pending/run/macro-expand-named/Impls_1.scala
+++ b/test/pending/run/macro-expand-named/Impls_1.scala
@@ -3,8 +3,8 @@ import scala.reflect.macros.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = {
import c.universe._
- val sum = Apply(Select(x.tree, newTermName("$minus")), List(y.tree))
- val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum))
+ val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree))
+ val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
Expr[Unit](body)
}
} \ No newline at end of file
diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
index 26de70cc12..487ac79673 100644
--- a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
+++ b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
@@ -4,9 +4,9 @@ object Impls {
def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(())))
}
} \ No newline at end of file
diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
index 26de70cc12..487ac79673 100644
--- a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
+++ b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
@@ -4,9 +4,9 @@ object Impls {
def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
Block(List(
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(T.toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
- Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant(V.toString))))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(implicitly[c.WeakTypeTag[U]].toString)))),
+ Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(V.toString))))),
Literal(Constant(())))
}
} \ No newline at end of file
diff --git a/test/pending/run/macro-reify-tagless-b/Test_2.scala b/test/pending/run/macro-reify-tagless-b/Test_2.scala
index 10487b1515..09ca6ba30e 100644
--- a/test/pending/run/macro-reify-tagless-b/Test_2.scala
+++ b/test/pending/run/macro-reify-tagless-b/Test_2.scala
@@ -6,8 +6,8 @@ object Test extends App {
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass)))
- val rhs = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant("hello world"))))
- val list = ValDef(NoMods, newTermName("list"), tpt, rhs)
- val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name))))
+ val rhs = Apply(Select(Ident(TermName("Macros")), TermName("foo")), List(Literal(Constant("hello world"))))
+ val list = ValDef(NoMods, TermName("list"), tpt, rhs)
+ val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Ident(list.name))))
println(cm.mkToolBox().eval(tree))
}
diff --git a/test/pending/run/t5427a.scala b/test/pending/run/t5427a.scala
index f7cd05158d..a7d20922db 100644
--- a/test/pending/run/t5427a.scala
+++ b/test/pending/run/t5427a.scala
@@ -4,7 +4,7 @@ object Foo { val bar = 2 }
object Test extends App {
val tpe = getType(Foo)
- val bar = tpe.nonPrivateMember(newTermName("bar"))
+ val bar = tpe.nonPrivateMember(TermName("bar"))
val value = getValue(Foo, bar)
println(value)
} \ No newline at end of file
diff --git a/test/pending/run/t5427b.scala b/test/pending/run/t5427b.scala
index e80bd12369..af1ae6ea2f 100644
--- a/test/pending/run/t5427b.scala
+++ b/test/pending/run/t5427b.scala
@@ -5,7 +5,7 @@ class Foo { val bar = 2 }
object Test extends App {
val foo = new Foo
val tpe = getType(foo)
- val bar = tpe.nonPrivateMember(newTermName("bar"))
+ val bar = tpe.nonPrivateMember(TermName("bar"))
val value = getValue(foo, bar)
println(value)
} \ No newline at end of file
diff --git a/test/pending/run/t5427c.scala b/test/pending/run/t5427c.scala
index 7095158e85..ba71803080 100644
--- a/test/pending/run/t5427c.scala
+++ b/test/pending/run/t5427c.scala
@@ -5,7 +5,7 @@ class Foo(bar: Int)
object Test extends App {
val foo = new Foo(2)
val tpe = getType(foo)
- val bar = tpe.nonPrivateMember(newTermName("bar"))
+ val bar = tpe.nonPrivateMember(TermName("bar"))
bar match {
case NoSymbol => println("no public member")
case _ => println("i'm screwed")
diff --git a/test/pending/run/t5427d.scala b/test/pending/run/t5427d.scala
index f0cc07d27e..1d37dbdde3 100644
--- a/test/pending/run/t5427d.scala
+++ b/test/pending/run/t5427d.scala
@@ -5,7 +5,7 @@ class Foo(val bar: Int)
object Test extends App {
val foo = new Foo(2)
val tpe = getType(foo)
- val bar = tpe.nonPrivateMember(newTermName("bar"))
+ val bar = tpe.nonPrivateMember(TermName("bar"))
val value = getValue(foo, bar)
println(value)
} \ No newline at end of file