on master help sign in
Fix toSrcType for aliased record extensions
4c7ff93Evan Czaplicki
compiler/Type/Type.hs+7−1
@@ -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"
417
417
418+ dealias :: T.CanonicalType -> T.CanonicalType
419+ dealias t =
420+ case t of
421+ T.Aliased _ t' -> t'
422+ _ -> t
423+
418
424
419data AppStructure = List Variable | Tuple [Variable] | Other
425data AppStructure = List Variable | Tuple [Variable] | Other
420
426