diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/typecheck/TcDerivInfer.hs index 93dcf4383ccf3b5c3b7b95b79d9bc46d26a37308..bbd054cb937f3a9ddd55207e954b8884b963a102 100644 --- a/compiler/typecheck/TcDerivInfer.hs +++ b/compiler/typecheck/TcDerivInfer.hs @@ -622,6 +622,8 @@ simplifyDeriv pred tvs thetas -- Simplify the constraints ; solved_implics <- runTcSDeriveds $ solveWantedsAndDrop $ unionsWC wanteds + -- It's not yet zonked! Obviously zonk it before peering at it + ; solved_implics <- zonkWC solved_implics -- See [STEP DAC HOIST] -- Split the resulting constraints into bad and good constraints, diff --git a/testsuite/tests/deriving/should_compile/T14339.hs b/testsuite/tests/deriving/should_compile/T14339.hs new file mode 100644 index 0000000000000000000000000000000000000000..e2521f2de0c741bac0af1345f532fa0141c827f0 --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T14339.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE UndecidableInstances #-} +module Bug where + +import GHC.TypeLits + +newtype Baz = Baz Foo + deriving Bar + +newtype Foo = Foo Int + +class Bar a where + bar :: a + +instance (TypeError (Text "Boo")) => Bar Foo where + bar = undefined diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index 5f94f9d7e4168ab7041deeec359b86a8452f9fd5..86648d3edf2561436b9ada294215da107d4f2b1f 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -89,3 +89,4 @@ test('T13272', normal, compile, ['']) test('T13272a', normal, compile, ['']) test('T13297', normal, compile, ['']) test('T14331', normal, compile, ['']) +test('T14339', normal, compile, [''])