summaryrefslogtreecommitdiff
path: root/src/library/scala/reflect/base/TagInterop.scala
blob: e989631abf30cdf19190497f390d39756b4473fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package scala.reflect
package base

import scala.runtime.ScalaRunTime._

trait TagInterop { self: Universe =>
  // TODO `mirror` parameters are now of type `Any`, because I can't make these path-dependent types work
  // if you're brave enough, replace `Any` with `Mirror`, recompile and run interop_typetags_are_manifests.scala

  /**
   * Convert a typetag to a pre `Scala-2.10` manifest.
   * For example
   * {{{
   * typeTagToManifest( scala.reflect.runtime.currentMirror, implicitly[TypeTag[String]] )
   * }}}
   */
  def typeTagToManifest[T: ClassTag](mirror: Any, tag: base.Universe # TypeTag[T]): Manifest[T] =
    throw new UnsupportedOperationException("This universe does not support tag -> manifest conversions. Use scala.reflect.runtime.universe from scala-reflect.jar.")

  /**
   * Convert a pre `Scala-2.10` manifest to a typetag.
   * For example
   * {{{
   * manifestToTypeTag( scala.reflect.runtime.currentMirror, implicitly[Manifest[String]] )
   * }}}
   */
  def manifestToTypeTag[T](mirror: Any, manifest: Manifest[T]): base.Universe # TypeTag[T] =
    throw new UnsupportedOperationException("This universe does not support manifest -> tag conversions. Use scala.reflect.runtime.universe from scala-reflect.jar.")
}