[Refactoring] Simplify the role of inferType function

Move lambda deduction handling code from inferType to deduceType
[Refactoring] inferType
[Refactoring] Add FuncExp::matchType and simplify lambda conversions