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

Commits:

4 changed files:

Changes:

  • changelog.d/T27916
    1
    +section: compiler
    
    2
    +issues: #27916
    
    3
    +mrs: !16785
    
    4
    +synopsis:
    
    5
    +  Fix "urk! lookup local fingerprint" panic involving a type synonym in a kind.
    
    6
    +description:
    
    7
    +  GHC no longer crashes when encountering a kind mentioning a type synonym that
    
    8
    +  is defined later on in the same file (a bug due to incorrect declaration
    
    9
    +  dependency analysis).
    \ No newline at end of file

  • compiler/GHC/Iface/Syntax.hs
    ... ... @@ -1945,28 +1945,32 @@ freeNamesIfDecl (IfaceId { ifType = t, ifIdDetails = d, ifIdInfo = i})
    1945 1945
         freeNamesIfIdInfo i &&&
    
    1946 1946
         freeNamesIfIdDetails d
    
    1947 1947
     
    
    1948
    -freeNamesIfDecl (IfaceData { ifBinders = bndrs, ifResKind = res_k
    
    1948
    +freeNamesIfDecl (IfaceData { ifKind = kind, ifBinders = bndrs, ifResKind = res_k
    
    1949 1949
                                , ifParent = p, ifCtxt = ctxt, ifCons = cons })
    
    1950
    -  = freeNamesIfVarBndrs bndrs &&&
    
    1950
    +  = freeNamesIfKind kind &&&
    
    1951
    +    freeNamesIfVarBndrs bndrs &&&
    
    1951 1952
         freeNamesIfType res_k &&&
    
    1952 1953
         freeNamesIfaceTyConParent p &&&
    
    1953 1954
         freeNamesIfContext ctxt &&&
    
    1954 1955
         freeNamesIfConDecls cons
    
    1955 1956
     
    
    1956
    -freeNamesIfDecl (IfaceSynonym { ifBinders = bndrs, ifResKind = res_k
    
    1957
    +freeNamesIfDecl (IfaceSynonym { ifKind = kind, ifBinders = bndrs, ifResKind = res_k
    
    1957 1958
                                   , ifSynRhs = rhs })
    
    1958
    -  = freeNamesIfVarBndrs bndrs &&&
    
    1959
    +  = freeNamesIfKind kind &&&
    
    1960
    +    freeNamesIfVarBndrs bndrs &&&
    
    1959 1961
         freeNamesIfKind res_k &&&
    
    1960 1962
         freeNamesIfType rhs
    
    1961 1963
     
    
    1962
    -freeNamesIfDecl (IfaceFamily { ifBinders = bndrs, ifResKind = res_k
    
    1964
    +freeNamesIfDecl (IfaceFamily { ifKind = kind, ifBinders = bndrs, ifResKind = res_k
    
    1963 1965
                                  , ifFamFlav = flav })
    
    1964
    -  = freeNamesIfVarBndrs bndrs &&&
    
    1966
    +  = freeNamesIfKind kind &&&
    
    1967
    +    freeNamesIfVarBndrs bndrs &&&
    
    1965 1968
         freeNamesIfKind res_k &&&
    
    1966 1969
         freeNamesIfFamFlav flav
    
    1967 1970
     
    
    1968
    -freeNamesIfDecl (IfaceClass{ ifBinders = bndrs, ifBody = cls_body })
    
    1969
    -  = freeNamesIfVarBndrs bndrs &&&
    
    1971
    +freeNamesIfDecl (IfaceClass{ ifKind = kind, ifBinders = bndrs, ifBody = cls_body })
    
    1972
    +  = freeNamesIfKind kind &&&
    
    1973
    +    freeNamesIfVarBndrs bndrs &&&
    
    1970 1974
         freeNamesIfClassBody cls_body
    
    1971 1975
     
    
    1972 1976
     freeNamesIfDecl (IfaceAxiom { ifTyCon = tc, ifAxBranches = branches })
    

  • testsuite/tests/typecheck/should_compile/T27916.hs
    1
    +module T27916 where
    
    2
    +
    
    3
    +import Data.Kind
    
    4
    +
    
    5
    +data Y :: X
    
    6
    +type X = Type -> Type

  • testsuite/tests/typecheck/should_compile/all.T
    ... ... @@ -970,3 +970,4 @@ test('T23135', normal, compile, [''])
    970 970
     test('LazyFieldAnnotations', normal, compile, [''])
    
    971 971
     test('T27557', normal, compile, [''])
    
    972 972
     test('T27664', normal, compile, [''])
    
    973
    +test('T27916', normal, compile, [''])