ghc.git
4 years agoImported ids without signatures are still inferred.
Richard Eisenberg [Fri, 10 Jul 2015 00:08:47 +0000 (20:08 -0400)] 
Imported ids without signatures are still inferred.

4 years agoRemove SkolemiseMode -- always go deep.
Richard Eisenberg [Thu, 9 Jul 2015 18:39:16 +0000 (14:39 -0400)] 
Remove SkolemiseMode -- always go deep.

4 years agoBugfixing
Richard Eisenberg [Thu, 9 Jul 2015 18:35:15 +0000 (14:35 -0400)] 
Bugfixing

4 years agoVTA tests work
Richard Eisenberg [Thu, 9 Jul 2015 17:57:48 +0000 (13:57 -0400)] 
VTA tests work

4 years agoStage 2 succeeds
Richard Eisenberg [Thu, 9 Jul 2015 17:40:56 +0000 (13:40 -0400)] 
Stage 2 succeeds

4 years agoFix [OpenTypeKind accepts foralls]
Richard Eisenberg [Thu, 9 Jul 2015 17:20:43 +0000 (13:20 -0400)] 
Fix [OpenTypeKind accepts foralls]

4 years agoComments only
Richard Eisenberg [Thu, 9 Jul 2015 17:13:13 +0000 (13:13 -0400)] 
Comments only

4 years ago*** Use global url for .gitmodules
Richard Eisenberg [Thu, 9 Jul 2015 03:24:56 +0000 (23:24 -0400)] 
*** Use global url for .gitmodules

4 years ago`base` compiles
Richard Eisenberg [Thu, 9 Jul 2015 02:17:07 +0000 (22:17 -0400)] 
`base` compiles

4 years agoUndoing some changes
Richard Eisenberg [Wed, 8 Jul 2015 20:41:33 +0000 (16:41 -0400)] 
Undoing some changes

4 years agoCheckpoint in bugfixing
Richard Eisenberg [Wed, 8 Jul 2015 18:33:54 +0000 (14:33 -0400)] 
Checkpoint in bugfixing

4 years agoMassive simplification: always deeply skolemise
Richard Eisenberg [Wed, 8 Jul 2015 13:12:34 +0000 (09:12 -0400)] 
Massive simplification: always deeply skolemise

4 years agoYet another checkpoint
Richard Eisenberg [Wed, 8 Jul 2015 03:51:50 +0000 (23:51 -0400)] 
Yet another checkpoint

4 years agoCheckpoint in more undoing.
Richard Eisenberg [Wed, 8 Jul 2015 03:39:03 +0000 (23:39 -0400)] 
Checkpoint in more undoing.

4 years agoCheckpoint on undoing a lot of sigma-type stuff.
Richard Eisenberg [Wed, 8 Jul 2015 03:29:20 +0000 (23:29 -0400)] 
Checkpoint on undoing a lot of sigma-type stuff.

4 years agoSome bugfixing
Richard Eisenberg [Wed, 8 Jul 2015 02:05:59 +0000 (22:05 -0400)] 
Some bugfixing

4 years agoWorking on failing test
Richard Eisenberg [Thu, 2 Jul 2015 03:56:57 +0000 (23:56 -0400)] 
Working on failing test

4 years agoVta1 passes
Richard Eisenberg [Wed, 1 Jul 2015 21:29:18 +0000 (17:29 -0400)] 
Vta1 passes

4 years agoCheckpoint in bugfixing
Richard Eisenberg [Wed, 1 Jul 2015 21:14:37 +0000 (17:14 -0400)] 
Checkpoint in bugfixing

4 years agoSome bugfixing
Richard Eisenberg [Wed, 1 Jul 2015 16:09:16 +0000 (12:09 -0400)] 
Some bugfixing

4 years agoIn the process of eager skolemisation
Richard Eisenberg [Wed, 1 Jul 2015 12:29:32 +0000 (08:29 -0400)] 
In the process of eager skolemisation

4 years agoIt compiles.
Richard Eisenberg [Tue, 30 Jun 2015 21:25:02 +0000 (17:25 -0400)] 
It compiles.

4 years agoStarting to compile.
Richard Eisenberg [Tue, 30 Jun 2015 20:07:56 +0000 (16:07 -0400)] 
Starting to compile.

4 years agoMidway through redesign of the type inference alg.
Richard Eisenberg [Tue, 30 Jun 2015 03:28:47 +0000 (23:28 -0400)] 
Midway through redesign of the type inference alg.

4 years agoTestsuite stuff from previous commit
Richard Eisenberg [Sun, 28 Jun 2015 20:55:09 +0000 (16:55 -0400)] 
Testsuite stuff from previous commit

