Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

7 changed files:

Changes:

  • compiler/GHC/Iface/Recomp.hs
    ... ... @@ -1782,10 +1782,12 @@ declExtras fix_fn ann_fn rule_env inst_env fi_env dm_env complete_env decl
    1782 1782
           IfaceClass{ifBody = IfConcreteClass { ifSigs=sigs, ifATs=ats }} ->
    
    1783 1783
                          IfaceClassExtras (fix_fn n) insts (ann_fn (AnnOccName n)) meths defms
    
    1784 1784
               where
    
    1785
    -            insts = (map ifDFun $ (concatMap at_extras ats)
    
    1786
    -                                    ++ lookupOccEnvL inst_env n)
    
    1787
    -                           -- Include instances of the associated types
    
    1788
    -                           -- as well as instances of the class (#5147)
    
    1785
    +            insts =
    
    1786
    +              let (atFamInsts, atClsInsts) = foldMap at_extras ats
    
    1787
    +              in (ifFamInstAxiom <$> atFamInsts) ++ (ifDFun <$> atClsInsts)
    
    1788
    +                 ++ (ifDFun <$> lookupOccEnvL inst_env n)
    
    1789
    +                           -- Include instances and axioms of the associated types
    
    1790
    +                           -- as well as instances of the class (#5147) (#26183)
    
    1789 1791
                 meths = [id_extras (getOccName op) | IfaceClassOp op _ _ <- sigs]
    
    1790 1792
                 -- Names of all the default methods (see Note [default method Name])
    
    1791 1793
                 defms = [ dmName
    
    ... ... @@ -1802,7 +1804,10 @@ declExtras fix_fn ann_fn rule_env inst_env fi_env dm_env complete_env decl
    1802 1804
       where
    
    1803 1805
             n = getOccName decl
    
    1804 1806
             id_extras occ = IdExtras (fix_fn occ) (lookupOccEnvL rule_env occ) (ann_fn (AnnOccName occ)) (lookup_complete_match occ)
    
    1805
    -        at_extras (IfaceAT decl _) = lookupOccEnvL inst_env (getOccName decl)
    
    1807
    +        at_extras (IfaceAT decl _) =
    
    1808
    +          ( lookupOccEnvL fi_env (getOccName decl) -- Axioms
    
    1809
    +          , lookupOccEnvL inst_env (getOccName decl) -- Class instances
    
    1810
    +          )
    
    1806 1811
     
    
    1807 1812
             lookup_complete_match occ = lookupOccEnvL complete_env occ
    
    1808 1813
     
    

  • testsuite/tests/driver/recomp26183/M.hs
    1
    +module M where
    
    2
    +import M2
    
    3
    +
    
    4
    +x :: AT ()
    
    5
    +x = True

  • testsuite/tests/driver/recomp26183/M2A.hs
    1
    +{-# LANGUAGE TypeFamilies #-}
    
    2
    +module M2 where
    
    3
    +
    
    4
    +class C a where
    
    5
    +  type AT a
    
    6
    +
    
    7
    +instance C () where
    
    8
    +  type AT () = Bool

  • testsuite/tests/driver/recomp26183/M2B.hs
    1
    +{-# LANGUAGE TypeFamilies #-}
    
    2
    +module M2 where
    
    3
    +
    
    4
    +class C a where
    
    5
    +  type AT a
    
    6
    +
    
    7
    +instance C () where
    
    8
    +  type AT () = Int

  • testsuite/tests/driver/recomp26183/Makefile
    1
    +TOP=../../..
    
    2
    +include $(TOP)/mk/boilerplate.mk
    
    3
    +include $(TOP)/mk/test.mk
    
    4
    +
    
    5
    +# Recompilation tests
    
    6
    +
    
    7
    +recomp26183:
    
    8
    +	cp M2A.hs M2.hs
    
    9
    +	'$(TEST_HC)' $(TEST_HC_OPTS) --make M.hs
    
    10
    +	sleep 1
    
    11
    +	cp M2B.hs M2.hs
    
    12
    +	# This should fail
    
    13
    +	if '$(TEST_HC)' $(TEST_HC_OPTS) --make M.hs; then false; fi

  • testsuite/tests/driver/recomp26183/all.T
    1
    +test('recomp26183', [extra_files(['M2A.hs', 'M.hs', 'M2B.hs']),
    
    2
    +                   when(fast(), skip), ignore_stdout],
    
    3
    +     makefile_test, [])

  • testsuite/tests/driver/recomp26183/recomp26183.stderr
    1
    +M.hs:5:5: error: [GHC-83865]
    
    2
    +    • Couldn't match type ‘Bool’ with ‘Int’
    
    3
    +      Expected: AT ()
    
    4
    +        Actual: Bool
    
    5
    +    • In the expression: True
    
    6
    +      In an equation for ‘x’: x = True
    
    7
    +