@@ -409,12 +409,18 @@ toSrcType var =
409 Record1 tfields extension -> do
409 Record1 tfields extension -> do
410 fields' <- traverse (mapM toSrcType) tfields
410 fields' <- traverse (mapM toSrcType) tfields
411 let fields = concat [ map ((,) name) ts | (name,ts) <- Map.toList fields' ]
411 let fields = concat [ map ((,) name) ts | (name,ts) <- Map.toList fields' ]
412− ext' <- toSrcType extension
412+ ext' <- dealias <$> toSrcType extension
413 return $ case ext' of
413 return $ case ext' of
414 T.Record fs ext -> T.Record (fs ++ fields) ext
414 T.Record fs ext -> T.Record (fs ++ fields) ext
415 T.Var _ -> T.Record fields (Just ext')
415 T.Var _ -> T.Record fields (Just ext')
416 _ -> error "Used toSrcType on a type that is not well-formed"
416 _ -> error "Used toSrcType on a type that is not well-formed"
418+ dealias :: T.CanonicalType -> T.CanonicalType
421+ T.Aliased _ t' -> t'
419data AppStructure = List Variable | Tuple [Variable] | Other
425data AppStructure = List Variable | Tuple [Variable] | Other