Opened 10 months ago

Closed 7 months ago

#12548 closed bug (fixed)

Exported pattern synonyms does not mark top-level bindings in RHS as used

Reported by: pkmx Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: PatternSynonyms, newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case: rename/should_compile/T12548
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


{-# LANGUAGE PatternSynonyms #-}

module Foo (pattern P) where

x :: Int
x = 0

pattern P :: Int
pattern P <- _ where
        P = x


Foo.hs:6:1: warning: [-Wunused-top-binds]
    Defined but not used: ‘x’

Change History (3)

comment:1 Changed 10 months ago by mpickering

Keywords: newcomer added

comment:2 Changed 7 months ago by Simon Peyton Jones <simonpj@…>

In 6305674/ghc:

Fix used-variable calculation (Trac #12548)

The used-variable calculation for pattern synonyms is a little
tricky, for reasons described in RnBinds
Note [Pattern synonym builders don't yield dependencies]

It was right semantically, but the "unused-variable warning" was
wrong, which led to Trac #12548.

comment:3 Changed 7 months ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: rename/should_compile/T12548

Thanks for the example!

Note: See TracTickets for help on using tickets.