Verified Commit 5aea4e31 authored by Camil Staps's avatar Camil Staps 🙂

Fix usages of types used in type synonyms

parent 38469bb7
......@@ -237,7 +237,6 @@ isBuiltin :: !Location -> Bool
toTypeDefEntry :: !Location !TypeDef !(Maybe TypeDoc) -> TypeDefEntry
getTypeDef :: !TypeDefEntry -> TypeDef
getTypeDefRhs :: !TypeDefEntry -> TypeDefRhs
getTypeDefDoc :: !TypeDefEntry -> Maybe TypeDoc
mergeTypeDefEntries :: !TypeDefEntry !TypeDefEntry -> TypeDefEntry
......
......@@ -196,9 +196,6 @@ toTypeDefEntry loc td doc =
getTypeDef :: !TypeDefEntry -> TypeDef
getTypeDef {tde_typedef} = tde_typedef
getTypeDefRhs :: !TypeDefEntry -> TypeDefRhs
getTypeDefRhs {tde_typedef} = tde_typedef.td_rhs
getTypeDefDoc :: !TypeDefEntry -> Maybe TypeDoc
getTypeDefDoc {tde_doc} = tde_doc
......
......@@ -178,7 +178,7 @@ finaliseDB extra tdb =
, syntax = idxarr \e -> e=:(SyntaxEntry _)
, abc_instrs = idxarr \e -> e=:(ABCInstructionEntry _)
, type_synonyms = idxarr \e -> case e of
TypeDefEntry tde -> ('Cloogle.DB'.getTypeDefRhs tde)=:('Clean.Types'.TDRSynonym _)
TypeDefEntry tde -> ('Clean.Types'.td_rhs ('Cloogle.DB'.getTypeDef tde))=:('Clean.Types'.TDRSynonym _)
_ -> False
, library_map = libmap
, module_map = modmap
......@@ -249,7 +249,18 @@ where
o flatten
type_usages_map = make_usage_map
[[(t,idx) \\ 'Clean.Types'.Type t _ <- 'Clean.Types'.subtypes t] \\ (idx,FunctionEntry {fe_type=Just t}) <- entridxs]
[[(subt,idx) \\ t <- usingTypes e, 'Clean.Types'.Type subt _ <- 'Clean.Types'.subtypes t] \\ (idx,e) <- entridxs]
where
usingTypes :: !CloogleEntry -> ['Clean.Types'.Type]
usingTypes (FunctionEntry {fe_type=Just t}) = [t]
usingTypes (TypeDefEntry tde) = typesOfRhs ('Clean.Types'.td_rhs ('Cloogle.DB'.getTypeDef tde))
where
typesOfRhs rhs = case rhs of
'Clean.Types'.TDRSynonym t -> [t]
'Clean.Types'.TDRAbstract (Just rhs) -> typesOfRhs rhs
'Clean.Types'.TDRAbstractSynonym t -> [t]
_ -> [] // constructors and selectors are taken care of by FunctionEntry
usingTypes _ = []
class_usages_map = make_usage_map
[[(cls,idx) \\ 'Clean.Types'.Instance cls _ <- context e] \\ (idx,e) <- entridxs]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment