Skip to content

fix(Cabal): fix abi tag in case ghc's unit-id is the same as the compiler id#11652

Open
andreabedini wants to merge 1 commit intohaskell:masterfrom
andreabedini:fix/abi-tag-empty-string
Open

fix(Cabal): fix abi tag in case ghc's unit-id is the same as the compiler id#11652
andreabedini wants to merge 1 commit intohaskell:masterfrom
andreabedini:fix/abi-tag-empty-string

Conversation

@andreabedini
Copy link
Collaborator

When computing the ABI tag, compilerId is stripped as a common prefix from
GHC's "Project Unit Id" info entry via stripCommonPrefix. When the project
unit-id exactly matches the compiler id, stripCommonPrefix returns "", and
the old code produced AbiTag "" instead of NoAbiTag.

Rewrite compilerAbiTag with explicit case analysis so that a missing, empty,
or fully-stripped "Project Unit Id" value correctly yields NoAbiTag.

…iler id

When computing the ABI tag, `compilerId` is stripped as a common prefix from
GHC's "Project Unit Id" info entry via `stripCommonPrefix`. When the project
unit-id exactly matches the compiler id, `stripCommonPrefix` returns `""`, and
the old code produced `AbiTag ""` instead of `NoAbiTag`.

Rewrite `compilerAbiTag` with explicit case analysis so that a missing, empty,
or fully-stripped "Project Unit Id" value correctly yields `NoAbiTag`.
<$> projectUnitId
)

case Map.lookup "Project Unit Id" ghcInfoMap of
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with:

dropWhile (== '-') $ stripCommonPrefix (prettyShow compilerId) <$> Map.lookup "Project Unit Id" ghcInfoMap

you can eliminate a nested case (but that wouldn't be necessarily more readable, your call!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants