git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Error when re-exporting a pseudo module with conflicts
commit6492c771a856c17182bbf869a110a54295db44de authorGary Burgess <gary.burgess@gmail.com> dateSat 5 Dec 2015, 23:32 (11 years ago) parente20d299
3 files changed+36−5
examples/failing/ConflictingQualifiedImports.purs+17 examples/failing/ConflictingQualifiedImports2.purs+15 src/Language/PureScript/Sugar/Names/Exports.hs+4−5
examples/failing/ConflictingQualifiedImports.pursnew file+17
@@ -0,0 +1,17 @@
1+-- @shouldFailWith ScopeConflict
2+module A where
3+
4+ thing :: Int
5+ thing = 1
6+
7+module B where
8+
9+ thing :: Int
10+ thing = 2
11+
12+module Main where
13+
14+ import A as X
15+ import B as X
16+
17+ foo = X.thing
examples/failing/ConflictingQualifiedImports2.pursnew file+15
@@ -0,0 +1,15 @@
1+-- @shouldFailWith ScopeConflict
2+module A where
3+
4+ thing :: Int
5+ thing = 1
6+
7+module B where
8+
9+ thing :: Int
10+ thing = 2
11+
12+module Main (module X) where
13+
14+ import A as X
15+ import B as X
src/Language/PureScript/Sugar/Names/Exports.hs+4−5
@@ -115,12 +115,11 @@ resolveExports env mn imps exps refs =
115115 -> (a -> String)
116116 -> M.Map (Qualified a) [(Qualified a, ModuleName)]
117117 -> m [Qualified a]
118− extract useQual name render = fmap (map (fst . head . snd)) . go useQual . M.toList
118+ extract useQual name render = fmap (map (fst . head . snd)) . go . M.toList
119119 where
120− go True = filterM (return . eqQual name . fst)
121− go False = filterM $ \(_, options) -> do
122− let isMatch = any (eqQual name . fst) options
123− when (length options > 1) $ checkImportConflicts render options
120+ go = filterM $ \(name', options) -> do
121+ let isMatch = if useQual then eqQual name name' else any (eqQual name . fst) options
122+ when (isMatch && length options > 1) $ checkImportConflicts render options
124123 return isMatch
125124
126125 -- Check whether a module name refers to a "pseudo module" that came into