Section 7.2 shows an example of type notes caused by errors. Below, we show an example of polymorphic use of a variable. When compiling with optimization, the following type notes are produced. However, the program always executes correctly because the types of a and b will always match at run time. The type inference system prints out type warning messages when it failed to discover any type for a variable.
Type waring messages usually indicate errors in user programs.
Because the method add is not defined for the integer class, the type inference system produces a string of messages when compiling with optimization on. Type warnings are usually accompanied by type notes as in the above example. Because the type inference system performs global flow analysis, a single error in the user program can propagate to several places and cause multiple warning messages to be printed, as shown by the above example. The type inference system does not track down the exact origin of each type error. However, information is provided for programmers to track down errors manually, as explained in the next section.