Start let insert example

This commit is contained in:
Andreas Stadelmeier 2024-01-31 18:05:22 +01:00
parent 8e3707b9a6
commit 921adc85b1

View File

@ -45,7 +45,30 @@ List<?> genList() {
\end{subfigure}
%\caption{Example code}
%\label{fig:intro-example-code}
\end{figure}
\end{figure}
In \cite{WildcardsNeedWitnessProtection} existential types have to be \textit{unpacked} before they can be used.
Our type inference algorithm has to add let statements surrounding method invocations.
\begin{figure}[tp]
\begin{subfigure}[t]{0.49\linewidth}
\begin{lstlisting}[style=fgj]
List<? super Integer> ls = ...;
ls.add(new Integer());
\end{lstlisting}
\caption{Method invocation}
\label{fig:intro-example-typeless}
\end{subfigure}
~
\begin{subfigure}[t]{0.49\linewidth}
\begin{lstlisting}[style=tfgj]
List<? super Integer> ls = ...;
ls.add(new Integer());
\end{lstlisting}
\caption{Capture Conversion by \texttt{let}-statement}
\label{fig:intro-example-typed}
\end{subfigure}
\end{figure}
% \subsection{Wildcards}
% Java subtyping involving generics is invariant.