Permalink
Browse files

removes tags and their incantations from Predef

All tags and reflection-related stuff requires a prefix,
be it scala.reflect for simple tags (ArrayTags and ClassTags),
or scala.reflect.basis/scala.reflect.runtime.universe for type tags.
  • Loading branch information...
xeno-by committed Jun 6, 2012
1 parent 252a448 commit bdff66e2730518f449634375b1f3d19689d72b1e
Showing with 48 additions and 24 deletions.
  1. +1 −0 src/compiler/scala/tools/nsc/Global.scala
  2. +1 −0 src/compiler/scala/tools/nsc/interpreter/ILoop.scala
  3. +1 −0 src/compiler/scala/tools/nsc/interpreter/IMain.scala
  4. +1 −0 src/compiler/scala/tools/nsc/interpreter/NamedParam.scala
  5. +1 −0 src/compiler/scala/tools/nsc/interpreter/Power.scala
  6. +2 −0 src/compiler/scala/tools/nsc/interpreter/RichClass.scala
  7. +1 −0 src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala
  8. +1 −0 src/compiler/scala/tools/nsc/io/Pickler.scala
  9. +1 −0 src/compiler/scala/tools/nsc/settings/MutableSettings.scala
  10. +1 −0 src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
  11. +1 −0 src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
  12. +1 −0 src/compiler/scala/tools/nsc/util/ClassPath.scala
  13. +1 −0 src/compiler/scala/tools/nsc/util/Position.scala
  14. +1 −0 src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
  15. +1 −0 src/compiler/scala/tools/reflect/FrontEnds.scala
  16. +1 −0 src/compiler/scala/tools/reflect/StdTags.scala
  17. +0 −18 src/library/scala/Predef.scala
  18. +2 −0 src/library/scala/collection/GenTraversableOnce.scala
  19. +1 −0 src/library/scala/collection/TraversableOnce.scala
  20. +1 −0 src/library/scala/collection/TraversableProxyLike.scala
  21. +1 −0 src/library/scala/collection/generic/ArrayTagTraversableFactory.scala
  22. +1 −0 src/library/scala/collection/generic/GenericArrayTagCompanion.scala
  23. +1 −0 src/library/scala/collection/generic/GenericArrayTagTraversableTemplate.scala
  24. +1 −0 src/library/scala/collection/generic/TraversableForwarder.scala
  25. +1 −0 src/library/scala/collection/immutable/PagedSeq.scala
  26. +1 −0 src/library/scala/collection/immutable/StringLike.scala
  27. +1 −1 src/library/scala/collection/mutable/ArrayOps.scala
  28. +1 −0 src/library/scala/collection/mutable/ArrayStack.scala
  29. +1 −0 src/library/scala/collection/mutable/UnrolledBuffer.scala
  30. +1 −1 src/library/scala/collection/mutable/WrappedArray.scala
  31. +1 −0 src/library/scala/collection/parallel/ParIterableLike.scala
  32. +1 −1 src/library/scala/collection/parallel/mutable/ParArray.scala
  33. +1 −1 src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala
  34. +1 −0 src/library/scala/concurrent/Future.scala
  35. +1 −1 src/library/scala/reflect/makro/Universe.scala
  36. +1 −0 src/library/scala/reflect/makro/internal/package.scala
  37. +5 −0 src/library/scala/reflect/package.scala
  38. +1 −0 src/library/scala/runtime/ScalaRunTime.scala
  39. +1 −1 src/library/scala/util/Sorting.scala
  40. +1 −0 src/library/scala/util/control/Exception.scala
  41. +1 −0 src/partest/scala/tools/partest/SigTest.scala
  42. +1 −0 src/scalacheck/org/scalacheck/Arbitrary.scala
  43. +1 −0 src/scalacheck/org/scalacheck/util/Buildable.scala
