Vladislav Zavialov pushed to branch wip/int-index/enforce-namespaces at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Rename/Names.hs
    ... ... @@ -1382,16 +1382,7 @@ filterImports hsc_env iface decl_spec (Just (want_hiding, L l import_items))
    1382 1382
                              -- to find 'b' and 'd'.  So we make up an import item
    
    1383 1383
                              -- to report as failing, namely T( b, d ).
    
    1384 1384
                              -- c.f. #15413
    
    1385
    -                 subordinate_err =
    
    1386
    -                   assertPpr (length unavailable + length nontype == length items)
    
    1387
    -                             (ppr items) $
    
    1388
    -                       IsSubordinateError { subordinate_err_parent = gre
    
    1389
    -                                          , subordinate_err_unavailable = unavailable
    
    1390
    -                                          , subordinate_err_nontype = nontype }
    
    1391
    -                 unavailable =
    
    1392
    -                   [ (occNameFS . rdrNameOcc . ieWrappedName) wname
    
    1393
    -                   | LookupChildNotFound (L _ wname) <- children_errs ]
    
    1394
    -                 nontype = [ g | LookupChildNonType{lce_nontype_item = g} <- children_errs ]
    
    1385
    +                 subordinate_err = mkSubordinateError gre children_errs
    
    1395 1386
                  in bad_import_w ie subordinate_err
    
    1396 1387
     
    
    1397 1388
                let name' = replaceWrappedName rdr_tc name
    
    ... ... @@ -1447,6 +1438,22 @@ data IsSubordinateError
    1447 1438
                            , subordinate_err_nontype     :: [GlobalRdrElt] }
    
    1448 1439
       | IsNotSubordinate
    
    1449 1440
     
    
    1441
    +mkSubordinateError :: GlobalRdrElt -> [LookupChildError] -> IsSubordinateError
    
    1442
    +mkSubordinateError gre children_errs = foldr add init_acc children_errs
    
    1443
    +  where
    
    1444
    +    init_acc :: IsSubordinateError
    
    1445
    +    init_acc = IsSubordinateError gre [] []
    
    1446
    +
    
    1447
    +    add :: LookupChildError -> IsSubordinateError -> IsSubordinateError
    
    1448
    +    add children_err sub@IsSubordinateError{} =
    
    1449
    +      case children_err of
    
    1450
    +        LookupChildNonType{lce_nontype_item = g} ->
    
    1451
    +          sub { subordinate_err_nontype = g : subordinate_err_nontype sub }
    
    1452
    +        LookupChildNotFound (L _ wname) ->
    
    1453
    +          let fs = (occNameFS . rdrNameOcc . ieWrappedName) wname
    
    1454
    +          in sub { subordinate_err_unavailable = fs : subordinate_err_unavailable sub }
    
    1455
    +    add _ IsNotSubordinate = panic "mkSubordinateError: IsNotSubordinate"
    
    1456
    +
    
    1450 1457
     data IELookupError
    
    1451 1458
       = QualImportError RdrName
    
    1452 1459
       | BadImport (IE GhcPs) IsSubordinateError