on master help sign in
Localize types from the current module as well
commit76a0954615372d4988b3da7904f9f61363cafe66 authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 18 Apr 2018, 14:37 (9 years ago) parent117100e
2 files changed+11−7
compiler/src/Compile.hs+7−3 compiler/src/Reporting/Render/Type/Localizer.hs+4−4
compiler/src/Compile.hs+7−3
@@ -89,12 +89,16 @@ compile flag pkg importDict interfaces source =
8989runTypeInference :: [Src.Import] -> Can.Module -> Result i (Map.Map N.Name Can.Annotation)
9090runTypeInference imports canonical =
9191 case unsafePerformIO (Type.run =<< Type.constrain canonical) of
92− Left errors ->
93− Result.throw (Error.Type (L.fromImports imports) errors)
94−
9592 Right annotations ->
9693 Result.ok annotations
9794
95+ Left errors ->
96+ let
97+ localizer =
98+ L.fromImports (ModuleName._module (Can._name canonical)) imports
99+ in
100+ Result.throw (Error.Type localizer errors)
101+
98102
99103
100104-- EXHAUSTIVENESS CHECK
compiler/src/Reporting/Render/Type/Localizer.hs+4−4
@@ -5,7 +5,6 @@ module Reporting.Render.Type.Localizer
55 , toDoc
66 , empty
77 , fromImports
8−
98 )
109 where
1110
@@ -71,9 +70,10 @@ toDoc (Localizer localizer) home name =
7170-- MAKE
7271
7372
74−fromImports :: [Src.Import] -> Localizer
75−fromImports imports =
76− Localizer $ Map.fromList (map toPair imports)
73+fromImports :: N.Name -> [Src.Import] -> Localizer
74+fromImports self imports =
75+ Localizer $ Map.fromList $
76+ (self, Import Nothing All) : map toPair imports
7777
7878
7979toPair :: Src.Import -> (N.Name, Import)