Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: e7cacf59 by sheaf at 2026-10-09T20:29:09-04:00 Take into account ifKind in freeNamesIfDecl Commit 3c2f4bb4 added the 'ifKind' field to various constructors of 'IfaceDecl', which preserves the original kind (before type synonym expansion) for better error messages. However, that commit forgot to update 'freeNamesIfDecl' correspondingly. This could result in a "urk! lookup local fingerpring" crash when e.g. a type's kind uses a type synonym defined later, as we failed to add a dependency on the type synonym during dependency analysis. Fixes #27916 - - - - - 4 changed files: - + changelog.d/T27916 - compiler/GHC/Iface/Syntax.hs - + testsuite/tests/typecheck/should_compile/T27916.hs - testsuite/tests/typecheck/should_compile/all.T Changes: ===================================== changelog.d/T27916 ===================================== @@ -0,0 +1,9 @@ +section: compiler +issues: #27916 +mrs: !16785 +synopsis: + Fix "urk! lookup local fingerprint" panic involving a type synonym in a kind. +description: + GHC no longer crashes when encountering a kind mentioning a type synonym that + is defined later on in the same file (a bug due to incorrect declaration + 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}) freeNamesIfIdInfo i &&& freeNamesIfIdDetails d -freeNamesIfDecl (IfaceData { ifBinders = bndrs, ifResKind = res_k +freeNamesIfDecl (IfaceData { ifKind = kind, ifBinders = bndrs, ifResKind = res_k , ifParent = p, ifCtxt = ctxt, ifCons = cons }) - = freeNamesIfVarBndrs bndrs &&& + = freeNamesIfKind kind &&& + freeNamesIfVarBndrs bndrs &&& freeNamesIfType res_k &&& freeNamesIfaceTyConParent p &&& freeNamesIfContext ctxt &&& freeNamesIfConDecls cons -freeNamesIfDecl (IfaceSynonym { ifBinders = bndrs, ifResKind = res_k +freeNamesIfDecl (IfaceSynonym { ifKind = kind, ifBinders = bndrs, ifResKind = res_k , ifSynRhs = rhs }) - = freeNamesIfVarBndrs bndrs &&& + = freeNamesIfKind kind &&& + freeNamesIfVarBndrs bndrs &&& freeNamesIfKind res_k &&& freeNamesIfType rhs -freeNamesIfDecl (IfaceFamily { ifBinders = bndrs, ifResKind = res_k +freeNamesIfDecl (IfaceFamily { ifKind = kind, ifBinders = bndrs, ifResKind = res_k , ifFamFlav = flav }) - = freeNamesIfVarBndrs bndrs &&& + = freeNamesIfKind kind &&& + freeNamesIfVarBndrs bndrs &&& freeNamesIfKind res_k &&& freeNamesIfFamFlav flav -freeNamesIfDecl (IfaceClass{ ifBinders = bndrs, ifBody = cls_body }) - = freeNamesIfVarBndrs bndrs &&& +freeNamesIfDecl (IfaceClass{ ifKind = kind, ifBinders = bndrs, ifBody = cls_body }) + = freeNamesIfKind kind &&& + freeNamesIfVarBndrs bndrs &&& freeNamesIfClassBody cls_body freeNamesIfDecl (IfaceAxiom { ifTyCon = tc, ifAxBranches = branches }) ===================================== testsuite/tests/typecheck/should_compile/T27916.hs ===================================== @@ -0,0 +1,6 @@ +module T27916 where + +import Data.Kind + +data Y :: X +type X = Type -> Type ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -970,3 +970,4 @@ test('T23135', normal, compile, ['']) test('LazyFieldAnnotations', normal, compile, ['']) test('T27557', normal, compile, ['']) test('T27664', normal, compile, ['']) +test('T27916', normal, compile, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e7cacf59b891f999708cf7c7f7412de0... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e7cacf59b891f999708cf7c7f7412de0... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help