function analyze_type