summaryrefslogtreecommitdiff
path: root/libraries/base/tests
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Data.List specialization to []"Matthew Pickering2021-12-032-3/+1
| | | | | | | | | | This reverts commit bddecda1a4c96da21e3f5211743ce5e4c78793a2. This implements the first step in the plan formulated in #20025 to improve the communication and migration strategy for the proposed changes to Data.List. Requires changing the haddock submodule to update the test output.
* Make openFile more tolerant of async excs (#18832)Kamil Dworakowski2021-12-023-0/+79
|
* Remove record field from SoloSimon Peyton Jones2021-11-052-10/+0
| | | | | | | | | | | | | | Ticket #20562 revealed that Solo, which is a wired-in TyCon, had a record field that wasn't being added to the type env. Why not? Because wired-in TyCons don't have record fields. It's not hard to change that, but it's tiresome for this one use-case, and it seems easier simply to make `getSolo` into a standalone function. On the way I refactored the handling of Solo slightly, to put it into wiredInTyCons (where it belongs) rather than only in knownKeyNames
* base: Update Unicode database to 14.0Ben Gamari2021-10-031-59/+59
| | | | Closes #20404.
* Add a regression test for #17912Kamil Dworakowski2021-09-293-0/+36
|
* testsuite: Add test for #18382Ben Gamari2021-09-173-0/+16
|
* testsuite: Mark hDuplicateTo001 as fragile in concurrent waysBen Gamari2021-09-131-2/+1
| | | | As noted in #17568.
* Export Solo from Data.TupleDavid Feuer2021-08-273-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | * The `Solo` type is intended to be the canonical lifted unary tuple. Up until now, it has only been available from `GHC.Tuple` in `ghc-prim`. Export it from `Data.Tuple` in `base`. I proposed this on the libraries list in December, 2020. https://mail.haskell.org/pipermail/libraries/2020-December/031061.html Responses from chessai https://mail.haskell.org/pipermail/libraries/2020-December/031062.html and George Wilson https://mail.haskell.org/pipermail/libraries/2021-January/031077.html were positive. There were no other responses. * Add Haddock documentation for Solo. * Give `Solo` a single field, `getSolo`, a custom `Show` instance that does *not* use record syntax, and a `Read` instance that accepts either record syntax or non-record syntax.
* Check the buffer size *before* calling the continuation in withEncodedCStringMatthew Pickering2021-07-232-0/+12
| | | | | | | | | | | | | | | | | | | | This fixes a very subtle bug in withEncodedCString where a reference would be kept to the whole continuation until the continuation had finished executing. This was because the call to tryFillBufferAndCall could fail, if the buffer was already full and so the `go` helper would be recursively called on failure which necessitated keeping a reference to `act`. The failure could only happen during the initial checking phase of the function but not during the call to the continuation. Therefore the fix is to first perform the size check, potentially recursively and then finally calling tail calling the continuation. In the real world, this broke writing lazy bytestrings because a reference to the head of the bytestring would be retained in the continuation until the whole string had been written to a file. Fixes #20107
* base: Update Unicode data to 13.0.0Ben Gamari2021-05-111-13/+13
| | | | (cherry picked from commit d22e087f7bf74341c4468f11b4eb0273033ca931)
* Use correct precedence in Complex's Read1/Show1 instancesRyan Scott2021-04-183-0/+43
| | | | Fixes #19719.
* Data.List specialization to []Oleg Grenrus2021-04-012-1/+3
| | | | | | | - Remove GHC.OldList - Remove Data.OldList - compat-unqualified-imports is no-op - update haddock submodule
* [ci] Skip test's on windows that often fail in CI.wip/angerman/stable-windowsMoritz Angermann2021-03-161-1/+2
|
* Use GHC2021 as default languageJoachim Breitner2021-03-105-15/+24
|
* Implement BoxedRep proposalwip/boxed-repBen Gamari2021-03-072-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This implements the BoxedRep proposal, refactoring the `RuntimeRep` hierarchy from: ```haskell data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ... ``` to ```haskell data RuntimeRep = BoxedRep Levity | ... data Levity = Lifted | Unlifted ``` Updates binary, haddock submodules. Closes #17526. Metric Increase: T12545
* Fix typosBrian Wignall2021-02-062-2/+2
|
* Fix accidental unsoundness in Data.Typeable.Internal.mkTypeLitFromStringRyan Scott2021-02-013-0/+35
| | | | | | | | | An accidental use of `tcSymbol` instead of `tcNat` in the `TypeLitNat` case of `mkTypeLitFromString` meant that it was possible to unsafely equate `Nat` with `Symbol`. A consequence of this is that you could write `unsafeCoerce`, as observed in #19288. This is fixed easily enough, thankfully. Fixes #19288.
* base: add Numeric.{readBin, showBin} (fix #19036)Artem Pelenitsyn2021-01-024-11/+10
|
* Revert "Implement BoxedRep proposal"Ben Gamari2020-12-152-3/+3
| | | | | | This was inadvertently merged. This reverts commit 6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea.
* Implement BoxedRep proposalAndrew Martin2020-12-142-3/+3
| | | | | | | | | | | | | | | | | | This implements the BoxedRep proposal, refacoring the `RuntimeRep` hierarchy from: ```haskell data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ... ``` to ```haskell data RuntimeRep = BoxedRep Levity | ... data Levity = Lifted | Unlifted ``` Closes #17526.
* Fix a leak in `transpose`Hécate2020-11-013-0/+31
| | | | This patch was authored by David Feuer <david.feuer@gmail.com>
* winio: fixed bytestring reading interface.Tamar Christina2020-10-093-0/+35
|
* Add linting of `base` to the CIHécate2020-10-091-1/+4
|
* Remove redundant "do", "return" and language extensions from baseHécate2020-09-2315-27/+25
|
* testsuite: Mark tempfiles as broken on Win32 without WinIOGHC GitLab CI2020-09-201-1/+4
| | | | The old POSIX emulation appears to ignore the user-requested prefix.
* base/testsuite: Add missing LANGUAGE pragma in ThreadDelay001Ben Gamari2020-09-201-0/+1
| | | | Only affected the Windows codepath.
* Add testsSandy Maguire2020-09-123-0/+41
|
* Remove all the unnecessary LANGUAGE pragmasHécate2020-08-057-10/+13
|
* Bignum: add backward compat integer-gmp functionsSylvain Henry2020-08-052-5/+13
| | | | Also enhance bigNatCheck# and isValidNatural test
* testsuite: Normalise WinIO error message differencesBen Gamari2020-07-261-3/+3
| | | | | Previously the old Windows IO manager threw different errors than WinIO. We now canonicalise these to the WinIO errors.
* Define type Void# = (# #) (#18441)Krzysztof Gogolewski2020-07-221-2/+2
| | | | | There's one backwards compatibility issue: GHC.Prim no longer exports Void#, we now manually re-export it from GHC.Exts.
* Implement `fullCompilerVersion`Hécate2020-07-183-0/+15
| | | | | | | | Follow-up of https://gitlab.haskell.org/ghc/ghc/-/issues/18403 This MR adds `fullCompilerVersion`, a function that shares the same backend as the `--numeric-version` GHC flag, exposing a full, three-digit version datatype.
* winio: fix tempfiles test on linuxAndreas Klebinger2020-07-151-1/+1
|
* winio: Accept T9681 output.Andreas Klebinger2020-07-151-2/+2
| | | | GHC now reports String instead of [Char].
* winio: Fix openFile009 merge conflict leftoverAndreas Klebinger2020-07-151-4/+0
|
* winio: Fix ThreadDelay001 CPPAndreas Klebinger2020-07-151-1/+1
|
* winio: Update T9681 output, disable T4808 on windows.Andreas Klebinger2020-07-152-4/+4
| | | | | | | T4808 tests functionality of the FD interface which won't be supported under WINIO. T9681 just has it's expected output tweaked.
* winio: ThreadDelay001: Use higher resolution timer.Andreas Klebinger2020-07-151-4/+21
|
* winio: Fix expected tempfiles output.Andreas Klebinger2020-07-152-13/+1
| | | | | Tempfiles now works properly on windows, as such we can delete the win32 specific output.
* winio: Update output of T9681 since we now actually run it.Andreas Klebinger2020-07-151-2/+5
|
* winio: Fix sqrt and openFile009 test casesAndreas Klebinger2020-07-153-5/+9
|
* winio: Set handle offset when opening files in Append mode.Andreas Klebinger2020-07-153-0/+22
| | | | Otherwise we would truncate the file.
* winio: Switch Testsuite to test winio by defaultTamar Christina2020-07-155-16/+29
|
* BigNum: rename BigNat typesSylvain Henry2020-07-072-2/+2
| | | | | | | | | | | | | | | Before this patch BigNat names were confusing because we had: * GHC.Num.BigNat.BigNat: unlifted type used everywhere else * GHC.Num.BigNat.BigNatW: lifted type only used to share static constants * GHC.Natural.BigNat: lifted type only used for backward compatibility After this patch we have: * GHC.Num.BigNat.BigNat#: unlifted type * GHC.Num.BigNat.BigNat: lifted type (reexported from GHC.Natural) Thanks to @RyanGlScott for spotting this.
* Add missing Ix instances for tuples of size 6 through 15 (#16643)Joshua Price2020-06-303-0/+25
|
* Update testsuiteSylvain Henry2020-06-171-3/+1
| | | | | | | | | | | | | | * support detection of slow ghc-bignum backend (to replace the detection of integer-simple use). There are still some test cases that the native backend doesn't handle efficiently enough. * remove tests for GMP only functions that have been removed from ghc-bignum * fix test results showing dependent packages (e.g. integer-gmp) or showing suggested instances * fix test using Integer/Natural API or showing internal names
* Update `base` packageSylvain Henry2020-06-172-6/+7
| | | | | | | | | | | | | | | * GHC.Natural isn't implemented in `base` anymore. It is provided by ghc-bignum in GHC.Num.Natural. It means that we can safely use Natural primitives in `base` without fearing issues with built-in rewrite rules (cf #15286) * `base` doesn't conditionally depend on an integer-* package anymore, it depends on ghc-bignum * Some duplicated code in integer-* can now be factored in GHC.Float * ghc-bignum tries to use a uniform naming convention so most of the other changes are renaming
* Simple subsumptionwip/T17775Simon Peyton Jones2020-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch simplifies GHC to use simple subsumption. Ticket #17775 Implements GHC proposal #287 https://github.com/ghc-proposals/ghc-proposals/blob/master/ proposals/0287-simplify-subsumption.rst All the motivation is described there; I will not repeat it here. The implementation payload: * tcSubType and friends become noticably simpler, because it no longer uses eta-expansion when checking subsumption. * No deeplyInstantiate or deeplySkolemise That in turn means that some tests fail, by design; they can all be fixed by eta expansion. There is a list of such changes below. Implementing the patch led me into a variety of sticky corners, so the patch includes several othe changes, some quite significant: * I made String wired-in, so that "foo" :: String rather than "foo" :: [Char] This improves error messages, and fixes #15679 * The pattern match checker relies on knowing about in-scope equality constraints, andd adds them to the desugarer's environment using addTyCsDs. But the co_fn in a FunBind was missed, and for some reason simple-subsumption ends up with dictionaries there. So I added a call to addTyCsDs. This is really part of #18049. * I moved the ic_telescope field out of Implication and into ForAllSkol instead. This is a nice win; just expresses the code much better. * There was a bug in GHC.Tc.TyCl.Instance.tcDataFamInstHeader. We called checkDataKindSig inside tc_kind_sig, /before/ solveEqualities and zonking. Obviously wrong, easily fixed. * solveLocalEqualitiesX: there was a whole mess in here, around failing fast enough. I discovered a bad latent bug where we could successfully kind-check a type signature, and use it, but have unsolved constraints that could fill in coercion holes in that signature -- aargh. It's all explained in Note [Failure in local type signatures] in GHC.Tc.Solver. Much better now. * I fixed a serious bug in anonymous type holes. IN f :: Int -> (forall a. a -> _) -> Int that "_" should be a unification variable at the /outer/ level; it cannot be instantiated to 'a'. This was plain wrong. New fields mode_lvl and mode_holes in TcTyMode, and auxiliary data type GHC.Tc.Gen.HsType.HoleMode. This fixes #16292, but makes no progress towards the more ambitious #16082 * I got sucked into an enormous refactoring of the reporting of equality errors in GHC.Tc.Errors, especially in mkEqErr1 mkTyVarEqErr misMatchMsg misMatchMsgOrCND In particular, the very tricky mkExpectedActualMsg function is gone. It took me a full day. But the result is far easier to understand. (Still not easy!) This led to various minor improvements in error output, and an enormous number of test-case error wibbles. One particular point: for occurs-check errors I now just say Can't match 'a' against '[a]' rather than using the intimidating language of "occurs check". * Pretty-printing AbsBinds Tests review * Eta expansions T11305: one eta expansion T12082: one eta expansion (undefined) T13585a: one eta expansion T3102: one eta expansion T3692: two eta expansions (tricky) T2239: two eta expansions T16473: one eta determ004: two eta expansions (undefined) annfail06: two eta (undefined) T17923: four eta expansions (a strange program indeed!) tcrun035: one eta expansion * Ambiguity check at higher rank. Now that we have simple subsumption, a type like f :: (forall a. Eq a => Int) -> Int is no longer ambiguous, because we could write g :: (forall a. Eq a => Int) -> Int g = f and it'd typecheck just fine. But f's type is a bit suspicious, and we might want to consider making the ambiguity check do a check on each sub-term. Meanwhile, these tests are accepted, whereas they were previously rejected as ambiguous: T7220a T15438 T10503 T9222 * Some more interesting error message wibbles T13381: Fine: one error (Int ~ Exp Int) rather than two (Int ~ Exp Int, Exp Int ~ Int) T9834: Small change in error (improvement) T10619: Improved T2414: Small change, due to order of unification, fine T2534: A very simple case in which a change of unification order means we get tow unsolved constraints instead of one tc211: bizarre impredicative tests; just accept this for now Updates Cabal and haddock submodules. Metric Increase: T12150 T12234 T5837 haddock.base Metric Decrease: haddock.compiler haddock.Cabal haddock.base Merge note: This appears to break the `UnliftedNewtypesDifficultUnification` test. It has been marked as broken in the interest of merging. (cherry picked from commit 66b7b195cb3dce93ed5078b80bf568efae904cc5)
* Fix "build/elem" RULE.Andreas Klebinger2020-05-294-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | An redundant constraint prevented the rule from matching. Fixing this allows a call to elem on a known list to be translated into a series of equality checks, and eventually a simple case expression. Surprisingly this seems to regress elem for strings. To avoid this we now also allow foldrCString to inline and add an UTF8 variant. This results in elem being compiled to a tight non-allocating loop over the primitive string literal which performs a linear search. In the process this commit adds UTF8 variants for some of the functions in GHC.CString. This is required to make this work for both ASCII and UTF8 strings. There are also small tweaks to the CString related rules. We now allow ourselfes the luxury to compare the folding function via eqExpr, which helps to ensure the rule fires before we inline foldrCString*. Together with a few changes to allow matching on both the UTF8 and ASCII variants of the CString functions.
* Do eager instantation in termsSimon Peyton Jones2020-04-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements eager instantiation, a small but critical change to the type inference engine, #17173. The main change is this: When inferring types, always return an instantiated type (for now, deeply instantiated; in future shallowly instantiated) There is more discussion in https://www.tweag.io/posts/2020-04-02-lazy-eager-instantiation.html There is quite a bit of refactoring in this patch: * The ir_inst field of GHC.Tc.Utils.TcType.InferResultk has entirely gone. So tcInferInst and tcInferNoInst have collapsed into tcInfer. * Type inference of applications, via tcInferApp and tcInferAppHead, are substantially refactored, preparing the way for Quick Look impredicativity. * New pure function GHC.Tc.Gen.Expr.collectHsArgs and applyHsArgs are beatifully dual. We can see the zipper! * GHC.Tc.Gen.Expr.tcArgs is now much nicer; no longer needs to return a wrapper * In HsExpr, HsTypeApp now contains the the actual type argument, and is used in desugaring, rather than putting it in a mysterious wrapper. * I struggled a bit with good error reporting in Unify.matchActualFunTysPart. It's a little bit simpler than before, but still not great. Some smaller things * Rename tcPolyExpr --> tcCheckExpr tcMonoExpr --> tcLExpr * tcPatSig moves from GHC.Tc.Gen.HsType to GHC.Tc.Gen.Pat Metric Decrease: T9961 Reduction of 1.6% in comiler allocation on T9961, I think.