Fix error messages for index and substring expressions
Added type analysis for append expressions
Fix error messages in compare_types function
Fix type analysis in logic expressions