Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

# Version 0.18.0.0 (2025-10-09)

- Bugfix for v0.18.0.0: deal with constraints generated by unflattening
in `splitTyConApp_upTo`. Fixes #19.

# Version 0.18.0.0 (2025-09-15)

- On GHC 9.0 and below, `ghc-tcplugin-api` will now automatically unflatten all
Expand Down
2 changes: 1 addition & 1 deletion ghc-tcplugin-api.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: ghc-tcplugin-api
version: 0.18.0.0
version: 0.18.1.0
synopsis: An API for type-checker plugins.
license: BSD-3-Clause
build-type: Simple
Expand Down
17 changes: 12 additions & 5 deletions src/GHC/TcPlugin/API/TyConSubst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down Expand Up @@ -403,16 +404,13 @@ isCanonicalVarEq = \case
Just (cc_tyvar, cc_rhs, cc_eq_rel)
CFunEqCan { cc_fsk, cc_fun, cc_tyargs } ->
Just (cc_fsk, mkTyConApp cc_fun cc_tyargs, NomEq)
_otherwise -> Nothing
#elif __GLASGOW_HASKELL__ < 907
CEqCan { cc_lhs, cc_rhs, cc_eq_rel }
| TyVarLHS var <- cc_lhs
-> Just (var, cc_rhs, cc_eq_rel)
| TyFamLHS tyCon args <- cc_lhs
, Just var <- getTyVar_maybe cc_rhs
-> Just (var, mkTyConApp tyCon args, NomEq)
_otherwise
-> Nothing
#else
CEqCan eqCt
| TyVarLHS var <- lhs
Expand All @@ -424,9 +422,18 @@ isCanonicalVarEq = \case
lhs = eq_lhs eqCt
rhs = eq_rhs eqCt
rel = eq_eq_rel eqCt
_otherwise
-> Nothing
#endif
-- Deal with CNonCanonical, which are produced by ghc-tcplugin-api
-- in GHC 9.0 and below due to 'unflattenCts'.
ct@(CNonCanonical {})
| EqPred rel lhs rhs <- classifyPredType (ctPred ct)
-> if | Just tv <- getTyVar_maybe lhs
-> Just (tv, rhs, rel)
| Just tv <- getTyVar_maybe rhs
-> Just (tv, lhs, rel)
| otherwise
-> Nothing
_ -> Nothing

{-------------------------------------------------------------------------------
Internal auxiliary
Expand Down
Loading