@@ -30,6 +30,7 @@ import backend.opt.{ Inliners, InlineExceptionHandlers, ClosureElimination, Dead
import backend.icode.analysis._
import language.postfixOps
import reflect.internal.StdAttachments
import scala.reflect.ClassTag
class Global(var currentSettings: Settings, var reporter: Reporter)
extends SymbolTable
@@ -24,6 +24,7 @@ import util.ScalaClassLoader
import ScalaClassLoader._
import scala.tools.util._
import language.{implicitConversions, existentials}
import scala.reflect.{ClassTag, classTag}
import scala.tools.reflect.StdTags._
/** The Scala interactive shell. It provides a read-eval-print loop
@@ -26,6 +26,7 @@ import java.util.concurrent.Future
import typechecker.Analyzer
import language.implicitConversions
import scala.reflect.runtime.{ universe => ru }
import scala.reflect.{ ClassTag, classTag }
import scala.tools.reflect.StdTags._
/** directory to save .class files to */
@@ -9,6 +9,7 @@ package interpreter
import NamedParam._
import language.implicitConversions
import scala.reflect.runtime.{universe => ru}
import scala.reflect.{ClassTag, classTag}
trait NamedParamCreator {
protected def freshName: () => String
@@ -15,6 +15,7 @@ import java.net.{ URL, MalformedURLException }
import io.{ Path }
import language.implicitConversions
import scala.reflect.runtime.{universe => ru}
import scala.reflect.{ClassTag, classTag}
/** Collecting some power mode examples.
@@ -6,6 +6,8 @@
package scala.tools.nsc
package interpreter
import scala.reflect.{ ClassTag, classTag }
class RichClass[T](val clazz: Class[T]) {
def toTag: ClassTag[T] = ClassTag[T](clazz)
def toTypeString: String = TypeStrings.fromClazz(clazz)
@@ -11,6 +11,7 @@ import r.TypeVariable
import scala.reflect.NameTransformer
import NameTransformer._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.{ClassTag, classTag}
import typechecker.DestructureTypes
import scala.tools.util.StringOps.ojoin
@@ -4,6 +4,7 @@ import annotation.unchecked
import Lexer._
import java.io.Writer
import language.implicitConversions
import reflect.ClassTag
/** An abstract class for writing and reading Scala objects to and
* from a legible representation. The presesentation follows the following grammar:
@@ -12,6 +12,7 @@ import io.{ AbstractFile, Path, PlainFile, VirtualDirectory }
import scala.tools.util.StringOps
import scala.collection.mutable.ListBuffer
import scala.io.Source
import scala.reflect.{ ClassTag, classTag }
/** A mutable Settings object.
*/
@@ -8,6 +8,7 @@ package typechecker
import symtab.Flags._
import scala.collection.{ mutable, immutable }
import scala.tools.util.StringOps.{ ojoin }
import scala.reflect.ClassTag
import scala.reflect.runtime.{ universe => ru }
import language.higherKinds
@@ -9,6 +9,7 @@ package typechecker
import symtab.Flags._
import scala.collection.mutable
import scala.ref.WeakReference
import scala.reflect.ArrayTag
/**
* @author Lukas Rytz
@@ -11,6 +11,7 @@ import java.net.URL
import scala.collection.{ mutable, immutable }
import io.{ File, Directory, Path, Jar, AbstractFile }
import scala.tools.util.StringOps.splitWhere
import scala.reflect.ClassTag
import Jar.isJarOrZip
import File.pathSeparator
import java.net.MalformedURLException
@@ -7,6 +7,7 @@
package scala.tools.nsc
package util
import reflect.ClassTag
import reflect.base.Attachments
import reflect.api.PositionApi
@@ -15,6 +15,7 @@ import scala.reflect.runtime.ReflectionUtils.unwrapHandler
import ScalaClassLoader._
import scala.util.control.Exception.{ catching }
import language.implicitConversions
import scala.reflect.{ ClassTag, classTag }
trait HasClassPath {
def classPathURLs: Seq[URL]
@@ -3,6 +3,7 @@ package reflect
import scala.tools.nsc.reporters._
import scala.tools.nsc.Settings
import scala.reflect.ClassTag
trait FrontEnds extends scala.reflect.api.FrontEnds {
@@ -2,6 +2,7 @@ package scala.tools
package reflect
import java.lang.{Class => jClass}
import scala.reflect.{ClassTag, classTag}
import scala.reflect.base.{MirrorOf, TypeCreator, Universe => BaseUniverse}
import scala.reflect.runtime.{universe => ru}
@@ -111,24 +111,6 @@ object Predef extends LowPriorityImplicits {
def classManifest[T](implicit m: ClassManifest[T]) = m
def optManifest[T](implicit m: OptManifest[T]) = m
// Tag types and companions, and incantations for summoning
type ArrayTag[T] = scala.reflect.ArrayTag[T]
type ClassTag[T] = scala.reflect.ClassTag[T]
type TypeTag[T] = scala.reflect.TypeTag[T]
type ConcreteTypeTag[T] = scala.reflect.ConcreteTypeTag[T]
val ClassTag = scala.reflect.ClassTag // doesn't need to be lazy, because it's not a path-dependent type
// [Paul to Eugene] No lazy vals in Predef. Too expensive. Have to work harder on breaking initialization dependencies.
lazy val TypeTag = scala.reflect.TypeTag // needs to be lazy, because requires scala.reflect.mirror instance
lazy val ConcreteTypeTag = scala.reflect.ConcreteTypeTag
// [Eugene to Martin] it's really tedious to type "implicitly[...]" all the time, so I'm reintroducing these shortcuts
def arrayTag[T](implicit atag: ArrayTag[T]) = atag
def classTag[T](implicit ctag: ClassTag[T]) = ctag
def tag[T](implicit ttag: TypeTag[T]) = ttag
def typeTag[T](implicit ttag: TypeTag[T]) = ttag
def concreteTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag
def concreteTypeTag[T](implicit cttag: ConcreteTypeTag[T]) = cttag
// Minor variations on identity functions
def identity[A](x: A): A = x // @see `conforms` for the implicit version
@inline def implicitly[T](implicit e: T) = e // for summoning implicit values from the nether world -- TODO: when dependent method types are on by default, give this result type `e.type`, so that inliner has better chance of knowing which method to inline in calls like `implicitly[MatchingStrategy[Option]].zero`
@@ -8,6 +8,8 @@
package scala.collection
import scala.reflect.ArrayTag
/** A template trait for all traversable-once objects which may be
* traversed in parallel.
*
@@ -11,6 +11,7 @@ package scala.collection
import mutable.{ Buffer, Builder, ListBuffer, ArrayBuffer }
import annotation.unchecked.{ uncheckedVariance => uV }
import language.{implicitConversions, higherKinds}
import reflect.ArrayTag
/** A template trait for collections which can be traversed either once only
* or one or more times.
@@ -12,6 +12,7 @@ package scala.collection
import generic._
import mutable.{Buffer, StringBuilder}
import reflect.ArrayTag
// Methods could be printed by cat TraversableLike.scala | egrep '^ (override )?def'
@@ -10,6 +10,7 @@ package scala.collection
package generic
import language.higherKinds
import reflect.ArrayTag
/** A template for companion objects of `ClassTagTraversable` and
* subclasses thereof.
@@ -11,6 +11,7 @@ package generic
import mutable.Builder
import language.higherKinds
import reflect.ArrayTag
/** This class represents companions of classes which require ArrayTags
* for their element types.
@@ -12,6 +12,7 @@ package generic
import mutable.Builder
import annotation.unchecked.uncheckedVariance
import language.higherKinds
import reflect.ArrayTag
/** This trait represents collections classes which require array
* tags for their element types.
@@ -11,6 +11,7 @@ package scala.collection.generic
import scala.collection._
import mutable.{ Buffer, StringBuilder }
import immutable.{ List, Stream }
import reflect.ArrayTag
/** This trait implements a forwarder for traversable objects. It forwards
* all calls to a different traversable, except for:
@@ -13,6 +13,7 @@ package immutable
import java.io._
import scala.util.matching.Regex
import reflect.ArrayTag
/** The `PagedSeq` object defines a lazy implementations of
* a random access sequence.
@@ -13,6 +13,7 @@ import generic._
import mutable.Builder
import scala.util.matching.Regex
import scala.math.ScalaNumber
import reflect.ArrayTag
/** A companion object for the `StringLike` containing some constants.
* @since 2.8
@@ -12,7 +12,7 @@ package scala.collection
package mutable
import compat.Platform.arraycopy
import scala.reflect.ArrayTag
import scala.reflect.{ArrayTag, ClassTag}
import scala.runtime.ScalaRunTime._
import parallel.mutable.ParArray
@@ -10,6 +10,7 @@ package scala.collection
package mutable
import generic._
import reflect.ArrayTag
/** Factory object for the `ArrayStack` class.
*
@@ -12,6 +12,7 @@ import collection.AbstractIterator
import collection.Iterator
import collection.generic._
import annotation.tailrec
import reflect.ArrayTag
/** A buffer that stores elements in an unrolled linked list.
*
@@ -11,7 +11,7 @@
package scala.collection
package mutable
import scala.reflect.ArrayTag
import scala.reflect.{ArrayTag, ClassTag}
import scala.runtime.ScalaRunTime._
import scala.collection.generic._
import scala.collection.parallel.mutable.ParArray
@@ -24,6 +24,7 @@ import scala.collection.GenIterable
import scala.collection.GenTraversableOnce
import scala.collection.GenTraversable
import immutable.HashMapCombiner
import reflect.{ArrayTag, ClassTag}
import java.util.concurrent.atomic.AtomicBoolean
@@ -26,7 +26,7 @@ import scala.collection.parallel.CHECK_RATE
import scala.collection.mutable.ArraySeq
import scala.collection.mutable.Builder
import scala.collection.GenTraversableOnce
import scala.reflect.ArrayTag
@@ -21,7 +21,7 @@ import scala.collection.parallel.TaskSupport
import scala.collection.parallel.unsupportedop
import scala.collection.parallel.Combiner
import scala.collection.parallel.Task
import scala.reflect.ArrayTag
@@ -25,6 +25,7 @@ import scala.annotation.tailrec
import scala.collection.mutable.Stack
import scala.collection.mutable.Builder
import scala.collection.generic.CanBuildFrom
import scala.reflect.ClassTag
import language.higherKinds
@@ -88,7 +88,7 @@ abstract class Universe extends scala.reflect.api.Universe {
def addAttachment(attachment: Any): this.type
/** ... */
def removeAttachment[T: ClassTag]: this.type
def removeAttachment[T: scala.reflect.ClassTag]: this.type
}
override type SymTree >: Null <: Tree with SymTreeContextApi
@@ -2,6 +2,7 @@ package scala.reflect.makro
import language.experimental.macros
import scala.reflect.base.{Universe => BaseUniverse}
import scala.reflect.{ClassTag, ArrayTag}
// anchors for materialization macros emitted during tag materialization in Implicits.scala
// implementation is magically hardwired into `scala.reflect.reify.Taggers`
@@ -21,6 +21,11 @@ package object reflect extends reflect_compat {
// ArrayTag trait is defined outside the basis
// ClassTag class is defined outside the basis
def arrayTag[T](implicit atag: ArrayTag[T]) = atag
def classTag[T](implicit ctag: ClassTag[T]) = ctag
// typeTag incantation is defined inside the basis
// concreteTypeTag incantation is defined inside the basis
type TypeTag[T] = scala.reflect.basis.TypeTag[T]
type ConcreteTypeTag[T] = scala.reflect.basis.ConcreteTypeTag[T]
@@ -12,6 +12,7 @@ import scala.collection.{ Seq, IndexedSeq, TraversableView, AbstractIterator }
import scala.collection.mutable.WrappedArray
import scala.collection.immutable.{ StringLike, NumericRange, List, Stream, Nil, :: }
import scala.collection.generic.{ Sorted }
import scala.reflect.{ ArrayTag, ClassTag, arrayTag, classTag }
import scala.util.control.ControlThrowable
import scala.xml.{ Node, MetaData }
@@ -8,7 +8,7 @@
package scala.util
import scala.reflect.ClassTag
import scala.reflect.{ ArrayTag, ClassTag }
import scala.math.Ordering
/** The Sorting object provides functions that can sort various kinds of
@@ -9,6 +9,7 @@
package scala.util.control
import collection.immutable.List
import reflect.{ ClassTag, classTag }
import java.lang.reflect.InvocationTargetException
import language.implicitConversions
@@ -8,6 +8,7 @@ package scala.tools.partest
import scala.tools.nsc.Settings
import scala.tools.nsc.interpreter.ILoop
import java.lang.reflect.{ Method => JMethod, Field => JField }
import scala.reflect.{ClassTag, classTag}
/** Support code for testing signatures.
*/
@@ -10,6 +10,7 @@
package org.scalacheck
import util.{FreqMap,Buildable}
import scala.reflect.ClassTag
sealed abstract class Arbitrary[T] {
val arbitrary: Gen[T]
@@ -10,6 +10,7 @@
package org.scalacheck.util
import scala.collection._
import scala.reflect.ClassTag
trait Buildable[T,C[_]] {
def builder: mutable.Builder[T,C[T]]

0 comments on commit bdff66e

Please sign in to comment.