diff --git a/introduction.tex b/introduction.tex index eb91626..5332f5e 100644 --- a/introduction.tex +++ b/introduction.tex @@ -17,13 +17,35 @@ List ls = emptyList(); Local type inference \cite{javaTIisBroken} is able to find a type substitution $\sigma$ satisfying $\overline{\type{A} <: \sigma(\type{F}) }, \sigma(\type{R}) <: \type{E}$. +It is important that $\overline{\type{A}}$ and $\type{E}$ are given types and do not contain +type placeholders already used in $\overline{\type{F}}$. The type parameters are not allowed on the left side of $A <: F$ We can generate method calls where this is the case. The second call to \texttt{get}. +Local type inference is based on matching and not unification. +When calling the \texttt{emptyList} method without context its return value will be set to a \texttt{List}. +The following Java code snippet is incorrect, because \texttt{emptyList()} returns +a \texttt{List} instead of the required \texttt{List}. \begin{verbatim} -emptyList().get(0).get(0); +emptyList().add(new List()) + .get(0) + .get(0); \end{verbatim} +%List <. A +%List <: List, B <: List +% B = A and therefore A on the left and right side of constraints. +% this makes matching impossible + +\begin{verbatim} +this.>emptyList().add(new List()) + .get(0) + .get(0); +\end{verbatim} + +Local type inference cannot deal with type inference during the algorithm. +If the left side contains unknown type parameters. + \begin{verbatim} import java.util.ArrayList;