| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Re-implement GHCi's :info and :browse commands in terms of TyThings
rather than IfaceSyn.
The GHC API now exposes its internal types for Haskell entities:
TyCons, Classes, DataCons, Ids and Instances (collectively known as
TyThings), so we can inspect these directly to pretty-print
information about an entity. Previously the internal representations
were converted to IfaceSyn for passing to InteractiveUI, but we can
now remove that code.
Some of the new code comes via Visual Haskell, but I've changed it
around a lot to fix various dark corners and properly print things
like GADTs.
The pretty-printing interfaces for TyThings are exposed by a new
module PprTyThing, which is implemented purely in terms of the GHC API
(and is probably a good source of sample code). Visual Haskell should
be able to use the functions exported by this module directly.
Lots of new goodies are exported by the GHC module, mainly for
inspecting TyThings.
|
|
|
|
| |
unused imports
|
|
|
|
|
| |
- Eliminate some warnings, remove dead code
- export PrintUnqualified, alwaysQualify
|
|
|
|
| |
-ddump-hi-diffs shouldn't turn off recompilation checking
|
|
|
|
| |
Hopefully fix more compilation problems with various versions of GHC
|
|
|
|
| |
Make this build with GHC < 6.03 again
|
|
|
|
|
| |
Profiling doesn't require -fvia-C any more. Also, I optimistically
removed -fvia-C from all the other ways except unreg.
|
|
|
|
|
| |
Make GHC.depanal store the module graph in the session again. Fixes
ghc -M.
|
|
|
|
| |
Make more error messages from the downsweep into ErrMsg exceptions.
|
|
|
|
| |
oops, fix updating the module graph
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix some reporting of errors in the GHC API: errors during the
downsweep were thrown as exceptions; now they're reported via the
(Messages->IO ()) callback in the same way as other errors.
getModuleInfo no longer prints anything on stdout. It does ignore
error messages and return Nothing, however - we should fix this and
return the error messages at some point.
The ErrMsg type can now be thrown as an exception. This can be a
convenient alternative if collecting multiple error messages isn't
required. We do this in the downsweep now.
|
|
|
|
| |
isObjectLinkable: don't return True for an empty linkable
|
|
|
|
| |
If hsc_lang is HscNothing, produce an empty linkable.
|
|
|
|
| |
Track new semantics of splitLongestPrefix; fixes -main-is bug
|
|
|
|
| |
SMP: omit the -pthread flag on Windows
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tune up the reporting of unused imports
Merge to STABLE
(I think the earlier change made it across)
(PS: the commit also does some trimming of
redundant imports. If they don't merge, just
discard them.)
My earlier fixes to the reporting of unused imports still missed
some obscure cases, some of which are now fixed by this commit.
I had to make the import-provenance data type yet richer, but in
fact it has more sharing now, so it may be cheaper on space.
There's still one infelicity. Consider
import M( x )
imoprt N( x )
where the same underlying 'x' is involved in both cases. Currently we
don't report a redundant import, because dropping either import would
change the qualified names in scope (M.x, N.x). But if the qualified
names aren't used, the import is indeed redundant. Sadly we don't know
that, because we only know what Names are used. Left for the future!
There's a comment in RnNames.warnDuplicateImports
This commit also trims quite a few redundant imports disovered
by the new setup.
|
|
|
|
|
|
|
|
|
|
| |
Improve source locations on error messages from the downsweep. We now
keep track of SrcSpans from import declarations, so we can report a
proper source location for unknown imports (this improves on the
previous hacky solution of keeping track of the filename that
contained the original import declaration).
ModSummary now contains (Located Module) for each import instead of Module.
|
|
|
|
| |
Further tweaks to the filename handling.
|
|
|
|
|
|
| |
Rationalise the filename handling in a few places, taking some bits
from the defunct System.FilePath library. Also fixes a bug I recently
introduced in replaceFilenameDirectory.
|
|
|
|
| |
Add modInfoInstances
|
|
|
|
| |
More commentary
|
|
|
|
| |
expand comment
|
|
|
|
|
|
| |
Bugfix to previous commit: filenames without an extension are assumed
to be a haskell source filenames with the extension removed (eg. ghc
--make hello should compile hello.hs).
|
|
|
|
| |
small cleanup: use joinFileExt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement -x <suffix> flag to override the suffix of a filename for
the purposes of determinig how it should be compiled. The usage is
similar to gcc, except that we just use a suffix rather than a name
for the language. eg.
ghc -c -x hs hello.blah
will pretend hello.blah is a .hs file. Another possible use is -x
hspp, which skips preprocessing.
This works for one-shot compilation, --make, GHCi, and ghc -e. The
original idea was to make it possible to use runghc on a file that
doesn't end in .hs, so changes to runghc will follow.
Also, I made it possible to specify .c files and other kinds of files
on the --make command line; these will be compiled to objects as
normal and linked into the final executable.
GHC API change: I had to extend the Target type to include an optional
start phase, and also GHC.guessTarget now takes a (Maybe Phase) argument.
I thought this would be half an hour, in fact it took half a day, and
I still haven't documented it. Sigh.
|
|
|
|
| |
added modInfoIsExportedName & modInfoLookupName functions
|
|
|
|
| |
replace emptyNodeMap with old_summary_map.
|
|
|
|
| |
Export nameModule
|
|
|
|
|
| |
summariseFile: use a cached summary if one is available. Previously
we always preprocessed modules named by filename on each reload.
|
|
|
|
|
|
| |
Make GHC.modInfoPrintUnqualified work for package modules too. Also
refactor a bit: move mkExportEnv from TcRnDriver up to GHC which is
the only use of it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make it so that you can deprecate a data constructor.
Previously {-# DEPRECATED T "no" #-} referred only to the type
or class T. Now it refers to the data constructor T as well,
just like in fixity declarations.
There's no way to deprecate the data constructor T without also
deprecating the type T, alas. Same problem in fixity decls.
Main problem is coming up with a suitable concrete syntax to do
so.
We could consider merging this to the STABLE branch.
NB: Sven, the manual fixes are not XML-valideated! I'm at home.
|
|
|
|
| |
getModuleInfo now does something reasonable for package modules.
|
|
|
|
| |
Add lookupGlobalName
|
|
|
|
| |
Wibbles to new hs-boot instance story
|
|
|
|
| |
Strip wired-in names from interface files
|
|
|
|
| |
Further wibbles to the new tidying plumbing
|
|
|
|
|
|
|
|
|
| |
Re-plumb the connections between TidyPgm and the various
code generators. There's a new type, CgGuts, to mediate this,
which has the happy effect that ModGuts can die earlier.
The non-O route still isn't quite right, because default methods
are being lost. I'm working on it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This big commit does several things at once (aeroplane hacking)
which change the format of interface files.
So you'll need to recompile your libraries!
1. The "stupid theta" of a newtype declaration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retain the "stupid theta" in a newtype declaration.
For some reason this was being discarded, and putting it
back in meant changing TyCon and IfaceSyn slightly.
2. Overlap flags travel with the instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Arrange that the ability to support overlap and incoherence
is a property of the *instance declaration* rather than the
module that imports the instance decl. This allows a library
writer to define overlapping instance decls without the
library client having to know.
The implementation is that in an Instance we store the
overlap flag, and preseve that across interface files
3. Nuke the "instnce pool" and "rule pool"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A major tidy-up and simplification of the way that instances
and rules are sucked in from interface files. Up till now
an instance decl has been held in a "pool" until its "gates"
(a set of Names) are in play, when the instance is typechecked
and added to the InstEnv in the ExternalPackageState.
This is complicated and error-prone; it's easy to suck in
too few (and miss an instance) or too many (and thereby be
forced to suck in its type constructors, etc).
Now, as we load an instance from an interface files, we
put it straight in the InstEnv... but the Instance we put in
the InstEnv has some Names (the "rough-match" names) that
can be used on lookup to say "this Instance can't match".
The detailed dfun is only read lazily, and the rough-match
thing meansn it is'nt poked on until it has a chance of
being needed.
This simply continues the successful idea for Ids, whereby
they are loaded straightaway into the TypeEnv, but their
TyThing is a lazy thunk, not poked on until the thing is looked
up.
Just the same idea applies to Rules.
On the way, I made CoreRule and Instance into full-blown records
with lots of info, with the same kind of key status as TyCon or
DataCon or Class. And got rid of IdCoreRule altogether.
It's all much more solid and uniform, but it meant touching
a *lot* of modules.
4. Allow instance decls in hs-boot files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allowing instance decls in hs-boot files is jolly useful, becuase
in a big mutually-recursive bunch of data types, you want to give
the instances with the data type declarations. To achieve this
* The hs-boot file makes a provisional name for the dict-fun, something
like $fx9.
* When checking the "mother module", we check that the instance
declarations line up (by type) and generate bindings for the
boot dfuns, such as
$fx9 = $f2
where $f2 is the dfun generated by the mother module
* In doing this I decided that it's cleaner to have DFunIds get their
final External Name at birth. To do that they need a stable OccName,
so I have an integer-valued dfun-name-supply in the TcM monad.
That keeps it simple.
This feature is hardly tested yet.
5. Tidy up tidying, and Iface file generation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main/TidyPgm now has two entry points:
simpleTidyPgm is for hi-boot files, when typechecking only
(not yet implemented), and potentially when compiling without -O.
It ignores the bindings, and generates a nice small TypeEnv.
optTidyPgm is the normal case: compiling with -O. It generates a
TypeEnv rich in IdInfo
MkIface.mkIface now only generates a ModIface. A separate
procedure, MkIface.writeIfaceFile, writes the file out to disk.
|
|
|
|
| |
Support for returning the renamed syntax from checkModule (untested).
|
|
|
|
|
|
|
|
|
|
|
|
| |
newTempName: instead of bumping the processId until we find a name
that isn't used, add an integer suffix to the processId. This should
prevent temp-file conflicts that appear to have been affecting our
nightly builds and occasionally make -j.
The right way to allocate a temporary file is to create it straight
away, but I'm not sure of the implications of passing existing
temporary files to the various sub-processes that GHC executes, hence
this fix instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When chasing explicit imports, we now look for the module in both the
home package and external packages, and complain if it is found in
both:
Chasing modules from: Overlap
Cannot import `List':
it was found in both overlap/List.hs and package haskell98-1.0.
Possible fix: -ignore-package haskell98-1.0
(imported from overlap/Overlap.hs)
Previously the home module would have been ignored in favour of the
package module. It means we're doing a bit more searching, but the
behaviour is less obscure.
|
|
|
|
|
|
|
|
|
|
| |
Back out previous revision.
It appears that passing -g to the assembly phase of C compilation
results in an object file with broken debug info, that gdb can't
read. This is probably a bug in gcc and/or binutils, but this change
means that I can't avoid it (unless we were to hack the pipeline to
do .c->.s->.o in one stage instead of two).
|
|
|
|
|
|
|
| |
runSomething: 'rawSystem' might raise an exception to indicate that
'pgm' couldn't be executed, so catch this here & report.
Merge to STABLE.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Requested by Duncan Coutts: -optc flags get passed to the assembler
phase too. It's not obvious, when using GHC to compile a .c file,
that options need to be passed both with -optc and -opta - gcc doesn't
need this, for example.
This is an experimental change - if it breaks anything we can back it
out. If anyone needs to pass flags to the .c->.s phase *only*, then
we will need to add another flag for that purpose. It seems unlikely,
though (there aren't many flags that affect the assembler only, and
those that do don't conflict with flags for the C phase).
|
|
|
|
| |
enable splitting on x86_64
|
|
|
|
|
| |
modInfoExports, TypecheckedSource and ParsedSource are exported.
Added modInfoPrintUnqualified function.
|
|
|
|
|
|
|
|
| |
- DriverPipeline.compile: report errors in GHC_OPTIONS pragmas using the
Message callback, and give them a proper line number.
- GHC.checkModule: read the GHC_OPTIONS pragma, and report errors
appropriately.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Significant clean-up of the handling of hi-boot files.
Previously, when compling A.hs, we loaded A.hi-boot, and
it went into the External Package Table. It was strange
but it worked. This tidy up stops it going anywhere;
it's just read in, and typechecked into a ModDetails.
All this was on the way to improving the handling of
instances in hs-boot files, something Chris Ryder wanted.
I think they work quite sensibly now.
If I've got all this right (have not had a chance to
fully test it) we can merge it into STABLE.
|
|
|
|
| |
Fix previous commit
|
|
|
|
|
|
|
| |
Make the status messages from ghc --make display the number of modules
to be compiled, as in:
[3 of 9] Compiling Foo.hs ( Foo.hs, Foo.o )
|