@@ -409,12 +409,18 @@ toSrcType var =
409409 Record1 tfields extension -> do
410410 fields' <- traverse (mapM toSrcType) tfields
411411 let fields = concat [ map ((,) name) ts | (name,ts) <- Map.toList fields' ]
412− ext' <- toSrcType extension
412+ ext' <- dealias <$> toSrcType extension
413413 return $ case ext' of
414414 T.Record fs ext -> T.Record (fs ++ fields) ext
415415 T.Var _ -> T.Record fields (Just ext')
416416 _ -> error "Used toSrcType on a type that is not well-formed"
417417
418+ dealias :: T.CanonicalType -> T.CanonicalType
419+ dealias t =
420+ case t of
421+ T.Aliased _ t' -> t'
422+ _ -> t
423+
418424
419425data AppStructure = List Variable | Tuple [Variable] | Other
420426