Improved input type inference, bug fixing, code simplification

This closes #176
[FLINK-1235] Compiler accepts iterations referenced from the static path of other iterations
 - Fix NepheleJobGraphGenerator to support iterations referenced on the static path of another iteration
 - Catch nested iterations on dynamic path properly in optimizer (and give a good error message)