[GHC] #5273: error and undefined should print a location
GHC
ghc-devs at haskell.org
Wed Sep 2 11:22:42 UTC 2015
#5273: error and undefined should print a location
-------------------------------------+-------------------------------------
Reporter: augustss | Owner:
Type: feature request | Status: patch
Priority: low | Milestone: 7.12.1
Component: Compiler | Version: 7.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: 9049 | Differential Revisions: Phab:D861
-------------------------------------+-------------------------------------
Comment (by Ben Gamari <ben@…>):
In [changeset:"6740d70d95cb81cea3859ff847afc61ec439db4f/ghc"
6740d70d/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="6740d70d95cb81cea3859ff847afc61ec439db4f"
Use IP based CallStack in error and undefined
This patch modifies `error`, `undefined`, and `assertError` to use
implicit call-stacks to provide better error messages to users.
There are a few knock-on effects:
- `GHC.Classes.IP` is now wired-in so it can be used in the wired-in
types for `error` and `undefined`.
- `TysPrim.tyVarList` has been replaced with a new function
`TysPrim.mkTemplateTyVars`. `tyVarList` made it easy to introduce
subtle bugs when you need tyvars of different kinds. The naive
```
tv1 = head $ tyVarList kind1
tv2 = head $ tyVarList kind2
```
would result in `tv1` and `tv2` sharing a `Unique`, thus substitutions
would be applied incorrectly, treating `tv1` and `tv2` as the same
tyvar. `mkTemplateTyVars` avoids this pitfall by taking a list of kinds
and producing a single tyvar of each kind.
- The types `GHC.SrcLoc.SrcLoc` and `GHC.Stack.CallStack` now live in
ghc-prim.
- The type `GHC.Exception.ErrorCall` has a new constructor
`ErrorCallWithLocation` that takes two `String`s instead of one, the
2nd one being arbitrary metadata about the error (but usually the
call-stack). A bi-directional pattern synonym `ErrorCall` continues to
provide the old API.
Updates Cabal, array, and haddock submodules.
Reviewers: nh2, goldfire, simonpj, hvr, rwbarton, austin, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, rodlogic, goldfire, maoe, simonmar, carter,
liyang, bgamari, thomie
Differential Revision: https://phabricator.haskell.org/D861
GHC Trac Issues: #5273
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5273#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list