File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/Development/IDE/Plugin/CodeAction Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,8 @@ extendImportTopLevel _ _ _ = lift $ Left "Unable to extend the import list"
239239-- extendImportViaParent "Bar" "Cons" AST:
240240--
241241-- import A --> Error
242+ -- import A (Bar(..)) --> Error
243+ -- import A (Bar(Cons)) --> Error
242244-- import A () --> import A (Bar(Cons))
243245-- import A (Foo, Bar) --> import A (Foo, Bar(Cons))
244246-- import A (Foo, Bar()) --> import A (Foo, Bar(Cons))
@@ -247,6 +249,8 @@ extendImportViaParent df parent child (L l it@ImportDecl {..})
247249 | Just (hide, L l' lies) <- ideclHiding = go hide l' [] lies
248250 where
249251 go :: Bool -> SrcSpan -> [LIE GhcPs ] -> [LIE GhcPs ] -> TransformT (Either String ) (LImportDecl GhcPs )
252+ go _hide _l' _pre ((L _ll' (IEThingAll _ (L _ ie))) : _xs)
253+ | parent == unIEWrappedName ie = lift . Left $ child <> " already included in " <> parent <> " imports"
250254 go hide l' pre (lAbs@ (L ll' (IEThingAbs _ absIE@ (L _ ie))) : xs)
251255 -- ThingAbs ie => ThingWith ie child
252256 | parent == unIEWrappedName ie = do
Original file line number Diff line number Diff line change @@ -3669,11 +3669,17 @@ nonLocalCompletionTests =
36693669 " ZeroPad"
36703670 [" module A where" , " import Text.Printf (FormatAdjustment (ZeroPad))" , " ZeroPad" ]
36713671 , completionCommandTest
3672- " parent imported"
3672+ " parent imported abs "
36733673 [" module A where" , " import Text.Printf (FormatAdjustment)" , " ZeroPad" ]
36743674 (Position 2 4 )
36753675 " ZeroPad"
36763676 [" module A where" , " import Text.Printf (FormatAdjustment (ZeroPad))" , " ZeroPad" ]
3677+ , completionCommandTest
3678+ " parent imported all"
3679+ [" module A where" , " import Text.Printf (FormatAdjustment (..))" , " ZeroPad" ]
3680+ (Position 2 4 )
3681+ " ZeroPad"
3682+ [" module A where" , " import Text.Printf (FormatAdjustment (..))" , " ZeroPad" ]
36773683 , completionCommandTest
36783684 " already imported"
36793685 [" module A where" , " import Text.Printf (FormatAdjustment (ZeroPad))" , " ZeroPad" ]
You can’t perform that action at this time.
0 commit comments