Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,860
    • Issues 4,860
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 454
    • Merge requests 454
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #19496
Closed
Open
Created Mar 05, 2021 by hdgarrood@hdgarroodDeveloper

Duplicate signatures clobbered in .bkp files

Summary

In .bkp files, it is possible to declare a signature multiple times within a unit, and it appears that only the last signature of a given name is considered; all others are ignored. I'm not certain if this is actually a bug, or how this is supposed to behave. cc @ezyang

Steps to reproduce

Write the following into a file test.bkp:

unit test where
  -- These two declarations of @signature A@ should be mergeable
  signature A where
    f :: Int
  signature A where
    g :: String

  -- These two declarations of @signature B@ are certainly not mergeable
  signature B where
    f :: Int
  signature B where
    f :: String

Then run ghc --backpack test.bkp, and inspect the generated .hi files with ghc --show-iface test/A.hi and ghc --show-iface test/B.hi.

Observed behaviour: GHC succeeds and writes out hi files for both A and B. A.hi lists only g :: String among its exports, and B.hi lists only f :: String among its exports.

Expected behavior

I am not entirely sure how signature merging is supposed to work in this scenario, but I expected one of two things to happen here:

  1. GHC would point out that A and B have both been declared multiple times, and no .hi files would be produced at all
  2. GHC would produce an A.hi file which listed both f :: Int and g :: String as exports, but would fail with an error at B, saying that the signatures were not mergeable

Environment

  • GHC version used: reproduced on both 8.10.4 and 9.0.1

Optional:

  • Operating System: Ubuntu linux
  • System Architecture: x86_64
Edited Mar 05, 2021 by hdgarrood
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking