[Git][ghc/ghc][wip/T24676] Wibbles
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Tue Jun 4 13:49:06 UTC 2024
Simon Peyton Jones pushed to branch wip/T24676 at Glasgow Haskell Compiler / GHC
Commits:
b6a7f3de by Simon Peyton Jones at 2024-06-04T14:48:35+01:00
Wibbles
- - - - -
4 changed files:
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Utils/TcType.hs
- testsuite/tests/typecheck/should_fail/T8450.hs
- testsuite/tests/typecheck/should_fail/T8450.stderr
Changes:
=====================================
compiler/GHC/Tc/Gen/App.hs
=====================================
@@ -119,8 +119,7 @@ Note [Instantiation variables are short lived]
variables can be unified with a polytype (by `qlUnify`).
* By the time QL is done, all filled-in occurrences of instantiation variables
- have been zonked away with `qlZonkTcType` (see "Crucial step" in tcValArgs).
- See also Note [QuickLook zonking] in GHC.Tc.Zonk.TcType
+ have been zonked away with `zonkTcType` (see "Crucial step" in tcValArgs).
See Section 4.3 "Applications and instantiation" of the paper.
@@ -294,7 +293,8 @@ Now we split into two cases:
Note [Unify with expected type before typechecking arguments]
5.2 Check the arguments with `tcValArgs`. Importantly, this will monomorphise
- all the instantiation variables of the call. See Note [qlMonoTcType]
+ all the instantiation variables of the call.
+ See Note [Monomorphise instantiation variables].
5.3 Use `zonkTcType` to expose the polymophism hidden under instantiation
variables in `app_res_rho`, and the monomorphic versions of any
@@ -526,7 +526,6 @@ tcValArg do_ql (EValArg { ea_ctxt = ctxt
-- Then Theta = [p :-> forall a. a->a], and we want
-- to check 'e' with expected type (forall a. a->a)
-- See Note [Instantiation variables are short lived]
- -- and Note [QuickLook zonking] in GHC.Tc.Zonk.TcType
; Scaled mult exp_arg_ty <- case do_ql of
DoQL -> liftZonkM $ zonkScaledTcType sc_arg_ty
NoQL -> return sc_arg_ty
=====================================
compiler/GHC/Tc/Utils/TcType.hs
=====================================
@@ -699,7 +699,7 @@ data TcLevel = TcLevel Int#
| QLInstVar
-- See Note [TcLevel invariants] for what this Int is
-- See also Note [TcLevel assignment]
- -- See also Note [The TcLevel QLInstVar]
+ -- See also Note [The QLInstVar TcLevel]
{-
Note [TcLevel invariants]
@@ -734,7 +734,7 @@ Note [TcLevel invariants]
The level of a MetaTyVar also governs its untouchability. See
Note [Unification preconditions] in GHC.Tc.Utils.Unify.
- -- See also Note [The TcLevel QLInstVar]
+ -- See also Note [The QLInstVar TcLevel]
Note [TcLevel assignment]
~~~~~~~~~~~~~~~~~~~~~~~~~
=====================================
testsuite/tests/typecheck/should_fail/T8450.hs
=====================================
@@ -7,5 +7,8 @@ runEffect = undefined
run :: forall a. a
run = runEffect $ (undefined :: Either a ())
-{- Either a () ~ Either Bool alpha
- a ~ alpha -}
\ No newline at end of file
+{-
+r:=a
+Expected: Either Bool a
+Actual: Either a ()
+-}
=====================================
testsuite/tests/typecheck/should_fail/T8450.stderr
=====================================
@@ -1,11 +1,15 @@
-
-T8450.hs:8:7: error: [GHC-25897]
- • Couldn't match expected type ‘a’ with actual type ‘()’
+T8450.hs:8:18: error: [GHC-25897]
+ • Couldn't match type ‘a’ with ‘Bool’
+ Expected: Either Bool a
+ Actual: Either a ()
‘a’ is a rigid type variable bound by
the type signature for:
run :: forall a. a
at T8450.hs:7:1-18
- • In the expression: runEffect $ (undefined :: Either a ())
+ • In the first argument of ‘runEffect’, namely
+ ‘(undefined :: Either a ())’
+ In the expression: runEffect (undefined :: Either a ())
In an equation for ‘run’:
- run = runEffect $ (undefined :: Either a ())
+ run = runEffect (undefined :: Either a ())
• Relevant bindings include run :: a (bound at T8450.hs:8:1)
+
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b6a7f3de755306e5188e420f0d4f38b6a1bebab5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b6a7f3de755306e5188e420f0d4f38b6a1bebab5
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240604/dc275120/attachment-0001.html>
More information about the ghc-commits
mailing list