summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Update Cabal submodule & ghc-pkg to use new module re-export typesEdward Z. Yang2014-09-241-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The main change is that Cabal changed the representation of module re-exports to distinguish reexports in source .cabal files versus re-exports in installed package registraion files. Cabal now also does the resolution of re-exports to specific installed packages itself, so ghc-pkg no longer has to do this. This is a cleaner design overall because re-export resolution can fail so it is better to do it during package configuration rather than package registration. It also simplifies the re-export representation that ghc-pkg has to use. Add extra ghc-pkg sanity check for module re-exports and duplicates For re-exports, check that the defining package exists and that it exposes the defining module (or for self-rexport exposed or hidden modules). Also check that the defining package is actually a direct or indirect dependency of the package doing the re-exporting. Also add a check for duplicate modules in a package, including re-exported modules. Test Plan: So far the sanity checks are totally untested. Should add some test case to make sure the sanity checks do catch things correctly, and don't ban legal things. Reviewers: austin, duncan Subscribers: angerman, simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D183 GHC Trac Issues:
* Change all hashbangs to /usr/bin/env (#9057)Thomas Miedema2014-09-231-1/+1
| | | | | | | | | | | | | | | | | | Summary: ``` git grep -l '#!' | xargs sed -i 's|#!.*/bin/\([^ ]*\)$|#!/usr/bin/env \1|' ``` and some manual tweaking Test Plan: harbormaster Reviewers: austin Subscribers: hvr, simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D237 GHC Trac Issues: #9057
* Delete all /* ! __GLASGOW_HASKELL__ */ codeThomas Miedema2014-09-2310-197/+2
| | | | | | | | | | | | | | | | | Summary: ``` git grep -l '\(#ifdef \|#if defined\)(\?__GLASGOW_HASKELL__)\?' ``` Test Plan: validate Reviewers: rwbarton, hvr, austin Reviewed By: rwbarton, hvr, austin Subscribers: rwbarton, simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D218
* Delete hack when takeDirectory returns ""Thomas Miedema2014-09-231-5/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: Since commits 8fe1f8 and bb6731 in the filepath packages (ticket #2034, closed in 2010), takeDirectory "foo" returns ".", and not "", so this check is no longer needed. Other commits: * Remove trailing whitespace * Update comments for #2278 Test Plan: harbormaster Reviewers: austin Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D213 GHC Trac Issues: #2034
* Ensure that loop breakers are computed when glommingSimon Peyton Jones2014-09-231-12/+30
| | | | | | | | | | | | | | | | | This patch fixes Trac #9583, a loop in the simplifier. I thought this was going to be very complicated but it turned out to be very simple! The occurrence analyser does something called "glomming" if the application of imported RULES means that something that didn't look recursive becomes recursive. See `Note [Glomming]` in `OccurAnal`. Under these circumstances we group all the top-level bindings into a single massive `Rec`. But, crucially, I failed to repeat the occurrence analysis on this glommed set of bindings. That means that we weren't establishing the right loop breakers (indeed there were no loop breakers whatsoever), and that led immediately to the loop. The only surprising this is that it didn't happen before.
* Export `Monoid(..)`/`Foldable(..)`/`Traversable(..)` from PreludeHerbert Valerio Riedel2014-09-2113-4/+32
| | | | | | | | | | | | | | | This finally exposes also the methods of these 3 classes in the Prelude in order to allow to define basic class instances w/o needing imports. This almost completes the primary goal of #9586 NOTE: `fold`, `foldl'`, `foldr'`, and `toList` are not exposed yet, as they require upstream fixes for at least `containers` and `bytestring`, and are not required for defining basic instances. Reviewed By: ekmett, austin Differential Revision: https://phabricator.haskell.org/D236
* Change linker message verbosity to `-v2` (re #7863)Herbert Valerio Riedel2014-09-201-1/+1
| | | | | | | | | | | | | | | | With this change, the linker status logging output such as Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. is suppressed unless verbosity level is `-v2` or higher. This is done to reduce the compiler message noise when TH is involved, which can reduce the visibiliy of compile warnings. Reviewed By: ekmett, austin Differential Revision: https://phabricator.haskell.org/D232
* TyposKrzysztof Gogolewski2014-09-192-3/+3
|
* Clean up Coercible handling, and interaction of data families with newtypesSimon Peyton Jones2014-09-1912-217/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes Trac #9580, in which the Coercible machinery succeeded even though the relevant data constructor was not in scope. As usual I got dragged into a raft of refactoring changes, all for the better. * Delete TcEvidence.coercionToTcCoercion (now unused) * Move instNewTyConTF_maybe, instNewTyCon_maybe to FamInst, and rename them to tcInstNewTyConTF_maybe, tcInstNewTyCon (They both return TcCoercions.) * tcInstNewTyConTF_maybe also gets more convenient type, which improves TcInteract.getCoercibleInst * Define FamInst.tcLookupDataFamInst, and use it in TcDeriv, (as well as in tcInstNewTyConTF_maybe) * Improve error report for Coercible errors, when data familes are involved Another use of tcLookupDataFamInst * In TcExpr.tcTagToEnum, use tcLookupDataFamInst to replace local hacky code * Fix Coercion.instNewTyCon_maybe and Type.newTyConInstRhs to deal with eta-reduced newtypes, using (new) Type.unwrapNewTyConEtad_maybe and (new) Type.applyTysX Some small refactoring of TcSMonad.matchFam.
* White space onlySimon Peyton Jones2014-09-191-2/+2
|
* Define Util.leLength :: [a] -> [b] -> BoolSimon Peyton Jones2014-09-191-1/+9
|
* Fix garbled comment wordingSimon Peyton Jones2014-09-191-2/+3
| | | | Thanks to Gabor for pointing this out
* Use mapAccumL (refactoring only)Simon Peyton Jones2014-09-191-8/+1
| | | | Fixes Trac #9529
* Increase -fcontext-stack=N default to 100Simon Peyton Jones2014-09-191-1/+2
| | | | This addresses Trac #5395
* Revert accidental wip/generics-propeq-conservative mergeHerbert Valerio Riedel2014-09-191-18/+16
| | | | | | | | | | | | | | | | This commit reverts the commits e12a6a8 Propositional equality for Datatype meta-information 0a8e6fc Make constructor metadata parametrized (with intended parameter <- datatype) f097b77 Implement sameConstructor cc618e6 get roles right and fix a FIXME 79c7125 Actually parametrize the Constructor with the Datatype 7bd4bab Supply a reasonable name (should be derived from d_name tho) 09fcd70 Use 'd_name' as the name (should be derived from d_name tho) 4d90e44 Add default case (fixes -Werror) and effectively resets ghc.git to the state it was at commit 8c79dcb4dc2c6b8b663fa0c2e61d40d0ac0e9996
* Use 'd_name' as the name (should be derived from d_name tho)Gabor Greif2014-09-191-1/+1
|
* Supply a reasonable name (should be derived from d_name tho)Gabor Greif2014-09-191-1/+1
|
* Actually parametrize the Constructor with the DatatypeGabor Greif2014-09-191-2/+3
|
* get roles right and fix a FIXMEGabor Greif2014-09-191-16/+17
|
* Add -fwarn-context-quantification (#4426)Krzysztof Gogolewski2014-09-188-24/+93
| | | | | | | | | | | | | | | | | | | | | | Summary: This warning (enabled by default) reports places where a context implicitly binds a type variable, for example type T a = {-forall m.-} Monad m => a -> m a Also update Haddock submodule. Test Plan: validate Reviewers: hvr, goldfire, simonpj, austin Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D211 GHC Trac Issues: #4426
* Comments only: explain checkAxInstCo in OptCoercionRichard Eisenberg2014-09-181-13/+48
|
* Implement `decodeDouble_Int64#` primopHerbert Valerio Riedel2014-09-171-0/+5
| | | | | | | | | | | | | | | The existing `decodeDouble_2Int#` primop is rather inconvenient to use (and in fact is not even used by `integer-gmp`) as the mantissa is split into 3 components which would actually fit in an `Int64#` value. However, `decodeDouble_Int64#` is to be used by the new `integer-gmp2` re-implementation (see #9281). Moreover, `decodeDouble_2Int#` performs direct bit-wise operations on the IEEE representation which can be replaced by a combination of the portable standard C99 `scalbn(3)` and `frexp(3)` functions. Differential Revision: https://phabricator.haskell.org/D160
* Typo in commentGabor Greif2014-09-171-1/+1
|
* SimplifyGabor Greif2014-09-171-12/+10
|
* TypoGabor Greif2014-09-171-1/+1
|
* Return nBytes instead of nextAddr from utf8DecodeCharThomas Miedema2014-09-163-28/+29
| | | | | | | | | | | | | | | | | | | | | Summary: While researching D176, I came across the following simplification opportunity: Not all functions that call utf8DecodeChar actually need the address of the next char. And some need the 'number of bytes' read. So returning nBytes instead of nextAddr should save a few addition and subtraction operations, and makes the code a bit simpler. Test Plan: it validates Reviewers: simonmar, ezyang, austin Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D179
* Add the ability to :set -l{foo} in ghci, fix #1407.archblob2014-09-161-9/+20
| | | | | | | | | | | | | | | | | | Summary: The dynamic linking code was already there but it was not called on flag changes in ghci. Test Plan: validate Reviewers: hvr, simonmar, austin Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D194 GHC Trac Issues: #1407
* Remove special casing of singleton strings, split all strings.Thijs Alkemade2014-09-162-6/+56
| | | | | | | | | | | | | | | | | | | | | Summary: exprIsConApp_maybe now detects string literals and correctly splits them. This means case-statemnts on string literals can now push the literal into the cases. fix trac issue #9400 Test Plan: validate Reviewers: austin, simonpj Reviewed By: austin, simonpj Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D199 GHC Trac Issues: #9400
* Don't offer hidden modules for autocomplete.Edward Z. Yang2014-09-151-1/+2
| | | | | | | It was annoying to test GHCi directly, so I added a ghc-api unit test of the function instead. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Export `Traversable()` and `Foldable()` from PreludeHerbert Valerio Riedel2014-09-152-2/+9
| | | | | | | | | | | | | | | | | | | | | | This exposes *only* the type-classes w/o any of their methods. This is the very first step for implementing BPP (see #9586), which already requires breaking up several import-cycles leading back to `Prelude`. Ideally, importing `Prelude` should be avoided in most `base` modules, as `Prelude` does not define any entities, but rather re-exports existing ones. Test Plan: validate passes Reviewers: ekmett, austin Reviewed By: ekmett, austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D209 GHC Trac Issues: #9586
* Detabify primops.txt.ppHerbert Valerio Riedel2014-09-131-178/+178
|
* Move docstring of `seq` to primops.txt.ppHerbert Valerio Riedel2014-09-131-2/+11
| | | | | | | | | | | The documentation for `seq` was recently augmented via #9390 & cbfa107604f4cbfaf02bd633c1faa6ecb90c6dd7. However, it doesn't show up in the Haddock generated docs because `#ifdef __HADDOCK__` doesn't work as expected. Also, it's easier to just fix the problem at the origin (which in this is case is the primops.txt.pp file). The benefit/downside of this is that now the extended documentation shows up everywhere `seq` is re-exported directly.
* Fix support for deriving Generic1 for data families (FIX #9563)Jose Pedro Magalhaes2014-09-121-4/+5
|
* Make GHC `time-1.5`-readyHerbert Valerio Riedel2014-09-101-1/+1
| | | | | | | This also updates a few submodules to have their upper-bounds on `time` relaxed to allow `time-1.5`. The only package that can't be upgraded yet is `Cabal` due to API changes breaking `ghc-cabal`. This needs to be addressed in a future commit.
* Kill obsolete pre GHC 7.6 bootstrapping supportHerbert Valerio Riedel2014-09-101-3/+0
| | | | | This left-over is definitely not needed anymore and was probably missed in 527bcc41630918977c7
* Make Applicative a superclass of MonadAustin Seipp2014-09-0963-127/+234
| | | | | | | | | | | | | | | | | | | | | Summary: This includes pretty much all the changes needed to make `Applicative` a superclass of `Monad` finally. There's mostly reshuffling in the interests of avoid orphans and boot files, but luckily we can resolve all of them, pretty much. The only catch was that Alternative/MonadPlus also had to go into Prelude to avoid this. As a result, we must update the hsc2hs and haddock submodules. Signed-off-by: Austin Seipp <austin@well-typed.com> Test Plan: Build things, they might not explode horribly. Reviewers: hvr, simonmar Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D13
* PostTcType replaced with TypeAnnotAlan Zimmerman2014-09-0634-689/+1021
| | | | | | | | | | | | | | | | | | | | | Summary: This is a first step toward allowing generic traversals of the AST without 'landmines', by removing the `panic`s located throughout `placeHolderType`, `placeHolderKind` & co. See more on the discussion at https://www.mail-archive.com/ghc-devs@haskell.org/msg05564.html (This also makes a corresponding update to the `haddock` submodule.) Test Plan: `sh validate` and new tests pass. Reviewers: austin, simonpj, goldfire Reviewed By: austin, simonpj, goldfire Subscribers: edsko, Fuuzetsu, thomasw, holzensp, goldfire, simonmar, relrod, ezyang, carter Projects: #ghc Differential Revision: https://phabricator.haskell.org/D157
* pprC: declare extern cmm primitives as functions, not dataSergei Trofimovich2014-09-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The commit fixes incorrect code generation of integer-gmp package on ia64 due to C prototypes mismatch. Before the patch prototypes for "foreign import prim" were: StgWord poizh[]; After the patch they became: StgFunPtr poizh(); Long story: Consider the following simple example: {-# LANGUAGE MagicHash, GHCForeignImportPrim, UnliftedFFITypes #-} module M where import GHC.Prim -- Int# foreign import prim "poizh" poi# :: Int# -> Int# Before the patch unregisterised build generated the following 'poizh' reference: EI_(poizh); /* StgWord poizh[]; */ FN_(M_poizh_entry) { // ... JMP_((W_)&poizh); } After the patch it looks this way: EF_(poizh); /* StgFunPtr poizh(); */ FN_(M_poizh_entry) { // ... JMP_((W_)&poizh); } On ia64 it leads to different relocation types being generated: incorrect one: addl r14 = @ltoffx(poizh#) ld8.mov r14 = [r14], poizh# ; r14 = address-of 'poizh#' correct one: addl r14 = @ltoff(@fptr(poizh#)), gp ; r14 = address-of-thunk 'poizh#' ld8 r14 = [r14] '@fptr(poizh#)' basically instructs assembler to creates another obect consisting of real address to 'poizh' instructions and module address. That '@fptr' object is used as a function "address" This object is different for every module referencing 'poizh' symbol. All indirect function calls expect '@fptr' object. That way call site reads real destination address and set destination module address in 'gp' register from '@fptr'. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Small improvement to unsaturated-type-function error messageSimon Peyton Jones2014-09-041-1/+3
|
* systools: fix gcc version detecton on non-english localeSergei Trofimovich2014-09-021-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: ghc runs 'gcc -v' to check if we run under vanilla gcc or disaguised clang by checking for string "gcc version <something>" But this check does not always work as gcc has that string localized via gettext mechanism: (some gcc's locale strings) be.po-msgstr "версія gcc %s\n" da.po-msgstr "GCC version %s\n" de.po-msgstr "gcc-Version %s %s\n" el.po-msgstr "έκδοση gcc %s\n" ... To ping gcc to English locale we now override environment variable with 'LANGUAGE=en' value. Fixes Issue #8825 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: validate Reviewers: austin Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D185 GHC Trac Issues: #8825
* Make Lexer.x more like the 2010 reportThomas Miedema2014-09-011-42/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I tried reading the lexer and the 2010 report side-by-side. Althought I didn't quite finish, here are some small discrepancies that I found. This revision may be low priority for reviewers, but having these commits just in my local repository does no good either. Changes: * $nl was defined, but not used anywhere * formfeed is a newline character * add \: to $ascsymbol For simplification reason, the colon (':') was added to the character set $ascsymbol in the 2010 report. Here we make the same change. * introduce the macros `qvarid`, `qconid`, `qvarsym` and `qconsym` * foreign is a Haskell keyword * add/update comments Test Plan: Harbormaster (is awesome) Reviewers: simonmar, hvr, austin Reviewed By: austin Subscribers: hvr, simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D180
* StringBuffer should not contain initial byte-order mark (BOM)Thomas Miedema2014-09-011-13/+32
| | | | | | | | | | | | | | | | | | | | Summary: Just skipping over a BOM, but leaving it in the Stringbuffer, is not sufficient. The Lexer calls prevChar when a regular expression starts with '^' (which is a shorthand for '\n^'). It would never match on the first line, since instead of '\n', prevChar would still return '\xfeff'. Test Plan: validate Reviewers: austin, ezyang Reviewed By: austin, ezyang Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D176 GHC Trac Issues: #6016
* `M-x delete-trailing-whitespace` & `M-x untabify`...Herbert Valerio Riedel2014-08-316-70/+68
| | | | | | ...some files more or less recently touched by me [ci skip]
* Re-export Word from Prelude (re #9531)Herbert Valerio Riedel2014-08-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original proposal text can be found at http://www.haskell.org/pipermail/libraries/2014-August/023491.html The proposal passed with a clear majority, and was additionally confirmed by the core libraries committee. *Compatibility Note* Only code that imports `Data.Word` for the sole purpose of using `Word` *and* requires to be `-Werror`-clean (due to `-fwarn-unused-imports`) is affected by this change. In order to write warning-free forward/backward compatible against `base`, a variant of the following CPP-based snippet can be used: -- Starting with base>4.7.0 or GHC>7.8 Prelude re-exports 'Word' -- The following is needed, if 'Word' is the *only* entity needed from Data.Word #ifdef MIN_VERSION_base # if !MIN_VERSION_base(4,7,1) import Data.Word (Word) # endif -- no cabal_macros.h -- fallback to __GLASGOW_HASKELL__ #elif __GLASGOW_HASKELL__ < 709 import Data.Word (Word) #endif This also updates the haddock submodule in order to avoid a compile warning
* Some typosGabor Greif2014-08-301-1/+1
|
* Typos in commentsGabor Greif2014-08-294-5/+5
|
* Give the worker for an INLINABLE function a suitably-phased ActivationSimon Peyton Jones2014-08-291-25/+29
| | | | | See Note [Activation for INLINABLE worker]. This was preventing Trac #6056 from working.
* Better specImport discarding message (again)Simon Peyton Jones2014-08-291-10/+14
|
* When finding loop breakers, distinguish INLINE from INLINEABLESimon Peyton Jones2014-08-292-41/+31
| | | | | | Previously INLINE and INLINEABLE were treated identically, but it's crucial that we don't choose a wrapper (INLINE) as a loop breaker, when it is mutually recursive with an INLINEABLE worker.
* Comments, white space, and rename "InlineRule" to "stable unfolding"Simon Peyton Jones2014-08-294-44/+44
| | | | | | The "InlineRule" is gone now, so this is just making the comments line up with the code. A function does change its name though: updModeForInlineRules --> updModeForStableUnfoldings