4 years agoRetain System naems until the end of typechecking
Richard Eisenberg [Sun, 28 Jun 2015 17:53:32 +0000 (13:53 -0400)] 
Retain System naems until the end of typechecking

4 years agoOnly thing left is the typechecker
Richard Eisenberg [Sat, 27 Jun 2015 16:50:20 +0000 (12:50 -0400)] 
Only thing left is the typechecker

4 years agoLexing/parsing complete.
Richard Eisenberg [Sat, 27 Jun 2015 16:01:50 +0000 (12:01 -0400)] 
Lexing/parsing complete.

4 years agoAdd VTA tests
Richard Eisenberg [Fri, 26 Jun 2015 21:12:57 +0000 (17:12 -0400)] 
Add VTA tests

4 years agoRemove vestigial prefixq{var,con}sym from parser.
Richard Eisenberg [Sat, 27 Jun 2015 16:55:36 +0000 (12:55 -0400)] 
Remove vestigial prefixq{var,con}sym from parser.

4 years agoTest Trac #10524
Simon Peyton Jones [Fri, 26 Jun 2015 15:00:45 +0000 (16:00 +0100)] 
Test Trac #10524

4 years agoImprove error message for Typeable k (T k)
Simon Peyton Jones [Fri, 26 Jun 2015 15:00:19 +0000 (16:00 +0100)] 
Improve error message for Typeable k (T k)

GHC can't yest build a TypeRep for a type involving kind variables.
(We await kinds = types for that.)  But the error message was terrible,
as fixing #10524 reminded me.

This improves it a lot.

4 years agoBetter tracing and tiny refactoring
Simon Peyton Jones [Fri, 26 Jun 2015 14:57:28 +0000 (15:57 +0100)] 
Better tracing and tiny refactoring

4 years agoMake fvType ignore kinds
Simon Peyton Jones [Fri, 26 Jun 2015 14:56:35 +0000 (15:56 +0100)] 
Make fvType ignore kinds

TcValidity.fvTypes works in partnership with sizeTypes, and
hence should ignore kinds in exactly the same way.  It wasn't
doing so, which meant that validDerivPred said "No" when it
should have said "Yes". That led to the bug reported in
Trac #10524 comment:7.

The error message is pretty terrible
  No instance for (Typeable T)
but I'll fix that next

4 years agoKill off sizePred
Simon Peyton Jones [Fri, 26 Jun 2015 13:34:42 +0000 (14:34 +0100)] 
Kill off sizePred

It really isn't needed, and life is simpler without

4 years agocloseOverKinds *before* oclose in coverage check
Simon Peyton Jones [Fri, 26 Jun 2015 13:28:45 +0000 (14:28 +0100)] 
closeOverKinds *before* oclose in coverage check

Combining functional dependencies with kind-polymorphism is
devilishly tricky!  It's all documented in
    Note [Closing over kinds in coverage]

Fixes Trac #10564

4 years agoImprove CPR behavior for strict constructors
Simon Peyton Jones [Fri, 26 Jun 2015 10:40:01 +0000 (11:40 +0100)] 
Improve CPR behavior for strict constructors

When working on Trac #10482 I noticed that we could give constructor
arguments the CPR property if they are use strictly.

This is documented carefully in
    Note [CPR in a product case alternative]
and also
    Note [Initial CPR for strict binders]

There are a bunch of intersting examples in
    Note [CPR examples]
which I have added to the test suite as T10482a.

I also added a test for #10482 itself.

4 years agoSmall doc fixes
Simon Peyton Jones [Fri, 26 Jun 2015 10:36:02 +0000 (11:36 +0100)] 
Small doc fixes

4 years agoComments only
Simon Peyton Jones [Fri, 26 Jun 2015 07:35:11 +0000 (08:35 +0100)] 
Comments only

4 years agoGHCi docs: layout rule is respected inside :{ :}
Thomas Miedema [Wed, 24 Jun 2015 10:52:16 +0000 (12:52 +0200)] 
GHCi docs: layout rule is respected inside :{ :}

Summary:
I don't know if or when this changed, but the documentation on :{ :}
(multiline input) seems out of date. Layout rule works fine. I added a
regression test.

Reviewers: austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1013

