Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#9417 closed bug (fixed)

Pattern synonyms across modules broken in Haddock

Reported by: Fuuzetsu Owned by: cactus
Priority: normal Milestone: 7.8.4
Component: Compiler Version: 7.9
Keywords: PatternSynonyms Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Create modules as follows

-- PatSymDef.hs

{-# Language PatternSynonyms #-}                                            
module PatSymDef where

pattern Some a = Just a
-- PatSymUse.hs

{-# Language PatternSynonyms #-}
module PatSymUse where

import PatSymDef

f :: Maybe Int -> Int
f (Some a) = a
f Nothing = 0

Then run Haddock against them:

[nix-shell:~/programming/haddock]$ ./dist/build/haddock/haddock -h /tmp/PatSymUse.hs /tmp/PatSymDef.hs  -o /tmp                                                                                                                                                                 
Haddock coverage:
Warning: Not found in environment: Some
  50% (  1 /  2) in 'PatSymDef'

/tmp/PatSymUse.hs:9:4:
    Can't find interface-file declaration for data constructor Some
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the pattern: Some a
    In an equation for ‘f’: f (Some a) = a

Here with -ddump-if-trace:

[nix-shell:~/programming/haddock]$ ./dist/build/haddock/haddock -h /tmp/PatSymUse.hs /tmp/PatSymDef.hs -o /tmp --optghc='-ddump-if-trace'
Haddock coverage:
Considering whether to load base:Prelude
Reading interface for base:Prelude;
    reason: Prelude is directly imported
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/Prelude.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/Prelude.dyn_hi
updating EPS_
updating EPS_
Considering whether to load base:GHC.Base {- SYSTEM -}
Reading interface for base:GHC.Base;
    reason: Loading orphan modules (base:GHC.Base)
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Base.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Base.dyn_hi
updating EPS_
Considering whether to load base:GHC.Float {- SYSTEM -}
Reading interface for base:GHC.Float;
    reason: Loading orphan modules (base:GHC.Float)
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Float.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Float.dyn_hi
updating EPS_
Considering whether to load base:GHC.Real {- SYSTEM -}
Reading interface for base:GHC.Real;
    reason: Loading orphan modules (base:GHC.Real)
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Real.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/GHC/Real.dyn_hi
updating EPS_
loadHiBootInterface main@main:PatSymDef
Considering whether to load base:Data.Maybe {- SYSTEM -}
Reading interface for base:Data.Maybe;
    reason: The name ‘Data.Maybe.Just’ is mentioned explicitly
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/Data/Maybe.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/base_DiPQ1siqG3SBjHauL3L03p/Data/Maybe.dyn_hi
updating EPS_
Starting fork { Declaration for Maybe
Loading decl for Data.Maybe.Maybe
updating EPS_
Considering whether to load ghc-prim:GHC.Prim {- SYSTEM -}
Reading interface for ghc-prim:GHC.Prim;
    reason: Need home interface for wired-in thing *
updating EPS_
Start interface-file tc_con_decl Nothing
Done interface-file tc_con_decl Data.Maybe.Nothing
Start interface-file tc_con_decl Just
Done interface-file tc_con_decl Data.Maybe.Just
tcIfaceDecl4 Data.Maybe.Maybe
} ending fork Declaration for Maybe
Starting fork { Constructor Data.Maybe.Nothing
} ending fork Constructor Data.Maybe.Nothing
Starting fork { Constructor Data.Maybe.Just
} ending fork Constructor Data.Maybe.Just

==================== Interface statistics ====================
Renamer stats: 6 interfaces read
               1 type/class/variable imported, out of 776 read
               0 instance decls imported, out of 42 read
               0 rule decls imported, out of 53 read


Need decl for PatSymDef.Some
Considering whether to load main@main:PatSymDef {- SYSTEM -}
Warning: Not found in environment: Some
  50% (  1 /  2) in 'PatSymDef'
Considering whether to load base:Prelude
Considering whether to load main@main:PatSymDef
updating EPS_
Considering whether to load base:GHC.Base {- SYSTEM -}
Considering whether to load base:GHC.Float {- SYSTEM -}
Considering whether to load base:GHC.Real {- SYSTEM -}
loadHiBootInterface main@main:PatSymUse
Considering whether to load base:Data.Maybe {- SYSTEM -}
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Reading interface for ghc-prim:GHC.Types;
    reason: The name ‘GHC.Types.Int’ is mentioned explicitly
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/ghcpr_BE58KUgBe9ELCsPXiJ1Q2r/GHC/Types.hi
readIFace /nix/store/m347lhn3g6sh2s9pv7kz68qs2jyhzphg-ghc-7.9.20140805/lib/ghc-7.9.20140805/ghcpr_BE58KUgBe9ELCsPXiJ1Q2r/GHC/Types.dyn_hi
updating EPS_
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Considering whether to load main@main:PatSymDef {- SYSTEM -}
Considering whether to load base:Data.Maybe {- SYSTEM -}
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Considering whether to load ghc-prim:GHC.Types {- SYSTEM -}
Need decl for PatSymDef.Some
Considering whether to load main@main:PatSymDef {- SYSTEM -}

/tmp/PatSymUse.hs:9:4:
    Can't find interface-file declaration for data constructor Some
      Probable cause: bug in .hi-boot file, or inconsistent .hi file
      Use -ddump-if-trace to get an idea of which file caused the error
    In the pattern: Some a
    In an equation for ‘f’: f (Some a) = a

Originally reported to me against Haddock 2.14.3, GHC 7.8.3 and I can confirm both there and on yesterday's GHC HEAD.

It'd be great if whoever is involved with pattern synonyms could take a look.

Change History (8)

comment:1 Changed 3 years ago by cactus

Keywords: pattern synonyms added

comment:2 Changed 3 years ago by cactus

Owner: set to cactus

comment:3 Changed 3 years ago by Dr. ERDI Gergo <gergo@…>

In f0db1857b053597e9ac43d9ce578e5f5fa0545cb/ghc:

Include pattern synonyms as AConLikes in the type environment,
even for simplified/boot ModDetails (fixes #9417)

comment:4 Changed 3 years ago by cactus

Status: newmerge

comment:5 Changed 3 years ago by cactus

Could someone who knows his way around in Haddock add this as a test case please?

comment:6 Changed 3 years ago by Fuuzetsu

I don't have a HEAD build at the moment. You can simply stick the Haskell source files into html-test/src, run the (Haddock) tests, eye the results in html-test/out and if you're happy with them either copy the results to html-test/ref or use the accept.lhs file to do so for you.

comment:7 Changed 2 years ago by thoughtpolice

Milestone: 7.8.4
Resolution: fixed
Status: mergeclosed

Merged to 7.8.4.

comment:8 Changed 2 years ago by cactus

Keywords: PatternSynonyms added; pattern synonyms removed
Note: See TracTickets for help on using tickets.