A problem arose in CamFort with the location of declarations being misreported to the wrong file (https://github.com/camfort/camfort/issues/185). It turns out this comes down to the structure of mod file analysis, where all the used 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 the NameType data structure about whether a variable is Local or Imported. A module map can then be 'localised' with localisedModuleMap 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.
A problem arose in CamFort with the location of declarations being misreported to the wrong file (https://github.com/camfort/camfort/issues/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 inModFileSpec
The
genUniqNameToFilenameMap :: ModFiles -> M.Map F.Name String
applies this localisation.