The type inference should work.
Check types and constant types are resolved.
Type inference can detect loops.

Removed log messages.
Filter out parameters from emitted function variables.