summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Dont call unsafeGlobalDynFlags if it is not setThomas Miedema2015-03-166-17/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | Parsing of static and mode flags happens before any session is started, i.e., before the first call to 'GHC.withGhc'. Therefore, to report errors for invalid usage of these two types of flags, we can not call any function that needs DynFlags, as there are no DynFlags available yet (unsafeGlobalDynFlags is not set either). So we always print "on the commandline" as the location, which is true except for Api users, which is probably ok. When reporting errors for invalid usage of dynamic flags we /can/ make use of DynFlags, and we do so explicitly in DynFlags.parseDynamicFlagsFull. Before, we called unsafeGlobalDynFlags when an invalid (combination of) flag(s) was given on the commandline, resulting in panics (#9963). This regression was introduced in 1d6124de. Also rename showSDocSimple to showSDocUnsafe, to hopefully prevent this from happening again. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D730 GHC Trac Issues: #9963
* Link temporary shared objects with `--no-as-needed`Peter Trommler2015-03-141-5/+14
| | | | | | | | | | | | | | | | | | | | | | Some ELF link editors default to `--as-needed` and record only those libraries in DT_NEEDED tags that are needed to resolve undefined symbols in the shared object to be created. In Template Haskell we rely on all symbols that were defined in modules compiled so far to be available in the current temporary shared object. To prevent the link editor from dropping the DT_NEEDED tag for the previously linked temporary shared object we need to override the link editors default and specify `--no-as-needed` on the command line. This is for GNU ld and GOLD ld. This addresses #10110 TODO: regression test Reviewed By: hvr Differential Revision: https://phabricator.haskell.org/D731
* Update filepath submodule to filepath-1.4 snapshotHerbert Valerio Riedel2015-03-111-1/+1
| | | | | | This also needs to update a couple of other submodules to update the upper bound on filepath to allow this major version bump to 1.4.0.0
* Update Cabal submodule to latest 1.22 snapshotEdward Z. Yang2015-03-111-0/+1
| | | | | | | | | | | | | | | This changes the library file name format NOTE: This patch originally updated to Cabal HEAD, but was reduced to update to Cabal 1.22 HEAD by hvr as this is needed in order to update the filepath submodule to version 1.4.0, and subsequently to be cherry-picked into the ghc-7.10 branch Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D707
* Documentation for PackageArg/ModRenaming/PackageFlagEdward Z. Yang2015-03-101-11/+31
| | | | | | | | | | | | | | | Summary: [skip-ci] Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D723
* Refactor Digraph to use Data.Graph when possibleEdward Z. Yang2015-03-092-263/+50
| | | | | | | | | | | | | | Summary: This just rewrites the IntGraph data type. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D708
* Revert "Refactor Digraph to use Data.Graph when possible"Edward Z. Yang2015-03-092-41/+264
| | | | | | | This breaks the build with GHC 7.6 bootstrapping, since the Functor SCC instance is not available. This reverts commit c439af5f5baa2c8af3434652554135230edbf5c3.
* Fix `ghc --make -fhpc` with imported lhs modulesThomas Miedema2015-03-091-2/+66
| | | | | | | | | See Note [Don't normalise input filenames] in `compiler/main/DriverPipeline.hs`. Fixes #2991. Reviewers: austin Differential Revision: https://phabricator.haskell.org/D701
* Remove obsolete comment in cmmOffsetJoachim Breitner2015-03-091-7/+0
| | | | | | | | | | | | | | Summary: as obviously, the code does _not_ adhere to the comment, and yet the compiler does _not_ go into an infinite loop. Test Plan: Run validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D719
* Refactor Digraph to use Data.Graph when possibleEdward Z. Yang2015-03-092-264/+41
| | | | | | | | | | | | | | Summary: This just rewrites the IntGraph data type. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D708
* Update process submoduleThomas Miedema2015-03-091-4/+5
| | | | | | | | | | | | | Summary: Rename `SysTools.readCreateProcess`. Functions `readCreateProcess` and `readCreateProcessWithExitCode` were added to `System.Process`, the former of which conflicts with `SysTools.readCreateProcess`. Reviewed by: austin Differential Revision: https://phabricator.haskell.org/D713
* Store renamings as (ModuleName, ModuleName) pairs.Edward Z. Yang2015-03-072-12/+11
| | | | | | | | | | | | Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D710
* Dynamically link all loaded packages in new objectPeter Trommler2015-03-071-1/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: As a result of fixing #8935 we needed to open shared libraries with RTLD_LOCAL and so symbols from packages loaded earlier cannot be found anymore. We need to include in the link all packages loaded so far. This fixes #10058 Test Plan: validate Reviewers: hvr, simonmar, austin Reviewed By: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D676 GHC Trac Issues: #10058
* Improve core linter so it catches unsafeCoerce problems (T9122)Alexander Vershilov2015-03-073-17/+93
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is a draft of the patch that is sent for review. In this patch required changes in linter were introduced and actual check: - new helper function: primRepSizeB - primRep check for floating - Add access to dynamic flags in linter. - Implement additional lint rules. Reviewers: austin, goldfire, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D637 GHC Trac Issues: #9122
* Custom `Typeable` solver, that keeps track of kinds.Iavor S. Diatchki2015-03-0710-225/+393
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This implements the new `Typeable` solver: when GHC sees `Typeable` constraints it solves them on the spot. The current implementation creates `TyCon` representations on the spot. Pro: No overhead at all in code that does not use `Typeable` Cons: Code that uses `Typeable` may create multipe `TyCon` represntations. We have discussed an implementation where representations of `TyCons` are computed once, in the module, where a datatype is declared. This would lead to more code being generated: for a promotable datatype we need to generate `2 + number_of_data_cons` type-constructro representations, and we have to do that for all programs, even ones that do not intend to use typeable. I added code to emit warning whenevar `deriving Typeable` is encountered--- the idea being that this is not needed anymore, and shold be fixed. Also, we allow `instance Typeable T` in .hs-boot files, but they result in a warning, and are ignored. This last one was to avoid breaking exisitng code, and should become an error, eventually. Test Plan: 1. GHC can compile itself. 2. I compiled a number of large libraries, including `lens`. - I had to make some small changes: `unordered-containers` uses internals of `TypeReps`, so I had to do a 1 line fix - `lens` needed one instance changed, due to a poly-kinded `Typeble` instance 3. I also run some code that uses `syb` to traverse a largish datastrucutre. I didn't notice any signifiant performance difference between the 7.8.3 version, and this implementation. Reviewers: simonpj, simonmar, austin, hvr Reviewed By: austin, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D652 GHC Trac Issues: #9858
* Re-export `<$>` from Prelude (#10113)Herbert Valerio Riedel2015-03-0712-9/+14
| | | | | | | | | | | | | | | | | | | | | Whether to re-export the `<$>` non-method operator from `Prelude` wasn't explicitly covered in the original AMP proposal[1], but it turns out that not doing so forces most code that makes use of applicatives to import `Data.Functor` or `Control.Applicative` just to get that operator into scope. To this end, it was proposed to add `<$>` to Prelude as well[2]. The down-side is that this increases the amount of redundant-import warnings triggered, as well as the relatively minor issue of stealing the `<$>` operator from the default namespace for good (although at this point `<$>` is supposed to be ubiquitous anyway due to `Applicative` being implicitly required into the next Haskell Report) [1]: https://wiki.haskell.org/Functor-Applicative-Monad_Proposal [2]: http://thread.gmane.org/gmane.comp.lang.haskell.libraries/24161 Reviewed By: austin, ekmett Differential Revision: https://phabricator.haskell.org/D680
* Update shift/reduce commentary in Parser.yEdward Z. Yang2015-03-061-111/+272
| | | | | | | | | | | | Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: none Reviewers: austin, simonpj, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D697
* Remove unused/undocumented flag `-fhpc-no-auto`Thomas Miedema2015-03-041-2/+0
| | | | | | | | | Added in 53a5d0b01. Perhaps accidentally? It didn't do anything back then either. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D700
* Check for equality before deferringSimon Peyton Jones2015-03-042-5/+23
| | | | | | | | | | | | | | | | | | | | | | | This one was a bit of a surprise. In fixing Trac #7854, I moved the checkAmbiguity tests to checkValidType. That meant it happened even for monotypes, and that turned out to be very expensive in T9872a, for reasons described in this (new) Note in TcUnify: Note [Check for equality before deferring] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Particularly in ambiguity checks we can get equalities like (ty ~ ty). If ty involves a type function we may defer, which isn't very sensible. An egregious example of this was in test T9872a, which has a type signature Proxy :: Proxy (Solutions Cubes) Doing the ambiguity check on this signature generates the equality Solutions Cubes ~ Solutions Cubes and currently the constraint solver normalises both sides at vast cost. This little short-cut in 'defer' helps quite a bit. I fixed the problem with a quick equality test, but it feels like an ad-hoc solution; I think we might want to do something in the constraint solver too. (The problem was there all along, just more hidden.)
* Comments onlySimon Peyton Jones2015-03-041-11/+14
|
* A raft of small changes associated with -XConstrainedClassMethodsSimon Peyton Jones2015-03-043-140/+155
| | | | | | | | | | | | | | | | | | | | | | | | | See Trac #7854. Specifically: * Major clean up and simplification of check_op in checkValidClass; specifically - use checkValidType on the entire method-selector type to detect ambiguity - put a specific test for -XConstrainedClassMethods * Make -XConstrainedClassMethods be implied by -XMultiParamTypeClasses (a bit ad-hoc but see #7854), and document in the user manual. * Do the checkAmbiguity test just once in TcValidity.checkValidType, rather than repeatedly at every level. See Note [When to call checkAmbiguity] * Add -XAllowAmbiguousTypes in GHC.IP, since 'ip' really is ambiguous. (It's a rather magic function.) * Improve location info for check_op in checkValidClass * Update quite a few tests, which had genuinely-ambiguous class method signatures. Some I fixed by making them unambiguous; some by adding -XAllowAmbiguousTypes
* Some minor refactoring in TcHsTypeSimon Peyton Jones2015-03-041-17/+20
|
* Tidy up and improve comments about one-shot infoSimon Peyton Jones2015-03-045-12/+11
| | | | (Triggered by investigating Trac #10102 etc.)
* Clarify some comments in Packages.hs [skip-ci]Edward Z. Yang2015-03-031-4/+7
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Don't use deriveUnique *twice* in flattenTys.Richard Eisenberg2015-03-031-4/+23
| | | | | | | Previously, we used deriveUnique and then uniqAway. This worked doubly hard to avoid clashes. Doing just uniqAway is enough. This commit also includes clarifying comments.
* Pretty-print # on unboxed literals in coreThomas Miedema2015-03-034-32/+89
| | | | | | | | | | | | | | | | | | Summary: Ticket #10104 dealt with showing the '#'s on types with unboxed fields. This commit pretty prints the '#'s on unboxed literals in core output. Test Plan: simplCore/should_compile/T8274 Reviewers: jstolarek, simonpj, austin Reviewed By: simonpj, austin Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D678 GHC Trac Issues: #8274
* Cite the TrieMap idea [skip-ci]Edward Z. Yang2015-03-021-0/+6
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Small emitCmmSwitch/emitCmmLitSwitch refactoringJoachim Breitner2015-03-021-12/+11
| | | | | both use the same logic to divide, so put it in divideBranches :: Ord a => [(a,b)] -> ([(a,b)], a, [(a,b)])
* Improve if-then-else tree for cases on literal valuesJoachim Breitner2015-03-022-6/+34
| | | | | | | | | Previously, in the branch of the if-then-else tree, it would emit a final check if the scrut matches the alternative, even if earlier comparisons alread imply this equality. By keeping track of the bounds we can skip this check. Of course this is only sound for integer types. This closes #10129. Differential Revision: https://phabricator.haskell.org/D693
* Typos in non-codeGabor Greif2015-03-021-1/+1
|
* fix typos in coreSynJavran Cheng2015-03-023-3/+3
| | | | | | | | | | | | | | Summary: fixed few typos in coreSyn, no trac number Test Plan: validate Reviewers: austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D682
* Show record construction/update without parensThomas Miedema2015-03-022-1/+5
| | | | | | | | | | | | | | | | | Summary: The 2010 report mentions: "The result of `show` is a syntactically correct Haskell expression ... Parenthesis are only added where needed, //ignoring associativity//". Reviewers: austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D669 GHC Trac Issues: #2530
* Two kind-polymorphism fixes (Trac #10122)Simon Peyton Jones2015-03-022-14/+32
| | | | | | | | | * The original fix was to improve the documentation, in line with the suggestions on Trac #10122 * But in doing so I realised that the kind generalisation in TcRnDriver.tcRnType was completely wrong. So I fixed that and updated Note [Kind-generalise in tcRnType] to explain.
* Comments onlySimon Peyton Jones2015-03-021-3/+3
|
* Improve comments on coreView/tcView, and combine coreExpandTyCon/tcExpandTyConSimon Peyton Jones2015-03-027-50/+24
| | | | | | | | | | | | | This is minor stuff triggered by Trac #10103. * Fix outdated comments on tcView/coreView (we should really combine them with a new name, but I'll leave that slightly-disruptive change for now) * Combine tcExpandTyCon_maybe and coreExpandTyCon_maybe (which were identical) into expandSynTyCon_maybe * A few more comment fixups
* Comments onlySimon Peyton Jones2015-03-021-9/+10
|
* Axe ModFinderCache, folding it into a generalized FinderCache.Edward Z. Yang2015-02-243-68/+20
| | | | | | | | | | | | | | | | | Summary: FinderCache is now keyed by a module, ModuleNames in the home package are turned into Modules using thisPackage in the dynamic flags. Simplifies some code! Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D634
* Fix comments, and a little reformattingSimon Marlow2015-02-241-26/+26
|
* driver: split -fwarn-unused-binds into 3 flags (fixes #17)Oleg Grenrus2015-02-234-8/+29
| | | | | | | | | | | | | | | | | | | | | | Summary: New flags: -fwarn-unused-top-binds -fwarn-unused-local-binds -fwarn-unused-pattern-binds Test Plan: `tests/rename/should_compile/T17` tests Correct other tests Reviewers: austin, rwbarton Reviewed By: austin, rwbarton Subscribers: rwbarton, carter, thomie Differential Revision: https://phabricator.haskell.org/D591 GHC Trac Issues: #17
* Comment typoJoachim Breitner2015-02-231-3/+1
| | | | and reference to long-removed note in CallArity.hs
* Show '#' on unboxed literalsThomas Miedema2015-02-233-13/+39
| | | | | | | | | | | | | | Test Plan: deriving/should_run/T10104 Reviewers: austin, jstolarek Reviewed By: austin, jstolarek Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D672 GHC Trac Issues: #10104
* Fix for ticket #10078: ensure that tcPluginStop is called even in case of ↵Jan Bracker2015-02-231-2/+7
| | | | | | | | | | | | | | | | | | | | | type errors Summary: Remove unused variable that appeared through the fix for ticket #10078 Merge branch 'master' of git://git.haskell.org/ghc Added comment with bug ID. Reviewers: adamgundry, gridaphobe, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D667 GHC Trac Issues: #10078
* Error out on `Main` without `main` in GHCi (#7765)Thomas Miedema2015-02-234-34/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: GHC does 2 validation checks for module `Main`: * does `main` exist * is `main` exported (#414) The second check is done in ghc as well as in ghci (and runghc and ghc -e). The first check however is currently not done in ghci, to prevent "'main' is not in scope" errors when loading simple scripts. See commit d28ba8c8009 for more information. This commit tightens the special case for ghci. When the file does not contain a main function, but does contain an explicit module header (i.e. "module Main where"), then /do/ raise an error in ghci (and runghc and ghc -e) as well Test Plan: module/T7765: a module Main with an explicit module header but without a main function should be an error for all Ways. Additionaly: delete test module/mod174. It was added in commit 5a54c38, but it is a duplicate of module/T414. Reviewers: austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D649 GHC Trac Issues: #7765
* [ci skip] comment typoJoachim Breitner2015-02-211-1/+1
|
* Comments onlySimon Peyton Jones2015-02-201-1/+3
|
* Comments onlySimon Peyton Jones2015-02-201-1/+1
|
* Comments onlySimon Peyton Jones2015-02-202-34/+57
|
* Add a bizarre corner-case to cgExpr (Trac #9964)Simon Peyton Jones2015-02-201-23/+55
| | | | | | | | | | | David Feuer managed to tickle a corner case in the code generator. See Note [Scrutinising VoidRep] in StgCmmExpr. I rejigged the comments in that area of the code generator Note [Dodgy unsafeCoerce 1] Note [Dodgy unsafeCoerce 2] but I can't say I fully understand them, alas.
* Don't report instance constraints with fundeps as redundantSimon Peyton Jones2015-02-204-24/+54
| | | | | | | More subtlety due to functional dependencies. Note [Redundant constraints in instance decls] in TcErrors. Fixes Trac #10100.
* Comments onlySimon Peyton Jones2015-02-192-17/+22
|