pub fn resolve_type_ref( r: &TypeRef, types: &HashMap<String, Arc<TypeDecl>>, tys: &Types, ) -> Option<TyId>