on master help sign in
Make sure all interfaces are loaded for --debug metadata

Fix https://github.com/elm/compiler/issues/1712

commit567319539c0688b0400c89de339c6f9466b26a49 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 25 May 2018, 00:30 (8 years ago) parent4798ce7
1 file changed+23−7
builder/src/Generate/Output.hs+23−7
builder/src/Generate/Output.hs+23−7
@@ -61,7 +61,7 @@ generate
6161 -> Crawl.Result
6262 -> Map.Map Module.Raw Compiler.Artifacts
6363 -> Task.Task ()
64−generate mode target maybeOutput summary graph@(Crawl.Graph args _ _ _ _) artifacts =
64+generate mode target maybeOutput summary graph@(Crawl.Graph args locals _ _ _) artifacts =
6565 case args of
6666 Args.Pkg _ ->
6767 return ()
@@ -72,7 +72,8 @@ generate mode target maybeOutput summary graph@(Crawl.Graph args _ _ _ _) artifa
7272 realMode <-
7373 case mode of
7474 Debug ->
75− return $ Mode.debug target (getInterfaces summary artifacts)
75+ do interfaces <- getInterfaces summary locals artifacts
76+ return $ Mode.debug target interfaces
7677
7778 Dev ->
7879 return $ Mode.dev target
@@ -84,14 +85,29 @@ generate mode target maybeOutput summary graph@(Crawl.Graph args _ _ _ _) artifa
8485 generateMonolith realMode maybeOutput summary objectGraph (name:names)
8586
8687
87−getInterfaces :: Summary.Summary -> Map.Map Module.Raw Compiler.Artifacts -> I.Interfaces
88−getInterfaces (Summary.Summary _ project _ interfaces _) artifacts =
88+getInterfaces
89+ :: Summary.Summary
90+ -> Map.Map Module.Raw a
91+ -> Map.Map Module.Raw Compiler.Artifacts
92+ -> Task.Task I.Interfaces
93+getInterfaces (Summary.Summary root project _ interfaces _) locals artifacts =
8994 let
90− pkg = Project.getName project
95+ pkg =
96+ Project.getName project
97+
9198 addArtifact home (Compiler.Artifacts elmi _ _) ifaces =
92− Map.insert (ModuleName.Canonical pkg home) elmi ifaces
99+ (ModuleName.Canonical pkg home, elmi) : ifaces
100+
101+ addInterface home iface ifaces =
102+ (ModuleName.Canonical pkg home, iface) : ifaces
103+
104+ readInterface home _ =
105+ IO.readBinary (Paths.elmi root home)
93106 in
94− Map.foldrWithKey addArtifact interfaces artifacts
107+ do cached <- Map.traverseWithKey readInterface (Map.difference locals artifacts)
108+ return $
109+ Map.union interfaces $ Map.fromList $
110+ Map.foldrWithKey addInterface (Map.foldrWithKey addArtifact [] artifacts) cached
95111
96112
97113