Simon Peyton Jones pushed to branch wip/T27731 at Glasgow Haskell Compiler / GHC Commits: d2286d58 by Simon Peyton Jones at 2026-09-27T23:43:04+01:00 Wibbles [skip-ci] - - - - - 2 changed files: - compiler/GHC/Tc/Utils/Monad.hs - testsuite/tests/typecheck/should_fail/ClassOperator.stderr Changes: ===================================== compiler/GHC/Tc/Utils/Monad.hs ===================================== @@ -69,7 +69,7 @@ module GHC.Tc.Utils.Monad( wrapLocM, wrapLocFstM, wrapLocFstMA, wrapLocSndM, wrapLocSndMA, wrapLocM_, wrapLocMA_,wrapLocMA, getErrsVar, setErrsVar, - addErr, + addErr, captureMessagesTcM, failWith, failAt, addErrAt, addErrs, checkErr, checkErrAt, @@ -1604,26 +1604,26 @@ tcTryM thing_inside -- built-in in exception; see IOEnv.failM ----------------------- -capture_constraints :: TcM r -> TcM (r, WantedConstraints) --- capture_constraints simply captures and returns the +captureConstraintsTcM :: TcM r -> TcM (r, WantedConstraints) +-- captureConstraintsTcM simply captures and returns the -- constraints generated by thing_inside -- Precondition: thing_inside must not throw an exception! -- Reason for precondition: an exception would blow past the place -- where we read the lie_var, and we'd lose the constraints altogether -capture_constraints thing_inside +captureConstraintsTcM thing_inside = do { lie_var <- newTcRef emptyWC ; res <- updLclEnv (\ env -> env { tcl_lie = lie_var }) $ thing_inside ; lie <- readTcRef lie_var ; return (res, lie) } -capture_messages :: TcM r -> TcM (r, Messages TcRnMessage) --- capture_messages simply captures and returns the +captureMessagesTcM :: TcM r -> TcM (r, Messages TcRnMessage) +-- captureMessagesTcM simply captures and returns the -- errors and warnings generated by thing_inside -- Precondition: thing_inside must not throw an exception! -- Reason for precondition: an exception would blow past the place -- where we read the msg_var, and we'd lose the constraints altogether -capture_messages thing_inside +captureMessagesTcM thing_inside = do { msg_var <- newTcRef emptyMessages ; res <- setErrsVar msg_var thing_inside ; msgs <- readTcRef msg_var @@ -1643,8 +1643,8 @@ capture_messages thing_inside -- propagate any errors/warnings generated by m askErrsFound :: TcRn a -> TcRn (a, Bool) askErrsFound thing_inside - = do { ((mb_res, lie), msgs) <- capture_messages $ - capture_constraints $ + = do { ((mb_res, lie), msgs) <- captureMessagesTcM $ + captureConstraintsTcM $ tcTryM thing_inside ; addMessages msgs @@ -1665,7 +1665,7 @@ tryCaptureConstraints :: TcM a -> TcM (Maybe a, WantedConstraints) -- it returns Nothing and the /insoluble/ constraints -- Error messages are propagated tryCaptureConstraints thing_inside - = do { (mb_res, lie) <- capture_constraints $ + = do { (mb_res, lie) <- captureConstraintsTcM $ tcTryM thing_inside -- See Note [Constraints and errors] @@ -1794,7 +1794,7 @@ tryTc :: TcRn a -> TcRn (Maybe a, Messages TcRnMessage) -- It also returns all the errors and warnings accumulated by m -- It always succeeds (never raises an exception) tryTc thing_inside - = capture_messages (attemptM thing_inside) + = captureMessagesTcM (attemptM thing_inside) ----------------------- discardErrs :: TcRn a -> TcRn a @@ -1827,8 +1827,8 @@ tryTcDiscardingErrs' :: (WantedConstraints -> Messages TcRnMessage -> r -> Bool) -- otherwise discard everything from 'thing_inside', including errors, -- and try 'recover' instead. tryTcDiscardingErrs' validate recover_invalid recover_error thing_inside - = do { ((mb_res, lie), msgs) <- capture_messages $ - capture_constraints $ + = do { ((mb_res, lie), msgs) <- captureMessagesTcM $ + captureConstraintsTcM $ tcTryM thing_inside ; case mb_res of Just res | not (errorsFound msgs) ===================================== testsuite/tests/typecheck/should_fail/ClassOperator.stderr ===================================== @@ -1,52 +1,52 @@ - ClassOperator.hs:14:3: error: [GHC-39999] • Could not deduce ‘a ><> b0’ from the context: a ><> b bound by the type signature for: - (**>) :: forall a b. (a ><> b) => a -> a -> () + (<**) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:14:3-44 The type variable ‘b0’ is ambiguous - • In the ambiguity check for ‘**>’ + • In the ambiguity check for ‘<**’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the class method: - (**>) :: forall a b. (a ><> b) => a -> a -> () + (<**) :: forall a b. (a ><> b) => a -> a -> () In the class declaration for ‘><>’ ClassOperator.hs:14:3: error: [GHC-39999] • Could not deduce ‘a ><> b0’ from the context: a ><> b bound by the type signature for: - (**<) :: forall a b. (a ><> b) => a -> a -> () + (>**) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:14:3-44 The type variable ‘b0’ is ambiguous - • In the ambiguity check for ‘**<’ + • In the ambiguity check for ‘>**’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the class method: - (**<) :: forall a b. (a ><> b) => a -> a -> () + (>**) :: forall a b. (a ><> b) => a -> a -> () In the class declaration for ‘><>’ ClassOperator.hs:14:3: error: [GHC-39999] • Could not deduce ‘a ><> b0’ from the context: a ><> b bound by the type signature for: - (>**) :: forall a b. (a ><> b) => a -> a -> () + (**<) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:14:3-44 The type variable ‘b0’ is ambiguous - • In the ambiguity check for ‘>**’ + • In the ambiguity check for ‘**<’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the class method: - (>**) :: forall a b. (a ><> b) => a -> a -> () + (**<) :: forall a b. (a ><> b) => a -> a -> () In the class declaration for ‘><>’ ClassOperator.hs:14:3: error: [GHC-39999] • Could not deduce ‘a ><> b0’ from the context: a ><> b bound by the type signature for: - (<**) :: forall a b. (a ><> b) => a -> a -> () + (**>) :: forall a b. (a ><> b) => a -> a -> () at ClassOperator.hs:14:3-44 The type variable ‘b0’ is ambiguous - • In the ambiguity check for ‘<**’ + • In the ambiguity check for ‘**>’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the class method: - (<**) :: forall a b. (a ><> b) => a -> a -> () + (**>) :: forall a b. (a ><> b) => a -> a -> () In the class declaration for ‘><>’ + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d2286d58c40bba550efdf12b2870b66c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d2286d58c40bba550efdf12b2870b66c... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Simon Peyton Jones (@simonpj)