Commit 07ed2413 authored by niteria's avatar niteria
Browse files

Use a correct substitution in tcCheckPatSynDecl

The `substTheta` call didn't have the free variables of the
`prov_theta` in the `in_scope` set. It should be enough to add
`univ_tvs`, as all the `ex_tvs` are already in the domain of
the substitution.

Test Plan: added a testcase

Reviewers: simonpj, bgamari, goldfire, austin

Reviewed By: simonpj, bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1879

GHC Trac Issues: #11524
parent 01c587c0
......@@ -251,7 +251,13 @@ tcCheckPatSynDecl PSB{ psb_id = lname@(L _ name), psb_args = details
else newMetaSigTyVars ex_tvs
-- See the "Existential type variables part of
-- Note [Checking against a pattern signature]
; prov_dicts <- mapM (emitWanted origin) (substTheta subst prov_theta)
; prov_dicts <- mapM (emitWanted origin)
(substTheta (extendTCvInScopeList subst univ_tvs) prov_theta)
-- Add the free vars of 'prov_theta' to the in_scope set to
-- satisfy the substition invariant. There's no need to
-- add 'ex_tvs' as they are already in the domain of the
-- substitution.
-- See also Note [The substitution invariant] in TyCoRep.
; args' <- zipWithM (tc_arg subst) arg_names arg_tys
; return (ex_tvs', prov_dicts, args') }
......
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeInType #-}
module T11524 where
data AType (a :: k) where
AMaybe :: AType Maybe
AInt :: AType Int
AApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1).
AType a -> AType b -> AType (a b)
pattern PApp :: () => (fun ~ a b) => AType a -> AType b -> AType fun
--pattern PApp :: forall k (fun :: k) k1 (a :: k1 -> k) (b :: k1).
-- () => (fun ~ a b) => AType a -> AType b -> AType fun
pattern PApp fun arg <- AApp fun arg
......@@ -502,3 +502,4 @@ test('RebindHR', normal, compile, [''])
test('RebindNegate', normal, compile, [''])
test('T11397', normal, compile, [''])
test('T11458', normal, compile, [''])
test('T11524', normal, compile, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment