diff --git a/documentation/src/reference/ReferencePart.tex b/documentation/src/reference/ReferencePart.tex index 6ca419ff3..43e1550bf 100644 --- a/documentation/src/reference/ReferencePart.tex +++ b/documentation/src/reference/ReferencePart.tex @@ -6120,86 +6120,6 @@ \section{Context Bounds and View Bounds}\label{sec:context-bounds} def <= [B >: A <% Ordered[B]](that: B): Boolean \end{lstlisting} -\section{Manifests}\label{sec:manifests} - -\newcommand{\Mobj}{\mbox{\sl Mobj}} - -Manifests are type descriptors that can be automatically generated by -the Scala compiler as arguments to implicit parameters. The Scala -standard library contains a hierarchy of four manifest classes, -with \lstinline@OptManifest@ -at the top. Their signatures follow the outline below. -\begin{lstlisting} -trait OptManifest[+T] -object NoManifest extends OptManifest[Nothing] -trait ClassManifest[T] extends OptManifest[T] -trait Manifest[T] extends ClassManifest[T] -\end{lstlisting} - -If an implicit parameter of a method or constructor is of a subtype $M[T]$ of -class \lstinline@OptManifest[T]@, {\em a manifest is determined for $M[S]$}, -according to the following rules. - -First if there is already an implicit argument that matches $M[T]$, this -argument is selected. - -Otherwise, let $\Mobj$ be the companion object \lstinline@scala.reflect.Manifest@ -if $M$ is trait \lstinline@Manifest@, or be -the companion object \lstinline@scala.reflect.ClassManifest@ otherwise. Let $M'$ be the trait -\lstinline@Manifest@ if $M$ is trait \lstinline@Manifest@, or be the trait \lstinline@OptManifest@ otherwise. -Then the following rules apply. - - -\begin{enumerate} -\item -If $T$ is a value class or one of the classes \lstinline@Any@, \lstinline@AnyVal@, \lstinline@Object@, -\lstinline@Null@, or \lstinline@Nothing@, -a manifest for it is generated by selecting -the corresponding manifest value \lstinline@Manifest.$T$@, which exists in the -\lstinline@Manifest@ module. -\item -If $T$ is an instance of \lstinline@Array[$S$]@, a manifest is generated -with the invocation \lstinline@$\Mobj$.arrayType[S](m)@, where $m$ is the manifest -determined for $M[S]$. -\item -If $T$ is some other class type $S\#C[U_1 \commadots U_n]$ where the prefix type $S$ -cannot be statically determined from the class $C$, -a manifest is generated -with the invocation \lstinline@$\Mobj$.classType[T]($m_0$, classOf[T], $ms$)@ -where $m_0$ is the manifest determined for $M'[S]$ and $ms$ are the -manifests determined for $M'[U_1] \commadots M'[U_n]$. -\item -If $T$ is some other class type with type arguments $U_1 \commadots U_n$, -a manifest is generated -with the invocation \lstinline@$\Mobj$.classType[T](classOf[T], $ms$)@ -where $ms$ are the -manifests determined for $M'[U_1] \commadots M'[U_n]$. -\item -If $T$ is a singleton type ~\lstinline@$p$.type@, a manifest is generated with -the invocation -\lstinline@$\Mobj$.singleType[T]($p$)@ -\item -If $T$ is a refined type $T' \{ R \}$, a manifest is generated for $T'$. -(That is, refinements are never reflected in manifests). -\item -If $T$ is an intersection type -\lstinline@$T_1$ with $\commadots$ with $T_n$@ -where $n > 1$, the result depends on whether a full manifest is -to be determined or not. -If $M$ is trait \lstinline@Manifest@, then -a manifest is generated with the invocation -\lstinline@Manifest.intersectionType[T]($ms$)@ where $ms$ are the manifests -determined for $M[T_1] \commadots M[T_n]$. -Otherwise, if $M$ is trait \lstinline@ClassManifest@, -then a manifest is generated for the intersection dominator -(\sref{sec:erasure}) -of the types $T_1 \commadots T_n$. -\item -If $T$ is some other type, then if $M$ is trait \lstinline@OptManifest@, -a manifest is generated from the designator \lstinline@scala.reflect.NoManifest@. -If $M$ is a type different from \lstinline@OptManifest@, a static error results. -\end{enumerate} - \chapter{Pattern Matching} \section{Patterns} @@ -8204,19 +8124,6 @@ \section{The \large{\code{Predef}} Object}\label{cls:predef} val Map = collection.immutable.Map val Set = collection.immutable.Set - // Manifest types, companions, and incantations for summoning --------- - - type ClassManifest[T] = scala.reflect.ClassManifest[T] - type Manifest[T] = scala.reflect.Manifest[T] - type OptManifest[T] = scala.reflect.OptManifest[T] - val ClassManifest = scala.reflect.ClassManifest - val Manifest = scala.reflect.Manifest - val NoManifest = scala.reflect.NoManifest - - def manifest[T](implicit m: Manifest[T]) = m - def classManifest[T](implicit m: ClassManifest[T]) = m - def optManifest[T](implicit m: OptManifest[T]) = m - // Minor variations on identity functions ----------------------------- def identity[A](x: A): A = x // @see `conforms` for the implicit version def implicitly[T](implicit e: T) = e // for summoning implicit values from the nether world