1. 12 Jun, 2015 2 commits
    • Simon Marlow's avatar
      Add parseExpr and compileParsedExpr and use them in GHC API and GHCi · d20031d4
      Simon Marlow authored
      Summary:
      This commit brings following changes and fixes:
      
       * Implement parseExpr and compileParsedExpr;
       * Fix compileExpr and dynCompilerExpr, which returned `()` for empty expr;
       * Fix :def and :cmd, which didn't work if `IO` or `String` is not in scope;
       * Use GHCiMonad instead IO in :def and :cmd;
       * Clean PrelInfo: delete dead comment and duplicate entries, add assertion.
      
      See new tests for more details.
      
      Test Plan: ./validate
      
      Reviewers: austin, dterei, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie, bgamari
      
      Differential Revision: https://phabricator.haskell.org/D974
      
      GHC Trac Issues: #10508
      d20031d4
    • thomie's avatar
      Testsuite: fix the little known CHECK_FILES_WRITTEN=1 · c14bd017
      thomie authored
      The testsuite driver has a little known feature to check which files
      each test writes to, whether there are tests that write to same file,
      and whether the tests leave any files behind when CLEANUP=1. It uses
      strace under the hood.
      
      This commit fixes some bitrot, and filters out some more strace lines
      that we're not interested in (and are shown as framework failures
      otherwise).
      
      Differential Revision: https://phabricator.haskell.org/D979
      c14bd017
  2. 11 Jun, 2015 9 commits
    • Edward Z. Yang's avatar
      Revert "Support for multiple signature files in scope." · bac927b9
      Edward Z. Yang authored
      This reverts commit a7524eae.
      bac927b9
    • Edward Z. Yang's avatar
      Add failing test for #9562. · 23582b0c
      Edward Z. Yang authored
      
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      23582b0c
    • thomie's avatar
      Testsuite: change some expect_fail tests to expect_broken · 5e66a698
      thomie authored
      Change the following tests from expect_fail to expect_broken: and list
      the ticket number:
      
          * driver/sigof03m/sigof03 (#9252)
          * driver/static001 (#8127)
          * partial-sigs/should_compile/EqualityConstraint (#9478)
          * partial-sigs/should_compile/ExtraNumAMROn (#9478)
          * partial-sigs/should_compile/PatBind2 (#9478)
          * partial-sigs/should_fail/TidyClash2 (#9478)
          * simplCore/should_compile/T8832 (#8832)
      
      The following tests are still marked as expect_fail, but it is not
      clearly documented why so:
      
          * gadt/lazypatok
          * indexed-types/should_fail/SkolemOccursLoop
      
      All other expect_fail tests are only expected to fail on either a
      certain platform/os or for a certain way only.
      
      Differential Revision: https://phabricator.haskell.org/D966
      5e66a698
    • thomie's avatar
      Testsuite: mention the existence of ticket #10510 · 6cefeb37
      thomie authored
      [skip ci]
      6cefeb37
    • thomie's avatar
      Testsuite: mark T4945 as expect_broken (#4945) · 506522c9
      thomie authored
      In commit 7d519dab, the file
      T4945.stdout was added to the repository, to make T4945 pass
      validatation presumably.
      
      When that test produces output however, there is a bug somewhere, and we
      shouldn't hide it. There is a comment in the Makefile which says:
      
          "When SpecConstr works there are no STUArrays at all"
      
      So here we remove T4945.stdout again, mark T4945 as expect_broken, and
      reopen the ticket.
      
      Differential Revision: https://phabricator.haskell.org/D976
      506522c9
    • thomie's avatar
      Testsuite: mark tests as expect_broken on win64 · a765f72c
      thomie authored
      Tickets: #1407, #9381, #9878.
      
      Differential Revision: https://phabricator.haskell.org/D977
      a765f72c
    • thomie's avatar
      Testsuite Windows: fix T8172 (#8172) · da84fd54
      thomie authored
      Use the new function `normalise_drive_letter` to change D:\ to C:\
      before comparing outputs.
      da84fd54
    • Simon Peyton Jones's avatar
      c0dc79fb
    • Simon Peyton Jones's avatar
      Another major improvement of "improvement" · ddbb97d0
      Simon Peyton Jones authored
      I wasn't very happy with my fix to Trac #10009. This is much better.
      
      The main idea is that the inert set now contains a "model", which
      embodies *all* the (nominal) equalities that we know about, with
      a view to exposing unifications.  This requires a lot fewer iterations
      of the solver than before.
      
      There are extensive comments in
       TcSMonad:  Note [inert_model: the inert model]
                  Note [Adding an inert canonical constraint the InertCans]
      
      The big changes are
      
        * New inert_model field in InertCans
      
        * Functions addInertEq, addInertCan deal with adding a
          constraint, maintaining the model
      
        * A nice improvement is that unification variables can
          unify with fmvs, so that from, say   alpha ~ fmv
          we get              alpha := fmv
          See Note [Orientation of equalities with fmvs] in TcFlatten
          It's still not perfect, as the Note explains
      
      New flag -fconstraint-solver-iterations=n, allows us to control
      the number of constraint solver iterations, and in particular
      will flag up when it's more than a small number.
      
      Performance is generally slightly better:
      T5837 is a lot better for some reason.
      ddbb97d0
  3. 09 Jun, 2015 5 commits
    • thomie's avatar
      Testsuite: delete expect_fail setups for ghc < 7.1 · 3445947a
      thomie authored
      This makes it easier to grep for expect_fail in the tests directory.
      
      Differential Revision: https://phabricator.haskell.org/D965
      3445947a
    • thomie's avatar
      Testsuite: delete expect_fail setups for hugs · 43ebe24a
      thomie authored
      This makes it easier to grep for expect_fail in the tests directory.
      
      Differential Revision: https://phabricator.haskell.org/D964
      43ebe24a
    • thomie's avatar
      Revert "The test runner now also works under the msys-native Python." · bb996712
      thomie authored
      To make the test runner work under msys-native Python...
      
      Commit 5258566e broke the msys testsuite
      driver (#10441). It changed the quoting of `config.compiler` from single
      quotes to double quote, which turns out to not be compatible with what
      the function `passThroughCmd` expected.
      
      We could fix `passThroughCmd` to handle the case where `config.compiler`
      is double quoted, and scatter some notes around to make sure the quoting
      done in various places of the testsuite driver stay compatible.
      
      Instead, this commit reverts 101c62e2,
      which introdced the function `passThroughCmd` in the first place
      (#9626). ezyang reports that doing this revert fixes the testsuite
      driver for him using the the following version of msys2:
      
        msys2-keyring r8.3864337-1
        msys2-runtime 2.1.0.16351.cd3184b-1
        msys2-runtime-devel 2.1.0.16351.cd3184b-1
        msys2-w32api-headers 5.0.0.4456.c8b6742-1
        msys2-w32api-runtime 5.0.0.4455.32db221-1
      
      Ideally we'd know what minimum version of msys2 we require, but for now
      this fix is better than nothing.
      
      Only gintas ever reported the original problem, and he actually
      mentioned shortly afterwards: "This may have been fixed by a recent
      release of msys2, but I am not sure."
      
      Differential Revision: https://phabricator.haskell.org/D952
      bb996712
    • Zejun Wu's avatar
      Always force the exception in enqueued commands · 3b55659d
      Zejun Wu authored
      `enqueueCommands` should always force exception in commands. Otherwise
      the exception thrown in `:cmd` (e.g. `:cmd return $ head []`) will cause
      GHCi to terminate with panic.
      
      Test Plan: `cd testsuite/tests/ghci/ && make`
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D967
      
      GHC Trac Issues: #10501
      3b55659d
    • thomasw's avatar
      Refactor wild card renaming · 058af6c9
      thomasw authored
      Summary:
      Refactor wild card error reporting
      
      * Merge `HsWildcardTy` and `HsNamedWildcardTy` into one constructor
        `HsWildCardTy` with as field the new type `HsWildCardInfo`, which has two
        constructors: `AnonWildCard` and `NamedWildCard`.
      
      * All partial type checks are removed from `RdrHsSyn.hs` and are now done
        during renaming in order to report better error messages. When wild cards
        are allowed in a type, the new function `rnLHsTypeWithWildCards` (or
        `rnHsSigTypeWithWildCards`) should be used. This will bring the named wild
        cards into scope before renaming them. When this is not done, renaming will
        trigger "Unexpected wild card..." errors.
      
        Unfortunately, this has to be done separately for anonymous wild cards
        because they are given a fresh name during renaming, so they will not cause
        an out-of-scope error. They are handled in `tc_hs_type`, as a special case
        of a lookup that fails.
      
        The previous opt-out approach is replaced with an opt-in approach. No more
        panics because of forgotten checks!
      
      * `[t| _ |]` isn't caught by the above two checks, so it is currently handled
        by a special case. The error message (generated in the `DsM` monad) doesn't
        provide as much context information as the other cases.
      
      * Instead of three (!) functions that walk `HsType`, there is now only one
        pure function called `collectWildCards`.
      
      * Alternative approach: catch all unwanted wild cards in `rnHsTyKi` by looking
        at the `HsDocContext`. This will reduce the number of places to catch
        unwanted wild cards form three to one, and make the error messages more
        uniform, albeit less informative, as the error context for renaming is not
        as informative as the one for type checking. A new constructor of
        `HsDocContext` will be required for pattern synonyms signatures.
      
        Small problem: currently type-class type signatures can't be distinguished
        from type signatures using the `HsDocContext`.
      
      This requires an update to the Haddock submodule.
      
      Test Plan: validate
      
      Reviewers: goldfire, simonpj, austin
      
      Reviewed By: simonpj
      
      Subscribers: bgamari, thomie, goldfire
      
      Differential Revision: https://phabricator.haskell.org/D613
      
      GHC Trac Issues: #10098
      058af6c9
  4. 06 Jun, 2015 1 commit
    • thomie's avatar
      Testsuite: only show output diff when test is expected to pass · ae83a81a
      thomie authored
      Don't let the output of tests that either have missing libraries or are
      expected to be broken obscure real failures.
      
      This makes it easier to analyse the testlogs.
      
      The only consequence is that when a test fails because a certain library
      isn't installed, you have to check the all.T file in which the test is
      defined to actually find out _which_ library that is. Before it would
      print something like
      
          Compile failed (status 256) errors were:
      
          stm052.hs:10:8: error:
           Could not find module ‘System.Random’
           Use -v to see a list of the files searched for.
      
      And now it doesn't. I think this is an acceptable tradeoff.
      
      Differential Revision: https://phabricator.haskell.org/D945
      ae83a81a
  5. 05 Jun, 2015 1 commit
    • eir@cis.upenn.edu's avatar
      Fix #10489 · 61b96a86
      eir@cis.upenn.edu authored
      Dang, roles are annoying.
      
      Test case: typecheck/should_compile/T10489
      61b96a86
  6. 04 Jun, 2015 5 commits
    • thomie's avatar
      Testsuite: don't show compile/link info for some tests · 0686d76f
      thomie authored
      This info is not needed in the testlogs, and was actually making these
      tests fail on my machine because of some bug with the timeout program:
      ...
      [1 of 1] Compiling Main ( OutOfHeap.hs, tmp_T9579_outofheap_rtssome/Main.o )
      Linking T9579_outofheap_rtsnone ...
      ...
      0686d76f
    • thomie's avatar
      Testsuite: ignore `stdcall attribute ignored` (#1288) · 07feab19
      thomie authored
      That warning is only shown on some platforms, and is I believe harmless.
      07feab19
    • thomie's avatar
      Testsuite: add/fix cleanup for certain tests · e340f6ec
      thomie authored
      * extra_clean argument should be a list
        Add an assert to prevent regressions.
      
      * properly clean package conf direcories
        They are directories now, which was causing problems.
      
      * properly clean write_interface_* tests
        We were getting these errors:
      
        [Errno 21] Is a directory: './driver/write_interface_oneshot'
        [Errno 39] Directory not empty: './driver/write_interface_oneshot'
        [Errno 21] Is a directory: './driver/write_interface_make'
        [Errno 39] Directory not empty: './driver/write_interface_make'
      
      * outputdir() is better than -outputdir, as it knows how to (pre)clean
        itself.
      e340f6ec
    • thomie's avatar
      Make validate more quiet · d0063e89
      thomie authored
        * By default use V=0, and call the testsuite with VERBOSE=2, which we
          did before only with validate --quiet. This disables printing the
          test commands it runs.
      
        * When --quiet is used, call the testsuite with VERBOSE=1. This
          disables printing the '====> Scanning' lines, and doesn't print
          which test is being run. So it only prints something when a test
          accidentally prints to stdout or when it fails.
      
          Don't set this option on Travis, as Travis will cancel a build if it
          doesn't see any output for more than 10 minutes.
      
        * When --quiet is used, set the new test option NO_PRINT_SUMMARY,
          which skips printing the test summary. Only the list of unexpected
          failures is printed, if there are any. Note that the full summary
          can still be found in testsuite_summary.txt
      
        * When --quiet is used, don't pass the `-v` flag to `ghc-pkg check`
      
        * When --quiet is used, don't print the Oops! header. It shoud be
          clear from the list of failing tests that something is wrong.
      
      This is all done to get the most out of 30 lines of logfile. These changes can
      be disabled later by simply not passing the --quiet flag to validate.
      
      Differential Revision: https://phabricator.haskell.org/D942
      d0063e89
    • thomie's avatar
      Re-center perf numbers for haddock.compiler · d8f66f1b
      thomie authored
      Summary:
      Phabricator/Harbormaster measured the following allocation numbers for
      haddock.compiler:
      
      Expected:     33562468736
      June 2nd [1]: 36740649320
      Upper bound:  36918715610
      June 3rd [2]: 36956620504
      
      So although this test didn't start failing until June 2nd/3rd, the
      biggest increase in allocation must have occured sometime before that.
      
      [1] 2f0011ac
      [2] 942cfa4e
      
      Test Plan: validate
      
      Reviewers: austin
      
      Subscribers: bgamari, thomie
      
      Differential Revision: https://phabricator.haskell.org/D948
      d8f66f1b
  7. 03 Jun, 2015 2 commits
  8. 02 Jun, 2015 7 commits
    • Austin Seipp's avatar
      942a074c
    • Simon Peyton Jones's avatar
      Improve FFI error reporting · 3758050f
      Simon Peyton Jones authored
      I refactored TcType FFI functions to return Validity rather than Bool,
      which turned out to be an easy way to solve Trac #10461.
      3758050f
    • Austin Seipp's avatar
      compiler: make sure we reject -O + HscInterpreted · 091944e3
      Austin Seipp authored
      
      
      When using GHCi, we explicitly reject optimization, because the
      compilers optimization passes can introduce unboxed tuples, which the
      interpreter is not able to handle. But this goes the other way too: using
      GHCi on optimized code may cause the optimizer to float out breakpoints
      that the interpreter introduces. This manifests itself in weird ways,
      particularly if you as an API client use custom DynFlags to introduce
      optimization in combination with HscInterpreted.
      
      It turns out we weren't checking for consistent DynFlag settings when
      doing `setSessionDynFlags`, as #10052 showed. While the main driver
      handled it in `DynFlags` via `parseDynamicFlags`, we didn't check this
      elsewhere.
      
      This does a little refactoring to split out some of the common code, and
      immunizes the various `DynFlags` utilities in the `GHC` module from this
      particular bug. We should probably be checking other general invariants
      too.
      
      This fixes #10052, and adds some notes about the behavior in `GHC` and
      `FloatOut`
      
      As a bonus, expose `warningMsg` from `ErrUtils` as a helper since it
      didn't exist (somehow).
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      
      Reviewed By: edsko
      
      Differential Revision: https://phabricator.haskell.org/D727
      
      GHC Trac Issues: #10052
      091944e3
    • Simon Peyton Jones's avatar
      Test Trac #10438 · b2b69b2a
      Simon Peyton Jones authored
      b2b69b2a
    • Simon Peyton Jones's avatar
      Test Trac #10466 · 8e5f8cf4
      Simon Peyton Jones authored
      8e5f8cf4
    • Simon Peyton Jones's avatar
      Test Trac #10451 · 8a383483
      Simon Peyton Jones authored
      8a383483
    • Simon Peyton Jones's avatar
      Test Trac #10423 · b1b2b44a
      Simon Peyton Jones authored
      b1b2b44a
  9. 01 Jun, 2015 8 commits
    • Simon Peyton Jones's avatar
      Set 32-bit perf figure · dbcdfe23
      Simon Peyton Jones authored
      dbcdfe23
    • Simon Peyton Jones's avatar
      Mark sigof02 tests as expect_broken · 90fde522
      Simon Peyton Jones authored
      Consequence of the GlobalRdrEnv refactoring;
      see Trac #10472
      90fde522
    • Simon Peyton Jones's avatar
      Refactor the GlobalRdrEnv, fixing #7672 · 9b73cb16
      Simon Peyton Jones authored
      This patch started innocently enough, by deleting a single
      call from rnImportDecl, namely
      
          let gbl_env = mkGlobalRdrEnv (filterOut from_this_mod gres)
      
      The 'filterOut' makes no sense, and was the cause of #7672.
      
      But that little loose end led to into a twisty maze of little
      passages, all alike, which has taken me an unreasonably long
      time to straighten out. Happily, I think the result is really
      much better.
      
      In particular:
      
       * INVARIANT 1 of the GlobalRdrEnv type was simply not true:
         we had multiple GlobalRdrElts in a list with the same
         gre_name field. This kludgily implmented one form of
         shadowing.
      
       * Meanwhile, extendGlobalRdrEnvRn implemented a second form of
         shadowing, by deleting stuff from the GlobalRdrEnv.
      
       * In turn, much of this shadowing stuff depended on the Names of
         the Ids bound in the GHCi InteractiveContext being Internal
         names, even though the TyCons and suchlike all had External
         Names. Very confusing.
      
      So I have made the following changes
      
       * I re-established INVARIANT 1 of GlobalRdrEnv.  As a result
         some strange code in RdrName.pickGREs goes away.
      
       * RnNames.extendGlobalRdrEnvRn now makes one call to deal with
         shadowing, where necessary, and another to extend the
         environment.  It deals separately with duplicate bindings.
      
         The very complicated RdrName.extendGlobalRdrEnv becomes much
         simpler; we need to export the shadowing function, now called
         RdrName.shadowNames; and we can nuke
         RdrName.findLocalDupsRdrEnv altogether.
      
         RdrName Note [GlobalRdrEnv shadowing] summarises the shadowing
         story
      
       * The Names of the Ids bound in the GHCi interactive context are
         now all External.  See Note [Interactively-bound Ids in GHCi]
         in HscTypes.
      
       * Names for Ids created by the debugger are now made by
         IfaceEnv.newInteractiveBinder.  This fixes a lurking bug which
         was that the debugger was using mkNewUniqueSupply 'I' to make
         uniques, which does NOT guarantee a fresh supply of uniques on
         successive calls.
      
       * Note [Template Haskell ambiguity] in RnEnv shows that one TH-related
         error is reported lazily (on occurrences) when it might be better
         reported when extending the environment.  In some (but not all) cases
         this was done before; but now it's uniformly at occurrences.  In
         some ways it'd be better to report when extending the environment,
         but it's a tiresome test and the error is rare, so I'm leaving it
         at the lookup site for now, with the above Note.
      
       * A small thing: RnNames.greAvail becomes RdrName.availFromGRE, where
         it joins the dual RdrName.gresFromAvail.
      9b73cb16
    • Herbert Valerio Riedel's avatar
      Re-center perf numbers for T5631 · 34dcf8a0
      Herbert Valerio Riedel authored
      7dd0ea74 seems to have tipped this one over,
      although 7dd0ea74 itself had only a minimal impact on my local system.
      
      Locally, I measured right before 7dd0ea74:
      
        Expected    T5631(normal) bytes allocated: 776121120 +/-5%
        Actual      T5631(normal) bytes allocated: 811973144
        Deviation   T5631(normal) bytes allocated:       4.6 %
      
      and at 7dd0ea74:
      
        Expected    T5631(normal) bytes allocated: 776121120 +/-5%
        Actual      T5631(normal) bytes allocated: 812288344
        Deviation   T5631(normal) bytes allocated:       4.7 %
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D936
      34dcf8a0
    • Edward Z. Yang's avatar
      Add (failing) test case for #7672. · a27fb46f
      Edward Z. Yang authored
      
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      a27fb46f
    • Alan Zimmerman's avatar
      ApiAnnotations : strings in warnings do not return SourceText · e6191d1c
      Alan Zimmerman authored
      Summary:
      The strings used in a WARNING pragma are captured via
      
          strings :: { Located ([AddAnn],[Located FastString]) }
              : STRING { sL1 $1 ([],[L (gl $1) (getSTRING $1)]) }
          ..
      
      The STRING token has a method getSTRINGs that returns the original
      source text for a string.
      
      A warning of the form
      
          {-# WARNING Logic
                    , mkSolver
                    , mkSimpleSolver
                    , mkSolverForLogic
                    , solverSetParams
                    , solverPush
                    , solverPop
                    , solverReset
                    , solverGetNumScopes
                    , solverAssertCnstr
                    , solverAssertAndTrack
                    , solverCheck
                    , solverCheckAndGetModel
                    , solverGetReasonUnknown
                    "New Z3 API support is still incomplete and fragile: \
                    \you may experience segmentation faults!"
            #-}
      
      returns the concatenated warning string rather than the original source.
      
      This patch now deals with all remaining instances of getSTRING to bring
      in a SourceText for each.
      
      This updates the haddock submodule as well, for the AST change.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin, goldfire
      
      Reviewed By: austin
      
      Subscribers: bgamari, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D907
      
      GHC Trac Issues: #10313
      e6191d1c
    • Alan Zimmerman's avatar
      ApiAnnotations : rationalise tests · e00910b0
      Alan Zimmerman authored
      Summary:
      At the moment the API Annotations tests have a driver that has been
      copy/pasted multiple times.
      
      Compile it once, and run it for each test case.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin
      
      Reviewed By: austin
      
      Subscribers: bgamari, thomie
      
      Differential Revision: https://phabricator.haskell.org/D913
      
      GHC Trac Issues: #10452
      e00910b0
    • rwbarton's avatar
      In ghci linker, link against all previous temp sos (#10322) · a52f1444
      rwbarton authored
      The OS X dlopen() appears to only resolve undefined symbols in
      the direct dependencies of the shared library it is loading.
      
      Reviewed By: trommler, austin
      
      Differential Revision: https://phabricator.haskell.org/D852
      
      GHC Trac Issues: #10322
      a52f1444