git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Remove qualified keyword, merge #1997
7fcebc8Phil Freeman
examples/failing/OverlappingReExport.purs+1−1
@@ -7,4 +7,4 @@ module B where
7
7
8module C (module A, module M2) where
8module C (module A, module M2) where
9 import A
9 import A
10− import qualified B as M2
10+ import B as M2
examples/passing/AutoPrelude2.purs+1−1
@@ -1,7 +1,7 @@
1module Main where
1module Main where
2
2
3import Prelude
3import Prelude
4−import qualified Prelude as P
4+import Prelude as P
5import Control.Monad.Eff.Console
5import Control.Monad.Eff.Console
6
6
7f :: forall a. a -> a
7f :: forall a. a -> a
examples/passing/ModuleExportQualified.purs+1−1
@@ -3,7 +3,7 @@ module A (module Prelude) where
3
3
4module Main where
4module Main where
5 import Control.Monad.Eff.Console
5 import Control.Monad.Eff.Console
6− import qualified A as B
6+ import A as B
7
7
8 main = do
8 main = do
9 print (B.show 1.0)
9 print (B.show 1.0)
examples/passing/OptionalQualified.purs+1−2
@@ -1,7 +1,6 @@
1module Main where
1module Main where
2
2
3−-- qualified import with the "qualified" keyword
4−import qualified Prelude as P
3+import Prelude as P
5
4
6-- qualified import without the "qualified" keyword
5-- qualified import without the "qualified" keyword
7import Control.Monad.Eff.Console as Console
6import Control.Monad.Eff.Console as Console
examples/passing/QualifiedQualifiedImports.purs+1−1
@@ -1,6 +1,6 @@
1module Main where
1module Main where
2
2
3-- qualified import with qualified imported names
3-- qualified import with qualified imported names
4−import qualified Control.Monad.Eff.Console (log) as Console
4+import Control.Monad.Eff.Console (log) as Console
5
5
6main = Console.log "Success!"
6main = Console.log "Success!"
examples/passing/ReExportQualified.purs+1−1
@@ -6,7 +6,7 @@ module B where
6
6
7module C (module A, module M2) where
7module C (module A, module M2) where
8 import A
8 import A
9− import qualified B as M2
9+ import B as M2
10
10
11module Main where
11module Main where
12
12
psci/PSCi/Completion.hs+2−5
@@ -7,7 +7,6 @@ import Prelude.Compat
7
7
8import Data.Maybe (mapMaybe)
8import Data.Maybe (mapMaybe)
9import Data.List (nub, nubBy, sortBy, isPrefixOf, stripPrefix)
9import Data.List (nub, nubBy, sortBy, isPrefixOf, stripPrefix)
10−import Data.Char (isUpper)
11import Data.Function (on)
10import Data.Function (on)
12
11
13import Control.Arrow (second)
12import Control.Arrow (second)
@@ -87,10 +86,8 @@ directiveArg _ Kind = [CtxType]
87completeImport :: [String] -> String -> [CompletionContext]
86completeImport :: [String] -> String -> [CompletionContext]
88completeImport ws w' =
87completeImport ws w' =
89 case (ws, w') of
88 case (ws, w') of
90− (["import"], w) | headSatisfies isUpper w -> [CtxModule]
91− (["import"], _) -> [CtxModule, CtxFixed "qualified"]
92− (["import", "qualified"], _) -> [CtxModule]
89+ (["import"], _) -> [CtxModule]
93− _ -> []
90+ _ -> []
94
91
95headSatisfies :: (a -> Bool) -> [a] -> Bool
92headSatisfies :: (a -> Bool) -> [a] -> Bool
96headSatisfies p str =
93headSatisfies p str =
psci/PSCi/Module.hs+1−1
@@ -98,7 +98,7 @@ createTemporaryModuleForImports PSCiState{psciImportedModules = imports} =
98 P.Module (P.internalModuleSourceSpan "<internal>") [] moduleName (importDecl `map` imports) Nothing
98 P.Module (P.internalModuleSourceSpan "<internal>") [] moduleName (importDecl `map` imports) Nothing
99
99
100importDecl :: ImportedModule -> P.Declaration
100importDecl :: ImportedModule -> P.Declaration
101−importDecl (mn, declType, asQ) = P.ImportDeclaration mn declType asQ False
101+importDecl (mn, declType, asQ) = P.ImportDeclaration mn declType asQ
102
102
103indexFile :: FilePath
103indexFile :: FilePath
104indexFile = ".psci_modules" ++ pathSeparator : "index.js"
104indexFile = ".psci_modules" ++ pathSeparator : "index.js"
psci/PSCi/Parser.hs+1−1
@@ -107,7 +107,7 @@ psciLet = Decls <$> (P.reserved "let" *> P.indented *> manyDecls)
107-- :show import works, for example.
107-- :show import works, for example.
108psciImport :: P.TokenParser Command
108psciImport :: P.TokenParser Command
109psciImport = do
109psciImport = do
110− (mn, declType, asQ, _) <- P.parseImportDeclaration'
110+ (mn, declType, asQ) <- P.parseImportDeclaration'
111 return $ Import (mn, declType, asQ)
111 return $ Import (mn, declType, asQ)
112
112
113-- | Any other declaration that we don't need a 'special case' parser for
113-- | Any other declaration that we don't need a 'special case' parser for
src/Language/PureScript/AST/Declarations.hs+3−4
@@ -47,9 +47,9 @@ getModuleName (Module _ _ name _ _) = name
47addDefaultImport :: ModuleName -> Module -> Module
47addDefaultImport :: ModuleName -> Module -> Module
48addDefaultImport toImport m@(Module ss coms mn decls exps) =
48addDefaultImport toImport m@(Module ss coms mn decls exps) =
49 if isExistingImport `any` decls || mn == toImport then m
49 if isExistingImport `any` decls || mn == toImport then m
50− else Module ss coms mn (ImportDeclaration toImport Implicit Nothing False : decls) exps
50+ else Module ss coms mn (ImportDeclaration toImport Implicit Nothing : decls) exps
51 where
51 where
52− isExistingImport (ImportDeclaration mn' _ _ _) | mn' == toImport = True
52+ isExistingImport (ImportDeclaration mn' _ _) | mn' == toImport = True
53 isExistingImport (PositionedDeclaration _ _ d) = isExistingImport d
53 isExistingImport (PositionedDeclaration _ _ d) = isExistingImport d
54 isExistingImport _ = False
54 isExistingImport _ = False
55
55
@@ -198,9 +198,8 @@ data Declaration
198 | FixityDeclaration Fixity String (Maybe (Qualified FixityAlias))
198 | FixityDeclaration Fixity String (Maybe (Qualified FixityAlias))
199 -- |
199 -- |
200 -- A module import (module name, qualified/unqualified/hiding, optional "qualified as" name)
200 -- A module import (module name, qualified/unqualified/hiding, optional "qualified as" name)
201− -- TODO: also a boolean specifying whether the old `qualified` syntax was used, so a warning can be raised in desugaring (remove for 0.9)
202 --
201 --
203− | ImportDeclaration ModuleName ImportDeclarationType (Maybe ModuleName) Bool
202+ | ImportDeclaration ModuleName ImportDeclarationType (Maybe ModuleName)
204 -- |
203 -- |
205 -- A type class declaration (name, argument, implies, member declarations)
204 -- A type class declaration (name, argument, implies, member declarations)
206 --
205 --
src/Language/PureScript/CoreFn/Desugar.hs+1−1
@@ -230,7 +230,7 @@ findQualModules decls =
230-- Desugars import declarations from AST to CoreFn representation.
230-- Desugars import declarations from AST to CoreFn representation.
231--
231--
232importToCoreFn :: A.Declaration -> Maybe (Ann, ModuleName)
232importToCoreFn :: A.Declaration -> Maybe (Ann, ModuleName)
233−importToCoreFn (A.ImportDeclaration name _ _ _) = Just (nullAnn, name)
233+importToCoreFn (A.ImportDeclaration name _ _) = Just (nullAnn, name)
234importToCoreFn (A.PositionedDeclaration ss _ d) =
234importToCoreFn (A.PositionedDeclaration ss _ d) =
235 ((,) (Just ss, [], Nothing, Nothing) . snd) <$> importToCoreFn d
235 ((,) (Just ss, [], Nothing, Nothing) . snd) <$> importToCoreFn d
236importToCoreFn _ = Nothing
236importToCoreFn _ = Nothing
src/Language/PureScript/Errors.hs−11
@@ -142,7 +142,6 @@ data SimpleErrorMessage
142 | UnusedDctorExplicitImport (ProperName 'TypeName) [ProperName 'ConstructorName]
142 | UnusedDctorExplicitImport (ProperName 'TypeName) [ProperName 'ConstructorName]
143 | DeprecatedOperatorDecl String
143 | DeprecatedOperatorDecl String
144 | DeprecatedOperatorSection Expr (Either Expr Expr)
144 | DeprecatedOperatorSection Expr (Either Expr Expr)
145− | DeprecatedQualifiedSyntax ModuleName ModuleName
146 | DeprecatedClassImport ModuleName (ProperName 'ClassName)
145 | DeprecatedClassImport ModuleName (ProperName 'ClassName)
147 | DeprecatedClassExport (ProperName 'ClassName)
146 | DeprecatedClassExport (ProperName 'ClassName)
148 | DuplicateSelectiveImport ModuleName
147 | DuplicateSelectiveImport ModuleName
@@ -331,7 +330,6 @@ errorCode em = case unwrapErrorMessage em of
331 UnusedDctorExplicitImport{} -> "UnusedDctorExplicitImport"
330 UnusedDctorExplicitImport{} -> "UnusedDctorExplicitImport"
332 DeprecatedOperatorDecl{} -> "DeprecatedOperatorDecl"
331 DeprecatedOperatorDecl{} -> "DeprecatedOperatorDecl"
333 DeprecatedOperatorSection{} -> "DeprecatedOperatorSection"
332 DeprecatedOperatorSection{} -> "DeprecatedOperatorSection"
334− DeprecatedQualifiedSyntax{} -> "DeprecatedQualifiedSyntax"
335 DeprecatedClassImport{} -> "DeprecatedClassImport"
333 DeprecatedClassImport{} -> "DeprecatedClassImport"
336 DeprecatedClassExport{} -> "DeprecatedClassExport"
334 DeprecatedClassExport{} -> "DeprecatedClassExport"
337 DuplicateSelectiveImport{} -> "DuplicateSelectiveImport"
335 DuplicateSelectiveImport{} -> "DuplicateSelectiveImport"
@@ -463,8 +461,6 @@ errorSuggestion err = case err of
463 UnusedImport{} -> emptySuggestion
461 UnusedImport{} -> emptySuggestion
464 RedundantEmptyHidingImport{} -> emptySuggestion
462 RedundantEmptyHidingImport{} -> emptySuggestion
465 DuplicateImport{} -> emptySuggestion
463 DuplicateImport{} -> emptySuggestion
466− DeprecatedQualifiedSyntax name qualName -> suggest $
467− "import " ++ runModuleName name ++ " as " ++ runModuleName qualName
468 UnusedExplicitImport mn _ qual refs -> suggest $ importSuggestion mn refs qual
464 UnusedExplicitImport mn _ qual refs -> suggest $ importSuggestion mn refs qual
469 ImplicitImport mn refs -> suggest $ importSuggestion mn refs Nothing
465 ImplicitImport mn refs -> suggest $ importSuggestion mn refs Nothing
470 ImplicitQualifiedImport mn asModule refs -> suggest $ importSuggestion mn refs (Just asModule)
466 ImplicitQualifiedImport mn asModule refs -> suggest $ importSuggestion mn refs (Just asModule)
@@ -951,13 +947,6 @@ prettyPrintSingleError full level showWiki e = flip evalState defaultUnknownMap
951 renderOperator (PositionedValue _ _ ex) = renderOperator ex
947 renderOperator (PositionedValue _ _ ex) = renderOperator ex
952 renderOperator (Var (Qualified _ (Op ident))) = line ident
948 renderOperator (Var (Qualified _ (Op ident))) = line ident
953 renderOperator other = Box.hcat Box.top [ line "`", prettyPrintValue valueDepth other, line "`" ]
949 renderOperator other = Box.hcat Box.top [ line "`", prettyPrintValue valueDepth other, line "`" ]
954− renderSimpleErrorMessage (DeprecatedQualifiedSyntax name qualName) =
955− paras [ line "Import uses the deprecated 'qualified' syntax:"
956− , indent $ line $ "import qualified " ++ runModuleName name ++ " as " ++ runModuleName qualName
957− , line "Should instead use the form:"
958− , indent $ line $ "import " ++ runModuleName name ++ " as " ++ runModuleName qualName
959− , line "The deprecated syntax will be removed in PureScript 0.9."
960− ]
961
950
962 renderSimpleErrorMessage (DeprecatedClassImport mn name) =
951 renderSimpleErrorMessage (DeprecatedClassImport mn name) =
963 paras [ line $ "Class import from " ++ runModuleName mn ++ " uses deprecated syntax that omits the 'class' keyword:"
952 paras [ line $ "Class import from " ++ runModuleName mn ++ " uses deprecated syntax that omits the 'class' keyword:"
src/Language/PureScript/Externs.hs+1−1
@@ -165,7 +165,7 @@ moduleToExternsFile (Module _ _ mn ds (Just exps)) env = ExternsFile{..}
165 fixityDecl _ = Nothing
165 fixityDecl _ = Nothing
166
166
167 importDecl :: Declaration -> Maybe ExternsImport
167 importDecl :: Declaration -> Maybe ExternsImport
168− importDecl (ImportDeclaration m mt qmn _) = Just (ExternsImport m mt qmn)
168+ importDecl (ImportDeclaration m mt qmn) = Just (ExternsImport m mt qmn)
169 importDecl (PositionedDeclaration _ _ d) = importDecl d
169 importDecl (PositionedDeclaration _ _ d) = importDecl d
170 importDecl _ = Nothing
170 importDecl _ = Nothing
171
171
src/Language/PureScript/Ide/Imports.hs+4−5
@@ -95,9 +95,9 @@ parseImportsWithModuleName ls = do
95 (P.Module _ _ mn decls _) <- moduleParse ls
95 (P.Module _ _ mn decls _) <- moduleParse ls
96 pure (mn, concatMap mkImport (unwrapPositioned <$> decls))
96 pure (mn, concatMap mkImport (unwrapPositioned <$> decls))
97 where
97 where
98− mkImport (P.ImportDeclaration mn (P.Explicit refs) qual _) =
98+ mkImport (P.ImportDeclaration mn (P.Explicit refs) qual) =
99 [Import mn (P.Explicit (unwrapPositionedRef <$> refs)) qual]
99 [Import mn (P.Explicit (unwrapPositionedRef <$> refs)) qual]
100− mkImport (P.ImportDeclaration mn it qual _) = [Import mn it qual]
100+ mkImport (P.ImportDeclaration mn it qual) = [Import mn it qual]
101 mkImport _ = []
101 mkImport _ = []
102
102
103sliceImportSection :: [Text] -> Either String (P.ModuleName, [Text], [Import], [Text])
103sliceImportSection :: [Text] -> Either String (P.ModuleName, [Text], [Import], [Text])
@@ -348,8 +348,7 @@ parseImport :: Text -> Maybe Import
348parseImport t =
348parseImport t =
349 case P.lex "<psc-ide>" (T.unpack t)
349 case P.lex "<psc-ide>" (T.unpack t)
350 >>= P.runTokenParser "<psc-ide>" P.parseImportDeclaration' of
350 >>= P.runTokenParser "<psc-ide>" P.parseImportDeclaration' of
351− Right (mn, P.Explicit refs, mmn, _) ->
351+ Right (mn, P.Explicit refs, mmn) ->
352 Just (Import mn (P.Explicit (unwrapPositionedRef <$> refs)) mmn)
352 Just (Import mn (P.Explicit (unwrapPositionedRef <$> refs)) mmn)
353− Right (mn, idt, mmn, _) -> Just (Import mn idt mmn)
353+ Right (mn, idt, mmn) -> Just (Import mn idt mmn)
354 Left _ -> Nothing
354 Left _ -> Nothing
355−
src/Language/PureScript/Ide/Rebuild.hs+1−1
@@ -78,7 +78,7 @@ sortExterns m ex = do
78 mkShallowModule P.ExternsFile{..} =
78 mkShallowModule P.ExternsFile{..} =
79 P.Module undefined [] efModuleName (map mkImport efImports) Nothing
79 P.Module undefined [] efModuleName (map mkImport efImports) Nothing
80 mkImport (P.ExternsImport mn it iq) =
80 mkImport (P.ExternsImport mn it iq) =
81− P.ImportDeclaration mn it iq False
81+ P.ImportDeclaration mn it iq
82 getExtern mn = M.lookup mn ex
82 getExtern mn = M.lookup mn ex
83 -- Sort a list so its elements appear in the same order as in another list.
83 -- Sort a list so its elements appear in the same order as in another list.
84 inOrderOf :: (Ord a) => [a] -> [a] -> [a]
84 inOrderOf :: (Ord a) => [a] -> [a] -> [a]
src/Language/PureScript/Ide/SourceFile.hs+3−3
@@ -68,14 +68,14 @@ getImportsForFile fp = do
68 let imports = getImports module'
68 let imports = getImports module'
69 pure (mkModuleImport . unwrapPositionedImport <$> imports)
69 pure (mkModuleImport . unwrapPositionedImport <$> imports)
70 where
70 where
71− mkModuleImport (D.ImportDeclaration mn importType' qualifier _) =
71+ mkModuleImport (D.ImportDeclaration mn importType' qualifier) =
72 ModuleImport
72 ModuleImport
73 (T.pack (N.runModuleName mn))
73 (T.pack (N.runModuleName mn))
74 importType'
74 importType'
75 (T.pack . N.runModuleName <$> qualifier)
75 (T.pack . N.runModuleName <$> qualifier)
76 mkModuleImport _ = error "Shouldn't have gotten anything but Imports here"
76 mkModuleImport _ = error "Shouldn't have gotten anything but Imports here"
77− unwrapPositionedImport (D.ImportDeclaration mn importType' qualifier b) =
77+ unwrapPositionedImport (D.ImportDeclaration mn importType' qualifier) =
78− D.ImportDeclaration mn (unwrapImportType importType') qualifier b
78+ D.ImportDeclaration mn (unwrapImportType importType') qualifier
79 unwrapPositionedImport x = x
79 unwrapPositionedImport x = x
80 unwrapImportType (D.Explicit decls) = D.Explicit (map unwrapPositionedRef decls)
80 unwrapImportType (D.Explicit decls) = D.Explicit (map unwrapPositionedRef decls)
81 unwrapImportType (D.Hiding decls) = D.Hiding (map unwrapPositionedRef decls)
81 unwrapImportType (D.Hiding decls) = D.Hiding (map unwrapPositionedRef decls)
src/Language/PureScript/Linter/Imports.hs+2−2
@@ -112,8 +112,8 @@ lintImports (Module _ _ mn mdecls mexports) env usedImps = do
112 where
112 where
113
113
114 countOpenImports :: Declaration -> Int
114 countOpenImports :: Declaration -> Int
115− countOpenImports (ImportDeclaration mn' Implicit Nothing _) | not (isPrim mn') = 1
115+ countOpenImports (ImportDeclaration mn' Implicit Nothing) | not (isPrim mn') = 1
116− countOpenImports (ImportDeclaration mn' (Hiding _) Nothing _) | not (isPrim mn') = 1
116+ countOpenImports (ImportDeclaration mn' (Hiding _) Nothing) | not (isPrim mn') = 1
117 countOpenImports (PositionedDeclaration _ _ d) = countOpenImports d
117 countOpenImports (PositionedDeclaration _ _ d) = countOpenImports d
118 countOpenImports _ = 0
118 countOpenImports _ = 0
119
119
src/Language/PureScript/ModuleDependencies.hs+2−2
@@ -47,7 +47,7 @@ sortModules ms = do
47 -- Extract module names that have been brought into scope by an `as` import.
47 -- Extract module names that have been brought into scope by an `as` import.
48 extractQualAs :: Declaration -> [ModuleName]
48 extractQualAs :: Declaration -> [ModuleName]
49 extractQualAs (PositionedDeclaration _ _ d) = extractQualAs d
49 extractQualAs (PositionedDeclaration _ _ d) = extractQualAs d
50− extractQualAs (ImportDeclaration _ _ (Just am) _) = [am]
50+ extractQualAs (ImportDeclaration _ _ (Just am)) = [am]
51 extractQualAs _ = []
51 extractQualAs _ = []
52
52
53-- |
53-- |
@@ -65,7 +65,7 @@ usedModules ams d =
65 where
65 where
66
66
67 forDecls :: Declaration -> [ModuleName]
67 forDecls :: Declaration -> [ModuleName]
68− forDecls (ImportDeclaration mn _ _ _) =
68+ forDecls (ImportDeclaration mn _ _) =
69 -- Regardless of whether an imported module is qualified we still need to
69 -- Regardless of whether an imported module is qualified we still need to
70 -- take into account its import to build an accurate list of dependencies.
70 -- take into account its import to build an accurate list of dependencies.
71 [mn]
71 [mn]
src/Language/PureScript/Parser/Declarations.hs+7−16
@@ -132,28 +132,19 @@ parseFixityDeclaration = do
132
132
133parseImportDeclaration :: TokenParser Declaration
133parseImportDeclaration :: TokenParser Declaration
134parseImportDeclaration = do
134parseImportDeclaration = do
135− (mn, declType, asQ, isOldSyntax) <- parseImportDeclaration'
135+ (mn, declType, asQ) <- parseImportDeclaration'
136− return $ ImportDeclaration mn declType asQ isOldSyntax
136+ return $ ImportDeclaration mn declType asQ
137
137
138−parseImportDeclaration' :: TokenParser (ModuleName, ImportDeclarationType, Maybe ModuleName, Bool)
138+parseImportDeclaration' :: TokenParser (ModuleName, ImportDeclarationType, Maybe ModuleName)
139parseImportDeclaration' = do
139parseImportDeclaration' = do
140 reserved "import"
140 reserved "import"
141 indented
141 indented
142− qualImport <|> stdImport
142+ moduleName' <- moduleName
143+ declType <- reserved "hiding" *> qualifyingList Hiding <|> qualifyingList Explicit
144+ qName <- P.optionMaybe qualifiedName
145+ return (moduleName', declType, qName)
143 where
146 where
144− stdImport = do
145− moduleName' <- moduleName
146− declType <- reserved "hiding" *> qualifyingList Hiding <|> qualifyingList Explicit
147− qName <- P.optionMaybe qualifiedName
148− return (moduleName', declType, qName, False)
149 qualifiedName = reserved "as" *> moduleName
147 qualifiedName = reserved "as" *> moduleName
150− qualImport = do
151− reserved "qualified"
152− indented
153− moduleName' <- moduleName
154− declType <- qualifyingList Explicit
155− qName <- qualifiedName
156− return (moduleName', declType, Just qName, True)
157 qualifyingList expectedType = do
148 qualifyingList expectedType = do
158 declType <- P.optionMaybe (expectedType <$> (indented *> parens (commaSep parseDeclarationRef)))
149 declType <- P.optionMaybe (expectedType <$> (indented *> parens (commaSep parseDeclarationRef)))
159 return $ fromMaybe Implicit declType
150 return $ fromMaybe Implicit declType
src/Language/PureScript/Sugar/Names/Imports.hs+4−5
@@ -15,7 +15,7 @@ import Prelude.Compat
15import Data.Foldable (traverse_, for_)
15import Data.Foldable (traverse_, for_)
16import Data.Function (on)
16import Data.Function (on)
17import Data.List (find, sortBy, groupBy, (\\))
17import Data.List (find, sortBy, groupBy, (\\))
18−import Data.Maybe (fromMaybe, isNothing, fromJust)
18+import Data.Maybe (fromMaybe, isNothing)
19import Data.Traversable (for)
19import Data.Traversable (for)
20
20
21import Control.Arrow (first)
21import Control.Arrow (first)
@@ -43,8 +43,7 @@ findImports
43 -> m (M.Map ModuleName [(Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)])
43 -> m (M.Map ModuleName [(Maybe SourceSpan, ImportDeclarationType, Maybe ModuleName)])
44findImports = foldM (go Nothing) M.empty
44findImports = foldM (go Nothing) M.empty
45 where
45 where
46− go pos result (ImportDeclaration mn typ qual isOldSyntax) = do
46+ go pos result (ImportDeclaration mn typ qual) = do
47− when isOldSyntax . tell . errorMessage $ DeprecatedQualifiedSyntax mn (fromJust qual)
48 let imp = (pos, typ, qual)
47 let imp = (pos, typ, qual)
49 return $ M.insert mn (maybe [imp] (imp :) (mn `M.lookup` result)) result
48 return $ M.insert mn (maybe [imp] (imp :) (mn `M.lookup` result)) result
50 go _ result (PositionedDeclaration pos _ d) = warnAndRethrowWithPosition pos $ go (Just pos) result d
49 go _ result (PositionedDeclaration pos _ d) = warnAndRethrowWithPosition pos $ go (Just pos) result d
@@ -137,13 +136,13 @@ resolveImports env (Module ss coms currentModule decls exps) =
137 updateImportRef :: Declaration -> m Declaration
136 updateImportRef :: Declaration -> m Declaration
138 updateImportRef (PositionedDeclaration pos com d) =
137 updateImportRef (PositionedDeclaration pos com d) =
139 warnAndRethrowWithPosition pos $ PositionedDeclaration pos com <$> updateImportRef d
138 warnAndRethrowWithPosition pos $ PositionedDeclaration pos com <$> updateImportRef d
140− updateImportRef (ImportDeclaration mn typ qual isOldSyntax) = do
139+ updateImportRef (ImportDeclaration mn typ qual) = do
141 modExports <- getExports env mn
140 modExports <- getExports env mn
142 typ' <- case typ of
141 typ' <- case typ of
143 Implicit -> return Implicit
142 Implicit -> return Implicit
144 Explicit refs -> Explicit <$> updateProperRef mn modExports `traverse` refs
143 Explicit refs -> Explicit <$> updateProperRef mn modExports `traverse` refs
145 Hiding refs -> Hiding <$> updateProperRef mn modExports `traverse` refs
144 Hiding refs -> Hiding <$> updateProperRef mn modExports `traverse` refs
146− return $ ImportDeclaration mn typ' qual isOldSyntax
145+ return $ ImportDeclaration mn typ' qual
147 updateImportRef other = return other
146 updateImportRef other = return other
148
147
149 updateProperRef :: ModuleName -> Exports -> DeclarationRef -> m DeclarationRef
148 updateProperRef :: ModuleName -> Exports -> DeclarationRef -> m DeclarationRef
tests/TestPsci.hs+1−3
@@ -60,7 +60,6 @@ completionTestData =
60 -- import should complete module names
60 -- import should complete module names
61 , ("import Control.Monad.E", map ("import Control.Monad.Eff" ++) ["", ".Unsafe", ".Class", ".Console"])
61 , ("import Control.Monad.E", map ("import Control.Monad.Eff" ++) ["", ".Unsafe", ".Class", ".Console"])
62 , ("import Control.Monad.Eff.", map ("import Control.Monad.Eff" ++) [".Unsafe", ".Class", ".Console"])
62 , ("import Control.Monad.Eff.", map ("import Control.Monad.Eff" ++) [".Unsafe", ".Class", ".Console"])
63− , ("import qualified Control.Monad.Eff.", map ("import qualified Control.Monad.Eff" ++) [".Unsafe", ".Class", ".Console"])
64
63
65 -- :load, :module should complete file paths
64 -- :load, :module should complete file paths
66 , (":l tests/support/psci/", [":l tests/support/psci/Sample.purs"])
65 , (":l tests/support/psci/", [":l tests/support/psci/Sample.purs"])
@@ -91,8 +90,7 @@ completionTestData =
91
90
92 -- a few other import tests
91 -- a few other import tests
93 , ("impor", ["import"])
92 , ("impor", ["import"])
94− , ("import q", ["import qualified"])
95− , ("import ", map ("import " ++) supportModules ++ ["import qualified"])
93+ , ("import ", map ("import " ++) supportModules)
96 , ("import Prelude ", [])
94 , ("import Prelude ", [])
97
95
98 -- String and number literals should not be completed
96 -- String and number literals should not be completed