-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localise module maps #286
Localise module maps #286
Conversation
(note this is rebased off #285) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Some of the pre-existing type synonyms I find hard to follow and might warrant extra documenting, but it's a minor nit.
main :: IO () | ||
main = do | ||
args <- getArgs | ||
(opts, parsedArgs) <- compileArgs args | ||
case (parsedArgs, action opts) of | ||
(paths, ShowMyVersion) -> do | ||
putStrLn $ "fortran-src version: " ++ showVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(We should have a release guide that instructs updating the version string shown here. I'll start a wiki page later.)
A problem arose in CamFort with the location of declarations being misreported to the wrong file (camfort/camfort#185). It turns out this comes down to the structure of mod file analysis, where all the
use
d modules get their name space inserted into the module map and so it cannot be distinguished whether a variable was declared in this module or an imported one. This PR fixes this by adding information into theNameType
data structure about whether a variable isLocal
orImported
. A module map can then be 'localised' withlocalisedModuleMap
which removes from a mod map any imported declarations. This fixes the bug in CamFort.An accompanying test was added in
ModFileSpec
The
genUniqNameToFilenameMap :: ModFiles -> M.Map F.Name String
applies this localisation.