summaryrefslogtreecommitdiff
path: root/testsuite/tests/pmcheck/should_compile/T21662.hs
blob: 1a3ff6cb6e2c80a0e8174ec8a8e811b71254175d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeApplications #-}

module T21662 where

import GHC.TypeNats (Nat, KnownNat)

view_fn :: forall (n :: Nat). KnownNat n => Int -> Bool
view_fn i = i > 0

foo :: Int -> Int
foo (view_fn @12 -> True) = 0
foo (view_fn @12 -> False) = 0

  -- The point is that the two view pattern functions "view_fn"
  -- may get different uniques for the KnownNat 12 dictionary,
  -- which leads to a spurious pattern match warning.