Fix
This commit is contained in:
parent
1fd7c56391
commit
ed8895f0b5
@ -209,7 +209,7 @@ Therefore calling the method \texttt{concat} with two wildcard lists in the exam
|
||||
% of the \texttt{concat} function with \texttt{?}.
|
||||
|
||||
\begin{figure}
|
||||
\begin{lstlisting}[caption=Concat Example,label=lst:concatError]{java}
|
||||
\begin{lstlisting}[caption=Wildcard Example with faulty call to a concat method,label=lst:concatError]{java}
|
||||
<X> List<X> concat(List<X> l1, List<X> l2){
|
||||
return l1.addAll(l2);
|
||||
}
|
||||
@ -219,9 +219,9 @@ List<String> ls = new List<String>();
|
||||
List<?> l1 = ls;
|
||||
List<?> l2 = new List<Integer>(1);
|
||||
|
||||
concat(l1, l2);
|
||||
concat(l1, l2); // Error! this would add an Integer to a List of Strings
|
||||
\end{lstlisting}
|
||||
\begin{lstlisting}[style=TamedFJ,caption=\TamedFJ{} representation, label=lst:concatTamedFJ]
|
||||
\begin{lstlisting}[style=TamedFJ,caption=\TamedFJ{} representation of the concat call, label=lst:concatTamedFJ]
|
||||
let l1' : (*@$\wctype{\rwildcard{X}}{List}{\exptype{List}{\rwildcard{X}}}$@*) = l1 in
|
||||
let l2' : (*@$\wctype{\rwildcard{Y}}{List}{\exptype{List}{\rwildcard{Y}}}$@*) = l2 in
|
||||
concat(l1', l2') // Error!
|
||||
|
Loading…
Reference in New Issue
Block a user