summaryrefslogtreecommitdiff
path: root/compiler
Commit message (Collapse)AuthorAgeFilesLines
...
* Various ticky-related workJoachim Breitner2016-03-243-24/+54
| | | | | | | | | | | | | | | | | | this Diff contains small, self-contained changes as I work towards fixing #10613. It is mostly created to let harbormaster do its job, but feedback is welcome as well. Please do not merge this via arc; I’d like to push the individual patches as layed out here. I might push mostly trivial ones even without review, as long as the build passes. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2014
* Add unicode syntax for banana bracketsJosh Price2016-03-242-6/+19
| | | | | | | | | | | | | | | | | | | | | Summary: Add "⦇" and "⦈" as unicode alternatives for "(|" and "|)" respectively. This must be implemented differently than other unicode additions because ⦇" and "⦈" are interpretted as a $unigraphic rather than a $unisymbol. Test Plan: validate Reviewers: goldfire, bgamari, austin Reviewed By: bgamari, austin Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2012 GHC Trac Issues: #10162
* Add `PatSynSigSkol` and modify `PatSynCtxt`Rik Steenkamp2016-03-247-60/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the type of a pattern synonym cannot in general be represented by a value of type Type, we cannot use a value `SigSkol (PatSynCtxt n) (Check ty)` to represent the signature of a pattern synonym (this causes incorrect signatures to be printed in error messages). Therefore we now represent it by a value `PatSynSigSkol n` (instead of incorrect signatures we simply print no explicit signature). Furthermore, we rename `PatSynCtxt` to `PatSynBuilderCtxt`, and use `SigSkol (PatSynBuilderCtxt n) (Check ty)` to represent the type of a bidirectional pattern synonym when used in an expression context. Before, this type was represented by a value `SigSkol (PatSynCtxt n) (Check ty)`, which caused incorrect error messages. Also, in `mk_dict_err` of `typecheck\TcErrors.hs` we now distinguish between all enclosing implications and "useful" enclosing implications, for better error messages concerning pattern synonyms. See `Note [Useful implications]`. See the Phabricator page for examples. Reviewers: mpickering, goldfire, simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1967 GHC Trac Issues: #11667
* ErrUtils: Add timings to compiler phasesBen Gamari2016-03-2415-105/+186
| | | | | | | | | | | | | | | | | | | | | | | This adds timings and allocation figures to the compiler's output when run with `-v2` in an effort to ease performance analysis. Todo: * Documentation * Where else should we add these? * Perhaps we should remove some of the now-arguably-redundant `showPass` occurrences where they are * Must we force more? * Perhaps we should place this behind a `-ftimings` instead of `-v2` Test Plan: `ghc -v2 Test.hs`, look at the output Reviewers: hvr, goldfire, simonmar, austin Reviewed By: simonmar Subscribers: angerman, michalt, niteria, ezyang, thomie Differential Revision: https://phabricator.haskell.org/D1959
* Move DFunUnfolding generation to TcInstDclsSimon Peyton Jones2016-03-232-29/+34
| | | | | | | | The desugarer had a fragile case to generate the Unfolding for a DFun. This patch moves the unfolding generation to TcInstDcls, where all the pieces are to hand. Fixes Trac #11742
* Move applyTysX near piResultTysSimon Peyton Jones2016-03-231-12/+12
|
* Comment fixSimon Peyton Jones2016-03-231-1/+1
|
* Avoid running afoul of the zipTvSubst check.Richard Eisenberg2016-03-211-1/+2
| | | | | | | | addDataConStupidTheta includes comments that the types list might be longer than the tvs list. And the check in zipTvSubst doesn't appear to be terribly recent. I am utterly flummoxed as to why this worked before. It was clearly just broken. And now it's fixed.
* Use the correct in-scope set in coercionKindBartosz Nitka2016-03-211-2/+12
| | | | | | | | | | | | | | | | | The free vars of `ty2` need to be in scope to satisfy the substitution invariant. As far as I can tell we don't have the free vars of `ty2` when substituting, so unfortunately we have to compute them. Test Plan: ./validate Reviewers: austin, bgamari, simonpj, goldfire Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2024 GHC Trac Issues: #11371
* PPC NCG: Emit more portable `fcmpu 0, ...` instead of `fcmpu cr0, ...`Herbert Valerio Riedel2016-03-211-2/+6
| | | | | | | Use `fcmpu 0, ...` rather than `fcmpu cr0, ...` for better portability since some non-GNU assembler (such as IBM's `as`) tend to not support the symbolic register name `cr0`. This matches the syntax that GCC emits for PPC targets.
* Comments (only) in TcFlattenRichard Eisenberg2016-03-211-7/+15
|
* Improve panicking outputRichard Eisenberg2016-03-211-3/+3
|
* Fix #11723 and #11724.Richard Eisenberg2016-03-212-11/+50
| | | | Test cases: typecheck/should_fail/T1172{3,4}
* Zonk before calling splitDepVarsOfType.Richard Eisenberg2016-03-217-46/+91
| | | | | | It was Utterly Wrong before. Note to self: Never, ever take the free vars of an unzonked type.
* Track specified/invisible more carefully.Richard Eisenberg2016-03-2122-217/+437
| | | | | | | | | | | | | | In particular, this allows correct tracking of specified/invisible for variables in Haskell98 data constructors and in pattern synonyms. GADT-syntax constructors are harder, and are left until #11721. This was all inspired by Simon's comments to my fix for #11512, which this subsumes. Test case: ghci/scripts/TypeAppData [skip ci] (The test case fails because of an unrelated problem fixed in the next commit.)
* Comment a suspicious zonk in TcFlatten.Richard Eisenberg2016-03-211-0/+3
|
* Prevent eager unification with type families.Richard Eisenberg2016-03-212-9/+89
| | | | | See Note [Prevent unification with type families] in TcUnify for the details.
* Make equality print better. (#11712)Richard Eisenberg2016-03-211-16/+60
|
* Fix #11635 / #11719.Richard Eisenberg2016-03-211-16/+17
| | | | | | | | | | | Instead of creating a new meta-tyvar and then unifying it with a known kind in a KindedTyVar in a LHsQTyVars, just use the known kind. Sadly, this still doesn't make #11719 usable, because while you can now define a higher-kinded type family, you can't write any equations for it, which is a larger problem. test cases: dependent/should_compile/T{11635,11719}
* Add two small optimizations. (#11196)Richard Eisenberg2016-03-212-8/+14
| | | | | | | | | | | | | | | - Optimize zonking * to avoid allocation. - Try to avoid looking at the free variables of a type in the pure unifier. We need look at the variables only in the case of a forall. The performance results updates included in this also include a regression, but the regression is not due to this patch. When validating previous patches, the test case failed, but I was unable to reproduce outside of validation, so I let it go by, thinking the failure was spurious. Upon closer inspection, the perf number was right at the line, and the wibble between a valiation environment and a regular test run was enough to make the difference.
* TypeApplications does not imply AllowAmbiguousTypesRichard Eisenberg2016-03-211-1/+0
|
* Fix exponential algorithm in pure unifier.Richard Eisenberg2016-03-211-22/+30
|
* Remove unused substTyWithBinders functionsBartosz Nitka2016-03-213-26/+4
| | | | | | | | | | | | | | | | | Originally I wanted to only remove substTyWithBindersUnchecked, but since both of them are unused maybe we don't need them. Test Plan: ./validate Reviewers: austin, goldfire, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2025 GHC Trac Issues: #11371
* Remove unnecessary Ord instance for ConLikeBartosz Nitka2016-03-213-8/+4
| | | | | | | | | | | | | | | | | | The Ord instance for ConLike uses Unique order which is bad for determinism. Fortunately it's not used, so we can just delete it. The is part of the effort to make Unique comparisons explicit. Test Plan: ./validate Reviewers: austin, simonmar, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2018 GHC Trac Issues: #4012
* Delete a misleading comment in TyConBartosz Nitka2016-03-211-3/+0
| | | | | | | | | | | | | | | | | | | `Ord` for `TyCon` uses `Uniques` and it's not lexicographic. I did some archeology and in rGHC6c381e873e222417d9a67aeec77b9555eca7b7a8 the comment was introduced, where there was something like `Ord3 Tycon` which *was* lexicographic. In rGHC9dd6e1c216993624a2cd74b62ca0f0569c02c26b `Ord3 TyCon` was already not lexicographic and `Ord3` got removed. Test Plan: make someone take a look Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2017
* DsExpr: Don't build/foldr huge listsBen Gamari2016-03-201-1/+28
| | | | | | | | | | | | | | | | | Desugaring long lists with build trades large static data for large code, which is likely a poor trade-off. See #11707. Test Plan: Validate, nofib Reviewers: simonpj, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2007 GHC Trac Issues: #11707
* Dwarf: Add support for labels in unwind expressionsBen Gamari2016-03-203-1/+6
| | | | | | | | | | | | Test Plan: Look at DWARF output. Reviewers: scpmw, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1734
* PrelRules: Fix constant folding for WordRemOpBen Gamari2016-03-201-1/+6
| | | | | | | | | | | | | | Test Plan: Validate with testcase in D2002 Reviewers: austin, simonpj Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2004 GHC Trac Issues: #11702
* Fix #11512 by getting visibility right for methodsRichard Eisenberg2016-03-172-6/+18
| | | | Test case: typecheck/should_compile/T11512
* Fix #11716.Richard Eisenberg2016-03-176-12/+25
| | | | | | | | | | | There were several smallish bugs here: - We had too small an InScopeSet when rejigging GADT return types. - When adding the extra_tvs with a datatype kind signature, we were sometimes changing Uniques of an explicitly bound kind var. - Using coercionKind in the flattener got the wrong visibility for a binder. Now we just zonk to get what we need. Test case: dependent/should_compile/RaeJobTalk
* typechecker: fix trac issue #11708Csongor Kiss2016-03-171-2/+5
| | | | | | | | | | | | | | Summary: Fixes T11708 Reviewers: austin, bgamari, goldfire, simonpj Reviewed By: goldfire, simonpj Subscribers: simonpj, goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2006 GHC Trac Issues: #11708
* Fix #11711.Richard Eisenberg2016-03-173-5/+9
| | | | | | | | There were two bugs here, both simple: we need to filter out covars before calling isMetaTyVar in the solver, and TcPat had a tcSubType the wrong way round. test case: dependent/should_compile/T11711
* DriverPipeline: Fix 'unused arguments' warnings from ClangErik de Castro Lopo2016-03-171-8/+24
| | | | | | | | | | | | | | | | | | | When using Clang as the C compiler, over 100 tests were failing due to Clang reporting that some command line arguments were not being used. These warnings only occur when Clang is compiling assembler files which happens in two places, one of which already conditionally adding `-Qunused-arguments` to the command line when the compiler was Clang. This fixes the other. Test Plan: validate with clang as the C compiler Reviewers: bgamari, hvr, austin, rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1998 GHC Trac Issues: #11684
* Clean up some pretty-printing in errors.Richard Eisenberg2016-03-152-8/+21
| | | | | | | | | | | | | It turns out that there were some pretty egregious mistakes in the code that suggested -fprint-explicit-kinds, which are fixed. This commit also reorders a bunch of error messages, which I think is an improvement. This also adds the test case for #11471, which is what triggered the cleanup in TcErrors. Now that #11473 is done, there is nothing more outstanding for #11471. test case: dependent/should_fail/T11471
* Fix printing of "kind" vs. "type"Richard Eisenberg2016-03-151-9/+1
| | | | | | | This is as reported in #11471, though it's not the focus of that ticket. test case: polykinds/KindVType
* Fix #11473.Richard Eisenberg2016-03-151-7/+57
| | | | | | | | | | | | | | I've added a check in the zonker for representation polymorphism. I don't like having this be in the zonker, but I don't know where else to put it. It can't go in TcValidity, because a clever enough user could convince the solver to do bogus representation polymorphism even though there's nothing obviously wrong in what they wrote. Note that TcValidity doesn't run over *expressions*, which is where this problem arises. In any case, the check is simple and it works. test case: dependent/should_fail/T11473
* Fix #11357.Richard Eisenberg2016-03-152-11/+22
| | | | | | | | | We were looking at a data instance tycon for visibility info, which is the wrong place to look. Look at the data family tycon instead. Also improved the pretty-printing near there to suppress kind arguments when appropriate.
* Remove redundant anonymiseTyBinders (#11648)Richard Eisenberg2016-03-152-30/+2
| | | | | This was necessary in an earlier version of the patch for #11648, but not in the final version. I forgot to remove it.
* Allow eager unification with type families.Richard Eisenberg2016-03-141-70/+2
| | | | | | | | | | | | | | | | | | | | Previously, checkTauTvUpdate, used in the eager unifier (TcUnify) right before writing to a metavar, refused to write a metavar to a type involving type functions. The reason for this was given in a Note, but the Note didn't make all that much sense and even admitted that it was a bit confused. The Note, in turn, referred to another Note, which it was quite sceptical of, as well. The type-family check was slowing down performance, so I tried removing it, running the tests referred to in the Note. The tests all passed without the check. Looking at more test results, I saw several error messages improve without the check, and some cases where GHC looped (T7788, in particular) it now doesn't. So, all in all, quite a win: Two hairy Notes removed, several lines of code removed, better performance, and improved output. [skip ci]
* Fix #11648.Richard Eisenberg2016-03-1412-179/+335
| | | | | | | | | | | | We now check that a CUSK is really a CUSK and issue an error if it isn't. This also involves more solving and zonking in kcHsTyVarBndrs, which was the outright bug reported in #11648. Test cases: polykinds/T11648{,b} This updates the haddock submodule. [skip ci]
* Expand Note [Non-trivial definitional equality]Richard Eisenberg2016-03-141-0/+52
| | | | | | This adapts the text from D1944. [skip ci]
* Refactor visible type application.Richard Eisenberg2016-03-1411-133/+147
| | | | | | | | | | | | | This replaces the old HsType and HsTypeOut constructors with HsAppType and HsAppTypeOut, leading to some simplification. (This refactoring addresses #11329.) This also fixes #11456, which stumbled over HsType (which is not an expression). test case: ghci/scripts/T11456 [skip ci]
* Fix #11401.Richard Eisenberg2016-03-141-24/+16
| | | | | | This commit teaches shortCutReduction about Derived constraints. [skip ci]
* Fix #11334.Richard Eisenberg2016-03-142-4/+36
| | | | | | | | | Now we fail when trying to default non-*-kinded kind variables with -XNoPolyKinds. test case: dependent/should_fail/T11334 [skip ci]
* Fix #11407.Richard Eisenberg2016-03-145-48/+51
| | | | | | | | | | | | | | This removes the `defer_me` check that was in checkTauTvUpdate and uses only a type family check instead. The old defer_me check repeated work done by fast_check in occurCheckExpand. There is also some error message improvement, necessitated by the terrible error message that the test case produced, even when it didn't consume all of memory. test case: dependent/should_fail/T11407 [skip ci]
* Fix the name of the Word16ElemRep wired-in dataconmniip2016-03-141-1/+1
| | | | | | | | | | Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1999
* LlvmCodeGen: Fix generation of malformed LLVM blocksErik de Castro Lopo2016-03-121-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 673efccb3b uncovered a bug in LLVM code generation that produced LLVM code that the LLVM compiler refused to compile: { clpH: br label %clpH } This may well be a bug in LLVM itself. The solution is to keep the existing entry label and rewrite the function as: { clpH: br label %nPV nPV: br label %nPV } Thanks to Ben Gamari for pointing me in the right direction on this one. Test Plan: Build GHC with BuildFlavour=quick-llvm Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1996 GHC Trac Issues: #11649
* Simplify: Make generated names more usefulBen Gamari2016-03-121-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | makeTrivial is responsible for concocting names during simplification. Previously, however, it would make no attempt to generate a name that might be useful to later readers of the resulting Core. Here we add a bit of state to SimplEnv: a finite depth stack of binders within which we are currently simplifying. We then derive generated binders from this context. See #11676. Open questions: * Is there a better way to accomplish this? * Is `maxContextDepth` too large/small? Test Plan: Validate, look at Core. Reviewers: austin, simonpj Reviewed By: simonpj Subscribers: thomie, simonpj Differential Revision: https://phabricator.haskell.org/D1970 GHC Trac Issues: #11676
* Add -foptimal-applicative-doSimon Marlow2016-03-112-76/+152
| | | | | | | | | | | | | | | | | | | | Summary: The algorithm for ApplicativeDo rearrangement is based on a heuristic that runs in O(n^2). This patch adds the optimal algorithm, which is O(n^3), selected by a flag (-foptimal-applicative-do). It finds better solutions in a small number of cases (about 2% of the cases where ApplicativeDo makes a difference), but it can be very slow for large do expressions. I'm mainly adding it for experimental reasons. ToDo: user guide docs Test Plan: validate Reviewers: simonpj, bgamari, austin, niteria, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1969
* Move getOccFS to NameBen Gamari2016-03-112-11/+10
|