@@ -1125,43 +1125,44 @@ getModSummaryFromImports env uri _modTime mContents = do
1125
1125
liftIO $ evaluate $ rnf textualImports
1126
1126
1127
1127
1128
- case uriToFilePath' uri of
1129
- Nothing -> do
1130
- let nuri = toNormalizedUri uri
1131
- throwError [ideErrorText nuri $ " Uri is not a file uri: " <> getUri uri]
1132
- Just file -> do
1133
- modLoc <- liftIO $ if mod == mAIN_NAME
1134
- -- specially in tests it's common to have lots of nameless modules
1135
- -- mkHomeModLocation will map them to the same hi/hie locations
1136
- then mkHomeModLocation dflags (pathToModuleName uri) file
1137
- else mkHomeModLocation dflags mod file
1138
-
1139
- let modl = mkHomeModule (hscHomeUnit ppEnv) mod
1140
- sourceType = if " -boot" `isSuffixOf` takeExtension file then HsBootFile else HsSrcFile
1141
- msrModSummary =
1142
- ModSummary
1143
- { ms_mod = modl
1144
- , ms_hie_date = Nothing
1145
- , ms_dyn_obj_date = Nothing
1146
- , ms_ghc_prim_import = ghc_prim_import
1147
- , ms_hs_hash = _src_hash
1148
-
1149
- , ms_hsc_src = sourceType
1150
- -- The contents are used by the GetModSummary rule
1151
- , ms_hspp_buf = Just contents
1152
- , ms_hspp_file = file
1153
- , ms_hspp_opts = dflags
1154
- , ms_iface_date = Nothing
1155
- , ms_location = withBootSuffix sourceType modLoc
1156
- , ms_obj_date = Nothing
1157
- , ms_parsed_mod = Nothing
1158
- , ms_srcimps = srcImports
1159
- , ms_textual_imps = textualImports
1160
- }
1161
-
1162
- msrFingerprint <- liftIO $ computeFingerprint file opts msrModSummary
1163
- msrHscEnv <- liftIO $ Loader. initializePlugins (hscSetFlags (ms_hspp_opts msrModSummary) ppEnv)
1164
- return ModSummaryResult {.. }
1128
+ -- NOTE: thisis pretty bad as it relies on the prepropcessors not actually reading from a file when it's not needed
1129
+ when (isNothing (uriToFilePath' uri) && isNothing mContents) $ do
1130
+ throwError [ideErrorText (toNormalizedUri uri) $ " Uri is not a file uri: " <> getUri uri]
1131
+
1132
+ let file = T. unpack $ getUri uri
1133
+
1134
+ modLoc <- liftIO $ if mod == mAIN_NAME
1135
+ -- specially in tests it's common to have lots of nameless modules
1136
+ -- mkHomeModLocation will map them to the same hi/hie locations
1137
+ then mkHomeModLocation dflags (pathToModuleName uri) file
1138
+ else mkHomeModLocation dflags mod file
1139
+
1140
+ let modl = mkHomeModule (hscHomeUnit ppEnv) mod
1141
+ sourceType = if " -boot" `isSuffixOf` takeExtension file then HsBootFile else HsSrcFile
1142
+ msrModSummary =
1143
+ ModSummary
1144
+ { ms_mod = modl
1145
+ , ms_hie_date = Nothing
1146
+ , ms_dyn_obj_date = Nothing
1147
+ , ms_ghc_prim_import = ghc_prim_import
1148
+ , ms_hs_hash = _src_hash
1149
+
1150
+ , ms_hsc_src = sourceType
1151
+ -- The contents are used by the GetModSummary rule
1152
+ , ms_hspp_buf = Just contents
1153
+ , ms_hspp_file = file
1154
+ , ms_hspp_opts = dflags
1155
+ , ms_iface_date = Nothing
1156
+ , ms_location = withBootSuffix sourceType modLoc
1157
+ , ms_obj_date = Nothing
1158
+ , ms_parsed_mod = Nothing
1159
+ , ms_srcimps = srcImports
1160
+ , ms_textual_imps = textualImports
1161
+ }
1162
+
1163
+ msrFingerprint <- liftIO $ computeFingerprint file opts msrModSummary
1164
+ msrHscEnv <- liftIO $ Loader. initializePlugins (hscSetFlags (ms_hspp_opts msrModSummary) ppEnv)
1165
+ return ModSummaryResult {.. }
1165
1166
where
1166
1167
-- Compute a fingerprint from the contents of `ModSummary`,
1167
1168
-- eliding the timestamps, the preprocessed source and other non relevant fields
0 commit comments