summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor PackageFlags so that ExposePackage is a single constructor.Edward Z. Yang2014-08-052-44/+39
| | | | | | | You can parametrize over the different selection by using a different PackageArg. This helps reduce code duplication. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Refactor package state, also fixing a module reexport bug.Edward Z. Yang2014-08-053-153/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of building a multiply indirected data structure and querying it on every import, we now have two data structures moduleToPkgConf and moduleToPkgConfAll. moduleToPkgConf is a single-level UniqFM that is intended to be used for most valid imports; however, it does not contain any information useful for error reporting. If an error is occurred, we then query moduleToPkgConfAll, which contains a more comprehensive view of the package database. This field is lazily initialized (so this means we're retaining the package database list, but this should be fine because we're already maintaining the entries of the list.) Additionally, the full view doesn't keep track of a boolean toggle for visibility/exposure anymore, but instead tracks the *provenance* of how the module binding came to be (the ModuleOrigin data type). Additionally, we move the logic for determining if a module is exposed or not from Finder.lhs and put it in Packages.lhs; this information is communicated via the LookupResult data type. Unfortunately, we can't directly return a FindResult, because this data type is defined in HscTypes which depends on Packages. This is going to change some more in the near future when I add thinning/renaming to package flags; the error messages will need to be more flexible. I've also slightly changed the semantics of error messages for package qualified imports. Previously, if we didn't find any package qualified imports, but there were hidden modules in a *different* package, the error message would prefer mentioning those as opposed to providing suggestions. Now, if a module is hidden but in the wrong package, we won't mention it; instead, it will get mentioned with the other module suggestions. I was too lazy to write a test, but I can add one if people would like. The module reexport bug was, package q reexported p:P as Conflict, and package r reexported p:P2 as Conflict, this was *not* reported as a conflict, because the old logic incorrectly decided that P and P2 were the same module on account of being from the same package. The logic here has been corrected. Contains haddock submodule update. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Make PackageState an abstract type.Edward Z. Yang2014-08-058-57/+80
| | | | | | | | | | | | Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D107
* Package keys (for linking/type equality) separated from package IDs.Edward Z. Yang2014-08-0514-62/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch set makes us no longer assume that a package key is a human readable string, leaving Cabal free to "do whatever it wants" to allocate keys; we'll look up the PackageId in the database to display to the user. This also means we have a new level of qualifier decisions to make at the package level, and rewriting some Safe Haskell error reporting code to DTRT. Additionally, we adjust the build system to use a new ghc-cabal output Make variable PACKAGE_KEY to determine library names and other things, rather than concatenating PACKAGE/VERSION as before. Adds a new `-this-package-key` flag to subsume the old, erroneously named `-package-name` flag, and `-package-key` to select packages by package key. RFC: The md5 hashes are pretty tough on the eye, as far as the file system is concerned :( ToDo: safePkg01 test had its output updated, but the fix is not really right: the rest of the dependencies are truncated due to the fact the we're only grepping a single line, but ghc-pkg is wrapping its output. ToDo: In a later commit, update all submodules to stop using -package-name and use -this-package-key. For now, we don't do it to avoid submodule explosion. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D80
* Disable package auto-hiding if -hide-all-packages is passedEdward Z. Yang2014-08-041-3/+14
| | | | | | | | | | | | | | | | | | Summary: This is in preparation for thinning/renaming package arguments, which allow users to rename modules of packages they import. In situations like this, it may be desirable to load multiple copies of a package at different versions explicitly under different names. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, simonmar, hvr, austin Subscribers: simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D106
* ghc --make: add nicer names to RTS threads (threaded IO manager, make workers)Sergei Trofimovich2014-08-041-0/+14
| | | | | | | | | | | | | | | | | | | | Summary: The patch names most of RTS threads and ghc (the tool) threads. It makes nicer debug and eventlog output for ghc itself. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: ran debugged ghc under '+RTS -Ds' Reviewers: simonmar, austin Reviewed By: austin Subscribers: phaskell, simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D101
* Infer safety of modules correctly with new overlapping pragmas.David Terei2014-08-011-0/+3
|
* Allow warning if could have been infered safe instead of explicitDavid Terei2014-08-014-71/+89
| | | | Trustworthy label.
* Dont allow hand-written Generic instances in Safe Haskell.David Terei2014-08-012-10/+24
| | | | | | | While they aren't strictly unsafe, it is a similar situation to Typeable. There are few instances where a programmer will write their own instance, and having compiler assurance that the Generic implementation is correct brings a lot of benefits.
* Fix-up to d4d4bef2 'Improve the desugaring of RULES'Simon Peyton Jones2014-08-011-2/+8
| | | | | I'd forgotten the possiblity that desugaring could generate dead dictionary bindings; easily fixed by calling occurAnalyseExpr
* Improve the desugaring of RULES, esp those from SPECIALISE pragmasSimon Peyton Jones2014-08-011-11/+64
| | | | | | | | | | | | In the code for Trac #8331 we were not getting a complaint, but we *were* getting a terrible (and virtually useless) RULE, looking like useAbstractMonad (complicated-dictionary-expresion) = $fuseAbstractMonad where we wanted useAbstractMonad d = $fuseAbstractMonad This commit improves the desugaring algorithm. More comments explain; see Note [Drop dictionary bindings on rule LHS]
* A panic in CmmBuildInfoTables.bundle shouldn't be a panic (#9329)Simon Marlow2014-08-011-4/+8
| | | | | | | | | | | | | | | | | Summary: This code needs more comments, but I believe this is safe. By definition I can't have broken anything that was working by turning a panic into a non-panic anyway. Test Plan: validate Reviewers: hvr, simonpj, austin Subscribers: simonmar, relrod, ezyang, carter Differential Revision: https://phabricator.haskell.org/D105 GHC Trac Issues: #9329
* add a commentSimon Marlow2014-08-011-0/+3
|
* update commentSimon Marlow2014-08-011-4/+3
|
* Fix reference to noteSimon Marlow2014-08-011-1/+1
|
* refactor to fix 80column overflowSimon Marlow2014-08-011-16/+20
|
* Typo fixesGabor Greif2014-08-014-7/+7
|
* Small tweaks to commentGabor Greif2014-08-011-2/+2
|
* Minor wordsmithing of commentsGabor Greif2014-08-011-4/+4
|
* Typo in commentGabor Greif2014-07-311-1/+1
|
* Complete work on new OVERLAPPABLE/OVERLAPPING pragmas (Trac #9242)Simon Peyton Jones2014-07-317-137/+173
| | | | | | | | | | | | | | | | | * Deprecate -XOverlappingInstances * Update test suite. Several tests even had entirely unnecessary uses of -XOverlappingInstances * Update user manual with a careful description of the instance resolution story * Fix an outright bug in the handling of duplidate instances in GHCi, which are meant to silently overwrite the earlier duplicate. The logic was right for family instances but was both more complicated, and plain wrong, for class instances. (If you are interested, the bug was that we were eliminating the duplicate from the InstEnv, but not from the [ClsInst] held in tcg_insts.) Test is ghci044a.
* Comments onlySimon Peyton Jones2014-07-311-0/+3
|
* Add a fast-path in TcInteract.kickOutRewritableSimon Peyton Jones2014-07-311-6/+10
|
* Comments and white spaceSimon Peyton Jones2014-07-312-18/+26
|
* Comments and minor refactoringSimon Peyton Jones2014-07-312-59/+82
| | | | | | | | - Better comments about Generalised Newtype Deriving See Note [Bindings for Generalised Newtype Deriving] - Refactor the interface between TcDeriv and TcGenDeriv, to reduce the size of the interface of the latter.
* Comments and white spaceSimon Peyton Jones2014-07-311-3/+2
|
* Allow multiple entry points when allocating recursive groups (#9303)Simon Marlow2014-07-312-35/+39
| | | | | | | | | | | | | | | | | Summary: In this example we ended up with some code that was only reachable via an info table, because a branch had been optimised away by the native code generator. The register allocator then got confused because it was only considering the first block of the proc to be an entry point, when actually any of the info tables are entry points. Test Plan: validate Reviewers: simonpj, austin Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D88
* comment updateSimon Marlow2014-07-311-4/+1
|
* Add note about renaming of pattern synonym wrappersDr. ERDI Gergo2014-07-292-0/+28
|
* Refactor PatSynBind so that we can pass around PSBs instead of several argumentsDr. ERDI Gergo2014-07-297-117/+123
|
* When computing minimal recursive sets of bindings, don't include references ↵Dr. ERDI Gergo2014-07-291-1/+1
| | | | | | in wrapper definitions for explicitly-bidirectional pattern synonyms
* Typecheck the wrapper definition of a pattern synonym,Dr. ERDI Gergo2014-07-293-59/+82
| | | | after everything in the same scope is typechecked
* tcLookupPatSyn: look up the PatSyn record for a given IdDr. ERDI Gergo2014-07-291-3/+11
|
* Add renamer support for explicitly-bidirectional pattern synonymsDr. ERDI Gergo2014-07-291-5/+9
|
* Typechecker support for explicitly-bidirectional pattern synonymsDr. ERDI Gergo2014-07-291-16/+23
|
* Add parser support for explicitly bidirectional pattern synonymsDr. ERDI Gergo2014-07-294-13/+60
|
* New parser for pattern synonym declarations:Dr. ERDI Gergo2014-07-292-7/+28
| | | | | | Like splitCon for constructor definitions, the left-hand side of a pattern declaration is parsed as a single pattern which is then split into a ConName and argument variable names
* getCoerbileInsts: Move the two NT-unwrapping instances togetherJoachim Breitner2014-07-291-14/+14
| | | | | | | and fix the numbering in the comments. Thank to SPJ for noticing. Nothing deep in here, just a insufficent copy’n’pasting in revision 7e78faf0. Incidentially, 7e78faf0 did a better job updating the comments than the code :-).
* add Solaris' linker warning messages filtering into link phaseKarel Gardas2014-07-281-1/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Solaris ld emits harmless warning messages about unresolved symbol in case of compiling into shared library when we do not link against all the required libs. That is the case of GHC which does not link against RTS library explicitly in order to be able to chose the library later based on binary application linking parameters. The warnings look like: Undefined first referenced symbol in file stg_ap_n_fast ./T2386_Lib.o stg_upd_frame_info ./T2386_Lib.o templatezmhaskell_LanguageziHaskellziTHziLib_litE_closure ./T2386_Lib.o templatezmhaskell_LanguageziHaskellziTHziLib_appE_closure ./T2386_Lib.o templatezmhaskell_LanguageziHaskellziTHziLib_conE_closure ./T2386_Lib.o templatezmhaskell_LanguageziHaskellziTHziSyntax_mkNameGzud_closure ./T2386_Lib.o newCAF ./T2386_Lib.o stg_bh_upd_frame_info ./T2386_Lib.o stg_ap_ppp_fast ./T2386_Lib.o templatezmhaskell_LanguageziHaskellziTHziLib_stringL_closure ./T2386_Lib.o stg_ap_p_fast ./T2386_Lib.o stg_ap_pp_fast ./T2386_Lib.o ld: warning: symbol referencing errors this is actually coming from T2386 testcase. The emitting of those warnings is also a reason why so many TH testcases fail on Solaris. The patch provides filter which filters out only linker warnings. Test Plan: validate Reviewers: austin Reviewed By: austin Subscribers: phaskell, simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D94
* do not link with -lrt on Solaris for threaded wayKarel Gardas2014-07-281-1/+0
| | | | | | | | | | | | | | | | | Summary: This patch removes linking with rt library on Solaris for threaded way. The reason is simple it casuses few ffi related tests failures and also is not needed anymore. Test Plan: validate Reviewers: austin Reviewed By: austin Subscribers: phaskell, simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D95
* Comments onlyJan Stolarek2014-07-281-2/+2
|
* Implement OVERLAPPING and OVERLAPPABLE pragmas (see #9242)Iavor S. Diatchki2014-07-277-52/+104
| | | | | | | | | | | | | | | | | | | | | | This also removes the short-lived NO_OVERLAP pragama, and renames OVERLAP to OVERLAPS. An instance may be annotated with one of 4 pragams, to control its interaction with other overlapping instances: * OVERLAPPABLE: this instance is ignored if a more specific candidate exists * OVERLAPPING: this instance is preferred over more general candidates * OVERLAPS: both OVERLAPPING and OVERLAPPABLE (i.e., the previous GHC behavior). When compiling with -XOverlappingInstances, all instance are OVERLAPS. * INCOHERENT: same as before (see manual for details). When compiling with -XIncoherentInstances, all instances are INCOHERENT.
* Fix build on OS X due to macro-like string in commentEdward Z. Yang2014-07-261-2/+2
| | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
* Module reexports, fixing #8407.Edward Z. Yang2014-07-256-44/+113
| | | | | | | | | | | | | | | | | | | | | | | | | The general approach is to add a new field to the package database, reexported-modules, which considered by the module finder as possible module declarations. Unlike declaring stub module files, multiple reexports of the same physical package at the same name do not result in an ambiguous import. Has submodule updates for Cabal and haddock. NB: When a reexport renames a module, that renaming is *not* accessible from inside the package. This is not so much a deliberate design choice as for implementation expediency (reexport resolution happens only when a package is in the package database.) TODO: Error handling when there are duplicate reexports/etc is not very well tested. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Conflicts: compiler/main/HscTypes.lhs testsuite/.gitignore utils/haddock
* Refactor FFI error messagesSimon Peyton Jones2014-07-258-251/+279
| | | | | | | | | | | | | | This patch was provoked by Trac #5610, which I finally got a moment to look at. In the end I added a new data type ErrUtils.Validity, data Validity = IsValid -- Everything is fine | NotValid MsgDoc -- A problem, and some indication of why with some suitable combinators, and used it where appropriate (which touches quite a few modules). The main payoff is that error messages improve for FFI type validation.
* Check for boxed tau types in the LHS of type family instancesSimon Peyton Jones2014-07-251-1/+8
| | | | Fixes Trac #9357
* Use the right kinds on the LHS in 'deriving' clausesSimon Peyton Jones2014-07-241-10/+26
| | | | This patch fixes Trac #9359
* Fixed issue with detection of duplicate record fieldsGintautas Miliauskas2014-07-241-12/+19
| | | | | | | | | Duplicate record fields would not be detected when given a type with multiple data constructors, and the first data constructor had a record field r1 and any consecutive data constructors had multiple fields named r1. This fixes #9156 and was reviewed in https://phabricator.haskell.org/D87
* Add missing memory fence to atomicWriteIntArray#Johan Tibell2014-07-233-1/+7
|
* X86 codegen: make LOCK a real instruction prefixJohan Tibell2014-07-233-12/+8
| | | | | | | | | | Before LOCK was a separate instruction and this led to the register allocator separating it from the instruction it was supposed to be a prefix of, leading to illegal assembly such as lock mov Fix contributed by PÁLI Gábor János.