From git at git.haskell.org Thu Sep 1 14:02:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 14:02:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Tag pointers in interpreted constructors (062b462) Message-ID: <20160901140211.C1CC73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/062b462ba88a493fa12377a11960e8bed2f56781/ghc >--------------------------------------------------------------- commit 062b462ba88a493fa12377a11960e8bed2f56781 Author: mniip Date: Tue Aug 30 16:57:47 2016 -0400 Tag pointers in interpreted constructors Instead of stg_interp_constr_entry there are now 7 functions (one for each value of the tag bits) that tag the constructor pointer before returning. This is consistent with compiled constructors' entry code, and expectations that compiled code places on compiled constructors. The iserv protocol is extended with an extra field that explains what pointer tag the constructor should use. Test Plan: Added tests for #12523 Reviewers: erikd, bgamari, hvr, austin, simonmar Reviewed By: simonmar Subscribers: osa1, thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D2473 GHC Trac Issues: #12523 (cherry picked from commit a25bf2673d0f6db5f454619ddf91f974cace4e8b) >--------------------------------------------------------------- 062b462ba88a493fa12377a11960e8bed2f56781 compiler/ghci/ByteCodeItbls.hs | 4 +++- includes/stg/MiscClosures.h | 8 +++++++- libraries/ghci/GHCi/InfoTable.hsc | 24 ++++++++++++++++++++---- libraries/ghci/GHCi/Message.hs | 5 +++-- libraries/ghci/GHCi/Run.hs | 4 ++-- rts/RtsSymbols.c | 8 +++++++- rts/StgMiscClosures.cmm | 13 ++++++++----- testsuite/tests/ghci/scripts/T12523.hs | 28 ++++++++++++++++++++++++++++ testsuite/tests/ghci/scripts/T12523.script | 18 ++++++++++++++++++ testsuite/tests/ghci/scripts/T12523.stdout | 8 ++++++++ testsuite/tests/ghci/scripts/all.T | 1 + 11 files changed, 105 insertions(+), 16 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 062b462ba88a493fa12377a11960e8bed2f56781 From git at git.haskell.org Thu Sep 1 14:02:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 14:02:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: GHC: Expose installSignalHandlers, withCleanupSession (aedb412) Message-ID: <20160901140214.8E6833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/aedb41292d042963ad281641f85c26e5c9ea4d4d/ghc >--------------------------------------------------------------- commit aedb41292d042963ad281641f85c26e5c9ea4d4d Author: Ben Gamari Date: Tue Aug 30 17:05:43 2016 -0400 GHC: Expose installSignalHandlers, withCleanupSession Test Plan: Validate Reviewers: austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2492 GHC Trac Issues: #12398 (cherry picked from commit 0e7492508cefbcabb4cf1398cfb3669edb72db77) >--------------------------------------------------------------- aedb41292d042963ad281641f85c26e5c9ea4d4d compiler/main/GHC.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index ee13976..0a7f6f0 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -13,6 +13,8 @@ module GHC ( defaultErrorHandler, defaultCleanupHandler, prettyPrintGhcErrors, + installSignalHandlers, + withCleanupSession, -- * GHC Monad Ghc, GhcT, GhcMonad(..), HscEnv, @@ -438,6 +440,7 @@ runGhc mb_top_dir ghc = do ref <- newIORef (panic "empty session") let session = Session ref flip unGhc session $ do + liftIO installSignalHandlers -- catch ^C initGhcMonad mb_top_dir withCleanupSession ghc @@ -462,6 +465,7 @@ runGhcT mb_top_dir ghct = do ref <- liftIO $ newIORef (panic "empty session") let session = Session ref flip unGhcT session $ do + liftIO installSignalHandlers -- catch ^C initGhcMonad mb_top_dir withCleanupSession ghct @@ -496,8 +500,7 @@ withCleanupSession ghc = ghc `gfinally` cleanup initGhcMonad :: GhcMonad m => Maybe FilePath -> m () initGhcMonad mb_top_dir = do { env <- liftIO $ - do { installSignalHandlers -- catch ^C - ; initStaticOpts + do { initStaticOpts ; mySettings <- initSysTools mb_top_dir ; dflags <- initDynFlags (defaultDynFlags mySettings) ; checkBrokenTablesNextToCode dflags From git at git.haskell.org Thu Sep 1 14:31:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 14:31:26 +0000 (UTC) Subject: [commit: ghc] wip/T5642's head updated: LoadIFace: Show known names on inconsistent interface file (dad6a88) Message-ID: <20160901143126.F0DEA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T5642' now includes: 886f4c1 Better comment for orIfNotFound. f91d87d Failing test-case for #12135. 3042a9d Use UniqDFM for HomePackageTable 48e9a1f Implement deterministic CallInfoSet a90085b Add @since annotations to base instances e684f54 Desugar ApplicativeDo and RecDo deterministically 31ba8d6 Kill nameSetElems 46d2da0 Document putDictionary determinism 3e7a876 Kill foldUniqSet 1937ef1 Make UnitIdMap a deterministic map a13cb27 Merge MatchFixity and HsMatchContext 77ccdf3 Kill occSetElts 7fea712 Use a deterministic map for imp_dep_mods d05dee3 CoreToStg: Remove hand-written Eq instances of HowBound and LetInfo 4426c5f Kill two instances of uniqSetToList 0d6f428 Fix build by removing unused import c148212 Kill varSetElems in checkValidInferredKinds ad8e203 Use DVarSet in Vectorise.Exp 3b698e8 Document determinism in pprintClosureCommand 5db93d2 Make vectInfoParallelVars a DVarSet 7008515 Kill varSetElems 7d58a97 Use pprUFM in pprStgLVs 00e3a5d Typofix. 4d5b2f6 Testsuite driver: always quote opts.testdir f5f5a8a Testsuite Windows: mark T8308 expect_broken (#8308) d4b548e Add some determinism tests dd33245 Desugar: Display resulting program stats with -v2 44a3c18 Revert "Desugar: Display resulting program stats with -v2" c2bbc8b Report term sizes with -v3 even when -ddump is enabled 80cf4cf Literal: Remove unused hashLiteral function d7933cb Show sources of cost centers in .prof 8f6d292 Fix #12064 by making IfaceClass typechecking more lazy. acb9e85 Minor performance note about IdInfo. 11ff1df Fix #12076 by inlining trivial expressions in CorePrep. 48385cb Remove special casing of Windows in generic files ceaf7f1 Implement Eq TyCon directly 68c1c29 Remove Ord (CoAxiom br) 9dbf354 Testsuite: delete dead code [skip ci] e703a23 Docs: fix links to ghc-flags 70e0a56 Remove Ord Class b2624ee Remove Ord PatSyn 77b8c29 Remove Ord AltCon c22ab1a Docs: delete PatternGuards documentation b020db2 Fix Ticky histogram on Windows e9dfb6e Improve the error messages for static forms. b0a7664 prettyPrintClosure(): Untag the closure before accessing fields 47d8173 Remove Printer.c:prettyPrintClosure() bcb419a Fix #12099: Remove bogus flags 6adff01 Comments only 6905ce2 Refine imports slightly 0f0b002 Comments only 3ae18df Minor refactoring b9fa72a Small refactor to mkRuntimErrorId 9e5ea67 NUMA support c88f31a Rts flags cleanup 5990016 ModuleSet: Use an actual set instead of map to units 6ace660 rts: Fix build when USE_LARGE_ADDRESS_SPACE is undefined 9130867 Skip retc001 on OSX b40e1b4 Fix incorrect calculated relocations on Windows x86_64 29e1464 Disable T12031 on linux 2bb6ba6 rts: Fix NUMA when cross compiling d25cb61 Kill off redundant SigTv check in occurCheckExpand 15b9bf4 Improve typechecking of let-bindings c28dde3 Tidy up zonkQuantifiedTyVar 7afb7ad Get in-scope set right in top_instantiate 35c9de7 Move the constraint-kind validity check 1f66128 Beef up mkNakedCastTy 15fc528 Fix the in-scope set for extendTvSubstWithClone 599d912 Beef up isPredTy 8104f7c Remove some traceTc calls e064f50 Add to .gitignore 921ebc9 Test Trac #12055 1dcb32d A second test for Trac #12055 5cee88d Add thin library support to Windows too 7de776c Kill unused foldModuleEnv 586d558 Use UniqFM for SigOf 0497ee5 Make the Ord Module independent of Unique order d55a9b4 Update Haddock to follow change in LHsSigWcType 4f35646 Adjust error message slightly 8dfd4ae Build system: mention ghc version in bindist's `configure --help` docdir a2deee0 Testsuite: enable ghci.prog010 (#2542) 23b73c9 Don't GC sparks for CAFs 9d22fbe Rename cmpType to nonDetCmpType 753c5b2 Simplify readProcessEnvWithExitCode + set LANGUAGE=C 70a4589 Revert "Make the Ord Module independent of Unique order" e33ca0e Fix testsuite wibble 77bb092 Re-add FunTy (big patch) e368f32 Major patch to introduce TyConBinder c56f8bd CoreMonad: Update error msg function docs 930a525 Abort the build when a Core plugin pass is specified in stage1 compiler a7f65b8 Remove dead code: countOnce, countMany 498ed26 NUMA cleanups 8d33af9 CoreLint: Slightly improve case type annotation error msgs 3e8c495 CmmNode: Make CmmTickScope's Unique strict 2396d9b llvmGen: Make metadata ids a newtype 85e09b1 llvmGen: Consolidate MetaExpr pretty-printing 9bb0578 Revert accidental submodule updates e02beb1 Driver: `ghc ../Test` (without file extension) should work f72f23f Testsuite: run tests in .run instead of /tmp 6f6f515 Testsuite: write "\n" instead of "\r\n" when using mingw Python d94c405 Testsuite: validate the tests/stage1 directory with the stage1 compiler a4c8532 Validate: use `rm -f` instead of `rm` 6354991 VarEnv: Comment only 270d545 Add Bifoldable and Bitraversable to base 9649fc0 Refactor derived Generic instances to reduce allocations 4d71cc8 Avoid find_tycon panic if datacon is not in scope f12fb8a Fix trac #10647: Notice about lack of SIMD support 2897be7 PPC NCG: Fix float parameter passing on 64-bit. f4b0488 PPC NCG: Fix and refactor TOC handling. 0be38a2 llvmGen: Add strictness to metadata fields 0e92af9 Remove use of KProxy in GHC.Generics 0ba34b6 ApplicativeDo: allow "return $ e" e7e42c8 Fix double-free in T5644 (#12208) cdc14b4 Testsuite: remove Windows CR again.. [skip ci] 9cdde38 Testsuite: remove Windows CR [skip ci] cf6e656 Testsuite: remove Windows CR [skip ci] 3dc1202 Testsuite: tabs -> spaces [skip ci] 7e7094f Testsuite: tabs -> spaces [skip ci] 46ff80f Testsuite: tabs -> spaces [skip ci] 915e07c Testsuite: tabs -> spaces [skip ci] 5b03dc6 Testsuite: tabs -> spaces [skip ci] a7160fa Testsuite: tabs -> spaces [skip ci] 4a4bdda Testsuite: recover from utf8 decoding errors 6d0a4fc Testsuite: fix WAY=ghci when LOCAL=0 1ddc10b Testsuite: *do* replace backslashes in config.libdir 1d938aa Testsuite: mark tests expect broken 3b49f8f Testsuite: remove `-fforce-recomp` from default flags (#11980) 82f7f18 Testsuite: delete TEST_HC_OPTS_NO_RECOMP 135fc86 Testsuite: remove `-Wno-warn-tabs` from default flags ebaf26b Testsuite: delete dead code + cleanup e170d19 Testsuite: assume timeout_prog always exists ee3bde7 Expand and clarify the docs for ApplicativeDo (#11835) 7301404 Typos in comments d09e982 Don't quantify over Refl in a RULE 97a50f8 Delete commented-out code 1230629 Make checkFamInstConsistency less expensive a47b62c Second attempt to fix sizeExpr c0583a9 Fix build breakage due to rebase 9d62d09 Hopefully fix all the rebase-induced breakage 4e7d835 Typos in comments [skip ci] 6199588 More typos in comments [skip ci] 93f40cb Don't error on GCC inlining warning in rts 348f2db Make the Ord Module independent of Unique order (2nd try) 15641b0 Accept new (lower) allocations for T7257 7e7aeab Comments only cc92a44 Improve error message in deriving( Functor ) a1b3359 Remove unused arg to tcSuperClasses ce97b72 Expand given superclasses more eagerly 210a2e1 Test Trac #12163 3e0af46 Give lookupGRE_Name a better API e556f76 Remove unused import 643706e Narrow the warning for simplifiable constraints 2f8cd14 Narrow the use of record wildcards slightly 7fc20b0 Have Core linter accept programs using StaticPointers and -fhpc. 35d1564 Provide Uniquable version of SCC bb74021 Remove Ord TyCon 7f5d560 Very confusing typo in error message. 9a34bf1 Fix #11974 by adding a more smarts to TcDefaults. 8035d1a Fix #10963 and #11975 by adding new cmds to GHCi. 4ae950f Release notes for #11975 and #10963 df9611e Testsuite: do not copy .hi/.o files to testdir (#12112) d2958bd Improve typechecking of instance defaults c871ce4 Comments around invisibility 393928d Fix renamer panic f86a337 Remove bogus comment on ForAllTy bb84ee4 Improve pretty-printing of Avail 12c4449 Implement ReifyConStrictness for -fexternal-interpreter (#12219) d2006d0 Run all TH tests with -fexternal-interpreter (#12219) bdb0d24 Remote GHCi: separate out message types eb73219 Remote GHCi: comments only 0bab375 Fix T8761 (#12219, #12077) dadd8b8 Test Trac #12229 9bc2233 Fix typo in Data.Bitraverse Haddocks 31b5806 Clean up outdated comments in template-haskell changelog a33b498 Add template-haskell changelog note for #8761 5fdb854 s/Invisible/Inferred/g s/Visible/Required/g 4cc5a39 Refactor tcInferArgs and add comments. 8c1cedd Allow building static libs. da60e3e rts/Linker.c: Improve ugly C pre-processor hack 7843c71 Make T8761 deterministic, I hope ff1cc26 Don't run the run_command tests with ext-interp 82282e8 Remove some `undefined`s 60c24b2 Typos in user manual and code: recurisve -> recursive afa6e83 rts/Linker.c: Rename ONLY_USED_x86_64_HOST_ARCH macro bbf0aa2 Testsuite: never pick up .T files in .run directories 7593c2f Testsuite: report duplicate testnames when `make TEST=` 1f45bce Testsuite: remove one level of indentation [skip ci] 206b4a1 Testsuite: simplify extra_file handling bafd615 Testsuite: do not print timeout message 58f0086 Testsuite: open/close stdin/stdout/stderr explicitly d8e9b87 Testsuite: cleanup printing of summary 782cacf Testsuite: framework failure improvements (#11165) 6b3b631 Testsuite: run all indexed-types ways on ./validate --slow 0eb0378 Testsuite: do not add -debug explicitly in .T file 3fb9837 Testsuite: mark tests expect_broken af21e38 Don't omit any evidence bindings 23b80ac Deal correctly with unused imports for 'coerce' dc62a22 Wibble error message for #11471 dd92c67 Stop the simplifier from removing StaticPtr binds. 2e9079f Test Trac #12185 848e3ce Testsuite: fixes for python2.6 support 9a645a1 Refactor match to not use Unique order 8f7194f Double the file descriptor limit for openFile008 1084d37 Testsuite: use ignore_stderr/stdout instead of ignore_output 24194a6 Fix pretty-printer for IfaceCo e8d6271 Testsuite: do not depend on sys.stdout.encoding fb6e2c7 Delete Ord Unique 9854f14 Add a new determinism test b6b20a5 Reorganize some determinism tests 480e066 Remove ufmToList b8b3e30 Axe RecFlag on TyCons. 0701db1 Updates to handle new Cabal 430f5c8 Trac #11554 fix loopy GADTs 6a5d13c nativeGen: Allow -fregs-graph to be used f68d40c ghc-pkg: Drop trailing slashes in computing db paths f1e16e9 CmmExpr: remove unused `vgcFlag` function b65363d Fix check_uniques in non-unicode locale 0afc41b Testsuite: be less strict about topHandler03's stderr c27ce26 users-guide: Fix markup in release notes 81b437b Add NamedThing (GenLocated l e) instance b412d82 Allow one type signature for multiple pattern synonyms 6ba4197 rules/sphinx.mk: stop xelatex on error ee8d1fa Remove unused oc->isImportLib (#12230) 6377757 Linker: some extra debugging / logging cbfeff4 Remove uniqSetToList 0d522b8 Document some benign nondeterminism 0ab63cf Kill varEnvElts in seqDmdEnv 01f449f Fix 32-bit build failures 9031382 MkCore: Fix some note names a6819a0 base: Add release date to changelog bf7cbe7 users-guide: Note multiple pattern signature change in relnotes afec447 testsuite: Add testcase for #12355 2a3af15 Treat duplicate pattern synonym signatures as an error 3b2deca users-guide: Remove static field type from rts-flag 331febf CallArity: Use not . null instead of length > 0 0bd7c4b Enum: Ensure that operations on Word fuse 18e71e4 Revert "Fix 32-bit build failures" 890ec98 Revert "Linker: some extra debugging / logging" e10497b Kill some varEnvElts 85aa6ef Check generic-default method for ambiguity 1267048 Extra ASSERTs for nameModule 55e43a6 Use DVarEnv for vectInfoVar 5f79394 Delete out-of-date comment 895eefa Make unique auxiliary function names in deriving cbe30fd Tidy up tidying f2d36ea White space only 6cedef0 Test Trac #12133 27fc75b Document codegen nondeterminism 18b782e Kill varEnvElts in zonkEnvIds 1b058d4 Remove varEnvElts b7b130c Fix GetTime.c on Darwin with clock_gettime f560a03 Adds x86_64-apple-darwin14 target. 567dbd9 Have addModFinalizer expose the local type environment. 56f47d4 Mention addModFinalizer changes in release notes. 672314c Switch to LLVM version 3.8 b9cea81 Show testcase where demand analysis abortion code fails 979baec --without-libcharset disables the use of libcharset bedd620 Style changes for UniqFM 6ed7c47 Document some codegen nondeterminism 9858552 Use deterministic maps for FamInstEnv 34085b5 Correct the message displayed for syntax error (#12146) 64bce8c Add Note [FamInstEnv determinism] 6e280c2 Utils: Fix `lengthIs` and `lengthExceeds` for negative args 0481324 Use UniqDFM for InstEnv b8cd94d GHC.Stack.CCS: Fix typo in Haddocks 91fd87e FastString: Reduce allocations of concatFS 15751f2 FastString: Add IsString instance c4a9dca FastString: Supply mconcat implementation fc53d36 OccName: Implement startsWithUnderscore in terms of headFS eb3d659 OccName: Avoid re-encoding derived OccNames 4f21a51 Kill eltsUFM in classifyTyCons 6c7c193 DsExpr: Remove usage of concatFS in fingerprintName 0177c85 Testsuite: expose TEST_CC (path to gcc) f53d761 TysWiredIn: Use UniqFM lookup for built-in OccNames 9a3df1f check-api-annotations utility loads by filename 17d0b84 Add -package-env to the flags reference 372dbc4 Pretty: delete really old changelog 45d8f4e Demand analyser: Implement LetUp rule (#12370) 18ac80f tidyType: Rename variables of nested forall at once cd0750e tidyOccNames: Rename variables fairly 37aeff6 Added type family dependency to Data.Type.Bool.Not b35e01c Bring comments in TcGenGenerics up to date a9bc547 Log heap profiler samples to event log ffe4660 IfaceEnv: Only check for built-in OccNames if mod is GHC.Types 24f5f36 Binary: Use ByteString's copy in getBS 0f0cdb6 Bugfix for bug 11632: `readLitChar` should consume null characters 1ba79fa CodeGen: Way to dump cmm only once (#11717) 89a8be7 Pretty: remove a harmful $! (#12227) 5df92f6 hp2ps: fix invalid PostScript for names with parentheses d213ab3 Fix misspellings of the word "instance" in comments 3fa3fe8 Make DeriveFunctor work with unboxed tuples 514c4a4 Fix Template Haskell reification of unboxed tuple types 1fc41d3 Make okConIdOcc recognize unboxed tuples 0df3f4c Fix PDF build for the User's Guide. 98b2c50 Support SCC pragmas in declaration context e46b768 Make Data.{Bifoldable,Bitraversable} -XSafe 908f8e2 TcInteract: Add braces to matchClassInst trace output 8de6e13 Fix bytecode generator panic cac3fb0 Cleanup PosixSource.h a0f83a6 Data.Either: Add fromLeft and fromRight (#12402) 627c767 Update docs for partial type signatures (#12365) ed48098 InstEnv: Ensure that instance visibility check is lazy 9513fe6 Clean up interaction between name cache and built-in syntax a4f2b76 testsuite: Add regression test for #12381 93acc02 Add another testcase for #12082 cf989ff Compact Regions 83e4f49 Revert "Clean up interaction between name cache and built-in syntax" 714bebf Implement unboxed sum primitive type a09c0e3 Comments only 9c54185 Comments + tiny refactor of isNullarySrcDataCon 8d4760f Comments re ApThunks + small refactor in mkRhsClosure 6a4dc89 Bump Haddock submodule 8265c78 Fix and document Unique generation for sum TyCon and DataCons e710f8f Correct a few mistyped words in prose/comments bbf36f8 More typos in comments fb34b27 Revert "Cleanup PosixSource.h" 86b1522 Unboxed sums: More unit tests bfef2eb StgCmmBind: Some minor simplifications c4f3d91 Add deepseq dependency and a few NFData instances 648fd73 Squash space leaks in the result of byteCodeGen 7f0f1d7 -fprof-auto-top 1fe5c89 UNPACK the size field of SizedSeq d068220 Fix the non-Linux build 4036c1f Testsuite: fix T10482a 1967d74 Some typos in comments a9251c6 MonadUtils: Typos in comments 1783011 Fix productivity calculation (#12424) 9d62f0d Accept better stats for T9675 8f63ba3 Compute boot-defined TyCon names from ModIface. b0a5144 Add mblocks_allocated to GC stats API e98edbd Move stat_startGCSync d3feb16 Make Unique a newtype c06e3f4 Add atomic operations to package.conf.in 89ae1e8 Relevant Bindings no longer reports shadowed bindings (fixes #12176) 750553a Use MO_Cmpxchg in Primops.cmm instead of ccall cas(..) 2078909 Typo in comment 36565a9 ForeignCall.hs: Remove DrIFT directives 55f5aed Track the lengths of the thread queues 988ad8b Fix to thread migration d1fe08e Only trace cap/capset events if we're tracing anything else 4dcbbd1 Remove the DEBUG_ variables, use RtsFlags directly 9df9490 StgSyn: Remove unused StgLiveVars types 2f79e79 Add comment about lexing of INLINE and INLINABLE pragma 0c37aef Update old comment InlinePragma b1e6415 More comments about InlinePragmas 7a06b22 Typo in comment [skip ci] 7a8ef01 Remove `setUnfoldingInfoLazily` a13fda7 Clarify comment on makeCorePair d85b26d CmmLive: Remove some redundant exports 8ecac25 CmmLayoutStack: Minor simplification fc66415 Replace an unsafeCoerce with coerce db5a226 Fix omission in haddock instance head 1101045 Trim all spaces after 'version:' fe4008f Remove identity update of field componentsConfigs f09d654 check that the number of parallel build is greater than 0 e3e2e49 codeGen: Remove binutils<2.17 hack, fixes T11758 ca7e1ad Expanded abbreviations in Haddock documentation ce13a9a Fix an assertion that could randomly fail 89fa4e9 Another try to get thread migration right 8fe1672 Bump `hoopl` submodule, mostly cosmetics 253fc38 Temporarily mark T1969 perf test as broken (#12437) 7354f93 StgCmm: Remove unused Bool field of Return sequel 02614fd Replace some `length . filter` with `count` 9aa5d87 Util.count: Implement as a left-fold instead of a right-fold affcec7 rts/Printer.h: fix constness of argument declaration 03af399 AsmCodeGen: Give linear-scan and coloring reg. allocators different cc names 3bfe6a5 RegAlloc: Remove duplicate seqList (use seqList from Util) bd51064 RegAlloc: Use IntSet/IntMaps instead of generic Set/Maps 7a2e933 Use Data.Functor.Const to implement Data.Data internals 6fe2355 configure.ac: Remove checks for bug 9439 773e3aa T1969: Enable it again but bump the max residency temporarily 4d9c22d Fix typo in Data.Bitraversable Haddocks fe19be2 Cabal submodule update. dd23a4c Actually update haddock.Cabal stats. e79bb2c Fix a bug in unboxed sum layout generation 9684dbb Remove StgRubbishArg and CmmArg ac0e112 Improve missing-sig warning bd0c310 Fix GHCi perf-llvm build on x86_64 37a7bcb Update `nofib` submodule to newest commit 7ad3b49 Misspellings in comments [skip ci] 18f0687 Fix configure detection. ffd4029 fix compilation failure on OpenBSD with system supplied GNU C 4.2.1 fc1432a Update hoopl submodule (extra .gitignore entry) 3551e62 refactor test for __builtin_unreachable into Rts.h macro RTS_UNREACHABLE da99a7f Darwin: Detect broken NM program at configure time f9a11a2 When in sanity mode, un-zero malloc'd memory; fix uninitialized memory bugs. d331ace Minor typofix. b222ef7 Typofix in System.Environment docs. 34da8e5 Typo in comment efc0372 Not-in-scope variables are always errors f352e5c Keep the bindings local during defaultCallStacks 58e7316 Refactor nestImplicTcS d610274 Revert "T1969: Enable it again but bump the max residency temporarily" 113d50b Add gcoerceWith to Data.Type.Coercion b2c5e4c Revert "codeGen: Remove binutils<2.17 hack, fixes T11758" 896d216 Annotate initIfaceCheck with usage information. e907e1f Axe initIfaceTc, tie the knot through HPT (or if_rec_types). 704913c Support for noinline magic function. 1f1bd92 Introduce BootUnfolding, set when unfolding is absent due to hs-boot file. 5a8fa2e When a value Id comes from hi-boot, insert noinline. Fixes #10083. 8fd1848 Retypecheck both before and after finishing hs-boot loops in --make. e528061 We also need to retypecheck before when we do parallel make. 0d3bf62 Fix #12472 by looking for noinline/lazy inside oversaturated applications. f9aa996 pass -z wxneeded or -Wl,-zwxneeded for linking on OpenBSD fb0d87f Splice singleton unboxed tuples correctly with Template Haskell 1f75440 Extra comments, as per SPJ in #12035. acdbd16 Move #12403, #12513 users guide notes to 8.2.1 release notes 89facad Add T12520 as a test 1766bb3 RtClosureInspect: Fix off-by-one error in cvReconstructType 613d745 Template Haskell support for unboxed sums 7a86f58 Comments only: Refer to actually existing Notes 8d92b88 DmdAnal: Add a final, safe iteration d6fd2e3 DmdAnal: Testcase about splitFVs and dmdFix abortion ec7fcfd Degrade "case scrutinee not known to diverge for sure" Lint error to warning faaf313 WwLib: Add strictness signature to "let x = absentError …" 1083f45 Fix doc build inconsistency ae66f35 Allow typed holes to be levity-polymorphic a60ea70 Move import to avoid warning 0050aff Fix scoping of type variables in instances ca8c0e2 Typofix in docs. 983f660 Template Haskell support for TypeApplications 822af41 Fix broken Haddock comment f4384ef Remove unused DerivInst constructor for DerivStuff 21c2ebf Missing stderr for T12531. 9d17560 GhcMake: limit Capability count to CPU count in parallel mode a5d26f2 rts: enable parallel GC scan of large (32M+) allocation area 044e81b OccName: Remove unused DrIFT directive ff1931e TcGenDeriv: Typofix d168c41 Fix and complete runghc documentation 6781f37 Clarify pkg selection when multiple versions are available 83b326c Fix binary-trees regression from unnecessary floating in CorePrep. a25bf26 Tag pointers in interpreted constructors ef784c5 Fix handling of package-db entries in .ghc.environment files, etc. 2ee1db6 Fixes #12504: Double-escape paths used to build call to hsc_line 28b71c5 users_guide: More capabilities than processors considered harmful 0e74925 GHC: Expose installSignalHandlers, withCleanupSession 3005fa5 iserv: Show usage message on argument parse failure d790cb9 Bump the default allocation area size to 1MB d40d6df StgCmmPrim: Add missing MO_WriteBarrier d1f2239 Clarify scope of `getQ`/`putQ` state. 22259c1 testsuite: Failing testcase for #12091 2d22026 ErrUtils: Expose accessors of ErrDoc and ErrMsg a07a3ff A failing testcase for T12485 9306db0 TysWiredIn: Use dataConWorkerUnique instead of incrUnique 9cfef16 Add Read1/Read2 methods defined in terms of ReadPrec 1ad770f Add -flocal-ghci-history flag (#9089). 010b07a PPC NCG: Implement minimal stack frame header. ca6d0eb testsuite: Update bytes allocated of parsing001 75321ff Add -fdefer-out-of-scope-variables flag (#12170). e9b0bf4 Remove redundant-constraints from -Wall (#10635) 043604c RnExpr: Fix ApplicativeDo desugaring with RebindableSyntax dad6a88 LoadIFace: Show known names on inconsistent interface file From git at git.haskell.org Thu Sep 1 15:01:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 15:01:19 +0000 (UTC) Subject: [commit: ghc] master: users_guide: Document removal of -Wredundant-constraints from -Wall (a69371c) Message-ID: <20160901150119.B2EDD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a69371ce34298c9e8cdc9e8a8927ec7a5047c414/ghc >--------------------------------------------------------------- commit a69371ce34298c9e8cdc9e8a8927ec7a5047c414 Author: Ben Gamari Date: Wed Aug 31 16:42:53 2016 -0400 users_guide: Document removal of -Wredundant-constraints from -Wall >--------------------------------------------------------------- a69371ce34298c9e8cdc9e8a8927ec7a5047c414 docs/users_guide/8.0.2-notes.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 2846d5c..a447732 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -25,7 +25,8 @@ Language Compiler ~~~~~~~~ -- TODO FIXME. +- The :ghc-flag:`-Wredundant-constraints` flag has been removed from the + :ghc-flag:`-Wall` flag set (see :ghc-ticket:`10635`). - The :ghc-flag:`-ddump-cmm` now dumps the result after C-- pipeline pass. Two more flags were added: :ghc-flag:`-ddump-cmm-from-stg` to allow to get the From git at git.haskell.org Thu Sep 1 15:01:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 15:01:22 +0000 (UTC) Subject: [commit: ghc] master: Revert "testsuite: Update bytes allocated of parsing001" (3fb8f48) Message-ID: <20160901150122.618A03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3fb8f48759cf6acf6b8af741fa8524e999dfc417/ghc >--------------------------------------------------------------- commit 3fb8f48759cf6acf6b8af741fa8524e999dfc417 Author: Ben Gamari Date: Thu Sep 1 10:23:20 2016 -0400 Revert "testsuite: Update bytes allocated of parsing001" This reverts commit ca6d0eb0f7d28b0245abc2b0783141101e51945f. I'm really not sure what happened with the test build that lead me to believe that this was necessary. Mysterious. >--------------------------------------------------------------- 3fb8f48759cf6acf6b8af741fa8524e999dfc417 testsuite/tests/perf/compiler/all.T | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 0ecc7c2..3c8cbda 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -428,9 +428,8 @@ test('T5631', test('parsing001', [compiler_stats_num_field('bytes allocated', [(wordsize(32), 274000576, 10), - (wordsize(64), 682266448, 5)]), + (wordsize(64), 587079016, 5)]), # expected value: 587079016 (amd64/Linux) - # 2016-08-31: 682266448 (amd64/Linux) only_ways(['normal']), ], compile_fail, ['']) From git at git.haskell.org Thu Sep 1 15:01:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 15:01:25 +0000 (UTC) Subject: [commit: ghc] master: users_guide: Move addModFinalizer mention to 8.0.2 release notes (ad1e072) Message-ID: <20160901150125.123C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad1e0727182094f0f6226d534ad72954b6d7374b/ghc >--------------------------------------------------------------- commit ad1e0727182094f0f6226d534ad72954b6d7374b Author: Ben Gamari Date: Wed Aug 31 17:03:46 2016 -0400 users_guide: Move addModFinalizer mention to 8.0.2 release notes >--------------------------------------------------------------- ad1e0727182094f0f6226d534ad72954b6d7374b docs/users_guide/8.0.2-notes.rst | 13 +++++++++++++ docs/users_guide/8.2.1-notes.rst | 8 -------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index a447732..b2fc0ac 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -33,6 +33,19 @@ Compiler initial cmm from STG-to-C-- code generation and :ghc-flag:`-ddump-cmm-verbose` to obtain the intermediates from all C-- pipeline stages. +Template Haskell +~~~~~~~~~~~~~~~~ + +- TODO FIXME. + +- ``addModFinalizer`` now exposes the local typing environment at the splice + point. This allows ``reify`` to see local and top-level definitions in the + current declaration group when used as in + + .. code-block:: none + + f x = $(addModFinalizer (reify 'x >>= runIO . print) >> [| x |]) + TODO FIXME Heading title ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index ec413b9..2302786 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -53,14 +53,6 @@ Template Haskell - TODO FIXME. -- ``addModFinalizer`` now exposes the local typing environment at the splice - point. This allows ``reify`` to see local and top-level definitions in the - current declaration group when used as in - - .. code-block:: none - - f x = $(addModFinalizer (reify 'x >>= runIO . print) >> [| x |]) - - Reifying types that contain unboxed tuples now works correctly. (Previously, Template Haskell reified unboxed tuples as boxed tuples with twice their appropriate arity.) From git at git.haskell.org Thu Sep 1 15:01:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 15:01:27 +0000 (UTC) Subject: [commit: ghc] master: users_guide: Move -fdefer-out-of-scope-variables note to 8.0.2 relnotes (1f5d4a3) Message-ID: <20160901150127.C0C033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1f5d4a32b4c73eb98c5d9467fbfb079f8d6128c0/ghc >--------------------------------------------------------------- commit 1f5d4a32b4c73eb98c5d9467fbfb079f8d6128c0 Author: Ben Gamari Date: Wed Aug 31 17:14:42 2016 -0400 users_guide: Move -fdefer-out-of-scope-variables note to 8.0.2 relnotes It will be included in 8.0.2 >--------------------------------------------------------------- 1f5d4a32b4c73eb98c5d9467fbfb079f8d6128c0 docs/users_guide/8.0.2-notes.rst | 3 +++ docs/users_guide/8.2.1-notes.rst | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index b2fc0ac..e153ab2 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -33,6 +33,9 @@ Compiler initial cmm from STG-to-C-- code generation and :ghc-flag:`-ddump-cmm-verbose` to obtain the intermediates from all C-- pipeline stages. +- Added :ghc-flag:`-fdefer-out-of-scope-variables`, which converts variable + out of scope variables errors into warnings. + Template Haskell ~~~~~~~~~~~~~~~~ diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 2302786..e74c151 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -38,9 +38,6 @@ Compiler syntax can be used, in addition to a new form for specifying the cost centre name. See :ref:`scc-pragma` for examples. -- Added :ghc-flag:`-fdefer-out-of-scope-variables`, which converts variable - out of scope variables errors into warnings. - GHCi ~~~~ From git at git.haskell.org Thu Sep 1 15:01:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 15:01:30 +0000 (UTC) Subject: [commit: ghc] master: users_guide: Move initGhcMonad note to 8.0.2 relnotes (da920f6) Message-ID: <20160901150130.7473E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/da920f691145175dc310055ae533757e638caab4/ghc >--------------------------------------------------------------- commit da920f691145175dc310055ae533757e638caab4 Author: Ben Gamari Date: Thu Sep 1 01:06:25 2016 -0400 users_guide: Move initGhcMonad note to 8.0.2 relnotes >--------------------------------------------------------------- da920f691145175dc310055ae533757e638caab4 docs/users_guide/8.0.2-notes.rst | 11 +++++++++++ docs/users_guide/8.2.1-notes.rst | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index e153ab2..09ba572 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -67,3 +67,14 @@ TODO FIXME Heading title length :: forall {a} {t :: * -> *}. Foldable t => t a -> Int *X> :type +v length length :: forall (t :: * -> *). Foldable t => forall a. t a -> Int + +Libraries +--------- + +ghc +~~~ + +- The ``GHC.initGhcMonad`` function no longer installs signal handlers by + default. This means that the RTS won't attempt to handle Ctrl-C gracefully. + If you would like to use GHC's signal handlers, call + ``GHC.installSignalHandlers`` during initialization. diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index e74c151..87bc97f 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -149,11 +149,7 @@ filepath ghc ~~~ -- The ``GHC.initGhcMonad`` function no longer installs signal handlers by - default. This means that the RTS won't attempt to handle Ctrl-C gracefully. - If you would like to use GHC's signal handlers, call - ``GHC.installSignalHandlers`` during initialization. - +- ghc-boot ~~~~~~~~ From git at git.haskell.org Thu Sep 1 15:31:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 15:31:20 +0000 (UTC) Subject: [commit: ghc] wip/T5642: Derive the Generic instance in perf/compiler/T5642 (d54b484) Message-ID: <20160901153120.AA5B13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T5642 Link : http://ghc.haskell.org/trac/ghc/changeset/d54b4844c469889bfb0a44e3c1c54dc5a947c413/ghc >--------------------------------------------------------------- commit d54b4844c469889bfb0a44e3c1c54dc5a947c413 Author: Ryan Scott Date: Thu Sep 1 11:30:49 2016 -0400 Derive the Generic instance in perf/compiler/T5642 >--------------------------------------------------------------- d54b4844c469889bfb0a44e3c1c54dc5a947c413 testsuite/tests/perf/compiler/T5642.hs | 875 +-------------------------------- 1 file changed, 2 insertions(+), 873 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d54b4844c469889bfb0a44e3c1c54dc5a947c413 From git at git.haskell.org Thu Sep 1 17:09:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 17:09:31 +0000 (UTC) Subject: [commit: ghc] master: restore -fmax-worker-args handling (Trac #11565) (a48de37) Message-ID: <20160901170931.4A3B43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a48de37dcca98e7d477040b0ed298bcd1b3ab303/ghc >--------------------------------------------------------------- commit a48de37dcca98e7d477040b0ed298bcd1b3ab303 Author: Sergei Trofimovich Date: Thu Sep 1 17:34:58 2016 +0100 restore -fmax-worker-args handling (Trac #11565) maxWorkerArgs handling was accidentally lost 3 years ago in a major update of demand analysis commit 0831a12ea2fc73c33652eeec1adc79fa19700578 Old regression is noticeable as: - code bloat (requires stack reshuffling) - compilation slowdown (more code to optimise/generate) - and increased heap usage (DynFlags unboxing/reboxing?) On a simple compile benchmark this change causes heap allocation drop from 70G don to 67G (ghc perf build). Signed-off-by: Sergei Trofimovich Reviewers: simonpj, ezyang, goldfire, austin, bgamari Reviewed By: simonpj, ezyang Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2503 GHC Trac Issues: #11565 >--------------------------------------------------------------- a48de37dcca98e7d477040b0ed298bcd1b3ab303 compiler/stranal/WwLib.hs | 30 +++++++++++++++++++++++++++++- testsuite/tests/perf/compiler/all.T | 6 ++++-- testsuite/tests/perf/space_leaks/all.T | 6 ++++-- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs index 0057f6f..1a09605 100644 --- a/compiler/stranal/WwLib.hs +++ b/compiler/stranal/WwLib.hs @@ -143,7 +143,7 @@ mkWwBodies dflags fam_envs fun_ty demands res_info wrapper_body = wrap_fn_args . wrap_fn_cpr . wrap_fn_str . applyToVars work_call_args . Var worker_body = mkLams work_lam_args. work_fn_str . work_fn_cpr . work_fn_args - ; if useful1 && not only_one_void_argument || useful2 + ; if is_small_enough work_args && (useful1 && not only_one_void_argument || useful2) then return (Just (worker_args_dmds, wrapper_body, worker_body)) else return Nothing } @@ -163,6 +163,10 @@ mkWwBodies dflags fam_envs fun_ty demands res_info = True | otherwise = False + is_small_enough args = count isId args <= maxWorkerArgs dflags + -- See Note [Limit w/w arity] + -- We count only Free variables (isId) to skip Type, Kind + -- variables which have no runtime representation. {- Note [Always do CPR w/w] @@ -177,6 +181,30 @@ a disaster, because then the enclosing function might say it has the CPR property, but now doesn't and there a cascade of disaster. A good example is Trac #5920. +Note [Limit w/w arity] +~~~~~~~~~~~~~~~~~~~~~~~~ +Guard against high worker arity as it generates a lot of stack traffic. +A simplified example is Trac #11565#comment:6 + +Current strategy is very simple: don't perform w/w transformation at all +if the result produces a wrapper with arity higher than -fmax-worker-args=. + +It is a bit all or nothing, consider + + f (x,y) (a,b,c,d,e ... , z) = rhs + +Currently we will remove all w/w ness entirely. But actually we could +w/w on the (x,y) pair... it's the huge product that is the problem. + +Could we instead refrain from w/w on an arg-by-arg basis? Yes, that'd +solve f. But we can get a lot of args from deeply-nested products: + + g (a, (b, (c, (d, ...)))) = rhs + +This is harder to spot on an arg-by-arg basis. Previously mkWwStr was +given some "fuel" saying how many arguments it could add; when we ran +out of fuel it would stop w/wing. +Still not very clever because it had a left-right bias. ************************************************************************ * * diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 3c8cbda..130ba44 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -428,8 +428,9 @@ test('T5631', test('parsing001', [compiler_stats_num_field('bytes allocated', [(wordsize(32), 274000576, 10), - (wordsize(64), 587079016, 5)]), + (wordsize(64), 581551384, 5)]), # expected value: 587079016 (amd64/Linux) + # 2016-09-01: 581551384 (amd64/Linux) Restore w/w limit (#11565) only_ways(['normal']), ], compile_fail, ['']) @@ -767,7 +768,7 @@ test('T9872d', test('T9961', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 568526784, 5), + [(wordsize(64), 537297968, 5), # 2015-01-12 807117816 Initally created # 2015-spring 772510192 Got better # 2015-05-22 663978160 Fix for #10370 improves it more @@ -775,6 +776,7 @@ test('T9961', # 2015-12-17 745044392 x86_64/Darwin Creep upwards # 2016-03-20 519436672 x64_64/Linux Don't use build desugaring for large lists (#11707) # 2016-03-24 568526784 x64_64/Linux Add eqInt* variants (#11688) + # 2016-09-01 537297968 x64_64/Linux Restore w/w limit (#11565) (wordsize(32), 275264188, 5) # was 375647160 # 2016-04-06 275264188 x86/Linux diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index c6b1d92..301029c 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -58,17 +58,19 @@ test('T4018', test('T4029', [stats_num_field('peak_megabytes_allocated', - [(wordsize(64), 82, 10)]), + [(wordsize(64), 71, 10)]), # 2016-02-26: 66 (amd64/Linux) INITIAL # 2016-05-23: 82 (amd64/Linux) Use -G1 # 2016-07-13: 92 (amd64/Linux) Changes to tidyType + # 2016-09-01: 71 (amd64/Linux) Restore w/w limit (#11565) stats_num_field('max_bytes_used', - [(wordsize(64), 22920616, 5)]), + [(wordsize(64), 21648488, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 # 2016-07-13: 27575416 (amd64/Linux) Changes to tidyType # 2016-07-20: 22920616 (amd64/Linux) Fix laziness of instance matching + # 2016-09-01: 21648488 (amd64/Linux) Restore w/w limit (#11565) extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Thu Sep 1 18:13:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 18:13:08 +0000 (UTC) Subject: [commit: nofib] master: Remove DEFAULT_TMPDIR (bed591d) Message-ID: <20160901181308.B1A7A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bed591d4aa45c7b92a40985c72bc6b3daaa68f0d/nofib >--------------------------------------------------------------- commit bed591d4aa45c7b92a40985c72bc6b3daaa68f0d Author: Ben Gamari Date: Mon Aug 29 18:09:10 2016 -0400 Remove DEFAULT_TMPDIR The logic for this was ripped out of GHC quite some time ago. >--------------------------------------------------------------- bed591d4aa45c7b92a40985c72bc6b3daaa68f0d mk/boilerplate.mk | 1 - runstdtest/Makefile | 1 - runstdtest/runstdtest.prl | 5 ++--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/mk/boilerplate.mk b/mk/boilerplate.mk index 69cab3e..906cd0b 100644 --- a/mk/boilerplate.mk +++ b/mk/boilerplate.mk @@ -20,7 +20,6 @@ SIZE = size STRIP = strip PERL = /usr/bin/perl CONTEXT_DIFF = diff -U 1 -DEFAULT_TMPDIR = /tmp EXECUTABLE_FILE = chmod +x # Benchmarks controls which set of tests should be run diff --git a/runstdtest/Makefile b/runstdtest/Makefile index 3762410..1dc8f6c 100644 --- a/runstdtest/Makefile +++ b/runstdtest/Makefile @@ -7,7 +7,6 @@ all:: $(RM) -f $(PROG) echo '#!$(PERL)' >> $(PROG) echo '$$RM = "$(RM)";' >> $(PROG) - echo '$$DEFAULT_TMPDIR = "$(DEFAULT_TMPDIR)";' >> $(PROG) echo '$$CONTEXT_DIFF = "$(CONTEXT_DIFF)";' >> $(PROG) cat $(PROG).prl >> $(PROG) $(EXECUTABLE_FILE) $(PROG) diff --git a/runstdtest/runstdtest.prl b/runstdtest/runstdtest.prl index 538dfa9..bab0ab4 100644 --- a/runstdtest/runstdtest.prl +++ b/runstdtest/runstdtest.prl @@ -2,7 +2,6 @@ # The perl script requires the following variables to be bound # to something meaningful before it will operate correctly: # -# DEFAULT_TMPDIR # CONTEXT_DIFF # RM # @@ -53,8 +52,8 @@ $PgmStdinFile = '/dev/null'; if ( $ENV{'TMPDIR'} ) { # where to make tmp file names $TmpPrefix = $ENV{'TMPDIR'}; } else { - $TmpPrefix ="$DEFAULT_TMPDIR"; - $ENV{'TMPDIR'} = "$DEFAULT_TMPDIR"; # set the env var as well + $TmpPrefix = '/tmp'; + $ENV{'TMPDIR'} = '/tmp'; # set the env var as well } # If this is Cygwin, ignore eol and CR characters. # Perhaps required for MSYS too, although the cygpath From git at git.haskell.org Thu Sep 1 18:13:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 18:13:25 +0000 (UTC) Subject: [commit: ghc] master: Kill vestiages of DEFAULT_TMPDIR (1e39c29) Message-ID: <20160901181325.B7B8B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e39c29ab55b9df83df142ad50e7a79e22f47f9e/ghc >--------------------------------------------------------------- commit 1e39c29ab55b9df83df142ad50e7a79e22f47f9e Author: Ben Gamari Date: Thu Sep 1 12:13:18 2016 -0400 Kill vestiages of DEFAULT_TMPDIR It was removed long ago in cf403b50900648063d99afa160d2091a7d6f58c1. Thanks for @rwbarton for catching this. Updates nofib submodule. Test Plan: Validate Reviewers: austin, rwbarton Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D2493 GHC Trac Issues: #12443 >--------------------------------------------------------------- 1e39c29ab55b9df83df142ad50e7a79e22f47f9e docs/users_guide/separate_compilation.rst | 4 ---- mk/config.mk.in | 15 --------------- nofib | 2 +- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst index e83cd8e..aa99c98 100644 --- a/docs/users_guide/separate_compilation.rst +++ b/docs/users_guide/separate_compilation.rst @@ -405,10 +405,6 @@ Redirecting temporary files name of the directory where temporary files should be put. GCC and other programs will honour the :envvar:`TMPDIR` variable as well. - Even better idea: Set the :envvar:`DEFAULT_TMPDIR` :command:`make` variable when - building GHC, and never worry about :envvar:`TMPDIR` again. (see the build - documentation). - .. _hi-options: Other options related to interface files diff --git a/mk/config.mk.in b/mk/config.mk.in index 56a63fd..2163643 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -396,21 +396,6 @@ GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64), at UseLibdw@, # ################################################################################ -# Directory used by GHC (and possibly other tools) for storing -# temporary files. If your TMPDIR isn't big enough, either override -# this in build.mk or set your environment variable "TMPDIR" to point -# to somewhere with more space. (TMPDIR=. is a good choice). - -# DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to -# override an environment variable with the value of the make variable -# of the same name (if it exists) when executing sub-processes, so -# setting the TMPDIR env var would have no effect in the build tree. - -DEFAULT_TMPDIR = /tmp -ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" -DEFAULT_TMPDIR = /C/TEMP -endif - BIN_DIST_NAME = ghc-$(ProjectVersion) BIN_DIST_PREP_DIR = bindistprep/$(BIN_DIST_NAME) BIN_DIST_PREP_TAR = bindistprep/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar diff --git a/nofib b/nofib index 6dc2b46..bed591d 160000 --- a/nofib +++ b/nofib @@ -1 +1 @@ -Subproject commit 6dc2b467c71cf7c7e8f99ba4e60ca4b32a90236a +Subproject commit bed591d4aa45c7b92a40985c72bc6b3daaa68f0d From git at git.haskell.org Thu Sep 1 18:25:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 18:25:32 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Linker: Fix Windows codepath (bd3506c) Message-ID: <20160901182532.E54603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/bd3506c3de60abf4aafd27844cba44fc1523103a/ghc >--------------------------------------------------------------- commit bd3506c3de60abf4aafd27844cba44fc1523103a Author: Ben Gamari Date: Thu Sep 1 10:04:41 2016 -0400 Linker: Fix Windows codepath Thanks to Phyx for the patch. >--------------------------------------------------------------- bd3506c3de60abf4aafd27844cba44fc1523103a rts/Linker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 8e00b92..82a37c8 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -4102,13 +4102,13 @@ ocGetNames_PEi386 ( ObjectCode* oc ) if (globalBssSize > 0) { bss = stgCallocBytes(1, globalBssSize, "ocGetNames_PEi386(non-anonymous bss)"); - addSection(§ions[oc->n_sections-1], + addSection(&oc->sections[oc->n_sections-1], SECTIONKIND_RWDATA, SECTION_MALLOC, bss, globalBssSize, 0, 0, 0); IF_DEBUG(linker, debugBelch("bss @ %p %" FMT_Word "\n", bss, globalBssSize)); addProddableBlock(oc, bss, globalBssSize); } else { - addSection(§ions[oc->n_sections-1], + addSection(&oc->sections[oc->n_sections-1], SECTIONKIND_OTHER, SECTION_NOMEM, NULL, 0, 0, 0, 0); } From git at git.haskell.org Thu Sep 1 18:25:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 18:25:36 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: RnExpr: Fix ApplicativeDo desugaring with RebindableSyntax (44755a0) Message-ID: <20160901182536.22CF53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/44755a0cbcb77aea1c28aeba994a4514aec87904/ghc >--------------------------------------------------------------- commit 44755a0cbcb77aea1c28aeba994a4514aec87904 Author: Ben Gamari Date: Wed Aug 31 16:03:33 2016 -0400 RnExpr: Fix ApplicativeDo desugaring with RebindableSyntax We need to compare against the local return and pure, not returnMName and pureAName. Fixes #12490. Test Plan: Validate, add testcase Reviewers: austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2499 GHC Trac Issues: #12490 (cherry picked from commit 043604c7232adb698d5008a46d3f29d532acd12d) >--------------------------------------------------------------- 44755a0cbcb77aea1c28aeba994a4514aec87904 compiler/rename/RnEnv.hs | 13 +++++++++- compiler/rename/RnExpr.hs | 55 +++++++++++++++++++++++++++---------------- testsuite/tests/ado/T12490.hs | 30 +++++++++++++++++++++++ testsuite/tests/ado/all.T | 1 + 4 files changed, 78 insertions(+), 21 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 44755a0cbcb77aea1c28aeba994a4514aec87904 From git at git.haskell.org Thu Sep 1 18:59:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 18:59:31 +0000 (UTC) Subject: [commit: ghc] master: Fix startsVarSym and refactor operator predicates (fixes #4239) (8d35e18) Message-ID: <20160901185931.04EA43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d35e18d885e60f998a9dddb6db19762fe4c6d92/ghc >--------------------------------------------------------------- commit 8d35e18d885e60f998a9dddb6db19762fe4c6d92 Author: Ben Gamari Date: Thu Sep 1 14:13:47 2016 -0400 Fix startsVarSym and refactor operator predicates (fixes #4239) startsVarSym used isSymbol which does not recognize valid operators beginning with OtherPunctuation generalCategory (e. g. (·)). Move it to ghc-boot-th for reducing duplication. This patch fixes template-haskell pretty printer, which is used by -ddump-minimal-imports. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2480 GHC Trac Issues: #4239 >--------------------------------------------------------------- 8d35e18d885e60f998a9dddb6db19762fe4c6d92 compiler/basicTypes/Lexeme.hs | 23 ---------------------- libraries/ghc-boot-th/GHC/Lexeme.hs | 23 +++++++++++++++++++--- .../template-haskell/Language/Haskell/TH/Ppr.hs | 8 +++----- testsuite/tests/rename/should_compile/T4239.hs | 1 + testsuite/tests/rename/should_compile/T4239.stdout | 2 +- testsuite/tests/rename/should_compile/T4239A.hs | 1 + 6 files changed, 26 insertions(+), 32 deletions(-) diff --git a/compiler/basicTypes/Lexeme.hs b/compiler/basicTypes/Lexeme.hs index ef5fa12..7012f5a 100644 --- a/compiler/basicTypes/Lexeme.hs +++ b/compiler/basicTypes/Lexeme.hs @@ -205,25 +205,6 @@ okIdChar c = case generalCategory c of OtherNumber -> True -- See #4373 _ -> c == '\'' || c == '_' --- | Is this character acceptable in a symbol (after the first char)? --- See alexGetByte in Lexer.x -okSymChar :: Char -> Bool -okSymChar c - | c `elem` specialSymbols - = False - | c `elem` "_\"'" - = False - | otherwise - = case generalCategory c of - ConnectorPunctuation -> True - DashPunctuation -> True - OtherPunctuation -> True - MathSymbol -> True - CurrencySymbol -> True - ModifierSymbol -> True - OtherSymbol -> True - _ -> False - -- | All reserved identifiers. Taken from section 2.4 of the 2010 Report. reservedIds :: Set.Set String reservedIds = Set.fromList [ "case", "class", "data", "default", "deriving" @@ -232,10 +213,6 @@ reservedIds = Set.fromList [ "case", "class", "data", "default", "deriving" , "module", "newtype", "of", "then", "type", "where" , "_" ] --- | All punctuation that cannot appear in symbols. See $special in Lexer.x. -specialSymbols :: [Char] -specialSymbols = "(),;[]`{}" - -- | All reserved operators. Taken from section 2.4 of the 2010 Report. reservedOps :: Set.Set String reservedOps = Set.fromList [ "..", ":", "::", "=", "\\", "|", "<-", "->" diff --git a/libraries/ghc-boot-th/GHC/Lexeme.hs b/libraries/ghc-boot-th/GHC/Lexeme.hs index 677c9a6..2ecee61 100644 --- a/libraries/ghc-boot-th/GHC/Lexeme.hs +++ b/libraries/ghc-boot-th/GHC/Lexeme.hs @@ -11,14 +11,31 @@ module GHC.Lexeme ( -- * Lexical characteristics of Haskell names startsVarSym, startsVarId, startsConSym, startsConId, - startsVarSymASCII, isVarSymChar + startsVarSymASCII, isVarSymChar, okSymChar ) where import Data.Char +-- | Is this character acceptable in a symbol (after the first char)? +-- See alexGetByte in Lexer.x +okSymChar :: Char -> Bool +okSymChar c + | c `elem` "(),;[]`{}_\"'" + = False + | otherwise + = case generalCategory c of + ConnectorPunctuation -> True + DashPunctuation -> True + OtherPunctuation -> True + MathSymbol -> True + CurrencySymbol -> True + ModifierSymbol -> True + OtherSymbol -> True + _ -> False + startsVarSym, startsVarId, startsConSym, startsConId :: Char -> Bool -startsVarSym c = startsVarSymASCII c || (ord c > 0x7f && isSymbol c) -- Infix Ids -startsConSym c = c == ':' -- Infix data constructors +startsVarSym c = okSymChar c && c /= ':' -- Infix Ids +startsConSym c = c == ':' -- Infix data constructors startsVarId c = c == '_' || case generalCategory c of -- Ordinary Ids LowercaseLetter -> True OtherLetter -> True -- See #1103 diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs index bdd4dd3..0462a8d 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs @@ -10,8 +10,9 @@ import Text.PrettyPrint (render) import Language.Haskell.TH.PprLib import Language.Haskell.TH.Syntax import Data.Word ( Word8 ) -import Data.Char ( toLower, chr, ord, isSymbol ) +import Data.Char ( toLower, chr) import GHC.Show ( showMultiLineString ) +import GHC.Lexeme( startsVarSym ) import Data.Ratio ( numerator, denominator ) nestDepth :: Int @@ -114,12 +115,9 @@ isSymOcc :: Name -> Bool isSymOcc n = case nameBase n of [] -> True -- Empty name; weird - (c:_) -> isSymbolASCII c || (ord c > 0x7f && isSymbol c) + (c:_) -> startsVarSym c -- c.f. OccName.startsVarSym in GHC itself -isSymbolASCII :: Char -> Bool -isSymbolASCII c = c `elem` "!#$%&*+./<=>?@\\^|~-" - pprInfixExp :: Exp -> Doc pprInfixExp (VarE v) = pprName' Infix v pprInfixExp (ConE v) = pprName' Infix v diff --git a/testsuite/tests/rename/should_compile/T4239.hs b/testsuite/tests/rename/should_compile/T4239.hs index 5d4f94f..02e4128 100644 --- a/testsuite/tests/rename/should_compile/T4239.hs +++ b/testsuite/tests/rename/should_compile/T4239.hs @@ -12,3 +12,4 @@ v2 = X v3 :: (:+++) v3 = (:---) +v4 = (·) diff --git a/testsuite/tests/rename/should_compile/T4239.stdout b/testsuite/tests/rename/should_compile/T4239.stdout index 05536b7..6e55a4e 100644 --- a/testsuite/tests/rename/should_compile/T4239.stdout +++ b/testsuite/tests/rename/should_compile/T4239.stdout @@ -1 +1 @@ -import T4239A ( type (:+++)((:---), X, (:+++)) ) +import T4239A ( type (:+++)((:---), X, (:+++)), (·) ) diff --git a/testsuite/tests/rename/should_compile/T4239A.hs b/testsuite/tests/rename/should_compile/T4239A.hs index ea92d96..076f4f2 100644 --- a/testsuite/tests/rename/should_compile/T4239A.hs +++ b/testsuite/tests/rename/should_compile/T4239A.hs @@ -8,3 +8,4 @@ data (:+++) = (:+++) | X | Y +(·) = undefined From git at git.haskell.org Thu Sep 1 19:05:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 19:05:48 +0000 (UTC) Subject: [commit: ghc] master: Revert "Fix startsVarSym and refactor operator predicates (fixes #4239)" (b946cf3) Message-ID: <20160901190548.3B8C53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b946cf3f5d6fd273a79b008472e8cb0ad1432be1/ghc >--------------------------------------------------------------- commit b946cf3f5d6fd273a79b008472e8cb0ad1432be1 Author: Ben Gamari Date: Thu Sep 1 15:03:46 2016 -0400 Revert "Fix startsVarSym and refactor operator predicates (fixes #4239)" This reverts commit 8d35e18d885e60f998a9dddb6db19762fe4c6d92. arc butchered the authorship on this. >--------------------------------------------------------------- b946cf3f5d6fd273a79b008472e8cb0ad1432be1 compiler/basicTypes/Lexeme.hs | 23 ++++++++++++++++++++++ libraries/ghc-boot-th/GHC/Lexeme.hs | 23 +++------------------- .../template-haskell/Language/Haskell/TH/Ppr.hs | 8 +++++--- testsuite/tests/rename/should_compile/T4239.hs | 1 - testsuite/tests/rename/should_compile/T4239.stdout | 2 +- testsuite/tests/rename/should_compile/T4239A.hs | 1 - 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/compiler/basicTypes/Lexeme.hs b/compiler/basicTypes/Lexeme.hs index 7012f5a..ef5fa12 100644 --- a/compiler/basicTypes/Lexeme.hs +++ b/compiler/basicTypes/Lexeme.hs @@ -205,6 +205,25 @@ okIdChar c = case generalCategory c of OtherNumber -> True -- See #4373 _ -> c == '\'' || c == '_' +-- | Is this character acceptable in a symbol (after the first char)? +-- See alexGetByte in Lexer.x +okSymChar :: Char -> Bool +okSymChar c + | c `elem` specialSymbols + = False + | c `elem` "_\"'" + = False + | otherwise + = case generalCategory c of + ConnectorPunctuation -> True + DashPunctuation -> True + OtherPunctuation -> True + MathSymbol -> True + CurrencySymbol -> True + ModifierSymbol -> True + OtherSymbol -> True + _ -> False + -- | All reserved identifiers. Taken from section 2.4 of the 2010 Report. reservedIds :: Set.Set String reservedIds = Set.fromList [ "case", "class", "data", "default", "deriving" @@ -213,6 +232,10 @@ reservedIds = Set.fromList [ "case", "class", "data", "default", "deriving" , "module", "newtype", "of", "then", "type", "where" , "_" ] +-- | All punctuation that cannot appear in symbols. See $special in Lexer.x. +specialSymbols :: [Char] +specialSymbols = "(),;[]`{}" + -- | All reserved operators. Taken from section 2.4 of the 2010 Report. reservedOps :: Set.Set String reservedOps = Set.fromList [ "..", ":", "::", "=", "\\", "|", "<-", "->" diff --git a/libraries/ghc-boot-th/GHC/Lexeme.hs b/libraries/ghc-boot-th/GHC/Lexeme.hs index 2ecee61..677c9a6 100644 --- a/libraries/ghc-boot-th/GHC/Lexeme.hs +++ b/libraries/ghc-boot-th/GHC/Lexeme.hs @@ -11,31 +11,14 @@ module GHC.Lexeme ( -- * Lexical characteristics of Haskell names startsVarSym, startsVarId, startsConSym, startsConId, - startsVarSymASCII, isVarSymChar, okSymChar + startsVarSymASCII, isVarSymChar ) where import Data.Char --- | Is this character acceptable in a symbol (after the first char)? --- See alexGetByte in Lexer.x -okSymChar :: Char -> Bool -okSymChar c - | c `elem` "(),;[]`{}_\"'" - = False - | otherwise - = case generalCategory c of - ConnectorPunctuation -> True - DashPunctuation -> True - OtherPunctuation -> True - MathSymbol -> True - CurrencySymbol -> True - ModifierSymbol -> True - OtherSymbol -> True - _ -> False - startsVarSym, startsVarId, startsConSym, startsConId :: Char -> Bool -startsVarSym c = okSymChar c && c /= ':' -- Infix Ids -startsConSym c = c == ':' -- Infix data constructors +startsVarSym c = startsVarSymASCII c || (ord c > 0x7f && isSymbol c) -- Infix Ids +startsConSym c = c == ':' -- Infix data constructors startsVarId c = c == '_' || case generalCategory c of -- Ordinary Ids LowercaseLetter -> True OtherLetter -> True -- See #1103 diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs index 0462a8d..bdd4dd3 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs @@ -10,9 +10,8 @@ import Text.PrettyPrint (render) import Language.Haskell.TH.PprLib import Language.Haskell.TH.Syntax import Data.Word ( Word8 ) -import Data.Char ( toLower, chr) +import Data.Char ( toLower, chr, ord, isSymbol ) import GHC.Show ( showMultiLineString ) -import GHC.Lexeme( startsVarSym ) import Data.Ratio ( numerator, denominator ) nestDepth :: Int @@ -115,9 +114,12 @@ isSymOcc :: Name -> Bool isSymOcc n = case nameBase n of [] -> True -- Empty name; weird - (c:_) -> startsVarSym c + (c:_) -> isSymbolASCII c || (ord c > 0x7f && isSymbol c) -- c.f. OccName.startsVarSym in GHC itself +isSymbolASCII :: Char -> Bool +isSymbolASCII c = c `elem` "!#$%&*+./<=>?@\\^|~-" + pprInfixExp :: Exp -> Doc pprInfixExp (VarE v) = pprName' Infix v pprInfixExp (ConE v) = pprName' Infix v diff --git a/testsuite/tests/rename/should_compile/T4239.hs b/testsuite/tests/rename/should_compile/T4239.hs index 02e4128..5d4f94f 100644 --- a/testsuite/tests/rename/should_compile/T4239.hs +++ b/testsuite/tests/rename/should_compile/T4239.hs @@ -12,4 +12,3 @@ v2 = X v3 :: (:+++) v3 = (:---) -v4 = (·) diff --git a/testsuite/tests/rename/should_compile/T4239.stdout b/testsuite/tests/rename/should_compile/T4239.stdout index 6e55a4e..05536b7 100644 --- a/testsuite/tests/rename/should_compile/T4239.stdout +++ b/testsuite/tests/rename/should_compile/T4239.stdout @@ -1 +1 @@ -import T4239A ( type (:+++)((:---), X, (:+++)), (·) ) +import T4239A ( type (:+++)((:---), X, (:+++)) ) diff --git a/testsuite/tests/rename/should_compile/T4239A.hs b/testsuite/tests/rename/should_compile/T4239A.hs index 076f4f2..ea92d96 100644 --- a/testsuite/tests/rename/should_compile/T4239A.hs +++ b/testsuite/tests/rename/should_compile/T4239A.hs @@ -8,4 +8,3 @@ data (:+++) = (:+++) | X | Y -(·) = undefined From git at git.haskell.org Thu Sep 1 19:05:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 19:05:50 +0000 (UTC) Subject: [commit: ghc] master: Fix startsVarSym and refactor operator predicates (fixes #4239) (f233f00) Message-ID: <20160901190550.E90113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f233f00b1915ac6c0a200b8017a9f07deefd401e/ghc >--------------------------------------------------------------- commit f233f00b1915ac6c0a200b8017a9f07deefd401e Author: Malo Jaffré Date: Thu Sep 1 14:13:47 2016 -0400 Fix startsVarSym and refactor operator predicates (fixes #4239) startsVarSym used isSymbol which does not recognize valid operators beginning with OtherPunctuation generalCategory (e. g. (·)). Move it to ghc-boot-th for reducing duplication. This patch fixes template-haskell pretty printer, which is used by -ddump-minimal-imports. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2480 GHC Trac Issues: #4239 >--------------------------------------------------------------- f233f00b1915ac6c0a200b8017a9f07deefd401e compiler/basicTypes/Lexeme.hs | 23 ---------------------- libraries/ghc-boot-th/GHC/Lexeme.hs | 23 +++++++++++++++++++--- .../template-haskell/Language/Haskell/TH/Ppr.hs | 8 +++----- testsuite/tests/rename/should_compile/T4239.hs | 1 + testsuite/tests/rename/should_compile/T4239.stdout | 2 +- testsuite/tests/rename/should_compile/T4239A.hs | 1 + 6 files changed, 26 insertions(+), 32 deletions(-) diff --git a/compiler/basicTypes/Lexeme.hs b/compiler/basicTypes/Lexeme.hs index ef5fa12..7012f5a 100644 --- a/compiler/basicTypes/Lexeme.hs +++ b/compiler/basicTypes/Lexeme.hs @@ -205,25 +205,6 @@ okIdChar c = case generalCategory c of OtherNumber -> True -- See #4373 _ -> c == '\'' || c == '_' --- | Is this character acceptable in a symbol (after the first char)? --- See alexGetByte in Lexer.x -okSymChar :: Char -> Bool -okSymChar c - | c `elem` specialSymbols - = False - | c `elem` "_\"'" - = False - | otherwise - = case generalCategory c of - ConnectorPunctuation -> True - DashPunctuation -> True - OtherPunctuation -> True - MathSymbol -> True - CurrencySymbol -> True - ModifierSymbol -> True - OtherSymbol -> True - _ -> False - -- | All reserved identifiers. Taken from section 2.4 of the 2010 Report. reservedIds :: Set.Set String reservedIds = Set.fromList [ "case", "class", "data", "default", "deriving" @@ -232,10 +213,6 @@ reservedIds = Set.fromList [ "case", "class", "data", "default", "deriving" , "module", "newtype", "of", "then", "type", "where" , "_" ] --- | All punctuation that cannot appear in symbols. See $special in Lexer.x. -specialSymbols :: [Char] -specialSymbols = "(),;[]`{}" - -- | All reserved operators. Taken from section 2.4 of the 2010 Report. reservedOps :: Set.Set String reservedOps = Set.fromList [ "..", ":", "::", "=", "\\", "|", "<-", "->" diff --git a/libraries/ghc-boot-th/GHC/Lexeme.hs b/libraries/ghc-boot-th/GHC/Lexeme.hs index 677c9a6..2ecee61 100644 --- a/libraries/ghc-boot-th/GHC/Lexeme.hs +++ b/libraries/ghc-boot-th/GHC/Lexeme.hs @@ -11,14 +11,31 @@ module GHC.Lexeme ( -- * Lexical characteristics of Haskell names startsVarSym, startsVarId, startsConSym, startsConId, - startsVarSymASCII, isVarSymChar + startsVarSymASCII, isVarSymChar, okSymChar ) where import Data.Char +-- | Is this character acceptable in a symbol (after the first char)? +-- See alexGetByte in Lexer.x +okSymChar :: Char -> Bool +okSymChar c + | c `elem` "(),;[]`{}_\"'" + = False + | otherwise + = case generalCategory c of + ConnectorPunctuation -> True + DashPunctuation -> True + OtherPunctuation -> True + MathSymbol -> True + CurrencySymbol -> True + ModifierSymbol -> True + OtherSymbol -> True + _ -> False + startsVarSym, startsVarId, startsConSym, startsConId :: Char -> Bool -startsVarSym c = startsVarSymASCII c || (ord c > 0x7f && isSymbol c) -- Infix Ids -startsConSym c = c == ':' -- Infix data constructors +startsVarSym c = okSymChar c && c /= ':' -- Infix Ids +startsConSym c = c == ':' -- Infix data constructors startsVarId c = c == '_' || case generalCategory c of -- Ordinary Ids LowercaseLetter -> True OtherLetter -> True -- See #1103 diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs index bdd4dd3..0462a8d 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs @@ -10,8 +10,9 @@ import Text.PrettyPrint (render) import Language.Haskell.TH.PprLib import Language.Haskell.TH.Syntax import Data.Word ( Word8 ) -import Data.Char ( toLower, chr, ord, isSymbol ) +import Data.Char ( toLower, chr) import GHC.Show ( showMultiLineString ) +import GHC.Lexeme( startsVarSym ) import Data.Ratio ( numerator, denominator ) nestDepth :: Int @@ -114,12 +115,9 @@ isSymOcc :: Name -> Bool isSymOcc n = case nameBase n of [] -> True -- Empty name; weird - (c:_) -> isSymbolASCII c || (ord c > 0x7f && isSymbol c) + (c:_) -> startsVarSym c -- c.f. OccName.startsVarSym in GHC itself -isSymbolASCII :: Char -> Bool -isSymbolASCII c = c `elem` "!#$%&*+./<=>?@\\^|~-" - pprInfixExp :: Exp -> Doc pprInfixExp (VarE v) = pprName' Infix v pprInfixExp (ConE v) = pprName' Infix v diff --git a/testsuite/tests/rename/should_compile/T4239.hs b/testsuite/tests/rename/should_compile/T4239.hs index 5d4f94f..02e4128 100644 --- a/testsuite/tests/rename/should_compile/T4239.hs +++ b/testsuite/tests/rename/should_compile/T4239.hs @@ -12,3 +12,4 @@ v2 = X v3 :: (:+++) v3 = (:---) +v4 = (·) diff --git a/testsuite/tests/rename/should_compile/T4239.stdout b/testsuite/tests/rename/should_compile/T4239.stdout index 05536b7..6e55a4e 100644 --- a/testsuite/tests/rename/should_compile/T4239.stdout +++ b/testsuite/tests/rename/should_compile/T4239.stdout @@ -1 +1 @@ -import T4239A ( type (:+++)((:---), X, (:+++)) ) +import T4239A ( type (:+++)((:---), X, (:+++)), (·) ) diff --git a/testsuite/tests/rename/should_compile/T4239A.hs b/testsuite/tests/rename/should_compile/T4239A.hs index ea92d96..076f4f2 100644 --- a/testsuite/tests/rename/should_compile/T4239A.hs +++ b/testsuite/tests/rename/should_compile/T4239A.hs @@ -8,3 +8,4 @@ data (:+++) = (:+++) | X | Y +(·) = undefined From git at git.haskell.org Thu Sep 1 19:20:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 19:20:44 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix and complete runghc documentation (2df0d75) Message-ID: <20160901192044.7DA8F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/2df0d7591e764bda60c933f75083a7186fb42a01/ghc >--------------------------------------------------------------- commit 2df0d7591e764bda60c933f75083a7186fb42a01 Author: Harendra Kumar Date: Tue Aug 30 16:54:30 2016 -0400 Fix and complete runghc documentation Reviewers: austin, thomie, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D2463 GHC Trac Issues: #12517 (cherry picked from commit d168c41a231cd92ca993e0bdd621cf554694df1c) >--------------------------------------------------------------- 2df0d7591e764bda60c933f75083a7186fb42a01 docs/users_guide/runghc.rst | 58 +++++++++++++++++++++++++++++++++------------ utils/runghc/Main.hs | 1 + 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/docs/users_guide/runghc.rst b/docs/users_guide/runghc.rst index d823e35..fcc8cf8 100644 --- a/docs/users_guide/runghc.rst +++ b/docs/users_guide/runghc.rst @@ -11,7 +11,7 @@ compile them. .. _runghc-introduction: -Flags +Usage ----- The ``runghc`` command-line looks like: @@ -20,17 +20,45 @@ The ``runghc`` command-line looks like: runghc [runghc flags] [GHC flags] module [program args] -The runghc flags are ``-f /path/to/ghc``, which tells runghc which GHC -to use to run the program, and ``--help``, which prints usage -information. If it is not given then runghc will search for GHC in the -directories in the system search path. - -runghc will try to work out where the boundaries between -``[runghc flags]`` and ``[GHC flags]``, and ``[program args]`` and -``module`` are, but you can use a ``--`` flag if it doesn't get it -right. For example, ``runghc -- -Wunused-bindings Foo`` means -runghc won't try to use ``warn-unused-bindings`` as the path to GHC, but -instead will pass the flag to GHC. If a GHC flag doesn't start with a -dash then you need to prefix it with ``--ghc-arg=`` or runghc will think -that it is the program to run, e.g. -``runghc -package-db --ghc-arg=foo.conf Main.hs``. +Any flags not recognized by runghc are automatically passed to GHC. +If a flag is recognized by both runghc and GHC but you want to +pass it to GHC then you can place it after a ``--`` separator. Flags after the +separator are treated as GHC only flags. Alternatively you can use the runghc +option ``--ghc-arg=`` to pass any flag or argument directly to GHC. + +``module`` could be a Haskell source filename with or without the extension. +If for some reason the filename starts with a ``-`` you can use a second +``--`` to indicate the end of flags. Anything following a second +``--`` will be considered a program file or module name followed by its +arguments. For example: + +- ``runghc -- -- -hello.hs`` + +runghc flags +------------ + +runghc accepts the following flags: + +- ``-f /path/to/ghc``: tell runghc the path of GHC executable to use to run the program. By default runghc will search for GHC in the directories in the system search path. +- ``--ghc-arg=``: Pass an option or argument to GHC +- ``--help``: print usage information. +- ``--version``: print version information. + +GHC Flags +--------- + +As discussed earlier, use ``--`` or ``--ghc-arg=`` to disambiguate GHC +flags when needed. For example, ``-f`` is recognized by runghc, therefore to +pass ``-fliberate-case`` to GHC use any of the following: + +- ``runghc -- -fliberate-case`` +- ``runghc --ghc-arg=-fliberate-case`` + +Note that any non-flag arguments are never passed to GHC. An unused non-flag +argument will be considered as the name of the program to run. If a GHC flag +takes an argument use ``--ghc-arg=`` to pass the argument to GHC. +For example, if you want to pass ``-package foo`` to GHC use any of the +following: + +- ``runghc -package --ghc-arg=foo Main.hs`` +- ``runghc --ghc-arg=-package --ghc-arg=foo Main.hs`` diff --git a/utils/runghc/Main.hs b/utils/runghc/Main.hs index d048125..001d902 100644 --- a/utils/runghc/Main.hs +++ b/utils/runghc/Main.hs @@ -107,6 +107,7 @@ printUsage = do putStrLn "" putStrLn "The runghc flags are" putStrLn " -f /path/to/ghc Tell runghc where GHC is" + putStrLn " --ghc-arg= Pass an option or argument to GHC" putStrLn " --help Print this usage information" putStrLn " --version Print version number" From git at git.haskell.org Thu Sep 1 20:32:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 20:32:01 +0000 (UTC) Subject: [commit: ghc] master: Added support for deprecated POSIX functions on Windows. (e5ecb20) Message-ID: <20160901203201.98AE03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e5ecb2010514405ac1b9b1285a8a65c00a5fd4e0/ghc >--------------------------------------------------------------- commit e5ecb2010514405ac1b9b1285a8a65c00a5fd4e0 Author: Tamar Christina Date: Thu Sep 1 21:30:07 2016 +0100 Added support for deprecated POSIX functions on Windows. Summary: With the introduction of 8.0.1 We've stopped supporting in GHCi the use of POSIX functions under their deprecated names on Windows. This to be compatible with object and libraries from the most popular compilers on the platform (Microsoft and Intel compilers). However this brings a confusing disparity between the compiled and interpreted behavior since MingW-W64 does support the deprecated names. Also It seems clear that package writers won't update their packages to properly support Windows. As such I have added redirects in the RTS for the deprecated functions as listed on https://msdn.microsoft.com/en-us/library/ms235384.aspx. This won't export the functions (as in, they won't be in the symbol table of compiled code for the RTS.) but we inject them into the symbol table of the dynamic linker at startup. Test Plan: ./validate and make test TEST="ffi017 ffi021" Reviewers: thomie, simonmar, RyanGlScott, bgamari, austin, hvr, erikd Reviewed By: simonmar, bgamari Subscribers: RyanGlScott, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2500 GHC Trac Issues: #12209, #12497, #12496 >--------------------------------------------------------------- e5ecb2010514405ac1b9b1285a8a65c00a5fd4e0 docs/users_guide/8.0.2-notes.rst | 10 +++ libraries/base/System/Posix/Internals.hs | 63 +++++----------- rts/Linker.c | 13 ++++ rts/RtsSymbols.c | 121 +++++++++++++++++++++++++++++++ rts/RtsSymbols.h | 3 +- testsuite/tests/ffi/should_run/all.T | 6 +- testsuite/tests/rts/Makefile | 4 + testsuite/tests/rts/T12497.hs | 24 ++++++ testsuite/tests/rts/T12497.stdout | 2 + testsuite/tests/rts/all.T | 5 ++ 10 files changed, 199 insertions(+), 52 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e5ecb2010514405ac1b9b1285a8a65c00a5fd4e0 From git at git.haskell.org Thu Sep 1 21:26:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 21:26:03 +0000 (UTC) Subject: [commit: ghc] branch 'wip/small-ord' created Message-ID: <20160901212603.12B8E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/small-ord Referencing: e1fe2f8f14d9df1917e3ce8ebce0832b514426fd From git at git.haskell.org Thu Sep 1 21:26:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 1 Sep 2016 21:26:06 +0000 (UTC) Subject: [commit: ghc] wip/small-ord: Make generated Ord instances smaller (per #10858). (e1fe2f8) Message-ID: <20160901212606.60C763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/small-ord Link : http://ghc.haskell.org/trac/ghc/changeset/e1fe2f8f14d9df1917e3ce8ebce0832b514426fd/ghc >--------------------------------------------------------------- commit e1fe2f8f14d9df1917e3ce8ebce0832b514426fd Author: Petr Prokhorenkov Date: Thu Sep 1 17:25:27 2016 -0400 Make generated Ord instances smaller (per #10858). Reviewers: simonpj, bgamari, RyanGlScott, austin Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2502 GHC Trac Issues: #10858 >--------------------------------------------------------------- e1fe2f8f14d9df1917e3ce8ebce0832b514426fd compiler/typecheck/TcGenDeriv.hs | 26 +++++++++++++++++----- .../should_compile => deriving/perf}/Makefile | 0 testsuite/tests/deriving/perf/T10858.hs | 10 +++++++++ .../tests/deriving/perf/T10858.stdout | 0 testsuite/tests/deriving/perf/all.T | 7 ++++++ 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index f282733..f378172 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -329,7 +329,7 @@ Several special cases: values we can't call the overloaded functions. See function unliftedOrdOp -Note [Do not rely on compare] +Note [Game plan for deriving Ord] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It's a bad idea to define only 'compare', and build the other binary comparisons on top of it; see Trac #2130, #4019. Reason: we don't @@ -341,8 +341,16 @@ binary result, something like this: True -> False False -> True +This being said, we can get away with generating full code only for +'compare' and '<' thus saving us generation of other three operators. +Other operators can be cheaply expressed through '<': +a <= b = not $ b < a +a > b = b < a +a >= b = not $ a < b + So for sufficiently small types (few constructors, or all nullary) we generate all methods; for large ones we just use 'compare'. + -} data OrdOp = OrdCompare | OrdLT | OrdLE | OrdGE | OrdGT @@ -395,13 +403,21 @@ gen_Ord_binds loc tycon aux_binds | single_con_type = emptyBag | otherwise = unitBag $ DerivAuxBind $ DerivCon2Tag tycon - -- Note [Do not rely on compare] + -- Note [Game plan for deriving Ord] other_ops | (last_tag - first_tag) <= 2 -- 1-3 constructors || null non_nullary_cons -- Or it's an enumeration - = listToBag (map mkOrdOp [OrdLT,OrdLE,OrdGE,OrdGT]) + = listToBag [mkOrdOp OrdLT, lE, gT, gE] | otherwise = emptyBag + negate_expr = nlHsApp (nlHsVar not_RDR) + lE = mk_easy_FunBind loc le_RDR [a_Pat, b_Pat] $ + negate_expr (nlHsApp (nlHsApp (nlHsVar lt_RDR) b_Expr) a_Expr) + gT = mk_easy_FunBind loc gt_RDR [a_Pat, b_Pat] $ + nlHsApp (nlHsApp (nlHsVar lt_RDR) b_Expr) a_Expr + gE = mk_easy_FunBind loc ge_RDR [a_Pat, b_Pat] $ + negate_expr (nlHsApp (nlHsApp (nlHsVar lt_RDR) a_Expr) b_Expr) + get_tag con = dataConTag con - fIRST_TAG -- We want *zero-based* tags, because that's what -- con2Tag returns (generated by untag_Expr)! @@ -2622,11 +2638,11 @@ as_RDRs = [ mkVarUnqual (mkFastString ("a"++show i)) | i <- [(1::Int) .. bs_RDRs = [ mkVarUnqual (mkFastString ("b"++show i)) | i <- [(1::Int) .. ] ] cs_RDRs = [ mkVarUnqual (mkFastString ("c"++show i)) | i <- [(1::Int) .. ] ] -a_Expr, c_Expr, f_Expr, z_Expr, ltTag_Expr, eqTag_Expr, gtTag_Expr, +a_Expr, b_Expr, c_Expr, f_Expr, z_Expr, ltTag_Expr, eqTag_Expr, gtTag_Expr, false_Expr, true_Expr, fmap_Expr, mempty_Expr, foldMap_Expr, traverse_Expr :: LHsExpr RdrName a_Expr = nlHsVar a_RDR --- b_Expr = nlHsVar b_RDR +b_Expr = nlHsVar b_RDR c_Expr = nlHsVar c_RDR f_Expr = nlHsVar f_RDR z_Expr = nlHsVar z_RDR diff --git a/testsuite/tests/annotations/should_compile/Makefile b/testsuite/tests/deriving/perf/Makefile similarity index 100% copy from testsuite/tests/annotations/should_compile/Makefile copy to testsuite/tests/deriving/perf/Makefile diff --git a/testsuite/tests/deriving/perf/T10858.hs b/testsuite/tests/deriving/perf/T10858.hs new file mode 100644 index 0000000..b4eb7e8 --- /dev/null +++ b/testsuite/tests/deriving/perf/T10858.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE MagicHash #-} + +import GHC.Prim + +data TestData = First Int Double String Int Int Int Int + | Second Char# Int# Word# Double# + | Third TestData TestData TestData TestData + deriving (Eq, Ord) + +main = return () diff --git a/libraries/base/tests/IO/encoding003.stdout b/testsuite/tests/deriving/perf/T10858.stdout similarity index 100% copy from libraries/base/tests/IO/encoding003.stdout copy to testsuite/tests/deriving/perf/T10858.stdout diff --git a/testsuite/tests/deriving/perf/all.T b/testsuite/tests/deriving/perf/all.T new file mode 100644 index 0000000..09f5e93 --- /dev/null +++ b/testsuite/tests/deriving/perf/all.T @@ -0,0 +1,7 @@ +test('T10858', + [compiler_stats_num_field('bytes allocated', + [ (wordsize(64), 641075800, 8) ]), + only_ways(['normal']) + ], + compile, + ['-O']) From git at git.haskell.org Fri Sep 2 07:37:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 2 Sep 2016 07:37:05 +0000 (UTC) Subject: [commit: ghc] master: configure.ac: fix --host= handling (0cc3931) Message-ID: <20160902073705.2A0553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0cc3931bd7831fa8d042f968a5a9114534a656e4/ghc >--------------------------------------------------------------- commit 0cc3931bd7831fa8d042f968a5a9114534a656e4 Author: Sergei Trofimovich Date: Fri Sep 2 08:35:25 2016 +0100 configure.ac: fix --host= handling The following command fails as: $ ./configure --prefix=/usr \ --build=x86_64-pc-linux-gnu \ --host=x86_64-pc-linux-gnu \ --target=x86_64-pc-linux-gnu configure: error: You've selected: BUILD: x86_64-unknown-linux HOST: x86_64-unknown-linux TARGET: x86_64-unknown-linux BUILD must equal HOST; 18f06878ed5d8cb0cf366a876f2bfea29647e5f0 changed native configure $build/$host/$target checks to ghc-mangled ones, but not completely. Signed-off-by: Sergei Trofimovich Reviewers: rwbarton, erikd, austin, hvr, bgamari, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2508 GHC Trac Issues: #12487 >--------------------------------------------------------------- 0cc3931bd7831fa8d042f968a5a9114534a656e4 configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ea3ba4e..0fceb16 100644 --- a/configure.ac +++ b/configure.ac @@ -417,7 +417,7 @@ if test "$TargetPlatform" != "$HostPlatform" ; then # configure: error: cannot run C compiled programs. # If you meant to cross compile, use `--host'. fi -if test "$BuildPlatform" != "$host" ; then +if test "$BuildPlatform" != "$HostPlatform" ; then AC_MSG_ERROR([ You've selected: From git at git.haskell.org Fri Sep 2 08:42:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 2 Sep 2016 08:42:34 +0000 (UTC) Subject: [commit: ghc] master: Fix #10923 by fingerprinting optimization level. (818760d) Message-ID: <20160902084234.9BB713A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/818760d68c0e5e4479a4f64fc863303ff5f23a3a/ghc >--------------------------------------------------------------- commit 818760d68c0e5e4479a4f64fc863303ff5f23a3a Author: Edward Z. Yang Date: Thu Sep 1 15:28:07 2016 -0700 Fix #10923 by fingerprinting optimization level. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonmar, austin, bgamari, thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D2509 GHC Trac Issues: #10923 >--------------------------------------------------------------- 818760d68c0e5e4479a4f64fc863303ff5f23a3a compiler/iface/FlagChecker.hs | 10 ++++++++-- compiler/utils/Binary.hs | 11 +++++++++++ testsuite/tests/driver/Makefile | 7 +++++++ testsuite/tests/driver/T10923.hs | 1 + testsuite/tests/driver/all.T | 5 +++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs index ca8cf28..b3f3758 100644 --- a/compiler/iface/FlagChecker.hs +++ b/compiler/iface/FlagChecker.hs @@ -45,8 +45,14 @@ fingerprintDynFlags dflags at DynFlags{..} this_mod nameio = -- -fprof-auto etc. prof = if gopt Opt_SccProfilingOn dflags then fromEnum profAuto else 0 - in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths)) $ - computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof) + -- -O, see https://ghc.haskell.org/trac/ghc/ticket/10923 + opt = if hscTarget == HscInterpreted || + hscTarget == HscNothing + then 0 + else optLevel + + in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths, prof, opt)) $ + computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof, opt) {- Note [path flags and recompilation] diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 9f7c03d..c3814cd 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -420,6 +420,17 @@ instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f) => Binary f <- get bh return (a,b,c,d,e,f) +instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g) => Binary (a,b,c,d,e,f,g) where + put_ bh (a,b,c,d,e,f,g) = do put_ bh a; put_ bh b; put_ bh c; put_ bh d; put_ bh e; put_ bh f; put_ bh g + get bh = do a <- get bh + b <- get bh + c <- get bh + d <- get bh + e <- get bh + f <- get bh + g <- get bh + return (a,b,c,d,e,f,g) + instance Binary a => Binary (Maybe a) where put_ bh Nothing = putByte bh 0 put_ bh (Just a) = do putByte bh 1; put_ bh a diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile index 8069331..4e9ef20 100644 --- a/testsuite/tests/driver/Makefile +++ b/testsuite/tests/driver/Makefile @@ -629,3 +629,10 @@ T12135: cp T12135b.h T12135b/T12135.h "$(TEST_HC)" $(TEST_HC_OPTS) -IT12135b -IT12135a --make T12135.hs ./T12135 + +.PHONY: T10923 +T10923: + $(RM) -rf T10923.o T10923.hi + "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O0 -c T10923.hs + # should NOT output "compilation is NOT required" + "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O -c T10923.hs diff --git a/testsuite/tests/driver/T10923.hs b/testsuite/tests/driver/T10923.hs new file mode 100644 index 0000000..8e2ddcd --- /dev/null +++ b/testsuite/tests/driver/T10923.hs @@ -0,0 +1 @@ +module T10923 where diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index ebd1b5a..c6283df 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -492,3 +492,8 @@ test('T12135', ['$MAKE -s --no-print-directory T12135']) test('T12192', normal, run_command, ['mkdir foo && (cd foo && {compiler} -v0 ../T12192)']) + +test('T10923', + extra_clean(['T10923.o', 'T10923.hi']), + run_command, + ['$MAKE -s --no-print-directory T10923']) From git at git.haskell.org Fri Sep 2 09:51:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 2 Sep 2016 09:51:45 +0000 (UTC) Subject: [commit: ghc] master: Typos in notes (36bba47) Message-ID: <20160902095145.E4E8C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/36bba475130509d6fe531277770b4c8226361961/ghc >--------------------------------------------------------------- commit 36bba475130509d6fe531277770b4c8226361961 Author: ggreif Date: Mon Jun 15 18:10:24 2015 +0200 Typos in notes >--------------------------------------------------------------- 36bba475130509d6fe531277770b4c8226361961 compiler/typecheck/TcSMonad.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 687168b..7da1939 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -1631,7 +1631,7 @@ After solving the Givens we take two things out of the inert set We get [D] 1 <= n, and we must remove it! Otherwise we unflatten it more then once, and assign to its fmv more than once...disaster. - It's ok to remove them because they turned not not to + It's ok to remove them because they turned out not to yield an insoluble, and hence have now done their work. -} From git at git.haskell.org Fri Sep 2 10:51:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 2 Sep 2016 10:51:03 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-solver-branch' created Message-ID: <20160902105103.3B7143A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/spj-solver-branch Referencing: 88e4652b545085e2f3e2b19dc5596ff89eafc293 From git at git.haskell.org Fri Sep 2 10:51:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 2 Sep 2016 10:51:05 +0000 (UTC) Subject: [commit: ghc] wip/spj-solver-branch: Fixing the constraint solver (88e4652) Message-ID: <20160902105105.EFF6E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-solver-branch Link : http://ghc.haskell.org/trac/ghc/changeset/88e4652b545085e2f3e2b19dc5596ff89eafc293/ghc >--------------------------------------------------------------- commit 88e4652b545085e2f3e2b19dc5596ff89eafc293 Author: Simon Peyton Jones Date: Fri Sep 2 11:09:58 2016 +0100 Fixing the constraint solver This is in-flight work on fixing the constraint solver. In particular I'm working on situations where the constraint solver loops, which should never happen #12386 (only loosely related) #12522 #12526 #12444 #12538 This is NOT DONE and not ready for review. I'm just committing it so I don't lose it. Current status Unexpected failures: hsc2hs/T12504.run T12504 [bad stdout] (normal) indexed-types/should_fail/T4179.run T4179 [stderr mismatch] (normal) perf/compiler/T5837.run T5837 [stderr mismatch] (normal) >--------------------------------------------------------------- 88e4652b545085e2f3e2b19dc5596ff89eafc293 compiler/typecheck/TcCanonical.hs | 63 +++------ compiler/typecheck/TcFlatten.hs | 153 +++++++++++++-------- compiler/typecheck/TcInteract.hs | 70 ++++++---- compiler/typecheck/TcRnTypes.hs | 3 +- compiler/typecheck/TcSMonad.hs | 62 ++++++--- .../tests/indexed-types/should_fail/T1897b.stderr | 2 +- .../tests/indexed-types/should_fail/T2544.stderr | 24 +--- .../tests/indexed-types/should_fail/T2627b.stderr | 4 +- .../tests/indexed-types/should_fail/T3330c.stderr | 6 +- .../tests/indexed-types/should_fail/T6123.stderr | 6 +- testsuite/tests/indexed-types/should_fail/T7786.hs | 16 ++- .../tests/indexed-types/should_fail/T7786.stderr | 43 +++--- .../tests/indexed-types/should_fail/T8227.stderr | 11 +- testsuite/tests/perf/compiler/all.T | 7 +- .../tests/typecheck/should_fail/ContextStack2.hs | 2 + .../typecheck/should_fail/ContextStack2.stderr | 13 -- testsuite/tests/typecheck/should_fail/T5853.stderr | 31 +++-- testsuite/tests/typecheck/should_fail/T8883.stderr | 2 +- testsuite/tests/typecheck/should_fail/T9260.stderr | 11 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- 20 files changed, 291 insertions(+), 240 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 88e4652b545085e2f3e2b19dc5596ff89eafc293 From git at git.haskell.org Fri Sep 2 12:59:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 2 Sep 2016 12:59:27 +0000 (UTC) Subject: [commit: ghc] master: Protect StablPtr dereference with the StaticPtr table lock. (33d3527) Message-ID: <20160902125927.F3A0B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/33d3527b7c6578bcb6dfa4d0657d0333de36d2df/ghc >--------------------------------------------------------------- commit 33d3527b7c6578bcb6dfa4d0657d0333de36d2df Author: Facundo Domínguez Date: Thu Sep 1 16:31:26 2016 -0300 Protect StablPtr dereference with the StaticPtr table lock. Summary: Also comment on the need to use stgMallocBytes in StaticPtrTable.c. Test Plan: ./validate Reviewers: erikd, austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2506 >--------------------------------------------------------------- 33d3527b7c6578bcb6dfa4d0657d0333de36d2df rts/StaticPtrTable.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rts/StaticPtrTable.c b/rts/StaticPtrTable.c index f7fe066..57ade5b 100644 --- a/rts/StaticPtrTable.c +++ b/rts/StaticPtrTable.c @@ -43,6 +43,9 @@ void hs_spt_insert(StgWord64 key[2],void *spe_closure) { #endif } + // Cannot remove this indirection yet because getStablePtr() + // might return NULL, in which case hs_spt_lookup() returns NULL + // instead of the actual closure pointer. StgStablePtr * entry = stgMallocBytes( sizeof(StgStablePtr) , "hs_spt_insert: entry" ); @@ -72,8 +75,8 @@ StgPtr hs_spt_lookup(StgWord64 key[2]) { if (spt) { ACQUIRE_LOCK(&spt_lock); const StgStablePtr * entry = lookupHashTable(spt, (StgWord)key); - RELEASE_LOCK(&spt_lock); const StgPtr ret = entry ? deRefStablePtr(*entry) : NULL; + RELEASE_LOCK(&spt_lock); return ret; } else return NULL; From git at git.haskell.org Fri Sep 2 17:14:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 2 Sep 2016 17:14:40 +0000 (UTC) Subject: [commit: ghc] master: ghc-cabal: accept EXTRA_HC_OPTS make variable (133a5cc) Message-ID: <20160902171440.40A523A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/133a5cc6647a2ea5a63b8d81f9f357f89cb541ef/ghc >--------------------------------------------------------------- commit 133a5cc6647a2ea5a63b8d81f9f357f89cb541ef Author: Sergei Trofimovich Date: Fri Sep 2 18:04:03 2016 +0100 ghc-cabal: accept EXTRA_HC_OPTS make variable Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 133a5cc6647a2ea5a63b8d81f9f357f89cb541ef utils/ghc-cabal/ghc.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index 62338ee..38f7951 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -63,7 +63,8 @@ $(ghc-cabal_DIST_BINARY): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. b -ilibraries/binary/src -DGENERICS \ -ilibraries/filepath \ -ilibraries/hpc \ - $(utils/ghc-cabal_dist_EXTRA_HC_OPTS) + $(utils/ghc-cabal_dist_EXTRA_HC_OPTS) \ + $(EXTRA_HC_OPTS) "$(TOUCH_CMD)" $@ endif From git at git.haskell.org Fri Sep 2 20:45:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 2 Sep 2016 20:45:28 +0000 (UTC) Subject: [commit: ghc] master: extend '-fmax-worker-args' limit to specialiser (Trac #11565) (f93c363) Message-ID: <20160902204528.AA1413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f93c363fab1ac8ce6f0b474f5967b0b097995827/ghc >--------------------------------------------------------------- commit f93c363fab1ac8ce6f0b474f5967b0b097995827 Author: Sergei Trofimovich Date: Fri Sep 2 18:47:56 2016 +0100 extend '-fmax-worker-args' limit to specialiser (Trac #11565) It's a complementary change to a48de37dcca98e7d477040b0ed298bcd1b3ab303 restore -fmax-worker-args handling (Trac #11565) I don't have a small example but I've noticed another discrepancy when was profiling GHC for performance cmmExprNative :: ReferenceKind -> CmmExpr -> CmmOptM CmmExpr was specialised by 'spec_one' down to a function with arity 159. As a result 'perf record' pointed at it as at slowest function in whole ghc library. I've extended -fmax-worker-args effect to 'spec_one' as it does the same worker/wrapper split to push arguments to the heap. The change decreases heap usage on a synth.bash benchmark (Trac #9221) from 67G down to 64G (-4%). Benchmark runtime decreased from 14.5 s down to 14.s (-7%). Signed-off-by: Sergei Trofimovich Reviewers: ezyang, simonpj, austin, goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2507 GHC Trac Issues: #11565 >--------------------------------------------------------------- f93c363fab1ac8ce6f0b474f5967b0b097995827 compiler/specialise/SpecConstr.hs | 12 ++++++++---- compiler/stranal/WwLib.hs | 14 +++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 8cc393c..1cf3d44 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -29,7 +29,7 @@ import CoreFVs ( exprsFreeVarsList ) import CoreMonad import Literal ( litIsLifted ) import HscTypes ( ModGuts(..) ) -import WwLib ( mkWorkerArgs ) +import WwLib ( isWorkerSmallEnough, mkWorkerArgs ) import DataCon import Coercion hiding( substCo ) import Rules @@ -1533,10 +1533,14 @@ specialise env bind_calls (RI { ri_fn = fn, ri_lam_bndrs = arg_bndrs | Just all_calls <- lookupVarEnv bind_calls fn = -- pprTrace "specialise entry {" (ppr fn <+> ppr (length all_calls)) $ - do { (boring_call, pats) <- callsToPats env specs arg_occs all_calls - + do { (boring_call, all_pats) <- callsToPats env specs arg_occs all_calls -- Bale out if too many specialisations - ; let n_pats = length pats + ; let pats = filter (is_small_enough . fst) all_pats + is_small_enough vars = isWorkerSmallEnough (sc_dflags env) vars + -- We are about to construct w/w pair in 'spec_one'. + -- Omit specialisation leading to high arity workers. + -- See Note [Limit w/w arity] + n_pats = length pats spec_count' = n_pats + spec_count ; case sc_count env of Just max | not (sc_force env) && spec_count' > max diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs index 1a09605..64de0e0 100644 --- a/compiler/stranal/WwLib.hs +++ b/compiler/stranal/WwLib.hs @@ -8,6 +8,7 @@ module WwLib ( mkWwBodies, mkWWstr, mkWorkerArgs , deepSplitProductType_maybe, findTypeShape + , isWorkerSmallEnough ) where #include "HsVersions.h" @@ -143,7 +144,8 @@ mkWwBodies dflags fam_envs fun_ty demands res_info wrapper_body = wrap_fn_args . wrap_fn_cpr . wrap_fn_str . applyToVars work_call_args . Var worker_body = mkLams work_lam_args. work_fn_str . work_fn_cpr . work_fn_args - ; if is_small_enough work_args && (useful1 && not only_one_void_argument || useful2) + ; if isWorkerSmallEnough dflags work_args + && (useful1 && not only_one_void_argument || useful2) then return (Just (worker_args_dmds, wrapper_body, worker_body)) else return Nothing } @@ -163,10 +165,12 @@ mkWwBodies dflags fam_envs fun_ty demands res_info = True | otherwise = False - is_small_enough args = count isId args <= maxWorkerArgs dflags - -- See Note [Limit w/w arity] - -- We count only Free variables (isId) to skip Type, Kind - -- variables which have no runtime representation. + +-- See Note [Limit w/w arity] +isWorkerSmallEnough :: DynFlags -> [Var] -> Bool +isWorkerSmallEnough dflags vars = count isId vars <= maxWorkerArgs dflags + -- We count only Free variables (isId) to skip Type, Kind + -- variables which have no runtime representation. {- Note [Always do CPR w/w] From git at git.haskell.org Sat Sep 3 12:45:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 3 Sep 2016 12:45:24 +0000 (UTC) Subject: [commit: ghc] master: Typo in comment (ac2ded3) Message-ID: <20160903124524.0BD023A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ac2ded39017714bb5a0124b60dddcb493dd308d1/ghc >--------------------------------------------------------------- commit ac2ded39017714bb5a0124b60dddcb493dd308d1 Author: Gabor Greif Date: Sat Sep 3 14:44:48 2016 +0200 Typo in comment >--------------------------------------------------------------- ac2ded39017714bb5a0124b60dddcb493dd308d1 compiler/main/GhcMake.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 9197b2c..0705b14 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -1831,7 +1831,7 @@ summariseFile hsc_env old_summaries file mb_phase obj_allowed maybe_buf get_src_timestamp = case maybe_buf of Just (_,t) -> return t Nothing -> liftIO $ getModificationUTCTime file - -- getMofificationUTCTime may fail + -- getModificationUTCTime may fail new_summary src_timestamp = do let dflags = hsc_dflags hsc_env From git at git.haskell.org Sat Sep 3 14:15:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 3 Sep 2016 14:15:41 +0000 (UTC) Subject: [commit: ghc] wip/T5642: Adjust the expected allocations for perf/compiler/T5642 (4723694) Message-ID: <20160903141541.B66CB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T5642 Link : http://ghc.haskell.org/trac/ghc/changeset/4723694b69a7ad5998c30be83ea3481c807e3c9b/ghc >--------------------------------------------------------------- commit 4723694b69a7ad5998c30be83ea3481c807e3c9b Author: Ryan Scott Date: Sat Sep 3 10:11:03 2016 -0400 Adjust the expected allocations for perf/compiler/T5642 >--------------------------------------------------------------- 4723694b69a7ad5998c30be83ea3481c807e3c9b testsuite/tests/perf/compiler/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 0ecc7c2..d8a88c1 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -554,7 +554,7 @@ test('T5642', # 2014-12-10: 641085256 Improvements in constraints solver # 2016-04-06: 462677300 - (wordsize(64), 916484672, 10)]) + (wordsize(64), 838316496, 10)]) # prev: 1300000000 # 2014-07-17: 1358833928 (general round of updates) # 2014-08-07: 1402242360 (caused by 1fc60ea) @@ -570,6 +570,7 @@ test('T5642', # 2016-02-08: 950004816 Pattern match checker re-rework # 2016-05-12: 1300685592 Make Generic1 poly-kinded # 2016-06-05: 916484672 Refactor derived Generic instances to reduce allocations + # 2016-09-03: 838316496 Derive the Generic instance in perf/compiler/T5642 ], compile,['-O']) From git at git.haskell.org Sat Sep 3 15:12:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 3 Sep 2016 15:12:13 +0000 (UTC) Subject: [commit: ghc] master: Fix comment about result (57aa6bb) Message-ID: <20160903151213.607643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/57aa6bb044a3eb46f485e703bcd3b4441959958a/ghc >--------------------------------------------------------------- commit 57aa6bb044a3eb46f485e703bcd3b4441959958a Author: Gabor Greif Date: Sat Sep 3 17:10:49 2016 +0200 Fix comment about result >--------------------------------------------------------------- 57aa6bb044a3eb46f485e703bcd3b4441959958a compiler/iface/MkIface.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 4c44e25..8115583 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -1089,7 +1089,7 @@ checkFlagHash hsc_env iface = do -- - a new home module has been added that shadows a package module -- See bug #1372. -- --- Returns True if recompilation is required. +-- Returns (RecompBecause ) if recompilation is required. checkDependencies :: HscEnv -> ModSummary -> ModIface -> IfG RecompileRequired checkDependencies hsc_env summary iface = checkList (map dep_missing (ms_imps summary ++ ms_srcimps summary)) From git at git.haskell.org Sun Sep 4 11:04:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 4 Sep 2016 11:04:57 +0000 (UTC) Subject: [commit: ghc] master: test #12567: add new testcase with expected plugin behaviour (f8b139f) Message-ID: <20160904110457.9D5873A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f8b139fd11611694aed0bbf8e4ee009ae91ef566/ghc >--------------------------------------------------------------- commit f8b139fd11611694aed0bbf8e4ee009ae91ef566 Author: Gabor Greif Date: Sun Sep 4 12:13:54 2016 +0200 test #12567: add new testcase with expected plugin behaviour >--------------------------------------------------------------- f8b139fd11611694aed0bbf8e4ee009ae91ef566 testsuite/driver/extra_files.py | 1 + testsuite/tests/plugins/Makefile | 6 ++++++ testsuite/tests/plugins/T12567a.hs | 3 +++ testsuite/tests/plugins/T12567a.stderr | 6 ++++++ testsuite/tests/plugins/T12567b.hs | 4 ++++ testsuite/tests/plugins/all.T | 6 ++++++ 6 files changed, 26 insertions(+) diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py index f1dbcb5..5af9695 100644 --- a/testsuite/driver/extra_files.py +++ b/testsuite/driver/extra_files.py @@ -426,6 +426,7 @@ extra_src_files = { 'plugins05': ['HomePackagePlugin.hs'], 'plugins06': ['LinkerTicklingPlugin.hs'], 'plugins07': ['rule-defining-plugin/'], + 'T12567a': ['T12567b.hs', 'simple-plugin/'], 'print002': ['../Test.hs'], 'print003': ['../Test.hs'], 'print005': ['../QSort.hs'], diff --git a/testsuite/tests/plugins/Makefile b/testsuite/tests/plugins/Makefile index 28d3ae8..d0cdca6 100644 --- a/testsuite/tests/plugins/Makefile +++ b/testsuite/tests/plugins/Makefile @@ -41,3 +41,9 @@ frontend01: .PHONY: T11244 T11244: ! "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v0 -O T11244.hs -package-db rule-defining-plugin/pkg.T11244/local.package.conf -hide-all-plugin-packages -package rule-defining-plugin -fplugin=RuleDefiningPlugin + +.PHONY: T12567a +T12567a: + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make T12567a.hs -package-db simple-plugin/pkg.T12567a/local.package.conf -hide-all-plugin-packages -plugin-package simple-plugin 1>&2 + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make -v T12567a.hs -package-db simple-plugin/pkg.T12567a/local.package.conf -hide-all-plugin-packages -plugin-package simple-plugin 2>&1 | grep "T12567a.hs, T12567a.o" 1>&2 + "$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --make T12567b.hs -package-db simple-plugin/pkg.T12567a/local.package.conf -hide-all-plugin-packages -plugin-package simple-plugin 1>&2 diff --git a/testsuite/tests/plugins/T12567a.hs b/testsuite/tests/plugins/T12567a.hs new file mode 100644 index 0000000..5138ed0 --- /dev/null +++ b/testsuite/tests/plugins/T12567a.hs @@ -0,0 +1,3 @@ +{-# OPTIONS -fplugin Simple.Plugin #-} + +module T12567a where diff --git a/testsuite/tests/plugins/T12567a.stderr b/testsuite/tests/plugins/T12567a.stderr new file mode 100644 index 0000000..e8e04c5 --- /dev/null +++ b/testsuite/tests/plugins/T12567a.stderr @@ -0,0 +1,6 @@ +[1 of 1] Compiling T12567a ( T12567a.hs, T12567a.o ) +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run +[1 of 1] Skipping T12567a ( T12567a.hs, T12567a.o ) +[2 of 2] Compiling T12567b ( T12567b.hs, T12567b.o ) diff --git a/testsuite/tests/plugins/T12567b.hs b/testsuite/tests/plugins/T12567b.hs new file mode 100644 index 0000000..6feb57f --- /dev/null +++ b/testsuite/tests/plugins/T12567b.hs @@ -0,0 +1,4 @@ +module T12567b where + +import T12567a + diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T index f165c4a..cca03bc 100644 --- a/testsuite/tests/plugins/all.T +++ b/testsuite/tests/plugins/all.T @@ -70,3 +70,9 @@ test('T11244', clean_cmd('$MAKE -s --no-print-directory -C rule-defining-plugin clean.T11244')], run_command, ['$MAKE -s --no-print-directory T11244']) + +test('T12567a', + [pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.T12567a TOP={top}'), + clean_cmd('$MAKE -s --no-print-directory -C simple-plugin clean.T12567a')], + run_command, + ['$MAKE -s --no-print-directory T12567a']) From git at git.haskell.org Sun Sep 4 11:05:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 4 Sep 2016 11:05:00 +0000 (UTC) Subject: [commit: ghc] master: accept current (problematic) output (1805754) Message-ID: <20160904110500.4A8973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/18057549ffebea244d9170377889d096ca9fdbcd/ghc >--------------------------------------------------------------- commit 18057549ffebea244d9170377889d096ca9fdbcd Author: Gabor Greif Date: Sun Sep 4 12:38:40 2016 +0200 accept current (problematic) output >--------------------------------------------------------------- 18057549ffebea244d9170377889d096ca9fdbcd testsuite/tests/plugins/T12567a.stderr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/plugins/T12567a.stderr b/testsuite/tests/plugins/T12567a.stderr index e8e04c5..aee35e3 100644 --- a/testsuite/tests/plugins/T12567a.stderr +++ b/testsuite/tests/plugins/T12567a.stderr @@ -2,5 +2,9 @@ Simple Plugin Passes Queried Got options: Simple Plugin Pass Run -[1 of 1] Skipping T12567a ( T12567a.hs, T12567a.o ) +[1 of 1] Compiling T12567a ( T12567a.hs, T12567a.o ) [Simple.Plugin changed] +[1 of 2] Compiling T12567a ( T12567a.hs, T12567a.o ) [Simple.Plugin changed] +Simple Plugin Passes Queried +Got options: +Simple Plugin Pass Run [2 of 2] Compiling T12567b ( T12567b.hs, T12567b.o ) From git at git.haskell.org Sun Sep 4 21:11:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 4 Sep 2016 21:11:39 +0000 (UTC) Subject: [commit: ghc] master: cleanup: drop 11 years old performance hack (cdbb9da) Message-ID: <20160904211139.27AF53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cdbb9da7a1330366678c4e29d11a48e591c1ac1e/ghc >--------------------------------------------------------------- commit cdbb9da7a1330366678c4e29d11a48e591c1ac1e Author: Sergei Trofimovich Date: Sun Sep 4 22:08:27 2016 +0100 cleanup: drop 11 years old performance hack The 'return () >>' hack was added in commit commit ac88f113abdec1edbffb6d2f97323e81f82908e7 Date: Tue Jul 26 12:14:03 2005 +0000 Nowadays it has no effect on generated Core on -O1/-O2 and slightly bloats Core on -O0. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- cdbb9da7a1330366678c4e29d11a48e591c1ac1e compiler/utils/Pretty.hs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/compiler/utils/Pretty.hs b/compiler/utils/Pretty.hs index 9849032..5b025d5 100644 --- a/compiler/utils/Pretty.hs +++ b/compiler/utils/Pretty.hs @@ -1018,9 +1018,6 @@ hPutLitString handle a l = if l == 0 -- and async exception-safe. We only have a single thread and don't -- care about exceptions, so we add a layer of fast buffering -- over the Handle interface. --- --- (3) a few hacks in layLeft below to convince GHC to generate the right --- code. printLeftRender :: Handle -> Doc -> IO () printLeftRender hdl doc = do @@ -1031,14 +1028,11 @@ printLeftRender hdl doc = do bufLeftRender :: BufHandle -> Doc -> IO () bufLeftRender b doc = layLeft b (reduceDoc doc) --- HACK ALERT! the "return () >>" below convinces GHC to eta-expand --- this function with the IO state lambda. Otherwise we end up with --- closures in all the case branches. layLeft :: BufHandle -> Doc -> IO () layLeft b _ | b `seq` False = undefined -- make it strict in b layLeft _ NoDoc = error "layLeft: NoDoc" -layLeft b (Union p q) = return () >> layLeft b (first p q) -layLeft b (Nest _ p) = return () >> layLeft b p +layLeft b (Union p q) = layLeft b (first p q) +layLeft b (Nest _ p) = layLeft b p layLeft b Empty = bPutChar b '\n' layLeft b (NilAbove p) = bPutChar b '\n' >> layLeft b p layLeft b (TextBeside s _ p) = put b s >> layLeft b p From git at git.haskell.org Mon Sep 5 13:34:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 13:34:14 +0000 (UTC) Subject: [commit: ghc] master: Don't ignore addTopDecls in module finalizers. (71dd6e4) Message-ID: <20160905133414.0EDD43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/71dd6e4429833238bcdaf96da8e2e41a62dacbf4/ghc >--------------------------------------------------------------- commit 71dd6e4429833238bcdaf96da8e2e41a62dacbf4 Author: Facundo Domínguez Date: Thu Sep 1 11:00:08 2016 -0300 Don't ignore addTopDecls in module finalizers. Summary: Module finalizer could call addTopDecls, however, the declarations added in this fashion were ignored. This patch makes sure to rename, type check and incorporate this declarations. Because a declaration may include a splice which calls addModFinalizer, the list of finalizers is repeteadly checked after adding declarations until no more finalizers remain. Test Plan: ./validate Reviewers: bgamari, goldfire, simonpj, austin Reviewed By: bgamari, simonpj Subscribers: simonmar, mboes, thomie Differential Revision: https://phabricator.haskell.org/D2505 GHC Trac Issues: #12559 >--------------------------------------------------------------- 71dd6e4429833238bcdaf96da8e2e41a62dacbf4 compiler/rename/RnSplice.hs | 1 + compiler/typecheck/TcRnDriver.hs | 24 +++++++++++++++++++++- compiler/typecheck/TcSplice.hs | 10 +++------ testsuite/tests/th/TH_finalizer2.hs | 3 +++ .../T3279.stdout => th/TH_finalizer2.stdout} | 0 testsuite/tests/th/TH_finalizer2M.hs | 9 ++++++++ testsuite/tests/th/all.T | 3 +++ 7 files changed, 42 insertions(+), 8 deletions(-) diff --git a/compiler/rename/RnSplice.hs b/compiler/rename/RnSplice.hs index 1b99376..4b2e561 100644 --- a/compiler/rename/RnSplice.hs +++ b/compiler/rename/RnSplice.hs @@ -654,6 +654,7 @@ rnTopSpliceDecls splice -- -- See Note [Delaying modFinalizers in untyped splices]. add_mod_finalizers_now :: [ForeignRef (TH.Q ())] -> TcRn () + add_mod_finalizers_now [] = return () add_mod_finalizers_now mod_finalizers = do th_modfinalizers_var <- fmap tcg_th_modfinalizers getGblEnv updTcRef th_modfinalizers_var $ \fins -> diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index bd32d80..da8c2a6 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -471,7 +471,8 @@ tcRnSrcDecls :: Bool -- False => no 'module M(..) where' header at all tcRnSrcDecls explicit_mod_hdr decls = do { -- Do all the declarations ; ((tcg_env, tcl_env), lie) <- captureConstraints $ - do { (tcg_env, tcl_env) <- tc_rn_src_decls decls ; + do { envs <- tc_rn_src_decls decls + ; (tcg_env, tcl_env) <- setEnvs envs run_th_modfinalizers -- Check for the 'main' declaration -- Must do this inside the captureConstraints @@ -539,6 +540,27 @@ tcRnSrcDecls explicit_mod_hdr decls } } +#ifdef GHCI +-- | Runs TH finalizers and renames and typechecks the top-level declarations +-- that they could introduce. +run_th_modfinalizers :: TcM (TcGblEnv, TcLclEnv) +run_th_modfinalizers = do + th_modfinalizers_var <- fmap tcg_th_modfinalizers getGblEnv + th_modfinalizers <- readTcRef th_modfinalizers_var + if null th_modfinalizers + then getEnvs + else do + writeTcRef th_modfinalizers_var [] + sequence_ th_modfinalizers + -- Finalizers can add top-level declarations with addTopDecls. + envs <- tc_rn_src_decls [] + -- addTopDecls can add declarations which add new finalizers. + setEnvs envs run_th_modfinalizers +#else +run_th_modfinalizers :: TcM (TcGblEnv, TcLclEnv) +run_th_modfinalizers = getEnvs +#endif /* GHCI */ + tc_rn_src_decls :: [LHsDecl RdrName] -> TcM (TcGblEnv, TcLclEnv) -- Loops around dealing with each top level inter-splice group diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index d879e56..861c370 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -962,16 +962,12 @@ addModFinalizerRef finRef = do pprPanic "addModFinalizer was called when no finalizers were collected" (ppr th_stage) --- | Run all module finalizers +-- | Releases the external interpreter state. finishTH :: TcM () finishTH = do - tcg <- getGblEnv - let th_modfinalizers_var = tcg_th_modfinalizers tcg - modfinalizers <- readTcRef th_modfinalizers_var - writeTcRef th_modfinalizers_var [] - sequence_ modfinalizers dflags <- getDynFlags - when (gopt Opt_ExternalInterpreter dflags) $ + when (gopt Opt_ExternalInterpreter dflags) $ do + tcg <- getGblEnv writeTcRef (tcg_th_remote_state tcg) Nothing runTHExp :: ForeignHValue -> TcM TH.Exp diff --git a/testsuite/tests/th/TH_finalizer2.hs b/testsuite/tests/th/TH_finalizer2.hs new file mode 100644 index 0000000..a233fdb --- /dev/null +++ b/testsuite/tests/th/TH_finalizer2.hs @@ -0,0 +1,3 @@ +import TH_finalizer2M + +main = print (f 0) diff --git a/testsuite/tests/concurrent/should_run/T3279.stdout b/testsuite/tests/th/TH_finalizer2.stdout similarity index 100% copy from testsuite/tests/concurrent/should_run/T3279.stdout copy to testsuite/tests/th/TH_finalizer2.stdout diff --git a/testsuite/tests/th/TH_finalizer2M.hs b/testsuite/tests/th/TH_finalizer2M.hs new file mode 100644 index 0000000..7eea2d8 --- /dev/null +++ b/testsuite/tests/th/TH_finalizer2M.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TemplateHaskell #-} +module TH_finalizer2M where + +import Language.Haskell.TH.Syntax + +g :: IO () +g = $(do addModFinalizer (do d <- [d| f x = (2 :: Int) |]; addTopDecls d) + [| return ()|] + ) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 2cfe2a5..5d2fe3b 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -405,6 +405,9 @@ test('T10820', normal, compile_and_run, ['-v0']) test('T11341', normal, compile, ['-v0 -dsuppress-uniques']) test('T11345', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('TH_finalizer', normal, compile, ['-v0']) +test('TH_finalizer2', + normal, multimod_compile_and_run, + ['TH_finalizer2', '-v0 ' + config.ghc_th_way_flags]) test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) test('T9022', normal, compile_and_run, ['-v0']) From git at git.haskell.org Mon Sep 5 19:29:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 19:29:26 +0000 (UTC) Subject: [commit: ghc] master: Make generated Ord instances smaller (per #10858). (4ff4929) Message-ID: <20160905192926.BCEAA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4ff4929cbaab21a3ca867abbc1bd24ff3287a16f/ghc >--------------------------------------------------------------- commit 4ff4929cbaab21a3ca867abbc1bd24ff3287a16f Author: Petr Prokhorenkov Date: Sun Sep 4 13:23:19 2016 -0400 Make generated Ord instances smaller (per #10858). Reviewers: simonpj, bgamari, RyanGlScott, austin Reviewed By: simonpj Subscribers: nomeata, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2502 GHC Trac Issues: #10858 >--------------------------------------------------------------- 4ff4929cbaab21a3ca867abbc1bd24ff3287a16f compiler/typecheck/TcGenDeriv.hs | 26 +++++++++++++++++----- .../should_compile => deriving/perf}/Makefile | 0 testsuite/tests/deriving/perf/T10858.hs | 10 +++++++++ .../tests/deriving/perf/T10858.stdout | 0 testsuite/tests/deriving/perf/all.T | 7 ++++++ 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index f282733..f378172 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -329,7 +329,7 @@ Several special cases: values we can't call the overloaded functions. See function unliftedOrdOp -Note [Do not rely on compare] +Note [Game plan for deriving Ord] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It's a bad idea to define only 'compare', and build the other binary comparisons on top of it; see Trac #2130, #4019. Reason: we don't @@ -341,8 +341,16 @@ binary result, something like this: True -> False False -> True +This being said, we can get away with generating full code only for +'compare' and '<' thus saving us generation of other three operators. +Other operators can be cheaply expressed through '<': +a <= b = not $ b < a +a > b = b < a +a >= b = not $ a < b + So for sufficiently small types (few constructors, or all nullary) we generate all methods; for large ones we just use 'compare'. + -} data OrdOp = OrdCompare | OrdLT | OrdLE | OrdGE | OrdGT @@ -395,13 +403,21 @@ gen_Ord_binds loc tycon aux_binds | single_con_type = emptyBag | otherwise = unitBag $ DerivAuxBind $ DerivCon2Tag tycon - -- Note [Do not rely on compare] + -- Note [Game plan for deriving Ord] other_ops | (last_tag - first_tag) <= 2 -- 1-3 constructors || null non_nullary_cons -- Or it's an enumeration - = listToBag (map mkOrdOp [OrdLT,OrdLE,OrdGE,OrdGT]) + = listToBag [mkOrdOp OrdLT, lE, gT, gE] | otherwise = emptyBag + negate_expr = nlHsApp (nlHsVar not_RDR) + lE = mk_easy_FunBind loc le_RDR [a_Pat, b_Pat] $ + negate_expr (nlHsApp (nlHsApp (nlHsVar lt_RDR) b_Expr) a_Expr) + gT = mk_easy_FunBind loc gt_RDR [a_Pat, b_Pat] $ + nlHsApp (nlHsApp (nlHsVar lt_RDR) b_Expr) a_Expr + gE = mk_easy_FunBind loc ge_RDR [a_Pat, b_Pat] $ + negate_expr (nlHsApp (nlHsApp (nlHsVar lt_RDR) a_Expr) b_Expr) + get_tag con = dataConTag con - fIRST_TAG -- We want *zero-based* tags, because that's what -- con2Tag returns (generated by untag_Expr)! @@ -2622,11 +2638,11 @@ as_RDRs = [ mkVarUnqual (mkFastString ("a"++show i)) | i <- [(1::Int) .. bs_RDRs = [ mkVarUnqual (mkFastString ("b"++show i)) | i <- [(1::Int) .. ] ] cs_RDRs = [ mkVarUnqual (mkFastString ("c"++show i)) | i <- [(1::Int) .. ] ] -a_Expr, c_Expr, f_Expr, z_Expr, ltTag_Expr, eqTag_Expr, gtTag_Expr, +a_Expr, b_Expr, c_Expr, f_Expr, z_Expr, ltTag_Expr, eqTag_Expr, gtTag_Expr, false_Expr, true_Expr, fmap_Expr, mempty_Expr, foldMap_Expr, traverse_Expr :: LHsExpr RdrName a_Expr = nlHsVar a_RDR --- b_Expr = nlHsVar b_RDR +b_Expr = nlHsVar b_RDR c_Expr = nlHsVar c_RDR f_Expr = nlHsVar f_RDR z_Expr = nlHsVar z_RDR diff --git a/testsuite/tests/annotations/should_compile/Makefile b/testsuite/tests/deriving/perf/Makefile similarity index 100% copy from testsuite/tests/annotations/should_compile/Makefile copy to testsuite/tests/deriving/perf/Makefile diff --git a/testsuite/tests/deriving/perf/T10858.hs b/testsuite/tests/deriving/perf/T10858.hs new file mode 100644 index 0000000..b4eb7e8 --- /dev/null +++ b/testsuite/tests/deriving/perf/T10858.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE MagicHash #-} + +import GHC.Prim + +data TestData = First Int Double String Int Int Int Int + | Second Char# Int# Word# Double# + | Third TestData TestData TestData TestData + deriving (Eq, Ord) + +main = return () diff --git a/libraries/base/tests/IO/encoding003.stdout b/testsuite/tests/deriving/perf/T10858.stdout similarity index 100% copy from libraries/base/tests/IO/encoding003.stdout copy to testsuite/tests/deriving/perf/T10858.stdout diff --git a/testsuite/tests/deriving/perf/all.T b/testsuite/tests/deriving/perf/all.T new file mode 100644 index 0000000..4d5996b --- /dev/null +++ b/testsuite/tests/deriving/perf/all.T @@ -0,0 +1,7 @@ +test('T10858', + [compiler_stats_num_field('bytes allocated', + [ (wordsize(64), 241655120, 8) ]), + only_ways(['normal']) + ], + compile, + ['-O']) From git at git.haskell.org Mon Sep 5 19:29:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 19:29:30 +0000 (UTC) Subject: [commit: ghc] master: Turn divInt# and modInt# into bitwise operations when possible (6ea6242) Message-ID: <20160905192930.2DBBD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ea62427de419ea071e1ea79ad0c15d9f4e90a67/ghc >--------------------------------------------------------------- commit 6ea62427de419ea071e1ea79ad0c15d9f4e90a67 Author: Takano Akio Date: Sun Sep 4 13:22:22 2016 -0400 Turn divInt# and modInt# into bitwise operations when possible This implements #5615 for divInt# and modInt#. I also included rules to do constant-folding when the both arguments are known. Test Plan: validate Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: hvr, thomie Differential Revision: https://phabricator.haskell.org/D2486 GHC Trac Issues: #5615 >--------------------------------------------------------------- 6ea62427de419ea071e1ea79ad0c15d9f4e90a67 compiler/cmm/CmmOpt.hs | 21 +------------------ compiler/prelude/PrelNames.hs | 12 ++++++++++- compiler/prelude/PrelRules.hs | 21 ++++++++++++++++++- compiler/prelude/primops.txt.pp | 8 ++++++-- compiler/utils/Util.hs | 24 ++++++++++++++++++++++ libraries/ghc-prim/GHC/Classes.hs | 3 +++ testsuite/tests/simplCore/should_compile/Makefile | 10 +++++++++ testsuite/tests/simplCore/should_compile/T5615.hs | 10 +++++++++ .../should_compile/T5615.stdout} | 0 testsuite/tests/simplCore/should_compile/all.T | 1 + 10 files changed, 86 insertions(+), 24 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6ea62427de419ea071e1ea79ad0c15d9f4e90a67 From git at git.haskell.org Mon Sep 5 19:29:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 19:29:32 +0000 (UTC) Subject: [commit: ghc] master: Less scary arity mismatch error message when deriving (8d00175) Message-ID: <20160905192932.D68773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d00175f4ba969ca5f4edf26b0e8593a79d4f508/ghc >--------------------------------------------------------------- commit 8d00175f4ba969ca5f4edf26b0e8593a79d4f508 Author: mniip Date: Sun Sep 4 13:23:03 2016 -0400 Less scary arity mismatch error message when deriving Test Plan: Corrected a few tests to include the new message. Reviewers: goldfire, austin, bgamari Reviewed By: bgamari Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2484 GHC Trac Issues: #12546 >--------------------------------------------------------------- 8d00175f4ba969ca5f4edf26b0e8593a79d4f508 compiler/typecheck/TcDeriv.hs | 9 ++++++++- compiler/typecheck/TcHsType.hs | 17 ++++++++--------- testsuite/tests/deriving/should_fail/T7959.stderr | 2 +- testsuite/tests/deriving/should_fail/drvfail005.stderr | 4 +--- testsuite/tests/deriving/should_fail/drvfail009.stderr | 4 +--- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index e38cfdc..7284600 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -612,7 +612,7 @@ deriveTyData :: [TyVar] -> TyCon -> [Type] -- LHS of data or data instance -- I.e. not standalone deriving deriveTyData tvs tc tc_args deriv_pred = setSrcSpan (getLoc (hsSigType deriv_pred)) $ -- Use loc of the 'deriving' item - do { (deriv_tvs, cls, cls_tys, cls_arg_kind) + do { (deriv_tvs, cls, cls_tys, cls_arg_kinds) <- tcExtendTyVarEnv tvs $ tcHsDeriv deriv_pred -- Deriving preds may (now) mention @@ -623,6 +623,9 @@ deriveTyData tvs tc tc_args deriv_pred -- Typeable is special, because Typeable :: forall k. k -> Constraint -- so the argument kind 'k' is not decomposable by splitKindFunTys -- as is the case for all other derivable type classes + ; when (length cls_arg_kinds /= 1) $ + failWithTc (nonUnaryErr deriv_pred) + ; let [cls_arg_kind] = cls_arg_kinds ; if className cls == typeableClassName then do warnUselessTypeable return [] @@ -1305,6 +1308,10 @@ checkSideConditions dflags mtheta cls cls_tys rep_tc classArgsErr :: Class -> [Type] -> SDoc classArgsErr cls cls_tys = quotes (ppr (mkClassPred cls cls_tys)) <+> text "is not a class" +nonUnaryErr :: LHsSigType Name -> SDoc +nonUnaryErr ct = quotes (ppr ct) + <+> text "is not a unary constraint, as expected by a deriving clause" + nonStdErr :: Class -> SDoc nonStdErr cls = quotes (ppr cls) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index ad1f3ba..058eab2 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -226,26 +226,25 @@ tc_hs_sig_type (HsIB { hsib_body = hs_ty ; return (mkSpecForAllTys tkvs ty) } ----------------- -tcHsDeriv :: LHsSigType Name -> TcM ([TyVar], Class, [Type], Kind) +tcHsDeriv :: LHsSigType Name -> TcM ([TyVar], Class, [Type], [Kind]) -- Like tcHsSigType, but for the ...deriving( C t1 ty2 ) clause --- Returns the C, [ty1, ty2, and the kind of C's *next* argument +-- Returns the C, [ty1, ty2, and the kinds of C's remaining arguments -- E.g. class C (a::*) (b::k->k) -- data T a b = ... deriving( C Int ) --- returns ([k], C, [k, Int], k->k) --- Also checks that (C ty1 ty2 arg) :: Constraint --- if arg has a suitable kind +-- returns ([k], C, [k, Int], [k->k]) tcHsDeriv hs_ty - = do { arg_kind <- newMetaKindVar + = do { cls_kind <- newMetaKindVar -- always safe to kind-generalize, because there -- can be no covars in an outer scope ; ty <- checkNoErrs $ -- avoid redundant error report with "illegal deriving", below - tc_hs_sig_type hs_ty (mkFunTy arg_kind constraintKind) + tc_hs_sig_type hs_ty cls_kind ; ty <- kindGeneralizeType ty -- also zonks - ; arg_kind <- zonkTcType arg_kind + ; cls_kind <- zonkTcType cls_kind ; let (tvs, pred) = splitForAllTys ty + ; let (args, _) = splitFunTys cls_kind ; case getClassPredTys_maybe pred of - Just (cls, tys) -> return (tvs, cls, tys, arg_kind) + Just (cls, tys) -> return (tvs, cls, tys, args) Nothing -> failWithTc (text "Illegal deriving item" <+> quotes (ppr hs_ty)) } tcHsClsInstType :: UserTypeCtxt -- InstDeclCtxt or SpecInstCtxt diff --git a/testsuite/tests/deriving/should_fail/T7959.stderr b/testsuite/tests/deriving/should_fail/T7959.stderr index 4756f79..254cfed 100644 --- a/testsuite/tests/deriving/should_fail/T7959.stderr +++ b/testsuite/tests/deriving/should_fail/T7959.stderr @@ -4,5 +4,5 @@ T7959.hs:5:1: error: • In the stand-alone deriving instance for ‘A’ T7959.hs:6:17: error: - • Expected kind ‘k0 -> Constraint’, but ‘A’ has kind ‘Constraint’ + • ‘A’ is not a unary constraint, as expected by a deriving clause • In the data declaration for ‘B’ diff --git a/testsuite/tests/deriving/should_fail/drvfail005.stderr b/testsuite/tests/deriving/should_fail/drvfail005.stderr index 4805c14..5f10652 100644 --- a/testsuite/tests/deriving/should_fail/drvfail005.stderr +++ b/testsuite/tests/deriving/should_fail/drvfail005.stderr @@ -1,6 +1,4 @@ drvfail005.hs:4:13: error: - • Expecting one fewer arguments to ‘Show a’ - Expected kind ‘k0 -> Constraint’, - but ‘Show a’ has kind ‘Constraint’ + • ‘Show a’ is not a unary constraint, as expected by a deriving clause • In the data declaration for ‘Test’ diff --git a/testsuite/tests/deriving/should_fail/drvfail009.stderr b/testsuite/tests/deriving/should_fail/drvfail009.stderr index 563bc5a..9c5f9ff 100644 --- a/testsuite/tests/deriving/should_fail/drvfail009.stderr +++ b/testsuite/tests/deriving/should_fail/drvfail009.stderr @@ -1,8 +1,6 @@ drvfail009.hs:10:31: error: - Expecting one more argument to ‘C’ - Expected kind ‘* -> Constraint’, - but ‘C’ has kind ‘* -> * -> Constraint’ + ‘C’ is not a unary constraint, as expected by a deriving clause In the newtype declaration for ‘T1’ drvfail009.hs:13:31: error: From git at git.haskell.org Mon Sep 5 19:48:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 19:48:47 +0000 (UTC) Subject: [commit: ghc] master: Derive the Generic instance in perf/compiler/T5642 (34010db) Message-ID: <20160905194847.3CE543A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/34010dbe77ac405da6c671c3feb3573d0d025379/ghc >--------------------------------------------------------------- commit 34010dbe77ac405da6c671c3feb3573d0d025379 Author: Ryan Scott Date: Mon Sep 5 15:45:38 2016 -0400 Derive the Generic instance in perf/compiler/T5642 Summary: For some inexplicable reason, the `Generic` instance in `perf/compiler/T5642` is written out entirely by hand. This is not only strange, since Trac #5642 is about derived `Generic` instances, but it also annoying to maintain, since it requires manually changing a bunch of code whenever the algorithm behind `deriving Generic` changes. (See D2304 for a recent example of this.) It seems more sensible to just derive the `Generic` instance. It shifts the goalposts of what allocations we're measuring a bit, since we no longer have to parse a large amount of code (and as a knock-on effect, the allocations go down a bit). But I think this program is morally equivalent to what we were benchmarking before, so it's not too unreasonable to change. Test Plan: make test TEST=T5642 Reviewers: austin, thomie, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D2511 GHC Trac Issues: #5642 >--------------------------------------------------------------- 34010dbe77ac405da6c671c3feb3573d0d025379 testsuite/tests/perf/compiler/T5642.hs | 875 +-------------------------------- testsuite/tests/perf/compiler/all.T | 3 +- 2 files changed, 4 insertions(+), 874 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 34010dbe77ac405da6c671c3feb3573d0d025379 From git at git.haskell.org Mon Sep 5 20:30:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 20:30:57 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix #12472 by looking for noinline/lazy inside oversaturated applications. (a8199e8) Message-ID: <20160905203057.55BEC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a8199e8e4c8cb779d9e4225aed0115886d47075c/ghc >--------------------------------------------------------------- commit a8199e8e4c8cb779d9e4225aed0115886d47075c Author: Edward Z. Yang Date: Sat Aug 6 13:47:05 2016 -0700 Fix #12472 by looking for noinline/lazy inside oversaturated applications. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2444 GHC Trac Issues: #12472 (cherry picked from commit 0d3bf62092de83375025edca6f7242812338542d) Note that this diverges slightly from the original commit in that the noinline logic has been removed, since this feature is not present in ghc-8.0. >--------------------------------------------------------------- a8199e8e4c8cb779d9e4225aed0115886d47075c compiler/coreSyn/CorePrep.hs | 186 +++++++++++++++++++++++-------------------- 1 file changed, 101 insertions(+), 85 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a8199e8e4c8cb779d9e4225aed0115886d47075c From git at git.haskell.org Mon Sep 5 20:31:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 20:31:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix binary-trees regression from unnecessary floating in CorePrep. (47d589e) Message-ID: <20160905203100.B68C83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/47d589ef52ded1ab3f81994f6567dac666e08587/ghc >--------------------------------------------------------------- commit 47d589ef52ded1ab3f81994f6567dac666e08587 Author: Edward Z. Yang Date: Tue Aug 30 16:55:58 2016 -0400 Fix binary-trees regression from unnecessary floating in CorePrep. In the previous patch, I handled lazy @(Int -> Int) f x correctly, but failed to handle lazy @Int (f x) (we need to collect arguments in f x). Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin, bgamari, nomeata Reviewed By: nomeata Subscribers: simonmar, thomie Differential Revision: https://phabricator.haskell.org/D2471 (cherry picked from commit 83b326cda759cfd4c538595cf38ee23eb81a4c76) >--------------------------------------------------------------- 47d589ef52ded1ab3f81994f6567dac666e08587 compiler/coreSyn/CorePrep.hs | 44 ++++++++++++++++------ testsuite/tests/simplCore/should_compile/all.T | 1 + testsuite/tests/simplCore/should_compile/par01.hs | 10 +++++ .../tests/simplCore/should_compile/par01.stderr | 33 ++++++++++++++++ 4 files changed, 76 insertions(+), 12 deletions(-) diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs index e2f2812..a3c70fd 100644 --- a/compiler/coreSyn/CorePrep.hs +++ b/compiler/coreSyn/CorePrep.hs @@ -671,13 +671,8 @@ cpeApp :: CorePrepEnv -> CoreExpr -> UniqSM (Floats, CpeRhs) -- May return a CpeRhs because of saturating primops cpeApp top_env expr = do { let (terminal, args, depth) = collect_args expr - ; (head, app, floats) <- cpe_app top_env terminal args depth - - -- Now deal with the function - ; case head of - Just fn_id -> do { sat_app <- maybeSaturate fn_id app depth - ; return (floats, sat_app) } - _other -> return (floats, app) } + ; cpe_app top_env terminal args depth + } where -- We have a nested data structure of the form @@ -705,10 +700,24 @@ cpeApp top_env expr -> CoreExpr -> [CpeArg] -> Int - -> UniqSM (Maybe Id, CpeApp, Floats) + -> UniqSM (Floats, CpeRhs) cpe_app env (Var f) (CpeArg Type{} : CpeArg arg : args) depth | f `hasKey` lazyIdKey -- Replace (lazy a) with a, and - = cpe_app env arg args (depth - 1) + -- Consider the code: + -- + -- lazy (f x) y + -- + -- We need to make sure that we need to recursively collect arguments on + -- "f x", otherwise we'll float "f x" out (it's not a variable) and + -- end up with this awful -ddump-prep: + -- + -- case f x of f_x { + -- __DEFAULT -> f_x y + -- } + -- + -- rather than the far superior "f x y". Test case is par01. + = let (terminal, args', depth') = collect_args arg + in cpe_app env terminal (args' ++ args) (depth + depth' - 1) cpe_app env (Var f) [CpeArg _runtimeRep at Type{}, CpeArg _type at Type{}, CpeArg arg] 1 | f `hasKey` runRWKey -- Replace (runRW# f) by (f realWorld#), beta reducing if possible (this @@ -726,7 +735,7 @@ cpeApp top_env expr -- cpe_ExprIsTrivial). But note that we need the type of the -- expression, not the id. ; (app, floats) <- rebuild_app args e2 (exprType e2) emptyFloats stricts - ; return (hd, app, floats) } + ; mb_saturate hd app floats depth } where stricts = case idStrictness v of StrictSig (DmdType _ demands _) @@ -739,16 +748,27 @@ cpeApp top_env expr -- Here, we can't evaluate the arg strictly, because this -- partial application might be seq'd + -- We inlined into something that's not a var and has no args. + -- Bounce it back up to cpeRhsE. + cpe_app env fun [] _ = cpeRhsE env fun + -- N-variable fun, better let-bind it - cpe_app env fun args _ + cpe_app env fun args depth = do { (fun_floats, fun') <- cpeArg env evalDmd fun ty -- The evalDmd says that it's sure to be evaluated, -- so we'll end up case-binding it ; (app, floats) <- rebuild_app args fun' ty fun_floats [] - ; return (Nothing, app, floats) } + ; mb_saturate Nothing app floats depth } where ty = exprType fun + -- Saturate if necessary + mb_saturate head app floats depth = + case head of + Just fn_id -> do { sat_app <- maybeSaturate fn_id app depth + ; return (floats, sat_app) } + _other -> return (floats, app) + -- Deconstruct and rebuild the application, floating any non-atomic -- arguments to the outside. We collect the type of the expression, -- the head of the application, and the number of actual value arguments, diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 8708548..c276834 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -236,3 +236,4 @@ test('T12212', normal, compile, ['-O']) test('T12076', extra_clean(['T12076a.hi', 'T12076a.o']), multimod_compile, ['T12076', '-v0']) test('T12076lit', normal, compile, ['-O']) test('T12076sat', normal, compile, ['-O']) +test('par01', only_ways(['optasm']), compile, ['-ddump-prep -dsuppress-uniques -O2']) diff --git a/testsuite/tests/simplCore/should_compile/par01.hs b/testsuite/tests/simplCore/should_compile/par01.hs new file mode 100644 index 0000000..e67fb13 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/par01.hs @@ -0,0 +1,10 @@ +module Par01 where + +import GHC.Conc + +-- The smoking gun in -ddump-prep is: +-- case Par01.depth d of sat { __DEFAULT -> sat } +-- this should never happen! + +depth :: Int -> Int +depth d = d `par` depth d diff --git a/testsuite/tests/simplCore/should_compile/par01.stderr b/testsuite/tests/simplCore/should_compile/par01.stderr new file mode 100644 index 0000000..8ec409d --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/par01.stderr @@ -0,0 +1,33 @@ + +==================== CorePrep ==================== +Result size of CorePrep = {terms: 18, types: 8, coercions: 0} + +Rec { +-- RHS size: {terms: 7, types: 3, coercions: 0} +Par01.depth [Occ=LoopBreaker] :: GHC.Types.Int -> GHC.Types.Int +[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType , Unf=OtherCon []] +Par01.depth = + \ (d :: GHC.Types.Int) -> + case GHC.Prim.par# @ GHC.Types.Int d of _ [Occ=Dead] { __DEFAULT -> + Par01.depth d + } +end Rec } + +-- RHS size: {terms: 2, types: 0, coercions: 0} +Par01.$trModule2 :: GHC.Types.TrName +[GblId, Caf=NoCafRefs, Str=DmdType m1, Unf=OtherCon []] +Par01.$trModule2 = GHC.Types.TrNameS "main"# + +-- RHS size: {terms: 2, types: 0, coercions: 0} +Par01.$trModule1 :: GHC.Types.TrName +[GblId, Caf=NoCafRefs, Str=DmdType m1, Unf=OtherCon []] +Par01.$trModule1 = GHC.Types.TrNameS "Par01"# + +-- RHS size: {terms: 3, types: 0, coercions: 0} +Par01.$trModule :: GHC.Types.Module +[GblId, Caf=NoCafRefs, Str=DmdType m, Unf=OtherCon []] +Par01.$trModule = + GHC.Types.Module Par01.$trModule2 Par01.$trModule1 + + + From git at git.haskell.org Mon Sep 5 21:00:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:00:00 +0000 (UTC) Subject: [commit: ghc] master: Make the test for #11108 less fragile (a7a960e) Message-ID: <20160905210000.D88C73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a7a960e43c34e40e1656fa1505605f756a44bb71/ghc >--------------------------------------------------------------- commit a7a960e43c34e40e1656fa1505605f756a44bb71 Author: Takano Akio Date: Mon Sep 5 15:52:37 2016 -0400 Make the test for #11108 less fragile This change should close #11108 by fixing the test case. This commit fixes two issues: * Make sure that each weak pointer we allocate has a constructor as the key, not a thunk. A failure to do so meant these weak pointers died prematurely on the 'ghci' WAY. * Don't print anything in the finalizer, because they are not guaranteed to run. Test Plan: validate Reviewers: austin, simonmar, erikd, bgamari Reviewed By: erikd, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2512 GHC Trac Issues: #11108 >--------------------------------------------------------------- a7a960e43c34e40e1656fa1505605f756a44bb71 testsuite/tests/rts/T11108.hs | 6 +++--- testsuite/tests/rts/all.T | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testsuite/tests/rts/T11108.hs b/testsuite/tests/rts/T11108.hs index d70f333..63e70c1 100644 --- a/testsuite/tests/rts/T11108.hs +++ b/testsuite/tests/rts/T11108.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE RecursiveDo, LambdaCase #-} +{-# LANGUAGE RecursiveDo, LambdaCase, BangPatterns #-} import Control.Monad.Fix import Data.IORef @@ -22,8 +22,8 @@ makePull f = do -- This seems to be the culprit, changing the order makes the weakRef get gc'ed -- In this configuration it crashes - foo <- Pull weak f <$> newIORef [] <*> newIORef Nothing - weak <- mkWeakPtr foo (Just $ print "died") + !foo <- Pull weak f <$> newIORef [] <*> newIORef Nothing + weak <- mkWeakPtr foo Nothing return foo diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index b82036f..9692846 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -267,7 +267,7 @@ test('T9078', only_ways(['threaded1']), compile_and_run, ['']) test('T10017', [ when(opsys('mingw32'), skip) , only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], compile_and_run, ['']) -test('T11108', expect_broken_for(11108, ['ghci', 'hpc']), compile_and_run, ['']) +test('T11108', normal, compile_and_run, ['']) test('rdynamic', [ unless(opsys('linux') or opsys('mingw32'), skip) # this needs runtime infrastructure to do in ghci: From git at git.haskell.org Mon Sep 5 21:00:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:00:03 +0000 (UTC) Subject: [commit: ghc] master: distrib: Fix libdw bindist check (05b497e) Message-ID: <20160905210003.BA29A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/05b497ece50f508526d0906f675bdb4c8109d46a/ghc >--------------------------------------------------------------- commit 05b497ece50f508526d0906f675bdb4c8109d46a Author: Ben Gamari Date: Sun Sep 4 13:23:35 2016 -0400 distrib: Fix libdw bindist check As reported in #12555 this code was terribly broken. Sadly, Autoconf was none-the-wiser. Thanks to @rwbarton for pointing this out. Test Plan: Test with libdw version newer and older and 0.158 Reviewers: hvr, austin, rwbarton Reviewed By: rwbarton Subscribers: thomie, rwbarton, erikd Differential Revision: https://phabricator.haskell.org/D2510 GHC Trac Issues: #12555 >--------------------------------------------------------------- 05b497ece50f508526d0906f675bdb4c8109d46a distrib/configure.ac.in | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 19ea5f0..0ae716b 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -89,17 +89,6 @@ dnl -------------------------------------------------------------- FIND_LD([LdCmd]) AC_SUBST([LdCmd]) -dnl ** Have libdw? -dnl -------------------------------------------------------------- -dnl Check for a usable version of libdw/elfutils -dnl Currently we need 0.158 or newer. -BinDistNeedsLibdw=@UseLibdw@ -if test "x$BinDistNeedsLibdw" = "xyes" ; then - AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES], - [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] - )]; -fi - FP_GCC_VERSION AC_PROG_CPP @@ -153,6 +142,18 @@ dnl ** how to invoke `ar' and `ranlib' FP_PROG_AR_SUPPORTS_ATFILE FP_PROG_AR_NEEDS_RANLIB +dnl ** Have libdw? +dnl -------------------------------------------------------------- +dnl Check for a usable version of libdw/elfutils +dnl Currently we need 0.158 or newer. +BinDistNeedsLibdw=@UseLibdw@ +if test "x$BinDistNeedsLibdw" = "xYES" ; then + AC_CHECK_LIB(dw, dwfl_attach_state, + [UseLibdw=YES], + [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] + ) +fi + FP_SETTINGS # From git at git.haskell.org Mon Sep 5 21:27:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:27:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Add test for #11959 (07a3404) Message-ID: <20160905212710.741A43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/07a3404a9ccf7004abc0c02efd114c2a1f7cbf77/ghc >--------------------------------------------------------------- commit 07a3404a9ccf7004abc0c02efd114c2a1f7cbf77 Author: Ben Gamari Date: Tue May 3 22:58:47 2016 +0200 testsuite: Add test for #11959 Test Plan: Validate, expected to fail Reviewers: goldfire, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2132 GHC Trac Issues: #11959 (cherry picked from commit 4f2afe1e674606230f2dc2f8ce040a2bd345a647) >--------------------------------------------------------------- 07a3404a9ccf7004abc0c02efd114c2a1f7cbf77 testsuite/tests/patsyn/should_compile/T11959.hs | 6 ++++++ testsuite/tests/patsyn/should_compile/T11959.stdout | 3 +++ testsuite/tests/patsyn/should_compile/T11959Lib.hs | 11 +++++++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + 4 files changed, 21 insertions(+) diff --git a/testsuite/tests/patsyn/should_compile/T11959.hs b/testsuite/tests/patsyn/should_compile/T11959.hs new file mode 100644 index 0000000..ccff2e0 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T11959.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE PatternSynonyms #-} +module Main where + +import T11959Lib (Vec2(..), pattern (:>)) + +main = return () diff --git a/testsuite/tests/patsyn/should_compile/T11959.stdout b/testsuite/tests/patsyn/should_compile/T11959.stdout new file mode 100644 index 0000000..01c0f01 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T11959.stdout @@ -0,0 +1,3 @@ + +T11959Lib.hs:2:35: warning: [-Wduplicate-exports (in -Wdefault)] + ‘:>’ is exported by ‘(:>)’ and ‘Vec2(Nil, type (:>))’ diff --git a/testsuite/tests/patsyn/should_compile/T11959Lib.hs b/testsuite/tests/patsyn/should_compile/T11959Lib.hs new file mode 100644 index 0000000..4c00721 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T11959Lib.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE PatternSynonyms, ViewPatterns #-} +module T11959Lib (Vec2(Nil,(:>)), pattern (:>)) where + +newtype Vec2 a = Vec2 {unvec2 :: [a]} + +pattern Nil :: Vec2 a +pattern Nil = Vec2 [] + +pattern (:>) x xs <- ((\ys -> (head $ unvec2 ys,Vec2 . tail $ unvec2 ys)) -> (x,xs)) + where + (:>) x xs = Vec2 (x:unvec2 xs) diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 00d3b87..9bb4f59 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -54,3 +54,4 @@ test('T11633', normal, compile, ['']) test('T12094', normal, compile, ['']) test('T12484', normal, compile, ['']) test('T12489', normal, compile, ['']) +test('T11959', expect_broken(11959), multimod_compile, ['T11959', '-v0']) From git at git.haskell.org Mon Sep 5 21:27:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:27:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Use the correct return type for Windows' send()/recv() (Fix #12010) (2a6ac3f) Message-ID: <20160905212714.718F93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/2a6ac3f18dc6e8abc779b8fbc7232e972f4a8a7d/ghc >--------------------------------------------------------------- commit 2a6ac3f18dc6e8abc779b8fbc7232e972f4a8a7d Author: Tamar Christina Date: Thu May 19 21:48:53 2016 +0200 Use the correct return type for Windows' send()/recv() (Fix #12010) Summary: They return signed 32 bit ints on Windows, even on a 64 bit OS, rather than Linux's 64 bit ssize_t. This means when recv() returned -1 to signal an error we thought it was 4294967295. It was converted to an int, -1 and the buffer was memcpy'd which caused a segfault. Other bad stuff happened with send()s. See also note CSsize in System.Posix.Internals. Add a test for #12010 Test Plan: - GHC testsuite (T12010) - http-conduit test (https://github.com/snoyberg/http-client/issues/191) Reviewers: austin, hvr, bgamari, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2170 GHC Trac Issues: #12010 (cherry picked from commit 1ee47c1bfa35c7be435adaec5c1fa9ec92cc776d) >--------------------------------------------------------------- 2a6ac3f18dc6e8abc779b8fbc7232e972f4a8a7d libraries/base/GHC/IO/FD.hs | 16 ++++---- libraries/base/System/Posix/Internals.hs | 41 ++++++++++----------- libraries/base/tests/IO/T12010/Makefile | 10 +++++ libraries/base/tests/IO/T12010/T12010.hsc | 40 ++++++++++++++++++++ libraries/base/tests/IO/T12010/T12010.stdout | 2 + libraries/base/tests/IO/T12010/cbits/initWinSock.c | 43 ++++++++++++++++++++++ libraries/base/tests/IO/T12010/test.T | 8 ++++ 7 files changed, 131 insertions(+), 29 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2a6ac3f18dc6e8abc779b8fbc7232e972f4a8a7d From git at git.haskell.org Mon Sep 5 21:27:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:27:17 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix failing T12010 (a81801f) Message-ID: <20160905212717.465A33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a81801f90a4af84a8196fb56eaadffbc4a331f5c/ghc >--------------------------------------------------------------- commit a81801f90a4af84a8196fb56eaadffbc4a331f5c Author: Tamar Christina Date: Sat May 21 10:23:59 2016 -0400 Fix failing T12010 Summary: T12010 seems to be failing because it can't find the correct paths. This gives the test some more qualified paths. Test Plan: make TEST=12010 Reviewers: hvr, bgamari, austin, thomie Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D2252 GHC Trac Issues: #12010 (cherry picked from commit a1f3bb8ca454f05fa35cb6b5c64e92f640380802) >--------------------------------------------------------------- a81801f90a4af84a8196fb56eaadffbc4a331f5c libraries/base/tests/IO/T12010/Makefile | 7 ++++--- libraries/base/tests/IO/T12010/T12010.stdout | 2 -- libraries/base/tests/IO/T12010/test.T | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libraries/base/tests/IO/T12010/Makefile b/libraries/base/tests/IO/T12010/Makefile index 112e1f1..b924de2 100644 --- a/libraries/base/tests/IO/T12010/Makefile +++ b/libraries/base/tests/IO/T12010/Makefile @@ -1,10 +1,11 @@ TOP=../../../../../testsuite include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk +TESTDIR=$(TOP)/../libraries/base/tests/IO/T12010 .PHONY: T12010 T12010: - '$(HSC2HS)' -I ../../../include/ -I ../../../../../includes/ T12010.hsc - '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -c cbits/initWinSock.c - '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -fno-warn-unsupported-calling-conventions cbits/initWinSock.o T12010.hs + '$(HSC2HS)' -I $(TOP)/../libraries/base/include/ -I $(TOP)/../includes/ T12010.hsc + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -c $(TESTDIR)/cbits/initWinSock.c + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -fno-warn-unsupported-calling-conventions $(TESTDIR)/cbits/initWinSock.o $(TESTDIR)/T12010.hs ./T12010 diff --git a/libraries/base/tests/IO/T12010/T12010.stdout b/libraries/base/tests/IO/T12010/T12010.stdout deleted file mode 100644 index dec7b86..0000000 --- a/libraries/base/tests/IO/T12010/T12010.stdout +++ /dev/null @@ -1,2 +0,0 @@ -[1 of 1] Compiling Main ( T12010.hs, T12010.o ) -Linking T12010 ... diff --git a/libraries/base/tests/IO/T12010/test.T b/libraries/base/tests/IO/T12010/test.T index 178814f..ecf4828 100644 --- a/libraries/base/tests/IO/T12010/test.T +++ b/libraries/base/tests/IO/T12010/test.T @@ -3,6 +3,8 @@ test('T12010', extra_clean(['cbits/initWinSock.o', 'T12010.hi', 'T12010.hs']), only_ways(['threaded1']), extra_ways(['threaded1']), + exit_code(0), + ignore_output, cmd_prefix('WAY_FLAGS="' + ' '.join(config.way_flags('T12010')['threaded1']) + '"')], run_command, ['$MAKE -s --no-print-directory T12010']) From git at git.haskell.org Mon Sep 5 21:27:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:27:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Testsuite: fix T12010 for real (2557d25) Message-ID: <20160905212719.E74953A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/2557d258033071482c37383ce54768101f801533/ghc >--------------------------------------------------------------- commit 2557d258033071482c37383ce54768101f801533 Author: Thomas Miedema Date: Sun May 22 14:41:48 2016 +0200 Testsuite: fix T12010 for real * Don't depend on generated files from build tree (libraries/base/include/HsBaseConfig.h). Running 'make test TEST=T12010' should work, even without building GHC first (it will use the system installed ghc). Test Plan: 'make test TEST=T12010' on Linux and Windows. Reviewed by: Phyx Differential Revision: https://phabricator.haskell.org/D2256 GHC Trac Issues: #12010 (cherry picked from commit 2230c8822233d6d68f930170cd51d96169649056) >--------------------------------------------------------------- 2557d258033071482c37383ce54768101f801533 libraries/base/tests/IO/T12010/Makefile | 7 +++---- libraries/base/tests/IO/T12010/T12010.hsc | 7 +++---- libraries/base/tests/IO/T12010/test.T | 4 +--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libraries/base/tests/IO/T12010/Makefile b/libraries/base/tests/IO/T12010/Makefile index b924de2..ac7a13c 100644 --- a/libraries/base/tests/IO/T12010/Makefile +++ b/libraries/base/tests/IO/T12010/Makefile @@ -1,11 +1,10 @@ TOP=../../../../../testsuite include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk -TESTDIR=$(TOP)/../libraries/base/tests/IO/T12010 .PHONY: T12010 T12010: - '$(HSC2HS)' -I $(TOP)/../libraries/base/include/ -I $(TOP)/../includes/ T12010.hsc - '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -c $(TESTDIR)/cbits/initWinSock.c - '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -fno-warn-unsupported-calling-conventions $(TESTDIR)/cbits/initWinSock.o $(TESTDIR)/T12010.hs + '$(HSC2HS)' T12010.hsc + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -c cbits/initWinSock.c + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -v0 -fno-warn-unsupported-calling-conventions cbits/initWinSock.o T12010.hs ./T12010 diff --git a/libraries/base/tests/IO/T12010/T12010.hsc b/libraries/base/tests/IO/T12010/T12010.hsc index fa566e0..e13a5fe 100644 --- a/libraries/base/tests/IO/T12010/T12010.hsc +++ b/libraries/base/tests/IO/T12010/T12010.hsc @@ -7,10 +7,9 @@ import Foreign.Marshal.Alloc import GHC.IO.FD import System.Exit --- HsBase includes WinSock on Windows, on POSIX we need to explicitly ask for --- sockets. -#include "HsBase.h" -#ifndef _WIN32 +#ifdef _WIN32 +#include +#else #include #endif diff --git a/libraries/base/tests/IO/T12010/test.T b/libraries/base/tests/IO/T12010/test.T index ecf4828..51c7a81 100644 --- a/libraries/base/tests/IO/T12010/test.T +++ b/libraries/base/tests/IO/T12010/test.T @@ -1,10 +1,8 @@ test('T12010', [ - extra_clean(['cbits/initWinSock.o', 'T12010.hi', 'T12010.hs']), + extra_clean(['cbits/']), only_ways(['threaded1']), extra_ways(['threaded1']), - exit_code(0), - ignore_output, cmd_prefix('WAY_FLAGS="' + ' '.join(config.way_flags('T12010')['threaded1']) + '"')], run_command, ['$MAKE -s --no-print-directory T12010']) From git at git.haskell.org Mon Sep 5 21:27:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:27:23 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Added support for deprecated POSIX functions on Windows. (714779c) Message-ID: <20160905212723.60F033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/714779c7d175203b95e6442f01a4164bedf52e90/ghc >--------------------------------------------------------------- commit 714779c7d175203b95e6442f01a4164bedf52e90 Author: Tamar Christina Date: Thu Sep 1 21:30:07 2016 +0100 Added support for deprecated POSIX functions on Windows. Summary: With the introduction of 8.0.1 We've stopped supporting in GHCi the use of POSIX functions under their deprecated names on Windows. This to be compatible with object and libraries from the most popular compilers on the platform (Microsoft and Intel compilers). However this brings a confusing disparity between the compiled and interpreted behavior since MingW-W64 does support the deprecated names. Also It seems clear that package writers won't update their packages to properly support Windows. As such I have added redirects in the RTS for the deprecated functions as listed on https://msdn.microsoft.com/en-us/library/ms235384.aspx. This won't export the functions (as in, they won't be in the symbol table of compiled code for the RTS.) but we inject them into the symbol table of the dynamic linker at startup. Test Plan: ./validate and make test TEST="ffi017 ffi021" Reviewers: thomie, simonmar, RyanGlScott, bgamari, austin, hvr, erikd Reviewed By: simonmar, bgamari Subscribers: RyanGlScott, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2500 GHC Trac Issues: #12209, #12497, #12496 (cherry picked from commit e5ecb2010514405ac1b9b1285a8a65c00a5fd4e0) >--------------------------------------------------------------- 714779c7d175203b95e6442f01a4164bedf52e90 docs/users_guide/8.0.2-notes.rst | 10 +++ libraries/base/System/Posix/Internals.hs | 63 +++++----------- rts/Linker.c | 14 +++- rts/RtsSymbols.c | 121 +++++++++++++++++++++++++++++++ rts/RtsSymbols.h | 3 +- testsuite/tests/rts/Makefile | 4 + testsuite/tests/rts/T12497.hs | 24 ++++++ testsuite/tests/rts/T12497.stdout | 2 + testsuite/tests/rts/all.T | 4 + 9 files changed, 196 insertions(+), 49 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 714779c7d175203b95e6442f01a4164bedf52e90 From git at git.haskell.org Mon Sep 5 21:27:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:27:26 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Less scary arity mismatch error message when deriving (52c7430) Message-ID: <20160905212726.3542C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/52c743033ab0d969101ab4616bfce3ecf2e6e472/ghc >--------------------------------------------------------------- commit 52c743033ab0d969101ab4616bfce3ecf2e6e472 Author: mniip Date: Sun Sep 4 13:23:03 2016 -0400 Less scary arity mismatch error message when deriving Test Plan: Corrected a few tests to include the new message. Reviewers: goldfire, austin, bgamari Reviewed By: bgamari Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2484 GHC Trac Issues: #12546 (cherry picked from commit 8d00175f4ba969ca5f4edf26b0e8593a79d4f508) >--------------------------------------------------------------- 52c743033ab0d969101ab4616bfce3ecf2e6e472 compiler/typecheck/TcDeriv.hs | 9 ++++++++- compiler/typecheck/TcHsType.hs | 17 ++++++++--------- testsuite/tests/deriving/should_fail/T7959.stderr | 2 +- testsuite/tests/deriving/should_fail/drvfail005.stderr | 4 +--- testsuite/tests/deriving/should_fail/drvfail009.stderr | 4 +--- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index d37762a..f4069b5 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -616,7 +616,7 @@ deriveTyData :: [TyVar] -> TyCon -> [Type] -- LHS of data or data instance -- I.e. not standalone deriving deriveTyData tvs tc tc_args deriv_pred = setSrcSpan (getLoc (hsSigType deriv_pred)) $ -- Use loc of the 'deriving' item - do { (deriv_tvs, cls, cls_tys, cls_arg_kind) + do { (deriv_tvs, cls, cls_tys, cls_arg_kinds) <- tcExtendTyVarEnv tvs $ tcHsDeriv deriv_pred -- Deriving preds may (now) mention @@ -627,6 +627,9 @@ deriveTyData tvs tc tc_args deriv_pred -- Typeable is special, because Typeable :: forall k. k -> Constraint -- so the argument kind 'k' is not decomposable by splitKindFunTys -- as is the case for all other derivable type classes + ; when (length cls_arg_kinds /= 1) $ + failWithTc (nonUnaryErr deriv_pred) + ; let [cls_arg_kind] = cls_arg_kinds ; if className cls == typeableClassName then do warnUselessTypeable return [] @@ -1295,6 +1298,10 @@ checkSideConditions dflags mtheta cls cls_tys rep_tc classArgsErr :: Class -> [Type] -> SDoc classArgsErr cls cls_tys = quotes (ppr (mkClassPred cls cls_tys)) <+> text "is not a class" +nonUnaryErr :: LHsSigType Name -> SDoc +nonUnaryErr ct = quotes (ppr ct) + <+> text "is not a unary constraint, as expected by a deriving clause" + nonStdErr :: Class -> SDoc nonStdErr cls = quotes (ppr cls) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 5373d1a..16a05e7 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -211,26 +211,25 @@ tc_hs_sig_type (HsIB { hsib_body = hs_ty ; return (mkSpecForAllTys tkvs ty) } ----------------- -tcHsDeriv :: LHsSigType Name -> TcM ([TyVar], Class, [Type], Kind) +tcHsDeriv :: LHsSigType Name -> TcM ([TyVar], Class, [Type], [Kind]) -- Like tcHsSigType, but for the ...deriving( C t1 ty2 ) clause --- Returns the C, [ty1, ty2, and the kind of C's *next* argument +-- Returns the C, [ty1, ty2, and the kinds of C's remaining arguments -- E.g. class C (a::*) (b::k->k) -- data T a b = ... deriving( C Int ) --- returns ([k], C, [k, Int], k->k) --- Also checks that (C ty1 ty2 arg) :: Constraint --- if arg has a suitable kind +-- returns ([k], C, [k, Int], [k->k]) tcHsDeriv hs_ty - = do { arg_kind <- newMetaKindVar + = do { cls_kind <- newMetaKindVar -- always safe to kind-generalize, because there -- can be no covars in an outer scope ; ty <- checkNoErrs $ -- avoid redundant error report with "illegal deriving", below - tc_hs_sig_type hs_ty (mkFunTy arg_kind constraintKind) + tc_hs_sig_type hs_ty cls_kind ; ty <- kindGeneralizeType ty -- also zonks - ; arg_kind <- zonkTcType arg_kind + ; cls_kind <- zonkTcType cls_kind ; let (tvs, pred) = splitForAllTys ty + ; let (args, _) = splitFunTys cls_kind ; case getClassPredTys_maybe pred of - Just (cls, tys) -> return (tvs, cls, tys, arg_kind) + Just (cls, tys) -> return (tvs, cls, tys, args) Nothing -> failWithTc (text "Illegal deriving item" <+> quotes (ppr hs_ty)) } tcHsClsInstType :: UserTypeCtxt -- InstDeclCtxt or SpecInstCtxt diff --git a/testsuite/tests/deriving/should_fail/T7959.stderr b/testsuite/tests/deriving/should_fail/T7959.stderr index 4756f79..254cfed 100644 --- a/testsuite/tests/deriving/should_fail/T7959.stderr +++ b/testsuite/tests/deriving/should_fail/T7959.stderr @@ -4,5 +4,5 @@ T7959.hs:5:1: error: • In the stand-alone deriving instance for ‘A’ T7959.hs:6:17: error: - • Expected kind ‘k0 -> Constraint’, but ‘A’ has kind ‘Constraint’ + • ‘A’ is not a unary constraint, as expected by a deriving clause • In the data declaration for ‘B’ diff --git a/testsuite/tests/deriving/should_fail/drvfail005.stderr b/testsuite/tests/deriving/should_fail/drvfail005.stderr index 552b3b0..5f10652 100644 --- a/testsuite/tests/deriving/should_fail/drvfail005.stderr +++ b/testsuite/tests/deriving/should_fail/drvfail005.stderr @@ -1,6 +1,4 @@ drvfail005.hs:4:13: error: - • Expecting one fewer argument to ‘Show a’ - Expected kind ‘k0 -> Constraint’, - but ‘Show a’ has kind ‘Constraint’ + • ‘Show a’ is not a unary constraint, as expected by a deriving clause • In the data declaration for ‘Test’ diff --git a/testsuite/tests/deriving/should_fail/drvfail009.stderr b/testsuite/tests/deriving/should_fail/drvfail009.stderr index 563bc5a..9c5f9ff 100644 --- a/testsuite/tests/deriving/should_fail/drvfail009.stderr +++ b/testsuite/tests/deriving/should_fail/drvfail009.stderr @@ -1,8 +1,6 @@ drvfail009.hs:10:31: error: - Expecting one more argument to ‘C’ - Expected kind ‘* -> Constraint’, - but ‘C’ has kind ‘* -> * -> Constraint’ + ‘C’ is not a unary constraint, as expected by a deriving clause In the newtype declaration for ‘T1’ drvfail009.hs:13:31: error: From git at git.haskell.org Mon Sep 5 21:27:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 21:27:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: distrib: Fix libdw bindist check (23d60a5) Message-ID: <20160905212728.DC1453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/23d60a530e2013b643aaa2de96f8cbbe98feb64e/ghc >--------------------------------------------------------------- commit 23d60a530e2013b643aaa2de96f8cbbe98feb64e Author: Ben Gamari Date: Sun Sep 4 13:23:35 2016 -0400 distrib: Fix libdw bindist check As reported in #12555 this code was terribly broken. Sadly, Autoconf was none-the-wiser. Thanks to @rwbarton for pointing this out. Test Plan: Test with libdw version newer and older and 0.158 Reviewers: hvr, austin, rwbarton Reviewed By: rwbarton Subscribers: thomie, rwbarton, erikd Differential Revision: https://phabricator.haskell.org/D2510 GHC Trac Issues: #12555 (cherry picked from commit 05b497ece50f508526d0906f675bdb4c8109d46a) >--------------------------------------------------------------- 23d60a530e2013b643aaa2de96f8cbbe98feb64e distrib/configure.ac.in | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index c399352..d50ce86 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -91,17 +91,6 @@ dnl -------------------------------------------------------------- FIND_LD([LdCmd]) AC_SUBST([LdCmd]) -dnl ** Have libdw? -dnl -------------------------------------------------------------- -dnl Check for a usable version of libdw/elfutils -dnl Currently we need 0.158 or newer. -BinDistNeedsLibdw=@HaveLibdw@ -if test "x$BinDistNeedsLibdw" = "xyes" ; then - AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], - [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] - )]; -fi - FP_GCC_VERSION AC_PROG_CPP @@ -150,6 +139,18 @@ dnl ** how to invoke `ar' and `ranlib' FP_PROG_AR_SUPPORTS_ATFILE FP_PROG_AR_NEEDS_RANLIB +dnl ** Have libdw? +dnl -------------------------------------------------------------- +dnl Check for a usable version of libdw/elfutils +dnl Currently we need 0.158 or newer. +BinDistNeedsLibdw=@UseLibdw@ +if test "x$BinDistNeedsLibdw" = "xYES" ; then + AC_CHECK_LIB(dw, dwfl_attach_state, + [UseLibdw=YES], + [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] + ) +fi + FP_SETTINGS # From git at git.haskell.org Mon Sep 5 22:06:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 22:06:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Be more aggressive when checking constraints for custom type errors. (23be8c9) Message-ID: <20160905220620.8FDD63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/23be8c99a411f846ae7668682259bcad2a507122/ghc >--------------------------------------------------------------- commit 23be8c99a411f846ae7668682259bcad2a507122 Author: Iavor S. Diatchki Date: Tue May 3 22:55:07 2016 +0200 Be more aggressive when checking constraints for custom type errors. This fixes #11990. The current rule is simpler than before: if we encounter an unsolved constraint that contains any mentions of properly applied `TypeError`, then we report the type error. If there are multiple `TypeErrors`, then we just report one of them. Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2151 GHC Trac Issues: #11990 (cherry picked from commit b75d1940dd3362382c0bc94018a9045c2def82a9) >--------------------------------------------------------------- 23be8c99a411f846ae7668682259bcad2a507122 compiler/typecheck/TcRnTypes.hs | 55 ++++++++++++++++++---- testsuite/tests/typecheck/should_fail/T11990a.hs | 24 ++++++++++ .../tests/typecheck/should_fail/T11990a.stderr | 5 ++ testsuite/tests/typecheck/should_fail/T11990b.hs | 28 +++++++++++ .../tests/typecheck/should_fail/T11990b.stderr | 5 ++ testsuite/tests/typecheck/should_fail/all.T | 2 + 6 files changed, 109 insertions(+), 10 deletions(-) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index f74e02c..753b9fb 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1835,18 +1835,53 @@ isTypeHoleCt :: Ct -> Bool isTypeHoleCt (CHoleCan { cc_hole = TypeHole {} }) = True isTypeHoleCt _ = False --- | The following constraints are considered to be a custom type error: --- 1. TypeError msg a b c --- 2. TypeError msg a b c ~ Something (and the other way around) --- 4. C (TypeError msg a b c) (for any parameter of class constraint) + +{- Note [Custom type errors in constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When GHC reports a type-error about an unsolved-constraint, we check +to see if the constraint contains any custom-type errors, and if so +we report them. Here are some examples of constraints containing type +errors: + +TypeError msg -- The actual constraint is a type error + +TypError msg ~ Int -- Some type was supposed to be Int, but ended up + -- being a type error instead + +Eq (TypeError msg) -- A class constraint is stuck due to a type error + +F (TypeError msg) ~ a -- A type function failed to evaluate due to a type err + +It is also possible to have constraints where the type error is nested deeper, +for example see #11990, and also: + +Eq (F (TypeError msg)) -- Here the type error is nested under a type-function + -- call, which failed to evaluate because of it, + -- and so the `Eq` constraint was unsolved. + -- This may happen when one function calls another + -- and the called function produced a custom type error. +-} + +-- | A constraint is considered to be a custom type error, if it contains +-- custom type errors anywhere in it. +-- See Note [Custom type errors in constraints] getUserTypeErrorMsg :: Ct -> Maybe Type -getUserTypeErrorMsg ct - | Just (_,t1,t2) <- getEqPredTys_maybe ctT = oneOf [t1,t2] - | Just (_,ts) <- getClassPredTys_maybe ctT = oneOf ts - | otherwise = userTypeError_maybe ctT +getUserTypeErrorMsg ct = findUserTypeError (ctPred ct) where - ctT = ctPred ct - oneOf xs = msum (map userTypeError_maybe xs) + findUserTypeError t = msum ( userTypeError_maybe t + : map findUserTypeError (subTys t) + ) + + subTys t = case splitAppTys t of + (t,[]) -> + case splitTyConApp_maybe t of + Nothing -> [] + Just (_,ts) -> ts + (t,ts) -> t : ts + + + isUserTypeErrorCt :: Ct -> Bool isUserTypeErrorCt ct = case getUserTypeErrorMsg ct of diff --git a/testsuite/tests/typecheck/should_fail/T11990a.hs b/testsuite/tests/typecheck/should_fail/T11990a.hs new file mode 100644 index 0000000..7b7a03b --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11990a.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-} +{-# LANGUAGE UndecidableInstances, ScopedTypeVariables, FlexibleContexts #-} + +module T11990a where + +import GHC.TypeLits +import Data.Proxy + +type family PartialTF t :: Symbol where + PartialTF Int = "Int" + PartialTF Bool = "Bool" + PartialTF a = TypeError (Text "Unexpected type @ PartialTF: " + :<>: ShowType a) + +testPartialTF :: forall a.(KnownSymbol (PartialTF a)) => a -> String +testPartialTF t = symbolVal (Proxy :: Proxy (PartialTF a)) + +t1 = testPartialTF 'a' + +{- Above code rightly fails with the following error: + • Unexpected type: Char + • In the expression: testPartialTF 'a' + In an equation for ‘t1’: t1 = testPartialTF 'a' +-} diff --git a/testsuite/tests/typecheck/should_fail/T11990a.stderr b/testsuite/tests/typecheck/should_fail/T11990a.stderr new file mode 100644 index 0000000..f875e67 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11990a.stderr @@ -0,0 +1,5 @@ + +T11990a.hs:18:6: + Unexpected type @ PartialTF: Char + In the expression: testPartialTF 'a' + In an equation for ‘t1’: t1 = testPartialTF 'a' diff --git a/testsuite/tests/typecheck/should_fail/T11990b.hs b/testsuite/tests/typecheck/should_fail/T11990b.hs new file mode 100644 index 0000000..9a31670 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11990b.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-} +{-# LANGUAGE UndecidableInstances, ScopedTypeVariables, FlexibleContexts #-} + +module T11990b where + +import GHC.TypeLits +import Data.Proxy + +type family PartialTF t :: Symbol where + PartialTF Int = "Int" + PartialTF Bool = "Bool" + PartialTF a = TypeError (Text "Unexpected type @ PartialTF: " + :<>: ShowType a) + +type family NestedPartialTF (tsym :: Symbol) :: Symbol where + NestedPartialTF "Int" = "int" + NestedPartialTF "Bool" = "bool" + NestedPartialTF a = + TypeError (Text "Unexpected type @ NestedPartialTF: " :<>: ShowType a) + +testPartialTF :: forall a.(KnownSymbol (PartialTF a)) => a -> String +testPartialTF t = symbolVal (Proxy :: Proxy (PartialTF a)) + +testNesPartialTF :: + forall a.(KnownSymbol (NestedPartialTF (PartialTF a))) => a -> String +testNesPartialTF t = symbolVal (Proxy :: Proxy (NestedPartialTF (PartialTF a))) + +t2 = testNesPartialTF 'a' diff --git a/testsuite/tests/typecheck/should_fail/T11990b.stderr b/testsuite/tests/typecheck/should_fail/T11990b.stderr new file mode 100644 index 0000000..9a92d43 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11990b.stderr @@ -0,0 +1,5 @@ + +T11990b.hs:28:6: + Unexpected type @ PartialTF: Char + In the expression: testNesPartialTF 'a' + In an equation for ‘t2’: t2 = testNesPartialTF 'a' diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 52a1a5d..bd6d159 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -422,3 +422,5 @@ test('T11974b', normal, compile_fail, ['']) test('T12406', normal, compile_fail, ['']) test('T12177', normal, compile_fail, ['']) test('T12170a', normal, compile_fail, ['']) +test('T11990a', normal, compile_fail, ['']) +test('T11990b', normal, compile_fail, ['']) From git at git.haskell.org Mon Sep 5 23:12:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 23:12:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix GHCi perf-llvm build on x86_64 (676efb9) Message-ID: <20160905231210.4099A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/676efb9f00d14c7f4bad7160d270c1292dd9b436/ghc >--------------------------------------------------------------- commit 676efb9f00d14c7f4bad7160d270c1292dd9b436 Author: Erik de Castro Lopo Date: Sun Aug 14 07:23:35 2016 +1000 Fix GHCi perf-llvm build on x86_64 With BuildFlavour set to `perf-llvm`, GHCi would fail as soon as it was run with: ghc-stage2: .../ghc-prim/dist-install/build/HSghc-prim-0.5.0.0.o: unknown symbol `__udivti3' ghc-stage2: unable to load package `ghc-prim-0.5.0.0' Fix this by adding `__udivti3` and `__umodti3` to RtsSymbols.c. Test Plan: Validate Reviewers: simonmar, austin, bgamari, Phyx, trofi Reviewed By: Phyx, trofi Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2449 GHC Trac Issues: #11981 (cherry picked from commit bd0c31063551744d00796219174739216c398da5) >--------------------------------------------------------------- 676efb9f00d14c7f4bad7160d270c1292dd9b436 rts/RtsSymbols.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index fdacae6..fec5cfc 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -868,6 +868,10 @@ SymI_NeedsProto(__ashrdi3) \ SymI_NeedsProto(__lshrdi3) \ SymI_NeedsProto(__fixunsdfdi) +#elif defined(__GNUC__) && SIZEOF_VOID_P == 8 +#define RTS_LIBGCC_SYMBOLS \ + SymI_NeedsProto(__udivti3) \ + SymI_NeedsProto(__umodti3) #else #define RTS_LIBGCC_SYMBOLS #endif From git at git.haskell.org Mon Sep 5 23:12:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 5 Sep 2016 23:12:12 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: InstEnv: Ensure that instance visibility check is lazy (291b439) Message-ID: <20160905231212.EA6A23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/291b439fb1da7af4401477c92ba24c7b4b498df8/ghc >--------------------------------------------------------------- commit 291b439fb1da7af4401477c92ba24c7b4b498df8 Author: Ben Gamari Date: Wed Jul 20 09:56:03 2016 +0200 InstEnv: Ensure that instance visibility check is lazy Previously instIsVisible had completely broken the laziness of lookupInstEnv' since it would examine is_dfun_name to check the name of the defining module (to know whether it is an interactive module). This resulted in the visibility check drawing in an interface file unnecessarily. This contributed to the unnecessary regression in compiler allocations reported in #12367. Test Plan: Validate, check nofib changes Reviewers: simonpj, ezyang, austin Reviewed By: ezyang Subscribers: thomie, ezyang Differential Revision: https://phabricator.haskell.org/D2411 GHC Trac Issues: #12367 (cherry picked from commit ed4809813fa51524ae73a4475afe33018a67f87d) >--------------------------------------------------------------- 291b439fb1da7af4401477c92ba24c7b4b498df8 compiler/iface/TcIface.hs | 8 +- compiler/types/InstEnv.hs | 97 +++++++++++++++------- .../tests/ghci.debugger/scripts/break006.stderr | 14 ++-- testsuite/tests/perf/space_leaks/all.T | 3 +- testsuite/tests/typecheck/should_fail/T5095.stderr | 8 +- 5 files changed, 83 insertions(+), 47 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 291b439fb1da7af4401477c92ba24c7b4b498df8 From git at git.haskell.org Thu Sep 8 15:12:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 15:12:01 +0000 (UTC) Subject: [commit: ghc] master: Remove references to -XRelaxedPolyRec (feaa31f) Message-ID: <20160908151201.0ADE93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/feaa31fbc41685d69045ac8d34be4e18f4f27ffd/ghc >--------------------------------------------------------------- commit feaa31fbc41685d69045ac8d34be4e18f4f27ffd Author: Ben Gamari Date: Mon Sep 5 19:19:23 2016 -0400 Remove references to -XRelaxedPolyRec Test Plan: Read it Reviewers: dfeuer, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2515 GHC Trac Issues: #11691 >--------------------------------------------------------------- feaa31fbc41685d69045ac8d34be4e18f4f27ffd docs/users_guide/bugs.rst | 51 +++++++++++++++++++++++++ docs/users_guide/glasgow_exts.rst | 62 ------------------------------- utils/mkUserGuidePart/Options/Language.hs | 8 ---- 3 files changed, 51 insertions(+), 70 deletions(-) diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst index 5d30363..875820b 100644 --- a/docs/users_guide/bugs.rst +++ b/docs/users_guide/bugs.rst @@ -126,6 +126,57 @@ been decided to remove them from the next version of the language standard. This behaviour can be controlled with the ``DatatypeContexts`` extension. See :ref:`datatype-contexts`. +.. _infelicities-recursive-groups: + +Typechecking of recursive binding groups +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The Haskell Report specifies that a group of bindings (at top level, or +in a ``let`` or ``where``) should be sorted into strongly-connected +components, and then type-checked in dependency order +(`Haskell Report, Section +4.5.1 `__). As +each group is type-checked, any binders of the group that have an +explicit type signature are put in the type environment with the +specified polymorphic type, and all others are monomorphic until the +group is generalised (`Haskell Report, Section +4.5.2 `__). + +Following a suggestion of Mark Jones, in his paper `Typing Haskell in +Haskell `__, GHC implements a +more general scheme. In GHC *the dependency analysis ignores references to +variables that have an explicit type signature*. As a result of this refined +dependency analysis, the dependency groups are smaller, and more bindings will +typecheck. For example, consider: :: + + f :: Eq a => a -> Bool + f x = (x == x) || g True || g "Yes" + + g y = (y <= y) || f True + +This is rejected by Haskell 98, but under Jones's scheme the definition +for ``g`` is typechecked first, separately from that for ``f``, because +the reference to ``f`` in ``g``\'s right hand side is ignored by the +dependency analysis. Then ``g``\'s type is generalised, to get :: + + g :: Ord a => a -> Bool + +Now, the definition for ``f`` is typechecked, with this type for ``g`` +in the type environment. + +The same refined dependency analysis also allows the type signatures of +mutually-recursive functions to have different contexts, something that is +illegal in Haskell 98 (Section 4.5.2, last sentence). GHC only insists that the +type signatures of a *refined* group have identical type signatures; in practice +this means that only variables bound by the same pattern binding must have the +same context. For example, this is fine: :: + + f :: Eq a => a -> Bool + f x = (x == x) || g True + + g :: Ord a => a -> Bool + g y = (y <= y) || f True + .. _infelicities-Modules: Module system and interface files diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 7709b22..6209548 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -8412,7 +8412,6 @@ Lexically scoped type variables .. ghc-flag:: -XScopedTypeVariables - :implies: :ghc-flag:`-XRelaxedPolyRec` :implies: :ghc-flag:`-XExplicitForAll` Enable lexical scoping of type variables explicitly introduced with @@ -8436,9 +8435,6 @@ signature for ``ys``. In Haskell 98 it is not possible to declare a type for ``ys``; a major benefit of scoped type variables is that it becomes possible to do so. -Lexically-scoped type variables are enabled by -:ghc-flag:`-XScopedTypeVariables`. This flag implies :ghc-flag:`-XRelaxedPolyRec`. - Overview -------- @@ -8651,64 +8647,6 @@ the Haskell Report) can be completely switched off by restriction is switched off by default in GHCi's interactive options (see :ref:`ghci-interactive-options`). -.. _typing-binds: - -Generalised typing of mutually recursive bindings -------------------------------------------------- - -.. ghc-flag:: -XRelaxedPolyRec - - Allow the typechecker to ignore references to bindings with - explicit type signatures. - -The Haskell Report specifies that a group of bindings (at top level, or -in a ``let`` or ``where``) should be sorted into strongly-connected -components, and then type-checked in dependency order -(`Haskell Report, Section -4.5.1 `__). As -each group is type-checked, any binders of the group that have an -explicit type signature are put in the type environment with the -specified polymorphic type, and all others are monomorphic until the -group is generalised (`Haskell Report, Section -4.5.2 `__). - -Following a suggestion of Mark Jones, in his paper `Typing Haskell in -Haskell `__, GHC implements a -more general scheme. If :ghc-flag:`-XRelaxedPolyRec` is specified: *the -dependency analysis ignores references to variables that have an -explicit type signature*. As a result of this refined dependency -analysis, the dependency groups are smaller, and more bindings will -typecheck. For example, consider: :: - - f :: Eq a => a -> Bool - f x = (x == x) || g True || g "Yes" - - g y = (y <= y) || f True - -This is rejected by Haskell 98, but under Jones's scheme the definition -for ``g`` is typechecked first, separately from that for ``f``, because -the reference to ``f`` in ``g``\'s right hand side is ignored by the -dependency analysis. Then ``g``\'s type is generalised, to get :: - - g :: Ord a => a -> Bool - -Now, the definition for ``f`` is typechecked, with this type for ``g`` -in the type environment. - -The same refined dependency analysis also allows the type signatures of -mutually-recursive functions to have different contexts, something that -is illegal in Haskell 98 (Section 4.5.2, last sentence). With -:ghc-flag:`-XRelaxedPolyRec` GHC only insists that the type signatures of a -*refined* group have identical type signatures; in practice this means -that only variables bound by the same pattern binding must have the same -context. For example, this is fine: :: - - f :: Eq a => a -> Bool - f x = (x == x) || g True - - g :: Ord a => a -> Bool - g y = (y <= y) || f True - .. _mono-local-binds: Let-generalisation diff --git a/utils/mkUserGuidePart/Options/Language.hs b/utils/mkUserGuidePart/Options/Language.hs index 0d9014e..c2012af 100644 --- a/utils/mkUserGuidePart/Options/Language.hs +++ b/utils/mkUserGuidePart/Options/Language.hs @@ -603,14 +603,6 @@ languageOptions = , flagReverse = "-XNoRecursiveDo" , flagSince = "6.8.1" } - , flag { flagName = "-XRelaxedPolyRec" - , flagDescription = - "*(deprecated)* Relaxed checking for :ref:`mutually-recursive "++ - "polymorphic functions `." - , flagType = DynamicFlag - , flagReverse = "-XNoRelaxedPolyRec" - , flagSince = "6.8.1" - } , flag { flagName = "-XRoleAnnotations" , flagDescription = "Enable :ref:`role annotations `." From git at git.haskell.org Thu Sep 8 15:12:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 15:12:04 +0000 (UTC) Subject: [commit: ghc] master: Add failing testcase for #12433 (dcc4904) Message-ID: <20160908151204.329653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dcc49044e8ac5b905955f99b042449635eb47e64/ghc >--------------------------------------------------------------- commit dcc49044e8ac5b905955f99b042449635eb47e64 Author: Ben Gamari Date: Mon Sep 5 19:19:10 2016 -0400 Add failing testcase for #12433 Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2517 GHC Trac Issues: #11433 >--------------------------------------------------------------- dcc49044e8ac5b905955f99b042449635eb47e64 testsuite/tests/codeGen/should_run/T12433.hs | 13 +++++++++++++ testsuite/tests/codeGen/should_run/all.T | 1 + 2 files changed, 14 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T12433.hs b/testsuite/tests/codeGen/should_run/T12433.hs new file mode 100644 index 0000000..f9e64a6 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T12433.hs @@ -0,0 +1,13 @@ +f :: Int -> IO () +f p = case p of + 0 -> return () + 1 -> return () + 2 -> return () + 3 -> return () + 4 -> return () + 10 -> return () + 11 -> return () + _ -> print p +{-# NOINLINE f #-} + +main = f 8 diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 42ec7d3..ee8772b 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -143,3 +143,4 @@ test('T10870', when(wordsize(32), skip), compile_and_run, ['']) test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12059', normal, compile_and_run, ['']) +test('T12433', expect_broken(12433), compile_and_run, ['']) From git at git.haskell.org Thu Sep 8 15:12:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 15:12:06 +0000 (UTC) Subject: [commit: ghc] master: Document meaning of order of --package-db flags, fixes #12485. (5eab6a0) Message-ID: <20160908151206.E15123A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5eab6a0da5f22a47d04b97a0ec8988346675b33b/ghc >--------------------------------------------------------------- commit 5eab6a0da5f22a47d04b97a0ec8988346675b33b Author: Edward Z. Yang Date: Mon Sep 5 19:19:57 2016 -0400 Document meaning of order of --package-db flags, fixes #12485. Test Plan: none Reviewers: austin, niteria, bgamari Reviewed By: niteria Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2514 GHC Trac Issues: #12485 >--------------------------------------------------------------- 5eab6a0da5f22a47d04b97a0ec8988346675b33b docs/users_guide/packages.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/users_guide/packages.rst b/docs/users_guide/packages.rst index 15c97c7..d3da125 100644 --- a/docs/users_guide/packages.rst +++ b/docs/users_guide/packages.rst @@ -384,6 +384,11 @@ stack. Several command line options described below can further manipulate this initial stack. You can see GHC's effective package database stack by running GHC with the :ghc-flag:`-v` flag. +This stack structure means that the order of :ghc-flag:`-package-db` flags or +:envvar:`GHC_PACKAGE_PATH` is important. Each substack of the stack +must be well formed (packages in databases on top of the stack can refer +to packages below, but not vice versa). + *Package shadowing:* When multiple package databases are in use it is possible, though rarely, that the same installed package id is present in more than one database. In that case, packages closer to the top of the stack From git at git.haskell.org Thu Sep 8 18:51:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:51:52 +0000 (UTC) Subject: [commit: ghc] branch 'wip/names3' created Message-ID: <20160908185152.C07253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/names3 Referencing: f174286c402ff59ac523603caf408a6889923fe2 From git at git.haskell.org Thu Sep 8 18:51:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:51:55 +0000 (UTC) Subject: [commit: ghc] wip/names3: TysWiredIn: Use dataConWorkerUnique instead of incrUnique (dc40244) Message-ID: <20160908185155.766B83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/dc402449bd995ae24749385eb0264a489a4a02e1/ghc >--------------------------------------------------------------- commit dc402449bd995ae24749385eb0264a489a4a02e1 Author: Ben Gamari Date: Fri Aug 19 07:31:23 2016 -0400 TysWiredIn: Use dataConWorkerUnique instead of incrUnique Try to preserve some amount of encapsulation. >--------------------------------------------------------------- dc402449bd995ae24749385eb0264a489a4a02e1 compiler/basicTypes/Unique.hs | 1 - compiler/prelude/TysWiredIn.hs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/basicTypes/Unique.hs b/compiler/basicTypes/Unique.hs index 0bbf861..c933d61 100644 --- a/compiler/basicTypes/Unique.hs +++ b/compiler/basicTypes/Unique.hs @@ -31,7 +31,6 @@ module Unique ( getKey, -- Used in Var, UniqFM, Name only! mkUnique, unpkUnique, -- Used in BinIface only - incrUnique, -- Used for renumbering deriveUnique, -- Ditto newTagUnique, -- Used in CgCase initTyVarUnique, diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index 1028478..b334967 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -489,7 +489,7 @@ pcDataConWithFixity :: Bool -- ^ declared infix? -> [Type] -- ^ args -> TyCon -> DataCon -pcDataConWithFixity infx n = pcDataConWithFixity' infx n (incrUnique (nameUnique n)) +pcDataConWithFixity infx n = pcDataConWithFixity' infx n (dataConWorkerUnique (nameUnique n)) NoRRI -- The Name's unique is the first of two free uniques; -- the first is used for the datacon itself, @@ -535,7 +535,7 @@ pcDataConWithFixity' declared_infix dc_name wrk_key rri tyvars ex_tyvars arg_tys -- used for RuntimeRep and friends pcSpecialDataCon :: Name -> [Type] -> TyCon -> RuntimeRepInfo -> DataCon pcSpecialDataCon dc_name arg_tys tycon rri - = pcDataConWithFixity' False dc_name (incrUnique (nameUnique dc_name)) rri + = pcDataConWithFixity' False dc_name (dataConWorkerUnique (nameUnique dc_name)) rri [] [] arg_tys tycon {- From git at git.haskell.org Thu Sep 8 18:51:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:51:58 +0000 (UTC) Subject: [commit: ghc] wip/names3: LoadIface: Add whitespace (12fe80d) Message-ID: <20160908185158.28D653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/12fe80d3b1098d08b56eb489b3959677d2640148/ghc >--------------------------------------------------------------- commit 12fe80d3b1098d08b56eb489b3959677d2640148 Author: Ben Gamari Date: Mon Aug 22 12:01:13 2016 -0400 LoadIface: Add whitespace >--------------------------------------------------------------- 12fe80d3b1098d08b56eb489b3959677d2640148 compiler/iface/LoadIface.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs index c5c3538..9c38462 100644 --- a/compiler/iface/LoadIface.hs +++ b/compiler/iface/LoadIface.hs @@ -138,7 +138,7 @@ importDecl name { eps <- getEps ; case lookupTypeEnv (eps_PTE eps) name of Just thing -> return (Succeeded thing) - Nothing -> return $ Failed (ifPprDebug (found_things_msg eps) $$ not_found_msg) + Nothing -> return $ Failed (ifPprDebug (found_things_msg eps $$ empty) $$ not_found_msg) }}} where nd_doc = text "Need decl for" <+> ppr name From git at git.haskell.org Thu Sep 8 18:52:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:00 +0000 (UTC) Subject: [commit: ghc] wip/names3: BinIface: Debugging (8a2d772) Message-ID: <20160908185200.DCA2F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/8a2d772d46212812558de3c5ab62b7813c81b1e7/ghc >--------------------------------------------------------------- commit 8a2d772d46212812558de3c5ab62b7813c81b1e7 Author: Ben Gamari Date: Mon Aug 22 12:01:00 2016 -0400 BinIface: Debugging >--------------------------------------------------------------- 8a2d772d46212812558de3c5ab62b7813c81b1e7 compiler/iface/BinIface.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/iface/BinIface.hs b/compiler/iface/BinIface.hs index e6b08b8..bd5bf90 100644 --- a/compiler/iface/BinIface.hs +++ b/compiler/iface/BinIface.hs @@ -303,6 +303,7 @@ putName _dict BinSymbolTable{ | isKnownKeyName name , let (c, u) = unpkUnique (nameUnique name) -- INVARIANT: (ord c) fits in 8 bits = -- ASSERT(u < 2^(22 :: Int)) + pprTrace "putName" (ppr name <+> ppr c <+> ppr u) $ put_ bh (0x80000000 .|. (fromIntegral (ord c) `shiftL` 22) .|. (fromIntegral u :: Word32)) | otherwise @@ -310,7 +311,7 @@ putName _dict BinSymbolTable{ case lookupUFM symtab_map name of Just (off,_) -> put_ bh (fromIntegral off :: Word32) Nothing -> do - off <- readFastMutInt symtab_next + off <- pprTrace "putName2" (ppr name) $ readFastMutInt symtab_next -- MASSERT(off < 2^(30 :: Int)) writeFastMutInt symtab_next (off+1) writeIORef symtab_map_ref @@ -330,9 +331,10 @@ getSymtabName _ncu _dict symtab bh = do let tag = chr (fromIntegral ((i .&. 0x3FC00000) `shiftR` 22)) ix = fromIntegral i .&. 0x003FFFFF + u = mkUnique tag ix in - return $! case lookupKnownKeyName (mkUnique tag ix) of - Nothing -> pprPanic "getSymtabName:unknown known-key unique" (ppr i) + return $! case lookupKnownKeyName u of + Nothing -> pprPanic "getSymtabName:unknown known-key unique" (ppr i $$ ppr (unpkUnique u)) Just n -> n _ -> pprPanic "getSymtabName:unknown name tag" (ppr i) From git at git.haskell.org Thu Sep 8 18:52:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:03 +0000 (UTC) Subject: [commit: ghc] wip/names3: MkIface: Turn a foldr into a foldl' (0c07c44) Message-ID: <20160908185203.8F3DA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/0c07c44cf5ac228a44585eb8148d2103718003d9/ghc >--------------------------------------------------------------- commit 0c07c44cf5ac228a44585eb8148d2103718003d9 Author: Ben Gamari Date: Mon Aug 22 23:18:02 2016 -0400 MkIface: Turn a foldr into a foldl' There is no reason why this should be a foldr considering we are building a map. >--------------------------------------------------------------- 0c07c44cf5ac228a44585eb8148d2103718003d9 compiler/iface/MkIface.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 4c44e25..ce8bc24 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -411,8 +411,8 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls -- e.g. a reference to a constructor must be turned into a reference -- to the TyCon for the purposes of calculating dependencies. parent_map :: OccEnv OccName - parent_map = foldr extend emptyOccEnv new_decls - where extend d env = + parent_map = foldl' extend emptyOccEnv new_decls + where extend env d = extendOccEnvList env [ (b,n) | b <- ifaceDeclImplicitBndrs d ] where n = ifName d From git at git.haskell.org Thu Sep 8 18:52:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:06 +0000 (UTC) Subject: [commit: ghc] wip/names3: Constrint tuples (27c0b01) Message-ID: <20160908185206.55A263A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/27c0b013d99da1668d0f8fd9d2ddb2cf58ac4cbd/ghc >--------------------------------------------------------------- commit 27c0b013d99da1668d0f8fd9d2ddb2cf58ac4cbd Author: Ben Gamari Date: Fri Aug 19 08:56:12 2016 -0400 Constrint tuples >--------------------------------------------------------------- 27c0b013d99da1668d0f8fd9d2ddb2cf58ac4cbd compiler/basicTypes/Unique.hs | 18 ++++-- compiler/iface/BinIface.hs | 140 +++-------------------------------------- compiler/prelude/PrelInfo.hs | 76 +++++++++++++++++----- compiler/prelude/TysWiredIn.hs | 12 +++- 4 files changed, 91 insertions(+), 155 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 27c0b013d99da1668d0f8fd9d2ddb2cf58ac4cbd From git at git.haskell.org Thu Sep 8 18:52:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:09 +0000 (UTC) Subject: [commit: ghc] wip/names3: TysWiredIn: Fix comment (aee6465) Message-ID: <20160908185209.050C83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/aee6465e0d498579169457af09f8073a92ca1982/ghc >--------------------------------------------------------------- commit aee6465e0d498579169457af09f8073a92ca1982 Author: Ben Gamari Date: Sat Aug 20 17:06:14 2016 -0400 TysWiredIn: Fix comment >--------------------------------------------------------------- aee6465e0d498579169457af09f8073a92ca1982 compiler/prelude/TysWiredIn.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index cd0d7e2..27a1f4f 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -198,12 +198,12 @@ names in PrelNames, so they use wTcQual, wDataQual, etc -- See also Note [Known-key names] wiredInTyCons :: [TyCon] -wiredInTyCons = [ unitTyCon -- Not treated like other tuples, because - -- it's defined in GHC.Base, and there's only - -- one of it. We put it in wiredInTyCons so - -- that it'll pre-populate the name cache, so - -- the special case in lookupOrigNameCache - -- doesn't need to look out for it +wiredInTyCons = [ -- Units are not treated like other tuples, because then + -- are defined in GHC.Base, and there's only a few of them. We + -- put them in wiredInTyCons so that they will pre-populate + -- the name cache, so the parser in isBuiltInOcc_maybe doesn't + -- need to look out for them. + unitTyCon , unboxedUnitTyCon , anyTyCon , boolTyCon From git at git.haskell.org Thu Sep 8 18:52:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:11 +0000 (UTC) Subject: [commit: ghc] wip/names3: Unique: Simplify encoding of sum uniques (bdb021c) Message-ID: <20160908185211.A44073A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/bdb021c3c0401f84a2f429592d230ad1b408168d/ghc >--------------------------------------------------------------- commit bdb021c3c0401f84a2f429592d230ad1b408168d Author: Ben Gamari Date: Sat Aug 20 12:50:49 2016 -0400 Unique: Simplify encoding of sum uniques The previous encoding was entropically a bit better, but harder to encode and decode. Now we just split up the integer part of the unique into a bitfield. >--------------------------------------------------------------- bdb021c3c0401f84a2f429592d230ad1b408168d compiler/basicTypes/Unique.hs | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/compiler/basicTypes/Unique.hs b/compiler/basicTypes/Unique.hs index 6d1c0e9..eeffa9b 100644 --- a/compiler/basicTypes/Unique.hs +++ b/compiler/basicTypes/Unique.hs @@ -378,31 +378,26 @@ mkTupleDataConUnique Unboxed a = mkUnique '8' (3*a) mkCTupleDataConUnique a = mkUnique 'm' (3*a) -- CTuples aren't exactly wired-in, but close -------------------------------------------------- --- Sum arities start from 2. A sum of arity N has N data constructors, so it --- occupies N+1 slots: 1 TyCon + N DataCons. +-- Sum arities start from 2. The encoding is a bit funny: we break up the +-- integral part into bitfields for the arity and alternative index (which is +-- taken to be 0xff in the case of the TyCon) -- --- So arity 2 sum takes uniques 0 (tycon), 1, 2 (2 data cons) --- arity 3 sum takes uniques 3 (tycon), 4, 5, 6 (3 data cons) --- etc. +-- TyCon for sum of arity k: +-- 00000000 kkkkkkkk 11111111 +-- DataCon for sum of arity k and alternative n: +-- 00000000 kkkkkkkk nnnnnnnn mkSumTyConUnique :: Arity -> Unique -mkSumTyConUnique arity = mkUnique 'z' (sumUniqsOccupied arity) +mkSumTyConUnique arity = + ASSERT(arity < 0xff) + mkUnique 'z' (arity `shiftL` 8 .|. 0xff) mkSumDataConUnique :: ConTagZ -> Arity -> Unique mkSumDataConUnique alt arity | alt >= arity = panic ("mkSumDataConUnique: " ++ show alt ++ " >= " ++ show arity) | otherwise - = mkUnique 'z' (sumUniqsOccupied arity + alt + 1 {- skip the tycon -}) - --- How many unique slots occupied by sum types (including constructors) up to --- the given arity? -sumUniqsOccupied :: Arity -> Int -sumUniqsOccupied arity - = ASSERT(arity >= 2) - -- 3 + 4 + ... + arity - ((arity * (arity + 1)) `div` 2) - 3 -{-# INLINE sumUniqsOccupied #-} + = mkUnique 'z' (arity `shiftL` 8 + alt) {- skip the tycon -} -------------------------------------------------- dataConRepNameUnique, dataConWorkerUnique :: Unique -> Unique From git at git.haskell.org Thu Sep 8 18:52:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:15 +0000 (UTC) Subject: [commit: ghc] wip/names3: Handle deserialization of tuples, etc specifically (5674451) Message-ID: <20160908185215.480493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/56744512abba0574c1f3a81a521367a319c6e078/ghc >--------------------------------------------------------------- commit 56744512abba0574c1f3a81a521367a319c6e078 Author: Ben Gamari Date: Sat Aug 20 16:52:26 2016 -0400 Handle deserialization of tuples, etc specifically Previously BinIface would build a UniqFM containing all of the known-key things and use this to resolve the Names of known-key things during interface file deserialization. However, this has the disadvantage of building up a rather large map containing all type and data constructors for anonymous sums and tuples. We now instead add codepaths to map a unique back to its associated known key name, allowing us to greatly shrink the size of the map. >--------------------------------------------------------------- 56744512abba0574c1f3a81a521367a319c6e078 compiler/basicTypes/Unique.hs | 35 --------- compiler/ghc.cabal.in | 1 + compiler/prelude/KnownUniques.hs | 135 ++++++++++++++++++++++++++++++++++ compiler/prelude/KnownUniques.hs-boot | 17 +++++ compiler/prelude/PrelInfo.hs | 18 ----- compiler/prelude/TysWiredIn.hs | 19 +++-- 6 files changed, 166 insertions(+), 59 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 56744512abba0574c1f3a81a521367a319c6e078 From git at git.haskell.org Thu Sep 8 18:52:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:17 +0000 (UTC) Subject: [commit: ghc] wip/names3: Fix it (5d2f8d7) Message-ID: <20160908185217.F0D843A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/5d2f8d7906377447fcf604bafefe12ce083953c0/ghc >--------------------------------------------------------------- commit 5d2f8d7906377447fcf604bafefe12ce083953c0 Author: Ben Gamari Date: Sun Aug 21 10:43:04 2016 -0400 Fix it >--------------------------------------------------------------- 5d2f8d7906377447fcf604bafefe12ce083953c0 compiler/ghc.mk | 1 + compiler/iface/BinIface.hs | 4 +++- compiler/prelude/KnownUniques.hs | 23 ++++++++++++++++++----- compiler/prelude/PrelInfo.hs | 10 ++++++++-- compiler/prelude/TysWiredIn.hs | 4 ++++ 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 5aeda53..1d30386 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -488,6 +488,7 @@ compiler_stage2_dll0_MODULES = \ IfaceType \ InstEnv \ Kind \ + KnownUniques \ Lexeme \ ListSetOps \ Literal \ diff --git a/compiler/iface/BinIface.hs b/compiler/iface/BinIface.hs index 190da9e..e6b08b8 100644 --- a/compiler/iface/BinIface.hs +++ b/compiler/iface/BinIface.hs @@ -290,8 +290,10 @@ serialiseName bh name _ = do -- The format of this word is: -- 00xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx -- A normal name. x is an index into the symbol table --- 10xxxxxx xxyyyyyy yyyyyyyy yyyyyyyyyy +-- 10xxxxxx xxyyyyyy yyyyyyyy yyyyyyyy -- A known-key name. x is the Unique's Char, y is the int part +-- +-- During serialization we check for known-key things using isKnownKeyName. -- See Note [Symbol table representation of names] putName :: BinDictionary -> BinSymbolTable -> BinHandle -> Name -> IO () diff --git a/compiler/prelude/KnownUniques.hs b/compiler/prelude/KnownUniques.hs index 15f953a..e87a489 100644 --- a/compiler/prelude/KnownUniques.hs +++ b/compiler/prelude/KnownUniques.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP #-} + -- | -- Some types (e.g. tuples and anonymous sums) have large numbers of known key -- names which we handle specially to avoid bloating 'PrelInfo.knownKeyNames'. @@ -20,13 +22,20 @@ module KnownUniques , mkCTupleDataConUnique ) where +#include "HsVersions.h" + import TysWiredIn +import TyCon +import DataCon +import Id import BasicTypes import Outputable - import Unique import Name +import Util + import Data.Bits +import Data.Maybe -- | Get the 'Name' associated with a known-key 'Unique'. knownUniqueName :: Unique -> Maybe Name @@ -70,8 +79,8 @@ mkSumDataConUnique alt arity getUnboxedSumName :: Int -> Name getUnboxedSumName n = case n .&. 0xff of - 0xff -> sumTyCon arity - alt -> sumDataCon (alt + 1) + 0xff -> tyConName $ sumTyCon arity + alt -> dataConName $ sumDataCon (alt + 1) arity where arity = n `shiftR` 0xff -- Note [Uniques for tuple type and data constructors] @@ -100,13 +109,15 @@ getCTupleTyConName n = case n `divMod` 2 of (arity, 0) -> cTupleTyConName arity (arity, 1) -> mkPrelTyConRepName $ cTupleTyConName arity + _ -> panic "getCTupleTyConName: impossible" getCTupleDataConUnique :: Int -> Name getCTupleDataConUnique n = case n `divMod` 3 of (arity, 0) -> cTupleDataConName arity - (arity, 1) -> panic "getCTupleDataConUnique: no worker" + (arity, 1) -> panic "getCTupleDataConName: no worker" (arity, 2) -> mkPrelTyConRepName $ cTupleDataConName arity + _ -> panic "getCTupleDataConName: impossible" -------------------------------------------------- -- Normal tuples @@ -125,11 +136,13 @@ getTupleTyConName boxity n = (arity, 0) -> tyConName $ tupleTyCon boxity arity (arity, 1) -> fromMaybe (panic "getTupleTyConName") $ tyConRepName_maybe $ tupleTyCon boxity arity + _ -> panic "getTupleTyConName: impossible" getTupleDataConName :: Boxity -> Int -> Name getTupleDataConName boxity n = case n `divMod` 3 of (arity, 0) -> dataConName $ tupleDataCon boxity arity - (arity, 1) -> idName $ dcWorkId $ tupleDataCon boxity arity + (arity, 1) -> idName $ dataConWorkId $ tupleDataCon boxity arity (arity, 2) -> fromMaybe (panic "getTupleDataCon") $ tyConRepName_maybe $ promotedTupleDataCon boxity arity + _ -> panic "getTupleDataConName: impossible" diff --git a/compiler/prelude/PrelInfo.hs b/compiler/prelude/PrelInfo.hs index a853bfa..bca992c 100644 --- a/compiler/prelude/PrelInfo.hs +++ b/compiler/prelude/PrelInfo.hs @@ -27,6 +27,8 @@ module PrelInfo ( #include "HsVersions.h" +import KnownUniques + import ConLike ( ConLike(..) ) import PrelNames import PrelRules @@ -45,7 +47,9 @@ import UniqFM import Util import {-# SOURCE #-} TcTypeNats ( typeNatTyCons ) +import Control.Applicative ((<|>)) import Data.Array +import Data.Maybe {- ************************************************************************ @@ -134,11 +138,13 @@ knownKeyNames -- | Given a 'Unique' lookup its associated 'Name' if it corresponds to a -- known-key thing. lookupKnownKeyName :: Unique -> Maybe Name -lookupKnownKeyName = lookupUFM knownKeysMap +lookupKnownKeyName u = + knownUniqueName u <|> lookupUFM knownKeysMap u -- | Is a 'Name' known-key? isKnownKeyName :: Name -> Bool -isKnownKeyName n = elemUFM n knownKeysMap +isKnownKeyName n = + isJust (knownUniqueName $ nameUnique n) || elemUFM n knownKeysMap knownKeysMap :: UniqFM Name knownKeysMap = listToUFM [ (nameUnique n, n) | n <- knownKeyNames ] diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index 27a1f4f..f41edc8 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -633,6 +633,10 @@ Note [How tuples work] See also Note [Known-key names] in PrelNames between BoxedTuple and ConstraintTuple (same OccName!), so tuples are not serialised into interface files using OccNames at all. +* Serialization to interface files works via the usual mechanism for known-key + things: instead of serializing the OccName we just serialize the key. + See Note [Symbol table representation of names] for details. + Note [One-tuples] ~~~~~~~~~~~~~~~~~ GHC supports both boxed and unboxed one-tuples: From git at git.haskell.org Thu Sep 8 18:52:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:20 +0000 (UTC) Subject: [commit: ghc] wip/names3: LoadIFace: Show known names on inconsistent interface file (00ed93b) Message-ID: <20160908185220.A0AEE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/00ed93bcbbea356a9b839cc57fee46acd4dffee8/ghc >--------------------------------------------------------------- commit 00ed93bcbbea356a9b839cc57fee46acd4dffee8 Author: Ben Gamari Date: Sat Aug 20 09:11:31 2016 -0400 LoadIFace: Show known names on inconsistent interface file >--------------------------------------------------------------- 00ed93bcbbea356a9b839cc57fee46acd4dffee8 compiler/iface/LoadIface.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs index ad5f7d3..c5c3538 100644 --- a/compiler/iface/LoadIface.hs +++ b/compiler/iface/LoadIface.hs @@ -138,7 +138,7 @@ importDecl name { eps <- getEps ; case lookupTypeEnv (eps_PTE eps) name of Just thing -> return (Succeeded thing) - Nothing -> return (Failed not_found_msg) + Nothing -> return $ Failed (ifPprDebug (found_things_msg eps) $$ not_found_msg) }}} where nd_doc = text "Need decl for" <+> ppr name @@ -146,6 +146,11 @@ importDecl name pprNameSpace (occNameSpace (nameOccName name)) <+> ppr name) 2 (vcat [text "Probable cause: bug in .hi-boot file, or inconsistent .hi file", text "Use -ddump-if-trace to get an idea of which file caused the error"]) + found_things_msg eps = + hang (text "Found the following declarations in" <+> ppr (nameModule name) <> colon) + 2 (vcat (map ppr $ filter is_interesting $ nameEnvElts $ eps_PTE eps)) + where + is_interesting thing = nameModule name == nameModule (getName thing) {- From git at git.haskell.org Thu Sep 8 18:52:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:23 +0000 (UTC) Subject: [commit: ghc] wip/names3: TysWiredIn: Non-user symbols needn't be handled by isBuiltInOcc (acfc69c) Message-ID: <20160908185223.50FF63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/acfc69c48b187e58e3d4b31ef3c815259cf8b129/ghc >--------------------------------------------------------------- commit acfc69c48b187e58e3d4b31ef3c815259cf8b129 Author: Ben Gamari Date: Tue Aug 23 08:11:11 2016 -0400 TysWiredIn: Non-user symbols needn't be handled by isBuiltInOcc >--------------------------------------------------------------- acfc69c48b187e58e3d4b31ef3c815259cf8b129 compiler/prelude/TysWiredIn.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index f41edc8..0d53aed 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -664,11 +664,14 @@ decl in GHC.Classes, so I think this part may not work properly. But it's unused I think. -} --- | Built in syntax isn't "in scope" so these OccNames map to wired-in Names +-- | Built-in syntax isn't "in scope" so these OccNames map to wired-in Names -- with BuiltInSyntax. However, this should only be necessary while resolving -- names produced by Template Haskell splices since we take care to encode -- built-in syntax names specially in interface files. See -- Note [Symbol table representation of names]. +-- +-- Moreover, there is no need to include names of things that the user can't +-- write (e.g. type representation bindings like $tc(,,,)). isBuiltInOcc_maybe :: OccName -> Maybe Name isBuiltInOcc_maybe occ = case name of From git at git.haskell.org Thu Sep 8 18:52:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:26 +0000 (UTC) Subject: [commit: ghc] wip/names3: IfaceSyn: Make IfaceTopBndr a Name (c838833) Message-ID: <20160908185226.07B743A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/c83883320c17ff0c9dec6889f12762d16954be5c/ghc >--------------------------------------------------------------- commit c83883320c17ff0c9dec6889f12762d16954be5c Author: Ben Gamari Date: Tue Aug 23 15:03:29 2016 -0400 IfaceSyn: Make IfaceTopBndr a Name Previously it was a Name but this made it unduly difficult to >--------------------------------------------------------------- c83883320c17ff0c9dec6889f12762d16954be5c compiler/iface/IfaceSyn.hs | 121 +++++++++++++++++++++++--------------------- compiler/iface/LoadIface.hs | 2 +- compiler/iface/MkIface.hs | 36 +++++++------ compiler/iface/TcIface.hs | 63 ++++++++++------------- 4 files changed, 108 insertions(+), 114 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c83883320c17ff0c9dec6889f12762d16954be5c From git at git.haskell.org Thu Sep 8 18:52:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:28 +0000 (UTC) Subject: [commit: ghc] wip/names3: TysWiredIn: Recognize unboxed sums in isBuiltInOcc_maybe (7df76ec) Message-ID: <20160908185228.BD02A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/7df76ec7e53b332862ee7e6c42711a543874b714/ghc >--------------------------------------------------------------- commit 7df76ec7e53b332862ee7e6c42711a543874b714 Author: Ben Gamari Date: Tue Aug 23 16:40:28 2016 -0400 TysWiredIn: Recognize unboxed sums in isBuiltInOcc_maybe >--------------------------------------------------------------- 7df76ec7e53b332862ee7e6c42711a543874b714 compiler/prelude/TysWiredIn.hs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index 0d53aed..8f35f7b 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -677,17 +677,38 @@ isBuiltInOcc_maybe occ = case name of "[]" -> Just $ choose_ns listTyConName nilDataConName ":" -> Just consDataConName + "[::]" -> Just parrTyConName + + -- boxed tuple data/tycon "()" -> Just $ tup_name Boxed 0 - "(##)" -> Just $ tup_name Unboxed 0 _ | Just rest <- "(" `stripPrefix` name , (commas, rest') <- BS.span (==',') rest , ")" <- rest' -> Just $ tup_name Boxed (1+BS.length commas) + + -- unboxed tuple data/tycon + "(##)" -> Just $ tup_name Unboxed 0 _ | Just rest <- "(#" `stripPrefix` name , (commas, rest') <- BS.span (==',') rest , "#)" <- rest' -> Just $ tup_name Unboxed (1+BS.length commas) + + -- unboxed sum tycon + _ | Just rest <- "(#" `stripPrefix` name + , (pipes, rest') <- BS.span (=='|') rest + , "#)" <- rest' + -> Just $ tyConName $ sumTyCon (1+BS.length pipes) + + -- unboxed sum datacon + _ | Just rest <- "(#" `stripPrefix` name + , (pipes1, rest') <- BS.span (=='|') rest + , Just rest'' <- "_" `stripPrefix` rest' + , (pipes2, rest''') <- BS.span (=='|') rest'' + , "#)" <- rest''' + -> let arity = BS.length pipes1 + BS.length pipes2 + alt = BS.length pipes1 + 1 + in Just $ dataConName $ sumDataCon alt arity _ -> Nothing where -- TODO: Drop when bytestring 0.10.8 can be assumed From git at git.haskell.org Thu Sep 8 18:52:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:31 +0000 (UTC) Subject: [commit: ghc] wip/names3: Fix it up (f53bb80) Message-ID: <20160908185231.6DF373A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/f53bb8025adefcf4bb042bdc86c2f1afc7b0c9f7/ghc >--------------------------------------------------------------- commit f53bb8025adefcf4bb042bdc86c2f1afc7b0c9f7 Author: Ben Gamari Date: Wed Aug 24 13:53:36 2016 -0400 Fix it up >--------------------------------------------------------------- f53bb8025adefcf4bb042bdc86c2f1afc7b0c9f7 compiler/iface/IfaceSyn.hs | 2 +- compiler/iface/MkIface.hs | 51 +++++++++++++++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index 9a45ee0..8a96449 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -416,7 +416,7 @@ ifaceConDeclImplicitBndrs (IfCon { ifConWrapper = has_wrapper, ifConName = con_n -- declaration with the name of the binder. (#5614, #7215) ifaceDeclFingerprints :: Fingerprint -> IfaceDecl -> [(OccName,Fingerprint)] ifaceDeclFingerprints hash decl - = (occName (ifName decl), hash) : + = (getOccName decl, hash) : [ (occ, computeFingerprint' (hash,occ)) | occ <- ifaceDeclImplicitBndrs decl ] where diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index ff57c0b..5eaccf8 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -368,6 +368,18 @@ mkHashFun hsc_env eps -- --------------------------------------------------------------------------- -- Compute fingerprints for the interface +-- | Add fingerprints for top-level declarations to a 'ModIface'. +-- +-- The general idea here is that we first examine the 'IfaceDecl's and determine +-- the recursive groups of them. We then walk these groups in dependency order, +-- serializing each contained 'IfaceDecl' to a "Binary" buffer which we then +-- hash using MD5 to produce a fingerprint for the group. However, the +-- serialization that we use is a bit funny: we override the @putName@ operation +-- with our own which serializes the hash of a 'Name' instead of the 'Name' +-- itself. This ensures that the fingerprint of a decl changes if anything in its +-- transitive closure changes. This trick is why we must be careful about +-- traversing in dependency order: we need to ensure that we have hashes for +-- everything referenced by the decl which we are fingerprinting. addFingerprints :: HscEnv -> Maybe Fingerprint -- the old fingerprint, if any @@ -390,14 +402,15 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls non_orph_fis decl edges :: [(IfaceDeclABI, Unique, [Unique])] - edges = [ (abi, getUnique (ifName decl), out) + edges = [ (abi, getUnique (getOccName decl), out) | decl <- new_decls , let abi = declABI decl , let out = localOccs $ freeNamesDeclABI abi ] name_module n = ASSERT2( isExternalName n, ppr n ) nameModule n - localOccs = map (getUnique . getParent . getOccName) + localOccs = + map (getUnique . getParent . getOccName) . filter ((== this_mod) . name_module) . nonDetEltsUFM -- It's OK to use nonDetEltsUFM as localOccs is only @@ -405,7 +418,8 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls -- stronglyConnCompFromEdgedVertices is deterministic -- even with non-deterministic order of edges as -- explained in Note [Deterministic SCC] in Digraph. - where getParent occ = lookupOccEnv parent_map occ `orElse` occ + where getParent :: OccName -> OccName + getParent occ = lookupOccEnv parent_map occ `orElse` occ -- maps OccNames to their parents in the current module. -- e.g. a reference to a constructor must be turned into a reference @@ -417,27 +431,34 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls where n = occName $ ifName d -- strongly-connected groups of declarations, in dependency order - groups = stronglyConnCompFromEdgedVerticesUniq edges + groups = + pprTrace "edges" (ppr edges) $ + stronglyConnCompFromEdgedVerticesUniq edges global_hash_fn = mkHashFun hsc_env eps - -- how to output Names when generating the data to fingerprint. + -- How to output Names when generating the data to fingerprint. -- Here we want to output the fingerprint for each top-level -- Name, whether it comes from the current module or another -- module. In this way, the fingerprint for a declaration will -- change if the fingerprint for anything it refers to (transitively) -- changes. - mk_put_name :: (OccEnv (OccName,Fingerprint)) + mk_put_name :: OccEnv (OccName,Fingerprint) -> NameSet -> BinHandle -> Name -> IO () - mk_put_name local_env bh name + mk_put_name local_env self_names bh name | isWiredInName name = putNameLiterally bh name -- wired-in names don't have fingerprints + | name `elemNameSet` self_names = putNameLiterally bh name + -- we may end up writing the Name of a thing we are currently fingerprinting; + -- naturally we don't know its hash yet so we instead just write the + -- name literally | otherwise = ASSERT2( isExternalName name, ppr name ) let hash | nameModule name /= this_mod = global_hash_fn name | otherwise = snd (lookupOccEnv local_env (getOccName name) - `orElse` pprPanic "urk! lookup local fingerprint" - (ppr name)) -- (undefined,fingerprint0)) + `orElse` pprTrace "urk! lookup local fingerprint" (ppr name $$ ppr (getUnique $ getOccName name) $$ ppr local_env) + -- (ppr name)) + (undefined,fingerprint0)) -- This panic indicates that we got the dependency -- analysis wrong, because we needed a fingerprint for -- an entity that wasn't in the environment. To debug @@ -457,9 +478,9 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls [(Fingerprint,IfaceDecl)]) fingerprint_group (local_env, decls_w_hashes) (AcyclicSCC abi) - = do let hash_fn = mk_put_name local_env + = do let hash_fn = mk_put_name local_env (extendNameSet (ifaceDeclImplicitBndrs abi) getName decl) decl = abiDecl abi - --pprTrace "fingerprinting" (ppr (ifName decl) ) $ do + pprTrace "fingerprinting" (ppr (ifName decl) $$ ppr abi) $ do hash <- computeFingerprint hash_fn abi env' <- extend_hash_env local_env (hash,decl) return (env', (hash,decl) : decls_w_hashes) @@ -468,8 +489,8 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls = do let decls = map abiDecl abis local_env1 <- foldM extend_hash_env local_env (zip (repeat fingerprint0) decls) - let hash_fn = mk_put_name local_env1 - -- pprTrace "fingerprinting" (ppr (map ifName decls) ) $ do + let hash_fn = mk_put_name local_env1 (unionNameSets $ getName decl : map ifaceDeclImplicitBndrs decls) + pprTrace "fingerprinting" (ppr (map ifName decls) ) $ do let stable_abis = sortBy cmp_abiNames abis -- put the cycle in a canonical order hash <- computeFingerprint hash_fn stable_abis @@ -518,7 +539,9 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls -- instances yourself, no need to consult hs-boot; if you do load the -- interface into EPS, you will see a duplicate orphan instance. - orphan_hash <- computeFingerprint (mk_put_name local_env) + orphan_hash <- + let hash_fn = mk_put_name local_env emptyNameSet + in computeFingerprint hash_fn (map ifDFun orph_insts, orph_rules, orph_fis) -- the export list hash doesn't depend on the fingerprints of From git at git.haskell.org Thu Sep 8 18:52:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:34 +0000 (UTC) Subject: [commit: ghc] wip/names3: Disable traces (8f5de2c) Message-ID: <20160908185234.1AEC73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/8f5de2c779207b94f5b0a09b53b169c18af8c0c0/ghc >--------------------------------------------------------------- commit 8f5de2c779207b94f5b0a09b53b169c18af8c0c0 Author: Ben Gamari Date: Wed Aug 24 14:26:38 2016 -0400 Disable traces >--------------------------------------------------------------- 8f5de2c779207b94f5b0a09b53b169c18af8c0c0 compiler/iface/BinIface.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/iface/BinIface.hs b/compiler/iface/BinIface.hs index bd5bf90..bc4271e 100644 --- a/compiler/iface/BinIface.hs +++ b/compiler/iface/BinIface.hs @@ -303,7 +303,7 @@ putName _dict BinSymbolTable{ | isKnownKeyName name , let (c, u) = unpkUnique (nameUnique name) -- INVARIANT: (ord c) fits in 8 bits = -- ASSERT(u < 2^(22 :: Int)) - pprTrace "putName" (ppr name <+> ppr c <+> ppr u) $ + --pprTrace "putName" (ppr name <+> ppr c <+> ppr u) $ put_ bh (0x80000000 .|. (fromIntegral (ord c) `shiftL` 22) .|. (fromIntegral u :: Word32)) | otherwise @@ -311,7 +311,8 @@ putName _dict BinSymbolTable{ case lookupUFM symtab_map name of Just (off,_) -> put_ bh (fromIntegral off :: Word32) Nothing -> do - off <- pprTrace "putName2" (ppr name) $ readFastMutInt symtab_next + off <- --pprTrace "putName2" (ppr name) $ + readFastMutInt symtab_next -- MASSERT(off < 2^(30 :: Int)) writeFastMutInt symtab_next (off+1) writeIORef symtab_map_ref From git at git.haskell.org Thu Sep 8 18:52:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:36 +0000 (UTC) Subject: [commit: ghc] wip/names3: KnownUniques: Satisfy haddock (196711b) Message-ID: <20160908185236.C35A13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/196711ba4a49a71e41040caac6bc23bddb5b0b70/ghc >--------------------------------------------------------------- commit 196711ba4a49a71e41040caac6bc23bddb5b0b70 Author: Ben Gamari Date: Thu Aug 25 11:12:54 2016 -0400 KnownUniques: Satisfy haddock >--------------------------------------------------------------- 196711ba4a49a71e41040caac6bc23bddb5b0b70 compiler/prelude/KnownUniques.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/prelude/KnownUniques.hs b/compiler/prelude/KnownUniques.hs index e87a489..f1fa1bf 100644 --- a/compiler/prelude/KnownUniques.hs +++ b/compiler/prelude/KnownUniques.hs @@ -123,7 +123,7 @@ getCTupleDataConUnique n = -- Normal tuples mkTupleDataConUnique :: Boxity -> Arity -> Unique -mkTupleDataConUnique Boxed a = mkUnique '7' (3*a) -- *may* be used in C labels +mkTupleDataConUnique Boxed a = mkUnique '7' (3*a) -- may be used in C labels mkTupleDataConUnique Unboxed a = mkUnique '8' (3*a) mkTupleTyConUnique :: Boxity -> Arity -> Unique From git at git.haskell.org Thu Sep 8 18:52:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:39 +0000 (UTC) Subject: [commit: ghc] wip/names3: Binary: Distinguish binding and non-binding Names (362457f) Message-ID: <20160908185239.79AA03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/362457f953f0bc7dc119de1f87f8c218a4ea307c/ghc >--------------------------------------------------------------- commit 362457f953f0bc7dc119de1f87f8c218a4ea307c Author: Ben Gamari Date: Thu Aug 25 11:14:54 2016 -0400 Binary: Distinguish binding and non-binding Names >--------------------------------------------------------------- 362457f953f0bc7dc119de1f87f8c218a4ea307c compiler/basicTypes/Name.hs | 4 ++- compiler/iface/BinIface.hs | 5 ++-- compiler/iface/FlagChecker.hs | 3 ++- compiler/iface/IfaceSyn.hs | 58 +++++++++++++++++++++++++++---------------- compiler/iface/MkIface.hs | 57 ++++++++++++++++++++++-------------------- compiler/utils/Binary.hs | 13 +++++++--- 6 files changed, 85 insertions(+), 55 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 362457f953f0bc7dc119de1f87f8c218a4ea307c From git at git.haskell.org Thu Sep 8 18:52:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:42 +0000 (UTC) Subject: [commit: ghc] wip/names3: MkIface: Disable tracing (126855d) Message-ID: <20160908185242.29B1B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/126855d576c4a15d073f1a7aaf97240a5bd92482/ghc >--------------------------------------------------------------- commit 126855d576c4a15d073f1a7aaf97240a5bd92482 Author: Ben Gamari Date: Thu Aug 25 13:07:12 2016 -0400 MkIface: Disable tracing >--------------------------------------------------------------- 126855d576c4a15d073f1a7aaf97240a5bd92482 compiler/iface/MkIface.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index d787251..077f243 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -439,7 +439,6 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls -- strongly-connected groups of declarations, in dependency order groups = - pprTrace "edges" (ppr edges) $ stronglyConnCompFromEdgedVerticesUniq edges global_hash_fn = mkHashFun hsc_env eps @@ -461,9 +460,8 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls = ASSERT2( isExternalName name, ppr name ) let hash | nameModule name /= this_mod = global_hash_fn name | otherwise = snd (lookupOccEnv local_env (getOccName name) - `orElse` pprTrace "urk! lookup local fingerprint" (ppr name $$ ppr (getUnique $ getOccName name) $$ ppr local_env) - -- (ppr name)) - (undefined,fingerprint0)) + `orElse` pprPanic "urk! lookup local fingerprint" + (ppr name)) -- (undefined,fingerprint0)) -- This panic indicates that we got the dependency -- analysis wrong, because we needed a fingerprint for -- an entity that wasn't in the environment. To debug @@ -485,7 +483,7 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls fingerprint_group (local_env, decls_w_hashes) (AcyclicSCC abi) = do let hash_fn = mk_put_name local_env decl = abiDecl abi - pprTrace "fingerprinting" (ppr (ifName decl) $$ ppr abi) $ do + --pprTrace "fingerprinting" (ppr (ifName decl) ) $ do hash <- computeFingerprint hash_fn abi env' <- extend_hash_env local_env (hash,decl) return (env', (hash,decl) : decls_w_hashes) @@ -495,7 +493,7 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls local_env1 <- foldM extend_hash_env local_env (zip (repeat fingerprint0) decls) let hash_fn = mk_put_name local_env1 - pprTrace "fingerprinting" (ppr (map ifName decls) ) $ do + -- pprTrace "fingerprinting" (ppr (map ifName decls) ) $ do let stable_abis = sortBy cmp_abiNames abis -- put the cycle in a canonical order hash <- computeFingerprint hash_fn stable_abis From git at git.haskell.org Thu Sep 8 18:52:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:44 +0000 (UTC) Subject: [commit: ghc] wip/names3: Clarify Note [Fingerprinting IfaceDecls] (78b50a6) Message-ID: <20160908185244.CBEF03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/78b50a62a406976f7c6cd20f990a0f7a34a93eaf/ghc >--------------------------------------------------------------- commit 78b50a62a406976f7c6cd20f990a0f7a34a93eaf Author: Ben Gamari Date: Thu Aug 25 15:22:00 2016 -0400 Clarify Note [Fingerprinting IfaceDecls] >--------------------------------------------------------------- 78b50a62a406976f7c6cd20f990a0f7a34a93eaf compiler/iface/MkIface.hs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 077f243..358c813 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -375,13 +375,20 @@ Note [Fingerprinting IfaceDecls] The general idea here is that we first examine the 'IfaceDecl's and determine the recursive groups of them. We then walk these groups in dependency order, serializing each contained 'IfaceDecl' to a "Binary" buffer which we then -hash using MD5 to produce a fingerprint for the group. However, the -serialization that we use is a bit funny: we override the @putName@ operation -with our own which serializes the hash of a 'Name' instead of the 'Name' -itself. This ensures that the fingerprint of a decl changes if anything in its -transitive closure changes. This trick is why we must be careful about +hash using MD5 to produce a fingerprint for the group. + +However, the serialization that we use is a bit funny: we override the @putName@ +operation with our own which serializes the hash of a 'Name' instead of the +'Name' itself. This ensures that the fingerprint of a decl changes if anything +in its transitive closure changes. This trick is why we must be careful about traversing in dependency order: we need to ensure that we have hashes for everything referenced by the decl which we are fingerprinting. + +Moreover, we need to be careful to distinguish between serialization of binding +Names (e.g. the ifName field of a IfaceDecl) and non-binding (e.g. the ifInstCls +field of a IfaceClsInst): only in the non-binding case should we include the +fingerprint; in the binding case we shouldn't since it is merely the name of the +thing that we are currently fingerprinting. -} -- | Add fingerprints for top-level declarations to a 'ModIface'. From git at git.haskell.org Thu Sep 8 18:52:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:47 +0000 (UTC) Subject: [commit: ghc] wip/names3: Fix determinism (680fb03) Message-ID: <20160908185247.7A95E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/680fb0318641dbc1b9f2df80aeb93757bb84056c/ghc >--------------------------------------------------------------- commit 680fb0318641dbc1b9f2df80aeb93757bb84056c Author: Ben Gamari Date: Thu Aug 25 15:41:16 2016 -0400 Fix determinism >--------------------------------------------------------------- 680fb0318641dbc1b9f2df80aeb93757bb84056c compiler/iface/MkIface.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 358c813..80d29c4 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -566,7 +566,7 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls -- put the declarations in a canonical order, sorted by OccName let sorted_decls = Map.elems $ Map.fromList $ - [(ifName d, e) | e@(_, d) <- decls_w_hashes] + [(getOccName d, e) | e@(_, d) <- decls_w_hashes] -- the flag hash depends on: -- - (some of) dflags @@ -738,8 +738,8 @@ abiDecl :: IfaceDeclABI -> IfaceDecl abiDecl (_, decl, _) = decl cmp_abiNames :: IfaceDeclABI -> IfaceDeclABI -> Ordering -cmp_abiNames abi1 abi2 = ifName (abiDecl abi1) `compare` - ifName (abiDecl abi2) +cmp_abiNames abi1 abi2 = getOccName (abiDecl abi1) `compare` + getOccName (abiDecl abi2) freeNamesDeclABI :: IfaceDeclABI -> NameSet freeNamesDeclABI (_mod, decl, extras) = From git at git.haskell.org Thu Sep 8 18:52:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:50 +0000 (UTC) Subject: [commit: ghc] wip/names3: Split up putName variants (0d43cbe) Message-ID: <20160908185250.A26773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/0d43cbe7f2a36f4024d1cf034f13a666c4b323a4/ghc >--------------------------------------------------------------- commit 0d43cbe7f2a36f4024d1cf034f13a666c4b323a4 Author: Ben Gamari Date: Thu Sep 8 12:06:06 2016 -0400 Split up putName variants >--------------------------------------------------------------- 0d43cbe7f2a36f4024d1cf034f13a666c4b323a4 compiler/basicTypes/Name.hs | 7 ++-- compiler/basicTypes/Name.hs-boot | 4 --- compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/iface/BinFingerprint.hs | 42 ++++++++++++++++++++++ compiler/iface/BinIface.hs | 7 ++-- compiler/iface/FlagChecker.hs | 3 +- compiler/iface/IfaceSyn.hs | 5 ++- compiler/iface/MkIface.hs | 17 +++------ compiler/utils/Binary.hs | 76 ++++++++++++++++++++------------------- compiler/utils/Fingerprint.hsc | 15 ++++++-- ghc/Main.hs | 3 +- libraries/base/GHC/Fingerprint.hs | 1 - 13 files changed, 117 insertions(+), 65 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0d43cbe7f2a36f4024d1cf034f13a666c4b323a4 From git at git.haskell.org Thu Sep 8 18:52:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 18:52:53 +0000 (UTC) Subject: [commit: ghc] wip/names3: Add type signature (f174286) Message-ID: <20160908185253.5265B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/f174286c402ff59ac523603caf408a6889923fe2/ghc >--------------------------------------------------------------- commit f174286c402ff59ac523603caf408a6889923fe2 Author: Ben Gamari Date: Thu Sep 8 14:51:30 2016 -0400 Add type signature >--------------------------------------------------------------- f174286c402ff59ac523603caf408a6889923fe2 compiler/iface/MkIface.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 0f16da8..f05426d 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -446,6 +446,7 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls where n = occName $ ifName d -- strongly-connected groups of declarations, in dependency order + groups :: [SCC IfaceDeclABI] groups = stronglyConnCompFromEdgedVerticesUniq edges From git at git.haskell.org Thu Sep 8 19:06:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 8 Sep 2016 19:06:25 +0000 (UTC) Subject: [commit: ghc] master: Update unix submodule to latest HEAD. (a8238a4) Message-ID: <20160908190625.8C8433A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a8238a4eb628dcab93e19021b27c0cf2b38ef7d0/ghc >--------------------------------------------------------------- commit a8238a4eb628dcab93e19021b27c0cf2b38ef7d0 Author: Edward Z. Yang Date: Thu Sep 8 12:05:30 2016 -0700 Update unix submodule to latest HEAD. Fixes readdir validation error (fixes #12572). Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- a8238a4eb628dcab93e19021b27c0cf2b38ef7d0 libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index 40820da..7b20b4c 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 40820da5fb35c53aed53c211277c3e6077c1ddf9 +Subproject commit 7b20b4cbc35a2fea3f26c988f9b2a95640babaaa From git at git.haskell.org Fri Sep 9 12:29:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 9 Sep 2016 12:29:20 +0000 (UTC) Subject: [commit: ghc] branch 'fd/D2519' created Message-ID: <20160909122920.A59E63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : fd/D2519 Referencing: d5f19714ef9789d4c1d5ea029f06add296162140 From git at git.haskell.org Fri Sep 9 12:29:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 9 Sep 2016 12:29:23 +0000 (UTC) Subject: [commit: ghc] fd/D2519: Fix the local type environment of module finalizers. (d5f1971) Message-ID: <20160909122924.002AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : fd/D2519 Link : http://ghc.haskell.org/trac/ghc/changeset/d5f19714ef9789d4c1d5ea029f06add296162140/ghc >--------------------------------------------------------------- commit d5f19714ef9789d4c1d5ea029f06add296162140 Author: Facundo Domínguez Date: Thu Sep 8 23:07:20 2016 -0300 Fix the local type environment of module finalizers. Summary: Before, the local type environment of the finalizer was the one present when the finalizer was added. This ignored the top-level Ids that would be present in the local type environment at the end of type-checking. This behavior was introduced in the fix to #11832. Now the local type environment at the end of type-checking is used to extend the local type environment of the finalizer. Test Plan: ./validate Reviewers: simonpj, bgamari, austin Subscribers: mboes, thomie Differential Revision: https://phabricator.haskell.org/D2519 GHC Trac Issues: #11832 >--------------------------------------------------------------- d5f19714ef9789d4c1d5ea029f06add296162140 compiler/typecheck/TcRnMonad.hs | 7 ++++++- testsuite/tests/th/TH_reifyGlobalDefs.hs | 22 ++++++++++++++++++++++ testsuite/tests/th/TH_reifyGlobalDefs.stderr | 2 ++ testsuite/tests/th/all.T | 1 + 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index a83fbf2..1c845c3 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -1539,7 +1539,12 @@ addModFinalizersWithLclEnv mod_finalizers = do lcl_env <- getLclEnv th_modfinalizers_var <- fmap tcg_th_modfinalizers getGblEnv updTcRef th_modfinalizers_var $ \fins -> - setLclEnv lcl_env (runRemoteModFinalizers mod_finalizers) + -- We extend the current local type environment with the local type + -- environment at the end of type-checking which contains all the + -- top-level Ids. + updLclEnv (\env -> lcl_env + { tcl_env = plusNameEnv (tcl_env env) (tcl_env lcl_env) }) + (runRemoteModFinalizers mod_finalizers) : fins #else addModFinalizersWithLclEnv :: ThModFinalizers -> TcM () diff --git a/testsuite/tests/th/TH_reifyGlobalDefs.hs b/testsuite/tests/th/TH_reifyGlobalDefs.hs new file mode 100644 index 0000000..d909b57 --- /dev/null +++ b/testsuite/tests/th/TH_reifyGlobalDefs.hs @@ -0,0 +1,22 @@ +-- test reification of global definitions +{-# LANGUAGE TemplateHaskell #-} +import Language.Haskell.TH.Syntax +import System.IO + + +g :: Int +g = 1 + +main :: IO () +main = + $(do + let printTypeOf n = do + addModFinalizer $ do + VarI _ t _ <- reify (mkName n) + runIO $ hPutStrLn stderr (n ++ " :: " ++ show t) + printTypeOf "g" + ds <- [d| f = True |] + addTopDecls ds + printTypeOf "f" + [| return () |] + ) diff --git a/testsuite/tests/th/TH_reifyGlobalDefs.stderr b/testsuite/tests/th/TH_reifyGlobalDefs.stderr new file mode 100644 index 0000000..f510249 --- /dev/null +++ b/testsuite/tests/th/TH_reifyGlobalDefs.stderr @@ -0,0 +1,2 @@ +f :: ConT GHC.Types.Bool +g :: ConT GHC.Types.Int diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 5d2fe3b..5e72fef 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -78,6 +78,7 @@ test('TH_spliceD2', test('TH_reifyDecl1', normal, compile, ['-v0']) test('TH_reifyDecl2', normal, compile, ['-v0']) test('TH_reifyLocalDefs', normal, compile, ['-v0']) +test('TH_reifyGlobalDefs', normal, compile, ['-v0']) test('TH_reifyMkName', normal, compile, ['-v0']) From git at git.haskell.org Fri Sep 9 13:02:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 9 Sep 2016 13:02:46 +0000 (UTC) Subject: [commit: ghc] master: Add hook for creating ghci external interpreter (65d9597) Message-ID: <20160909130246.D0A543A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/65d9597d98ead78198bb747aed4e1163ee0d60d3/ghc >--------------------------------------------------------------- commit 65d9597d98ead78198bb747aed4e1163ee0d60d3 Author: Alan Zimmerman Date: Thu Sep 8 08:59:48 2016 +0200 Add hook for creating ghci external interpreter Summary: The external interpreter is launched by calling 'System.Process.createProcess' with a 'CreateProcess' parameter. The current value for this has the 'std_in', 'std_out' and 'std_err' fields use the default of 'Inherit', meaning that the remote interpreter shares the stdio with the original ghc/ghci process. This patch introduces a new hook to the DynFlags, which has an opportunity to override the 'CreateProcess' fields, launch the process, and retrieve the stdio handles actually used. So if a ghci external interpreter session is launched from the GHC API the stdio can be redirected if required, which is useful for tooling/IDE integration. Test Plan: ./validate Reviewers: austin, hvr, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2518 >--------------------------------------------------------------- 65d9597d98ead78198bb747aed4e1163ee0d60d3 compiler/ghci/GHCi.hs | 18 ++++++++++++------ compiler/main/Hooks.hs | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/compiler/ghci/GHCi.hs b/compiler/ghci/GHCi.hs index b4777a3..c6d0d22 100644 --- a/compiler/ghci/GHCi.hs +++ b/compiler/ghci/GHCi.hs @@ -60,6 +60,7 @@ import Exception import BasicTypes import FastString import Util +import Hooks import Control.Concurrent import Control.Monad @@ -449,7 +450,11 @@ startIServ dflags = do prog = pgm_i dflags ++ flavour opts = getOpts dflags opt_i debugTraceMsg dflags 3 $ text "Starting " <> text prog - (ph, rh, wh) <- runWithPipes prog opts + let createProc = lookupHook createIservProcessHook + (\cp -> do { (_,_,_,ph) <- createProcess cp + ; return ph }) + dflags + (ph, rh, wh) <- runWithPipes createProc prog opts lo_ref <- newIORef Nothing cache_ref <- newIORef emptyUFM return $ IServ @@ -474,7 +479,8 @@ stopIServ HscEnv{..} = then return () else iservCall iserv Shutdown -runWithPipes :: FilePath -> [String] -> IO (ProcessHandle, Handle, Handle) +runWithPipes :: (CreateProcess -> IO ProcessHandle) + -> FilePath -> [String] -> IO (ProcessHandle, Handle, Handle) #ifdef mingw32_HOST_OS foreign import ccall "io.h _close" c__close :: CInt -> IO CInt @@ -482,26 +488,26 @@ foreign import ccall "io.h _close" foreign import ccall unsafe "io.h _get_osfhandle" _get_osfhandle :: CInt -> IO CInt -runWithPipes prog opts = do +runWithPipes createProc prog opts = do (rfd1, wfd1) <- createPipeFd -- we read on rfd1 (rfd2, wfd2) <- createPipeFd -- we write on wfd2 wh_client <- _get_osfhandle wfd1 rh_client <- _get_osfhandle rfd2 let args = show wh_client : show rh_client : opts - (_, _, _, ph) <- createProcess (proc prog args) + ph <- createProc (proc prog args) rh <- mkHandle rfd1 wh <- mkHandle wfd2 return (ph, rh, wh) where mkHandle :: CInt -> IO Handle mkHandle fd = (fdToHandle fd) `onException` (c__close fd) #else -runWithPipes prog opts = do +runWithPipes createProc prog opts = do (rfd1, wfd1) <- Posix.createPipe -- we read on rfd1 (rfd2, wfd2) <- Posix.createPipe -- we write on wfd2 setFdOption rfd1 CloseOnExec True setFdOption wfd2 CloseOnExec True let args = show wfd1 : show rfd2 : opts - (_, _, _, ph) <- createProcess (proc prog args) + ph <- createProc (proc prog args) closeFd wfd1 closeFd rfd2 rh <- fdToHandle rfd1 diff --git a/compiler/main/Hooks.hs b/compiler/main/Hooks.hs index 237101b..8d706d8 100644 --- a/compiler/main/Hooks.hs +++ b/compiler/main/Hooks.hs @@ -25,6 +25,7 @@ module Hooks ( Hooks , runRnSpliceHook #ifdef GHCI , getValueSafelyHook + , createIservProcessHook #endif ) where @@ -45,6 +46,7 @@ import CoreSyn import GHCi.RemoteTypes import SrcLoc import Type +import System.Process #endif import BasicTypes @@ -78,6 +80,7 @@ emptyHooks = Hooks , runRnSpliceHook = Nothing #ifdef GHCI , getValueSafelyHook = Nothing + , createIservProcessHook = Nothing #endif } @@ -96,6 +99,7 @@ data Hooks = Hooks , runRnSpliceHook :: Maybe (HsSplice Name -> RnM (HsSplice Name)) #ifdef GHCI , getValueSafelyHook :: Maybe (HscEnv -> Name -> Type -> IO (Maybe HValue)) + , createIservProcessHook :: Maybe (CreateProcess -> IO ProcessHandle) #endif } From git at git.haskell.org Fri Sep 9 17:26:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 9 Sep 2016 17:26:27 +0000 (UTC) Subject: [commit: ghc] master: Make start address of `osReserveHeapMemory` tunable via command line -xb (1b5f920) Message-ID: <20160909172627.874613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1b5f9207a649a64a1bba20b0283253425f9208d7/ghc >--------------------------------------------------------------- commit 1b5f9207a649a64a1bba20b0283253425f9208d7 Author: Francesco Mazzoli Date: Fri Sep 9 18:15:49 2016 +0100 Make start address of `osReserveHeapMemory` tunable via command line -xb Summary: We stumbled upon a case where an external library (OpenCL) does not work if a specific address (0x200000000) is taken. It so happens that `osReserveHeapMemory` starts trying to mmap at 0x200000000: ``` void *hint = (void*)((W_)8 * (1 << 30) + attempt * BLOCK_SIZE); at = osTryReserveHeapMemory(*len, hint); ``` This makes it impossible to use Haskell programs compiled with GHC 8 with C functions that use OpenCL. See this example ​https://github.com/chpatrick/oclwtf for a repro. This patch allows the user to work around this kind of behavior outside our control by letting the user override the starting address through an RTS command line flag. Reviewers: bgamari, Phyx, simonmar, erikd, austin Reviewed By: Phyx, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D2513 >--------------------------------------------------------------- 1b5f9207a649a64a1bba20b0283253425f9208d7 docs/users_guide/8.0.2-notes.rst | 4 ++++ includes/stg/Types.h | 4 ++++ rts/RtsFlags.c | 5 ++++- rts/posix/OSMem.c | 30 +++++++++++++++++++++++------- rts/sm/MBlock.c | 6 +++++- rts/sm/OSMem.h | 5 ++++- rts/win32/OSMem.c | 9 +++++---- 7 files changed, 49 insertions(+), 14 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1b5f9207a649a64a1bba20b0283253425f9208d7 From git at git.haskell.org Sat Sep 10 17:58:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 10 Sep 2016 17:58:42 +0000 (UTC) Subject: [commit: ghc] master: Remove -flocal-ghci-history from default flags (7b4bb40) Message-ID: <20160910175842.0BBA63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7b4bb40555eb19b528a976ff1f1b43c8bded6373/ghc >--------------------------------------------------------------- commit 7b4bb40555eb19b528a976ff1f1b43c8bded6373 Author: Ryan Scott Date: Sat Sep 10 13:51:23 2016 -0400 Remove -flocal-ghci-history from default flags Summary: D2461 seemed to (inadvertently, I think) add the `-flocal-ghci-history` flag to the list of `defaultFlags` that are enabled automatically. As a result, every invocation of `ghci` caused a local GHCi history to be saved to the current directory, which probably shouldn't be the default. Test Plan: Run `ghci`, observe the lack of a `.ghci_history` file in your working directory Reviewers: austin, thomie, bgamari Reviewed By: bgamari Subscribers: ak3n Differential Revision: https://phabricator.haskell.org/D2520 GHC Trac Issues: #9089 >--------------------------------------------------------------- 7b4bb40555eb19b528a976ff1f1b43c8bded6373 compiler/main/DynFlags.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index fa471d3..7546936 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -3675,7 +3675,6 @@ defaultFlags settings Opt_FlatCache, Opt_GenManifest, Opt_GhciHistory, - Opt_LocalGhciHistory, Opt_GhciSandbox, Opt_HelpfulErrors, Opt_KeepHiFiles, From git at git.haskell.org Sat Sep 10 19:33:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 10 Sep 2016 19:33:10 +0000 (UTC) Subject: [commit: ghc] master: Add platform warning to Foreign.C.Types (710f21c) Message-ID: <20160910193310.2533C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/710f21cc3a6f10dac1b31d089458e5fd16f6d3db/ghc >--------------------------------------------------------------- commit 710f21cc3a6f10dac1b31d089458e5fd16f6d3db Author: Tamar Christina Date: Sat Sep 10 13:04:19 2016 +0100 Add platform warning to Foreign.C.Types Summary: The generated documentation for thhe Foreign.C.Types module is generated based on the platform which ran Haddock. This is generating incorrect types for e.g. Windows. Add a disclaimer to the top of the page to ask people to keep this in mind. Test Plan: make documentation and inspect Haddock Reviewers: erikd, austin, hvr, bgamari Reviewed By: erikd Subscribers: RyanGlScott, #ghc_windows_task_force, thomie Differential Revision: https://phabricator.haskell.org/D2523 GHC Trac Issues: #12586 >--------------------------------------------------------------- 710f21cc3a6f10dac1b31d089458e5fd16f6d3db libraries/base/Foreign/C/Types.hs | 6 ++++++ libraries/base/System/Posix/Types.hs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libraries/base/Foreign/C/Types.hs b/libraries/base/Foreign/C/Types.hs index a16f838..6d084bf 100644 --- a/libraries/base/Foreign/C/Types.hs +++ b/libraries/base/Foreign/C/Types.hs @@ -23,6 +23,12 @@ module Foreign.C.Types ( -- * Representations of C types -- $ctypes + -- ** Platform differences + -- | This module contains platform specific information about types. + -- __/As such the types presented on this page reflect the platform + -- on which the documentation was generated and may not coincide with + -- the types on your platform./__ + -- ** Integral types -- | These types are represented as @newtype at s of -- types in "Data.Int" and "Data.Word", and are instances of diff --git a/libraries/base/System/Posix/Types.hs b/libraries/base/System/Posix/Types.hs index 5389e6e..52fce87 100644 --- a/libraries/base/System/Posix/Types.hs +++ b/libraries/base/System/Posix/Types.hs @@ -25,6 +25,12 @@ module System.Posix.Types ( -- * POSIX data types + + -- ** Platform differences + -- | This module contains platform specific information about types. + -- __/As such the types presented on this page reflect the platform + -- on which the documentation was generated and may not coincide with + -- the types on your platform./__ #if defined(HTYPE_DEV_T) CDev(..), #endif From git at git.haskell.org Sun Sep 11 13:39:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 11 Sep 2016 13:39:03 +0000 (UTC) Subject: [commit: ghc] master: Generalise type of mkMatchGroup to unify with mkMatchGroupName (158288b) Message-ID: <20160911133903.48D423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/158288bdd4e2391982936f796f3004d7d7b5d8df/ghc >--------------------------------------------------------------- commit 158288bdd4e2391982936f796f3004d7d7b5d8df Author: Matthew Pickering Date: Sun Sep 11 14:33:14 2016 +0100 Generalise type of mkMatchGroup to unify with mkMatchGroupName >--------------------------------------------------------------- 158288bdd4e2391982936f796f3004d7d7b5d8df compiler/hsSyn/HsUtils.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs index 641aac1..118e551 100644 --- a/compiler/hsSyn/HsUtils.hs +++ b/compiler/hsSyn/HsUtils.hs @@ -152,8 +152,9 @@ unguardedGRHSs rhs@(L loc _) unguardedRHS :: SrcSpan -> Located (body id) -> [LGRHS id (Located (body id))] unguardedRHS loc rhs = [L loc (GRHS [] rhs)] -mkMatchGroup :: Origin -> [LMatch RdrName (Located (body RdrName))] - -> MatchGroup RdrName (Located (body RdrName)) +mkMatchGroup :: (PostTc name Type ~ PlaceHolder) + => Origin -> [LMatch name (Located (body name))] + -> MatchGroup name (Located (body name)) mkMatchGroup origin matches = MG { mg_alts = mkLocatedList matches , mg_arg_tys = [] , mg_res_ty = placeHolderType @@ -165,10 +166,7 @@ mkLocatedList ms = L (combineLocs (head ms) (last ms)) ms mkMatchGroupName :: Origin -> [LMatch Name (Located (body Name))] -> MatchGroup Name (Located (body Name)) -mkMatchGroupName origin matches = MG { mg_alts = mkLocatedList matches - , mg_arg_tys = [] - , mg_res_ty = placeHolderType - , mg_origin = origin } +mkMatchGroupName = mkMatchGroup mkHsApp :: LHsExpr name -> LHsExpr name -> LHsExpr name mkHsApp e1 e2 = addCLoc e1 e2 (HsApp e1 e2) From git at git.haskell.org Sun Sep 11 13:39:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 11 Sep 2016 13:39:06 +0000 (UTC) Subject: [commit: ghc] master: Remove uses of mkMatchGroupName (04184a2) Message-ID: <20160911133906.11EBA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/04184a2a582d175dad4a696f5047cd66bfe26f8e/ghc >--------------------------------------------------------------- commit 04184a2a582d175dad4a696f5047cd66bfe26f8e Author: Matthew Pickering Date: Sun Sep 11 14:35:27 2016 +0100 Remove uses of mkMatchGroupName You can now just use `mkMatchGroup`. >--------------------------------------------------------------- 04184a2a582d175dad4a696f5047cd66bfe26f8e compiler/hsSyn/HsUtils.hs | 8 ++------ compiler/rename/RnBinds.hs | 2 +- compiler/typecheck/TcPatSyn.hs | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs index 118e551..5e51272 100644 --- a/compiler/hsSyn/HsUtils.hs +++ b/compiler/hsSyn/HsUtils.hs @@ -22,7 +22,7 @@ module HsUtils( -- Terms mkHsPar, mkHsApp, mkHsAppType, mkHsAppTypeOut, mkHsConApp, mkHsCaseAlt, mkSimpleMatch, unguardedGRHSs, unguardedRHS, - mkMatchGroup, mkMatchGroupName, mkMatch, mkHsLam, mkHsIf, + mkMatchGroup, mkMatch, mkHsLam, mkHsIf, mkHsWrap, mkLHsWrap, mkHsWrapCo, mkHsWrapCoR, mkLHsWrapCo, mkHsDictLet, mkHsLams, mkHsOpApp, mkHsDo, mkHsComp, mkHsWrapPat, mkHsWrapPatCo, @@ -164,10 +164,6 @@ mkLocatedList :: [Located a] -> Located [Located a] mkLocatedList [] = noLoc [] mkLocatedList ms = L (combineLocs (head ms) (last ms)) ms -mkMatchGroupName :: Origin -> [LMatch Name (Located (body Name))] - -> MatchGroup Name (Located (body Name)) -mkMatchGroupName = mkMatchGroup - mkHsApp :: LHsExpr name -> LHsExpr name -> LHsExpr name mkHsApp e1 e2 = addCLoc e1 e2 (HsApp e1 e2) @@ -703,7 +699,7 @@ mkTopFunBind :: Origin -> Located Name -> [LMatch Name (LHsExpr Name)] -> HsBind Name -- In Name-land, with empty bind_fvs mkTopFunBind origin fn ms = FunBind { fun_id = fn - , fun_matches = mkMatchGroupName origin ms + , fun_matches = mkMatchGroup origin ms , fun_co_fn = idHsWrapper , bind_fvs = emptyNameSet -- NB: closed -- binding diff --git a/compiler/rename/RnBinds.hs b/compiler/rename/RnBinds.hs index 4af699a..1eadf29 100644 --- a/compiler/rename/RnBinds.hs +++ b/compiler/rename/RnBinds.hs @@ -1028,7 +1028,7 @@ rnMatchGroup ctxt rnBody (MG { mg_alts = L _ ms, mg_origin = origin }) = do { empty_case_ok <- xoptM LangExt.EmptyCase ; when (null ms && not empty_case_ok) (addErr (emptyCaseErr ctxt)) ; (new_ms, ms_fvs) <- mapFvRn (rnMatch ctxt rnBody) ms - ; return (mkMatchGroupName origin new_ms, ms_fvs) } + ; return (mkMatchGroup origin new_ms, ms_fvs) } rnMatch :: Outputable (body RdrName) => HsMatchContext Name -> (Located (body RdrName) -> RnM (Located (body Name), FreeVars)) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 81a2029..548b746 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -555,7 +555,7 @@ tcPatSynBuilderBind (PSB { psb_id = L loc name, psb_def = lpat Unidirectional -> panic "tcPatSynBuilderBind" mk_mg :: LHsExpr Name -> MatchGroup Name (LHsExpr Name) - mk_mg body = mkMatchGroupName Generated [builder_match] + mk_mg body = mkMatchGroup Generated [builder_match] where builder_args = [L loc (VarPat (L loc n)) | L loc n <- args] builder_match = mkMatch (FunRhs (L loc name) Prefix) From git at git.haskell.org Sun Sep 11 14:40:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 11 Sep 2016 14:40:46 +0000 (UTC) Subject: [commit: ghc] master: Fix derived Ix instances for one-constructor GADTs (7b7ea8f) Message-ID: <20160911144046.8E5743A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7b7ea8f40e7400b8c183595a85bb2c65c9f9bb29/ghc >--------------------------------------------------------------- commit 7b7ea8f40e7400b8c183595a85bb2c65c9f9bb29 Author: Ryan Scott Date: Sun Sep 11 10:27:36 2016 -0400 Fix derived Ix instances for one-constructor GADTs Summary: Standalone-derived `Ix` instances would panic on GADTs with exactly one constructor, since the list of fields was being passed to a function that uses `foldl1` in order to generate an implementation for `inRange`. This adds a simple check that makes `inRange` be `True` whenever a product type has no fields. Fixes #12583. Test Plan: make test TEST=12583 Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2521 GHC Trac Issues: #12583 >--------------------------------------------------------------- 7b7ea8f40e7400b8c183595a85bb2c65c9f9bb29 compiler/hsSyn/HsExpr.hs | 12 +++++++++--- compiler/typecheck/TcGenDeriv.hs | 7 ++++++- docs/users_guide/8.0.2-notes.rst | 3 +++ testsuite/tests/deriving/should_compile/T12583.hs | 11 +++++++++++ testsuite/tests/deriving/should_compile/all.T | 1 + 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 78e6ad7..1ff204b 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -1954,9 +1954,15 @@ ppr_do_stmts stmts pprComp :: (OutputableBndrId id, Outputable body) => [LStmt id body] -> SDoc pprComp quals -- Prints: body | qual1, ..., qualn - | not (null quals) - , L _ (LastStmt body _ _) <- last quals - = hang (ppr body <+> vbar) 2 (pprQuals (dropTail 1 quals)) + | Just (initStmts, L _ (LastStmt body _ _)) <- snocView quals + = if null initStmts + -- If there are no statements in a list comprehension besides the last + -- one, we simply treat it like a normal list. This does arise + -- occasionally in code that GHC generates, e.g., in implementations of + -- 'range' for derived 'Ix' instances for product datatypes with exactly + -- one constructor (e.g., see Trac #12583). + then ppr body + else hang (ppr body <+> vbar) 2 (pprQuals initStmts) | otherwise = pprPanic "pprComp" (pprQuals quals) diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index f378172..69f9d98 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -908,7 +908,12 @@ gen_Ix_binds loc tycon = mk_easy_FunBind loc inRange_RDR [nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed, con_pat cs_needed] $ - foldl1 and_Expr (zipWith3Equal "single_con_inRange" in_range as_needed bs_needed cs_needed) + if con_arity == 0 + -- If the product type has no fields, inRange is trivially true + -- (see Trac #12853). + then true_Expr + else foldl1 and_Expr (zipWith3Equal "single_con_inRange" in_range + as_needed bs_needed cs_needed) where in_range a b c = nlHsApps inRange_RDR [mkLHsVarTuple [a,b], nlHsVar c] diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 924998f..43c9562 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -22,6 +22,9 @@ Language refer to closed local bindings. For instance, this is now permitted: ``f = static x where x = 'a'``. +- A bug has been fixed that caused standalone derived ``Ix`` instances to fail + for GADTs with exactly one constructor (:ghc-ticket:`12583`). + Compiler ~~~~~~~~ diff --git a/testsuite/tests/deriving/should_compile/T12583.hs b/testsuite/tests/deriving/should_compile/T12583.hs new file mode 100644 index 0000000..9dc151b --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T12583.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE GADTs #-} +{-# LANGUAGE StandaloneDeriving #-} +module T12583 where + +import Data.Ix + +data Foo a where + MkFoo :: (Eq a, Ord a, Ix a) => Foo a +deriving instance Eq (Foo a) +deriving instance Ord (Foo a) +deriving instance Ix (Foo a) diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index e42e34d..6beae8a 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -72,3 +72,4 @@ test('T11732c', normal, compile, ['']) test('T11833', normal, compile, ['']) test('T12245', normal, compile, ['']) test('T12399', normal, compile, ['']) +test('T12583', normal, compile, ['']) From git at git.haskell.org Sun Sep 11 15:14:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 11 Sep 2016 15:14:54 +0000 (UTC) Subject: [commit: ghc] master: Fix TH ppr output for list comprehensions with only one Stmt (0e7ccf6) Message-ID: <20160911151454.0A44A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0e7ccf6d233c66b23a60de4e35e039f78ea3e162/ghc >--------------------------------------------------------------- commit 0e7ccf6d233c66b23a60de4e35e039f78ea3e162 Author: Ryan Scott Date: Sun Sep 11 11:10:36 2016 -0400 Fix TH ppr output for list comprehensions with only one Stmt A folow-up to D2521 (which addressed #12583), where the `Outputable` `ppr` output was tweaked to display a list comprehension with only one `Stmt` as `[Foo]` instead of `[Foo|]` (which isn't valid Haskell). I forgot to update the corresponding code in `Language.Haskell.TH.Ppr` which pretty-prints `CompE`, however, so this commit takes care of that. >--------------------------------------------------------------- 0e7ccf6d233c66b23a60de4e35e039f78ea3e162 libraries/template-haskell/Language/Haskell/TH/Ppr.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs index 0462a8d..7376135 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs @@ -179,12 +179,17 @@ pprExp i (DoE ss_) = parensIf (i > noPrec) $ text "do" <+> pprStms ss_ pprExp _ (CompE []) = text "<>" -- This will probably break with fixity declarations - would need a ';' -pprExp _ (CompE ss) = text "[" <> ppr s - <+> bar - <+> commaSep ss' - <> text "]" - where s = last ss - ss' = init ss +pprExp _ (CompE ss) = + if null ss' + -- If there are no statements in a list comprehension besides the last + -- one, we simply treat it like a normal list. + then text "[" <> ppr s <> text "]" + else text "[" <> ppr s + <+> bar + <+> commaSep ss' + <> text "]" + where s = last ss + ss' = init ss pprExp _ (ArithSeqE d) = ppr d pprExp _ (ListE es) = brackets (commaSep es) pprExp i (SigE e t) = parensIf (i > noPrec) $ ppr e <+> dcolon <+> ppr t From git at git.haskell.org Mon Sep 12 07:33:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 07:33:51 +0000 (UTC) Subject: [commit: ghc] master: Add hs_try_putmvar() (454033b) Message-ID: <20160912073351.112763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/454033b54e2f7eef2354cc9d7ae7e7cba4dff09a/ghc >--------------------------------------------------------------- commit 454033b54e2f7eef2354cc9d7ae7e7cba4dff09a Author: Simon Marlow Date: Tue Aug 30 20:55:10 2016 +0100 Add hs_try_putmvar() Summary: This is a fast, non-blocking, asynchronous, interface to tryPutMVar that can be called from C/C++. It's useful for callback-based C/C++ APIs: the idea is that the callback invokes hs_try_putmvar(), and the Haskell code waits for the callback to run by blocking in takeMVar. The callback doesn't block - this is often a requirement of callback-based APIs. The callback wakes up the Haskell thread with minimal overhead and no unnecessary context-switches. There are a couple of benchmarks in testsuite/tests/concurrent/should_run. Some example results comparing hs_try_putmvar() with using a standard foreign export: ./hs_try_putmvar003 1 64 16 100 +RTS -s -N4 0.49s ./hs_try_putmvar003 2 64 16 100 +RTS -s -N4 2.30s hs_try_putmvar() is 4x faster for this workload (see the source for hs_try_putmvar003.hs for details of the workload). An alternative solution is to use the IO Manager for this. We've tried it, but there are problems with that approach: * Need to create a new file descriptor for each callback * The IO Manger thread(s) become a bottleneck * More potential for things to go wrong, e.g. throwing an exception in an IO Manager callback kills the IO Manager thread. Test Plan: validate; new unit tests Reviewers: niteria, erikd, ezyang, bgamari, austin, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2501 >--------------------------------------------------------------- 454033b54e2f7eef2354cc9d7ae7e7cba4dff09a docs/users_guide/ffi-chap.rst | 119 +++++++++++++++++++++ includes/HsFFI.h | 4 + libraries/base/GHC/Conc.hs | 2 + libraries/base/GHC/Conc/Sync.hs | 14 +++ rts/Capability.c | 1 + rts/Capability.h | 13 ++- rts/Prelude.h | 2 + rts/PrimOps.cmm | 8 ++ rts/RtsAPI.c | 75 +++++++++++++ rts/Schedule.c | 15 ++- rts/Task.c | 11 +- rts/Task.h | 10 +- rts/Threads.c | 79 ++++++++++++++ rts/Threads.h | 2 + rts/package.conf.in | 2 + testsuite/tests/concurrent/should_run/Makefile | 6 ++ testsuite/tests/concurrent/should_run/all.T | 31 ++++++ .../concurrent/should_run/hs_try_putmvar001.hs | 34 ++++++ .../should_run/hs_try_putmvar001.stdout} | 0 .../concurrent/should_run/hs_try_putmvar001_c.c | 31 ++++++ .../concurrent/should_run/hs_try_putmvar002.hs | 66 ++++++++++++ .../concurrent/should_run/hs_try_putmvar002_c.c | 28 +++++ .../concurrent/should_run/hs_try_putmvar003.hs | 88 +++++++++++++++ .../concurrent/should_run/hs_try_putmvar003_c.c | 83 ++++++++++++++ 24 files changed, 714 insertions(+), 10 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 454033b54e2f7eef2354cc9d7ae7e7cba4dff09a From git at git.haskell.org Mon Sep 12 12:42:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 12:42:53 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Remove references to -XRelaxedPolyRec (02f0941) Message-ID: <20160912124253.61AB93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/02f09410fa6b015ad84153c0d7680a5f59d81daa/ghc >--------------------------------------------------------------- commit 02f09410fa6b015ad84153c0d7680a5f59d81daa Author: Ben Gamari Date: Mon Sep 5 19:19:23 2016 -0400 Remove references to -XRelaxedPolyRec Test Plan: Read it Reviewers: dfeuer, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2515 GHC Trac Issues: #11691 (cherry picked from commit feaa31fbc41685d69045ac8d34be4e18f4f27ffd) >--------------------------------------------------------------- 02f09410fa6b015ad84153c0d7680a5f59d81daa docs/users_guide/bugs.rst | 51 +++++++++++++++++++++++++ docs/users_guide/glasgow_exts.rst | 62 ------------------------------- utils/mkUserGuidePart/Options/Language.hs | 8 ---- 3 files changed, 51 insertions(+), 70 deletions(-) diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst index a1ec885..006d5ce 100644 --- a/docs/users_guide/bugs.rst +++ b/docs/users_guide/bugs.rst @@ -126,6 +126,57 @@ been decided to remove them from the next version of the language standard. This behaviour can be controlled with the ``DatatypeContexts`` extension. See :ref:`datatype-contexts`. +.. _infelicities-recursive-groups: + +Typechecking of recursive binding groups +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The Haskell Report specifies that a group of bindings (at top level, or +in a ``let`` or ``where``) should be sorted into strongly-connected +components, and then type-checked in dependency order +(`Haskell Report, Section +4.5.1 `__). As +each group is type-checked, any binders of the group that have an +explicit type signature are put in the type environment with the +specified polymorphic type, and all others are monomorphic until the +group is generalised (`Haskell Report, Section +4.5.2 `__). + +Following a suggestion of Mark Jones, in his paper `Typing Haskell in +Haskell `__, GHC implements a +more general scheme. In GHC *the dependency analysis ignores references to +variables that have an explicit type signature*. As a result of this refined +dependency analysis, the dependency groups are smaller, and more bindings will +typecheck. For example, consider: :: + + f :: Eq a => a -> Bool + f x = (x == x) || g True || g "Yes" + + g y = (y <= y) || f True + +This is rejected by Haskell 98, but under Jones's scheme the definition +for ``g`` is typechecked first, separately from that for ``f``, because +the reference to ``f`` in ``g``\'s right hand side is ignored by the +dependency analysis. Then ``g``\'s type is generalised, to get :: + + g :: Ord a => a -> Bool + +Now, the definition for ``f`` is typechecked, with this type for ``g`` +in the type environment. + +The same refined dependency analysis also allows the type signatures of +mutually-recursive functions to have different contexts, something that is +illegal in Haskell 98 (Section 4.5.2, last sentence). GHC only insists that the +type signatures of a *refined* group have identical type signatures; in practice +this means that only variables bound by the same pattern binding must have the +same context. For example, this is fine: :: + + f :: Eq a => a -> Bool + f x = (x == x) || g True + + g :: Ord a => a -> Bool + g y = (y <= y) || f True + .. _infelicities-Modules: Module system and interface files diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 3015cec..d7ba481 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -8343,7 +8343,6 @@ Lexically scoped type variables .. ghc-flag:: -XScopedTypeVariables - :implies: :ghc-flag:`-XRelaxedPolyRec` :implies: :ghc-flag:`-XExplicitForAll` Enable lexical scoping of type variables explicitly introduced with @@ -8367,9 +8366,6 @@ signature for ``ys``. In Haskell 98 it is not possible to declare a type for ``ys``; a major benefit of scoped type variables is that it becomes possible to do so. -Lexically-scoped type variables are enabled by -:ghc-flag:`-XScopedTypeVariables`. This flag implies :ghc-flag:`-XRelaxedPolyRec`. - Overview -------- @@ -8582,64 +8578,6 @@ the Haskell Report) can be completely switched off by restriction is switched off by default in GHCi's interactive options (see :ref:`ghci-interactive-options`). -.. _typing-binds: - -Generalised typing of mutually recursive bindings -------------------------------------------------- - -.. ghc-flag:: -XRelaxedPolyRec - - Allow the typechecker to ignore references to bindings with - explicit type signatures. - -The Haskell Report specifies that a group of bindings (at top level, or -in a ``let`` or ``where``) should be sorted into strongly-connected -components, and then type-checked in dependency order -(`Haskell Report, Section -4.5.1 `__). As -each group is type-checked, any binders of the group that have an -explicit type signature are put in the type environment with the -specified polymorphic type, and all others are monomorphic until the -group is generalised (`Haskell Report, Section -4.5.2 `__). - -Following a suggestion of Mark Jones, in his paper `Typing Haskell in -Haskell `__, GHC implements a -more general scheme. If :ghc-flag:`-XRelaxedPolyRec` is specified: *the -dependency analysis ignores references to variables that have an -explicit type signature*. As a result of this refined dependency -analysis, the dependency groups are smaller, and more bindings will -typecheck. For example, consider: :: - - f :: Eq a => a -> Bool - f x = (x == x) || g True || g "Yes" - - g y = (y <= y) || f True - -This is rejected by Haskell 98, but under Jones's scheme the definition -for ``g`` is typechecked first, separately from that for ``f``, because -the reference to ``f`` in ``g``\'s right hand side is ignored by the -dependency analysis. Then ``g``\'s type is generalised, to get :: - - g :: Ord a => a -> Bool - -Now, the definition for ``f`` is typechecked, with this type for ``g`` -in the type environment. - -The same refined dependency analysis also allows the type signatures of -mutually-recursive functions to have different contexts, something that -is illegal in Haskell 98 (Section 4.5.2, last sentence). With -:ghc-flag:`-XRelaxedPolyRec` GHC only insists that the type signatures of a -*refined* group have identical type signatures; in practice this means -that only variables bound by the same pattern binding must have the same -context. For example, this is fine: :: - - f :: Eq a => a -> Bool - f x = (x == x) || g True - - g :: Ord a => a -> Bool - g y = (y <= y) || f True - .. _mono-local-binds: Let-generalisation diff --git a/utils/mkUserGuidePart/Options/Language.hs b/utils/mkUserGuidePart/Options/Language.hs index cb45347..7b58290 100644 --- a/utils/mkUserGuidePart/Options/Language.hs +++ b/utils/mkUserGuidePart/Options/Language.hs @@ -601,14 +601,6 @@ languageOptions = , flagReverse = "-XNoRecursiveDo" , flagSince = "6.8.1" } - , flag { flagName = "-XRelaxedPolyRec" - , flagDescription = - "*(deprecated)* Relaxed checking for :ref:`mutually-recursive "++ - "polymorphic functions `." - , flagType = DynamicFlag - , flagReverse = "-XNoRelaxedPolyRec" - , flagSince = "6.8.1" - } , flag { flagName = "-XRoleAnnotations" , flagDescription = "Enable :ref:`role annotations `." From git at git.haskell.org Mon Sep 12 12:42:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 12:42:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Clarify pkg selection when multiple versions are available (11cf0c6) Message-ID: <20160912124256.2FA6A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/11cf0c63c03516d5e468f941ed39caabf382b3b0/ghc >--------------------------------------------------------------- commit 11cf0c63c03516d5e468f941ed39caabf382b3b0 Author: Harendra Kumar Date: Tue Aug 30 16:55:08 2016 -0400 Clarify pkg selection when multiple versions are available Reviewers: austin, bgamari, ezyang Reviewed By: ezyang Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2464 (cherry picked from commit 6781f37d1915ab08cdb3846839a1d485a874049b) >--------------------------------------------------------------- 11cf0c63c03516d5e468f941ed39caabf382b3b0 docs/users_guide/conf.py | 6 +- docs/users_guide/packages.rst | 270 ++++++++++++++++++++++++------------------ 2 files changed, 159 insertions(+), 117 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 11cf0c63c03516d5e468f941ed39caabf382b3b0 From git at git.haskell.org Mon Sep 12 12:42:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 12:42:58 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Document meaning of order of --package-db flags, fixes #12485. (44e823d) Message-ID: <20160912124258.D8E233A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/44e823d39195f8cddd2ae4c587292a3639502050/ghc >--------------------------------------------------------------- commit 44e823d39195f8cddd2ae4c587292a3639502050 Author: Edward Z. Yang Date: Mon Sep 5 19:19:57 2016 -0400 Document meaning of order of --package-db flags, fixes #12485. Test Plan: none Reviewers: austin, niteria, bgamari Reviewed By: niteria Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2514 GHC Trac Issues: #12485 (cherry picked from commit 5eab6a0da5f22a47d04b97a0ec8988346675b33b) >--------------------------------------------------------------- 44e823d39195f8cddd2ae4c587292a3639502050 docs/users_guide/packages.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/users_guide/packages.rst b/docs/users_guide/packages.rst index 15c97c7..d3da125 100644 --- a/docs/users_guide/packages.rst +++ b/docs/users_guide/packages.rst @@ -384,6 +384,11 @@ stack. Several command line options described below can further manipulate this initial stack. You can see GHC's effective package database stack by running GHC with the :ghc-flag:`-v` flag. +This stack structure means that the order of :ghc-flag:`-package-db` flags or +:envvar:`GHC_PACKAGE_PATH` is important. Each substack of the stack +must be well formed (packages in databases on top of the stack can refer +to packages below, but not vice versa). + *Package shadowing:* When multiple package databases are in use it is possible, though rarely, that the same installed package id is present in more than one database. In that case, packages closer to the top of the stack From git at git.haskell.org Mon Sep 12 12:43:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 12:43:01 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add hook for creating ghci external interpreter (daa4de5) Message-ID: <20160912124301.9549F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/daa4de57c9faa3ee471fca92386360e1a06c382b/ghc >--------------------------------------------------------------- commit daa4de57c9faa3ee471fca92386360e1a06c382b Author: Alan Zimmerman Date: Thu Sep 8 08:59:48 2016 +0200 Add hook for creating ghci external interpreter Summary: The external interpreter is launched by calling 'System.Process.createProcess' with a 'CreateProcess' parameter. The current value for this has the 'std_in', 'std_out' and 'std_err' fields use the default of 'Inherit', meaning that the remote interpreter shares the stdio with the original ghc/ghci process. This patch introduces a new hook to the DynFlags, which has an opportunity to override the 'CreateProcess' fields, launch the process, and retrieve the stdio handles actually used. So if a ghci external interpreter session is launched from the GHC API the stdio can be redirected if required, which is useful for tooling/IDE integration. Test Plan: ./validate Reviewers: austin, hvr, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2518 (cherry picked from commit 65d9597d98ead78198bb747aed4e1163ee0d60d3) >--------------------------------------------------------------- daa4de57c9faa3ee471fca92386360e1a06c382b compiler/ghci/GHCi.hs | 18 ++++++++++++------ compiler/main/Hooks.hs | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/compiler/ghci/GHCi.hs b/compiler/ghci/GHCi.hs index 7097e66..094993d 100644 --- a/compiler/ghci/GHCi.hs +++ b/compiler/ghci/GHCi.hs @@ -60,6 +60,7 @@ import Exception import BasicTypes import FastString import Util +import Hooks import Control.Concurrent import Control.Monad @@ -442,7 +443,11 @@ startIServ dflags = do prog = pgm_i dflags ++ flavour opts = getOpts dflags opt_i debugTraceMsg dflags 3 $ text "Starting " <> text prog - (ph, rh, wh) <- runWithPipes prog opts + let createProc = lookupHook createIservProcessHook + (\cp -> do { (_,_,_,ph) <- createProcess cp + ; return ph }) + dflags + (ph, rh, wh) <- runWithPipes createProc prog opts lo_ref <- newIORef Nothing cache_ref <- newIORef emptyUFM return $ IServ @@ -467,7 +472,8 @@ stopIServ HscEnv{..} = then return () else iservCall iserv Shutdown -runWithPipes :: FilePath -> [String] -> IO (ProcessHandle, Handle, Handle) +runWithPipes :: (CreateProcess -> IO ProcessHandle) + -> FilePath -> [String] -> IO (ProcessHandle, Handle, Handle) #ifdef mingw32_HOST_OS foreign import ccall "io.h _close" c__close :: CInt -> IO CInt @@ -475,26 +481,26 @@ foreign import ccall "io.h _close" foreign import ccall unsafe "io.h _get_osfhandle" _get_osfhandle :: CInt -> IO CInt -runWithPipes prog opts = do +runWithPipes createProc prog opts = do (rfd1, wfd1) <- createPipeFd -- we read on rfd1 (rfd2, wfd2) <- createPipeFd -- we write on wfd2 wh_client <- _get_osfhandle wfd1 rh_client <- _get_osfhandle rfd2 let args = show wh_client : show rh_client : opts - (_, _, _, ph) <- createProcess (proc prog args) + ph <- createProc (proc prog args) rh <- mkHandle rfd1 wh <- mkHandle wfd2 return (ph, rh, wh) where mkHandle :: CInt -> IO Handle mkHandle fd = (fdToHandle fd) `onException` (c__close fd) #else -runWithPipes prog opts = do +runWithPipes createProc prog opts = do (rfd1, wfd1) <- Posix.createPipe -- we read on rfd1 (rfd2, wfd2) <- Posix.createPipe -- we write on wfd2 setFdOption rfd1 CloseOnExec True setFdOption wfd2 CloseOnExec True let args = show wfd1 : show rfd2 : opts - (_, _, _, ph) <- createProcess (proc prog args) + ph <- createProc (proc prog args) closeFd wfd1 closeFd rfd2 rh <- fdToHandle rfd1 diff --git a/compiler/main/Hooks.hs b/compiler/main/Hooks.hs index 237101b..8d706d8 100644 --- a/compiler/main/Hooks.hs +++ b/compiler/main/Hooks.hs @@ -25,6 +25,7 @@ module Hooks ( Hooks , runRnSpliceHook #ifdef GHCI , getValueSafelyHook + , createIservProcessHook #endif ) where @@ -45,6 +46,7 @@ import CoreSyn import GHCi.RemoteTypes import SrcLoc import Type +import System.Process #endif import BasicTypes @@ -78,6 +80,7 @@ emptyHooks = Hooks , runRnSpliceHook = Nothing #ifdef GHCI , getValueSafelyHook = Nothing + , createIservProcessHook = Nothing #endif } @@ -96,6 +99,7 @@ data Hooks = Hooks , runRnSpliceHook :: Maybe (HsSplice Name -> RnM (HsSplice Name)) #ifdef GHCI , getValueSafelyHook :: Maybe (HscEnv -> Name -> Type -> IO (Maybe HValue)) + , createIservProcessHook :: Maybe (CreateProcess -> IO ProcessHandle) #endif } From git at git.haskell.org Mon Sep 12 12:43:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 12:43:04 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users_guide: Add release note for createIservProcessHook (61be194) Message-ID: <20160912124304.4A7213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/61be194e789e1e56d20393fec07271dfe477e03d/ghc >--------------------------------------------------------------- commit 61be194e789e1e56d20393fec07271dfe477e03d Author: Ben Gamari Date: Fri Sep 9 09:14:15 2016 -0400 users_guide: Add release note for createIservProcessHook >--------------------------------------------------------------- 61be194e789e1e56d20393fec07271dfe477e03d docs/users_guide/8.0.2-notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index d7c55bd..a5b106d 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -55,3 +55,5 @@ Template Haskell - Accessors are now exposed for ``ErrUtils.ErrMsg`` and ``ErrUtils.ErrDoc``. +- There is now a ``createIservProcessHook`` to allow API users to redirect the + ``stdout`` and ``stderr`` handles. From git at git.haskell.org Mon Sep 12 12:43:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 12:43:06 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add platform warning to Foreign.C.Types (14fb8ef) Message-ID: <20160912124306.EF1F03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/14fb8ef376606a4dd873374a863863357d16ed95/ghc >--------------------------------------------------------------- commit 14fb8ef376606a4dd873374a863863357d16ed95 Author: Tamar Christina Date: Sat Sep 10 13:04:19 2016 +0100 Add platform warning to Foreign.C.Types Summary: The generated documentation for thhe Foreign.C.Types module is generated based on the platform which ran Haddock. This is generating incorrect types for e.g. Windows. Add a disclaimer to the top of the page to ask people to keep this in mind. Test Plan: make documentation and inspect Haddock Reviewers: erikd, austin, hvr, bgamari Reviewed By: erikd Subscribers: RyanGlScott, #ghc_windows_task_force, thomie Differential Revision: https://phabricator.haskell.org/D2523 GHC Trac Issues: #12586 (cherry picked from commit 710f21cc3a6f10dac1b31d089458e5fd16f6d3db) >--------------------------------------------------------------- 14fb8ef376606a4dd873374a863863357d16ed95 libraries/base/Foreign/C/Types.hs | 6 ++++++ libraries/base/System/Posix/Types.hs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libraries/base/Foreign/C/Types.hs b/libraries/base/Foreign/C/Types.hs index fef8e4a..7670f61 100644 --- a/libraries/base/Foreign/C/Types.hs +++ b/libraries/base/Foreign/C/Types.hs @@ -23,6 +23,12 @@ module Foreign.C.Types ( -- * Representations of C types -- $ctypes + -- ** Platform differences + -- | This module contains platform specific information about types. + -- __/As such the types presented on this page reflect the platform + -- on which the documentation was generated and may not coincide with + -- the types on your platform./__ + -- ** Integral types -- | These types are represented as @newtype at s of -- types in "Data.Int" and "Data.Word", and are instances of diff --git a/libraries/base/System/Posix/Types.hs b/libraries/base/System/Posix/Types.hs index c2ac65e..e1fc051 100644 --- a/libraries/base/System/Posix/Types.hs +++ b/libraries/base/System/Posix/Types.hs @@ -25,6 +25,12 @@ module System.Posix.Types ( -- * POSIX data types + + -- ** Platform differences + -- | This module contains platform specific information about types. + -- __/As such the types presented on this page reflect the platform + -- on which the documentation was generated and may not coincide with + -- the types on your platform./__ #if defined(HTYPE_DEV_T) CDev(..), #endif From git at git.haskell.org Mon Sep 12 14:44:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 14:44:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update unix submodule to latest HEAD. (96850ef) Message-ID: <20160912144422.D69973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/96850ef96461df54862e5e9f53deb14145bd6925/ghc >--------------------------------------------------------------- commit 96850ef96461df54862e5e9f53deb14145bd6925 Author: Edward Z. Yang Date: Thu Sep 8 12:05:30 2016 -0700 Update unix submodule to latest HEAD. Fixes readdir validation error (fixes #12572). Signed-off-by: Edward Z. Yang (cherry picked from commit a8238a4eb628dcab93e19021b27c0cf2b38ef7d0) >--------------------------------------------------------------- 96850ef96461df54862e5e9f53deb14145bd6925 libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index 5b2e91a..7b20b4c 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 5b2e91a09190f1686ea195d25183abda1757d771 +Subproject commit 7b20b4cbc35a2fea3f26c988f9b2a95640babaaa From git at git.haskell.org Mon Sep 12 15:21:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 15:21:12 +0000 (UTC) Subject: [commit: ghc] master: Be less picky about reporing inaccessible code (03541cb) Message-ID: <20160912152112.12DAB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03541cbae50f0d1cdf99120ab88698f29a278159/ghc >--------------------------------------------------------------- commit 03541cbae50f0d1cdf99120ab88698f29a278159 Author: Simon Peyton Jones Date: Fri Sep 9 17:42:42 2016 +0100 Be less picky about reporing inaccessible code Triggered by the discussion on Trac #12466, this patch makes GHC less aggressive about reporting an error when there are insoluble Givens. Being so agressive was making some libraries fail to compile, and is arguably wrong in at least some cases. See the discussion on the ticket. Several test now pass when they failed before; see the files-modified list for this patch. >--------------------------------------------------------------- 03541cbae50f0d1cdf99120ab88698f29a278159 compiler/typecheck/TcErrors.hs | 94 +++++++++++++++++----- compiler/typecheck/TcSMonad.hs | 14 ++-- compiler/typecheck/TcSimplify.hs | 2 +- testsuite/tests/ghci/scripts/Defer02.script | 3 + testsuite/tests/ghci/scripts/Defer02.stderr | 37 +++------ testsuite/tests/typecheck/should_compile/T12466.hs | 9 +++ .../tests/typecheck/should_compile/T12466a.hs | 26 ++++++ testsuite/tests/typecheck/should_compile/all.T | 2 + .../tests/typecheck/should_fail/FDsFromGivens.hs | 1 + .../typecheck/should_fail/FDsFromGivens.stderr | 19 ----- testsuite/tests/typecheck/should_fail/T10715.hs | 6 ++ .../tests/typecheck/should_fail/T10715.stderr | 13 --- testsuite/tests/typecheck/should_fail/T5236.hs | 3 + testsuite/tests/typecheck/should_fail/T5236.stderr | 15 ---- testsuite/tests/typecheck/should_fail/T8392a.hs | 4 +- .../tests/typecheck/should_fail/T8392a.stderr | 9 --- testsuite/tests/typecheck/should_fail/all.T | 8 +- testsuite/tests/typecheck/should_run/Defer01.hs | 1 + 18 files changed, 151 insertions(+), 115 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 03541cbae50f0d1cdf99120ab88698f29a278159 From git at git.haskell.org Mon Sep 12 15:21:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 15:21:54 +0000 (UTC) Subject: [commit: ghc] master: Remove unused exports (21d0bfe) Message-ID: <20160912152154.CA5883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/21d0bfe1ab6618059fc161816047070eb9eda312/ghc >--------------------------------------------------------------- commit 21d0bfe1ab6618059fc161816047070eb9eda312 Author: Simon Peyton Jones Date: Sun Sep 4 21:58:20 2016 +0100 Remove unused exports >--------------------------------------------------------------- 21d0bfe1ab6618059fc161816047070eb9eda312 compiler/typecheck/TcSMonad.hs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index f6b72eb..fb03ec2 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -66,7 +66,7 @@ module TcSMonad ( -- Inert CDictCans lookupInertDict, findDictsByClass, addDict, addDictsByClass, - delDict, partitionDicts, foldDicts, filterDicts, + delDict, foldDicts, filterDicts, -- Inert CTyEqCans EqualCtList, findTyEqs, foldTyEqs, isInInertEqs, @@ -81,8 +81,8 @@ module TcSMonad ( lookupFlatCache, extendFlatCache, newFlattenSkolem, -- Flatten skolems -- Inert CFunEqCans - updInertFunEqs, findFunEq, sizeFunEqMap, filterFunEqs, - findFunEqsByTyCon, partitionFunEqs, foldFunEqs, + updInertFunEqs, findFunEq, sizeFunEqMap, + findFunEqsByTyCon, instDFunType, -- Instantiation @@ -2224,11 +2224,6 @@ filterFunEqs = filterTcAppMap insertFunEq :: FunEqMap a -> TyCon -> [Type] -> a -> FunEqMap a insertFunEq m tc tys val = insertTcApp m (getUnique tc) tys val --- insertFunEqCt :: FunEqMap Ct -> Ct -> FunEqMap Ct --- insertFunEqCt m ct@(CFunEqCan { cc_fun = tc, cc_tyargs = tys }) --- = insertFunEq m tc tys ct --- insertFunEqCt _ ct = pprPanic "insertFunEqCt" (ppr ct) - partitionFunEqs :: (Ct -> Bool) -> FunEqMap Ct -> ([Ct], FunEqMap Ct) -- Optimise for the case where the predicate is false -- partitionFunEqs is called only from kick-out, and kick-out usually From git at git.haskell.org Mon Sep 12 16:15:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 16:15:38 +0000 (UTC) Subject: [commit: ghc] master: users_guide: Fix Docbook remnant (35086d4) Message-ID: <20160912161538.A9AB43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/35086d4dcc624c6022902c420e5dd61ee6414e30/ghc >--------------------------------------------------------------- commit 35086d4dcc624c6022902c420e5dd61ee6414e30 Author: Ben Gamari Date: Thu Sep 8 11:30:40 2016 -0400 users_guide: Fix Docbook remnant Not sure how this snuck through but it seems to be the only one. >--------------------------------------------------------------- 35086d4dcc624c6022902c420e5dd61ee6414e30 docs/users_guide/glasgow_exts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 6209548..78b5b0f 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -10082,7 +10082,7 @@ The :ghc-flag:`-XTemplateHaskellQuotes` extension is considered safe under add1 :: Int -> Q Exp add1 x = [| x + 1 |] - Now consider a splice using add1 in a separate + Now consider a splice using ``add1`` in a separate module: :: module Foo where From git at git.haskell.org Mon Sep 12 16:15:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 16:15:41 +0000 (UTC) Subject: [commit: ghc] master: users_guide: #8761 is now fixed (b451fef) Message-ID: <20160912161541.627633A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b451feff269562830e3ca727665ba19a0252d371/ghc >--------------------------------------------------------------- commit b451feff269562830e3ca727665ba19a0252d371 Author: Ben Gamari Date: Thu Sep 8 11:31:44 2016 -0400 users_guide: #8761 is now fixed Remove a leftover note in the users guide claiming that TH doesn't support pattern synonyms. >--------------------------------------------------------------- b451feff269562830e3ca727665ba19a0252d371 docs/users_guide/glasgow_exts.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 78b5b0f..bfe4dfc 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -10276,8 +10276,6 @@ The :ghc-flag:`-XTemplateHaskellQuotes` extension is considered safe under - Recursive ``do``-statements (see :ghc-ticket:`1262`) - - Pattern synonyms (see :ghc-ticket:`8761`) - - Typed holes (see :ghc-ticket:`10267`) (Compared to the original paper, there are many differences of detail. From git at git.haskell.org Mon Sep 12 16:15:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 16:15:44 +0000 (UTC) Subject: [commit: ghc] master: users_guide: TH now partially supports typed holes (c6ac1e5) Message-ID: <20160912161544.1B1E63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c6ac1e5f25e980c69e36581666210749811ee1c6/ghc >--------------------------------------------------------------- commit c6ac1e5f25e980c69e36581666210749811ee1c6 Author: Ben Gamari Date: Thu Sep 8 11:34:11 2016 -0400 users_guide: TH now partially supports typed holes As requested in #10267. However we still lack support in typed splices. See #10945 and #10946. >--------------------------------------------------------------- c6ac1e5f25e980c69e36581666210749811ee1c6 docs/users_guide/glasgow_exts.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index bfe4dfc..3c4453d 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -10276,7 +10276,8 @@ The :ghc-flag:`-XTemplateHaskellQuotes` extension is considered safe under - Recursive ``do``-statements (see :ghc-ticket:`1262`) - - Typed holes (see :ghc-ticket:`10267`) + - Type holes in typed splices (see :ghc-ticket:`10945` and + :ghc-ticket:`10946`) (Compared to the original paper, there are many differences of detail. The syntax for a declaration splice uses "``$``" not "``splice``". The type of From git at git.haskell.org Mon Sep 12 16:15:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 16:15:46 +0000 (UTC) Subject: [commit: ghc] master: rts: Disable -hb with multiple capabilities (6555c6b) Message-ID: <20160912161546.CC5E73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6555c6bb8447ed65d5da4bab462ee9da7dc3f97a/ghc >--------------------------------------------------------------- commit 6555c6bb8447ed65d5da4bab462ee9da7dc3f97a Author: Ben Gamari Date: Mon Sep 12 08:44:24 2016 -0400 rts: Disable -hb with multiple capabilities Biographical profiling is not thread-safe as documented in #12019. Throw an error when it is used in this way. Test Plan: Validate Reviewers: simonmar, austin, erikd Reviewed By: erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2516 GHC Trac Issues: #12019 >--------------------------------------------------------------- 6555c6bb8447ed65d5da4bab462ee9da7dc3f97a rts/ProfHeap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 956a250..c94b3e9 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -400,6 +400,13 @@ initHeapProfiling(void) errorBelch("cannot mix -hb and -hr"); stg_exit(EXIT_FAILURE); } +#ifdef THREADED_RTS + // See Trac #12019. + if (doingLDVProfiling() && RtsFlags.ParFlags.nCapabilities > 1) { + errorBelch("-hb cannot be used with multiple capabilities"); + stg_exit(EXIT_FAILURE); + } +#endif #endif // we only count eras if we're doing LDV profiling. Otherwise era From git at git.haskell.org Mon Sep 12 16:17:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 16:17:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix derived Ix instances for one-constructor GADTs (706a730) Message-ID: <20160912161702.B28A73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/706a7305415a8e22b7dc4e2b8406f5b660642d1c/ghc >--------------------------------------------------------------- commit 706a7305415a8e22b7dc4e2b8406f5b660642d1c Author: Ryan Scott Date: Sun Sep 11 10:27:36 2016 -0400 Fix derived Ix instances for one-constructor GADTs Standalone-derived `Ix` instances would panic on GADTs with exactly one constructor, since the list of fields was being passed to a function that uses `foldl1` in order to generate an implementation for `inRange`. This adds a simple check that makes `inRange` be `True` whenever a product type has no fields. Fixes #12583. Test Plan: make test TEST=12583 Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2521 GHC Trac Issues: #12583 (cherry picked from commit 7b7ea8f40e7400b8c183595a85bb2c65c9f9bb29) >--------------------------------------------------------------- 706a7305415a8e22b7dc4e2b8406f5b660642d1c compiler/hsSyn/HsExpr.hs | 12 +++++++++--- compiler/typecheck/TcGenDeriv.hs | 7 ++++++- docs/users_guide/8.0.2-notes.rst | 3 +++ testsuite/tests/deriving/should_compile/T12583.hs | 11 +++++++++++ testsuite/tests/deriving/should_compile/all.T | 1 + 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 103f59a..ee64c0c 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -1899,9 +1899,15 @@ ppr_do_stmts stmts pprComp :: (OutputableBndr id, Outputable body) => [LStmt id body] -> SDoc pprComp quals -- Prints: body | qual1, ..., qualn - | not (null quals) - , L _ (LastStmt body _ _) <- last quals - = hang (ppr body <+> vbar) 2 (pprQuals (dropTail 1 quals)) + | Just (initStmts, L _ (LastStmt body _ _)) <- snocView quals + = if null initStmts + -- If there are no statements in a list comprehension besides the last + -- one, we simply treat it like a normal list. This does arise + -- occasionally in code that GHC generates, e.g., in implementations of + -- 'range' for derived 'Ix' instances for product datatypes with exactly + -- one constructor (e.g., see Trac #12583). + then ppr body + else hang (ppr body <+> vbar) 2 (pprQuals initStmts) | otherwise = pprPanic "pprComp" (pprQuals quals) diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index f2da4dd..8c6bc81 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -867,7 +867,12 @@ gen_Ix_binds loc tycon = mk_easy_FunBind loc inRange_RDR [nlTuplePat [con_pat as_needed, con_pat bs_needed] Boxed, con_pat cs_needed] $ - foldl1 and_Expr (zipWith3Equal "single_con_inRange" in_range as_needed bs_needed cs_needed) + if con_arity == 0 + -- If the product type has no fields, inRange is trivially true + -- (see Trac #12853). + then true_Expr + else foldl1 and_Expr (zipWith3Equal "single_con_inRange" in_range + as_needed bs_needed cs_needed) where in_range a b c = nlHsApps inRange_RDR [mkLHsVarTuple [a,b], nlHsVar c] diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index a5b106d..c121962 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -10,6 +10,9 @@ Highlights - Many, many bug fixes. +- A bug has been fixed that caused standalone derived ``Ix`` instances to fail + for GADTs with exactly one constructor (:ghc-ticket:`12583`). + Full details ------------ diff --git a/testsuite/tests/deriving/should_compile/T12583.hs b/testsuite/tests/deriving/should_compile/T12583.hs new file mode 100644 index 0000000..9dc151b --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T12583.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE GADTs #-} +{-# LANGUAGE StandaloneDeriving #-} +module T12583 where + +import Data.Ix + +data Foo a where + MkFoo :: (Eq a, Ord a, Ix a) => Foo a +deriving instance Eq (Foo a) +deriving instance Ord (Foo a) +deriving instance Ix (Foo a) diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index 6b37420..473450d 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -72,3 +72,4 @@ test('T11732c', normal, compile, ['']) test('T11833', normal, compile, ['']) test('T11837', normal, compile, ['']) test('T12399', normal, compile, ['']) +test('T12583', normal, compile, ['']) From git at git.haskell.org Mon Sep 12 16:17:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 16:17:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix TH ppr output for list comprehensions with only one Stmt (43149ea) Message-ID: <20160912161705.6B4023A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/43149ea634a99e125bf7e1750953945d04df823b/ghc >--------------------------------------------------------------- commit 43149ea634a99e125bf7e1750953945d04df823b Author: Ryan Scott Date: Sun Sep 11 11:10:36 2016 -0400 Fix TH ppr output for list comprehensions with only one Stmt A folow-up to D2521 (which addressed #12583), where the `Outputable` `ppr` output was tweaked to display a list comprehension with only one `Stmt` as `[Foo]` instead of `[Foo|]` (which isn't valid Haskell). I forgot to update the corresponding code in `Language.Haskell.TH.Ppr` which pretty-prints `CompE`, however, so this commit takes care of that. (cherry picked from commit 0e7ccf6d233c66b23a60de4e35e039f78ea3e162) >--------------------------------------------------------------- 43149ea634a99e125bf7e1750953945d04df823b libraries/template-haskell/Language/Haskell/TH/Ppr.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs index 2a56620..a57eeff 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs @@ -159,12 +159,17 @@ pprExp i (DoE ss_) = parensIf (i > noPrec) $ text "do" <+> pprStms ss_ pprExp _ (CompE []) = text "<>" -- This will probably break with fixity declarations - would need a ';' -pprExp _ (CompE ss) = text "[" <> ppr s - <+> text "|" - <+> commaSep ss' - <> text "]" - where s = last ss - ss' = init ss +pprExp _ (CompE ss) = + if null ss' + -- If there are no statements in a list comprehension besides the last + -- one, we simply treat it like a normal list. + then text "[" <> ppr s <> text "]" + else text "[" <> ppr s + <+> text "|" + <+> commaSep ss' + <> text "]" + where s = last ss + ss' = init ss pprExp _ (ArithSeqE d) = ppr d pprExp _ (ListE es) = brackets (commaSep es) pprExp i (SigE e t) = parensIf (i > noPrec) $ ppr e <+> dcolon <+> ppr t From git at git.haskell.org Mon Sep 12 16:17:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 16:17:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Make start address of `osReserveHeapMemory` tunable via command line -xb (658f035) Message-ID: <20160912161708.283133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/658f0354326ddfdafec3772cdb86d89f0e424663/ghc >--------------------------------------------------------------- commit 658f0354326ddfdafec3772cdb86d89f0e424663 Author: Francesco Mazzoli Date: Fri Sep 9 18:15:49 2016 +0100 Make start address of `osReserveHeapMemory` tunable via command line -xb Summary: We stumbled upon a case where an external library (OpenCL) does not work if a specific address (0x200000000) is taken. It so happens that `osReserveHeapMemory` starts trying to mmap at 0x200000000: ``` void *hint = (void*)((W_)8 * (1 << 30) + attempt * BLOCK_SIZE); at = osTryReserveHeapMemory(*len, hint); ``` This makes it impossible to use Haskell programs compiled with GHC 8 with C functions that use OpenCL. See this example ​https://github.com/chpatrick/oclwtf for a repro. This patch allows the user to work around this kind of behavior outside our control by letting the user override the starting address through an RTS command line flag. Reviewers: bgamari, Phyx, simonmar, erikd, austin Reviewed By: Phyx, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D2513 (cherry picked from commit 1b5f9207a649a64a1bba20b0283253425f9208d7) >--------------------------------------------------------------- 658f0354326ddfdafec3772cdb86d89f0e424663 docs/users_guide/8.0.2-notes.rst | 4 ++++ includes/stg/Types.h | 2 ++ rts/RtsFlags.c | 5 ++++- rts/posix/OSMem.c | 30 +++++++++++++++++++++++------- rts/sm/MBlock.c | 6 +++++- rts/sm/OSMem.h | 5 ++++- rts/win32/OSMem.c | 9 +++++---- 7 files changed, 47 insertions(+), 14 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 658f0354326ddfdafec3772cdb86d89f0e424663 From git at git.haskell.org Mon Sep 12 22:09:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 22:09:40 +0000 (UTC) Subject: [commit: ghc] master: Test wibbles for commit 03541cba (5eeabe2) Message-ID: <20160912220940.2483F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5eeabe250a1de456f70af07bd3f507a32cb8e10e/ghc >--------------------------------------------------------------- commit 5eeabe250a1de456f70af07bd3f507a32cb8e10e Author: Simon Peyton Jones Date: Mon Sep 12 22:21:15 2016 +0100 Test wibbles for commit 03541cba I must have failed to validate properly, sorry. These testsuite wibbles belong with commit 03541cbae50f0d1cdf99120ab88698f29a278159 Author: Simon Peyton Jones Date: Fri Sep 9 17:42:42 2016 +0100 Be less picky about reporing inaccessible code >--------------------------------------------------------------- 5eeabe250a1de456f70af07bd3f507a32cb8e10e testsuite/tests/typecheck/should_fail/FDsFromGivens.hs | 5 ++++- testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr | 4 ++++ testsuite/tests/typecheck/should_fail/T10715.hs | 4 +++- testsuite/tests/typecheck/should_fail/T10715.stderr | 4 ++++ testsuite/tests/typecheck/should_fail/T8392a.hs | 2 ++ testsuite/tests/typecheck/should_fail/T8392a.stderr | 4 ++++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/typecheck/should_fail/FDsFromGivens.hs b/testsuite/tests/typecheck/should_fail/FDsFromGivens.hs index 6e1b34d..110199b 100644 --- a/testsuite/tests/typecheck/should_fail/FDsFromGivens.hs +++ b/testsuite/tests/typecheck/should_fail/FDsFromGivens.hs @@ -6,7 +6,10 @@ class C a b | a -> b where cop :: a -> b -> () {- Failing, as it righteously should! It's inaccessible code -} --- But (c.f. test T5236) we no longer reject this (see Trac #12466) +-- But (c.f. test T5236) we no longer reject this in the +-- typechecker (see Trac #12466) +-- Instead we get a redundant pattern-match warning, +-- in the post-typechecking pattern-match checks g1 :: (C Char [a], C Char Bool) => a -> () g1 x = () diff --git a/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr b/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr index e69de29..964e4b6 100644 --- a/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr +++ b/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr @@ -0,0 +1,4 @@ + +FDsFromGivens.hs:11:1: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match is redundant + In an equation for ‘g1’: g1 x = ... diff --git a/testsuite/tests/typecheck/should_fail/T10715.hs b/testsuite/tests/typecheck/should_fail/T10715.hs index c48402f..9e675e2 100644 --- a/testsuite/tests/typecheck/should_fail/T10715.hs +++ b/testsuite/tests/typecheck/should_fail/T10715.hs @@ -11,6 +11,8 @@ data X a -- -- But in Trac #12466 we decided to accept contradictory -- type signatures, so definition is now accepeted even --- though you can never call it. +-- though you can never call it. Instead we get a +-- redundant pattern-match warning, in the +-- post-typechecking pattern-match checks doCoerce :: Coercible a (X a) => a -> X a doCoerce = coerce diff --git a/testsuite/tests/typecheck/should_fail/T10715.stderr b/testsuite/tests/typecheck/should_fail/T10715.stderr index e69de29..10ff2c9 100644 --- a/testsuite/tests/typecheck/should_fail/T10715.stderr +++ b/testsuite/tests/typecheck/should_fail/T10715.stderr @@ -0,0 +1,4 @@ + +T10715.hs:17:1: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match is redundant + In an equation for ‘doCoerce’: doCoerce = ... diff --git a/testsuite/tests/typecheck/should_fail/T8392a.hs b/testsuite/tests/typecheck/should_fail/T8392a.hs index 2ae2338..940f8b6 100644 --- a/testsuite/tests/typecheck/should_fail/T8392a.hs +++ b/testsuite/tests/typecheck/should_fail/T8392a.hs @@ -5,5 +5,7 @@ module T8392a where -- -- But (Trac #12466) we now don't complain about -- contradictory signatures +-- Instead we get a redundant pattern-match warning, +-- in the post-typechecking pattern-match checks foo :: (Int ~ Bool) => a -> a foo x = x diff --git a/testsuite/tests/typecheck/should_fail/T8392a.stderr b/testsuite/tests/typecheck/should_fail/T8392a.stderr index e69de29..bfc30e7 100644 --- a/testsuite/tests/typecheck/should_fail/T8392a.stderr +++ b/testsuite/tests/typecheck/should_fail/T8392a.stderr @@ -0,0 +1,4 @@ + +T8392a.hs:11:1: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match is redundant + In an equation for ‘foo’: foo x = ... From git at git.haskell.org Mon Sep 12 23:02:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 12 Sep 2016 23:02:17 +0000 (UTC) Subject: [commit: ghc] master: Testsuite wibbles, to the same files (ec3edd5) Message-ID: <20160912230217.BC7373A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ec3edd56639e23399e23066d9dd00d744950e048/ghc >--------------------------------------------------------------- commit ec3edd56639e23399e23066d9dd00d744950e048 Author: Simon Peyton Jones Date: Tue Sep 13 00:00:21 2016 +0100 Testsuite wibbles, to the same files Sigh. I added some comments to the source files, and failed to revalidate. But the comments change the line number in the error messages. Doh. >--------------------------------------------------------------- ec3edd56639e23399e23066d9dd00d744950e048 testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr | 2 +- testsuite/tests/typecheck/should_fail/T10715.stderr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr b/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr index 964e4b6..a271580 100644 --- a/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr +++ b/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr @@ -1,4 +1,4 @@ -FDsFromGivens.hs:11:1: warning: [-Woverlapping-patterns (in -Wdefault)] +FDsFromGivens.hs:14:1: warning: [-Woverlapping-patterns (in -Wdefault)] Pattern match is redundant In an equation for ‘g1’: g1 x = ... diff --git a/testsuite/tests/typecheck/should_fail/T10715.stderr b/testsuite/tests/typecheck/should_fail/T10715.stderr index 10ff2c9..68aa7f9 100644 --- a/testsuite/tests/typecheck/should_fail/T10715.stderr +++ b/testsuite/tests/typecheck/should_fail/T10715.stderr @@ -1,4 +1,4 @@ -T10715.hs:17:1: warning: [-Woverlapping-patterns (in -Wdefault)] +T10715.hs:18:1: warning: [-Woverlapping-patterns (in -Wdefault)] Pattern match is redundant In an equation for ‘doCoerce’: doCoerce = ... From git at git.haskell.org Tue Sep 13 15:06:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:06:49 +0000 (UTC) Subject: [commit: ghc] wip/names3: KnownUniques: Fix unused binder (8db89df) Message-ID: <20160913150649.90B9B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/8db89dff165d874a6fa466cfb7ea0e0181bad85c/ghc >--------------------------------------------------------------- commit 8db89dff165d874a6fa466cfb7ea0e0181bad85c Author: Ben Gamari Date: Thu Sep 8 17:03:20 2016 -0400 KnownUniques: Fix unused binder >--------------------------------------------------------------- 8db89dff165d874a6fa466cfb7ea0e0181bad85c compiler/prelude/KnownUniques.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/prelude/KnownUniques.hs b/compiler/prelude/KnownUniques.hs index f1fa1bf..0e5995c 100644 --- a/compiler/prelude/KnownUniques.hs +++ b/compiler/prelude/KnownUniques.hs @@ -114,10 +114,10 @@ getCTupleTyConName n = getCTupleDataConUnique :: Int -> Name getCTupleDataConUnique n = case n `divMod` 3 of - (arity, 0) -> cTupleDataConName arity - (arity, 1) -> panic "getCTupleDataConName: no worker" - (arity, 2) -> mkPrelTyConRepName $ cTupleDataConName arity - _ -> panic "getCTupleDataConName: impossible" + (arity, 0) -> cTupleDataConName arity + (_arity, 1) -> panic "getCTupleDataConName: no worker" + (arity, 2) -> mkPrelTyConRepName $ cTupleDataConName arity + _ -> panic "getCTupleDataConName: impossible" -------------------------------------------------- -- Normal tuples From git at git.haskell.org Tue Sep 13 15:06:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:06:52 +0000 (UTC) Subject: [commit: ghc] wip/names3: BinFingerprint: Rip out debugging (703b3a8) Message-ID: <20160913150652.6406A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/703b3a8c6a076fb1a05d733fc294fd5f16e717b9/ghc >--------------------------------------------------------------- commit 703b3a8c6a076fb1a05d733fc294fd5f16e717b9 Author: Ben Gamari Date: Thu Sep 8 17:03:46 2016 -0400 BinFingerprint: Rip out debugging >--------------------------------------------------------------- 703b3a8c6a076fb1a05d733fc294fd5f16e717b9 compiler/iface/BinFingerprint.hs | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler/iface/BinFingerprint.hs b/compiler/iface/BinFingerprint.hs index 21c275f..3b1ecb9 100644 --- a/compiler/iface/BinFingerprint.hs +++ b/compiler/iface/BinFingerprint.hs @@ -14,7 +14,6 @@ import Binary import Name import Panic import Util -import Outputable fingerprintBinMem :: BinHandle -> IO Fingerprint fingerprintBinMem bh = @@ -29,8 +28,6 @@ computeFingerprint put_nonbinding_name a = do bh <- return $ setUserData bh $ newWriteState put_nonbinding_name putNameLiterally putFS put_ bh a fp <- fingerprintBinMem bh - withBinBuffer bh (\x -> -- pprTrace "computeFingerprint" (ppr fp $$ text (show x)) $ - return a) return fp -- | Used when we want to fingerprint a structure without depending on the From git at git.haskell.org Tue Sep 13 15:06:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:06:55 +0000 (UTC) Subject: [commit: ghc] wip/names3: PrelInfo: Kill dead code (7ae1e06) Message-ID: <20160913150655.46E773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/7ae1e0631f080d8068abc9a351a2e4167126e091/ghc >--------------------------------------------------------------- commit 7ae1e0631f080d8068abc9a351a2e4167126e091 Author: Ben Gamari Date: Thu Sep 8 17:54:27 2016 -0400 PrelInfo: Kill dead code >--------------------------------------------------------------- 7ae1e0631f080d8068abc9a351a2e4167126e091 compiler/prelude/PrelInfo.hs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/compiler/prelude/PrelInfo.hs b/compiler/prelude/PrelInfo.hs index bca992c..1a48f4f 100644 --- a/compiler/prelude/PrelInfo.hs +++ b/compiler/prelude/PrelInfo.hs @@ -97,20 +97,6 @@ knownKeyNames , basicKnownKeyNames ] where - -- All of the names associated with a known-key TyCon (where we only have its - -- name, not the TyCon itself). This includes the names of the TyCon itself - -- and its type rep binding. - tycon_kk_names :: Name -> [Name] - tycon_kk_names tc = [tc, mkPrelTyConRepName tc] - - -- All of the names associated with a known-key DataCon. This includes the - -- names of the DataCon itself and its promoted type rep. - datacon_kk_names :: Name -> [Name] - datacon_kk_names dc = - [ dc - , mkPrelTyConRepName dc - ] - -- All of the names associated with a wired-in TyCon. -- This includes the TyCon itself, its DataCons and promoted TyCons. wired_tycon_kk_names :: TyCon -> [Name] From git at git.haskell.org Tue Sep 13 15:06:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:06:58 +0000 (UTC) Subject: [commit: ghc] wip/names3: HACK: Work around non-determinism in MkIface (f54f318) Message-ID: <20160913150658.157E83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/f54f3180655985eb228af84c3fd39d7c3c98f73d/ghc >--------------------------------------------------------------- commit f54f3180655985eb228af84c3fd39d7c3c98f73d Author: Ben Gamari Date: Mon Sep 12 12:12:43 2016 -0400 HACK: Work around non-determinism in MkIface >--------------------------------------------------------------- f54f3180655985eb228af84c3fd39d7c3c98f73d compiler/iface/MkIface.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index f05426d..1ea59b4 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -418,7 +418,7 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls edges :: [(IfaceDeclABI, Unique, [Unique])] edges = [ (abi, getUnique (getOccName decl), out) - | decl <- new_decls + | decl <- sortBy (comparing getOccName) new_decls , let abi = declABI decl , let out = localOccs $ freeNamesDeclABI abi ] From git at git.haskell.org Tue Sep 13 15:07:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:07:00 +0000 (UTC) Subject: [commit: ghc] wip/names3: Fix unboxed sum arity calculation (ba730e8) Message-ID: <20160913150700.E05953A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/ba730e81c08e2f50faeb6b844a75f19b04317466/ghc >--------------------------------------------------------------- commit ba730e81c08e2f50faeb6b844a75f19b04317466 Author: Ben Gamari Date: Mon Sep 12 16:17:57 2016 -0400 Fix unboxed sum arity calculation >--------------------------------------------------------------- ba730e81c08e2f50faeb6b844a75f19b04317466 compiler/prelude/KnownUniques.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/prelude/KnownUniques.hs b/compiler/prelude/KnownUniques.hs index 0e5995c..70244c0 100644 --- a/compiler/prelude/KnownUniques.hs +++ b/compiler/prelude/KnownUniques.hs @@ -81,7 +81,7 @@ getUnboxedSumName n = case n .&. 0xff of 0xff -> tyConName $ sumTyCon arity alt -> dataConName $ sumDataCon (alt + 1) arity - where arity = n `shiftR` 0xff + where arity = n `shiftR` 8 -- Note [Uniques for tuple type and data constructors] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Tue Sep 13 15:07:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:07:03 +0000 (UTC) Subject: [commit: ghc] wip/names3: TcRnDriver: Use span from real thing in boot decl conflict error (d0a7338) Message-ID: <20160913150703.B09213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/d0a733803a614d2590b5b0520000b8a4dab05af0/ghc >--------------------------------------------------------------- commit d0a733803a614d2590b5b0520000b8a4dab05af0 Author: Ben Gamari Date: Mon Sep 12 16:18:08 2016 -0400 TcRnDriver: Use span from real thing in boot decl conflict error >--------------------------------------------------------------- d0a733803a614d2590b5b0520000b8a4dab05af0 compiler/typecheck/TcRnDriver.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index bd32d80..0d9dcd0 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -898,7 +898,9 @@ checkBootDeclM :: Bool -- ^ True <=> an hs-boot file (could also be a sig) -> TyThing -> TyThing -> TcM () checkBootDeclM is_boot boot_thing real_thing = whenIsJust (checkBootDecl boot_thing real_thing) $ \ err -> - addErrAt (nameSrcSpan (getName boot_thing)) + -- Here we use the source span of the real thing since the boot_thing may + -- have come from an interface file and therefore may not have a span + addErrAt (nameSrcSpan (getName real_thing)) (bootMisMatch is_boot err real_thing boot_thing) -- | Compares the two things for equivalence between boot-file and normal From git at git.haskell.org Tue Sep 13 15:07:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:07:06 +0000 (UTC) Subject: [commit: ghc] wip/names3: Move name cache things to new module (2604457) Message-ID: <20160913150706.964E13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/26044578b26cab3b3c42f89ee6001a634d2a1f3f/ghc >--------------------------------------------------------------- commit 26044578b26cab3b3c42f89ee6001a634d2a1f3f Author: Ben Gamari Date: Tue Sep 13 10:52:07 2016 -0400 Move name cache things to new module >--------------------------------------------------------------- 26044578b26cab3b3c42f89ee6001a634d2a1f3f compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/iface/BinIface.hs | 1 + compiler/iface/IfaceEnv.hs | 129 ++++++---------------------------------- compiler/main/HscMain.hs | 2 +- compiler/main/HscTypes.hs | 17 +----- compiler/main/TidyPgm.hs | 1 + compiler/simplCore/CoreMonad.hs | 1 + 8 files changed, 25 insertions(+), 128 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 26044578b26cab3b3c42f89ee6001a634d2a1f3f From git at git.haskell.org Tue Sep 13 15:08:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:08:35 +0000 (UTC) Subject: [commit: ghc] wip/names3: Move name cache things to new module (57bc817) Message-ID: <20160913150835.0362E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/57bc817cdac249989de03fed4eb193b47ba5f0e8/ghc >--------------------------------------------------------------- commit 57bc817cdac249989de03fed4eb193b47ba5f0e8 Author: Ben Gamari Date: Tue Sep 13 10:52:07 2016 -0400 Move name cache things to new module >--------------------------------------------------------------- 57bc817cdac249989de03fed4eb193b47ba5f0e8 compiler/basicTypes/NameCache.hs | 129 +++++++++++++++++++++++++++++++++++++++ compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/iface/BinIface.hs | 1 + compiler/iface/IfaceEnv.hs | 129 ++++++--------------------------------- compiler/main/HscMain.hs | 2 +- compiler/main/HscTypes.hs | 17 +----- compiler/main/TidyPgm.hs | 1 + compiler/simplCore/CoreMonad.hs | 1 + 9 files changed, 154 insertions(+), 128 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 57bc817cdac249989de03fed4eb193b47ba5f0e8 From git at git.haskell.org Tue Sep 13 15:08:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:08:37 +0000 (UTC) Subject: [commit: ghc] wip/names3: Move allKnownKeyNames to PrelInfo (d144d53) Message-ID: <20160913150837.DFD353A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/names3 Link : http://ghc.haskell.org/trac/ghc/changeset/d144d53c75bef72c87c22b90c066d8fe9243048f/ghc >--------------------------------------------------------------- commit d144d53c75bef72c87c22b90c066d8fe9243048f Author: Ben Gamari Date: Tue Sep 13 11:08:02 2016 -0400 Move allKnownKeyNames to PrelInfo >--------------------------------------------------------------- d144d53c75bef72c87c22b90c066d8fe9243048f compiler/iface/IfaceEnv.hs | 3 -- compiler/main/HscMain.hs | 36 +------------- compiler/main/HscTypes.hs | 3 +- compiler/prelude/PrelInfo.hs | 110 +++++++++++++++++++++++++++++-------------- 4 files changed, 76 insertions(+), 76 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d144d53c75bef72c87c22b90c066d8fe9243048f From git at git.haskell.org Tue Sep 13 15:35:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:35:30 +0000 (UTC) Subject: [commit: ghc] master: Comments and white space only (505a518) Message-ID: <20160913153530.9813C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/505a518b07edc61db763eadad46d48a3671d6f2e/ghc >--------------------------------------------------------------- commit 505a518b07edc61db763eadad46d48a3671d6f2e Author: Simon Peyton Jones Date: Mon Aug 29 09:04:24 2016 +0100 Comments and white space only >--------------------------------------------------------------- 505a518b07edc61db763eadad46d48a3671d6f2e compiler/hsSyn/HsBinds.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs index 2120e05..236892e 100644 --- a/compiler/hsSyn/HsBinds.hs +++ b/compiler/hsSyn/HsBinds.hs @@ -745,7 +745,7 @@ data Sig name -- | A signature for a class method -- False: ordinary class-method signature - -- True: default class method signature + -- True: generic-default class method signature -- e.g. class C a where -- op :: a -> a -- Ordinary -- default op :: Eq a => a -> a -- Generic default diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 61b00f3..9bfebd5 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -2097,10 +2097,10 @@ ppr_bag doc bag data Implication = Implic { - ic_tclvl :: TcLevel, -- TcLevel: unification variables - -- free in the environment + ic_tclvl :: TcLevel, -- TcLevel of unification variables + -- allocated /inside/ this implication - ic_skols :: [TcTyVar], -- Introduced skolems + ic_skols :: [TcTyVar], -- Introduced skolems ic_info :: SkolemInfo, -- See Note [Skolems in an implication] -- See Note [Shadowing in a constraint] From git at git.haskell.org Tue Sep 13 15:35:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:35:33 +0000 (UTC) Subject: [commit: ghc] master: Comments and white space (876b00b) Message-ID: <20160913153533.64DAC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/876b00ba25a615423f48b0cf9d443a9fd5dbd6f4/ghc >--------------------------------------------------------------- commit 876b00ba25a615423f48b0cf9d443a9fd5dbd6f4 Author: Simon Peyton Jones Date: Mon Sep 5 16:52:35 2016 +0100 Comments and white space >--------------------------------------------------------------- 876b00ba25a615423f48b0cf9d443a9fd5dbd6f4 compiler/specialise/SpecConstr.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 1cf3d44..b485f75 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -1539,7 +1539,7 @@ specialise env bind_calls (RI { ri_fn = fn, ri_lam_bndrs = arg_bndrs is_small_enough vars = isWorkerSmallEnough (sc_dflags env) vars -- We are about to construct w/w pair in 'spec_one'. -- Omit specialisation leading to high arity workers. - -- See Note [Limit w/w arity] + -- See Note [Limit w/w arity] in WwLib n_pats = length pats spec_count' = n_pats + spec_count ; case sc_count env of From git at git.haskell.org Tue Sep 13 15:35:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 13 Sep 2016 15:35:36 +0000 (UTC) Subject: [commit: ghc] master: Comments and white space only (8074e03) Message-ID: <20160913153536.360093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8074e037c098b407e735af7fa3209fdb8943d666/ghc >--------------------------------------------------------------- commit 8074e037c098b407e735af7fa3209fdb8943d666 Author: Simon Peyton Jones Date: Mon Sep 5 09:28:19 2016 +0100 Comments and white space only >--------------------------------------------------------------- 8074e037c098b407e735af7fa3209fdb8943d666 compiler/typecheck/TcRnDriver.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index da8c2a6..d4f82bf 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -577,6 +577,8 @@ tc_rn_src_decls ds #ifdef GHCI -- Get TH-generated top-level declarations and make sure they don't -- contain any splices since we don't handle that at the moment + -- + -- The plumbing here is a bit odd: see Trac #10853 ; th_topdecls_var <- fmap tcg_th_topdecls getGblEnv ; th_ds <- readTcRef th_topdecls_var ; writeTcRef th_topdecls_var [] From git at git.haskell.org Thu Sep 15 12:23:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 12:23:51 +0000 (UTC) Subject: [commit: ghc] master: tryGrabCapability should be using TRY_ACQUIRE_LOCK (9123845) Message-ID: <20160915122351.3E82C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/912384535d2ac7452d3bcda34cdee238e30600c9/ghc >--------------------------------------------------------------- commit 912384535d2ac7452d3bcda34cdee238e30600c9 Author: Simon Marlow Date: Thu Sep 15 11:34:05 2016 +0100 tryGrabCapability should be using TRY_ACQUIRE_LOCK >--------------------------------------------------------------- 912384535d2ac7452d3bcda34cdee238e30600c9 rts/Capability.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rts/Capability.c b/rts/Capability.c index 6979c63..6ca34f8 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -973,8 +973,10 @@ prodCapability (Capability *cap, Task *task) rtsBool tryGrabCapability (Capability *cap, Task *task) { + int r; if (cap->running_task != NULL) return rtsFalse; - ACQUIRE_LOCK(&cap->lock); + r = TRY_ACQUIRE_LOCK(&cap->lock); + if (r != 0) return rtsFalse; if (cap->running_task != NULL) { RELEASE_LOCK(&cap->lock); return rtsFalse; From git at git.haskell.org Thu Sep 15 12:23:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 12:23:54 +0000 (UTC) Subject: [commit: ghc] master: Fix codegen bug in PIC version of genSwitch (#12433) (86836a2) Message-ID: <20160915122354.47FEA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/86836a2ecc089b917866a2cb65b716fd5f04cc56/ghc >--------------------------------------------------------------- commit 86836a2ecc089b917866a2cb65b716fd5f04cc56 Author: Simon Marlow Date: Thu Sep 15 10:11:34 2016 +0100 Fix codegen bug in PIC version of genSwitch (#12433) Summary: * getNonClobberedReg instead of getSomeReg, because the reg needs to survive across t_code * Use a new reg for the table offset calculation instead of clobbering the reg returned by expr (this was the bug affecting #12433) Test Plan: New unit test; validate Reviewers: rwbarton, bgamari, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2529 GHC Trac Issues: #12433 >--------------------------------------------------------------- 86836a2ecc089b917866a2cb65b716fd5f04cc56 compiler/nativeGen/X86/CodeGen.hs | 9 ++++++--- .../should_run/T4262.stdout => codeGen/should_run/T12433.stdout} | 0 testsuite/tests/codeGen/should_run/all.T | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index cd45d92..4401f38 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -2603,7 +2603,8 @@ genSwitch :: DynFlags -> CmmExpr -> SwitchTargets -> NatM InstrBlock genSwitch dflags expr targets | gopt Opt_PIC dflags = do - (reg,e_code) <- getSomeReg (cmmOffset dflags expr offset) + (reg,e_code) <- getNonClobberedReg (cmmOffset dflags expr offset) + -- getNonClobberedReg because it needs to survive across t_code lbl <- getNewLabelNat dflags <- getDynFlags let is32bit = target32Bit (targetPlatform dflags) @@ -2624,6 +2625,7 @@ genSwitch dflags expr targets let op = OpAddr (AddrBaseIndex (EABaseReg tableReg) (EAIndex reg (wORD_SIZE dflags)) (ImmInt 0)) + offsetReg <- getNewRegNat (intFormat (wordWidth dflags)) return $ if is32bit || os == OSDarwin then e_code `appOL` t_code `appOL` toOL [ ADD (intFormat (wordWidth dflags)) op (OpReg tableReg), @@ -2636,8 +2638,9 @@ genSwitch dflags expr targets -- hack should be removed in conjunction with the hack in -- PprMach.hs/pprDataItem once binutils 2.17 is standard. e_code `appOL` t_code `appOL` toOL [ - MOVSxL II32 op (OpReg reg), - ADD (intFormat (wordWidth dflags)) (OpReg reg) + MOVSxL II32 op (OpReg offsetReg), + ADD (intFormat (wordWidth dflags)) + (OpReg offsetReg) (OpReg tableReg), JMP_TBL (OpReg tableReg) ids rosection lbl ] diff --git a/testsuite/tests/concurrent/should_run/T4262.stdout b/testsuite/tests/codeGen/should_run/T12433.stdout similarity index 100% copy from testsuite/tests/concurrent/should_run/T4262.stdout copy to testsuite/tests/codeGen/should_run/T12433.stdout diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index ee8772b..65e3dc0 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -143,4 +143,4 @@ test('T10870', when(wordsize(32), skip), compile_and_run, ['']) test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12059', normal, compile_and_run, ['']) -test('T12433', expect_broken(12433), compile_and_run, ['']) +test('T12433', normal, compile_and_run, ['']) From git at git.haskell.org Thu Sep 15 14:38:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 14:38:27 +0000 (UTC) Subject: [commit: ghc] master: Unify CallStack handling in ghc (626db8f) Message-ID: <20160915143827.BEE973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/626db8f82e734e48eef5ce7676a5233f98fe7145/ghc >--------------------------------------------------------------- commit 626db8f82e734e48eef5ce7676a5233f98fe7145 Author: Ben Gamari Date: Mon Sep 12 14:54:30 2016 -0400 Unify CallStack handling in ghc Here we introduce compatibility wrappers for HasCallStack constraints. This is necessary as we must support GHC 7.10.1 which lacks sane call stack support. We also introduce another constraint synonym, HasDebugCallStack, which only provides a call stack when DEBUG is set. >--------------------------------------------------------------- 626db8f82e734e48eef5ce7676a5233f98fe7145 compiler/simplStg/RepType.hs | 7 +++-- compiler/typecheck/TcDeriv.hs | 17 ++--------- compiler/types/TyCoRep.hs | 65 ++++++------------------------------------- compiler/utils/Maybes.hs | 8 ++---- compiler/utils/Outputable.hs | 35 +++++++---------------- compiler/utils/Util.hs | 46 +++++++++++++++++++++++++++++- 6 files changed, 72 insertions(+), 106 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 626db8f82e734e48eef5ce7676a5233f98fe7145 From git at git.haskell.org Thu Sep 15 16:07:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 16:07:27 +0000 (UTC) Subject: [commit: ghc] master: Comments only (a001299) Message-ID: <20160915160727.6E6CD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a0012992002d7065ff7a667cf05aa76f25568ee3/ghc >--------------------------------------------------------------- commit a0012992002d7065ff7a667cf05aa76f25568ee3 Author: Simon Peyton Jones Date: Thu Sep 15 17:07:12 2016 +0100 Comments only >--------------------------------------------------------------- a0012992002d7065ff7a667cf05aa76f25568ee3 compiler/types/TyCoRep.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 8302af9..d662129 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -1683,7 +1683,7 @@ the range of the TvSubstEnv should *never* include a type headed with CoercionTy. Note [The substitution invariant] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When calling (substTy subst ty) it should be the case that the in-scope set in the substitution is a superset of both: From git at git.haskell.org Thu Sep 15 16:15:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 16:15:01 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch: In-flight changes to InferRes (6b00895) Message-ID: <20160915161501.41BAC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch Link : http://ghc.haskell.org/trac/ghc/changeset/6b00895f52c08e60c2b07be2139c06d01b70f8fa/ghc >--------------------------------------------------------------- commit 6b00895f52c08e60c2b07be2139c06d01b70f8fa Author: Simon Peyton Jones Date: Thu Sep 15 17:14:08 2016 +0100 In-flight changes to InferRes >--------------------------------------------------------------- 6b00895f52c08e60c2b07be2139c06d01b70f8fa compiler/typecheck/Inst.hs | 4 +- compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcErrors.hs | 6 +-- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcHsType.hs | 6 +-- compiler/typecheck/TcMType.hs | 61 ++++++++++++----------- compiler/typecheck/TcPat.hs | 11 +++-- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcType.hs | 11 +++-- compiler/typecheck/TcUnify.hs | 104 +++++++++++++++++++++------------------- 10 files changed, 117 insertions(+), 96 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6b00895f52c08e60c2b07be2139c06d01b70f8fa From git at git.haskell.org Thu Sep 15 16:24:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 16:24:11 +0000 (UTC) Subject: [commit: ghc] master: Comments in TH.Syntax (Trac #12596) (a72d798) Message-ID: <20160915162411.3695D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a72d798ce948b054f47d7acd72799384cf06deea/ghc >--------------------------------------------------------------- commit a72d798ce948b054f47d7acd72799384cf06deea Author: Simon Peyton Jones Date: Wed Sep 14 08:38:33 2016 +0100 Comments in TH.Syntax (Trac #12596) See Note [Data for non-algebraic types] >--------------------------------------------------------------- a72d798ce948b054f47d7acd72799384cf06deea .../template-haskell/Language/Haskell/TH/Syntax.hs | 37 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 1129239..20c2396 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -716,15 +716,12 @@ dataToQa mkCon mkLit appCon antiQ t = (NameG DataName (mkPkgName "ghc-prim") (mkModName "GHC.Tuple")) - -- It is possible for a Data instance to be defined such - -- that toConstr uses a Constr defined using a function, - -- not a data constructor. In such a case, we must take - -- care to build the Name using mkNameG_v (for values), - -- not mkNameG_d (for data constructors). - -- See Trac #10796. + + -- Tricky case: see Note [Data for non-algebraic types] fun@(x:_) | startsVarSym x || startsVarId x -> mkNameG_v tyconPkg tyconMod fun con -> mkNameG_d tyconPkg tyconMod con + where tycon :: TyCon tycon = (typeRepTyCon . typeOf) t @@ -747,6 +744,34 @@ dataToQa mkCon mkLit appCon antiQ t = Just y -> y + +{- Note [Data for non-algebraic types] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Class Data was originally intended for algebraic data types. But +it is possible to use it for abstract types too. For example, in +package `text` we find + + instance Data Text where + ... + toConstr _ = packConstr + + packConstr :: Constr + packConstr = mkConstr textDataType "pack" [] Prefix + +Here `packConstr` isn't a real data constructor, it's an ordiary +function. Two complications + +* In such a case, we must take care to build the Name using + mkNameG_v (for values), not mkNameG_d (for data constructors). + See Trac #10796. + +* The pseudo-constructor is named only by its string, here "pack". + But 'dataToQa' needs the TyCon of its defining module, and has + to assume it's defined in the same module as the TyCon itself. + But nothing enforces that; Trac #12596 shows what goes wrong if + "pack" is defined in a different module than the data type "Text". + -} + -- | 'dataToExpQ' converts a value to a 'Q Exp' representation of the -- same value, in the SYB style. It is generalized to take a function -- override type-specific cases; see 'liftData' for a more commonly From git at git.haskell.org Thu Sep 15 17:50:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 17:50:33 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rts: Disable -hb with multiple capabilities (c51caaf) Message-ID: <20160915175033.0BA343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c51caafae7669d4246f4efd3d1a6858020780e02/ghc >--------------------------------------------------------------- commit c51caafae7669d4246f4efd3d1a6858020780e02 Author: Ben Gamari Date: Mon Sep 12 08:44:24 2016 -0400 rts: Disable -hb with multiple capabilities Biographical profiling is not thread-safe as documented in #12019. Throw an error when it is used in this way. Test Plan: Validate Reviewers: simonmar, austin, erikd Reviewed By: erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2516 GHC Trac Issues: #12019 (cherry picked from commit 6555c6bb8447ed65d5da4bab462ee9da7dc3f97a) >--------------------------------------------------------------- c51caafae7669d4246f4efd3d1a6858020780e02 rts/ProfHeap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 1b82b36..29fda5a 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -384,6 +384,13 @@ initHeapProfiling(void) errorBelch("cannot mix -hb and -hr"); stg_exit(EXIT_FAILURE); } +#ifdef THREADED_RTS + // See Trac #12019. + if (doingLDVProfiling() && RtsFlags.ParFlags.nCapabilities > 1) { + errorBelch("-hb cannot be used with multiple capabilities"); + stg_exit(EXIT_FAILURE); + } +#endif #endif // we only count eras if we're doing LDV profiling. Otherwise era From git at git.haskell.org Thu Sep 15 17:50:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 17:50:36 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add failing testcase for #12433 (094f3c6) Message-ID: <20160915175036.45C423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/094f3c691fef0bd85f711fa4ec3f9b99fee70225/ghc >--------------------------------------------------------------- commit 094f3c691fef0bd85f711fa4ec3f9b99fee70225 Author: Ben Gamari Date: Mon Sep 5 19:19:10 2016 -0400 Add failing testcase for #12433 Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2517 GHC Trac Issues: #11433 (cherry picked from commit dcc49044e8ac5b905955f99b042449635eb47e64) >--------------------------------------------------------------- 094f3c691fef0bd85f711fa4ec3f9b99fee70225 testsuite/tests/codeGen/should_run/T12433.hs | 13 +++++++++++++ .../T4262.stdout => codeGen/should_run/T12433.stdout} | 0 testsuite/tests/codeGen/should_run/all.T | 1 + 3 files changed, 14 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T12433.hs b/testsuite/tests/codeGen/should_run/T12433.hs new file mode 100644 index 0000000..f9e64a6 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T12433.hs @@ -0,0 +1,13 @@ +f :: Int -> IO () +f p = case p of + 0 -> return () + 1 -> return () + 2 -> return () + 3 -> return () + 4 -> return () + 10 -> return () + 11 -> return () + _ -> print p +{-# NOINLINE f #-} + +main = f 8 diff --git a/testsuite/tests/concurrent/should_run/T4262.stdout b/testsuite/tests/codeGen/should_run/T12433.stdout similarity index 100% copy from testsuite/tests/concurrent/should_run/T4262.stdout copy to testsuite/tests/codeGen/should_run/T12433.stdout diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index a390a70..36babf2 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -143,3 +143,4 @@ test('T10521b', normal, compile_and_run, ['']) test('T10870', when(wordsize(32), skip), compile_and_run, ['']) test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) +test('T12433', expect_broken(12433), compile_and_run, ['']) From git at git.haskell.org Thu Sep 15 17:50:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 17:50:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Improve typechecking of instance defaults (54b887b) Message-ID: <20160915175040.382D43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/54b887b5abf6ee723c6ac6aaa2d2f4c14cf74060/ghc >--------------------------------------------------------------- commit 54b887b5abf6ee723c6ac6aaa2d2f4c14cf74060 Author: Simon Peyton Jones Date: Thu Jun 23 14:51:22 2016 +0100 Improve typechecking of instance defaults In an instance declaration when you don't specify the code for a method, GHC fills in from the default binding in the class. The type of the default method can legitmiately be ambiguous --- see Note [Default methods in instances] in TcInstDcls --- so typechecking it can be tricky. Trac #12220 showed that although we were dealing with that ambiguity for /vanilla/ default methods, we were not doing so for /generic/ default methods. Moreover we were dealing with it clumsily, by generating post-typechecked code. This patch fixes the bug AND deletes code! We now use the same code path for both vanilla and generic default methods; and generate /pre-typechecked/ code in both cases. The key trick is that we can use Visible Type Application to deal with the ambiguity, which wasn't possible before. Hooray. There is a small hit to performance in compiler/perf/T1969 which consists of nothing BUT instance declarations with several default methods to fill, which we now have to typecheck. The actual hit is from 724 -> 756 or 4% in that extreme example. Real world programs have vastly fewer instance decls. (cherry picked from commit d2958bd08a049b61941f078e51809c7e63bc3354) >--------------------------------------------------------------- 54b887b5abf6ee723c6ac6aaa2d2f4c14cf74060 compiler/coreSyn/TrieMap.hs | 3 +- compiler/iface/IfaceType.hs | 3 - compiler/typecheck/TcClassDcl.hs | 19 +- compiler/typecheck/TcInstDcls.hs | 136 +++-- testsuite/tests/generics/GShow/GShow.hs | 3 +- testsuite/tests/generics/GenDerivOutput.stderr | 6 + .../tests/generics/T10604/T10604_deriving.stderr | 549 +++++++++++++++++++++ testsuite/tests/generics/T12220.hs | 37 ++ testsuite/tests/generics/all.T | 1 + testsuite/tests/perf/compiler/all.T | 3 +- 10 files changed, 669 insertions(+), 91 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 54b887b5abf6ee723c6ac6aaa2d2f4c14cf74060 From git at git.haskell.org Thu Sep 15 17:50:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 17:50:42 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix codegen bug in PIC version of genSwitch (#12433) (a0472f8) Message-ID: <20160915175042.EA6703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a0472f8dd29037412c61cbd42537863ad18b74f0/ghc >--------------------------------------------------------------- commit a0472f8dd29037412c61cbd42537863ad18b74f0 Author: Simon Marlow Date: Thu Sep 15 10:11:34 2016 +0100 Fix codegen bug in PIC version of genSwitch (#12433) Summary: * getNonClobberedReg instead of getSomeReg, because the reg needs to survive across t_code * Use a new reg for the table offset calculation instead of clobbering the reg returned by expr (this was the bug affecting #12433) Test Plan: New unit test; validate Reviewers: rwbarton, bgamari, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2529 GHC Trac Issues: #12433 >--------------------------------------------------------------- a0472f8dd29037412c61cbd42537863ad18b74f0 compiler/nativeGen/X86/CodeGen.hs | 9 ++++++--- testsuite/tests/codeGen/should_run/all.T | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index cd45d92..4401f38 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -2603,7 +2603,8 @@ genSwitch :: DynFlags -> CmmExpr -> SwitchTargets -> NatM InstrBlock genSwitch dflags expr targets | gopt Opt_PIC dflags = do - (reg,e_code) <- getSomeReg (cmmOffset dflags expr offset) + (reg,e_code) <- getNonClobberedReg (cmmOffset dflags expr offset) + -- getNonClobberedReg because it needs to survive across t_code lbl <- getNewLabelNat dflags <- getDynFlags let is32bit = target32Bit (targetPlatform dflags) @@ -2624,6 +2625,7 @@ genSwitch dflags expr targets let op = OpAddr (AddrBaseIndex (EABaseReg tableReg) (EAIndex reg (wORD_SIZE dflags)) (ImmInt 0)) + offsetReg <- getNewRegNat (intFormat (wordWidth dflags)) return $ if is32bit || os == OSDarwin then e_code `appOL` t_code `appOL` toOL [ ADD (intFormat (wordWidth dflags)) op (OpReg tableReg), @@ -2636,8 +2638,9 @@ genSwitch dflags expr targets -- hack should be removed in conjunction with the hack in -- PprMach.hs/pprDataItem once binutils 2.17 is standard. e_code `appOL` t_code `appOL` toOL [ - MOVSxL II32 op (OpReg reg), - ADD (intFormat (wordWidth dflags)) (OpReg reg) + MOVSxL II32 op (OpReg offsetReg), + ADD (intFormat (wordWidth dflags)) + (OpReg offsetReg) (OpReg tableReg), JMP_TBL (OpReg tableReg) ids rosection lbl ] diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 36babf2..15ad68b 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -143,4 +143,4 @@ test('T10521b', normal, compile_and_run, ['']) test('T10870', when(wordsize(32), skip), compile_and_run, ['']) test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) -test('T12433', expect_broken(12433), compile_and_run, ['']) +test('T12433', normal, compile_and_run, ['']) From git at git.haskell.org Thu Sep 15 21:12:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 15 Sep 2016 21:12:34 +0000 (UTC) Subject: [commit: ghc] master: Add test case for #7611 (97b47d2) Message-ID: <20160915211234.E1F093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/97b47d277d6b0ced3ce73175f78b23ecff84cfa3/ghc >--------------------------------------------------------------- commit 97b47d277d6b0ced3ce73175f78b23ecff84cfa3 Author: Joachim Breitner Date: Thu Sep 15 17:06:16 2016 -0400 Add test case for #7611 basically using the machinery from the test case of #2110. >--------------------------------------------------------------- 97b47d277d6b0ced3ce73175f78b23ecff84cfa3 testsuite/tests/simplCore/should_run/T7611.hs | 29 ++++++++++++++++++++++ .../should_run/{AmapCoerce.stdout => T7611.stdout} | 1 + testsuite/tests/simplCore/should_run/all.T | 1 + 3 files changed, 31 insertions(+) diff --git a/testsuite/tests/simplCore/should_run/T7611.hs b/testsuite/tests/simplCore/should_run/T7611.hs new file mode 100644 index 0000000..717a655 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T7611.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE MagicHash #-} + +import GHC.Exts + +newtype Age = Age Int + +myMap f [] = [] +myMap f (x:xs) = f x : myMap f xs + +{-# RULES "map id2" myMap (\x -> x) = id #-} + +mapId = myMap id +mapIdApp x = myMap id x + +mapLamId = myMap (\x -> x) +mapLamIdApp x = myMap (\x -> x) x + + +same :: a -> a -> IO () +same x y = case reallyUnsafePtrEquality# x y of + 1# -> putStrLn "yes" + _ -> putStrLn "no" + +main = do + let l = [1,2,3] + same (mapId l) l + same (mapIdApp l) l + same (mapLamId l) l + same (mapLamIdApp l) l diff --git a/testsuite/tests/simplCore/should_run/AmapCoerce.stdout b/testsuite/tests/simplCore/should_run/T7611.stdout similarity index 75% copy from testsuite/tests/simplCore/should_run/AmapCoerce.stdout copy to testsuite/tests/simplCore/should_run/T7611.stdout index 55f7ebb..4ff957b 100644 --- a/testsuite/tests/simplCore/should_run/AmapCoerce.stdout +++ b/testsuite/tests/simplCore/should_run/T7611.stdout @@ -1,3 +1,4 @@ yes yes yes +yes diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 7fd1812..60a279a 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -72,3 +72,4 @@ test('T9390', normal, compile_and_run, ['']) test('T10830', extra_run_opts('+RTS -K100k -RTS'), compile_and_run, ['']) test('T11172', normal, compile_and_run, ['']) test('T11731', normal, compile_and_run, ['-fspec-constr']) +test('T7611', normal, compile_and_run, ['']) From git at git.haskell.org Fri Sep 16 15:10:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 16 Sep 2016 15:10:44 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix T12504 (21c2020) Message-ID: <20160916151044.DCE423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/21c20203ab071d2255051a395a646f0b39dbfc38/ghc >--------------------------------------------------------------- commit 21c20203ab071d2255051a395a646f0b39dbfc38 Author: Ben Gamari Date: Thu Sep 15 13:30:57 2016 -0400 Fix T12504 This had an extra_files directive, which does not exist in ghc-8.0, from cherry-picking. >--------------------------------------------------------------- 21c20203ab071d2255051a395a646f0b39dbfc38 testsuite/tests/hsc2hs/all.T | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testsuite/tests/hsc2hs/all.T b/testsuite/tests/hsc2hs/all.T index 3f910db..a953bee 100644 --- a/testsuite/tests/hsc2hs/all.T +++ b/testsuite/tests/hsc2hs/all.T @@ -37,7 +37,6 @@ test('T10272', ['$MAKE -s --no-print-directory T10272']) test('T12504', - [extra_clean(['T12504/path/to/T12504.hs']), - extra_files(['T12504'])], + [extra_clean(['T12504/path/to/T12504.hs'])], run_command, ['$MAKE -s --no-print-directory T12504']) From git at git.haskell.org Fri Sep 16 16:20:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 16 Sep 2016 16:20:57 +0000 (UTC) Subject: [commit: ghc] master: Remove directories from include paths (ea310f9) Message-ID: <20160916162057.240133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ea310f9956179f91ca973bc747b0bc7b061bc174/ghc >--------------------------------------------------------------- commit ea310f9956179f91ca973bc747b0bc7b061bc174 Author: Ben Gamari Date: Fri Sep 16 11:49:24 2016 -0400 Remove directories from include paths Previously this was a relative path which worked in the GHC tree, but failed elsewhere. This caused trouble for out-of-tree users as well as Hadrian, which wants to move build artifacts out of the working directory. Fixes #8040. Test Plan: Validate Reviewers: thomie, austin, snowleopard, hvr Reviewed By: snowleopard, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2530 GHC Trac Issues: #8040 >--------------------------------------------------------------- ea310f9956179f91ca973bc747b0bc7b061bc174 compiler/HsVersions.h | 2 +- compiler/ghc.mk | 5 +++++ compiler/main/DynFlags.hs | 3 ++- compiler/main/PlatformConstants.hs | 3 ++- rules/build-dependencies.mk | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/HsVersions.h b/compiler/HsVersions.h index 6d5716d..83cbcf1 100644 --- a/compiler/HsVersions.h +++ b/compiler/HsVersions.h @@ -20,7 +20,7 @@ you will screw up the layout where they are used in case expressions! * ghcconfig.h, because that will include ghcplatform.h which has the * wrong platform settings for the compiler (it has the platform * settings for the target plat instead). */ -#include "../includes/ghcautoconf.h" +#include "ghcautoconf.h" #define GLOBAL_VAR(name,value,ty) \ {-# NOINLINE name #-}; \ diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 5aeda53..38eae0e 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -259,6 +259,11 @@ PRIMOP_BITS_STAGE3 = $(addprefix compiler/stage3/build/,$(PRIMOP_BITS_NAMES)) compiler_CPP_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) compiler_CPP_OPTS += ${GhcCppOpts} +# We add these paths to the Haskell compiler's #include search path list since +# we must avoid #including files by paths relative to the source file as Hadrian +# moves the build artifacts out of the source tree. See #8040. +compiler_HC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) + define preprocessCompilerFiles # $0 = stage compiler/stage$1/build/primops.txt: compiler/prelude/primops.txt.pp compiler/stage$1/$$(PLATFORM_H) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 7546936..b642bea 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -4765,7 +4765,8 @@ compilerInfo dflags showBool False = "NO" isWindows = platformOS (targetPlatform dflags) == OSMinGW32 -#include "../includes/dist-derivedconstants/header/GHCConstantsHaskellWrappers.hs" +-- Produced by deriveConstants +#include "GHCConstantsHaskellWrappers.hs" bLOCK_SIZE_W :: DynFlags -> Int bLOCK_SIZE_W dflags = bLOCK_SIZE dflags `quot` wORD_SIZE dflags diff --git a/compiler/main/PlatformConstants.hs b/compiler/main/PlatformConstants.hs index b2ca32b..c9a4072 100644 --- a/compiler/main/PlatformConstants.hs +++ b/compiler/main/PlatformConstants.hs @@ -10,5 +10,6 @@ module PlatformConstants (PlatformConstants(..)) where -#include "../includes/dist-derivedconstants/header/GHCConstantsHaskellType.hs" +-- Produced by deriveConstants +#include "GHCConstantsHaskellType.hs" diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk index 8152691..1905a0e 100644 --- a/rules/build-dependencies.mk +++ b/rules/build-dependencies.mk @@ -24,6 +24,7 @@ $1_$2_C_FILES_DEPS = $$(filter-out $$($1_$2_C_FILES_NODEPS),$$($1_$2_C_FILES)) $1_$2_MKDEPENDHS_FLAGS = -dep-makefile $$($1_$2_depfile_haskell).tmp $$(foreach way,$$($1_$2_WAYS),-dep-suffix "$$(patsubst %o,%,$$($$(way)_osuf))") $1_$2_MKDEPENDHS_FLAGS += -include-pkg-deps +$1_$2_MKDEPENDHS_FLAGS += $(addprefix -I,$($1_INCLUDE_DIRS)) ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES" From git at git.haskell.org Sun Sep 18 17:00:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 18 Sep 2016 17:00:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Get in-scope set right in top_instantiate (5c01763) Message-ID: <20160918170052.E73023A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/5c01763e2fa7cd9bb5f08fad713cb03b97a07b7f/ghc >--------------------------------------------------------------- commit 5c01763e2fa7cd9bb5f08fad713cb03b97a07b7f Author: Simon Peyton Jones Date: Sat Jun 11 23:55:10 2016 +0100 Get in-scope set right in top_instantiate ...thereby being able to replace substThetaUnchecked with substTheta (cherry picked from commit 7afb7adf45216701e4f645676ecc0668f64b424d) >--------------------------------------------------------------- 5c01763e2fa7cd9bb5f08fad713cb03b97a07b7f compiler/typecheck/Inst.hs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs index 49f57a5..0c854f7 100644 --- a/compiler/typecheck/Inst.hs +++ b/compiler/typecheck/Inst.hs @@ -172,7 +172,8 @@ topInstantiateInferred :: CtOrigin -> TcSigmaType -- then wrap e :: rho topInstantiateInferred = top_instantiate False -top_instantiate :: Bool -- True <=> instantiate *all* variables +top_instantiate :: Bool -- True <=> instantiate *all* variables + -- False <=> instantiate only the invisible ones -> CtOrigin -> TcSigmaType -> TcM (HsWrapper, TcRhoType) top_instantiate inst_all orig ty | not (null binders && null theta) @@ -180,16 +181,21 @@ top_instantiate inst_all orig ty (inst_theta, leave_theta) | null leave_bndrs = (theta, []) | otherwise = ([], theta) - ; (subst, inst_tvs') <- newMetaTyVars (map (binderVar "top_inst") inst_bndrs) - ; let inst_theta' = substThetaUnchecked subst inst_theta - sigma' = substTyAddInScope subst (mkForAllTys leave_bndrs $ - mkFunTys leave_theta rho) + in_scope = mkInScopeSet (tyCoVarsOfType ty) + empty_subst = mkEmptyTCvSubst in_scope + inst_tvs = map (binderVar "top_inst") inst_bndrs + ; (subst, inst_tvs') <- mapAccumLM newMetaTyVarX empty_subst inst_tvs + ; let inst_theta' = substTheta subst inst_theta + sigma' = substTy subst (mkForAllTys leave_bndrs $ + mkFunTys leave_theta rho) ; wrap1 <- instCall orig (mkTyVarTys inst_tvs') inst_theta' ; traceTc "Instantiating" (vcat [ text "all tyvars?" <+> ppr inst_all , text "origin" <+> pprCtOrigin orig , text "type" <+> ppr ty + , text "theta" <+> ppr theta + , text "leave_bndrs" <+> ppr leave_bndrs , text "with" <+> ppr inst_tvs' , text "theta:" <+> ppr inst_theta' ]) From git at git.haskell.org Sun Sep 18 17:00:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 18 Sep 2016 17:00:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Be less picky about reporing inaccessible code (0e4e03a) Message-ID: <20160918170056.C10943A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/0e4e03a2a810ffa8ae16815d2ce4aad11d4b1065/ghc >--------------------------------------------------------------- commit 0e4e03a2a810ffa8ae16815d2ce4aad11d4b1065 Author: Simon Peyton Jones Date: Fri Sep 9 17:42:42 2016 +0100 Be less picky about reporing inaccessible code Triggered by the discussion on Trac #12466, this patch makes GHC less aggressive about reporting an error when there are insoluble Givens. Being so agressive was making some libraries fail to compile, and is arguably wrong in at least some cases. See the discussion on the ticket. Several test now pass when they failed before; see the files-modified list for this patch. (cherry picked from commit 03541cbae50f0d1cdf99120ab88698f29a278159) >--------------------------------------------------------------- 0e4e03a2a810ffa8ae16815d2ce4aad11d4b1065 compiler/typecheck/TcErrors.hs | 94 +++++++++++++++++----- compiler/typecheck/TcSMonad.hs | 14 ++-- compiler/typecheck/TcSimplify.hs | 2 +- testsuite/tests/ghci/scripts/Defer02.script | 5 +- testsuite/tests/ghci/scripts/Defer02.stderr | 92 +++++++++------------ testsuite/tests/typecheck/should_compile/T12466.hs | 9 +++ .../tests/typecheck/should_compile/T12466a.hs | 26 ++++++ testsuite/tests/typecheck/should_compile/all.T | 2 + .../tests/typecheck/should_fail/FDsFromGivens.hs | 1 + .../typecheck/should_fail/FDsFromGivens.stderr | 19 ----- testsuite/tests/typecheck/should_fail/T10715.hs | 6 ++ .../tests/typecheck/should_fail/T10715.stderr | 14 ---- testsuite/tests/typecheck/should_fail/T5236.hs | 3 + testsuite/tests/typecheck/should_fail/T5236.stderr | 15 ---- testsuite/tests/typecheck/should_fail/T8392a.hs | 4 +- .../tests/typecheck/should_fail/T8392a.stderr | 9 --- testsuite/tests/typecheck/should_fail/all.T | 8 +- testsuite/tests/typecheck/should_run/Defer01.hs | 1 + 18 files changed, 179 insertions(+), 145 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0e4e03a2a810ffa8ae16815d2ce4aad11d4b1065 From git at git.haskell.org Sun Sep 18 17:00:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 18 Sep 2016 17:00:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Test wibbles for commit 03541cba (e284872) Message-ID: <20160918170059.6FA393A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e284872899c53f1d389a55ad3a6547fbfcce6909/ghc >--------------------------------------------------------------- commit e284872899c53f1d389a55ad3a6547fbfcce6909 Author: Simon Peyton Jones Date: Mon Sep 12 22:21:15 2016 +0100 Test wibbles for commit 03541cba I must have failed to validate properly, sorry. These testsuite wibbles belong with commit 03541cbae50f0d1cdf99120ab88698f29a278159 Author: Simon Peyton Jones Date: Fri Sep 9 17:42:42 2016 +0100 Be less picky about reporing inaccessible code (cherry picked from commit 5eeabe250a1de456f70af07bd3f507a32cb8e10e) >--------------------------------------------------------------- e284872899c53f1d389a55ad3a6547fbfcce6909 testsuite/tests/typecheck/should_fail/FDsFromGivens.hs | 5 ++++- testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr | 4 ++++ testsuite/tests/typecheck/should_fail/T10715.hs | 4 +++- testsuite/tests/typecheck/should_fail/T10715.stderr | 4 ++++ testsuite/tests/typecheck/should_fail/T8392a.hs | 2 ++ testsuite/tests/typecheck/should_fail/T8392a.stderr | 4 ++++ 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/typecheck/should_fail/FDsFromGivens.hs b/testsuite/tests/typecheck/should_fail/FDsFromGivens.hs index 6e1b34d..110199b 100644 --- a/testsuite/tests/typecheck/should_fail/FDsFromGivens.hs +++ b/testsuite/tests/typecheck/should_fail/FDsFromGivens.hs @@ -6,7 +6,10 @@ class C a b | a -> b where cop :: a -> b -> () {- Failing, as it righteously should! It's inaccessible code -} --- But (c.f. test T5236) we no longer reject this (see Trac #12466) +-- But (c.f. test T5236) we no longer reject this in the +-- typechecker (see Trac #12466) +-- Instead we get a redundant pattern-match warning, +-- in the post-typechecking pattern-match checks g1 :: (C Char [a], C Char Bool) => a -> () g1 x = () diff --git a/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr b/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr index e69de29..964e4b6 100644 --- a/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr +++ b/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr @@ -0,0 +1,4 @@ + +FDsFromGivens.hs:11:1: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match is redundant + In an equation for ‘g1’: g1 x = ... diff --git a/testsuite/tests/typecheck/should_fail/T10715.hs b/testsuite/tests/typecheck/should_fail/T10715.hs index c48402f..9e675e2 100644 --- a/testsuite/tests/typecheck/should_fail/T10715.hs +++ b/testsuite/tests/typecheck/should_fail/T10715.hs @@ -11,6 +11,8 @@ data X a -- -- But in Trac #12466 we decided to accept contradictory -- type signatures, so definition is now accepeted even --- though you can never call it. +-- though you can never call it. Instead we get a +-- redundant pattern-match warning, in the +-- post-typechecking pattern-match checks doCoerce :: Coercible a (X a) => a -> X a doCoerce = coerce diff --git a/testsuite/tests/typecheck/should_fail/T10715.stderr b/testsuite/tests/typecheck/should_fail/T10715.stderr index e69de29..10ff2c9 100644 --- a/testsuite/tests/typecheck/should_fail/T10715.stderr +++ b/testsuite/tests/typecheck/should_fail/T10715.stderr @@ -0,0 +1,4 @@ + +T10715.hs:17:1: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match is redundant + In an equation for ‘doCoerce’: doCoerce = ... diff --git a/testsuite/tests/typecheck/should_fail/T8392a.hs b/testsuite/tests/typecheck/should_fail/T8392a.hs index 2ae2338..940f8b6 100644 --- a/testsuite/tests/typecheck/should_fail/T8392a.hs +++ b/testsuite/tests/typecheck/should_fail/T8392a.hs @@ -5,5 +5,7 @@ module T8392a where -- -- But (Trac #12466) we now don't complain about -- contradictory signatures +-- Instead we get a redundant pattern-match warning, +-- in the post-typechecking pattern-match checks foo :: (Int ~ Bool) => a -> a foo x = x diff --git a/testsuite/tests/typecheck/should_fail/T8392a.stderr b/testsuite/tests/typecheck/should_fail/T8392a.stderr index e69de29..bfc30e7 100644 --- a/testsuite/tests/typecheck/should_fail/T8392a.stderr +++ b/testsuite/tests/typecheck/should_fail/T8392a.stderr @@ -0,0 +1,4 @@ + +T8392a.hs:11:1: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match is redundant + In an equation for ‘foo’: foo x = ... From git at git.haskell.org Sun Sep 18 17:01:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 18 Sep 2016 17:01:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: More testsuite wibbles (d3ac6ce) Message-ID: <20160918170102.6A0FD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d3ac6ce08f282060ca6dc61de527b5b77885ab88/ghc >--------------------------------------------------------------- commit d3ac6ce08f282060ca6dc61de527b5b77885ab88 Author: Ben Gamari Date: Sun Sep 18 12:57:18 2016 -0400 More testsuite wibbles The old testsuite driver still requires a relative path to Defer02. >--------------------------------------------------------------- d3ac6ce08f282060ca6dc61de527b5b77885ab88 testsuite/tests/ghci/scripts/Defer02.script | 4 +- testsuite/tests/ghci/scripts/Defer02.stderr | 76 ++++++++++++---------- .../typecheck/should_fail/FDsFromGivens.stderr | 2 +- .../tests/typecheck/should_fail/T10715.stderr | 2 +- 4 files changed, 43 insertions(+), 41 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d3ac6ce08f282060ca6dc61de527b5b77885ab88 From git at git.haskell.org Mon Sep 19 02:01:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 19 Sep 2016 02:01:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rts: Fix reference to NUMA-specific field (129845018) Message-ID: <20160919020146.6AEB83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/1298450180e387a27b1333ed4db5a6fccaaf6d84/ghc >--------------------------------------------------------------- commit 1298450180e387a27b1333ed4db5a6fccaaf6d84 Author: Ben Gamari Date: Sun Sep 18 13:11:52 2016 -0400 rts: Fix reference to NUMA-specific field This snuck into c51caafae7669d4246f4efd3d1a6858020780e02. >--------------------------------------------------------------- 1298450180e387a27b1333ed4db5a6fccaaf6d84 rts/ProfHeap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 29fda5a..929b4fc 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -386,7 +386,7 @@ initHeapProfiling(void) } #ifdef THREADED_RTS // See Trac #12019. - if (doingLDVProfiling() && RtsFlags.ParFlags.nCapabilities > 1) { + if (doingLDVProfiling() && RtsFlags.ParFlags.nNodes > 1) { errorBelch("-hb cannot be used with multiple capabilities"); stg_exit(EXIT_FAILURE); } From git at git.haskell.org Tue Sep 20 04:20:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 04:20:00 +0000 (UTC) Subject: [commit: ghc] master: Codegen for case: Remove redundant void id checks (14c2e8e) Message-ID: <20160920042000.CC17C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/14c2e8e0c11bb2b95f81303284d1460bb80a9a98/ghc >--------------------------------------------------------------- commit 14c2e8e0c11bb2b95f81303284d1460bb80a9a98 Author: Ömer Sinan Ağacan Date: Tue Sep 20 00:19:15 2016 -0400 Codegen for case: Remove redundant void id checks New unarise (714bebf) eliminates void binders in patterns already, so no need to eliminate them here. I leave assertions to make sure this is the case. Assertion failure -> bug in unarise Reviewers: bgamari, simonpj, austin, simonmar, hvr Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2416 >--------------------------------------------------------------- 14c2e8e0c11bb2b95f81303284d1460bb80a9a98 compiler/codeGen/StgCmm.hs | 19 +++++++++------ compiler/codeGen/StgCmmBind.hs | 20 +++++++++------ compiler/codeGen/StgCmmClosure.hs | 51 ++++++++++++++++++++++++++++++++++++--- compiler/codeGen/StgCmmCon.hs | 15 ++++++------ compiler/codeGen/StgCmmEnv.hs | 22 +---------------- compiler/codeGen/StgCmmExpr.hs | 26 +++++++++++--------- compiler/codeGen/StgCmmLayout.hs | 30 ++++++++++++++--------- compiler/codeGen/StgCmmTicky.hs | 3 +-- compiler/ghci/ByteCodeItbls.hs | 18 ++++++++------ compiler/simplStg/UnariseStg.hs | 14 +++++++++++ 10 files changed, 138 insertions(+), 80 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 14c2e8e0c11bb2b95f81303284d1460bb80a9a98 From git at git.haskell.org Tue Sep 20 11:15:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 11:15:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix scoping of type variables in instances (e134a5b) Message-ID: <20160920111502.1E6F63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e134a5bcdd7ba383c49cd0033884d98f6ef92c0c/ghc >--------------------------------------------------------------- commit e134a5bcdd7ba383c49cd0033884d98f6ef92c0c Author: Simon Peyton Jones Date: Fri Aug 26 17:32:42 2016 +0100 Fix scoping of type variables in instances This fixes Trac #12531: class Foo x where foo :: forall a . x a -> x a default foo :: forall b . x b -> x b foo x = go where go :: x b go = undefined We want 'b' to scope over the code for 'foo', but we were using 'a' instead. (cherry picked from commit 0050aff22ba04baca732bf5124002417ab667f8a) >--------------------------------------------------------------- e134a5bcdd7ba383c49cd0033884d98f6ef92c0c compiler/hsSyn/HsUtils.hs | 29 +++++++++++++++++++- compiler/rename/RnBinds.hs | 30 +++++++++------------ compiler/typecheck/TcClassDcl.hs | 36 +++++++++++++++---------- compiler/typecheck/TcInstDcls.hs | 6 ++--- testsuite/tests/rename/should_compile/T12533.hs | 10 +++++++ testsuite/tests/rename/should_compile/all.T | 1 + 6 files changed, 77 insertions(+), 35 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e134a5bcdd7ba383c49cd0033884d98f6ef92c0c From git at git.haskell.org Tue Sep 20 11:15:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 11:15:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Trim all spaces after 'version:' (ec6526e) Message-ID: <20160920111505.02FCF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/ec6526ea4d5bd92edc39400ea7f7e8d6a1bbd370/ghc >--------------------------------------------------------------- commit ec6526ea4d5bd92edc39400ea7f7e8d6a1bbd370 Author: Gabor Greif Date: Fri Aug 5 09:42:09 2016 +0200 Trim all spaces after 'version:' ... that we grep out of libraries/Cabal/Cabal/Cabal.cabal This is necessary because the file got reformatted in the 'master' branch. (cherry picked from commit 1101045cbdbd6f240fa7e2438d9488822cd604fb) >--------------------------------------------------------------- ec6526ea4d5bd92edc39400ea7f7e8d6a1bbd370 utils/ghc-cabal/ghc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index c06a011..62338ee 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -14,7 +14,7 @@ # Euch, hideous hack: # XXX This should be in a different Makefile -CABAL_DOTTED_VERSION := $(shell grep "^version:" libraries/Cabal/Cabal/Cabal.cabal | sed "s/^version: //") +CABAL_DOTTED_VERSION := $(shell grep "^version:" libraries/Cabal/Cabal/Cabal.cabal | sed "s/^version: *//") CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION)) CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)" From git at git.haskell.org Tue Sep 20 11:15:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 11:15:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix configure detection. (682518d) Message-ID: <20160920111508.1043A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/682518d410a4c522be5d10550c5c915b1f56084d/ghc >--------------------------------------------------------------- commit 682518d410a4c522be5d10550c5c915b1f56084d Author: Tamar Christina Date: Sat Aug 13 16:27:30 2016 +0100 Fix configure detection. Summary: GHC's configure script seems to normalize the values returned from config.guess. So for Windows it turns x86_64-pc-mingw64 into x86_64-unknown-mingw32. These mangled names are stored in the values $BuildPlatform, $HostPlatform and $TargetPlatform. However further down the file when the comparison is done between the stage0 compiler and the host the normalized versions are not used. So when normalization actually changes the triple this check will fail. Not sure why it's worked for all this time.. Nor if this is the right fix? Does it still work for cross compiling correctly? Test Plan: ./configure Reviewers: hvr, austin, thomie, bgamari, erikd Reviewed By: erikd Subscribers: erikd, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2452 GHC Trac Issues: #12487 (cherry picked from commit 18f06878ed5d8cb0cf366a876f2bfea29647e5f0) >--------------------------------------------------------------- 682518d410a4c522be5d10550c5c915b1f56084d configure.ac | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 7d176dd..20ee711 100644 --- a/configure.ac +++ b/configure.ac @@ -419,20 +419,20 @@ dnl ** Building a cross compiler? dnl -------------------------------------------------------------- CrossCompiling=NO # If 'host' and 'target' differ, then this means we are building a cross-compiler. -if test "$target" != "$host" ; then +if test "$TargetPlatform" != "$HostPlatform" ; then CrossCompiling=YES cross_compiling=yes # This tells configure that it can accept just 'target', # otherwise you get # configure: error: cannot run C compiled programs. # If you meant to cross compile, use `--host'. fi -if test "$build" != "$host" ; then +if test "$BuildPlatform" != "$host" ; then AC_MSG_ERROR([ You've selected: - BUILD: $build (the architecture we're building on) - HOST: $host (the architecture the compiler we're building will execute on) - TARGET: $target (the architecture the compiler we're building will produce code for) + BUILD: $BuildPlatform (the architecture we're building on) + HOST: $HostPlatform (the architecture the compiler we're building will execute on) + TARGET: $TargetPlatform (the architecture the compiler we're building will produce code for) BUILD must equal HOST; that is, we do not support building GHC itself with a cross-compiler. To cross-compile GHC itself, set TARGET: stage @@ -446,7 +446,7 @@ then else CrossCompilePrefix="" fi -TargetPlatformFull="${target}" +TargetPlatformFull="${TargetPlatform}" AC_SUBST(CrossCompiling) AC_SUBST(CrossCompilePrefix) AC_SUBST(TargetPlatformFull) From git at git.haskell.org Tue Sep 20 11:15:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 11:15:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: configure.ac: fix --host= handling (b205029) Message-ID: <20160920111510.DD0FA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b20502997c0e1817b2360e3aaabcea31c1d7dedd/ghc >--------------------------------------------------------------- commit b20502997c0e1817b2360e3aaabcea31c1d7dedd Author: Sergei Trofimovich Date: Fri Sep 2 08:35:25 2016 +0100 configure.ac: fix --host= handling The following command fails as: $ ./configure --prefix=/usr \ --build=x86_64-pc-linux-gnu \ --host=x86_64-pc-linux-gnu \ --target=x86_64-pc-linux-gnu configure: error: You've selected: BUILD: x86_64-unknown-linux HOST: x86_64-unknown-linux TARGET: x86_64-unknown-linux BUILD must equal HOST; 18f06878ed5d8cb0cf366a876f2bfea29647e5f0 changed native configure $build/$host/$target checks to ghc-mangled ones, but not completely. Signed-off-by: Sergei Trofimovich Reviewers: rwbarton, erikd, austin, hvr, bgamari, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2508 GHC Trac Issues: #12487 (cherry picked from commit 0cc3931bd7831fa8d042f968a5a9114534a656e4) >--------------------------------------------------------------- b20502997c0e1817b2360e3aaabcea31c1d7dedd configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 20ee711..13d33d2 100644 --- a/configure.ac +++ b/configure.ac @@ -426,7 +426,7 @@ if test "$TargetPlatform" != "$HostPlatform" ; then # configure: error: cannot run C compiled programs. # If you meant to cross compile, use `--host'. fi -if test "$BuildPlatform" != "$host" ; then +if test "$BuildPlatform" != "$HostPlatform" ; then AC_MSG_ERROR([ You've selected: From git at git.haskell.org Tue Sep 20 18:50:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 18:50:58 +0000 (UTC) Subject: [commit: ghc] master: Bump Haddock submodule to fix rendering of class methods (6886bba) Message-ID: <20160920185058.719323A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6886bba8ea2965177c00edceb98509b48957b515/ghc >--------------------------------------------------------------- commit 6886bba8ea2965177c00edceb98509b48957b515 Author: Matthew Pickering Date: Tue Sep 20 19:48:01 2016 +0100 Bump Haddock submodule to fix rendering of class methods Fixes #12519 >--------------------------------------------------------------- 6886bba8ea2965177c00edceb98509b48957b515 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index a3309e7..073d899 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit a3309e797c42dae9bccdeb17ce52fcababbaff8a +Subproject commit 073d899a8f94ddec698f617a38d3420160a7fd0b From git at git.haskell.org Tue Sep 20 20:48:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 20:48:32 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch: A collection of type-inference refactorings. (f477756) Message-ID: <20160920204832.865BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch Link : http://ghc.haskell.org/trac/ghc/changeset/f477756baefc1b16549631efa0de56ccbb66bdef/ghc >--------------------------------------------------------------- commit f477756baefc1b16549631efa0de56ccbb66bdef Author: Simon Peyton Jones Date: Tue Aug 30 11:00:47 2016 +0100 A collection of type-inference refactorings. 1. Modify TcType.ExpType to make a distinct data type, InferResult for the Infer case, and consequential refactoring. 2. Define a new function TcUnify.fillInferResult, to fill in an InferResult. It uses TcMType.promoteTcType to promote the type to the level of the InferResult. See TcMType Note [Promoting a type] This refactoring is in preparation for an improvement to typechecking pattern bindings, coming next. I flirted with an elaborate scheme to give better higher rank inference, but it was just too complicated. See TcMType Note [Promotion and higher rank types] 3. Add to InferResult a new field ir_inst :: Bool to say whether or not the type used to fill in the InferResult should be deeply instantiated. See TcUnify Note [Deep instantiation of InferResult]. 4. Add a TcLevel to SkolemTvs. This will be useful generally - it's a fast way to see if the type variable escapes when floating (not used yet) - it provides a good consistency check when updating a unification variable (TcMType.writeMetaTyVarRef, the level_check_ok check) I originally had another reason (related to the flirting in (2), but I left it in because it seems like a step in the right direction. 5. Reduce and simplify the plethora of uExpType, tcSubType and related functions in TcUnify. It was such an opaque mess and it's still not great, but it's better. 6. Simplify the uo_expected field of TypeEqOrigin. Richard had generatlised it to a ExpType, but it was almost always a Check type. Now it's back to being a plain TcType which is much easier. 7. Improve error messages by refraining from skolemisation when it's clear that there's an error: see TcUnify Note [Don't skolemise unnecessarily] 8. Type.isPiTy and isForAllTy seem to be missing a coreView check, so I added it All these changes led to quite bit of error message wibbling >--------------------------------------------------------------- f477756baefc1b16549631efa0de56ccbb66bdef compiler/ghci/RtClosureInspect.hs | 2 +- compiler/typecheck/Inst.hs | 4 +- compiler/typecheck/TcBinds.hs | 68 +--- compiler/typecheck/TcErrors.hs | 6 +- compiler/typecheck/TcExpr.hs | 24 +- compiler/typecheck/TcHsSyn.hs | 2 +- compiler/typecheck/TcHsType.hs | 21 +- compiler/typecheck/TcInstDcls.hs | 3 +- compiler/typecheck/TcMType.hs | 324 +++++++++++----- compiler/typecheck/TcMatches.hs | 19 +- compiler/typecheck/TcPat.hs | 34 +- compiler/typecheck/TcPatSyn.hs | 16 +- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcType.hs | 75 ++-- compiler/typecheck/TcUnify.hs | 407 +++++++++++---------- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Type.hs | 2 + compiler/vectorise/Vectorise/Generic/PData.hs | 2 +- testsuite/tests/ado/ado004.stderr | 4 +- .../tests/annotations/should_fail/annfail10.stderr | 12 +- testsuite/tests/driver/T2182.stderr | 32 +- testsuite/tests/gadt/gadt-escape1.stderr | 16 +- testsuite/tests/gadt/gadt13.stderr | 10 +- testsuite/tests/gadt/gadt7.stderr | 18 +- .../tests/ghci.debugger/scripts/break012.stdout | 8 +- .../tests/ghci.debugger/scripts/print022.stdout | 4 +- testsuite/tests/ghci/scripts/T11524a.stdout | 4 +- testsuite/tests/ghci/scripts/T2182ghci.stderr | 10 +- .../tests/indexed-types/should_fail/T12386.hs | 9 + .../tests/indexed-types/should_fail/T12386.stderr | 7 + .../tests/indexed-types/should_fail/T7354.stderr | 8 +- .../tests/parser/should_compile/read014.stderr | 2 +- testsuite/tests/parser/should_fail/T7848.stderr | 3 - .../tests/parser/should_fail/readFail003.stderr | 4 +- .../partial-sigs/should_compile/T10438.stderr | 14 +- .../tests/patsyn/should_compile/T11213.stderr | 2 +- testsuite/tests/patsyn/should_fail/mono.stderr | 4 +- testsuite/tests/perf/compiler/stdout | 29 ++ testsuite/tests/polykinds/T7438.stderr | 16 +- testsuite/tests/rebindable/rebindable6.stderr | 12 +- testsuite/tests/roles/should_compile/T8958.stderr | 5 +- testsuite/tests/th/T11452.stderr | 2 +- testsuite/tests/th/T2222.stderr | 2 +- .../typecheck/should_compile/ExPatFail.stderr | 4 +- .../should_compile/T12427.stderr} | 0 .../tests/typecheck/should_compile/T12427a.stderr | 33 ++ .../tests/typecheck/should_compile/tc141.stderr | 6 +- .../tests/typecheck/should_fail/T10495.stderr | 10 +- .../tests/typecheck/should_fail/T10619.stderr | 18 +- .../tests/typecheck/should_fail/T12177.stderr | 19 +- testsuite/tests/typecheck/should_fail/T3102.hs | 6 +- testsuite/tests/typecheck/should_fail/T3102.stderr | 12 - testsuite/tests/typecheck/should_fail/T7453.stderr | 50 +-- testsuite/tests/typecheck/should_fail/T7734.stderr | 12 +- testsuite/tests/typecheck/should_fail/T8428.stderr | 5 +- testsuite/tests/typecheck/should_fail/T9109.stderr | 10 +- testsuite/tests/typecheck/should_fail/T9318.stderr | 12 +- .../tests/typecheck/should_fail/VtaFail.stderr | 2 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- .../tests/typecheck/should_fail/tcfail002.stderr | 6 +- .../tests/typecheck/should_fail/tcfail004.stderr | 6 +- .../tests/typecheck/should_fail/tcfail005.stderr | 6 +- .../tests/typecheck/should_fail/tcfail013.stderr | 2 +- .../tests/typecheck/should_fail/tcfail014.stderr | 6 +- .../tests/typecheck/should_fail/tcfail018.stderr | 2 +- .../tests/typecheck/should_fail/tcfail032.stderr | 6 +- .../tests/typecheck/should_fail/tcfail099.stderr | 6 +- .../tests/typecheck/should_fail/tcfail104.stderr | 10 +- .../tests/typecheck/should_fail/tcfail140.stderr | 4 +- .../tests/typecheck/should_fail/tcfail181.stderr | 2 +- 70 files changed, 848 insertions(+), 659 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f477756baefc1b16549631efa0de56ccbb66bdef From git at git.haskell.org Tue Sep 20 20:48:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 20:48:36 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch: Refactor typechecking of pattern bindings (831882f) Message-ID: <20160920204836.0F8D23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch Link : http://ghc.haskell.org/trac/ghc/changeset/831882f23f5df3415f6c719479a3541d51d03d77/ghc >--------------------------------------------------------------- commit 831882f23f5df3415f6c719479a3541d51d03d77 Author: Simon Peyton Jones Date: Wed Aug 31 09:28:39 2016 +0100 Refactor typechecking of pattern bindings This patch fixes a regression introduced, post 8.0.1, by this major commit: commit 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72 Author: Simon Peyton Jones Date: Sat Jun 11 23:49:27 2016 +0100 Improve typechecking of let-bindings This major commit was initially triggered by #11339, but it spiraled into a major review of the way in which type signatures for bindings are handled, especially partial type signatures. I didn't get the typechecking of pattern bindings right, leading to Trac #12427. In fixing this I found that this program doesn't work: data T where T :: a -> ((forall b. [b]->[b]) -> Int) -> T h1 y = case y of T _ v -> v Works in 7.10, but not in 8.0.1. There's a happy ending. I found a way to fix this, and improve pattern bindings too. Not only does this fix #12427, but it also allows In particular,we now can accept data T where MkT :: a -> Int -> T ... let { MkT _ q = t } in ... Previously this elicited "my head exploded" but it's really fine since q::Int. The approach is described in detail in TcBinds Note [Typechecking pattern bindings] Super cool. And not even a big patch! >--------------------------------------------------------------- 831882f23f5df3415f6c719479a3541d51d03d77 compiler/typecheck/TcBinds.hs | 226 +++++++++++++-------- compiler/typecheck/TcPat.hs | 187 +++++++++-------- .../tests/typecheck/should_compile/T12427a.hs | 40 ++++ .../tests/typecheck/should_compile/T12427b.hs | 20 ++ testsuite/tests/typecheck/should_compile/all.T | 3 + 5 files changed, 299 insertions(+), 177 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 831882f23f5df3415f6c719479a3541d51d03d77 From git at git.haskell.org Tue Sep 20 20:48:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 20 Sep 2016 20:48:38 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch: Comments and trivial refactoring (c30773c) Message-ID: <20160920204838.B69B33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch Link : http://ghc.haskell.org/trac/ghc/changeset/c30773ce53714980594a5fa2b8a0e6f5547b3c4d/ghc >--------------------------------------------------------------- commit c30773ce53714980594a5fa2b8a0e6f5547b3c4d Author: Simon Peyton Jones Date: Mon Sep 19 10:08:29 2016 +0100 Comments and trivial refactoring >--------------------------------------------------------------- c30773ce53714980594a5fa2b8a0e6f5547b3c4d compiler/basicTypes/BasicTypes.hs | 2 +- compiler/hsSyn/HsBinds.hs | 4 +++- compiler/simplCore/CoreMonad.hs | 16 ---------------- compiler/simplCore/SimplCore.hs | 16 ++++++++++++++++ compiler/typecheck/TcInstDcls.hs | 6 +++--- compiler/types/TyCoRep.hs | 2 +- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index aab0528..d911a54 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -961,7 +961,7 @@ data InlinePragma -- Note [InlinePragma] -- That is, inl_sat describes the number of *source-code* -- arguments the thing must be applied to. We add on the -- number of implicit, dictionary arguments when making - -- the InlineRule, and don't look at inl_sat further + -- the Unfolding, and don't look at inl_sat further , inl_act :: Activation -- Says during which phases inlining is allowed diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs index 236892e..4878592 100644 --- a/compiler/hsSyn/HsBinds.hs +++ b/compiler/hsSyn/HsBinds.hs @@ -593,6 +593,7 @@ ppr_monobind (AbsBinds { abs_tvs = tyvars, abs_ev_vars = dictvars pprLHsBinds val_binds ppr_monobind (AbsBindsSig { abs_tvs = tyvars , abs_ev_vars = dictvars + , abs_sig_export = poly_id , abs_sig_ev_bind = ev_bind , abs_sig_bind = bind }) = sdocWithDynFlags $ \ dflags -> @@ -600,7 +601,8 @@ ppr_monobind (AbsBindsSig { abs_tvs = tyvars hang (text "AbsBindsSig" <+> brackets (interpp'SP tyvars) <+> brackets (interpp'SP dictvars)) 2 $ braces $ vcat - [ text "Bind:" <+> ppr bind + [ text "Exported type:" <+> pprBndr LetBind poly_id + , text "Bind:" <+> ppr bind , text "Evidence:" <+> ppr ev_bind ] else ppr bind diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 853f5be..a386a28 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -238,22 +238,6 @@ runMaybe (Just x) f = f x runMaybe Nothing _ = CoreDoNothing {- -Note [RULEs enabled in SimplGently] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -RULES are enabled when doing "gentle" simplification. Two reasons: - - * We really want the class-op cancellation to happen: - op (df d1 d2) --> $cop3 d1 d2 - because this breaks the mutual recursion between 'op' and 'df' - - * I wanted the RULE - lift String ===> ... - to work in Template Haskell when simplifying - splices, so we get simpler code for literal strings - -But watch out: list fusion can prevent floating. So use phase control -to switch off those rules until after floating. - ************************************************************************ * * diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 8bc0392..0af167e 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -367,6 +367,22 @@ addPluginPasses builtin_passes #endif {- +Note [RULEs enabled in SimplGently] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +RULES are enabled when doing "gentle" simplification. Two reasons: + + * We really want the class-op cancellation to happen: + op (df d1 d2) --> $cop3 d1 d2 + because this breaks the mutual recursion between 'op' and 'df' + + * I wanted the RULE + lift String ===> ... + to work in Template Haskell when simplifying + splices, so we get simpler code for literal strings + +But watch out: list fusion can prevent floating. So use phase control +to switch off those rules until after floating. + ************************************************************************ * * The CoreToDo interpreter diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index 572b3f1..ab91c84 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -1316,15 +1316,15 @@ tcMethodBody clas tyvars dfun_ev_vars inst_tys -- Substitute the local_meth_name for the binder -- NB: the binding is always a FunBind - ; global_meth_id <- addInlinePrags global_meth_id prags - ; spec_prags <- tcSpecPrags global_meth_id prags - -- taking instance signature into account might change the type of -- the local_meth_id ; (meth_implic, ev_binds_var, tc_bind) <- checkInstConstraints $ tcMethodBodyHelp sig_fn sel_id local_meth_id (L bind_loc lm_bind) + ; global_meth_id <- addInlinePrags global_meth_id prags + ; spec_prags <- tcSpecPrags global_meth_id prags + ; let specs = mk_meth_spec_prags global_meth_id spec_inst_prags spec_prags export = ABE { abe_poly = global_meth_id , abe_mono = local_meth_id diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index cd221a2..88352e9 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -1686,7 +1686,7 @@ the range of the TvSubstEnv should *never* include a type headed with CoercionTy. Note [The substitution invariant] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When calling (substTy subst ty) it should be the case that the in-scope set in the substitution is a superset of both: From git at git.haskell.org Wed Sep 21 07:40:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 21 Sep 2016 07:40:56 +0000 (UTC) Subject: [commit: ghc] master: Fix failing test T12504 (8bd3d41) Message-ID: <20160921074056.84F2C3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8bd3d417e67e5e938dd5bfc640c3efbb683ee309/ghc >--------------------------------------------------------------- commit 8bd3d417e67e5e938dd5bfc640c3efbb683ee309 Author: Tamar Christina Date: Wed Sep 21 01:51:47 2016 +0100 Fix failing test T12504 Summary: Test T12504 does it's checking in the Makefile using grep but still specified an stdout. the stdout has the old output and would always fail. Since the stdout isn't needed, let's not check it. Test Plan: make test TEST=T12504 Reviewers: bgamari, austin, erikd, rcook Reviewed By: rcook Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2537 GHC Trac Issues: #12504 >--------------------------------------------------------------- 8bd3d417e67e5e938dd5bfc640c3efbb683ee309 testsuite/tests/hsc2hs/T12504.stdout | 2 -- testsuite/tests/hsc2hs/all.T | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/hsc2hs/T12504.stdout b/testsuite/tests/hsc2hs/T12504.stdout deleted file mode 100644 index c1c05d0..0000000 --- a/testsuite/tests/hsc2hs/T12504.stdout +++ /dev/null @@ -1,2 +0,0 @@ -{-# LINE 1 "T12504/path/to/T12504.hsc" #-} -{-# LINE 2 "T12504/path/to/T12504.hsc" #-} diff --git a/testsuite/tests/hsc2hs/all.T b/testsuite/tests/hsc2hs/all.T index 3f910db..23628b2 100644 --- a/testsuite/tests/hsc2hs/all.T +++ b/testsuite/tests/hsc2hs/all.T @@ -38,6 +38,7 @@ test('T10272', test('T12504', [extra_clean(['T12504/path/to/T12504.hs']), - extra_files(['T12504'])], + extra_files(['T12504']), + ignore_stdout], run_command, ['$MAKE -s --no-print-directory T12504']) From git at git.haskell.org Wed Sep 21 14:54:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 21 Sep 2016 14:54:12 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch: Test Trac #12507 (eb51b56) Message-ID: <20160921145412.5121A3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch Link : http://ghc.haskell.org/trac/ghc/changeset/eb51b56e56df684ea3f0b8d8ddb55f9fa4ece329/ghc >--------------------------------------------------------------- commit eb51b56e56df684ea3f0b8d8ddb55f9fa4ece329 Author: Simon Peyton Jones Date: Wed Sep 21 15:51:52 2016 +0100 Test Trac #12507 This is now working apparently. It relates to when a polymorphic function gets instantiated, under some implicit paramter bindings. >--------------------------------------------------------------- eb51b56e56df684ea3f0b8d8ddb55f9fa4ece329 testsuite/tests/typecheck/should_compile/T12507.hs | 16 ++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_compile/T12507.hs b/testsuite/tests/typecheck/should_compile/T12507.hs new file mode 100644 index 0000000..b4cfd0e --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12507.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE GADTs, ConstraintKinds, Rank2Types, ImplicitParams #-} + +module T12507 where + +data Rec fields where + Rec :: fields => Rec fields + +qn :: Rec fields -> (fields => r) -> r +qn Rec e = e + +record :: Rec (?a :: Int, ?b :: String) +record = Rec where ?a=42 + ?b="hey" + +access :: Int +access = qn record ?a diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 9f32b44..72c8ce9 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -535,4 +535,4 @@ test('T12381', normal, compile, ['']) test('T12082', normal, compile, ['']) test('T12427a', normal, compile_fail, ['']) test('T12427b', normal, compile, ['']) - +test('T12507', normal, compile, ['']) From git at git.haskell.org Fri Sep 23 04:40:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 23 Sep 2016 04:40:03 +0000 (UTC) Subject: [commit: ghc] master: shutdownHaskellAndExit: just do a normal hs_exit() (#5402) (9cbcdb4) Message-ID: <20160923044003.DEAB03A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9cbcdb4863064753df0fff9054b7b7c6b3188b64/ghc >--------------------------------------------------------------- commit 9cbcdb4863064753df0fff9054b7b7c6b3188b64 Author: Simon Marlow Date: Thu Sep 15 15:53:00 2016 +0100 shutdownHaskellAndExit: just do a normal hs_exit() (#5402) If we want to keep the RTS alive a bit longer by having another hs_init()/hs_exit() pair in a library that will destruct itself after main() has exited, then the forced shutdown here thwarts that. I think we just "fixed" #5402 in the wrong way before, this should be better. >--------------------------------------------------------------- 9cbcdb4863064753df0fff9054b7b7c6b3188b64 rts/RtsStartup.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 123fb9b..33ffb83 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -466,10 +466,6 @@ void shutdownHaskellAndExit(int n, int fastExit) { if (!fastExit) { - // even if hs_init_count > 1, we still want to shut down the RTS - // and exit immediately (see #5402) - hs_init_count = 1; - // we're about to exit(), no need to wait for foreign calls to return. hs_exit_(rtsFalse); } From git at git.haskell.org Fri Sep 23 04:40:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 23 Sep 2016 04:40:06 +0000 (UTC) Subject: [commit: ghc] master: Expose hs_exit_(rtsFalse) as hs_exit_nowait() (74c4ca0) Message-ID: <20160923044006.9079B3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/74c4ca02df1f7099420eedf32ab4fabc0fd8cb8c/ghc >--------------------------------------------------------------- commit 74c4ca02df1f7099420eedf32ab4fabc0fd8cb8c Author: Simon Marlow Date: Fri Sep 16 11:04:44 2016 +0100 Expose hs_exit_(rtsFalse) as hs_exit_nowait() Summary: And document it. See the docmentation for the reason I want this. Test Plan: It's an existing API, just exposing it. Reviewers: bgamari, niteria, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2531 >--------------------------------------------------------------- 74c4ca02df1f7099420eedf32ab4fabc0fd8cb8c docs/users_guide/ffi-chap.rst | 16 +++++++++++++--- includes/HsFFI.h | 1 + rts/RtsStartup.c | 8 ++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/ffi-chap.rst b/docs/users_guide/ffi-chap.rst index f46d902..70b55d0 100644 --- a/docs/users_guide/ffi-chap.rst +++ b/docs/users_guide/ffi-chap.rst @@ -612,9 +612,19 @@ The GHC runtime treats program exit as a special case, to avoid the need to wait for blocked threads when a standalone executable exits. Since the program and all its threads are about to terminate at the same time that the code is removed from memory, it isn't necessary to ensure that -the threads have exited first. (Unofficially, if you want to use this -fast and loose version of ``hs_exit()``, then call -``shutdownHaskellAndExit()`` instead). +the threads have exited first. If you want this fast and loose +version of ``hs_exit()``, you can call: + +.. code-block:: c + + void hs_exit_nowait(void); + +instead. This is particularly useful if you have foreign libraries +that need to call ``hs_exit()`` at program exit (perhaps via a C++ +destructor): in this case you should use ``hs_exit_nowait()``, because +the thread that called ``exit()`` and is running C++ destructors is in +a foreign call from Haskell that will never return, so ``hs_exit()`` +would deadlock. .. _hs_try_putmvar: diff --git a/includes/HsFFI.h b/includes/HsFFI.h index cdf4510..8e9ff40 100644 --- a/includes/HsFFI.h +++ b/includes/HsFFI.h @@ -96,6 +96,7 @@ typedef void* HsStablePtr; extern void hs_init (int *argc, char **argv[]); extern void hs_exit (void); +extern void hs_exit_nowait(void); extern void hs_set_argv (int argc, char *argv[]); extern void hs_add_root (void (*init_root)(void)); extern void hs_thread_done (void); diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 33ffb83..a2630b2 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -455,6 +455,14 @@ hs_exit(void) // be safe; this might be a DLL } +void +hs_exit_nowait(void) +{ + hs_exit_(rtsFalse); + // do not wait for outstanding foreign calls to return; if they return in + // the future, they will block indefinitely. +} + // Compatibility interfaces void shutdownHaskell(void) From git at git.haskell.org Fri Sep 23 04:40:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 23 Sep 2016 04:40:09 +0000 (UTC) Subject: [commit: ghc] master: Improved documentation for Foreign.Concurrent (#12547) (3a17916) Message-ID: <20160923044009.49DC93A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3a17916bb5fd4bda9d21359a82f5b5f38cc0fdad/ghc >--------------------------------------------------------------- commit 3a17916bb5fd4bda9d21359a82f5b5f38cc0fdad Author: Simon Marlow Date: Fri Sep 16 14:48:57 2016 +0100 Improved documentation for Foreign.Concurrent (#12547) We had better docs for the underlying functions in GHC.ForeignPtr, but this wasn't propagated to the re-exported versions in Foreign.Concurrent. >--------------------------------------------------------------- 3a17916bb5fd4bda9d21359a82f5b5f38cc0fdad libraries/base/Foreign/Concurrent.hs | 37 ++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/libraries/base/Foreign/Concurrent.hs b/libraries/base/Foreign/Concurrent.hs index 9d27166..a19b20b 100644 --- a/libraries/base/Foreign/Concurrent.hs +++ b/libraries/base/Foreign/Concurrent.hs @@ -35,17 +35,38 @@ import GHC.ForeignPtr ( ForeignPtr ) import qualified GHC.ForeignPtr newForeignPtr :: Ptr a -> IO () -> IO (ForeignPtr a) --- ^Turns a plain memory reference into a foreign object by associating --- a finalizer - given by the monadic operation - with the reference. --- The finalizer will be executed after the last reference to the --- foreign object is dropped. There is no guarantee of promptness, and +-- +-- ^Turns a plain memory reference into a foreign object by +-- associating a finalizer - given by the monadic operation - with the +-- reference. The storage manager will start the finalizer, in a +-- separate thread, some time after the last reference to the +-- @ForeignPtr@ is dropped. There is no guarantee of promptness, and -- in fact there is no guarantee that the finalizer will eventually -- run at all. +-- +-- Note that references from a finalizer do not necessarily prevent +-- another object from being finalized. If A's finalizer refers to B +-- (perhaps using 'touchForeignPtr', then the only guarantee is that +-- B's finalizer will never be started before A's. If both A and B +-- are unreachable, then both finalizers will start together. See +-- 'touchForeignPtr' for more on finalizer ordering. +-- newForeignPtr = GHC.ForeignPtr.newConcForeignPtr addForeignPtrFinalizer :: ForeignPtr a -> IO () -> IO () --- ^This function adds a finalizer to the given 'ForeignPtr'. --- The finalizer will run after the last reference to the foreign object --- is dropped, but /before/ all previously registered finalizers for the --- same object. +-- ^This function adds a finalizer to the given @ForeignPtr at . The +-- finalizer will run /before/ all other finalizers for the same +-- object which have already been registered. +-- +-- This is a variant of @Foreign.ForeignPtr.addForeignPtrFinalizer@, +-- where the finalizer is an arbitrary @IO@ action. When it is +-- invoked, the finalizer will run in a new thread. +-- +-- NB. Be very careful with these finalizers. One common trap is that +-- if a finalizer references another finalized value, it does not +-- prevent that value from being finalized. In particular, 'Handle's +-- are finalized objects, so a finalizer should not refer to a 'Handle' +-- (including @stdout@, @stdin@ or @stderr@). +-- addForeignPtrFinalizer = GHC.ForeignPtr.addForeignPtrConcFinalizer + From git at git.haskell.org Fri Sep 23 14:34:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 23 Sep 2016 14:34:23 +0000 (UTC) Subject: [commit: ghc] master: Fix #12442. (9766b0c) Message-ID: <20160923143423.719803A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9766b0c81476c208b2b29ff66d97251209a79707/ghc >--------------------------------------------------------------- commit 9766b0c81476c208b2b29ff66d97251209a79707 Author: Richard Eisenberg Date: Wed Jul 27 16:41:50 2016 -0400 Fix #12442. The problem is described in the ticket. This patch adds new variants of the access points to the pure unifier that allow unification of types only when the caller wants this behavior. (The unifier used to also unify kinds.) This behavior is appropriate when the kinds are either already known to be the same, or the list of types provided are a list of well-typed arguments to some type constructor. In the latter case, unifying earlier types in the list will unify the kinds of any later (dependent) types. At use sites, I went through and chose the unification function according to the criteria above. This patch includes some modest performance improvements as we are now doing less work. >--------------------------------------------------------------- 9766b0c81476c208b2b29ff66d97251209a79707 compiler/ghci/RtClosureInspect.hs | 2 +- compiler/specialise/Rules.hs | 4 +- compiler/typecheck/FunDeps.hs | 8 +- compiler/typecheck/TcSimplify.hs | 6 +- compiler/types/Unify.hs | 109 +++++++++++++++++---- testsuite/tests/dependent/should_compile/T12442.hs | 57 +++++++++++ testsuite/tests/dependent/should_compile/all.T | 1 + testsuite/tests/perf/compiler/all.T | 9 +- 8 files changed, 166 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9766b0c81476c208b2b29ff66d97251209a79707 From git at git.haskell.org Fri Sep 23 22:33:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 23 Sep 2016 22:33:28 +0000 (UTC) Subject: [commit: ghc] master: Mark mapUnionFV as INLINABLE rather than INLINE (d122935) Message-ID: <20160923223328.945E73A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d122935340ddf97a5a8496070de1f9bb34328440/ghc >--------------------------------------------------------------- commit d122935340ddf97a5a8496070de1f9bb34328440 Author: Matthew Pickering Date: Fri Sep 23 23:25:43 2016 +0100 Mark mapUnionFV as INLINABLE rather than INLINE It is a self-recursive function so will always be the loop-breaker and hence never able to be inlined. It is dubious whether the INLINABLE pragma will ever help as it is not a very polymorphic function but some specialisation could occur. >--------------------------------------------------------------- d122935340ddf97a5a8496070de1f9bb34328440 compiler/utils/FV.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/utils/FV.hs b/compiler/utils/FV.hs index 8e01220..b5cf096 100644 --- a/compiler/utils/FV.hs +++ b/compiler/utils/FV.hs @@ -184,7 +184,7 @@ mapUnionFV :: (a -> FV) -> [a] -> FV mapUnionFV _f [] _fv_cand _in_scope acc = acc mapUnionFV f (a:as) fv_cand in_scope acc = mapUnionFV f as fv_cand in_scope $! f a fv_cand in_scope $! acc -{-# INLINE mapUnionFV #-} +{-# INLINABLE mapUnionFV #-} -- | Union many free variable computations. unionsFV :: [FV] -> FV From git at git.haskell.org Sat Sep 24 00:21:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 24 Sep 2016 00:21:26 +0000 (UTC) Subject: [commit: ghc] master: Replace INLINEABLE by INLINABLE (#12613) (68f72f1) Message-ID: <20160924002126.CF6CB3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/68f72f101d67b276aff567be03619a3fd9618017/ghc >--------------------------------------------------------------- commit 68f72f101d67b276aff567be03619a3fd9618017 Author: Joachim Breitner Date: Sat Sep 24 09:16:59 2016 +0900 Replace INLINEABLE by INLINABLE (#12613) as the latter is the official, correct spelling, and the former just a misspelling accepted by GHC. Also document in the user’s guide that the alternative spelling is accepted This commit was brough to you by HIW 2016. >--------------------------------------------------------------- 68f72f101d67b276aff567be03619a3fd9618017 compiler/coreSyn/CoreSyn.hs | 2 +- compiler/coreSyn/CoreUnfold.hs | 8 ++++---- compiler/simplCore/OccurAnal.hs | 10 +++++----- compiler/simplCore/Simplify.hs | 2 +- compiler/specialise/SpecConstr.hs | 2 +- compiler/specialise/Specialise.hs | 14 +++++++------- docs/users_guide/glasgow_exts.rst | 2 ++ docs/users_guide/using-warnings.rst | 4 ++-- libraries/base/Control/Monad.hs | 12 ++++++------ libraries/base/Data/Bits.hs | 2 +- libraries/base/GHC/Base.hs | 20 ++++++++++---------- libraries/base/GHC/List.hs | 4 ++-- libraries/base/GHC/Real.hs | 4 ++-- testsuite/tests/perf/compiler/all.T | 2 +- testsuite/tests/rename/should_fail/T7906.hs | 2 +- 15 files changed, 46 insertions(+), 44 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 68f72f101d67b276aff567be03619a3fd9618017 From git at git.haskell.org Sat Sep 24 01:20:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 24 Sep 2016 01:20:55 +0000 (UTC) Subject: [commit: ghc] master: Update test output (55d92cc) Message-ID: <20160924012055.275463A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/55d92cc06fb02fe4e4ef5acf310dc5e2f91ad64d/ghc >--------------------------------------------------------------- commit 55d92cc06fb02fe4e4ef5acf310dc5e2f91ad64d Author: Joachim Breitner Date: Sat Sep 24 10:20:18 2016 +0900 Update test output >--------------------------------------------------------------- 55d92cc06fb02fe4e4ef5acf310dc5e2f91ad64d testsuite/tests/rename/should_fail/T7906.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/rename/should_fail/T7906.stderr b/testsuite/tests/rename/should_fail/T7906.stderr index ab448ed..ddcd4ff 100644 --- a/testsuite/tests/rename/should_fail/T7906.stderr +++ b/testsuite/tests/rename/should_fail/T7906.stderr @@ -1,4 +1,4 @@ -T7906.hs:5:16: error: +T7906.hs:5:15: error: The INLINABLE pragma for ‘foo’ lacks an accompanying binding (The INLINABLE pragma must be given where ‘foo’ is declared) From git at git.haskell.org Sat Sep 24 15:29:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 24 Sep 2016 15:29:22 +0000 (UTC) Subject: [commit: ghc] master: Pattern Synonyms documentation update (bc7c730) Message-ID: <20160924152922.2962A3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bc7c730c613f5c35eea512955728d1e7a0d01aa9/ghc >--------------------------------------------------------------- commit bc7c730c613f5c35eea512955728d1e7a0d01aa9 Author: Matthew Pickering Date: Sat Sep 24 16:28:02 2016 +0100 Pattern Synonyms documentation update >--------------------------------------------------------------- bc7c730c613f5c35eea512955728d1e7a0d01aa9 docs/users_guide/glasgow_exts.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 025aad8..6af26b5 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -4199,7 +4199,7 @@ constructors. The syntax for doing this is as follows: :: - pattern Point :: (Int, Int) + pattern Point :: Int -> Int -> (Int, Int) pattern Point{x, y} = (x, y) The idea is that we can then use ``Point`` just as if we had defined a new @@ -4229,7 +4229,11 @@ For a unidirectional record pattern synonym we define record selectors but do not allow record updates or construction. The syntax and semantics of pattern synonyms are elaborated in the -following subsections. See the :ghc-wiki:`Wiki page ` for more +following subsections. +There are also lots more details in the `paper +`_. + +See the :ghc-wiki:`Wiki page ` for more details. Syntax and scoping of pattern synonyms From git at git.haskell.org Mon Sep 26 10:54:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 10:54:41 +0000 (UTC) Subject: [commit: ghc] master: Print foralls in user format (796f0f2) Message-ID: <20160926105441.37DA43A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/796f0f2ad7eefd1c9af5a7ef9bf56848067e85b1/ghc >--------------------------------------------------------------- commit 796f0f2ad7eefd1c9af5a7ef9bf56848067e85b1 Author: Simon Peyton Jones Date: Mon Sep 26 08:37:47 2016 +0100 Print foralls in user format This fixes Trac #12597: in RnNames.warnMissingSignatures, use pprSigmaType not pprType >--------------------------------------------------------------- 796f0f2ad7eefd1c9af5a7ef9bf56848067e85b1 compiler/rename/RnNames.hs | 2 +- compiler/types/TyCoRep.hs | 2 ++ testsuite/tests/driver/werror.stderr | 3 +-- testsuite/tests/indexed-types/should_compile/T8889.stderr | 4 +--- testsuite/tests/parser/should_compile/read014.stderr | 2 +- testsuite/tests/rename/should_compile/T12597.hs | 5 +++++ testsuite/tests/rename/should_compile/T12597.stderr | 3 +++ testsuite/tests/rename/should_compile/all.T | 1 + testsuite/tests/typecheck/should_compile/T10971a.stderr | 6 +++--- testsuite/tests/typecheck/should_compile/tc243.stderr | 2 +- testsuite/tests/warnings/should_compile/T11077.stderr | 2 +- 11 files changed, 20 insertions(+), 12 deletions(-) diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index f0c7bb9..6b4942f 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -1615,7 +1615,7 @@ warnMissingSignatures gbl_env = do { env <- tcInitTidyEnv -- Why not use emptyTidyEnv? ; let name = idName id (_, ty) = tidyOpenType env (idType id) - ty_msg = ppr ty + ty_msg = pprSigmaType ty ; add_warn name $ hang (text "Top-level binding with no type signature:") 2 (pprPrefixName name <+> dcolon <+> ty_msg) } diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index d662129..a355b85 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2689,6 +2689,8 @@ ppr_fun_tail (FunTy ty1 ty2) ppr_fun_tail other_ty = [ppr_type TopPrec other_ty] pprSigmaType :: Type -> SDoc +-- Prints a top-level type for the user; in particular +-- top-level foralls are omitted unless you use -fprint-explicit-foralls pprSigmaType ty = sdocWithDynFlags $ \dflags -> eliminateRuntimeRep (ppr_sigma_type dflags False) ty diff --git a/testsuite/tests/driver/werror.stderr b/testsuite/tests/driver/werror.stderr index 67c8112..9d8d724 100644 --- a/testsuite/tests/driver/werror.stderr +++ b/testsuite/tests/driver/werror.stderr @@ -17,8 +17,7 @@ werror.hs:10:1: warning: [-Wunused-top-binds (in -Wextra, -Wunused-binds)] Defined but not used: ‘f’ werror.hs:10:1: warning: [-Wmissing-signatures (in -Wall)] - Top-level binding with no type signature: - f :: forall a1 a2. [a2] -> [a1] + Top-level binding with no type signature: f :: [a2] -> [a1] werror.hs:10:1: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive diff --git a/testsuite/tests/indexed-types/should_compile/T8889.stderr b/testsuite/tests/indexed-types/should_compile/T8889.stderr index 81359b2..cef00df 100644 --- a/testsuite/tests/indexed-types/should_compile/T8889.stderr +++ b/testsuite/tests/indexed-types/should_compile/T8889.stderr @@ -1,6 +1,4 @@ T8889.hs:12:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: - f :: forall (f :: * -> *) b a. - (C f, C_fmap f a) => - (a -> b) -> f a -> f b + f :: (C f, C_fmap f a) => (a -> b) -> f a -> f b diff --git a/testsuite/tests/parser/should_compile/read014.stderr b/testsuite/tests/parser/should_compile/read014.stderr index d7c43e5..09e79ee 100644 --- a/testsuite/tests/parser/should_compile/read014.stderr +++ b/testsuite/tests/parser/should_compile/read014.stderr @@ -1,7 +1,7 @@ read014.hs:4:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: - ng1 :: forall a t. Num a => t -> a -> a + ng1 :: Num a => t -> a -> a read014.hs:4:5: warning: [-Wunused-matches (in -Wextra)] Defined but not used: ‘x’ diff --git a/testsuite/tests/rename/should_compile/T12597.hs b/testsuite/tests/rename/should_compile/T12597.hs new file mode 100644 index 0000000..12769e4 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T12597.hs @@ -0,0 +1,5 @@ +{-# OPTIONS_GHC -Wmissing-signatures #-} + +module T12597 where + +f x = x diff --git a/testsuite/tests/rename/should_compile/T12597.stderr b/testsuite/tests/rename/should_compile/T12597.stderr new file mode 100644 index 0000000..8364fd0 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T12597.stderr @@ -0,0 +1,3 @@ + +T12597.hs:5:1: warning: [-Wmissing-signatures (in -Wall)] + Top-level binding with no type signature: f :: t -> t diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T index b6318ae..106ba0a 100644 --- a/testsuite/tests/rename/should_compile/all.T +++ b/testsuite/tests/rename/should_compile/all.T @@ -243,3 +243,4 @@ test('T12127', multimod_compile, ['T12127', '-v0']) test('T12533', normal, compile, ['']) +test('T12597', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_compile/T10971a.stderr b/testsuite/tests/typecheck/should_compile/T10971a.stderr index bfcc3ff..96330fd 100644 --- a/testsuite/tests/typecheck/should_compile/T10971a.stderr +++ b/testsuite/tests/typecheck/should_compile/T10971a.stderr @@ -1,6 +1,6 @@ T10971a.hs:7:1: warning: [-Wmissing-signatures (in -Wall)] - Top-level binding with no type signature: f :: forall a. [a] -> Int + Top-level binding with no type signature: f :: [a] -> Int T10971a.hs:7:11: warning: [-Wtype-defaults (in -Wall)] • Defaulting the following constraint to type ‘[]’ @@ -11,7 +11,7 @@ T10971a.hs:7:11: warning: [-Wtype-defaults (in -Wall)] T10971a.hs:8:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: - g :: forall b a. (a -> b) -> [a] -> [b] + g :: (a -> b) -> [a] -> [b] T10971a.hs:8:6: warning: [-Wname-shadowing (in -Wall)] This binding for ‘f’ shadows the existing binding @@ -26,7 +26,7 @@ T10971a.hs:8:13: warning: [-Wtype-defaults (in -Wall)] T10971a.hs:9:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: - h :: forall b a. (a -> b) -> [a] -> ([b], Int) + h :: (a -> b) -> [a] -> ([b], Int) T10971a.hs:9:6: warning: [-Wname-shadowing (in -Wall)] This binding for ‘f’ shadows the existing binding diff --git a/testsuite/tests/typecheck/should_compile/tc243.stderr b/testsuite/tests/typecheck/should_compile/tc243.stderr index f96fede..5c5e9b2 100644 --- a/testsuite/tests/typecheck/should_compile/tc243.stderr +++ b/testsuite/tests/typecheck/should_compile/tc243.stderr @@ -1,3 +1,3 @@ tc243.hs:10:1: warning: [-Wmissing-signatures (in -Wall)] - Top-level binding with no type signature: (.+.) :: forall a. a + Top-level binding with no type signature: (.+.) :: a diff --git a/testsuite/tests/warnings/should_compile/T11077.stderr b/testsuite/tests/warnings/should_compile/T11077.stderr index fcaa385..ba7d4d8 100644 --- a/testsuite/tests/warnings/should_compile/T11077.stderr +++ b/testsuite/tests/warnings/should_compile/T11077.stderr @@ -1,3 +1,3 @@ T11077.hs:3:1: warning: [-Wmissing-exported-sigs] - Top-level binding with no type signature: foo :: forall a. a + Top-level binding with no type signature: foo :: a From git at git.haskell.org Mon Sep 26 17:38:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 17:38:00 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T12626' created Message-ID: <20160926173800.A12F43A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T12626 Referencing: ed151f6641372b4fbb59ba82031d0bfb95ae1dbe From git at git.haskell.org Mon Sep 26 17:38:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 17:38:03 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Move exprType to CoreSyn (21200ea) Message-ID: <20160926173803.7E1943A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/21200ea5d53bf950bf6014caa7ca62de7768e80c/ghc >--------------------------------------------------------------- commit 21200ea5d53bf950bf6014caa7ca62de7768e80c Author: Joachim Breitner Date: Mon Sep 26 09:48:26 2016 -0400 Move exprType to CoreSyn >--------------------------------------------------------------- 21200ea5d53bf950bf6014caa7ca62de7768e80c compiler/basicTypes/MkId.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 127 ++++++++++++++++++++++++- compiler/coreSyn/CoreUtils.hs | 110 --------------------- compiler/coreSyn/MkCore.hs | 2 +- compiler/deSugar/DsCCall.hs | 1 - compiler/deSugar/DsMeta.hs | 1 - compiler/deSugar/DsUtils.hs | 1 - compiler/main/GHC.hs | 2 +- compiler/simplCore/SetLevels.hs | 3 +- compiler/specialise/Rules.hs | 2 +- compiler/specialise/Specialise.hs | 2 +- compiler/stgSyn/CoreToStg.hs | 2 +- compiler/stranal/DmdAnal.hs | 2 +- compiler/stranal/WorkWrap.hs | 2 +- compiler/stranal/WwLib.hs | 2 +- compiler/vectorise/Vectorise/Generic/PADict.hs | 1 - compiler/vectorise/Vectorise/Type/Env.hs | 1 - compiler/vectorise/Vectorise/Utils.hs | 1 - compiler/vectorise/Vectorise/Utils/Base.hs | 1 - compiler/vectorise/Vectorise/Utils/Closure.hs | 1 - compiler/vectorise/Vectorise/Utils/Hoisting.hs | 1 - 21 files changed, 135 insertions(+), 132 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 21200ea5d53bf950bf6014caa7ca62de7768e80c From git at git.haskell.org Mon Sep 26 17:38:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 17:38:06 +0000 (UTC) Subject: [commit: ghc] wip/T12626: A quick stab at compressing type arguments (#12626) (5201690) Message-ID: <20160926173806.3E23A3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/5201690cae1a641dfda14abbf3d529270b20212c/ghc >--------------------------------------------------------------- commit 5201690cae1a641dfda14abbf3d529270b20212c Author: Joachim Breitner Date: Mon Sep 26 09:39:36 2016 -0400 A quick stab at compressing type arguments (#12626) Introducing the Apps constructor to Core, and the App pattern synonym. No compression performed yet. >--------------------------------------------------------------- 5201690cae1a641dfda14abbf3d529270b20212c compiler/coreSyn/CoreSyn.hs | 56 ++++++++++++++++++++++++++++++++----------- compiler/coreSyn/CoreUtils.hs | 22 ++++++++--------- compiler/coreSyn/PprCore.hs | 26 ++++++++++---------- compiler/ghc.cabal.in | 4 ++++ compiler/main/TidyPgm.hs | 4 ++-- mk/warnings.mk | 2 +- 6 files changed, 73 insertions(+), 41 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5201690cae1a641dfda14abbf3d529270b20212c From git at git.haskell.org Mon Sep 26 17:38:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 17:38:08 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Actually implement a simple compression scheme (#12626) (32b2c30) Message-ID: <20160926173808.DDAFE3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/32b2c30a17d2809152401200e41ed01a777dd29b/ghc >--------------------------------------------------------------- commit 32b2c30a17d2809152401200e41ed01a777dd29b Author: Joachim Breitner Date: Mon Sep 26 10:41:13 2016 -0400 Actually implement a simple compression scheme (#12626) Which only works for type variables where there is an argument of that type, but that is enough for, say, the tuple constructor. >--------------------------------------------------------------- 32b2c30a17d2809152401200e41ed01a777dd29b compiler/coreSyn/CoreSyn.hs | 64 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 6d82775..9adfb07 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -98,6 +98,7 @@ import CostCentre import VarEnv( InScopeSet ) import Var import Type +import TyCoRep ( TyBinder(..) ) import Coercion import Name import NameSet @@ -120,6 +121,7 @@ import Pair import Data.Data hiding (TyCon) import Data.Int import Data.Word +import Data.List ( findIndex ) infixl 4 `mkApps`, `mkTyApps`, `mkVarApps`, `App`, `mkCoApps` -- Left associative, so that we can say (f `mkTyApps` xs `mkVarApps` ys) @@ -276,6 +278,7 @@ data Expr b | Coercion Coercion deriving Data + class CompressArgs b where unpackArgs :: Expr b -> Arity -> [Expr b] -> [Expr b] unpackArgs _ _ l = l @@ -289,7 +292,7 @@ popArg (Apps e a xs) = case unpackArgs e a xs of xs -> Just (Apps e (a-1) (packArgs e (init xs)), last xs) popArg _ = Nothing -pattern App :: Expr b -> Arg b -> Expr b +pattern App :: () => CompressArgs b => Expr b -> Arg b -> Expr b pattern App e1 e2 <- (popArg -> Just (e1, e2)) where App e1 e2 | (f, args) <- collectArgs e1 = Apps f (length args +1) (packArgs f (args ++ [e2])) @@ -1438,9 +1441,60 @@ type CoreBind = Bind CoreBndr -- | Case alternatives where binders are 'CoreBndr's type CoreAlt = Alt CoreBndr + +-- Simple compression scheme, as a proof of concept: Only look for type +-- arguments that thare the type of one argument. +defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Expr b] -> [Expr b] +defaultPackArgs typeOf f args + = go pis args + where + (all_pis,_) = splitPiTys (typeOf f) + -- Match the arity of the arguments with the arity of the type + n = min (length all_pis) (length args) + pis = take n all_pis + + -- Remove redundant type type arguments + go (Named tyBndr : pis) (_ : args) + | any (isTyVar (binderVar tyBndr)) pis + = go pis args + go (_ : pis) (a : args) + = a : go pis args + -- More args than our type can handle, keep them + go [] args + = args + go _ [] = panic "defaultPackArgs: not enough args" + + isTyVar :: TyVar -> TyBinder -> Bool + isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True + isTyVar _ _ = False + +defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Expr b] -> [Expr b] +defaultUnpackArgs typeOf f arity args + = go pis args + where + (all_pis,_) = splitPiTys (typeOf f) + -- Match the arity of the arguments with the arity of the type + n = min (length all_pis) arity + pis = take n all_pis + + go (Named tyBndr : pis) args + | Just i <- findIndex (isTyVar (binderVar tyBndr)) pis + -- This is a type argument we have to recover + = let args' = go pis args + in Type (typeOf (args' !! i)) : args' + go (_ : pis) (a : args) + = a : go pis args + go [] args + = args + go _ [] = panic "defaultPackArgs: not enough args" + + isTyVar :: TyVar -> TyBinder -> Bool + isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True + isTyVar _ _ = False + instance CompressArgs Var where - unpackArgs _ _ l = l - packArgs _ l = l + unpackArgs = defaultUnpackArgs exprType + packArgs = defaultPackArgs exprType {- ************************************************************************ @@ -1467,8 +1521,8 @@ instance Outputable b => OutputableBndr (TaggedBndr b) where pprPrefixOcc b = ppr b instance CompressArgs (TaggedBndr t) where - unpackArgs _ _ l = l - packArgs _ l = l + unpackArgs = defaultUnpackArgs (exprType . deTagExpr) + packArgs = defaultPackArgs (exprType . deTagExpr) deTagExpr :: TaggedExpr t -> CoreExpr deTagExpr (Var v) = Var v From git at git.haskell.org Mon Sep 26 17:38:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 17:38:11 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Optimize mkApps and collectArgs (ed151f6) Message-ID: <20160926173811.8D9243A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/ed151f6641372b4fbb59ba82031d0bfb95ae1dbe/ghc >--------------------------------------------------------------- commit ed151f6641372b4fbb59ba82031d0bfb95ae1dbe Author: Joachim Breitner Date: Mon Sep 26 10:54:22 2016 -0400 Optimize mkApps and collectArgs so that these do pack/unpack only once, and not repeatedly, and maintain the invariant that Apps constructors do not nest (this invariant can be revisited; it is not crucial here.) >--------------------------------------------------------------- ed151f6641372b4fbb59ba82031d0bfb95ae1dbe compiler/coreSyn/CoreSyn.hs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 9adfb07..7dcad45 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -280,22 +280,21 @@ data Expr b class CompressArgs b where - unpackArgs :: Expr b -> Arity -> [Expr b] -> [Expr b] + unpackArgs :: Expr b -> Arity -> [Arg b] -> [Arg b] unpackArgs _ _ l = l - packArgs :: Expr b -> [Expr b] -> [Expr b] + packArgs :: Expr b -> [Arg b] -> [Arg b] packArgs _ l = l -popArg :: CompressArgs b => Expr b -> Maybe (Expr b, Expr b) -popArg (Apps e a xs) = case unpackArgs e a xs of - [x] -> Just (e, x) - xs -> Just (Apps e (a-1) (packArgs e (init xs)), last xs) -popArg _ = Nothing +popArg :: CompressArgs b => Expr b -> Maybe (Expr b, Arg b) +popArg e = case collectArgs e of + (_, []) -> Nothing + (f, xs) -> Just (mkApps f (init xs), last xs) pattern App :: () => CompressArgs b => Expr b -> Arg b -> Expr b pattern App e1 e2 <- (popArg -> Just (e1, e2)) where App e1 e2 | (f, args) <- collectArgs e1 - = Apps f (length args +1) (packArgs f (args ++ [e2])) + = mkApps f (args ++ [e2]) -- | Type synonym for expressions that occur in function argument positions. -- Only 'Arg' should contain a 'Type' at top level, general 'Expr' should not @@ -1444,7 +1443,7 @@ type CoreAlt = Alt CoreBndr -- Simple compression scheme, as a proof of concept: Only look for type -- arguments that thare the type of one argument. -defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Expr b] -> [Expr b] +defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Arg b] -> [Arg b] defaultPackArgs typeOf f args = go pis args where @@ -1468,7 +1467,7 @@ defaultPackArgs typeOf f args isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True isTyVar _ _ = False -defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Expr b] -> [Expr b] +defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Arg b] -> [Arg b] defaultUnpackArgs typeOf f arity args = go pis args where @@ -1564,12 +1563,16 @@ mkVarApps :: CompressArgs b => Expr b -> [Var] -> Expr b -- use 'MkCore.mkCoreConApps' if possible mkConApp :: CompressArgs b => DataCon -> [Arg b] -> Expr b -mkApps f args = foldl App f args -mkCoApps f args = foldl (\ e a -> App e (Coercion a)) f args -mkVarApps f vars = foldl (\ e a -> App e (varToCoreExpr a)) f vars +mkApps e [] = e +mkApps e args2 = Apps f (length args) (packArgs f args) + where + (f, args1) = collectArgs e + args = args1 ++ args2 +mkCoApps f args = mkApps f (map Coercion args) +mkVarApps f vars = mkApps f (map varToCoreExpr vars) mkConApp con args = mkApps (Var (dataConWorkId con)) args -mkTyApps f args = foldl (\ e a -> App e (typeOrCoercion a)) f args +mkTyApps f args = mkApps f (map typeOrCoercion args) where typeOrCoercion ty | Just co <- isCoercionTy_maybe ty = Coercion co @@ -1763,11 +1766,8 @@ collectTyAndValBinders expr -- | Takes a nested application expression and returns the the function -- being applied and the arguments to which it is applied collectArgs :: CompressArgs b => Expr b -> (Expr b, [Arg b]) -collectArgs expr - = go expr [] - where - go (App f a) as = go f (a:as) - go e as = (e, as) +collectArgs (Apps e a xs) = (e, unpackArgs e a xs) +collectArgs e = (e, []) -- | Like @collectArgs@, but also collects looks through floatable -- ticks if it means that we can find more arguments. From git at git.haskell.org Mon Sep 26 17:51:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 17:51:33 +0000 (UTC) Subject: [commit: ghc] master: Remove #ifdef with never fulfilled condition (b0ae0dd) Message-ID: <20160926175133.EB5F13A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b0ae0ddf4e5807e4d66e5da0f7acf68edd76e289/ghc >--------------------------------------------------------------- commit b0ae0ddf4e5807e4d66e5da0f7acf68edd76e289 Author: Joachim Breitner Date: Mon Sep 26 13:49:42 2016 -0400 Remove #ifdef with never fulfilled condition __GLASGOW_HASKELL is a typo (should be __GLASGOW_HASKELL__), obviously, but nobody noticed. >--------------------------------------------------------------- b0ae0ddf4e5807e4d66e5da0f7acf68edd76e289 compiler/hsSyn/HsTypes.hs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/compiler/hsSyn/HsTypes.hs b/compiler/hsSyn/HsTypes.hs index 008baef..6d82f92 100644 --- a/compiler/hsSyn/HsTypes.hs +++ b/compiler/hsSyn/HsTypes.hs @@ -91,10 +91,6 @@ import Maybes( isJust ) import Data.Data hiding ( Fixity ) import Data.Maybe ( fromMaybe ) import Control.Monad ( unless ) -#if __GLASGOW_HASKELL > 710 -import Data.Semigroup ( Semigroup ) -import qualified Data.Semigroup as Semigroup -#endif {- ************************************************************************ From git at git.haskell.org Mon Sep 26 18:16:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:16:49 +0000 (UTC) Subject: [commit: ghc] wip/T12626: A quick stab at compressing type arguments (#12626) (384c3ed) Message-ID: <20160926181649.9684B3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/384c3edf57a025e61864906f735089c1ef410f30/ghc >--------------------------------------------------------------- commit 384c3edf57a025e61864906f735089c1ef410f30 Author: Joachim Breitner Date: Mon Sep 26 09:39:36 2016 -0400 A quick stab at compressing type arguments (#12626) Introducing the Apps constructor to Core, and the App pattern synonym. No compression performed yet. >--------------------------------------------------------------- 384c3edf57a025e61864906f735089c1ef410f30 compiler/coreSyn/CoreSyn.hs | 56 ++++++++++++++++++++++++++++++++----------- compiler/coreSyn/CoreUtils.hs | 22 ++++++++--------- compiler/coreSyn/PprCore.hs | 26 ++++++++++---------- compiler/ghc.cabal.in | 4 ++++ compiler/main/TidyPgm.hs | 4 ++-- mk/warnings.mk | 2 +- 6 files changed, 73 insertions(+), 41 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 384c3edf57a025e61864906f735089c1ef410f30 From git at git.haskell.org Mon Sep 26 18:16:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:16:52 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Move exprType to CoreSyn (808015e) Message-ID: <20160926181652.634113A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/808015ec38b62cf0566fb35bd9917d4f3e81bc1a/ghc >--------------------------------------------------------------- commit 808015ec38b62cf0566fb35bd9917d4f3e81bc1a Author: Joachim Breitner Date: Mon Sep 26 09:48:26 2016 -0400 Move exprType to CoreSyn >--------------------------------------------------------------- 808015ec38b62cf0566fb35bd9917d4f3e81bc1a compiler/basicTypes/MkId.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 127 ++++++++++++++++++++++++- compiler/coreSyn/CoreUtils.hs | 112 ---------------------- compiler/coreSyn/MkCore.hs | 2 +- compiler/deSugar/DsCCall.hs | 1 - compiler/deSugar/DsMeta.hs | 1 - compiler/deSugar/DsUtils.hs | 1 - compiler/main/GHC.hs | 2 +- compiler/simplCore/SAT.hs | 1 - compiler/simplCore/SetLevels.hs | 3 +- compiler/specialise/Rules.hs | 2 +- compiler/specialise/Specialise.hs | 2 +- compiler/stgSyn/CoreToStg.hs | 2 +- compiler/stranal/DmdAnal.hs | 2 +- compiler/stranal/WorkWrap.hs | 2 +- compiler/stranal/WwLib.hs | 2 +- compiler/vectorise/Vectorise/Generic/PADict.hs | 1 - compiler/vectorise/Vectorise/Type/Env.hs | 1 - compiler/vectorise/Vectorise/Utils.hs | 1 - compiler/vectorise/Vectorise/Utils/Base.hs | 1 - compiler/vectorise/Vectorise/Utils/Closure.hs | 1 - compiler/vectorise/Vectorise/Utils/Hoisting.hs | 1 - 22 files changed, 135 insertions(+), 135 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 808015ec38b62cf0566fb35bd9917d4f3e81bc1a From git at git.haskell.org Mon Sep 26 18:16:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:16:55 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Actually implement a simple compression scheme (#12626) (bcce91b) Message-ID: <20160926181655.228123A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/bcce91b104cf1aa58fbbc8aaf612044a994f4d14/ghc >--------------------------------------------------------------- commit bcce91b104cf1aa58fbbc8aaf612044a994f4d14 Author: Joachim Breitner Date: Mon Sep 26 10:41:13 2016 -0400 Actually implement a simple compression scheme (#12626) Which only works for type variables where there is an argument of that type, but that is enough for, say, the tuple constructor. >--------------------------------------------------------------- bcce91b104cf1aa58fbbc8aaf612044a994f4d14 compiler/coreSyn/CoreSyn.hs | 66 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 6d82775..3da804f 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -98,6 +98,7 @@ import CostCentre import VarEnv( InScopeSet ) import Var import Type +import TyCoRep ( TyBinder(..) ) import Coercion import Name import NameSet @@ -120,6 +121,7 @@ import Pair import Data.Data hiding (TyCon) import Data.Int import Data.Word +import Data.List ( findIndex ) infixl 4 `mkApps`, `mkTyApps`, `mkVarApps`, `App`, `mkCoApps` -- Left associative, so that we can say (f `mkTyApps` xs `mkVarApps` ys) @@ -276,6 +278,7 @@ data Expr b | Coercion Coercion deriving Data + class CompressArgs b where unpackArgs :: Expr b -> Arity -> [Expr b] -> [Expr b] unpackArgs _ _ l = l @@ -289,7 +292,9 @@ popArg (Apps e a xs) = case unpackArgs e a xs of xs -> Just (Apps e (a-1) (packArgs e (init xs)), last xs) popArg _ = Nothing -pattern App :: Expr b -> Arg b -> Expr b +#if __GLASGOW_HASKELL__ > 710 +pattern App :: CompressArgs b => Expr b -> Arg b -> Expr b +#endif pattern App e1 e2 <- (popArg -> Just (e1, e2)) where App e1 e2 | (f, args) <- collectArgs e1 = Apps f (length args +1) (packArgs f (args ++ [e2])) @@ -1438,9 +1443,60 @@ type CoreBind = Bind CoreBndr -- | Case alternatives where binders are 'CoreBndr's type CoreAlt = Alt CoreBndr + +-- Simple compression scheme, as a proof of concept: Only look for type +-- arguments that thare the type of one argument. +defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Expr b] -> [Expr b] +defaultPackArgs typeOf f args + = go pis args + where + (all_pis,_) = splitPiTys (typeOf f) + -- Match the arity of the arguments with the arity of the type + n = min (length all_pis) (length args) + pis = take n all_pis + + -- Remove redundant type type arguments + go (Named tyBndr : pis) (_ : args) + | any (isTyVar (binderVar tyBndr)) pis + = go pis args + go (_ : pis) (a : args) + = a : go pis args + -- More args than our type can handle, keep them + go [] args + = args + go _ [] = panic "defaultPackArgs: not enough args" + + isTyVar :: TyVar -> TyBinder -> Bool + isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True + isTyVar _ _ = False + +defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Expr b] -> [Expr b] +defaultUnpackArgs typeOf f arity args + = go pis args + where + (all_pis,_) = splitPiTys (typeOf f) + -- Match the arity of the arguments with the arity of the type + n = min (length all_pis) arity + pis = take n all_pis + + go (Named tyBndr : pis) args + | Just i <- findIndex (isTyVar (binderVar tyBndr)) pis + -- This is a type argument we have to recover + = let args' = go pis args + in Type (typeOf (args' !! i)) : args' + go (_ : pis) (a : args) + = a : go pis args + go [] args + = args + go _ [] = panic "defaultPackArgs: not enough args" + + isTyVar :: TyVar -> TyBinder -> Bool + isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True + isTyVar _ _ = False + instance CompressArgs Var where - unpackArgs _ _ l = l - packArgs _ l = l + unpackArgs = defaultUnpackArgs exprType + packArgs = defaultPackArgs exprType {- ************************************************************************ @@ -1467,8 +1523,8 @@ instance Outputable b => OutputableBndr (TaggedBndr b) where pprPrefixOcc b = ppr b instance CompressArgs (TaggedBndr t) where - unpackArgs _ _ l = l - packArgs _ l = l + unpackArgs = defaultUnpackArgs (exprType . deTagExpr) + packArgs = defaultPackArgs (exprType . deTagExpr) deTagExpr :: TaggedExpr t -> CoreExpr deTagExpr (Var v) = Var v From git at git.haskell.org Mon Sep 26 18:16:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:16:57 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Optimize mkApps and collectArgs (dcef1da) Message-ID: <20160926181657.DB1FE3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/dcef1da14a8d46f64a451a8a78a0c29b6ba78641/ghc >--------------------------------------------------------------- commit dcef1da14a8d46f64a451a8a78a0c29b6ba78641 Author: Joachim Breitner Date: Mon Sep 26 10:54:22 2016 -0400 Optimize mkApps and collectArgs so that these do pack/unpack only once, and not repeatedly, and maintain the invariant that Apps constructors do not nest (this invariant can be revisited; it is not crucial here.) >--------------------------------------------------------------- dcef1da14a8d46f64a451a8a78a0c29b6ba78641 compiler/coreSyn/CoreSyn.hs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 3da804f..cb5a75a 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -280,24 +280,23 @@ data Expr b class CompressArgs b where - unpackArgs :: Expr b -> Arity -> [Expr b] -> [Expr b] + unpackArgs :: Expr b -> Arity -> [Arg b] -> [Arg b] unpackArgs _ _ l = l - packArgs :: Expr b -> [Expr b] -> [Expr b] + packArgs :: Expr b -> [Arg b] -> [Arg b] packArgs _ l = l -popArg :: CompressArgs b => Expr b -> Maybe (Expr b, Expr b) -popArg (Apps e a xs) = case unpackArgs e a xs of - [x] -> Just (e, x) - xs -> Just (Apps e (a-1) (packArgs e (init xs)), last xs) -popArg _ = Nothing +popArg :: CompressArgs b => Expr b -> Maybe (Expr b, Arg b) +popArg e = case collectArgs e of + (_, []) -> Nothing + (f, xs) -> Just (mkApps f (init xs), last xs) #if __GLASGOW_HASKELL__ > 710 pattern App :: CompressArgs b => Expr b -> Arg b -> Expr b #endif pattern App e1 e2 <- (popArg -> Just (e1, e2)) where App e1 e2 | (f, args) <- collectArgs e1 - = Apps f (length args +1) (packArgs f (args ++ [e2])) + = mkApps f (args ++ [e2]) -- | Type synonym for expressions that occur in function argument positions. -- Only 'Arg' should contain a 'Type' at top level, general 'Expr' should not @@ -1446,7 +1445,7 @@ type CoreAlt = Alt CoreBndr -- Simple compression scheme, as a proof of concept: Only look for type -- arguments that thare the type of one argument. -defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Expr b] -> [Expr b] +defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Arg b] -> [Arg b] defaultPackArgs typeOf f args = go pis args where @@ -1470,7 +1469,7 @@ defaultPackArgs typeOf f args isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True isTyVar _ _ = False -defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Expr b] -> [Expr b] +defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Arg b] -> [Arg b] defaultUnpackArgs typeOf f arity args = go pis args where @@ -1566,12 +1565,16 @@ mkVarApps :: CompressArgs b => Expr b -> [Var] -> Expr b -- use 'MkCore.mkCoreConApps' if possible mkConApp :: CompressArgs b => DataCon -> [Arg b] -> Expr b -mkApps f args = foldl App f args -mkCoApps f args = foldl (\ e a -> App e (Coercion a)) f args -mkVarApps f vars = foldl (\ e a -> App e (varToCoreExpr a)) f vars +mkApps e [] = e +mkApps e args2 = Apps f (length args) (packArgs f args) + where + (f, args1) = collectArgs e + args = args1 ++ args2 +mkCoApps f args = mkApps f (map Coercion args) +mkVarApps f vars = mkApps f (map varToCoreExpr vars) mkConApp con args = mkApps (Var (dataConWorkId con)) args -mkTyApps f args = foldl (\ e a -> App e (typeOrCoercion a)) f args +mkTyApps f args = mkApps f (map typeOrCoercion args) where typeOrCoercion ty | Just co <- isCoercionTy_maybe ty = Coercion co @@ -1765,11 +1768,8 @@ collectTyAndValBinders expr -- | Takes a nested application expression and returns the the function -- being applied and the arguments to which it is applied collectArgs :: CompressArgs b => Expr b -> (Expr b, [Arg b]) -collectArgs expr - = go expr [] - where - go (App f a) as = go f (a:as) - go e as = (e, as) +collectArgs (Apps e a xs) = (e, unpackArgs e a xs) +collectArgs e = (e, []) -- | Like @collectArgs@, but also collects looks through floatable -- ticks if it means that we can find more arguments. From git at git.haskell.org Mon Sep 26 18:16:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:16:59 +0000 (UTC) Subject: [commit: ghc] wip/T12626's head updated: Optimize mkApps and collectArgs (dcef1da) Message-ID: <20160926181659.EEB003A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T12626' now includes: bc7c730 Pattern Synonyms documentation update 796f0f2 Print foralls in user format b0ae0dd Remove #ifdef with never fulfilled condition 384c3ed A quick stab at compressing type arguments (#12626) 808015e Move exprType to CoreSyn bcce91b Actually implement a simple compression scheme (#12626) dcef1da Optimize mkApps and collectArgs From git at git.haskell.org Mon Sep 26 18:24:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:24:32 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Move exprType to CoreSyn (b211409) Message-ID: <20160926182432.D68193A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/b21140947d409516ec7fbbefa52b67ce77f18030/ghc >--------------------------------------------------------------- commit b21140947d409516ec7fbbefa52b67ce77f18030 Author: Joachim Breitner Date: Mon Sep 26 09:48:26 2016 -0400 Move exprType to CoreSyn >--------------------------------------------------------------- b21140947d409516ec7fbbefa52b67ce77f18030 compiler/basicTypes/MkId.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 127 ++++++++++++++++++++++++- compiler/coreSyn/CoreUtils.hs | 113 +--------------------- compiler/coreSyn/MkCore.hs | 2 +- compiler/deSugar/DsCCall.hs | 1 - compiler/deSugar/DsMeta.hs | 1 - compiler/deSugar/DsUtils.hs | 1 - compiler/main/GHC.hs | 2 +- compiler/simplCore/SAT.hs | 1 - compiler/simplCore/SetLevels.hs | 3 +- compiler/specialise/Rules.hs | 2 +- compiler/specialise/Specialise.hs | 2 +- compiler/stgSyn/CoreToStg.hs | 2 +- compiler/stranal/DmdAnal.hs | 2 +- compiler/stranal/WorkWrap.hs | 2 +- compiler/stranal/WwLib.hs | 2 +- compiler/vectorise/Vectorise/Generic/PADict.hs | 1 - compiler/vectorise/Vectorise/Type/Env.hs | 1 - compiler/vectorise/Vectorise/Utils.hs | 1 - compiler/vectorise/Vectorise/Utils/Base.hs | 1 - compiler/vectorise/Vectorise/Utils/Closure.hs | 1 - compiler/vectorise/Vectorise/Utils/Hoisting.hs | 1 - 22 files changed, 136 insertions(+), 135 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b21140947d409516ec7fbbefa52b67ce77f18030 From git at git.haskell.org Mon Sep 26 18:24:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:24:35 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Actually implement a simple compression scheme (#12626) (d7e7ade) Message-ID: <20160926182435.88EA03A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/d7e7ade7aa876ecb1758eb8b7913bef0d9553d56/ghc >--------------------------------------------------------------- commit d7e7ade7aa876ecb1758eb8b7913bef0d9553d56 Author: Joachim Breitner Date: Mon Sep 26 10:41:13 2016 -0400 Actually implement a simple compression scheme (#12626) Which only works for type variables where there is an argument of that type, but that is enough for, say, the tuple constructor. >--------------------------------------------------------------- d7e7ade7aa876ecb1758eb8b7913bef0d9553d56 compiler/coreSyn/CoreSyn.hs | 66 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 6d82775..3da804f 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -98,6 +98,7 @@ import CostCentre import VarEnv( InScopeSet ) import Var import Type +import TyCoRep ( TyBinder(..) ) import Coercion import Name import NameSet @@ -120,6 +121,7 @@ import Pair import Data.Data hiding (TyCon) import Data.Int import Data.Word +import Data.List ( findIndex ) infixl 4 `mkApps`, `mkTyApps`, `mkVarApps`, `App`, `mkCoApps` -- Left associative, so that we can say (f `mkTyApps` xs `mkVarApps` ys) @@ -276,6 +278,7 @@ data Expr b | Coercion Coercion deriving Data + class CompressArgs b where unpackArgs :: Expr b -> Arity -> [Expr b] -> [Expr b] unpackArgs _ _ l = l @@ -289,7 +292,9 @@ popArg (Apps e a xs) = case unpackArgs e a xs of xs -> Just (Apps e (a-1) (packArgs e (init xs)), last xs) popArg _ = Nothing -pattern App :: Expr b -> Arg b -> Expr b +#if __GLASGOW_HASKELL__ > 710 +pattern App :: CompressArgs b => Expr b -> Arg b -> Expr b +#endif pattern App e1 e2 <- (popArg -> Just (e1, e2)) where App e1 e2 | (f, args) <- collectArgs e1 = Apps f (length args +1) (packArgs f (args ++ [e2])) @@ -1438,9 +1443,60 @@ type CoreBind = Bind CoreBndr -- | Case alternatives where binders are 'CoreBndr's type CoreAlt = Alt CoreBndr + +-- Simple compression scheme, as a proof of concept: Only look for type +-- arguments that thare the type of one argument. +defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Expr b] -> [Expr b] +defaultPackArgs typeOf f args + = go pis args + where + (all_pis,_) = splitPiTys (typeOf f) + -- Match the arity of the arguments with the arity of the type + n = min (length all_pis) (length args) + pis = take n all_pis + + -- Remove redundant type type arguments + go (Named tyBndr : pis) (_ : args) + | any (isTyVar (binderVar tyBndr)) pis + = go pis args + go (_ : pis) (a : args) + = a : go pis args + -- More args than our type can handle, keep them + go [] args + = args + go _ [] = panic "defaultPackArgs: not enough args" + + isTyVar :: TyVar -> TyBinder -> Bool + isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True + isTyVar _ _ = False + +defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Expr b] -> [Expr b] +defaultUnpackArgs typeOf f arity args + = go pis args + where + (all_pis,_) = splitPiTys (typeOf f) + -- Match the arity of the arguments with the arity of the type + n = min (length all_pis) arity + pis = take n all_pis + + go (Named tyBndr : pis) args + | Just i <- findIndex (isTyVar (binderVar tyBndr)) pis + -- This is a type argument we have to recover + = let args' = go pis args + in Type (typeOf (args' !! i)) : args' + go (_ : pis) (a : args) + = a : go pis args + go [] args + = args + go _ [] = panic "defaultPackArgs: not enough args" + + isTyVar :: TyVar -> TyBinder -> Bool + isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True + isTyVar _ _ = False + instance CompressArgs Var where - unpackArgs _ _ l = l - packArgs _ l = l + unpackArgs = defaultUnpackArgs exprType + packArgs = defaultPackArgs exprType {- ************************************************************************ @@ -1467,8 +1523,8 @@ instance Outputable b => OutputableBndr (TaggedBndr b) where pprPrefixOcc b = ppr b instance CompressArgs (TaggedBndr t) where - unpackArgs _ _ l = l - packArgs _ l = l + unpackArgs = defaultUnpackArgs (exprType . deTagExpr) + packArgs = defaultPackArgs (exprType . deTagExpr) deTagExpr :: TaggedExpr t -> CoreExpr deTagExpr (Var v) = Var v From git at git.haskell.org Mon Sep 26 18:24:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:24:38 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Optimize mkApps and collectArgs (376c3a3) Message-ID: <20160926182438.53A8E3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/376c3a3537c39f5d6d3b8ae9e53465e77f1f833c/ghc >--------------------------------------------------------------- commit 376c3a3537c39f5d6d3b8ae9e53465e77f1f833c Author: Joachim Breitner Date: Mon Sep 26 10:54:22 2016 -0400 Optimize mkApps and collectArgs so that these do pack/unpack only once, and not repeatedly, and maintain the invariant that Apps constructors do not nest (this invariant can be revisited; it is not crucial here.) >--------------------------------------------------------------- 376c3a3537c39f5d6d3b8ae9e53465e77f1f833c compiler/coreSyn/CoreSyn.hs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 3da804f..cb5a75a 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -280,24 +280,23 @@ data Expr b class CompressArgs b where - unpackArgs :: Expr b -> Arity -> [Expr b] -> [Expr b] + unpackArgs :: Expr b -> Arity -> [Arg b] -> [Arg b] unpackArgs _ _ l = l - packArgs :: Expr b -> [Expr b] -> [Expr b] + packArgs :: Expr b -> [Arg b] -> [Arg b] packArgs _ l = l -popArg :: CompressArgs b => Expr b -> Maybe (Expr b, Expr b) -popArg (Apps e a xs) = case unpackArgs e a xs of - [x] -> Just (e, x) - xs -> Just (Apps e (a-1) (packArgs e (init xs)), last xs) -popArg _ = Nothing +popArg :: CompressArgs b => Expr b -> Maybe (Expr b, Arg b) +popArg e = case collectArgs e of + (_, []) -> Nothing + (f, xs) -> Just (mkApps f (init xs), last xs) #if __GLASGOW_HASKELL__ > 710 pattern App :: CompressArgs b => Expr b -> Arg b -> Expr b #endif pattern App e1 e2 <- (popArg -> Just (e1, e2)) where App e1 e2 | (f, args) <- collectArgs e1 - = Apps f (length args +1) (packArgs f (args ++ [e2])) + = mkApps f (args ++ [e2]) -- | Type synonym for expressions that occur in function argument positions. -- Only 'Arg' should contain a 'Type' at top level, general 'Expr' should not @@ -1446,7 +1445,7 @@ type CoreAlt = Alt CoreBndr -- Simple compression scheme, as a proof of concept: Only look for type -- arguments that thare the type of one argument. -defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Expr b] -> [Expr b] +defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Arg b] -> [Arg b] defaultPackArgs typeOf f args = go pis args where @@ -1470,7 +1469,7 @@ defaultPackArgs typeOf f args isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True isTyVar _ _ = False -defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Expr b] -> [Expr b] +defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Arg b] -> [Arg b] defaultUnpackArgs typeOf f arity args = go pis args where @@ -1566,12 +1565,16 @@ mkVarApps :: CompressArgs b => Expr b -> [Var] -> Expr b -- use 'MkCore.mkCoreConApps' if possible mkConApp :: CompressArgs b => DataCon -> [Arg b] -> Expr b -mkApps f args = foldl App f args -mkCoApps f args = foldl (\ e a -> App e (Coercion a)) f args -mkVarApps f vars = foldl (\ e a -> App e (varToCoreExpr a)) f vars +mkApps e [] = e +mkApps e args2 = Apps f (length args) (packArgs f args) + where + (f, args1) = collectArgs e + args = args1 ++ args2 +mkCoApps f args = mkApps f (map Coercion args) +mkVarApps f vars = mkApps f (map varToCoreExpr vars) mkConApp con args = mkApps (Var (dataConWorkId con)) args -mkTyApps f args = foldl (\ e a -> App e (typeOrCoercion a)) f args +mkTyApps f args = mkApps f (map typeOrCoercion args) where typeOrCoercion ty | Just co <- isCoercionTy_maybe ty = Coercion co @@ -1765,11 +1768,8 @@ collectTyAndValBinders expr -- | Takes a nested application expression and returns the the function -- being applied and the arguments to which it is applied collectArgs :: CompressArgs b => Expr b -> (Expr b, [Arg b]) -collectArgs expr - = go expr [] - where - go (App f a) as = go f (a:as) - go e as = (e, as) +collectArgs (Apps e a xs) = (e, unpackArgs e a xs) +collectArgs e = (e, []) -- | Like @collectArgs@, but also collects looks through floatable -- ticks if it means that we can find more arguments. From git at git.haskell.org Mon Sep 26 18:35:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:35:18 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Move exprType to CoreSyn (7d0ade0) Message-ID: <20160926183518.57F103A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/7d0ade0addde40ef9eebaa8f8beca00c194520b6/ghc >--------------------------------------------------------------- commit 7d0ade0addde40ef9eebaa8f8beca00c194520b6 Author: Joachim Breitner Date: Mon Sep 26 09:48:26 2016 -0400 Move exprType to CoreSyn >--------------------------------------------------------------- 7d0ade0addde40ef9eebaa8f8beca00c194520b6 compiler/basicTypes/MkId.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 127 ++++++++++++++++++++++++- compiler/coreSyn/CoreUtils.hs | 113 +--------------------- compiler/coreSyn/MkCore.hs | 2 +- compiler/deSugar/DsCCall.hs | 1 - compiler/deSugar/DsListComp.hs | 1 - compiler/deSugar/DsMeta.hs | 1 - compiler/deSugar/DsUtils.hs | 1 - compiler/main/GHC.hs | 2 +- compiler/simplCore/SAT.hs | 1 - compiler/simplCore/SetLevels.hs | 3 +- compiler/specialise/Rules.hs | 2 +- compiler/specialise/Specialise.hs | 2 +- compiler/stgSyn/CoreToStg.hs | 2 +- compiler/stranal/DmdAnal.hs | 2 +- compiler/stranal/WorkWrap.hs | 2 +- compiler/stranal/WwLib.hs | 2 +- compiler/vectorise/Vectorise/Generic/PADict.hs | 1 - compiler/vectorise/Vectorise/Type/Env.hs | 1 - compiler/vectorise/Vectorise/Utils.hs | 1 - compiler/vectorise/Vectorise/Utils/Base.hs | 1 - compiler/vectorise/Vectorise/Utils/Closure.hs | 1 - compiler/vectorise/Vectorise/Utils/Hoisting.hs | 1 - 23 files changed, 136 insertions(+), 136 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7d0ade0addde40ef9eebaa8f8beca00c194520b6 From git at git.haskell.org Mon Sep 26 18:35:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:35:21 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Actually implement a simple compression scheme (#12626) (5d2b565) Message-ID: <20160926183521.042A23A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/5d2b56566808ca68f7705d25acd168df938c8fcd/ghc >--------------------------------------------------------------- commit 5d2b56566808ca68f7705d25acd168df938c8fcd Author: Joachim Breitner Date: Mon Sep 26 10:41:13 2016 -0400 Actually implement a simple compression scheme (#12626) Which only works for type variables where there is an argument of that type, but that is enough for, say, the tuple constructor. >--------------------------------------------------------------- 5d2b56566808ca68f7705d25acd168df938c8fcd compiler/coreSyn/CoreSyn.hs | 66 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 6d82775..3da804f 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -98,6 +98,7 @@ import CostCentre import VarEnv( InScopeSet ) import Var import Type +import TyCoRep ( TyBinder(..) ) import Coercion import Name import NameSet @@ -120,6 +121,7 @@ import Pair import Data.Data hiding (TyCon) import Data.Int import Data.Word +import Data.List ( findIndex ) infixl 4 `mkApps`, `mkTyApps`, `mkVarApps`, `App`, `mkCoApps` -- Left associative, so that we can say (f `mkTyApps` xs `mkVarApps` ys) @@ -276,6 +278,7 @@ data Expr b | Coercion Coercion deriving Data + class CompressArgs b where unpackArgs :: Expr b -> Arity -> [Expr b] -> [Expr b] unpackArgs _ _ l = l @@ -289,7 +292,9 @@ popArg (Apps e a xs) = case unpackArgs e a xs of xs -> Just (Apps e (a-1) (packArgs e (init xs)), last xs) popArg _ = Nothing -pattern App :: Expr b -> Arg b -> Expr b +#if __GLASGOW_HASKELL__ > 710 +pattern App :: CompressArgs b => Expr b -> Arg b -> Expr b +#endif pattern App e1 e2 <- (popArg -> Just (e1, e2)) where App e1 e2 | (f, args) <- collectArgs e1 = Apps f (length args +1) (packArgs f (args ++ [e2])) @@ -1438,9 +1443,60 @@ type CoreBind = Bind CoreBndr -- | Case alternatives where binders are 'CoreBndr's type CoreAlt = Alt CoreBndr + +-- Simple compression scheme, as a proof of concept: Only look for type +-- arguments that thare the type of one argument. +defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Expr b] -> [Expr b] +defaultPackArgs typeOf f args + = go pis args + where + (all_pis,_) = splitPiTys (typeOf f) + -- Match the arity of the arguments with the arity of the type + n = min (length all_pis) (length args) + pis = take n all_pis + + -- Remove redundant type type arguments + go (Named tyBndr : pis) (_ : args) + | any (isTyVar (binderVar tyBndr)) pis + = go pis args + go (_ : pis) (a : args) + = a : go pis args + -- More args than our type can handle, keep them + go [] args + = args + go _ [] = panic "defaultPackArgs: not enough args" + + isTyVar :: TyVar -> TyBinder -> Bool + isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True + isTyVar _ _ = False + +defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Expr b] -> [Expr b] +defaultUnpackArgs typeOf f arity args + = go pis args + where + (all_pis,_) = splitPiTys (typeOf f) + -- Match the arity of the arguments with the arity of the type + n = min (length all_pis) arity + pis = take n all_pis + + go (Named tyBndr : pis) args + | Just i <- findIndex (isTyVar (binderVar tyBndr)) pis + -- This is a type argument we have to recover + = let args' = go pis args + in Type (typeOf (args' !! i)) : args' + go (_ : pis) (a : args) + = a : go pis args + go [] args + = args + go _ [] = panic "defaultPackArgs: not enough args" + + isTyVar :: TyVar -> TyBinder -> Bool + isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True + isTyVar _ _ = False + instance CompressArgs Var where - unpackArgs _ _ l = l - packArgs _ l = l + unpackArgs = defaultUnpackArgs exprType + packArgs = defaultPackArgs exprType {- ************************************************************************ @@ -1467,8 +1523,8 @@ instance Outputable b => OutputableBndr (TaggedBndr b) where pprPrefixOcc b = ppr b instance CompressArgs (TaggedBndr t) where - unpackArgs _ _ l = l - packArgs _ l = l + unpackArgs = defaultUnpackArgs (exprType . deTagExpr) + packArgs = defaultPackArgs (exprType . deTagExpr) deTagExpr :: TaggedExpr t -> CoreExpr deTagExpr (Var v) = Var v From git at git.haskell.org Mon Sep 26 18:35:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 18:35:23 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Optimize mkApps and collectArgs (57a1bc7) Message-ID: <20160926183523.DE5713A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/57a1bc7ea16e1d41ab47f4699c41f73d0aceb82c/ghc >--------------------------------------------------------------- commit 57a1bc7ea16e1d41ab47f4699c41f73d0aceb82c Author: Joachim Breitner Date: Mon Sep 26 10:54:22 2016 -0400 Optimize mkApps and collectArgs so that these do pack/unpack only once, and not repeatedly, and maintain the invariant that Apps constructors do not nest (this invariant can be revisited; it is not crucial here.) >--------------------------------------------------------------- 57a1bc7ea16e1d41ab47f4699c41f73d0aceb82c compiler/coreSyn/CoreSyn.hs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 3da804f..cb5a75a 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -280,24 +280,23 @@ data Expr b class CompressArgs b where - unpackArgs :: Expr b -> Arity -> [Expr b] -> [Expr b] + unpackArgs :: Expr b -> Arity -> [Arg b] -> [Arg b] unpackArgs _ _ l = l - packArgs :: Expr b -> [Expr b] -> [Expr b] + packArgs :: Expr b -> [Arg b] -> [Arg b] packArgs _ l = l -popArg :: CompressArgs b => Expr b -> Maybe (Expr b, Expr b) -popArg (Apps e a xs) = case unpackArgs e a xs of - [x] -> Just (e, x) - xs -> Just (Apps e (a-1) (packArgs e (init xs)), last xs) -popArg _ = Nothing +popArg :: CompressArgs b => Expr b -> Maybe (Expr b, Arg b) +popArg e = case collectArgs e of + (_, []) -> Nothing + (f, xs) -> Just (mkApps f (init xs), last xs) #if __GLASGOW_HASKELL__ > 710 pattern App :: CompressArgs b => Expr b -> Arg b -> Expr b #endif pattern App e1 e2 <- (popArg -> Just (e1, e2)) where App e1 e2 | (f, args) <- collectArgs e1 - = Apps f (length args +1) (packArgs f (args ++ [e2])) + = mkApps f (args ++ [e2]) -- | Type synonym for expressions that occur in function argument positions. -- Only 'Arg' should contain a 'Type' at top level, general 'Expr' should not @@ -1446,7 +1445,7 @@ type CoreAlt = Alt CoreBndr -- Simple compression scheme, as a proof of concept: Only look for type -- arguments that thare the type of one argument. -defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Expr b] -> [Expr b] +defaultPackArgs :: (Expr b -> Type) -> Expr b -> [Arg b] -> [Arg b] defaultPackArgs typeOf f args = go pis args where @@ -1470,7 +1469,7 @@ defaultPackArgs typeOf f args isTyVar v (Anon t) | Just v' <- getTyVar_maybe t, v == v' = True isTyVar _ _ = False -defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Expr b] -> [Expr b] +defaultUnpackArgs :: (Expr b -> Type) -> Expr b -> Arity -> [Arg b] -> [Arg b] defaultUnpackArgs typeOf f arity args = go pis args where @@ -1566,12 +1565,16 @@ mkVarApps :: CompressArgs b => Expr b -> [Var] -> Expr b -- use 'MkCore.mkCoreConApps' if possible mkConApp :: CompressArgs b => DataCon -> [Arg b] -> Expr b -mkApps f args = foldl App f args -mkCoApps f args = foldl (\ e a -> App e (Coercion a)) f args -mkVarApps f vars = foldl (\ e a -> App e (varToCoreExpr a)) f vars +mkApps e [] = e +mkApps e args2 = Apps f (length args) (packArgs f args) + where + (f, args1) = collectArgs e + args = args1 ++ args2 +mkCoApps f args = mkApps f (map Coercion args) +mkVarApps f vars = mkApps f (map varToCoreExpr vars) mkConApp con args = mkApps (Var (dataConWorkId con)) args -mkTyApps f args = foldl (\ e a -> App e (typeOrCoercion a)) f args +mkTyApps f args = mkApps f (map typeOrCoercion args) where typeOrCoercion ty | Just co <- isCoercionTy_maybe ty = Coercion co @@ -1765,11 +1768,8 @@ collectTyAndValBinders expr -- | Takes a nested application expression and returns the the function -- being applied and the arguments to which it is applied collectArgs :: CompressArgs b => Expr b -> (Expr b, [Arg b]) -collectArgs expr - = go expr [] - where - go (App f a) as = go f (a:as) - go e as = (e, as) +collectArgs (Apps e a xs) = (e, unpackArgs e a xs) +collectArgs e = (e, []) -- | Like @collectArgs@, but also collects looks through floatable -- ticks if it means that we can find more arguments. From git at git.haskell.org Mon Sep 26 21:10:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 26 Sep 2016 21:10:47 +0000 (UTC) Subject: [commit: ghc] master: Fix layout of MultiWayIf expressions (#10807) (c36904d) Message-ID: <20160926211047.30ADE3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c36904d66f30d4386a231ce365a056962a881767/ghc >--------------------------------------------------------------- commit c36904d66f30d4386a231ce365a056962a881767 Author: Ömer Sinan Ağacan Date: Mon Sep 26 17:09:01 2016 -0400 Fix layout of MultiWayIf expressions (#10807) With this patch we stop generating virtual semicolons in MultiWayIf guards. Fixes #10807. Test Plan: Reviewers: simonmar, austin, bgamari Reviewed By: simonmar Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2524 GHC Trac Issues: #10807 >--------------------------------------------------------------- c36904d66f30d4386a231ce365a056962a881767 compiler/parser/Lexer.x | 63 +++++++++++++--------- compiler/parser/Parser.y | 14 ++--- testsuite/tests/parser/should_run/T10807.hs | 43 +++++++++++++++ .../should_run/T10807.stdout} | 2 + testsuite/tests/parser/should_run/all.T | 1 + 5 files changed, 87 insertions(+), 36 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c36904d66f30d4386a231ce365a056962a881767 From git at git.haskell.org Tue Sep 27 03:59:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 27 Sep 2016 03:59:09 +0000 (UTC) Subject: [commit: ghc] wip/T12626: seqExpr: No need to unpack Apps (5afc920) Message-ID: <20160927035909.DA87B3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/5afc920326f729fa5d1065b4792c21b718cfbde6/ghc >--------------------------------------------------------------- commit 5afc920326f729fa5d1065b4792c21b718cfbde6 Author: Joachim Breitner Date: Mon Sep 26 23:38:25 2016 -0400 seqExpr: No need to unpack Apps >--------------------------------------------------------------- 5afc920326f729fa5d1065b4792c21b718cfbde6 compiler/coreSyn/CoreSeq.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/coreSyn/CoreSeq.hs b/compiler/coreSyn/CoreSeq.hs index d426bd3..dcfa64a 100644 --- a/compiler/coreSyn/CoreSeq.hs +++ b/compiler/coreSyn/CoreSeq.hs @@ -54,7 +54,7 @@ seqRules (BuiltinRule {} : rules) = seqRules rules seqExpr :: CoreExpr -> () seqExpr (Var v) = v `seq` () seqExpr (Lit lit) = lit `seq` () -seqExpr (App f a) = seqExpr f `seq` seqExpr a +seqExpr (Apps f n as) = seqExpr f `seq` n `seq` seqExprs as seqExpr (Lam b e) = seqBndr b `seq` seqExpr e seqExpr (Let b e) = seqBind b `seq` seqExpr e seqExpr (Case e b t as) = seqExpr e `seq` seqBndr b `seq` seqType t `seq` seqAlts as From git at git.haskell.org Tue Sep 27 04:32:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 27 Sep 2016 04:32:45 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Argument compression: Optimize for quick decompression (3c102cd) Message-ID: <20160927043245.639AC3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/3c102cd235a03e5bd4a964ce337e3728e4237bb7/ghc >--------------------------------------------------------------- commit 3c102cd235a03e5bd4a964ce337e3728e4237bb7 Author: Joachim Breitner Date: Tue Sep 27 00:19:36 2016 -0400 Argument compression: Optimize for quick decompression By storing the offset to the value argument to take the type from, the decompression function is pretty simple: * It no longer needs to know the arity of the uncompressed argument list. * If a type application is poped but then not forced, no exprType is executed. * The analysis of the function's type is done only once, when the list of applications is compressed, but no longer when it is decompressed. >--------------------------------------------------------------- 3c102cd235a03e5bd4a964ce337e3728e4237bb7 compiler/coreSyn/CoreSeq.hs | 7 ++- compiler/coreSyn/CoreSyn.hs | 140 +++++++++++++++++++----------------------- compiler/coreSyn/CoreUtils.hs | 18 +++--- compiler/coreSyn/PprCore.hs | 26 ++++---- compiler/main/TidyPgm.hs | 4 +- 5 files changed, 92 insertions(+), 103 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3c102cd235a03e5bd4a964ce337e3728e4237bb7 From git at git.haskell.org Tue Sep 27 04:32:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 27 Sep 2016 04:32:48 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Improve popArgs (8c38915) Message-ID: <20160927043248.1100B3A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/8c389150a5f58f31f7d6a7f2d043d7081f84f939/ghc >--------------------------------------------------------------- commit 8c389150a5f58f31f7d6a7f2d043d7081f84f939 Author: Joachim Breitner Date: Tue Sep 27 00:31:46 2016 -0400 Improve popArgs to not recalculate the compression, but rather remove the last argument and fill the holes refering to it, if any. >--------------------------------------------------------------- 8c389150a5f58f31f7d6a7f2d043d7081f84f939 compiler/coreSyn/CoreSyn.hs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 0673034..6dbd6e7 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -323,9 +323,21 @@ unpackArgs args = go args go [] = [] popArg :: HasTypeOf b => Expr b -> Maybe (Expr b, Arg b) -popArg e = case collectArgs e of - (_, []) -> Nothing - (f, xs) -> Just (mkApps f (init xs), last xs) +popArg (Apps _ []) = panic "popArg: empty args" +popArg (Apps _ [Left _]) = panic "popArg: left singleton" +popArg (Apps e [Right x]) = Just (e, x) +popArg (Apps e rxs) = Just (Apps e (fixUp xs 0 []), x) + where + Right x:xs = reverse rxs + ty = exprType' x + + -- An erased type argument referring to the popped argument needs to be + -- removed; all others can stay. This way we avoid re-consulting the + -- function's type. + fixUp [] _ acc = acc + fixUp (Left i:xs) n acc | i == n = fixUp xs (n+1) (Right (Type ty) : acc) + fixUp (x :xs) n acc = fixUp xs (n+1) (x : acc) +popArg _ = Nothing #if __GLASGOW_HASKELL__ > 710 pattern App :: HasTypeOf b => Expr b -> Arg b -> Expr b From git at git.haskell.org Tue Sep 27 19:15:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 27 Sep 2016 19:15:44 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T12144' created Message-ID: <20160927191544.30CEE3A339@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T12144 Referencing: 588bfab63eef99ce504effe04c06e3945a12a5dd From git at git.haskell.org Tue Sep 27 19:15:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 27 Sep 2016 19:15:47 +0000 (UTC) Subject: [commit: ghc] wip/T12144: Implement deriving strategies (1f10e18) Message-ID: <20160927191547.1D1373A339@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12144 Link : http://ghc.haskell.org/trac/ghc/changeset/1f10e1828d76894b0cc963aaf8df6fd5d6474fc9/ghc >--------------------------------------------------------------- commit 1f10e1828d76894b0cc963aaf8df6fd5d6474fc9 Author: Ryan Scott Date: Sat Aug 27 14:00:04 2016 -0400 Implement deriving strategies Summary: Allows users to explicitly request which approach to `deriving` to use via keywords, e.g., ``` newtype Foo = Foo Bar deriving Eq deriving builtin Ord deriving newtype Show ``` Fixes #10598. Test Plan: ./validate Reviewers: hvr, kosmikus, goldfire, bgamari, simonpj, alanz, austin, erikd, simonmar Reviewed By: simonpj, alanz Subscribers: thomie, mpickering, oerjan Differential Revision: https://phabricator.haskell.org/D2280 GHC Trac Issues: #10598 >--------------------------------------------------------------- 1f10e1828d76894b0cc963aaf8df6fd5d6474fc9 compiler/basicTypes/BasicTypes.hs | 26 + compiler/deSugar/DsMeta.hs | 57 ++- compiler/hsSyn/Convert.hs | 27 +- compiler/hsSyn/HsDecls.hs | 89 ++-- compiler/main/DynFlags.hs | 1 + compiler/main/HscStats.hs | 8 +- compiler/parser/ApiAnnotation.hs | 4 +- compiler/parser/Lexer.x | 8 + compiler/parser/Parser.y | 124 +++-- compiler/prelude/THNames.hs | 151 +++--- compiler/rename/RnSource.hs | 45 +- compiler/rename/RnTypes.hs | 4 +- compiler/typecheck/TcDeriv.hs | 525 +++++++++++++++------ compiler/typecheck/TcGenDeriv.hs | 21 +- compiler/typecheck/TcInstDcls.hs | 10 +- docs/users_guide/8.2.1-notes.rst | 4 + docs/users_guide/glasgow_exts.rst | 56 +++ .../ghc-boot-th/GHC/LanguageExtensions/Type.hs | 1 + libraries/ghci/GHCi/TH/Binary.hs | 2 + libraries/template-haskell/Language/Haskell/TH.hs | 13 +- .../template-haskell/Language/Haskell/TH/Lib.hs | 32 +- .../template-haskell/Language/Haskell/TH/Ppr.hs | 29 +- .../template-haskell/Language/Haskell/TH/Syntax.hs | 40 +- libraries/template-haskell/changelog.md | 3 + testsuite/driver/extra_files.py | 1 + .../tests/deriving/should_fail/T10598_fail1.hs | 11 + .../tests/deriving/should_fail/T10598_fail1.stderr | 18 + .../tests/deriving/should_fail/T10598_fail2.hs | 5 + .../tests/deriving/should_fail/T10598_fail2.stderr | 12 + .../tests/deriving/should_fail/T10598_fail3.hs | 8 + .../tests/deriving/should_fail/T10598_fail3.stderr | 5 + .../tests/deriving/should_fail/T10598_fail4.hs | 4 + .../tests/deriving/should_fail/T10598_fail4.stderr | 4 + .../tests/deriving/should_fail/T10598_fail5.hs | 5 + .../tests/deriving/should_fail/T10598_fail5.stderr | 4 + .../tests/deriving/should_fail/T10598_fail6.hs | 5 + .../tests/deriving/should_fail/T10598_fail6.stderr | 6 + testsuite/tests/deriving/should_fail/all.T | 6 + testsuite/tests/deriving/should_run/T10598_bug.hs | 9 + .../tests/deriving/should_run/T10598_bug.stdout | 1 + testsuite/tests/deriving/should_run/T10598_run.hs | 24 + .../tests/deriving/should_run/T10598_run.stdout | 2 + testsuite/tests/deriving/should_run/all.T | 2 + testsuite/tests/driver/T4437.hs | 3 +- testsuite/tests/ghc-api/annotations/Makefile | 4 + testsuite/tests/ghc-api/annotations/T10598.stdout | 36 ++ testsuite/tests/ghc-api/annotations/Test10598.hs | 18 + testsuite/tests/ghc-api/annotations/all.T | 1 + testsuite/tests/rts/T7919A.hs | 2 +- testsuite/tests/th/T10598_TH.hs | 42 ++ testsuite/tests/th/T10598_TH.stderr | 41 ++ testsuite/tests/th/T10697_sourceUtil.hs | 2 +- testsuite/tests/th/T10819.hs | 3 +- testsuite/tests/th/T8100.hs | 4 +- testsuite/tests/th/TH_dataD1.hs | 2 +- testsuite/tests/th/all.T | 1 + utils/mkUserGuidePart/Options/Language.hs | 7 + 57 files changed, 1203 insertions(+), 375 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1f10e1828d76894b0cc963aaf8df6fd5d6474fc9 From git at git.haskell.org Tue Sep 27 19:15:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 27 Sep 2016 19:15:50 +0000 (UTC) Subject: [commit: ghc] wip/T12144: Work on #12144 (588bfab) Message-ID: <20160927191550.768543A339@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12144 Link : http://ghc.haskell.org/trac/ghc/changeset/588bfab63eef99ce504effe04c06e3945a12a5dd/ghc >--------------------------------------------------------------- commit 588bfab63eef99ce504effe04c06e3945a12a5dd Author: Ryan Scott Date: Sat Aug 27 14:00:56 2016 -0400 Work on #12144 >--------------------------------------------------------------- 588bfab63eef99ce504effe04c06e3945a12a5dd compiler/typecheck/TcDeriv.hs | 97 ++++++++++++++--------- testsuite/tests/deriving/should_compile/T12144.hs | 6 ++ testsuite/tests/deriving/should_compile/all.T | 1 + 3 files changed, 68 insertions(+), 36 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 588bfab63eef99ce504effe04c06e3945a12a5dd From git at git.haskell.org Tue Sep 27 21:38:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 27 Sep 2016 21:38:44 +0000 (UTC) Subject: [commit: ghc] master: TH: Use atomicModifyIORef' for fresh names (f897b74) Message-ID: <20160927213844.E9B943A339@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f897b7427a4804e3285144f57676574d338be1f5/ghc >--------------------------------------------------------------- commit f897b7427a4804e3285144f57676574d338be1f5 Author: Erik de Castro Lopo Date: Wed Sep 28 07:37:33 2016 +1000 TH: Use atomicModifyIORef' for fresh names This prevents the possibility of race conditions when creating fresh names. Test Plan: validate Reviewers: goldfire, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2548 >--------------------------------------------------------------- f897b7427a4804e3285144f57676574d338be1f5 libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 20c2396..00ac0b3 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -112,9 +112,8 @@ class Monad m => Quasi m where ----------------------------------------------------- instance Quasi IO where - qNewName s = do { n <- readIORef counter - ; writeIORef counter (n+1) - ; return (mkNameU s n) } + qNewName s = do { n <- atomicModifyIORef' counter (\x -> (x + 1, x)) + ; pure (mkNameU s n) } qReport True msg = hPutStrLn stderr ("Template Haskell error: " ++ msg) qReport False msg = hPutStrLn stderr ("Template Haskell error: " ++ msg) From git at git.haskell.org Wed Sep 28 13:33:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 28 Sep 2016 13:33:11 +0000 (UTC) Subject: [commit: ghc] master: Comments and manual only: spelling (0b6024c) Message-ID: <20160928133311.3F2433A339@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0b6024c6fc7c7226d9ba2373eb2a5b7a08311a2e/ghc >--------------------------------------------------------------- commit 0b6024c6fc7c7226d9ba2373eb2a5b7a08311a2e Author: Gabor Greif Date: Wed Sep 28 15:28:38 2016 +0200 Comments and manual only: spelling >--------------------------------------------------------------- 0b6024c6fc7c7226d9ba2373eb2a5b7a08311a2e compiler/nativeGen/Dwarf/Types.hs | 2 +- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcSplice.hs | 2 +- docs/users_guide/glasgow_exts.rst | 2 +- testsuite/tests/typecheck/should_fail/tcfail096.hs | 2 +- testsuite/tests/typecheck/should_fail/tcfail130.hs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs index 0db2419..0fcd926 100644 --- a/compiler/nativeGen/Dwarf/Types.hs +++ b/compiler/nativeGen/Dwarf/Types.hs @@ -152,7 +152,7 @@ pprDwarfInfo haveSrc d noChildren = pprDwarfInfoOpen haveSrc d -- | Prints assembler data corresponding to DWARF info records. Note --- that the binary format of this is paramterized in @abbrevDecls@ and +-- that the binary format of this is parameterized in @abbrevDecls@ and -- has to be kept in synch. pprDwarfInfoOpen :: Bool -> DwarfInfo -> SDoc pprDwarfInfoOpen haveSrc (DwarfCompileUnit _ name producer compDir lowLabel diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 298bbb2..583ca62 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -1667,7 +1667,7 @@ Note [FunDep and implicit parameter reactions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Currently, our story of interacting two dictionaries (or a dictionary and top-level instances) for functional dependencies, and implicit -paramters, is that we simply produce new Derived equalities. So for example +parameters, is that we simply produce new Derived equalities. So for example class D a b | a -> b where ... Inert: diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 9bfebd5..6d956fe 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1916,7 +1916,7 @@ Note that trigger superclass expansion. This was a good part of the loop in Trac #11523 - * Even for Wanted constraints, we say "no" for implicit paramters. + * Even for Wanted constraints, we say "no" for implicit parameters. we have [W] ?x::ty, expanding superclasses won't help: - Superclasses can't be implicit parameters - If we have a [G] ?x:ty2, then we'll have another unsolved diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index 861c370..ed55323 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1851,7 +1851,7 @@ reify_tc_app tc tys reifyPred :: TyCoRep.PredType -> TcM TH.Pred reifyPred ty - -- We could reify the invisible paramter as a class but it seems + -- We could reify the invisible parameter as a class but it seems -- nicer to support them properly... | isIPPred ty = noTH (sLit "implicit parameters") (ppr ty) | otherwise = reifyType ty diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 6af26b5..b41a09a 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -3383,7 +3383,7 @@ example), then we apply the function ``f`` directly to it. If a type is encountered that is not syntactically equivalent to the last type parameter *but does mention* the last type parameter somewhere in it, then a recursive call to ``fmap`` is made. If a type is found which doesn't mention the last -type paramter at all, then it is left alone. +type parameter at all, then it is left alone. The second of those cases, in which a type is unequal to the type parameter but does contain the type parameter, can be surprisingly tricky. For example, the diff --git a/testsuite/tests/typecheck/should_fail/tcfail096.hs b/testsuite/tests/typecheck/should_fail/tcfail096.hs index c019bfb..41dfd90 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail096.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail096.hs @@ -6,7 +6,7 @@ class Foo f a r | f a -> r where foo::f->a->r -- These instances are incompatible because we can unify --- the first two paramters, though it's rather obscure: +-- the first two parameters, though it's rather obscure: -- p -> (a,b) -- t -> (,) (a,a) -- c -> (,) a diff --git a/testsuite/tests/typecheck/should_fail/tcfail130.hs b/testsuite/tests/typecheck/should_fail/tcfail130.hs index 96101b5..0d71120 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail130.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail130.hs @@ -1,7 +1,7 @@ {-# LANGUAGE ImplicitParams #-} -- The defn of foo should be rejected; it's monomorphic, but --- the implicit paramter escapes +-- the implicit parameter escapes module Foo where From git at git.haskell.org Thu Sep 29 08:23:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:23:55 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #12634 (13d3b53) Message-ID: <20160929082355.C59243A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/13d3b531aa565b0fc602feb312f3054e4f1f380a/ghc >--------------------------------------------------------------- commit 13d3b531aa565b0fc602feb312f3054e4f1f380a Author: Simon Peyton Jones Date: Thu Sep 29 09:23:11 2016 +0100 Test Trac #12634 >--------------------------------------------------------------- 13d3b531aa565b0fc602feb312f3054e4f1f380a testsuite/tests/partial-sigs/should_fail/T12634.hs | 15 +++++++++++++++ testsuite/tests/partial-sigs/should_fail/T12634.stderr | 10 ++++++++++ testsuite/tests/partial-sigs/should_fail/all.T | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/partial-sigs/should_fail/T12634.hs b/testsuite/tests/partial-sigs/should_fail/T12634.hs new file mode 100644 index 0000000..36865ed --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T12634.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} + +module T12634 where + +twacePowDec :: t m' r -> t m r +twacePowDec = undefined + +data Bench a + +bench :: (a -> b) -> a -> Bench params +bench f = undefined + +bench_twacePow :: forall t m m' r . _ => t m' r -> Bench '(t,m,m',r) +bench_twacePow = bench (twacePowDec :: t m' r -> t m r) diff --git a/testsuite/tests/partial-sigs/should_fail/T12634.stderr b/testsuite/tests/partial-sigs/should_fail/T12634.stderr new file mode 100644 index 0000000..4287110 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T12634.stderr @@ -0,0 +1,10 @@ + +T12634.hs:14:58: error: + • Expected a type, but + ‘'(t, m, m', r)’ has kind + ‘(k1 -> k2 -> *, k0, k1, k2)’ + • In the first argument of ‘Bench’, namely ‘'(t, m, m', r)’ + In the type ‘t m' r -> Bench '(t, m, m', r)’ + In the type signature: + bench_twacePow :: forall t m m' r. + _ => t m' r -> Bench '(t, m, m', r) diff --git a/testsuite/tests/partial-sigs/should_fail/all.T b/testsuite/tests/partial-sigs/should_fail/all.T index e8f5928..dca7f48 100644 --- a/testsuite/tests/partial-sigs/should_fail/all.T +++ b/testsuite/tests/partial-sigs/should_fail/all.T @@ -62,4 +62,4 @@ test('T11122', normal, compile, ['']) test('T11976', normal, compile_fail, ['']) test('PatBind3', normal, compile_fail, ['']) test('T12039', normal, compile_fail, ['']) - +test('T12634', normal, compile_fail, ['']) From git at git.haskell.org Thu Sep 29 08:36:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:36:54 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-temp' created Message-ID: <20160929083654.782893A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/spj-temp Referencing: bfd1ac57535a9229fd55ba22369d8a159bb9392b From git at git.haskell.org Thu Sep 29 08:36:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:36:57 +0000 (UTC) Subject: [commit: ghc] wip/spj-temp: A bit of tracing about flattening (f850207) Message-ID: <20160929083657.44DD13A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-temp Link : http://ghc.haskell.org/trac/ghc/changeset/f85020791f24cf715d954b8a237f9fbc84f9c93f/ghc >--------------------------------------------------------------- commit f85020791f24cf715d954b8a237f9fbc84f9c93f Author: Simon Peyton Jones Date: Sat Sep 24 04:42:18 2016 +0100 A bit of tracing about flattening >--------------------------------------------------------------- f85020791f24cf715d954b8a237f9fbc84f9c93f compiler/typecheck/TcFlatten.hs | 18 +++++++++++++----- compiler/typecheck/TcSMonad.hs | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 4e02e99..b575c51 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -778,7 +778,10 @@ yields a better error message anyway.) flatten :: FlattenMode -> CtEvidence -> TcType -> TcS (Xi, TcCoercion) flatten mode ev ty - = runFlatten mode ev (flatten_one ty) + = do { traceTcS "flatten {" (ppr ty) + ; (ty', co) <- runFlatten mode ev (flatten_one ty) + ; traceTcS "flatten }" (ppr ty') + ; return (ty', co) } flattenManyNom :: CtEvidence -> [TcType] -> TcS ([Xi], [TcCoercion]) -- Externally-callable, hence runFlatten @@ -787,7 +790,10 @@ flattenManyNom :: CtEvidence -> [TcType] -> TcS ([Xi], [TcCoercion]) -- ctEvFlavour ev = Nominal -- and we want to flatten all at nominal role flattenManyNom ev tys - = runFlatten FM_FlattenAll ev (flatten_many_nom tys) + = do { traceTcS "flatten_many {" (vcat (map ppr tys)) + ; (tys', cos) <- runFlatten FM_FlattenAll ev (flatten_many_nom tys) + ; traceTcS "flatten }" (vcat (map ppr tys')) + ; return (tys', cos) } {- ********************************************************************* * * @@ -943,7 +949,7 @@ flatten_one (AppTy ty1 ty2) role2 co2 xi2 ty2 role1 ) } -- output should match fmode -flatten_one (TyConApp tc tys) +flatten_one ty@(TyConApp tc tys) -- Expand type synonyms that mention type families -- on the RHS; see Note [Flattening synonyms] | Just (tenv, rhs, tys') <- expandSynTyCon_maybe tc tys @@ -952,8 +958,10 @@ flatten_one (TyConApp tc tys) ; let used_tcs = tyConsOfType rhs ; case mode of FM_FlattenAll | anyNameEnv isTypeFamilyTyCon used_tcs - -> flatten_one expanded_ty - _ -> flatten_ty_con_app tc tys } + -> do { traceFlat "flatten_one syn expand" (ppr ty $$ ppr used_tcs) + ; flatten_one expanded_ty } + _ -> do { traceFlat "flatten_one syn no expand" (ppr ty) + ; flatten_ty_con_app tc tys } } -- Otherwise, it's a type function application, and we have to -- flatten it away as well, and generate a new given equality constraint diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index fb03ec2..18b6a69 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -3085,8 +3085,19 @@ matchFam tycon args = wrapTcS $ matchFamTcM tycon args matchFamTcM :: TyCon -> [Type] -> TcM (Maybe (Coercion, TcType)) -- Given (F tys) return (ty, co), where co :: F tys ~ ty matchFamTcM tycon args - = do { fam_envs <- FamInst.tcGetFamInstEnvs - ; return $ reduceTyFamApp_maybe fam_envs Nominal tycon args } + = do { fam_envs@(_,lcl) <- FamInst.tcGetFamInstEnvs + ; let match_fam_result + = reduceTyFamApp_maybe fam_envs Nominal tycon args + ; TcM.traceTc "matchFamTcM" $ + vcat [ text "Matching:" <+> ppr (mkTyConApp tycon args) + , ppr_res match_fam_result + , text "Lcl fam env:" <+> ppr lcl ] + ; return match_fam_result } + where + ppr_res Nothing = text "Match failed" + ppr_res (Just (co,ty)) = hang (text "Match succeeded:") + 2 (vcat [ text "Rewrites to:" <+> ppr ty + , text "Coercion:" <+> ppr co ]) {- Note [Residual implications] From git at git.haskell.org Thu Sep 29 08:37:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:37:00 +0000 (UTC) Subject: [commit: ghc] wip/spj-temp: Improve -dsuppress-uniques (88671b7) Message-ID: <20160929083700.1F97D3A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-temp Link : http://ghc.haskell.org/trac/ghc/changeset/88671b7f99950f79bf1147a682dff79b40433660/ghc >--------------------------------------------------------------- commit 88671b7f99950f79bf1147a682dff79b40433660 Author: Simon Peyton Jones Date: Sun Sep 25 06:23:56 2016 +0100 Improve -dsuppress-uniques This just makes -dsuppress-uniques work more uniformly by putting the work into pprUnique >--------------------------------------------------------------- 88671b7f99950f79bf1147a682dff79b40433660 compiler/basicTypes/Name.hs | 6 +----- compiler/basicTypes/Unique.hs | 6 +++++- compiler/main/DynFlags.hs | 5 ++++- compiler/main/DynFlags.hs-boot | 3 ++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs index d1b05f3..54f946e 100644 --- a/compiler/basicTypes/Name.hs +++ b/compiler/basicTypes/Name.hs @@ -577,11 +577,7 @@ pprModulePrefix sty mod occ = sdocWithDynFlags $ \dflags -> ppr_underscore_unique :: Unique -> SDoc -- Print an underscore separating the name from its unique -- But suppress it if we aren't printing the uniques anyway -ppr_underscore_unique uniq - = sdocWithDynFlags $ \dflags -> - if gopt Opt_SuppressUniques dflags - then empty - else char '_' <> pprUnique uniq +ppr_underscore_unique uniq = char '_' <> pprUnique uniq ppr_occ_name :: OccName -> SDoc ppr_occ_name occ = ftext (occNameFS occ) diff --git a/compiler/basicTypes/Unique.hs b/compiler/basicTypes/Unique.hs index c933d61..914fe77 100644 --- a/compiler/basicTypes/Unique.hs +++ b/compiler/basicTypes/Unique.hs @@ -66,6 +66,7 @@ module Unique ( import BasicTypes import FastString +import {-# SOURCE #-} DynFlags( suppressUniques ) import Outputable import Util @@ -262,7 +263,10 @@ finish_show 't' u _pp_u | u < 26 finish_show tag _ pp_u = tag : pp_u pprUnique :: Unique -> SDoc -pprUnique u = text (showUnique u) +pprUnique u = sdocWithDynFlags $ \dflags -> + if (suppressUniques dflags) + then text "xxx" + else text (showUnique u) instance Outputable Unique where ppr = pprUnique diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index b642bea..3a0ac76 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -32,7 +32,7 @@ module DynFlags ( wopt, wopt_set, wopt_unset, xopt, xopt_set, xopt_unset, lang_set, - useUnicodeSyntax, + useUnicodeSyntax, suppressUniques, whenGeneratingDynamicToo, ifGeneratingDynamicToo, whenCannotGenerateDynamicToo, dynamicTooMkDynamicDynFlags, @@ -1866,6 +1866,9 @@ lang_set dflags lang = useUnicodeSyntax :: DynFlags -> Bool useUnicodeSyntax = gopt Opt_PrintUnicodeSyntax +suppressUniques :: DynFlags -> Bool +suppressUniques = gopt Opt_SuppressUniques + -- | Set the Haskell language standard to use setLanguage :: Language -> DynP () setLanguage l = upd (`lang_set` Just l) diff --git a/compiler/main/DynFlags.hs-boot b/compiler/main/DynFlags.hs-boot index 5cf2166..2c45e0c 100644 --- a/compiler/main/DynFlags.hs-boot +++ b/compiler/main/DynFlags.hs-boot @@ -9,5 +9,6 @@ targetPlatform :: DynFlags -> Platform pprUserLength :: DynFlags -> Int pprCols :: DynFlags -> Int unsafeGlobalDynFlags :: DynFlags -useUnicode :: DynFlags -> Bool +useUnicode :: DynFlags -> Bool useUnicodeSyntax :: DynFlags -> Bool +suppressUniques :: DynFlags -> Bool From git at git.haskell.org Thu Sep 29 08:37:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:37:03 +0000 (UTC) Subject: [commit: ghc] wip/spj-temp: Fix a bug in occurs checking (f3832cf) Message-ID: <20160929083703.CC0803A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-temp Link : http://ghc.haskell.org/trac/ghc/changeset/f3832cfb347a1359a91c5b30ebb4eb7d94dc3f0d/ghc >--------------------------------------------------------------- commit f3832cfb347a1359a91c5b30ebb4eb7d94dc3f0d Author: Simon Peyton Jones Date: Thu Sep 22 22:18:22 2016 +0100 Fix a bug in occurs checking 1. Trac #1593 exposed a long-standing bug in the occurs checking machinery. When unifying two type variables a ~ b where a /= b, we were assuming that there could be no occurs-check error. But there can: 'a' can occur in b's kind! When the RHS was a non-tyvar we used occurCheckExpand, which /did/ look in kinds, but not when the RHS was a tyvar. This bug has been lurking ever since TypeInType, maybe longer. And it was present both in TcUnify (the on-the-fly unifier), and in TcInteract. I ended up refactoring both so that the tyvar/tyvar path naturally goes through the same occurs-check as non-tyvar rhss. It's simpler and more robust now. One good thing is that both unifiers now share TcType.swapOverVars TcType.canSolveByUnification previously they had different logic for the same goals 2. Fixing this bug exposed another! In T11635 we end up unifying (alpha :: forall k. k->*) ~ (beta :: forall k. k->*) Now that the occurs check is done for tyvars too, we look inside beta's kind. And then reject the program becuase of the forall inside there. But in fact that forall is fine -- it does not count as impredicative polymoprhism. See Note [Checking for foralls] in TcType. 3. All this fuss around occurrence checking forced me to look at TcUnify.checkTauTvUpdate and TcType.occurCheckExpand There's a lot of duplication there, and I managed to elminate quite a bit of it. For example, checkTauTvUpdate called a local 'defer_me'; and then called occurCheckExpand, which then used a very similar 'fast_check'. Things are better, but there is more to do. >--------------------------------------------------------------- f3832cfb347a1359a91c5b30ebb4eb7d94dc3f0d compiler/typecheck/TcCanonical.hs | 154 ++--------- compiler/typecheck/TcInteract.hs | 66 ++--- compiler/typecheck/TcType.hs | 129 ++++++--- compiler/typecheck/TcUnify.hs | 304 ++++++++++++--------- testsuite/tests/polykinds/T12593.hs | 14 + testsuite/tests/polykinds/T12593.stderr | 31 +++ testsuite/tests/polykinds/all.T | 1 + .../tests/typecheck/should_compile/tc141.stderr | 10 +- testsuite/tests/typecheck/should_fail/T9605.stderr | 6 +- .../tests/typecheck/should_fail/tcfail122.stderr | 2 +- utils/haddock | 2 +- 11 files changed, 371 insertions(+), 348 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f3832cfb347a1359a91c5b30ebb4eb7d94dc3f0d From git at git.haskell.org Thu Sep 29 08:37:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:37:06 +0000 (UTC) Subject: [commit: ghc] wip/spj-temp: Add Outputable Report in TcErrors (edec5b3) Message-ID: <20160929083706.85C793A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-temp Link : http://ghc.haskell.org/trac/ghc/changeset/edec5b33b5fc5bebce936decbadbe9df2b7d8074/ghc >--------------------------------------------------------------- commit edec5b33b5fc5bebce936decbadbe9df2b7d8074 Author: Simon Peyton Jones Date: Sun Sep 25 15:48:29 2016 +0100 Add Outputable Report in TcErrors ...just for debug output >--------------------------------------------------------------- edec5b33b5fc5bebce936decbadbe9df2b7d8074 compiler/typecheck/TcErrors.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index b27e073..8f2cfe8 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -216,6 +216,11 @@ data Report , report_relevant_bindings :: [SDoc] } +instance Outputable Report where -- Debugging only + ppr (Report { report_important = imp, report_relevant_bindings = rel }) + = vcat [ text "important:" <+> vcat imp + , text "relevant:" <+> vcat rel ] + {- Note [Error report] The idea is that error msgs are divided into three parts: the main msg, the context block (\"In the second argument of ...\"), and the relevant bindings From git at git.haskell.org Thu Sep 29 08:37:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:37:09 +0000 (UTC) Subject: [commit: ghc] wip/spj-temp: Comments only (bfd1ac5) Message-ID: <20160929083709.4AB643A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-temp Link : http://ghc.haskell.org/trac/ghc/changeset/bfd1ac57535a9229fd55ba22369d8a159bb9392b/ghc >--------------------------------------------------------------- commit bfd1ac57535a9229fd55ba22369d8a159bb9392b Author: Simon Peyton Jones Date: Tue Sep 27 17:16:57 2016 +0100 Comments only >--------------------------------------------------------------- bfd1ac57535a9229fd55ba22369d8a159bb9392b compiler/types/TyCoRep.hs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index a355b85..50d1cba 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2954,6 +2954,7 @@ pprTcApp_help to_type p pp tc tys dflags style pp_tc = ppr tc tys_wo_kinds = suppressInvisibles to_type dflags tc tys + -- See Note [Printing eqauality constraints] mb_saturated_equality | hetero_eq_tc , [k1, k2, t1, t2] <- tys @@ -2964,14 +2965,13 @@ pprTcApp_help to_type p pp tc tys dflags style | otherwise = Nothing + -- See Note [Printing eqauality constraints] homo_eq_tc = tc `hasKey` eqTyConKey -- ~ hetero_eq_tc = tc `hasKey` eqPrimTyConKey -- ~# || tc `hasKey` eqReprPrimTyConKey -- ~R# || tc `hasKey` heqTyConKey -- ~~ - -- This is all a bit ad-hoc, trying to print out the best representation - -- of equalities. If you see a better design, go for it. - + -- See Note [Printing eqauality constraints] print_equality (ki1, ki2, ty1, ty2) | print_eqs = ppr_infix_eq pp_tc @@ -2999,6 +2999,30 @@ pprTcApp_help to_type p pp tc tys dflags style dumpStyle style || debugStyle style +{- Note [Printing equality constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +GHC has a lot of differnent equalities: + ~ Boxed homogeneous Nominal + ~~ Boxed heterogeneous Nominal + ~# Unboxed heterogeneous Nominal + ~R# Unboxed heterogeneous Representational + +This is cofusing to the user, so when priting we usse this +strategy: + +If -fprint-equality-relations or -dppr-debug or we are in + "dump style", then print the relation as-is, which + distinguishes the various different equalities listed + above + +If ...something about heterogeneous equalities + +Ohherwise print 'Coercible' for (~#), and "~" for the others. + +This is all a bit ad-hoc, trying to print out the best representation +of equalities. If you see a better design, go for it. +-} + ------------------ -- | Given a 'TyCon',and the args to which it is applied, -- suppress the args that are implicit From git at git.haskell.org Thu Sep 29 08:37:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:37:12 +0000 (UTC) Subject: [commit: ghc] wip/spj-temp: Fix TcUnify.tc_sub_type_ds (ebbb8cf) Message-ID: <20160929083712.00FC13A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-temp Link : http://ghc.haskell.org/trac/ghc/changeset/ebbb8cffc6f65ce3b37041e619ffc9309d815451/ghc >--------------------------------------------------------------- commit ebbb8cffc6f65ce3b37041e619ffc9309d815451 Author: Simon Peyton Jones Date: Sun Sep 25 15:50:18 2016 +0100 Fix TcUnify.tc_sub_type_ds This patch fixes Trac #12616. There were two separate bugs 1. For some reason, in TcDeriv we switched on -XImpredicativeTypes locally, for the code generated by a 'deriving' clause. But GHC really doesn't support impredicative types, so this is a deeply bogus thing to do. And it interacted with (2) to cause the failure. So I've just removed the local flag setting. Let's see if anything breaks. (If it does, a non-solution is to restore the flag!) 2. In TcUnify.tc_sub_type_ds we were going to some trouble to support co- and contra-variance even for impredicative types. Because of (1) that allowed a unification variable to be unified with a polytype (probably wrongly) and that caused later trouble, in the constraint solver where -XImpredicativeTypes was not on. In effect, -XImpredicativeTypes can't be switched on locally. So this patch just deletes code to fix the bug. I think we should probably nuke -XImpredicativeTypes altogether. >--------------------------------------------------------------- ebbb8cffc6f65ce3b37041e619ffc9309d815451 compiler/typecheck/TcDeriv.hs | 3 +-- compiler/typecheck/TcUnify.hs | 28 +++++++--------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index 0b5f073..342e0c0 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -2272,8 +2272,7 @@ genInst spec@(DS { ds_tvs = tvs, ds_tc = rep_tycon { ib_binds = gen_Newtype_binds loc clas tvs tys rhs_ty , ib_tyvars = map Var.varName tvs -- Scope over bindings , ib_pragmas = [] - , ib_extensions = [ LangExt.ImpredicativeTypes - , LangExt.RankNTypes ] + , ib_extensions = [ LangExt.RankNTypes ] , ib_derived = True } } , emptyBag , Just $ getName $ head $ tyConDataCons rep_tycon ) } diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index b564f9f..b8c7640 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -721,27 +721,13 @@ tc_sub_type_ds eq_orig inst_orig ctxt ty_actual ty_expected ; tc_sub_type_ds eq_orig inst_orig ctxt ty_a' ty_e } Unfilled _ -> unify } - - go ty_a (TyVarTy tv_e) - = do { dflags <- getDynFlags - ; tclvl <- getTcLevel - ; lookup_res <- lookupTcTyVar tv_e - ; case lookup_res of - Filled ty_e' -> - do { traceTc "tcSubTypeDS_NC_O following filled exp meta-tyvar:" - (ppr tv_e <+> text "-->" <+> ppr ty_e') - ; tc_sub_tc_type eq_orig inst_orig ctxt ty_a ty_e' } - Unfilled details - | canUnifyWithPolyType dflags details - && isTouchableMetaTyVar tclvl tv_e -- don't want skolems here - -> unify - - -- We've avoided instantiating ty_actual just in case ty_expected is - -- polymorphic. But we've now assiduously determined that it is *not* - -- polymorphic. So instantiate away. This is needed for e.g. test - -- typecheck/should_compile/T4284. - | otherwise - -> inst_and_unify } + -- Historical note (Sept 16): there was a case here for + -- go ty_a (TyVarTy alpha) + -- which, in the impredicative case unified alpha := ty_a + -- where th_a is a polytype. Not only is this probably bogus (we + -- simply do not have decent story for imprdicative types), but it + -- caused Trac #12616 because (also bizarrely) 'deriving' code had + -- -XImpredicativeTypes on. I deleted the entire case. go (FunTy act_arg act_res) (FunTy exp_arg exp_res) | not (isPredTy act_arg) From git at git.haskell.org Thu Sep 29 08:37:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 08:37:15 +0000 (UTC) Subject: [commit: ghc] wip/spj-temp: Fix desugaring of pattern bindings (again) (07bdbea) Message-ID: <20160929083715.614CB3A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-temp Link : http://ghc.haskell.org/trac/ghc/changeset/07bdbeabb04662a80dea289d0aeb898ff75f23f9/ghc >--------------------------------------------------------------- commit 07bdbeabb04662a80dea289d0aeb898ff75f23f9 Author: Simon Peyton Jones Date: Fri Sep 16 22:33:20 2016 +0100 Fix desugaring of pattern bindings (again) This patch fixes Trac #12595. The problem was with a pattern binding like !x = e For a start it's silly to match that pattern and build a unit tuple (the General Case of mkSelectorBinds); but that's what was happening because the bang fell through to the general case. But for a variable pattern building any auxiliary bindings is stupid. So the patch introduces a new case in mkSelectorBinds for variable patterns. Then it turned out that if 'e' was a plain variable, and moreover was imported GlobalId, then matchSinglePat made it a /bound/ variable, which should never happen. That ultimately caused a linker error, but the original bug was much earlier. >--------------------------------------------------------------- 07bdbeabb04662a80dea289d0aeb898ff75f23f9 compiler/deSugar/DsBinds.hs | 3 +- compiler/deSugar/DsUtils.hs | 136 ++++++++++++--------- compiler/deSugar/Match.hs | 21 +++- testsuite/tests/deSugar/should_run/T12595.hs | 10 ++ .../tests/deSugar/should_run/T12595.stdout | 0 testsuite/tests/deSugar/should_run/all.T | 1 + 6 files changed, 109 insertions(+), 62 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 07bdbeabb04662a80dea289d0aeb898ff75f23f9 From git at git.haskell.org Thu Sep 29 10:35:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 10:35:51 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-tc-branch2' created Message-ID: <20160929103551.9A92E3A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/spj-tc-branch2 Referencing: c2e6bf021468881b1557d77506e3bcf38a1de4ad From git at git.haskell.org Thu Sep 29 10:35:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 10:35:55 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: A collection of type-inference refactorings. (190dbdd) Message-ID: <20160929103555.C7EC73A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/190dbdd08520bde35e4cd1a2002ab2958410c548/ghc >--------------------------------------------------------------- commit 190dbdd08520bde35e4cd1a2002ab2958410c548 Author: Simon Peyton Jones Date: Tue Aug 30 11:00:47 2016 +0100 A collection of type-inference refactorings. 1. Modify TcType.ExpType to make a distinct data type, InferResult for the Infer case, and consequential refactoring. 2. Define a new function TcUnify.fillInferResult, to fill in an InferResult. It uses TcMType.promoteTcType to promote the type to the level of the InferResult. See TcMType Note [Promoting a type] This refactoring is in preparation for an improvement to typechecking pattern bindings, coming next. I flirted with an elaborate scheme to give better higher rank inference, but it was just too complicated. See TcMType Note [Promotion and higher rank types] 3. Add to InferResult a new field ir_inst :: Bool to say whether or not the type used to fill in the InferResult should be deeply instantiated. See TcUnify Note [Deep instantiation of InferResult]. 4. Add a TcLevel to SkolemTvs. This will be useful generally - it's a fast way to see if the type variable escapes when floating (not used yet) - it provides a good consistency check when updating a unification variable (TcMType.writeMetaTyVarRef, the level_check_ok check) I originally had another reason (related to the flirting in (2), but I left it in because it seems like a step in the right direction. 5. Reduce and simplify the plethora of uExpType, tcSubType and related functions in TcUnify. It was such an opaque mess and it's still not great, but it's better. 6. Simplify the uo_expected field of TypeEqOrigin. Richard had generatlised it to a ExpType, but it was almost always a Check type. Now it's back to being a plain TcType which is much easier. 7. Improve error messages by refraining from skolemisation when it's clear that there's an error: see TcUnify Note [Don't skolemise unnecessarily] 8. Type.isPiTy and isForAllTy seem to be missing a coreView check, so I added it All these changes led to quite bit of error message wibbling >--------------------------------------------------------------- 190dbdd08520bde35e4cd1a2002ab2958410c548 compiler/ghci/RtClosureInspect.hs | 2 +- compiler/typecheck/Inst.hs | 4 +- compiler/typecheck/TcBinds.hs | 68 +--- compiler/typecheck/TcErrors.hs | 6 +- compiler/typecheck/TcExpr.hs | 24 +- compiler/typecheck/TcHsSyn.hs | 2 +- compiler/typecheck/TcHsType.hs | 21 +- compiler/typecheck/TcInstDcls.hs | 3 +- compiler/typecheck/TcMType.hs | 324 +++++++++++----- compiler/typecheck/TcMatches.hs | 19 +- compiler/typecheck/TcPat.hs | 34 +- compiler/typecheck/TcPatSyn.hs | 16 +- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcType.hs | 75 ++-- compiler/typecheck/TcUnify.hs | 407 +++++++++++---------- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Type.hs | 2 + compiler/vectorise/Vectorise/Generic/PData.hs | 2 +- testsuite/tests/ado/ado004.stderr | 4 +- .../tests/annotations/should_fail/annfail10.stderr | 12 +- testsuite/tests/driver/T2182.stderr | 32 +- testsuite/tests/gadt/gadt-escape1.stderr | 16 +- testsuite/tests/gadt/gadt13.stderr | 10 +- testsuite/tests/gadt/gadt7.stderr | 18 +- .../tests/ghci.debugger/scripts/break012.stdout | 8 +- .../tests/ghci.debugger/scripts/print022.stdout | 4 +- testsuite/tests/ghci/scripts/T11524a.stdout | 4 +- testsuite/tests/ghci/scripts/T2182ghci.stderr | 10 +- .../tests/indexed-types/should_fail/T12386.hs | 9 + .../tests/indexed-types/should_fail/T12386.stderr | 7 + .../tests/indexed-types/should_fail/T7354.stderr | 8 +- .../tests/parser/should_compile/read014.stderr | 2 +- testsuite/tests/parser/should_fail/T7848.stderr | 3 - .../tests/parser/should_fail/readFail003.stderr | 4 +- .../partial-sigs/should_compile/T10438.stderr | 14 +- .../tests/patsyn/should_compile/T11213.stderr | 2 +- testsuite/tests/patsyn/should_fail/mono.stderr | 4 +- testsuite/tests/perf/compiler/stdout | 29 ++ testsuite/tests/polykinds/T7438.stderr | 16 +- testsuite/tests/rebindable/rebindable6.stderr | 12 +- testsuite/tests/roles/should_compile/T8958.stderr | 5 +- testsuite/tests/th/T11452.stderr | 2 +- testsuite/tests/th/T2222.stderr | 2 +- .../typecheck/should_compile/ExPatFail.stderr | 4 +- .../should_compile/T12427.stderr} | 0 .../tests/typecheck/should_compile/T12427a.stderr | 33 ++ .../tests/typecheck/should_compile/tc141.stderr | 6 +- .../tests/typecheck/should_fail/T10495.stderr | 10 +- .../tests/typecheck/should_fail/T10619.stderr | 18 +- .../tests/typecheck/should_fail/T12177.stderr | 19 +- testsuite/tests/typecheck/should_fail/T3102.hs | 6 +- testsuite/tests/typecheck/should_fail/T3102.stderr | 12 - testsuite/tests/typecheck/should_fail/T7453.stderr | 50 +-- testsuite/tests/typecheck/should_fail/T7734.stderr | 12 +- testsuite/tests/typecheck/should_fail/T8428.stderr | 5 +- testsuite/tests/typecheck/should_fail/T9109.stderr | 10 +- testsuite/tests/typecheck/should_fail/T9318.stderr | 12 +- .../tests/typecheck/should_fail/VtaFail.stderr | 2 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- .../tests/typecheck/should_fail/tcfail002.stderr | 6 +- .../tests/typecheck/should_fail/tcfail004.stderr | 6 +- .../tests/typecheck/should_fail/tcfail005.stderr | 6 +- .../tests/typecheck/should_fail/tcfail013.stderr | 2 +- .../tests/typecheck/should_fail/tcfail014.stderr | 6 +- .../tests/typecheck/should_fail/tcfail018.stderr | 2 +- .../tests/typecheck/should_fail/tcfail032.stderr | 6 +- .../tests/typecheck/should_fail/tcfail099.stderr | 6 +- .../tests/typecheck/should_fail/tcfail104.stderr | 10 +- .../tests/typecheck/should_fail/tcfail140.stderr | 4 +- .../tests/typecheck/should_fail/tcfail181.stderr | 2 +- 70 files changed, 848 insertions(+), 659 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 190dbdd08520bde35e4cd1a2002ab2958410c548 From git at git.haskell.org Thu Sep 29 10:35:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 10:35:58 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Comments and trivial refactoring (3cd3e32) Message-ID: <20160929103558.7C1BB3A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/3cd3e3240459bc836c7983d0e0b5f93d1c935257/ghc >--------------------------------------------------------------- commit 3cd3e3240459bc836c7983d0e0b5f93d1c935257 Author: Simon Peyton Jones Date: Mon Sep 19 10:08:29 2016 +0100 Comments and trivial refactoring >--------------------------------------------------------------- 3cd3e3240459bc836c7983d0e0b5f93d1c935257 compiler/basicTypes/BasicTypes.hs | 2 +- compiler/hsSyn/HsBinds.hs | 4 +++- compiler/simplCore/CoreMonad.hs | 16 ---------------- compiler/simplCore/SimplCore.hs | 16 ++++++++++++++++ compiler/typecheck/TcInstDcls.hs | 6 +++--- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index aab0528..d911a54 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -961,7 +961,7 @@ data InlinePragma -- Note [InlinePragma] -- That is, inl_sat describes the number of *source-code* -- arguments the thing must be applied to. We add on the -- number of implicit, dictionary arguments when making - -- the InlineRule, and don't look at inl_sat further + -- the Unfolding, and don't look at inl_sat further , inl_act :: Activation -- Says during which phases inlining is allowed diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs index 236892e..4878592 100644 --- a/compiler/hsSyn/HsBinds.hs +++ b/compiler/hsSyn/HsBinds.hs @@ -593,6 +593,7 @@ ppr_monobind (AbsBinds { abs_tvs = tyvars, abs_ev_vars = dictvars pprLHsBinds val_binds ppr_monobind (AbsBindsSig { abs_tvs = tyvars , abs_ev_vars = dictvars + , abs_sig_export = poly_id , abs_sig_ev_bind = ev_bind , abs_sig_bind = bind }) = sdocWithDynFlags $ \ dflags -> @@ -600,7 +601,8 @@ ppr_monobind (AbsBindsSig { abs_tvs = tyvars hang (text "AbsBindsSig" <+> brackets (interpp'SP tyvars) <+> brackets (interpp'SP dictvars)) 2 $ braces $ vcat - [ text "Bind:" <+> ppr bind + [ text "Exported type:" <+> pprBndr LetBind poly_id + , text "Bind:" <+> ppr bind , text "Evidence:" <+> ppr ev_bind ] else ppr bind diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 853f5be..a386a28 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -238,22 +238,6 @@ runMaybe (Just x) f = f x runMaybe Nothing _ = CoreDoNothing {- -Note [RULEs enabled in SimplGently] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -RULES are enabled when doing "gentle" simplification. Two reasons: - - * We really want the class-op cancellation to happen: - op (df d1 d2) --> $cop3 d1 d2 - because this breaks the mutual recursion between 'op' and 'df' - - * I wanted the RULE - lift String ===> ... - to work in Template Haskell when simplifying - splices, so we get simpler code for literal strings - -But watch out: list fusion can prevent floating. So use phase control -to switch off those rules until after floating. - ************************************************************************ * * diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 8bc0392..0af167e 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -367,6 +367,22 @@ addPluginPasses builtin_passes #endif {- +Note [RULEs enabled in SimplGently] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +RULES are enabled when doing "gentle" simplification. Two reasons: + + * We really want the class-op cancellation to happen: + op (df d1 d2) --> $cop3 d1 d2 + because this breaks the mutual recursion between 'op' and 'df' + + * I wanted the RULE + lift String ===> ... + to work in Template Haskell when simplifying + splices, so we get simpler code for literal strings + +But watch out: list fusion can prevent floating. So use phase control +to switch off those rules until after floating. + ************************************************************************ * * The CoreToDo interpreter diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index fb567d2..d9722d3 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -1316,15 +1316,15 @@ tcMethodBody clas tyvars dfun_ev_vars inst_tys -- Substitute the local_meth_name for the binder -- NB: the binding is always a FunBind - ; global_meth_id <- addInlinePrags global_meth_id prags - ; spec_prags <- tcSpecPrags global_meth_id prags - -- taking instance signature into account might change the type of -- the local_meth_id ; (meth_implic, ev_binds_var, tc_bind) <- checkInstConstraints $ tcMethodBodyHelp sig_fn sel_id local_meth_id (L bind_loc lm_bind) + ; global_meth_id <- addInlinePrags global_meth_id prags + ; spec_prags <- tcSpecPrags global_meth_id prags + ; let specs = mk_meth_spec_prags global_meth_id spec_inst_prags spec_prags export = ABE { abe_poly = global_meth_id , abe_mono = local_meth_id From git at git.haskell.org Thu Sep 29 10:36:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 10:36:01 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Test Trac #12507 (03e6959) Message-ID: <20160929103601.B35FF3A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/03e69590fb6834bf3997c02148f0e6313749b682/ghc >--------------------------------------------------------------- commit 03e69590fb6834bf3997c02148f0e6313749b682 Author: Simon Peyton Jones Date: Wed Sep 21 15:51:52 2016 +0100 Test Trac #12507 This is now working apparently. It relates to when a polymorphic function gets instantiated, under some implicit paramter bindings. >--------------------------------------------------------------- 03e69590fb6834bf3997c02148f0e6313749b682 testsuite/tests/typecheck/should_compile/T12507.hs | 16 ++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_compile/T12507.hs b/testsuite/tests/typecheck/should_compile/T12507.hs new file mode 100644 index 0000000..b4cfd0e --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12507.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE GADTs, ConstraintKinds, Rank2Types, ImplicitParams #-} + +module T12507 where + +data Rec fields where + Rec :: fields => Rec fields + +qn :: Rec fields -> (fields => r) -> r +qn Rec e = e + +record :: Rec (?a :: Int, ?b :: String) +record = Rec where ?a=42 + ?b="hey" + +access :: Int +access = qn record ?a diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 79953e5..37e2369 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -543,4 +543,4 @@ test('T12466', normal, compile, ['']) test('T12466a', normal, compile, ['']) test('T12427a', normal, compile_fail, ['']) test('T12427b', normal, compile, ['']) - +test('T12507', normal, compile, ['']) From git at git.haskell.org Thu Sep 29 10:36:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 10:36:05 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Refactor typechecking of pattern bindings (21bf35a) Message-ID: <20160929103605.3F90D3A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/21bf35ad9eee14364982bba821c705457d16f478/ghc >--------------------------------------------------------------- commit 21bf35ad9eee14364982bba821c705457d16f478 Author: Simon Peyton Jones Date: Wed Aug 31 09:28:39 2016 +0100 Refactor typechecking of pattern bindings This patch fixes a regression introduced, post 8.0.1, by this major commit: commit 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72 Author: Simon Peyton Jones Date: Sat Jun 11 23:49:27 2016 +0100 Improve typechecking of let-bindings This major commit was initially triggered by #11339, but it spiraled into a major review of the way in which type signatures for bindings are handled, especially partial type signatures. I didn't get the typechecking of pattern bindings right, leading to Trac #12427. In fixing this I found that this program doesn't work: data T where T :: a -> ((forall b. [b]->[b]) -> Int) -> T h1 y = case y of T _ v -> v Works in 7.10, but not in 8.0.1. There's a happy ending. I found a way to fix this, and improve pattern bindings too. Not only does this fix #12427, but it also allows In particular,we now can accept data T where MkT :: a -> Int -> T ... let { MkT _ q = t } in ... Previously this elicited "my head exploded" but it's really fine since q::Int. The approach is described in detail in TcBinds Note [Typechecking pattern bindings] Super cool. And not even a big patch! >--------------------------------------------------------------- 21bf35ad9eee14364982bba821c705457d16f478 compiler/typecheck/TcBinds.hs | 226 +++++++++++++-------- compiler/typecheck/TcPat.hs | 187 +++++++++-------- .../tests/typecheck/should_compile/T12427a.hs | 40 ++++ .../tests/typecheck/should_compile/T12427b.hs | 20 ++ testsuite/tests/typecheck/should_compile/all.T | 3 + 5 files changed, 299 insertions(+), 177 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 21bf35ad9eee14364982bba821c705457d16f478 From git at git.haskell.org Thu Sep 29 10:36:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 10:36:08 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: More typechecker refactoring (e9caca9) Message-ID: <20160929103608.03A6D3A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/e9caca936fc0ab0b41eb2d9c3bd3a5cbbccf7910/ghc >--------------------------------------------------------------- commit e9caca936fc0ab0b41eb2d9c3bd3a5cbbccf7910 Author: Simon Peyton Jones Date: Tue Sep 20 23:31:07 2016 +0100 More typechecker refactoring This patch fixes one (un-reported) bug, and does a useful tidy-ups in the type checker 1. Kill off tcs_used_tcvs. Its purpose is to track the givens used by wanted constraints. For dictionaries etc we do that via the free vars of the /bindings/ in the implication constraint ic_binds. But for coercions we just do update-in-place in the type, rather than generating a binding. So we need something analogous to bindings, to track what coercions we have added. That was the purpose of tcs_used_tcvs. But it only worked for a /single/ iteration, whereas we may have multiple iterations of solving an implication. Look at (the old) 'setImplicationStatus'. If the constraint is unsolved, it just drops the used_tvs on the floor. If it becomes solved next time round, we'll pick up coercions used in that round, but ignore ones used in the first round. There was an outright bug. Result = (potentialy) bogus unused-constraint errors. Constructing a case where this actually happens seems quite trick so I did not do so. Solution: expand EvBindsVar to include the (free vars of the) coercions, so that the coercions are tracked in essentially the same way as the bindings. This turned out to be much simpler. Less code, more correct. 2. Make the ic_binds field in an implication have type ic_binds :: EvBindsVar instead of (as previously) ic_binds :: Maybe EvBindsVar This is notably simpler, and faster to use -- less testing of the Maybe. But in the occaional situation where we don't have anywhere to put the bindings, the belt-and-braces error check is lost. So I put it back as an ASSERT in 'setImplicationStatus' (see the use of 'termEvidenceAllowed') >--------------------------------------------------------------- e9caca936fc0ab0b41eb2d9c3bd3a5cbbccf7910 compiler/typecheck/TcErrors.hs | 38 ++++++------ compiler/typecheck/TcEvidence.hs | 33 +++++++++-- compiler/typecheck/TcHsSyn.hs | 5 +- compiler/typecheck/TcInstDcls.hs | 4 +- compiler/typecheck/TcPluginM.hs | 16 +---- compiler/typecheck/TcRnDriver.hs | 9 +-- compiler/typecheck/TcRnMonad.hs | 28 +++++---- compiler/typecheck/TcRnTypes.hs | 27 +++++---- compiler/typecheck/TcSMonad.hs | 124 ++++++++++++++++----------------------- compiler/typecheck/TcSimplify.hs | 58 +++++++++--------- compiler/typecheck/TcUnify.hs | 2 +- 11 files changed, 170 insertions(+), 174 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e9caca936fc0ab0b41eb2d9c3bd3a5cbbccf7910 From git at git.haskell.org Thu Sep 29 10:36:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 10:36:10 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Make TcLevel increase by 1 not 2 (a9c4e4d) Message-ID: <20160929103610.AA4443A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/a9c4e4d8b7815ca54922c0eb78e201a7eb8b00f2/ghc >--------------------------------------------------------------- commit a9c4e4d8b7815ca54922c0eb78e201a7eb8b00f2 Author: Simon Peyton Jones Date: Tue Sep 20 23:29:51 2016 +0100 Make TcLevel increase by 1 not 2 Make the TcLevel of a flatten-meta-var be always zero. See TcType.fmvTcLevel. This allows the levels of implication constraints to to up by 1 each time instead of 2, which is less confusing. This change has no effect on type checking. >--------------------------------------------------------------- a9c4e4d8b7815ca54922c0eb78e201a7eb8b00f2 compiler/typecheck/TcType.hs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 2970821..d955a80 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -655,18 +655,13 @@ Note [TcLevel assignment] ~~~~~~~~~~~~~~~~~~~~~~~~~ We arrange the TcLevels like this + 0 Level for flatten meta-vars 1 Top level - 2 Flatten-meta-vars of level 3 - 3 First-level implication constraints - 4 Flatten-meta-vars of level 5 - 5 Second-level implication constraints + 2 First-level implication constraints + 3 Second-level implication constraints ...etc... -The even-numbered levels are for the flatten-meta-variables assigned -at the next level in. Eg for a second-level implication conststraint -(level 5), the flatten meta-vars are level 4, which makes them untouchable. -The flatten meta-vars could equally well all have level 0, or just NotALevel -since they do not live across implications. +The flatten meta-vars are all at level 0, just to make them untouchable. -} maxTcLevel :: TcLevel -> TcLevel -> TcLevel @@ -674,7 +669,7 @@ maxTcLevel (TcLevel a) (TcLevel b) = TcLevel (a `max` b) fmvTcLevel :: TcLevel -> TcLevel -- See Note [TcLevel assignment] -fmvTcLevel (TcLevel n) = TcLevel (n-1) +fmvTcLevel _ = TcLevel 0 topTcLevel :: TcLevel -- See Note [TcLevel assignment] @@ -686,7 +681,7 @@ isTopTcLevel _ = False pushTcLevel :: TcLevel -> TcLevel -- See Note [TcLevel assignment] -pushTcLevel (TcLevel us) = TcLevel (us + 2) +pushTcLevel (TcLevel us) = TcLevel (us + 1) strictlyDeeperThan :: TcLevel -> TcLevel -> Bool strictlyDeeperThan (TcLevel tv_tclvl) (TcLevel ctxt_tclvl) From git at git.haskell.org Thu Sep 29 10:36:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 10:36:13 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Refactor occurrence-check logic (c2e6bf0) Message-ID: <20160929103613.77BD23A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/c2e6bf021468881b1557d77506e3bcf38a1de4ad/ghc >--------------------------------------------------------------- commit c2e6bf021468881b1557d77506e3bcf38a1de4ad Author: Simon Peyton Jones Date: Sun Sep 25 03:50:13 2016 +0100 Refactor occurrence-check logic This patch does two related things * Combines the occurrence-check logic in the on-the-fly unifier with that in the constraint solver. They are both doing the same job, after all. The resulting code is now in TcUnify: metaTyVarUpdateOK occCheckExpand occCheckForErrors (called in TcErrors) * In doing this I disovered checking for family-free-ness and foralls can be unnecessarily inefficient, because it expands type synonyms. It's easy just to cache this info in the type syononym TyCon, which I am now doing. >--------------------------------------------------------------- c2e6bf021468881b1557d77506e3bcf38a1de4ad compiler/basicTypes/DataCon.hs | 10 +- compiler/iface/TcIface.hs | 2 +- compiler/prelude/TysPrim.hs | 2 + compiler/prelude/TysWiredIn.hs | 6 +- compiler/typecheck/TcCanonical.hs | 21 +- compiler/typecheck/TcErrors.hs | 7 +- compiler/typecheck/TcFlatten.hs | 49 ++-- compiler/typecheck/TcTyClsDecls.hs | 2 +- compiler/typecheck/TcType.hs | 220 +-------------- compiler/typecheck/TcUnify.hs | 460 +++++++++++++++++++++++++------ compiler/types/TyCon.hs | 27 +- compiler/types/Type.hs | 25 +- compiler/vectorise/Vectorise/Type/Env.hs | 2 +- 13 files changed, 481 insertions(+), 352 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c2e6bf021468881b1557d77506e3bcf38a1de4ad From git at git.haskell.org Thu Sep 29 15:04:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 15:04:10 +0000 (UTC) Subject: [commit: ghc] master: Check.hs: Use actual import lists instead of comments (f21eedb) Message-ID: <20160929150410.EE3183A33A@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f21eedbc223c33b71ba323a44c25fcd512f61b52/ghc >--------------------------------------------------------------- commit f21eedbc223c33b71ba323a44c25fcd512f61b52 Author: Ömer Sinan Ağacan Date: Thu Sep 29 11:03:24 2016 -0400 Check.hs: Use actual import lists instead of comments >--------------------------------------------------------------- f21eedbc223c33b71ba323a44c25fcd512f61b52 compiler/deSugar/Check.hs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 6ee5bff..0a7706c 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -33,20 +33,19 @@ import Util import Outputable import FastString -import DsMonad -- DsM, initTcDsForSolver, getDictsDs -import TcSimplify -- tcCheckSatisfiability -import TcType -- toTcType, toTcTypeBag +import DsMonad +import TcSimplify (tcCheckSatisfiability) +import TcType (toTcType, isStringTy, isIntTy, isWordTy) import Bag import ErrUtils -import MonadUtils -- MonadIO -import Var -- EvVar +import Var (EvVar) import Type import UniqSupply -import DsGRHSs -- isTrueLHsExpr +import DsGRHSs (isTrueLHsExpr) -import Data.List -- find -import Data.Maybe -- isNothing, isJust, fromJust -import Control.Monad -- liftM3, forM +import Data.List (find) +import Data.Maybe (isJust) +import Control.Monad (forM, when, forM_) import Coercion import TcEvidence import IOEnv From git at git.haskell.org Thu Sep 29 17:22:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 17:22:22 +0000 (UTC) Subject: [commit: ghc] wip/T12626: Replace foldl App by mkApps everywhere (3e3d964) Message-ID: <20160929172222.6BAFF3A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12626 Link : http://ghc.haskell.org/trac/ghc/changeset/3e3d9644365a7f9e614b97a957b8fdfc6d6c877a/ghc >--------------------------------------------------------------- commit 3e3d9644365a7f9e614b97a957b8fdfc6d6c877a Author: Joachim Breitner Date: Thu Sep 29 13:16:01 2016 -0400 Replace foldl App by mkApps everywhere >--------------------------------------------------------------- 3e3d9644365a7f9e614b97a957b8fdfc6d6c877a compiler/coreSyn/CoreArity.hs | 2 +- compiler/coreSyn/CoreSubst.hs | 2 +- compiler/deSugar/DsMeta.hs | 2 +- compiler/simplCore/SetLevels.hs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs index f5e7673..1ab50b4 100644 --- a/compiler/coreSyn/CoreArity.hs +++ b/compiler/coreSyn/CoreArity.hs @@ -888,7 +888,7 @@ etaExpand n orig_expr -- See Note [Eta expansion and source notes] (expr', args) = collectArgs expr (ticks, expr'') = stripTicksTop tickishFloatable expr' - sexpr = foldl App expr'' args + sexpr = mkApps expr'' args retick expr = foldr mkTick expr ticks -- Wrapper Unwrapper diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs index ffd8c2a..81af530 100644 --- a/compiler/coreSyn/CoreSubst.hs +++ b/compiler/coreSyn/CoreSubst.hs @@ -1008,7 +1008,7 @@ simple_app subst (Tick t e) as | t `tickishScopesLike` SoftScope = mkTick t $ simple_app subst e as simple_app subst e as - = foldl App (simple_opt_expr subst e) as + = mkApps (simple_opt_expr subst e) as ---------------------- simple_opt_bind,simple_opt_bind' :: Subst -> CoreBind -> (Subst, Maybe CoreBind) diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 9395d35..7756b8d 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -1774,7 +1774,7 @@ unC (MkC x) = x rep2 :: Name -> [ CoreExpr ] -> DsM (Core a) rep2 n xs = do { id <- dsLookupGlobalId n - ; return (MkC (foldl App (Var id) xs)) } + ; return (MkC (mkApps (Var id) xs)) } dataCon' :: Name -> [CoreExpr] -> DsM (Core a) dataCon' n args = do { id <- dsLookupDataCon n diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index c28be3a..9c37434 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -316,7 +316,7 @@ lvlExpr env expr@(_, AnnApp _ _) = do let (lapp, rargs) = left (n_val_args - arity) expr [] rargs' <- mapM (lvlMFE False env) rargs lapp' <- lvlMFE False env lapp - return (foldl App lapp' rargs') + return (mkApps lapp' rargs') where n_val_args = count (isValArg . deAnnotate) args arity = idArity f @@ -335,7 +335,7 @@ lvlExpr env expr@(_, AnnApp _ _) = do _otherwise -> do args' <- mapM (lvlMFE False env) args fun' <- lvlExpr env fun - return (foldl App fun' args') + return (mkApps fun' args') -- We don't split adjacent lambdas. That is, given -- \x y -> (x+1,y) From git at git.haskell.org Thu Sep 29 21:06:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 21:06:31 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T12618' created Message-ID: <20160929210631.A367B3A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T12618 Referencing: e320acb126d4783561ecbcb347e205a4ebc7e206 From git at git.haskell.org Thu Sep 29 21:06:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 21:06:34 +0000 (UTC) Subject: [commit: ghc] wip/T12618: Introduce ConApp to Core (dead code as of yet) (e320acb) Message-ID: <20160929210634.875803A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12618 Link : http://ghc.haskell.org/trac/ghc/changeset/e320acb126d4783561ecbcb347e205a4ebc7e206/ghc >--------------------------------------------------------------- commit e320acb126d4783561ecbcb347e205a4ebc7e206 Author: Joachim Breitner Date: Thu Sep 29 16:56:56 2016 -0400 Introduce ConApp to Core (dead code as of yet) This is the first step towards #12618: It adds the data constructor and then fixes all problems due to incomplete patterns, essentially preparing the complete compiler for the eventual use of this variant. Because no where a ConApp is created, this should not yet have any effect. Care is taken to not take shortcuts via the data con worker id, as eventually, there will be no data con worker any more. There are a few unclear spots, marked with "TODO #12618". Input is appreciated. These are currently: * CoreLint: Remove a check from the App case that will only be relevant occurring in the ConApp case later * Interface files. I need input as to how to properly serialize and deserialize the reference to the DataCon. * simplExprF1: This case became very easy. I might have overlooked something else happening to arguments, as I read and simplified the code that handled App. Second pairs of eyes welcome. * ruleCheck: There can be no rules attached to data constructors, can there? * scExp: Can a datacon be in scSubstId? * dmdAnal: How to get the idStrictness equivalent of the worker? Or is there never something useful to be said about the strictness signature of an constructor? (Because strictness annotations are taken care of by the wrapper? >--------------------------------------------------------------- e320acb126d4783561ecbcb347e205a4ebc7e206 compiler/codeGen/StgCmmEnv.hs | 1 - compiler/coreSyn/CoreFVs.hs | 14 +++++++ compiler/coreSyn/CoreLint.hs | 11 +++++ compiler/coreSyn/CorePrep.hs | 17 ++++++++ compiler/coreSyn/CoreSeq.hs | 1 + compiler/coreSyn/CoreStats.hs | 2 + compiler/coreSyn/CoreSubst.hs | 40 ++++++++++-------- compiler/coreSyn/CoreSyn.hs | 4 ++ compiler/coreSyn/CoreTidy.hs | 15 +++---- compiler/coreSyn/CoreUnfold.hs | 5 +++ compiler/coreSyn/CoreUtils.hs | 1 + compiler/coreSyn/PprCore.hs | 4 ++ compiler/coreSyn/TrieMap.hs | 68 ++++++++++++++++++++----------- compiler/iface/IfaceSyn.hs | 46 +++++++++++++-------- compiler/iface/MkIface.hs | 21 +++++----- compiler/iface/TcIface.hs | 3 ++ compiler/main/TidyPgm.hs | 1 + compiler/nativeGen/RegAlloc/Graph/Main.hs | 3 ++ compiler/nativeGen/RegAlloc/Liveness.hs | 10 ++--- compiler/simplCore/CSE.hs | 1 + compiler/simplCore/CallArity.hs | 26 +++++++++--- compiler/simplCore/FloatIn.hs | 19 +++++++++ compiler/simplCore/FloatOut.hs | 8 ++++ compiler/simplCore/LiberateCase.hs | 1 + compiler/simplCore/OccurAnal.hs | 7 ++++ compiler/simplCore/SAT.hs | 12 ++++++ compiler/simplCore/SetLevels.hs | 6 ++- compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 4 ++ compiler/specialise/Rules.hs | 2 + compiler/specialise/SpecConstr.hs | 4 ++ compiler/specialise/Specialise.hs | 3 ++ compiler/stranal/DmdAnal.hs | 25 ++++++++++++ compiler/stranal/WorkWrap.hs | 3 ++ compiler/vectorise/Vectorise/Exp.hs | 13 ++++++ 35 files changed, 312 insertions(+), 90 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e320acb126d4783561ecbcb347e205a4ebc7e206 From git at git.haskell.org Thu Sep 29 21:18:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 29 Sep 2016 21:18:32 +0000 (UTC) Subject: [commit: ghc] wip/T12618: Introduce ConApp to Core (dead code as of yet) (db9d1d6) Message-ID: <20160929211832.6D8513A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12618 Link : http://ghc.haskell.org/trac/ghc/changeset/db9d1d6eaa69d8cd45ec406970558d5a8ae189a7/ghc >--------------------------------------------------------------- commit db9d1d6eaa69d8cd45ec406970558d5a8ae189a7 Author: Joachim Breitner Date: Thu Sep 29 16:56:56 2016 -0400 Introduce ConApp to Core (dead code as of yet) This is the first step towards #12618: It adds the data constructor and then fixes all problems due to incomplete patterns, essentially preparing the complete compiler for the eventual use of this variant. Because no where a ConApp is created, this should not yet have any effect. Care is taken to not take shortcuts via the data con worker id, as eventually, there will be no data con worker any more. There are a few unclear spots, marked with "TODO #12618". Input is appreciated. These are currently: * CoreLint: Remove a check from the App case that will only be relevant occurring in the ConApp case later * simplExprF1: This case became very easy. I might have overlooked something else happening to arguments, as I read and simplified the code that handled App. Second pairs of eyes welcome. * ruleCheck: There can be no rules attached to data constructors, can there? * scExp: Can a datacon be in scSubstId? * dmdAnal: How to get the idStrictness equivalent of the worker? Or is there never something useful to be said about the strictness signature of an constructor? (Because strictness annotations are taken care of by the wrapper? >--------------------------------------------------------------- db9d1d6eaa69d8cd45ec406970558d5a8ae189a7 compiler/codeGen/StgCmmEnv.hs | 1 - compiler/coreSyn/CoreFVs.hs | 14 +++++++ compiler/coreSyn/CoreLint.hs | 11 +++++ compiler/coreSyn/CorePrep.hs | 17 ++++++++ compiler/coreSyn/CoreSeq.hs | 1 + compiler/coreSyn/CoreStats.hs | 2 + compiler/coreSyn/CoreSubst.hs | 40 ++++++++++-------- compiler/coreSyn/CoreSyn.hs | 4 ++ compiler/coreSyn/CoreTidy.hs | 15 +++---- compiler/coreSyn/CoreUnfold.hs | 5 +++ compiler/coreSyn/CoreUtils.hs | 1 + compiler/coreSyn/PprCore.hs | 4 ++ compiler/coreSyn/TrieMap.hs | 68 ++++++++++++++++++++----------- compiler/iface/IfaceSyn.hs | 45 ++++++++++++-------- compiler/iface/MkIface.hs | 21 +++++----- compiler/iface/TcIface.hs | 3 ++ compiler/main/TidyPgm.hs | 1 + compiler/nativeGen/RegAlloc/Graph/Main.hs | 3 ++ compiler/nativeGen/RegAlloc/Liveness.hs | 10 ++--- compiler/simplCore/CSE.hs | 1 + compiler/simplCore/CallArity.hs | 26 +++++++++--- compiler/simplCore/FloatIn.hs | 19 +++++++++ compiler/simplCore/FloatOut.hs | 8 ++++ compiler/simplCore/LiberateCase.hs | 1 + compiler/simplCore/OccurAnal.hs | 7 ++++ compiler/simplCore/SAT.hs | 12 ++++++ compiler/simplCore/SetLevels.hs | 6 ++- compiler/simplCore/SimplUtils.hs | 1 + compiler/simplCore/Simplify.hs | 4 ++ compiler/specialise/Rules.hs | 2 + compiler/specialise/SpecConstr.hs | 4 ++ compiler/specialise/Specialise.hs | 3 ++ compiler/stranal/DmdAnal.hs | 25 ++++++++++++ compiler/stranal/WorkWrap.hs | 3 ++ compiler/vectorise/Vectorise/Exp.hs | 13 ++++++ 35 files changed, 311 insertions(+), 90 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc db9d1d6eaa69d8cd45ec406970558d5a8ae189a7 From git at git.haskell.org Fri Sep 30 11:54:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 11:54:21 +0000 (UTC) Subject: [commit: ghc] master: A bit of tracing about flattening (0b533a2) Message-ID: <20160930115421.C32843A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0b533a2597a8c5d5b623a008378af39826b009db/ghc >--------------------------------------------------------------- commit 0b533a2597a8c5d5b623a008378af39826b009db Author: Simon Peyton Jones Date: Sat Sep 24 04:42:18 2016 +0100 A bit of tracing about flattening >--------------------------------------------------------------- 0b533a2597a8c5d5b623a008378af39826b009db compiler/typecheck/TcFlatten.hs | 18 +++++++++++++----- compiler/typecheck/TcSMonad.hs | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 4e02e99..b575c51 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -778,7 +778,10 @@ yields a better error message anyway.) flatten :: FlattenMode -> CtEvidence -> TcType -> TcS (Xi, TcCoercion) flatten mode ev ty - = runFlatten mode ev (flatten_one ty) + = do { traceTcS "flatten {" (ppr ty) + ; (ty', co) <- runFlatten mode ev (flatten_one ty) + ; traceTcS "flatten }" (ppr ty') + ; return (ty', co) } flattenManyNom :: CtEvidence -> [TcType] -> TcS ([Xi], [TcCoercion]) -- Externally-callable, hence runFlatten @@ -787,7 +790,10 @@ flattenManyNom :: CtEvidence -> [TcType] -> TcS ([Xi], [TcCoercion]) -- ctEvFlavour ev = Nominal -- and we want to flatten all at nominal role flattenManyNom ev tys - = runFlatten FM_FlattenAll ev (flatten_many_nom tys) + = do { traceTcS "flatten_many {" (vcat (map ppr tys)) + ; (tys', cos) <- runFlatten FM_FlattenAll ev (flatten_many_nom tys) + ; traceTcS "flatten }" (vcat (map ppr tys')) + ; return (tys', cos) } {- ********************************************************************* * * @@ -943,7 +949,7 @@ flatten_one (AppTy ty1 ty2) role2 co2 xi2 ty2 role1 ) } -- output should match fmode -flatten_one (TyConApp tc tys) +flatten_one ty@(TyConApp tc tys) -- Expand type synonyms that mention type families -- on the RHS; see Note [Flattening synonyms] | Just (tenv, rhs, tys') <- expandSynTyCon_maybe tc tys @@ -952,8 +958,10 @@ flatten_one (TyConApp tc tys) ; let used_tcs = tyConsOfType rhs ; case mode of FM_FlattenAll | anyNameEnv isTypeFamilyTyCon used_tcs - -> flatten_one expanded_ty - _ -> flatten_ty_con_app tc tys } + -> do { traceFlat "flatten_one syn expand" (ppr ty $$ ppr used_tcs) + ; flatten_one expanded_ty } + _ -> do { traceFlat "flatten_one syn no expand" (ppr ty) + ; flatten_ty_con_app tc tys } } -- Otherwise, it's a type function application, and we have to -- flatten it away as well, and generate a new given equality constraint diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index fb03ec2..18b6a69 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -3085,8 +3085,19 @@ matchFam tycon args = wrapTcS $ matchFamTcM tycon args matchFamTcM :: TyCon -> [Type] -> TcM (Maybe (Coercion, TcType)) -- Given (F tys) return (ty, co), where co :: F tys ~ ty matchFamTcM tycon args - = do { fam_envs <- FamInst.tcGetFamInstEnvs - ; return $ reduceTyFamApp_maybe fam_envs Nominal tycon args } + = do { fam_envs@(_,lcl) <- FamInst.tcGetFamInstEnvs + ; let match_fam_result + = reduceTyFamApp_maybe fam_envs Nominal tycon args + ; TcM.traceTc "matchFamTcM" $ + vcat [ text "Matching:" <+> ppr (mkTyConApp tycon args) + , ppr_res match_fam_result + , text "Lcl fam env:" <+> ppr lcl ] + ; return match_fam_result } + where + ppr_res Nothing = text "Match failed" + ppr_res (Just (co,ty)) = hang (text "Match succeeded:") + 2 (vcat [ text "Rewrites to:" <+> ppr ty + , text "Coercion:" <+> ppr co ]) {- Note [Residual implications] From git at git.haskell.org Fri Sep 30 11:54:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 11:54:25 +0000 (UTC) Subject: [commit: ghc] master: Fix desugaring of pattern bindings (again) (2fbfbca) Message-ID: <20160930115425.7DBF43A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fbfbca2d12a8e9a09627529cf4f8284b19023ff/ghc >--------------------------------------------------------------- commit 2fbfbca2d12a8e9a09627529cf4f8284b19023ff Author: Simon Peyton Jones Date: Fri Sep 16 22:33:20 2016 +0100 Fix desugaring of pattern bindings (again) This patch fixes Trac #12595. The problem was with a pattern binding like !x = e For a start it's silly to match that pattern and build a unit tuple (the General Case of mkSelectorBinds); but that's what was happening because the bang fell through to the general case. But for a variable pattern building any auxiliary bindings is stupid. So the patch introduces a new case in mkSelectorBinds for variable patterns. Then it turned out that if 'e' was a plain variable, and moreover was imported GlobalId, then matchSinglePat made it a /bound/ variable, which should never happen. That ultimately caused a linker error, but the original bug was much earlier. >--------------------------------------------------------------- 2fbfbca2d12a8e9a09627529cf4f8284b19023ff compiler/deSugar/DsBinds.hs | 3 +- compiler/deSugar/DsUtils.hs | 136 ++++++++++++--------- compiler/deSugar/Match.hs | 21 +++- testsuite/tests/deSugar/should_run/T12595.hs | 10 ++ .../tests/deSugar/should_run/T12595.stdout | 0 testsuite/tests/deSugar/should_run/all.T | 1 + 6 files changed, 109 insertions(+), 62 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2fbfbca2d12a8e9a09627529cf4f8284b19023ff From git at git.haskell.org Fri Sep 30 11:54:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 11:54:29 +0000 (UTC) Subject: [commit: ghc] master: Fix a bug in occurs checking (66a8c19) Message-ID: <20160930115429.3C5E73A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/66a8c194520aadcaa0482736f3fdd4d2f31a5586/ghc >--------------------------------------------------------------- commit 66a8c194520aadcaa0482736f3fdd4d2f31a5586 Author: Simon Peyton Jones Date: Thu Sep 22 22:18:22 2016 +0100 Fix a bug in occurs checking 1. Trac #12593 exposed a long-standing bug in the occurs checking machinery. When unifying two type variables a ~ b where a /= b, we were assuming that there could be no occurs-check error. But there can: 'a' can occur in b's kind! When the RHS was a non-tyvar we used occurCheckExpand, which /did/ look in kinds, but not when the RHS was a tyvar. This bug has been lurking ever since TypeInType, maybe longer. And it was present both in TcUnify (the on-the-fly unifier), and in TcInteract. I ended up refactoring both so that the tyvar/tyvar path naturally goes through the same occurs-check as non-tyvar rhss. It's simpler and more robust now. One good thing is that both unifiers now share TcType.swapOverVars TcType.canSolveByUnification previously they had different logic for the same goals 2. Fixing this bug exposed another! In T11635 we end up unifying (alpha :: forall k. k->*) ~ (beta :: forall k. k->*) Now that the occurs check is done for tyvars too, we look inside beta's kind. And then reject the program becuase of the forall inside there. But in fact that forall is fine -- it does not count as impredicative polymoprhism. See Note [Checking for foralls] in TcType. 3. All this fuss around occurrence checking forced me to look at TcUnify.checkTauTvUpdate and TcType.occurCheckExpand There's a lot of duplication there, and I managed to elminate quite a bit of it. For example, checkTauTvUpdate called a local 'defer_me'; and then called occurCheckExpand, which then used a very similar 'fast_check'. Things are better, but there is more to do. >--------------------------------------------------------------- 66a8c194520aadcaa0482736f3fdd4d2f31a5586 compiler/typecheck/TcCanonical.hs | 154 ++--------- compiler/typecheck/TcInteract.hs | 66 ++--- compiler/typecheck/TcType.hs | 129 ++++++--- compiler/typecheck/TcUnify.hs | 304 ++++++++++++--------- testsuite/tests/polykinds/T12593.hs | 14 + testsuite/tests/polykinds/T12593.stderr | 31 +++ testsuite/tests/polykinds/all.T | 1 + .../tests/typecheck/should_compile/tc141.stderr | 10 +- testsuite/tests/typecheck/should_fail/T9605.stderr | 6 +- .../tests/typecheck/should_fail/tcfail122.stderr | 2 +- 10 files changed, 370 insertions(+), 347 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 66a8c194520aadcaa0482736f3fdd4d2f31a5586 From git at git.haskell.org Fri Sep 30 11:54:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 11:54:32 +0000 (UTC) Subject: [commit: ghc] master: Add Outputable Report in TcErrors (3012c43) Message-ID: <20160930115432.150823A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3012c431e466c55fccff0dd916987a9478cb1ae3/ghc >--------------------------------------------------------------- commit 3012c431e466c55fccff0dd916987a9478cb1ae3 Author: Simon Peyton Jones Date: Sun Sep 25 15:48:29 2016 +0100 Add Outputable Report in TcErrors ...just for debug output >--------------------------------------------------------------- 3012c431e466c55fccff0dd916987a9478cb1ae3 compiler/typecheck/TcErrors.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index b27e073..d49ca64 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -216,6 +216,11 @@ data Report , report_relevant_bindings :: [SDoc] } +instance Outputable Report where -- Debugging only + ppr (Report { report_important = imp, report_relevant_bindings = rel }) + = vcat [ text "important:" <+> vcat imp + , text "relevant:" <+> vcat rel ] + {- Note [Error report] The idea is that error msgs are divided into three parts: the main msg, the context block (\"In the second argument of ...\"), and the relevant bindings From git at git.haskell.org Fri Sep 30 11:54:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 11:54:35 +0000 (UTC) Subject: [commit: ghc] master: Fix impredicativity (again) (b612da6) Message-ID: <20160930115435.E128B3A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b612da667fe8fa5277fc78e972a86d4b35f98364/ghc >--------------------------------------------------------------- commit b612da667fe8fa5277fc78e972a86d4b35f98364 Author: Simon Peyton Jones Date: Sun Sep 25 15:50:18 2016 +0100 Fix impredicativity (again) This patch fixes Trac #12616. Dignosis. In TcUnify.tc_sub_type_ds we were going to some trouble to support co- and contra-variance even for impredicative types. With -XImpredicativeTYpes, this allowed a unification variable to be unified with a polytype (probably wrongly) and that caused later trouble in the constraint solver, where -XImpredicativeTypes was /not/ on. In effect, -XImpredicativeTypes can't be switched on locally. Why did we want ImpredicativeTypes locally? Because the program generated by GND for a higher-rank method involved impredicative instantation of 'coerce': op = coerce op -- where op has a higher rank type See Note [Newtype-deriving instances] in TcGenDeriv. Cure. 1. It is ghastly to rely on ImpredicativeTypes (a 100% flaky feature) to instantiate coerce polymorphically. Happily we now have Visible Type Application, so I've used that instead which should be solid and reliable. 2. I deleted the code in tc_sub_type_ds that allows the constraint solver to "look through" a unification variable to find a polytype. That used to be essential in the days of ReturnTv, but it's utterly unreliable and should be consigned to the dustbin of history. (We have ExpType now for the essential uses.) Tests involving ImpredicativeTypes are affected, but I'm not worried about them... it's advertised as a feature you can't rely on, and I want to reform it outright. >--------------------------------------------------------------- b612da667fe8fa5277fc78e972a86d4b35f98364 compiler/hsSyn/HsUtils.hs | 8 +-- compiler/typecheck/TcDeriv.hs | 2 + compiler/typecheck/TcGenDeriv.hs | 61 ++++++++--------- compiler/typecheck/TcUnify.hs | 30 +++------ testsuite/tests/boxy/Base1.hs | 3 + testsuite/tests/boxy/T2193.hs | 2 + testsuite/tests/boxy/all.T | 4 +- testsuite/tests/deriving/should_compile/T12616.hs | 21 ++++++ testsuite/tests/deriving/should_compile/all.T | 1 + testsuite/tests/deriving/should_fail/T4846.stderr | 4 +- testsuite/tests/typecheck/should_compile/T11319.hs | 3 + testsuite/tests/typecheck/should_compile/T12644.hs | 14 ++++ testsuite/tests/typecheck/should_compile/all.T | 3 +- testsuite/tests/typecheck/should_compile/tc211.hs | 3 + .../tests/typecheck/should_compile/tc211.stderr | 78 ++++++++++++++++++++-- .../tests/typecheck/should_fail/T10619.stderr | 18 ++--- .../tests/typecheck/should_fail/T2846b.stderr | 3 +- testsuite/tests/typecheck/should_fail/T8428.stderr | 5 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- .../tests/typecheck/should_fail/tcfail016.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail165.hs | 4 +- .../tests/typecheck/should_fail/tcfail165.stderr | 12 ++++ testsuite/tests/typecheck/should_fail/tcfail174.hs | 2 + .../tests/typecheck/should_fail/tcfail174.stderr | 19 ++++-- 24 files changed, 214 insertions(+), 90 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b612da667fe8fa5277fc78e972a86d4b35f98364 From git at git.haskell.org Fri Sep 30 11:54:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 11:54:38 +0000 (UTC) Subject: [commit: ghc] master: Comments only (fc4ef66) Message-ID: <20160930115438.A2BC53A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fc4ef667ce2b3f5b62d750e51118ab2fc67d7d71/ghc >--------------------------------------------------------------- commit fc4ef667ce2b3f5b62d750e51118ab2fc67d7d71 Author: Simon Peyton Jones Date: Tue Sep 27 17:16:57 2016 +0100 Comments only >--------------------------------------------------------------- fc4ef667ce2b3f5b62d750e51118ab2fc67d7d71 compiler/types/TyCoRep.hs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index a355b85..50d1cba 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2954,6 +2954,7 @@ pprTcApp_help to_type p pp tc tys dflags style pp_tc = ppr tc tys_wo_kinds = suppressInvisibles to_type dflags tc tys + -- See Note [Printing eqauality constraints] mb_saturated_equality | hetero_eq_tc , [k1, k2, t1, t2] <- tys @@ -2964,14 +2965,13 @@ pprTcApp_help to_type p pp tc tys dflags style | otherwise = Nothing + -- See Note [Printing eqauality constraints] homo_eq_tc = tc `hasKey` eqTyConKey -- ~ hetero_eq_tc = tc `hasKey` eqPrimTyConKey -- ~# || tc `hasKey` eqReprPrimTyConKey -- ~R# || tc `hasKey` heqTyConKey -- ~~ - -- This is all a bit ad-hoc, trying to print out the best representation - -- of equalities. If you see a better design, go for it. - + -- See Note [Printing eqauality constraints] print_equality (ki1, ki2, ty1, ty2) | print_eqs = ppr_infix_eq pp_tc @@ -2999,6 +2999,30 @@ pprTcApp_help to_type p pp tc tys dflags style dumpStyle style || debugStyle style +{- Note [Printing equality constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +GHC has a lot of differnent equalities: + ~ Boxed homogeneous Nominal + ~~ Boxed heterogeneous Nominal + ~# Unboxed heterogeneous Nominal + ~R# Unboxed heterogeneous Representational + +This is cofusing to the user, so when priting we usse this +strategy: + +If -fprint-equality-relations or -dppr-debug or we are in + "dump style", then print the relation as-is, which + distinguishes the various different equalities listed + above + +If ...something about heterogeneous equalities + +Ohherwise print 'Coercible' for (~#), and "~" for the others. + +This is all a bit ad-hoc, trying to print out the best representation +of equalities. If you see a better design, go for it. +-} + ------------------ -- | Given a 'TyCon',and the args to which it is applied, -- suppress the args that are implicit From git at git.haskell.org Fri Sep 30 12:33:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 12:33:23 +0000 (UTC) Subject: [commit: ghc] master: Add missing stderr file (5d473cd) Message-ID: <20160930123323.BBC8E3A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5d473cd6cce27347f070b76199f1607206c5c869/ghc >--------------------------------------------------------------- commit 5d473cd6cce27347f070b76199f1607206c5c869 Author: Simon Peyton Jones Date: Fri Sep 30 13:32:51 2016 +0100 Add missing stderr file ..accidentally omitted from previous commit. >--------------------------------------------------------------- 5d473cd6cce27347f070b76199f1607206c5c869 testsuite/tests/boxy/Base1.stderr | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/testsuite/tests/boxy/Base1.stderr b/testsuite/tests/boxy/Base1.stderr new file mode 100644 index 0000000..053a3bc --- /dev/null +++ b/testsuite/tests/boxy/Base1.stderr @@ -0,0 +1,18 @@ + +Base1.hs:20:13: error: + • Couldn't match type ‘a0 -> a0’ with ‘forall a. a -> a’ + Expected type: MEither Sid b + Actual type: MEither (a0 -> a0) b + • In the expression: MLeft fid + In an equation for ‘test1’: test1 fid = MLeft fid + +Base1.hs:25:39: error: + • Couldn't match type ‘a1 -> a1’ with ‘forall a. a -> a’ + Expected type: Maybe (Sid, Sid) + Actual type: Maybe (a1 -> a1, a2 -> a2) + • In the expression: Just (x, y) + In a case alternative: MRight y -> Just (x, y) + In the expression: + case m of { + MRight y -> Just (x, y) + _ -> Nothing } From git at git.haskell.org Fri Sep 30 13:34:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 13:34:05 +0000 (UTC) Subject: [commit: ghc] master: Make tcrun042 fail (3f27237) Message-ID: <20160930133405.C8A753A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3f27237b0e6d31c674f65284138ade50f26eab0c/ghc >--------------------------------------------------------------- commit 3f27237b0e6d31c674f65284138ade50f26eab0c Author: Simon Peyton Jones Date: Fri Sep 30 14:33:19 2016 +0100 Make tcrun042 fail This test uses wholesale impredicative polymorphism, and now fails. That's ok. >--------------------------------------------------------------- 3f27237b0e6d31c674f65284138ade50f26eab0c testsuite/tests/typecheck/should_run/all.T | 2 +- testsuite/tests/typecheck/should_run/tcrun042.hs | 8 ++++++++ testsuite/tests/typecheck/should_run/tcrun042.stderr | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index c2b277d..fa6273a 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -62,7 +62,7 @@ test('tcrun038', test('tcrun039', normal, compile_and_run, ['']) test('tcrun040', normal, compile_and_run, ['']) test('tcrun041', omit_ways(['ghci']), compile_and_run, ['']) -test('tcrun042', normal, compile_and_run, ['']) +test('tcrun042', normal, compile_fail, ['']) test('tcrun043', normal, compile_and_run, ['']) test('tcrun044', normal, compile_and_run, ['']) test('tcrun045', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_run/tcrun042.hs b/testsuite/tests/typecheck/should_run/tcrun042.hs index 1ea5c24..ba4251c 100644 --- a/testsuite/tests/typecheck/should_run/tcrun042.hs +++ b/testsuite/tests/typecheck/should_run/tcrun042.hs @@ -1,4 +1,12 @@ {-# LANGUAGE TupleSections, RankNTypes, ImpredicativeTypes #-} + +-- Sept 16: This test involves wholesale use of impredicative polymorhism +-- and I'm amazed it has worked for so long. Anyway it is now +-- failing, which is OK. We don't really suport impredicative +-- polymorphism! +-- +-- The test was added by Max in 5e8ff849, appretly to test tuple sections + module Main where e :: a -> (forall b. b -> b -> b) -> (a, String, forall c. c -> c -> c) diff --git a/testsuite/tests/typecheck/should_run/tcrun042.stderr b/testsuite/tests/typecheck/should_run/tcrun042.stderr new file mode 100644 index 0000000..52d9b29 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/tcrun042.stderr @@ -0,0 +1,6 @@ + +tcrun042.hs:13:5: error: + • Couldn't match expected type ‘forall c. c -> c -> c’ + with actual type ‘b0 -> b0 -> b0’ + • In the expression: (, "Hello" ++ "World",) + In an equation for ‘e’: e = (, "Hello" ++ "World",) From git at git.haskell.org Fri Sep 30 14:38:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 14:38:30 +0000 (UTC) Subject: [commit: ghc] master: Correct spelling in note references (28a00ea) Message-ID: <20160930143830.586773A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/28a00eafd7abc474e6e5c3d92d3c0ec561906c0b/ghc >--------------------------------------------------------------- commit 28a00eafd7abc474e6e5c3d92d3c0ec561906c0b Author: Gabor Greif Date: Fri Sep 30 16:37:53 2016 +0200 Correct spelling in note references >--------------------------------------------------------------- 28a00eafd7abc474e6e5c3d92d3c0ec561906c0b compiler/types/TyCoRep.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 50d1cba..7525f12 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2954,7 +2954,7 @@ pprTcApp_help to_type p pp tc tys dflags style pp_tc = ppr tc tys_wo_kinds = suppressInvisibles to_type dflags tc tys - -- See Note [Printing eqauality constraints] + -- See Note [Printing equality constraints] mb_saturated_equality | hetero_eq_tc , [k1, k2, t1, t2] <- tys @@ -2965,13 +2965,13 @@ pprTcApp_help to_type p pp tc tys dflags style | otherwise = Nothing - -- See Note [Printing eqauality constraints] + -- See Note [Printing equality constraints] homo_eq_tc = tc `hasKey` eqTyConKey -- ~ hetero_eq_tc = tc `hasKey` eqPrimTyConKey -- ~# || tc `hasKey` eqReprPrimTyConKey -- ~R# || tc `hasKey` heqTyConKey -- ~~ - -- See Note [Printing eqauality constraints] + -- See Note [Printing equality constraints] print_equality (ki1, ki2, ty1, ty2) | print_eqs = ppr_infix_eq pp_tc From git at git.haskell.org Fri Sep 30 15:17:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 15:17:38 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Refactor typechecking of pattern bindings (19140fd) Message-ID: <20160930151738.565473A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/19140fd5d178e7522ea9e939221686b1fd4c4a83/ghc >--------------------------------------------------------------- commit 19140fd5d178e7522ea9e939221686b1fd4c4a83 Author: Simon Peyton Jones Date: Wed Aug 31 09:28:39 2016 +0100 Refactor typechecking of pattern bindings This patch fixes a regression introduced, post 8.0.1, by this major commit: commit 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72 Author: Simon Peyton Jones Date: Sat Jun 11 23:49:27 2016 +0100 Improve typechecking of let-bindings This major commit was initially triggered by #11339, but it spiraled into a major review of the way in which type signatures for bindings are handled, especially partial type signatures. I didn't get the typechecking of pattern bindings right, leading to Trac #12427. In fixing this I found that this program doesn't work: data T where T :: a -> ((forall b. [b]->[b]) -> Int) -> T h1 y = case y of T _ v -> v Works in 7.10, but not in 8.0.1. There's a happy ending. I found a way to fix this, and improve pattern bindings too. Not only does this fix #12427, but it also allows In particular,we now can accept data T where MkT :: a -> Int -> T ... let { MkT _ q = t } in ... Previously this elicited "my head exploded" but it's really fine since q::Int. The approach is described in detail in TcBinds Note [Typechecking pattern bindings] Super cool. And not even a big patch! >--------------------------------------------------------------- 19140fd5d178e7522ea9e939221686b1fd4c4a83 compiler/typecheck/TcBinds.hs | 226 +++++++++++++-------- compiler/typecheck/TcPat.hs | 193 ++++++++++-------- .../tests/typecheck/should_compile/T12427a.hs | 40 ++++ .../tests/typecheck/should_compile/T12427b.hs | 20 ++ testsuite/tests/typecheck/should_compile/all.T | 2 + 5 files changed, 304 insertions(+), 177 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 19140fd5d178e7522ea9e939221686b1fd4c4a83 From git at git.haskell.org Fri Sep 30 15:17:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 15:17:41 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Comments and trivial refactoring (ff8b588) Message-ID: <20160930151741.3087E3A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/ff8b588e81abe015bf23f1b75f9e8d5705b108c3/ghc >--------------------------------------------------------------- commit ff8b588e81abe015bf23f1b75f9e8d5705b108c3 Author: Simon Peyton Jones Date: Mon Sep 19 10:08:29 2016 +0100 Comments and trivial refactoring >--------------------------------------------------------------- ff8b588e81abe015bf23f1b75f9e8d5705b108c3 compiler/basicTypes/BasicTypes.hs | 2 +- compiler/hsSyn/HsBinds.hs | 4 +++- compiler/simplCore/CoreMonad.hs | 16 ---------------- compiler/simplCore/SimplCore.hs | 16 ++++++++++++++++ compiler/typecheck/TcInstDcls.hs | 6 +++--- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index aab0528..d911a54 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -961,7 +961,7 @@ data InlinePragma -- Note [InlinePragma] -- That is, inl_sat describes the number of *source-code* -- arguments the thing must be applied to. We add on the -- number of implicit, dictionary arguments when making - -- the InlineRule, and don't look at inl_sat further + -- the Unfolding, and don't look at inl_sat further , inl_act :: Activation -- Says during which phases inlining is allowed diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs index 236892e..4878592 100644 --- a/compiler/hsSyn/HsBinds.hs +++ b/compiler/hsSyn/HsBinds.hs @@ -593,6 +593,7 @@ ppr_monobind (AbsBinds { abs_tvs = tyvars, abs_ev_vars = dictvars pprLHsBinds val_binds ppr_monobind (AbsBindsSig { abs_tvs = tyvars , abs_ev_vars = dictvars + , abs_sig_export = poly_id , abs_sig_ev_bind = ev_bind , abs_sig_bind = bind }) = sdocWithDynFlags $ \ dflags -> @@ -600,7 +601,8 @@ ppr_monobind (AbsBindsSig { abs_tvs = tyvars hang (text "AbsBindsSig" <+> brackets (interpp'SP tyvars) <+> brackets (interpp'SP dictvars)) 2 $ braces $ vcat - [ text "Bind:" <+> ppr bind + [ text "Exported type:" <+> pprBndr LetBind poly_id + , text "Bind:" <+> ppr bind , text "Evidence:" <+> ppr ev_bind ] else ppr bind diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 853f5be..a386a28 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -238,22 +238,6 @@ runMaybe (Just x) f = f x runMaybe Nothing _ = CoreDoNothing {- -Note [RULEs enabled in SimplGently] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -RULES are enabled when doing "gentle" simplification. Two reasons: - - * We really want the class-op cancellation to happen: - op (df d1 d2) --> $cop3 d1 d2 - because this breaks the mutual recursion between 'op' and 'df' - - * I wanted the RULE - lift String ===> ... - to work in Template Haskell when simplifying - splices, so we get simpler code for literal strings - -But watch out: list fusion can prevent floating. So use phase control -to switch off those rules until after floating. - ************************************************************************ * * diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 8bc0392..0af167e 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -367,6 +367,22 @@ addPluginPasses builtin_passes #endif {- +Note [RULEs enabled in SimplGently] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +RULES are enabled when doing "gentle" simplification. Two reasons: + + * We really want the class-op cancellation to happen: + op (df d1 d2) --> $cop3 d1 d2 + because this breaks the mutual recursion between 'op' and 'df' + + * I wanted the RULE + lift String ===> ... + to work in Template Haskell when simplifying + splices, so we get simpler code for literal strings + +But watch out: list fusion can prevent floating. So use phase control +to switch off those rules until after floating. + ************************************************************************ * * The CoreToDo interpreter diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index 96d7493..8bd5092 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -1316,15 +1316,15 @@ tcMethodBody clas tyvars dfun_ev_vars inst_tys -- Substitute the local_meth_name for the binder -- NB: the binding is always a FunBind - ; global_meth_id <- addInlinePrags global_meth_id prags - ; spec_prags <- tcSpecPrags global_meth_id prags - -- taking instance signature into account might change the type of -- the local_meth_id ; (meth_implic, ev_binds_var, tc_bind) <- checkInstConstraints $ tcMethodBodyHelp sig_fn sel_id local_meth_id (L bind_loc lm_bind) + ; global_meth_id <- addInlinePrags global_meth_id prags + ; spec_prags <- tcSpecPrags global_meth_id prags + ; let specs = mk_meth_spec_prags global_meth_id spec_inst_prags spec_prags export = ABE { abe_poly = global_meth_id , abe_mono = local_meth_id From git at git.haskell.org Fri Sep 30 15:17:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 15:17:44 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Test Trac #12507 (0b06fcc) Message-ID: <20160930151744.770AD3A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/0b06fcc23bd029c00884bbdb92ffd3a7e1c95c88/ghc >--------------------------------------------------------------- commit 0b06fcc23bd029c00884bbdb92ffd3a7e1c95c88 Author: Simon Peyton Jones Date: Wed Sep 21 15:51:52 2016 +0100 Test Trac #12507 This is now working apparently. It relates to when a polymorphic function gets instantiated, under some implicit paramter bindings. >--------------------------------------------------------------- 0b06fcc23bd029c00884bbdb92ffd3a7e1c95c88 testsuite/tests/typecheck/should_compile/T12507.hs | 16 ++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 17 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T12507.hs b/testsuite/tests/typecheck/should_compile/T12507.hs new file mode 100644 index 0000000..b4cfd0e --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12507.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE GADTs, ConstraintKinds, Rank2Types, ImplicitParams #-} + +module T12507 where + +data Rec fields where + Rec :: fields => Rec fields + +qn :: Rec fields -> (fields => r) -> r +qn Rec e = e + +record :: Rec (?a :: Int, ?b :: String) +record = Rec where ?a=42 + ?b="hey" + +access :: Int +access = qn record ?a diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 4ca8c91..6dc3a73 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -544,3 +544,4 @@ test('T12466a', normal, compile, ['']) test('T12644', normal, compile, ['']) test('T12427a', normal, compile_fail, ['']) test('T12427b', normal, compile, ['']) +test('T12507', normal, compile, ['']) From git at git.haskell.org Fri Sep 30 15:17:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 15:17:47 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Make TcLevel increase by 1 not 2 (2d960f2) Message-ID: <20160930151747.2A52F3A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/2d960f225483d1c428992893ee637987af90b2cb/ghc >--------------------------------------------------------------- commit 2d960f225483d1c428992893ee637987af90b2cb Author: Simon Peyton Jones Date: Tue Sep 20 23:29:51 2016 +0100 Make TcLevel increase by 1 not 2 Make the TcLevel of a flatten-meta-var be always zero. See TcType.fmvTcLevel. This allows the levels of implication constraints to to up by 1 each time instead of 2, which is less confusing. This change has no effect on type checking. >--------------------------------------------------------------- 2d960f225483d1c428992893ee637987af90b2cb compiler/typecheck/TcType.hs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index bd64f54..193060b 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -646,23 +646,18 @@ Note [TcLevel assignment] ~~~~~~~~~~~~~~~~~~~~~~~~~ We arrange the TcLevels like this + 0 Level for flatten meta-vars 1 Top level - 2 Flatten-meta-vars of level 3 - 3 First-level implication constraints - 4 Flatten-meta-vars of level 5 - 5 Second-level implication constraints + 2 First-level implication constraints + 3 Second-level implication constraints ...etc... -The even-numbered levels are for the flatten-meta-variables assigned -at the next level in. Eg for a second-level implication conststraint -(level 5), the flatten meta-vars are level 4, which makes them untouchable. -The flatten meta-vars could equally well all have level 0, or just NotALevel -since they do not live across implications. +The flatten meta-vars are all at level 0, just to make them untouchable. -} fmvTcLevel :: TcLevel -> TcLevel -- See Note [TcLevel assignment] -fmvTcLevel (TcLevel n) = TcLevel (n-1) +fmvTcLevel _ = TcLevel 0 topTcLevel :: TcLevel -- See Note [TcLevel assignment] @@ -674,7 +669,7 @@ isTopTcLevel _ = False pushTcLevel :: TcLevel -> TcLevel -- See Note [TcLevel assignment] -pushTcLevel (TcLevel us) = TcLevel (us + 2) +pushTcLevel (TcLevel us) = TcLevel (us + 1) strictlyDeeperThan :: TcLevel -> TcLevel -> Bool strictlyDeeperThan (TcLevel tv_tclvl) (TcLevel ctxt_tclvl) From git at git.haskell.org Fri Sep 30 15:17:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 15:17:51 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: A collection of type-inference refactorings. (31621b1) Message-ID: <20160930151751.5101C3A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/31621b12692601461652cb6857d1a9ab6783db29/ghc >--------------------------------------------------------------- commit 31621b12692601461652cb6857d1a9ab6783db29 Author: Simon Peyton Jones Date: Tue Sep 20 23:31:07 2016 +0100 A collection of type-inference refactorings. This patch does a raft of useful tidy-ups in the type checker. I've been meaning to do this for some time, and finally made time to do it en route to ICFP. 1. Modify TcType.ExpType to make a distinct data type, InferResult for the Infer case, and consequential refactoring. 2. Define a new function TcUnify.fillInferResult, to fill in an InferResult. It uses TcMType.promoteTcType to promote the type to the level of the InferResult. See TcMType Note [Promoting a type] This refactoring is in preparation for an improvement to typechecking pattern bindings, coming next. I flirted with an elaborate scheme to give better higher rank inference, but it was just too complicated. See TcMType Note [Promotion and higher rank types] 3. Add to InferResult a new field ir_inst :: Bool to say whether or not the type used to fill in the InferResult should be deeply instantiated. See TcUnify Note [Deep instantiation of InferResult]. 4. Add a TcLevel to SkolemTvs. This will be useful generally - it's a fast way to see if the type variable escapes when floating (not used yet) - it provides a good consistency check when updating a unification variable (TcMType.writeMetaTyVarRef, the level_check_ok check) I originally had another reason (related to the flirting in (2), but I left it in because it seems like a step in the right direction. 5. Reduce and simplify the plethora of uExpType, tcSubType and related functions in TcUnify. It was such an opaque mess and it's still not great, but it's better. 6. Simplify the uo_expected field of TypeEqOrigin. Richard had generatlised it to a ExpType, but it was almost always a Check type. Now it's back to being a plain TcType which is much, much easier. 7. Improve error messages by refraining from skolemisation when it's clear that there's an error: see TcUnify Note [Don't skolemise unnecessarily] 8. Type.isPiTy and isForAllTy seem to be missing a coreView check, so I added it 9. Kill off tcs_used_tcvs. Its purpose is to track the givens used by wanted constraints. For dictionaries etc we do that via the free vars of the /bindings/ in the implication constraint ic_binds. But for coercions we just do update-in-place in the type, rather than generating a binding. So we need something analogous to bindings, to track what coercions we have added. That was the purpose of tcs_used_tcvs. But it only worked for a /single/ iteration, whereas we may have multiple iterations of solving an implication. Look at (the old) 'setImplicationStatus'. If the constraint is unsolved, it just drops the used_tvs on the floor. If it becomes solved next time round, we'll pick up coercions used in that round, but ignore ones used in the first round. There was an outright bug. Result = (potentialy) bogus unused-constraint errors. Constructing a case where this actually happens seems quite trick so I did not do so. Solution: expand EvBindsVar to include the (free vars of the) coercions, so that the coercions are tracked in essentially the same way as the bindings. This turned out to be much simpler. Less code, more correct. 10. Make the ic_binds field in an implication have type ic_binds :: EvBindsVar instead of (as previously) ic_binds :: Maybe EvBindsVar This is notably simpler, and faster to use -- less testing of the Maybe. But in the occaional situation where we don't have anywhere to put the bindings, the belt-and-braces error check is lost. So I put it back as an ASSERT in 'setImplicationStatus' (see the use of 'termEvidenceAllowed') All these changes led to quite bit of error message wibbling >--------------------------------------------------------------- 31621b12692601461652cb6857d1a9ab6783db29 compiler/ghci/RtClosureInspect.hs | 2 +- compiler/typecheck/Inst.hs | 4 +- compiler/typecheck/TcBinds.hs | 68 +- compiler/typecheck/TcErrors.hs | 44 +- compiler/typecheck/TcEvidence.hs | 33 +- compiler/typecheck/TcExpr.hs | 24 +- compiler/typecheck/TcHsSyn.hs | 7 +- compiler/typecheck/TcHsType.hs | 21 +- compiler/typecheck/TcInstDcls.hs | 7 +- compiler/typecheck/TcMType.hs | 324 ++++++--- compiler/typecheck/TcMatches.hs | 19 +- compiler/typecheck/TcPat.hs | 22 +- compiler/typecheck/TcPatSyn.hs | 16 +- compiler/typecheck/TcPluginM.hs | 16 +- compiler/typecheck/TcRnDriver.hs | 9 +- compiler/typecheck/TcRnMonad.hs | 28 +- compiler/typecheck/TcRnTypes.hs | 29 +- compiler/typecheck/TcSMonad.hs | 124 ++-- compiler/typecheck/TcSimplify.hs | 58 +- compiler/typecheck/TcType.hs | 75 ++- compiler/typecheck/TcUnify.hs | 731 +++++++++++++++------ compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Type.hs | 2 + compiler/vectorise/Vectorise/Generic/PData.hs | 2 +- testsuite/tests/ado/ado004.stderr | 4 +- .../tests/annotations/should_fail/annfail10.stderr | 12 +- testsuite/tests/driver/T2182.stderr | 32 +- testsuite/tests/gadt/gadt-escape1.stderr | 16 +- testsuite/tests/gadt/gadt13.stderr | 10 +- testsuite/tests/gadt/gadt7.stderr | 18 +- .../tests/ghci.debugger/scripts/break012.stdout | 8 +- .../tests/ghci.debugger/scripts/print022.stdout | 4 +- testsuite/tests/ghci/scripts/T11524a.stdout | 4 +- testsuite/tests/ghci/scripts/T2182ghci.stderr | 10 +- .../tests/indexed-types/should_fail/T12386.hs | 9 + .../tests/indexed-types/should_fail/T12386.stderr | 7 + .../tests/indexed-types/should_fail/T5439.stderr | 16 +- .../tests/indexed-types/should_fail/T7354.stderr | 8 +- .../tests/parser/should_compile/read014.stderr | 2 +- testsuite/tests/parser/should_fail/T7848.stderr | 5 +- .../tests/parser/should_fail/readFail003.stderr | 4 +- .../partial-sigs/should_compile/T10438.stderr | 14 +- .../partial-sigs/should_compile/T11192.stderr | 16 +- .../tests/patsyn/should_compile/T11213.stderr | 2 +- testsuite/tests/patsyn/should_fail/mono.stderr | 4 +- testsuite/tests/perf/compiler/stdout | 29 + testsuite/tests/polykinds/T7438.stderr | 16 +- testsuite/tests/rebindable/rebindable6.stderr | 12 +- .../tests/rename/should_compile/T12597.stderr | 2 +- testsuite/tests/roles/should_compile/T8958.stderr | 5 +- .../simplCore/should_compile/noinline01.stderr | 4 +- testsuite/tests/th/T11452.stderr | 2 +- testsuite/tests/th/T2222.stderr | 2 +- .../typecheck/should_compile/ExPatFail.stderr | 4 +- .../should_compile/T12427.stderr} | 0 .../tests/typecheck/should_compile/T12427a.stderr | 33 + .../tests/typecheck/should_compile/tc141.stderr | 6 +- .../tests/typecheck/should_fail/T10495.stderr | 10 +- .../tests/typecheck/should_fail/T10619.stderr | 4 +- .../tests/typecheck/should_fail/T12177.stderr | 19 +- testsuite/tests/typecheck/should_fail/T3102.hs | 6 +- testsuite/tests/typecheck/should_fail/T3102.stderr | 12 - testsuite/tests/typecheck/should_fail/T7453.stderr | 50 +- testsuite/tests/typecheck/should_fail/T7734.stderr | 12 +- testsuite/tests/typecheck/should_fail/T9109.stderr | 10 +- testsuite/tests/typecheck/should_fail/T9318.stderr | 12 +- .../tests/typecheck/should_fail/VtaFail.stderr | 2 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- .../tests/typecheck/should_fail/tcfail002.stderr | 6 +- .../tests/typecheck/should_fail/tcfail004.stderr | 6 +- .../tests/typecheck/should_fail/tcfail005.stderr | 6 +- .../tests/typecheck/should_fail/tcfail013.stderr | 2 +- .../tests/typecheck/should_fail/tcfail014.stderr | 6 +- .../tests/typecheck/should_fail/tcfail018.stderr | 2 +- .../tests/typecheck/should_fail/tcfail032.stderr | 6 +- .../tests/typecheck/should_fail/tcfail099.stderr | 6 +- .../tests/typecheck/should_fail/tcfail104.stderr | 10 +- .../tests/typecheck/should_fail/tcfail140.stderr | 4 +- .../tests/typecheck/should_fail/tcfail181.stderr | 2 +- 79 files changed, 1346 insertions(+), 836 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 31621b12692601461652cb6857d1a9ab6783db29 From git at git.haskell.org Fri Sep 30 15:17:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 15:17:54 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Refactor occurrence-check logic (2e1c0da) Message-ID: <20160930151754.1FED83A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/2e1c0da4ef971f4f4cf61d1b780cdf318a8317ef/ghc >--------------------------------------------------------------- commit 2e1c0da4ef971f4f4cf61d1b780cdf318a8317ef Author: Simon Peyton Jones Date: Sun Sep 25 03:50:13 2016 +0100 Refactor occurrence-check logic This patch does two related things * Combines the occurrence-check logic in the on-the-fly unifier with that in the constraint solver. They are both doing the same job, after all. The resulting code is now in TcUnify: metaTyVarUpdateOK occCheckExpand occCheckForErrors (called in TcErrors) * In doing this I disovered checking for family-free-ness and foralls can be unnecessarily inefficient, because it expands type synonyms. It's easy just to cache this info in the type syononym TyCon, which I am now doing. >--------------------------------------------------------------- 2e1c0da4ef971f4f4cf61d1b780cdf318a8317ef compiler/basicTypes/DataCon.hs | 10 +- compiler/iface/TcIface.hs | 2 +- compiler/prelude/TysPrim.hs | 2 + compiler/prelude/TysWiredIn.hs | 6 +- compiler/typecheck/TcCanonical.hs | 10 +- compiler/typecheck/TcErrors.hs | 7 +- compiler/typecheck/TcFlatten.hs | 49 +++--- compiler/typecheck/TcTyClsDecls.hs | 2 +- compiler/typecheck/TcType.hs | 281 +------------------------------ compiler/typecheck/TcUnify.hs | 78 +-------- compiler/types/TyCon.hs | 27 ++- compiler/types/Type.hs | 25 ++- compiler/vectorise/Vectorise/Type/Env.hs | 2 +- 13 files changed, 102 insertions(+), 399 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2e1c0da4ef971f4f4cf61d1b780cdf318a8317ef From git at git.haskell.org Fri Sep 30 15:17:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 15:17:56 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2: Less voluminous trace (dbfe8ad) Message-ID: <20160930151756.C6FE63A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-tc-branch2 Link : http://ghc.haskell.org/trac/ghc/changeset/dbfe8adf5a6a2512797df9be3301b60f93de3cf1/ghc >--------------------------------------------------------------- commit dbfe8adf5a6a2512797df9be3301b60f93de3cf1 Author: Simon Peyton Jones Date: Fri Sep 30 16:15:28 2016 +0100 Less voluminous trace >--------------------------------------------------------------- dbfe8adf5a6a2512797df9be3301b60f93de3cf1 compiler/typecheck/TcSMonad.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 933f8b6..8adc8ff 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -3061,13 +3061,13 @@ matchFam tycon args = wrapTcS $ matchFamTcM tycon args matchFamTcM :: TyCon -> [Type] -> TcM (Maybe (Coercion, TcType)) -- Given (F tys) return (ty, co), where co :: F tys ~ ty matchFamTcM tycon args - = do { fam_envs@(_,lcl) <- FamInst.tcGetFamInstEnvs + = do { fam_envs@(_,_lcl) <- FamInst.tcGetFamInstEnvs ; let match_fam_result = reduceTyFamApp_maybe fam_envs Nominal tycon args ; TcM.traceTc "matchFamTcM" $ vcat [ text "Matching:" <+> ppr (mkTyConApp tycon args) - , ppr_res match_fam_result - , text "Lcl fam env:" <+> ppr lcl ] + , ppr_res match_fam_result ] +-- , text "Lcl fam env:" <+> ppr _lcl ] ; return match_fam_result } where ppr_res Nothing = text "Match failed" From git at git.haskell.org Fri Sep 30 15:17:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 15:17:59 +0000 (UTC) Subject: [commit: ghc] wip/spj-tc-branch2's head updated: Less voluminous trace (dbfe8ad) Message-ID: <20160930151759.308D33A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/spj-tc-branch2' now includes: f21eedb Check.hs: Use actual import lists instead of comments 0b533a2 A bit of tracing about flattening 2fbfbca Fix desugaring of pattern bindings (again) 66a8c19 Fix a bug in occurs checking 3012c43 Add Outputable Report in TcErrors b612da6 Fix impredicativity (again) fc4ef66 Comments only 19140fd Refactor typechecking of pattern bindings ff8b588 Comments and trivial refactoring 0b06fcc Test Trac #12507 2d960f2 Make TcLevel increase by 1 not 2 31621b1 A collection of type-inference refactorings. 2e1c0da Refactor occurrence-check logic dbfe8ad Less voluminous trace From git at git.haskell.org Fri Sep 30 19:55:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 30 Sep 2016 19:55:12 +0000 (UTC) Subject: [commit: ghc] master: Document Safe Haskell restrictions on Generic instances (b3d55e2) Message-ID: <20160930195512.E63B33A33B@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b3d55e20d20344bfc09f4ca4a554a819c4ecbfa8/ghc >--------------------------------------------------------------- commit b3d55e20d20344bfc09f4ca4a554a819c4ecbfa8 Author: Ryan Scott Date: Fri Sep 30 15:52:02 2016 -0400 Document Safe Haskell restrictions on Generic instances Commit 578fbeca31dd3d755e24e910c3a7327f92bc4ee3 disallowed hand-written `Generic` instances in Safe Haskell, but this wasn't documented anywhere. >--------------------------------------------------------------- b3d55e20d20344bfc09f4ca4a554a819c4ecbfa8 docs/users_guide/safe_haskell.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/users_guide/safe_haskell.rst b/docs/users_guide/safe_haskell.rst index 3914820..6ce8b8f 100644 --- a/docs/users_guide/safe_haskell.rst +++ b/docs/users_guide/safe_haskell.rst @@ -278,6 +278,15 @@ Furthermore, we restrict the following features: between types. Derived instances (through the :ghc-flag:`-XDeriveDataTypeable` extension) are still allowed. +- ``GHC.Generics`` — Hand crafted instances of the ``Generic`` type class are + not allowed in Safe Haskell. Such instances aren't strictly unsafe, but + there is an important invariant that a ``Generic`` instance should adhere to + the structure of the data type for which the instance is defined, and + allowing manually implemented ``Generic`` instances would break that + invariant. Derived instances (through the :ghc-flag:`-XDeriveGeneric` + extension) are still allowed. Refer to the + :ref:`generic programming ` section for more details. + .. _safe-overlapping-instances: Safe Overlapping Instances