File tree 1 file changed +13
-1
lines changed
ghcide/src/Development/IDE/Core 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -731,7 +731,11 @@ getModSummaryFromImports env fp modTime contents = do
731
731
liftIO $ evaluate $ rnf srcImports
732
732
liftIO $ evaluate $ rnf textualImports
733
733
734
- modLoc <- liftIO $ mkHomeModLocation dflags mod fp
734
+ modLoc <- liftIO $ if mod == mAIN_NAME
735
+ -- specially in tests it's common to have lots of nameless modules
736
+ -- mkHomeModLocation will map them to the same hi/hie locations
737
+ then mkHomeModLocation dflags (pathToModuleName fp) fp
738
+ else mkHomeModLocation dflags mod fp
735
739
736
740
let modl = mkHomeModule (hscHomeUnit (hscSetFlags dflags env)) mod
737
741
sourceType = if " -boot" `isSuffixOf` takeExtension fp then HsBootFile else HsSrcFile
@@ -994,3 +998,11 @@ lookupName hsc_env mod name = do
994
998
ATcId {tct_id= id } -> return (AnId id )
995
999
_ -> panic " tcRnLookupName'"
996
1000
return res
1001
+
1002
+
1003
+ pathToModuleName :: FilePath -> ModuleName
1004
+ pathToModuleName = mkModuleName . map rep
1005
+ where
1006
+ rep c | isPathSeparator c = ' _'
1007
+ rep ' :' = ' _'
1008
+ rep c = c
You can’t perform that action at this time.
0 commit comments