4 years agoFix deadlock (#10545)
Simon Marlow [Fri, 19 Jun 2015 14:12:24 +0000 (15:12 +0100)] 
Fix deadlock (#10545)

yieldCapability() was not prepared to be called by a Task that is not
either a worker or a bound Task.  This could happen if we ended up in
yieldCapability via this call stack:

performGC()
scheduleDoGC()
requestSync()
yieldCapability()

and there were a few other ways this could happen via requestSync.
The fix is to handle this case in yieldCapability(): when the Task is
not a worker or a bound Task, we put it on the returning_workers
queue, where it will be woken up again.

Summary of changes:

* `yieldCapability`: factored out subroutine waitForWorkerCapability`
* `waitForReturnCapability` renamed to `waitForCapability`, and
  factored out subroutine `waitForReturnCapability`
* `releaseCapabilityAndQueue` worker renamed to `enqueueWorker`, does
  not take a lock and no longer tests if `!isBoundTask()`
* `yieldCapability` adjusted for refactorings, only change in behavior
  is when it is not a worker or bound task.

Test Plan:
* new test concurrent/should_run/performGC
* validate

Reviewers: niteria, austin, ezyang, bgamari

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D997

GHC Trac Issues: #10545

4 years agoFix for crash in setnumcapabilities001
Simon Marlow [Fri, 19 Jun 2015 13:41:32 +0000 (14:41 +0100)] 
Fix for crash in setnumcapabilities001

getNewNursery() was unconditionally incrementing next_nursery, which
is normally fine but it broke an assumption in
storageAddCapabilities().  This manifested as an occasional crash in
the setnumcapabilities001 test.

4 years agoTiny refactor plus comments
Simon Peyton Jones [Fri, 26 Jun 2015 07:31:37 +0000 (08:31 +0100)] 
Tiny refactor plus comments

4 years agoError message wibbles from out-of-scope changes
Simon Peyton Jones [Thu, 25 Jun 2015 08:25:39 +0000 (09:25 +0100)] 
Error message wibbles from out-of-scope changes

The patch "Treat out-of-scope variables as holes" makes
lots of error messages change a bit. This patch has all
the change.

4 years agoTreat out-of-scope variables as holes
Simon Peyton Jones [Wed, 24 Jun 2015 22:27:59 +0000 (23:27 +0100)] 
Treat out-of-scope variables as holes

This patch implements the idea in Trac #10569.

* An out-of-scope variable is treated as a typed expression
  hole.

* That is, we don't report it in the type checker, not the
  renamer, and we when we do report it, we give its type.

* Moreover, we can defer the error to runtime with
  -fdefer-typed-holes

In implementation terms:

* The renamer turns an unbound variable into a HsUnboundVar

* The type checker emits a Hole constraint for a
  HsUnboundVar, and turns it back into a HsVar

It was a bit painful to implement because a whole raft of
error messages change slightly.  But there was absolutely
nothing hard in principle.

Holes are reported with a bunch of possibly-useful context,
notably the "relevant bindings".  I found that this was
distracting clutter in the very common case of a mis-typed
variable that is only accidentally not in scope, so I've
arranged to print the context information only for true holes,
that is ones starting with an underscore.

Unbound data constructors use in patterns, like
  f (D x) = x
are still reportd by the renamer, and abort compilation
before type checking.

4 years agoGet rid of irrelevant impredicative polymoprhism
Simon Peyton Jones [Thu, 25 Jun 2015 08:21:13 +0000 (09:21 +0100)] 
Get rid of irrelevant impredicative polymoprhism

These tests aren't about impredicativity

4 years agoGet rid of irrlevant result type signature
Simon Peyton Jones [Thu, 25 Jun 2015 08:17:27 +0000 (09:17 +0100)] 
Get rid of irrlevant result type signature

Result type-sigs are now illegal, but that's not what this test
is about

4 years agoAdd module header to test
Simon Peyton Jones [Thu, 25 Jun 2015 08:14:21 +0000 (09:14 +0100)] 
Add module header to test

..to avoid irrelevant 'main is not defined' error message

4 years agoDon't float out alpha[sig] ~ Int
Simon Peyton Jones [Thu, 25 Jun 2015 08:13:30 +0000 (09:13 +0100)] 
Don't float out alpha[sig] ~ Int

This is just a small twiddle to TcSimplify.usefulToFloat
See Note [Which equalities to float].

4 years agoFix addDataConStrictness
Simon Peyton Jones [Wed, 24 Jun 2015 22:43:41 +0000 (23:43 +0100)] 
Fix addDataConStrictness

See Note [Add demands for strict constructors].

The new bit is the test for isAbsDmd in addDataConStrictness.
There was a cryptic note that said that this function
should add a seqDmd even for Absent arguments, but that
is definitely a bad thing (as the Note now says), causing
unused arguments to be passed to the worker.

Easy fix!

4 years agoMinor fix to free-vars in RnTypes
Simon Peyton Jones [Wed, 24 Jun 2015 22:29:11 +0000 (23:29 +0100)] 
Minor fix to free-vars in RnTypes

A type wild-card should't appear in the "uses"
free-variable set.

4 years agoAllow recursive unwrapping of data families
Simon Peyton Jones [Wed, 24 Jun 2015 21:54:27 +0000 (22:54 +0100)] 
Allow recursive unwrapping of data families

When doing strictness analysis, we need to look inside products.
To avoid unpacking infinitely, we must be careful about
infinite types.  That in turn is controlled by TyCon.checkRecTc.

For data families like
   data instance T (a,b) = MkT a (T b)
we want to unpack the thing recursively for types like
  T (Int, (Int, (Int, Int)))

This patch elaborates the checkRecTc mechanism in TyCon, to
maintain a *count* of how many times a TyCon has shown up,
rather than just a boolean.

A simple change, and a useful one.  Fixes Trac #10482.

4 years agoUse a Representaional coercion for data families
Simon Peyton Jones [Wed, 24 Jun 2015 21:35:32 +0000 (22:35 +0100)] 
Use a Representaional coercion for data families

When we have
  data instance T (a,b) = MkT a b
we make a represntation type
  data TPair a b = MkT a b
plus an axiom to connect the two
  ax a b :: T (a,b)  ~R  TPair a b

Previously this was a Nominal equality, and that worked ok
but seems illogical since Nominal equalities are between
types that the programmer thinks of as being equal.  But
TPair is not visible to the programmer; indeed we call it
the "representation TyCon".  So a Representational equality
seems more suitable here.

4 years agoImprove pretty-printing for CoPat
Simon Peyton Jones [Wed, 24 Jun 2015 21:19:33 +0000 (22:19 +0100)] 
Improve pretty-printing for CoPat

4 years agoWhite space only
Simon Peyton Jones [Wed, 24 Jun 2015 21:14:44 +0000 (22:14 +0100)] 
White space only

4 years agoComments only
Reid Barton [Thu, 25 Jun 2015 18:26:40 +0000 (14:26 -0400)] 
Comments only

4 years agoBe aware of overlapping global STG registers in CmmSink (#10521)
Reid Barton [Thu, 25 Jun 2015 17:53:57 +0000 (13:53 -0400)] 
Be aware of overlapping global STG registers in CmmSink (#10521)

Summary:
On x86_64, commit e2f6bbd3a27685bc667655fdb093734cb565b4cf assigned
the STG registers F1 and D1 the same hardware register (xmm1), and
the same for the registers F2 and D2, etc. When mixing calls to
functions involving Float#s and Double#s, this can cause wrong Cmm
optimizations that assume the F1 and D1 registers are independent.

Reviewers: simonpj, austin

Reviewed By: austin

Subscribers: simonpj, thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D993

GHC Trac Issues: #10521

4 years agoTest Trac #10562
Simon Peyton Jones [Thu, 25 Jun 2015 14:49:09 +0000 (15:49 +0100)] 
Test Trac #10562

4 years agoImprove kind-checking for 'deriving' clauses
Simon Peyton Jones [Thu, 25 Jun 2015 14:48:37 +0000 (15:48 +0100)] 
Improve kind-checking for 'deriving' clauses

The main payload is in 'mk_functor_like_constraints' in
TcDeriv.inferConstraints.

This is moving towards a fix for Trac #10561

4 years agodriver: pass '-fPIC' option to all CC invocations
Sergei Trofimovich [Wed, 24 Jun 2015 21:10:47 +0000 (22:10 +0100)] 
driver: pass '-fPIC' option to all CC invocations

Reported by mitchty:

  When porting ghc to alpine linux (rumors say they build
  all binaries as Position Independent Executables
  to leverage global ASLR) linker issued obscure errors:

Tiny example:
    $ echo 'main = print "hello"' > a.hs
    $ ghc -fforce-recomp a.hs -fPIC -dynamic -optl-pie -o a
        ld: /tmp/ghc2142_0/ghc2142_5.o: relocation R_X86_64_32 against `ZCMain_main_closure'
            can not be used when making a shared object; recompile with -fPIC
        /tmp/ghc2142_0/ghc2142_5.o: error adding symbols: Bad value
        collect2: error: ld returned 1 exit status

There is two entry points in CC driver:
    'runPhase' (CC) and 'mkExtraObj'

'mkExtraObj' does not handle most of 'runPhase's complexity.
Ideally it should.

This patch only adds -fPIC propagation to 'mkExtraObj'.

Please merge to stable branch.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
4 years agoClean outdated ext-core references in comments.
Sergei Trofimovich [Sun, 21 Jun 2015 20:11:22 +0000 (21:11 +0100)] 
Clean outdated ext-core references in comments.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
4 years agoDrop prefix from package keys.
Edward Z. Yang [Tue, 23 Jun 2015 17:41:45 +0000 (10:41 -0700)] 
Drop prefix from package keys.

Summary:
Contains Cabal submodule update, as Cabal is responsible
generating package keys.  We also have to update some output.

Also comes with a documentation update for ghc-pkg in the
user manual for --package-key.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1011

GHC Trac Issues: #10550

4 years agoBuild system: delete unused variables in config.mk.in
Thomas Miedema [Tue, 23 Jun 2015 15:08:48 +0000 (17:08 +0200)] 
Build system: delete unused variables in config.mk.in

GhcStage1DefaultNewCodegen, GhcStage2DefaultNewCodegen,
GhcStage3DefaultNewCodegen and GhcCompilerWays are not used anywhere.

4 years agoMake $1 in $1_$2_$3_FOO actually be directory.
Edward Z. Yang [Sat, 20 Jun 2015 23:32:56 +0000 (16:32 -0700)] 
Make $1 in $1_$2_$3_FOO actually be directory.

Summary:
Previously, we used $1_$2_PACKAGE_KEY to parametrize $1.  But the
documentation says that $1 should be the directory...  and we're now
putting the libraries in $1_$2_LIB_NAME.  So use /that/.  This is just
alpha-renaming, so as long as we're consistent, there's no material
difference.)

I also fixed a bug of a package ID calculation which I missed first
time around, which was tickled by this change.

BTW, this means DEP_KEYS and TRANSITIVE_DEP_KEYS are unused, so
remove them from ghc-cabal.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1010

4 years agopowerpc: add basic support for PLT relocations (#10402)
Sergei Trofimovich [Tue, 23 Jun 2015 12:39:34 +0000 (07:39 -0500)] 
powerpc: add basic support for PLT relocations (#10402)

Commit a93ab43ab5f40cadbedea2f6342b93c245e91434
enabled support for proper PIC relocations from
assembler.

Commit adds support for relocations of type:
    R_PPC_REL16_HI
    R_PPC_REL16_HA
    R_PPC_REL16_LO
    R_PPC_PLTREL24

They are used only when GHC is built in
    DYNAMIC_GHC_PROGRAMS = NO
mode.

Verified by running the following test:

    // cat a.c
    #include <stdio.h>

    void ffi_a_hello (int i) {
        fprintf (stderr, "WEEEEEEEE: i=%d\n", i);
    }

    -- cat A.hs
    {-# LANGUAGE ForeignFunctionInterface #-}
    module A where

    import Foreign.C

    foreign import ccall "ffi_a_hello" a :: CInt -> IO ()

    # ghc -fPIC -c a.c -fforce-recomp
    # ghc -fPIC -c A.hs -fforce-recomp
    # ghc --interactive ./a.o A
    ...
    *A> a 42
    WEEEEEEEE: i=42
See gory details in Trac #10402.

Signed-off-by: Colin Watson <cjwatson@debian.org>
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Reviewed By: bgamari, austin

Differential Revision: https://phabricator.haskell.org/D996

GHC Trac Issues: #10402

4 years agoFurther elaborate Trac #10403 test
Simon Peyton Jones [Tue, 23 Jun 2015 12:14:26 +0000 (13:14 +0100)] 
Further elaborate Trac #10403 test

Adding app1, app2, as requested in the ticket

4 years agoRename $1_$2_$3_LIB_NAME to LIB_FILE.
Edward Z. Yang [Sat, 20 Jun 2015 23:23:58 +0000 (16:23 -0700)] 
Rename $1_$2_$3_LIB_NAME to LIB_FILE.

Summary:
When we introduced user-friendly library names
(e.g. unix-2.7.1.0-G4Yo1pNtYrk8nCq1cx8P9d instead of
unix_G4Yo1pNtYrk8nCq1cx8P9d) we added a new variable to
be written out by ghc-cabal, $1_$2_LIB_NAME.

What I didn't realize at the time was that this conflicts
with an existing variable in the build system, $1_$2_$3_LIB_NAME,
which (confusingly) refers to something like
'libHSunix-2.7.1.0-G4Yo1pNtYrk8nCq1cx8P9d.so'.  This is pretty
confusing (despite never conflicting), so I renamed this variable
to LIB_FILE for enhanced greppability.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1002

4 years agoFix #10551 by using LIB_NAMES.
Edward Z. Yang [Sat, 20 Jun 2015 23:15:41 +0000 (16:15 -0700)] 
Fix #10551 by using LIB_NAMES.

Summary:
(NB: this code is dead at the moment since Windows is not built
dynamically.)

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: none

Reviewers: austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1001

GHC Trac Issues: #10551

4 years agoUse -package-id to specify libraries on command line.
Edward Z. Yang [Sat, 20 Jun 2015 22:35:28 +0000 (15:35 -0700)] 
Use -package-id to specify libraries on command line.

Summary:
There's not really any good reason to use -package-key over
-package-id, so use the latter as standard practice.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: austin

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1000

4 years agoCheck KnownSymbol => Typeable deduction
Gabor Greif [Mon, 22 Jun 2015 13:40:01 +0000 (15:40 +0200)] 
Check KnownSymbol => Typeable deduction

verifying fix for #10348

4 years agoDocumentation: add section on .haskeline file (#2531)
Thomas Miedema [Sun, 21 Jun 2015 18:56:56 +0000 (20:56 +0200)] 
Documentation: add section on .haskeline file (#2531)

4 years agoAdd parsePattern parser entry point
Alan Zimmerman [Sun, 21 Jun 2015 19:52:58 +0000 (21:52 +0200)] 
Add parsePattern parser entry point

Reviewers: austin, thomie, alanz

Reviewed By: thomie, alanz

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1005

GHC Trac Issues: #10556

4 years agoChange `Typeable` instance for type-lis to use the Known* classes.
Iavor S. Diatchki [Sun, 21 Jun 2015 19:24:42 +0000 (12:24 -0700)] 
Change `Typeable` instance for type-lis to use the Known* classes.

This should fix T10348

4 years agoBuild system: unset HADDOCK when haddock is not found
Thomas Miedema [Thu, 18 Jun 2015 17:40:40 +0000 (19:40 +0200)] 
Build system: unset HADDOCK when haddock is not found

This prevents the following test errors on Windows:

   perf/haddock haddock.Cabal [[Errno 2] No such file or directory: ...
   perf/haddock haddock.base [[Errno 2] No such file or directory: ...
   perf/haddock haddock.compiler [[Errno 2] No such file or directory: ...

The tests will now be reported as having missing libraries.

4 years agoRemove duplicate test.
Edward Z. Yang [Sat, 20 Jun 2015 23:12:20 +0000 (16:12 -0700)] 
Remove duplicate test.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoFix all.T for T8131/T8131b.
Edward Z. Yang [Sat, 20 Jun 2015 22:58:46 +0000 (15:58 -0700)] 
Fix all.T for T8131/T8131b.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoFilter orphan rules based on imports, fixes #10294 and #10420.
Edward Z. Yang [Wed, 3 Jun 2015 21:33:05 +0000 (14:33 -0700)] 
Filter orphan rules based on imports, fixes #10294 and #10420.

Summary:
If we have an orphan rule in our database, don't apply it
unless the defining module is transitively imported by the
module we are processing.  We do this by defining a new RuleEnv
data type which includes both the RuleBase as well as the set
of visible orphan modules, and threading this through the
relevant environments (CoreReader, RuleCheckEnv and ScEnv).

This is analogous to the instances fix we applied in #2182
4c834fdddf4d44d12039da4d6a2c63a660975b95, but done for RULES.
An important knock-on effect is that we can remove some buggy
code in LoadInterface which tried to avoid loading interfaces
that were loaded by plugins (which sometimes caused instances
and rules to NEVER become visible).

One note about tests: I renamed the old plugins07 test to T10420
and replaced plugins07 with a test to ensure that a plugin
import did not cause new rules to be loaded in.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin, goldfire

Subscribers: bgamari, thomie

Differential Revision: https://phabricator.haskell.org/D950

GHC Trac Issues: #10420

4 years agoMake GHC install libraries to e.g. xhtml-3000.2.1-0ACfOp3hebWD9jGWE4v4Gh.
Edward Z. Yang [Fri, 29 May 2015 00:11:12 +0000 (17:11 -0700)] 
Make GHC install libraries to e.g. xhtml-3000.2.1-0ACfOp3hebWD9jGWE4v4Gh.

Summary:
Previously, we'd install them to something like
xhtml_0ACfOp3hebWD9jGWE4v4G which was fairly ugly; this
commit changes the default install path to contain the full
package name and version, as well as the package key.

Needs a Cabal submodule update for the commit for install paths support
"Add libname install-dirs variable, use it by default. Fixes #2437".
It also contains some miscellaneous fixes for Cabal HEAD.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: austin

Subscribers: bgamari, thomie

Trac Issues: #10479

Differential Revision: https://phabricator.haskell.org/D922

4 years agoUpdated output for test ghci024
Sergei Trofimovich [Sat, 20 Jun 2015 11:47:50 +0000 (12:47 +0100)] 
Updated output for test ghci024

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
4 years agoRecognise 'hardhloat' as a valid vendor in a host tuple
Sergei Trofimovich [Sat, 20 Jun 2015 11:23:00 +0000 (12:23 +0100)] 
Recognise 'hardhloat' as a valid vendor in a host tuple

Observed on a tuple armv7a-hardfloat-linux-gnueabi:
> Unknown vendor hardfloat

Reported-by: Sergey Alirzaev
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
4 years agoFix a couple of tests for GHCi/-O* (Trac #10052)
Sergei Trofimovich [Sat, 20 Jun 2015 09:24:40 +0000 (10:24 +0100)] 
Fix a couple of tests for GHCi/-O* (Trac #10052)

Tests use unboxed types (or optimizer gets to them),
those can't be handled by ghci. Fixed by using -fobject-code.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
4 years agoAmend tcrun037 after Trac #7854 fix
Sergei Trofimovich [Sat, 20 Jun 2015 09:04:28 +0000 (10:04 +0100)] 
Amend tcrun037 after Trac #7854 fix

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
4 years agoAmend tcrun024, tcrun025 after Trac #7854 fix
Sergei Trofimovich [Sat, 20 Jun 2015 08:51:36 +0000 (09:51 +0100)] 
Amend tcrun024, tcrun025 after Trac #7854 fix

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
4 years agoshould_run/allocLimit4: disable ghci way
Sergei Trofimovich [Fri, 19 Jun 2015 21:54:15 +0000 (22:54 +0100)] 
should_run/allocLimit4: disable ghci way

Test sets allocation limit for a current main thread,
ghci already loaded a bunch of stuff in it.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
4 years agodocs: Unbreak the PS/PDF builds for the User's Guide (#10509)
Gabor Pali [Fri, 19 Jun 2015 21:19:30 +0000 (23:19 +0200)] 
docs: Unbreak the PS/PDF builds for the User's Guide (#10509)

dblatex can only translate the Unicode glyphs introduced in #10509 for LaTeX
if the `latex.unicode.use=1` flag is set, otherwise it will just fail.
However, note that adding this flag is not going to fully solve the problem as
those symbols are not known by LaTeX, so the corresponding character codes
will be added instead to the resulting PS/PDF files.  Hence it is considered
an interim solution only, not a true fix, until a better one is found.

4 years agotestsuite: mark T4945 as expect_broken
Austin Seipp [Fri, 19 Jun 2015 17:28:14 +0000 (12:28 -0500)] 
testsuite: mark T4945 as expect_broken

This was working, and then it started failing again; it's a pretty
fragile test anyway because it 'grep's the output of the compiler.

In the mean time, make the CI system quiet down by marking it
appropriately.

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agoSpelling in comments
Gabor Greif [Tue, 16 Jun 2015 11:14:38 +0000 (13:14 +0200)] 
Spelling in comments

4 years agoElaborate test for Trac #10403
Simon Peyton Jones [Thu, 18 Jun 2015 22:26:48 +0000 (23:26 +0100)] 
Elaborate test for Trac #10403

4 years agoTest Trac #10503
Simon Peyton Jones [Thu, 18 Jun 2015 14:45:22 +0000 (15:45 +0100)] 
Test Trac #10503

4 years agoParser: commas_tup_tail duplicate SrcSpan on "Missing" value
Alan Zimmerman [Thu, 18 Jun 2015 14:19:50 +0000 (16:19 +0200)] 
Parser: commas_tup_tail duplicate SrcSpan on "Missing" value

Summary:
Parsing

    {-# LANGUAGE TupleSections #-}

    baz = (1, "hello", 6.5,,) 'a' (Just ())

Results in the following AST fragment

    (L tests/examples/Tuple.hs:3:7-25
       (ExplicitTuple
          [ L tests/examples/Tuple.hs:3:8
              (Present
                 (L tests/examples/Tuple.hs:3:8
                    (HsOverLit
                       (OverLit
                          (HsIntegral [ '1' ] 1)
                          PlaceHolder
                          (HsLit
                             (HsString
                                []
                                {abstract:FastString}))
                          PlaceHolder))))
          , L tests/examples/Tuple.hs:3:11-17
              (Present
                 (L tests/examples/Tuple.hs:3:11-17
                    (HsLit
                       (HsString
                          [ '"'
                          , 'h'
                          , 'e'
                          , 'l'
                          , 'l'
                          , 'o'
                          , '"'
                          ]
                          {abstract:FastString}))))
          , L tests/examples/Tuple.hs:3:20-22
              (Present
                 (L tests/examples/Tuple.hs:3:20-22
                    (HsOverLit
                       (OverLit
                          (HsFractional
                             (FL
                                [ '6' , '.' , '5' ]
                                (:% 13 2)))
                          PlaceHolder
                          (HsLit
                             (HsString
                                []
                                {abstract:FastString}))
                          PlaceHolder))))
          , L tests/examples/Tuple.hs:3:24
              (Missing PlaceHolder)
          , L tests/examples/Tuple.hs:3:24
              (Missing PlaceHolder)
          ]

The final `Missing PlaceHolder` has a duplicated `SrcSpan`

Test Plan: ./validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, bgamari, mpickering

Differential Revision: https://phabricator.haskell.org/D995

GHC Trac Issues: #10537

4 years agoTrac #4945 is working again
Simon Peyton Jones [Thu, 18 Jun 2015 14:18:19 +0000 (15:18 +0100)] 
Trac #4945 is working again

This test greps in the ouput of -ddump-simpl, so it's fragile.
It stopped working for a while, but now works again. I don't know
why, but I don't have time to investigate, so I'll just mark it
as ok.

4 years agoRefactor filterAlts into two parts
Simon Peyton Jones [Thu, 18 Jun 2015 14:16:59 +0000 (15:16 +0100)] 
Refactor filterAlts into two parts

This splits filterAlts into two:
 - filterAlts
 - refineDefaultAlt

No change in functionality

4 years agoComments plus tiny refactoring
Simon Peyton Jones [Thu, 18 Jun 2015 13:14:01 +0000 (14:14 +0100)] 
Comments plus tiny refactoring

4 years agoA bit more tracing
Simon Peyton Jones [Thu, 18 Jun 2015 13:13:24 +0000 (14:13 +0100)] 
A bit more tracing

4 years agoRemove some horrible munging of origins for Coercible
Simon Peyton Jones [Thu, 18 Jun 2015 13:12:54 +0000 (14:12 +0100)] 
Remove some horrible munging of origins for Coercible

I just didn't think it was buying enough for all the cruft it caused.
We can put some back if people start complaining about poor error
messages. I forget quite how I tripped over this but I got sucked in.

* Lots of tidying up in TcErrors

* Rename pprArisingAt to pprCtLoc, by analogy with pprCtOrigin

* Remove CoercibleOrigin data constructor from CtOrigin

* Make relevantBindings return a Ct with a zonked
  and tidied CtOrigin

* Add to TcRnTypes
      ctOrigin   :: Ct -> CtOrigin
      ctEvOrigin :: CtEvidence -> CtOrigin
      setCtLoc   :: Ct -> CtLoc -> Ct

4 years agoRename getCtLoc, setCtLoc
Simon Peyton Jones [Thu, 18 Jun 2015 12:55:41 +0000 (13:55 +0100)] 
Rename getCtLoc, setCtLoc

getCtLoc -> getCtLocM
setCtLoc -> setCtLocM

These operations are monadic, and I want to introduce a
pure version of setCtLoc :: Ct -> CtLoc -> Ct

4 years agoComments only
Simon Peyton Jones [Wed, 17 Jun 2015 11:31:26 +0000 (12:31 +0100)] 
Comments only

Rewording in
  Note [Decomposing equality]
  Note [Decomposing newtypes at representational role]

Richard you may want to check, but I think it's fine.

4 years agoReport arity errors correctly despite kinds
Simon Peyton Jones [Thu, 18 Jun 2015 07:54:11 +0000 (08:54 +0100)] 
Report arity errors correctly despite kinds

Trac #10516 pointed out that when reporting arity errors
(like "T needs 2 arguments but has been given 1"), we should
not count kind arguments, since they are implicit.  If we
include kind args in the count, we get very confusing error
messages indeed.

I did a little bit of refactoring which make some
error messages wobble around.  But the payload of
this fix is in TcValidity.tyConArityErr

4 years agoCare with impossible-cons in combineIdenticalAlts
Simon Peyton Jones [Thu, 18 Jun 2015 07:51:08 +0000 (08:51 +0100)] 
Care with impossible-cons in combineIdenticalAlts

This was a nasty, long-standing bug exposed in Trac #10538.
Symptoms were that we had an empty case
   case (x :: Either a) of {}
Core Lint correctly picked this bogus code up.

Here is what happened

* In SimplUtils.prepareAlts, we call
        filterAlts
  then
        combineIdenticalAlts

* We had    case x of { Left _ -> e1; Right _ -> e1 }

* filterAlts did nothing, but correctly retuned imposs_deflt_cons
  saying that 'x' cannot be {Left, Right} in the DEFAULT branch,
  if any (there isn't one.)

* combineIdentialAlts correctly combines the identical alts, to give
     case x of { DEFAULT -> e1 }

* BUT combineIdenticalAlts did no adjust imposs_deft_cons

* Result: when compiling e1 we did so in the belief that 'x'
  could not be {Left,Right}.  Disaster.

Easily fixed.

(It is hard to trigger; I can't construct a simple test case.)

4 years agoMake enum01/enum02/enum03 tests clang-compatible
Reid Barton [Tue, 16 Jun 2015 21:39:15 +0000 (16:39 -0500)] 
Make enum01/enum02/enum03 tests clang-compatible

... by entirely replacing the use of CPP by a custom preprocessor;
clang -E -traditional has no stringification mechanism at all.

Reviewed By: thomie, austin

Differential Revision: https://phabricator.haskell.org/D957

GHC Trac Issues: #9399