diff --git a/compiler/GHC/Tc/Gen/Bind.hs b/compiler/GHC/Tc/Gen/Bind.hs index 6079f9e3cc3f28f5db07585ea748046750e3fc39..9bfbcdbb1d8e0799bc3346e5ee687af9d3a7d066 100644 --- a/compiler/GHC/Tc/Gen/Bind.hs +++ b/compiler/GHC/Tc/Gen/Bind.hs @@ -291,7 +291,7 @@ tcLocalBinds (HsIPBinds x (IPBinds _ ip_binds)) thing_inside -- ?y = ?x + 1 tc_ip_bind :: Class -> IPBind GhcRn -> TcM (DictId, IPBind GhcTc) tc_ip_bind ipClass (IPBind _ l_name@(L _ ip) expr) - = do { ty <- newOpenFlexiTyVarTy + = do { ty <- newFlexiTyVarTy liftedTypeKind -- see #24298 ; let p = mkStrLitTy $ hsIPNameFS ip ; ip_id <- newDict ipClass [ p, ty ] ; expr' <- tcCheckMonoExpr expr ty diff --git a/testsuite/tests/typecheck/should_fail/T24298.hs b/testsuite/tests/typecheck/should_fail/T24298.hs new file mode 100644 index 0000000000000000000000000000000000000000..953c72bdfecbbcf130eba3c3e9c938267e59cb99 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T24298.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE ImplicitParams, MagicHash #-} +module T24298 where + +f = let ?foo = 4# in True diff --git a/testsuite/tests/typecheck/should_fail/T24298.stderr b/testsuite/tests/typecheck/should_fail/T24298.stderr new file mode 100644 index 0000000000000000000000000000000000000000..6af3f18ab758d72a95c32b33c9567557e7d415cf --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T24298.stderr @@ -0,0 +1,9 @@ + +T24298.hs:4:16: error: [GHC-18872] + • Couldn't match a lifted type with an unlifted type + When matching types + t0 :: * + GHC.Prim.Int# :: TYPE GHC.Types.IntRep + • In the expression: 4# + In the expression: let ?foo = 4# in True + In an equation for ‘f’: f = let ?foo = 4# in True diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 82661689a1d4f3f7e31b4974e6ac89ca2a3fa0ae..48f1f7d1b4a2dd5fe61ac505bdab913dd6597ded 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -710,3 +710,4 @@ test('T23776', normal, compile_fail, ['']) # error due to -Werror=compat, schedu test('T17940', normal, compile_fail, ['']) test('ErrorIndexLinks', normal, compile_fail, ['-fprint-error-index-links=always']) test('T24064', normal, compile_fail, ['']) +test('T24298', normal, compile_fail, [''])