@@ -118,29 +118,26 @@ addVars module_ (Env.Env home vars types patterns binops) =
118 return $ Env.Env home newVars types patterns binops
118 return $ Env.Env home newVars types patterns binops
121−addVarsHelp :: Map.Map N.Name () -> Map.Map N.Name Env.VarHomes -> Map.Map N.Name Env.VarHomes
121+addVarsHelp :: Map.Map N.Name R.Region -> Map.Map N.Name Env.VarHomes -> Map.Map N.Name Env.VarHomes
122addVarsHelp localVars vars =
122addVarsHelp localVars vars =
124− varHomes =
124+ addLeft _ region =
125− Env.VarHomes Env.TopLevel Map.empty
125+ Env.VarHomes (Env.TopLevel region) Map.empty
130− addBoth _ _ (Env.VarHomes _ qualified) =
127+ addBoth _ region (Env.VarHomes _ qualified) =
131− Env.VarHomes Env.TopLevel qualified
128+ Env.VarHomes (Env.TopLevel region) qualified
133 merge addLeft addBoth localVars vars
130 merge addLeft addBoth localVars vars
136−collectLowerVars :: Valid.Module -> Result i (Map.Map N.Name ())
133+collectLowerVars :: Valid.Module -> Result i (Map.Map N.Name R.Region)
137collectLowerVars (Valid.Module _ _ _ _ _ decls _ _ _ effects) =
134collectLowerVars (Valid.Module _ _ _ _ _ decls _ _ _ effects) =
139 addDecl (A.At _ (Valid.Decl (A.At region name) _ _ _)) dict =
136 addDecl (A.At _ (Valid.Decl (A.At region name) _ _ _)) dict =
140− Dups.insert name region () dict
137+ Dups.insert name region region dict
142 addPort (Valid.Port (A.At region name) _) dict =
139 addPort (Valid.Port (A.At region name) _) dict =
143− Dups.insert name region () dict
140+ Dups.insert name region region dict
145 effectDict =
142 effectDict =
146 case effects of
143 case effects of
@@ -153,32 +150,32 @@ collectLowerVars (Valid.Module _ _ _ _ _ decls _ _ _ effects) =
153 Valid.Manager _ manager ->
150 Valid.Manager _ manager ->
154 case manager of
151 case manager of
155 Valid.Cmd (A.At region _) ->
152 Valid.Cmd (A.At region _) ->
156− Dups.one "command" region ()
153+ Dups.one "command" region region
158 Valid.Sub (A.At region _) ->
155 Valid.Sub (A.At region _) ->
159− Dups.one "subscription" region ()
156+ Dups.one "subscription" region region
161 Valid.Fx (A.At regionCmd _) (A.At regionSub _) ->
158 Valid.Fx (A.At regionCmd _) (A.At regionSub _) ->
162 Dups.union
159 Dups.union
163− (Dups.one "command" regionCmd ())
160+ (Dups.one "command" regionCmd regionCmd)
164− (Dups.one "subscription" regionSub ())
161+ (Dups.one "subscription" regionSub regionSub)
166 Dups.detect Error.DuplicateDecl $ foldr addDecl effectDict decls
163 Dups.detect Error.DuplicateDecl $ foldr addDecl effectDict decls
169−collectUpperVars :: Valid.Module -> Result i (Map.Map N.Name ())
166+collectUpperVars :: Valid.Module -> Result i (Map.Map N.Name R.Region)
170collectUpperVars (Valid.Module _ _ _ _ _ _ unions aliases _ _) =
167collectUpperVars (Valid.Module _ _ _ _ _ _ unions aliases _ _) =
172 addUnion (Valid.Union _ _ ctors) dict =
169 addUnion (Valid.Union _ _ ctors) dict =
173 foldr addCtor dict ctors
170 foldr addCtor dict ctors
175 addCtor (A.At region name, _args) dict =
172 addCtor (A.At region name, _args) dict =
176− Dups.insert name region () dict
173+ Dups.insert name region region dict
178 addAlias (Valid.Alias (A.At region name) _ (A.At _ tipe)) dict =
175 addAlias (Valid.Alias (A.At region name) _ (A.At _ tipe)) dict =
179 case tipe of
176 case tipe of
180 Src.TRecord _ Nothing ->
177 Src.TRecord _ Nothing ->
181− Dups.insert name region () dict
178+ Dups.insert name region region dict