This commit is contained in:
Andreas Stadelmeier 2024-02-06 00:44:48 +01:00
parent faf7df709a
commit 5433e94aab

View File

@ -48,8 +48,10 @@ List<?> genList() {
\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.
Existential types have to be \textit{unpacked} before they can be used \cite{WildcardsNeedWitnessProtection}.
In Java this is done implicitly.
%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]
@ -139,8 +141,8 @@ it is safe to pass \texttt{"String"} for the first parameter of the function.
The constraints representing this code snippet are:
\begin{displaymath}
\type{String} \lessdot \wtv{a},\,
\wctype{\wildcard{X}{\type{Object}}{\type{String}}}{List}{\rwildcard{X}} \lessdot \exptype{List}{\wtv{a}}
\type{String} \lessdotCC \wtv{a},\,
\wctype{\wildcard{X}{\type{Object}}{\type{String}}}{List}{\rwildcard{X}} \lessdotCC \exptype{List}{\wtv{a}}
\end{displaymath}
Here $\sigma(\tv{a}) = \rwildcard{X}$ is a valid solution.