moved more type resolution logic from backend to runtime