From git at git.haskell.org Wed Apr 1 17:21:15 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Apr 2015 17:21:15 +0000 (UTC) Subject: [commit: ghc] master: Don't `make accept` output of expect_broken tests (d4cf705) Message-ID: <20150401172115.826BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4cf7051bc17182238b17ba1dc42e190fa5c6f0d/ghc >--------------------------------------------------------------- commit d4cf7051bc17182238b17ba1dc42e190fa5c6f0d Author: Thomas Miedema Date: Wed Apr 1 17:28:39 2015 +0200 Don't `make accept` output of expect_broken tests When running `make accept` on a directory in the testsuite, don't accept the output of tests that are marked as expect_broken. This makes it easier to review `git diff` after running `make accept`. When you change an error message in the compiler that shows up in the output of many tests, you can run `make accept` in the testsuite directory, and all expected test output will be updated. But since your change didn't magically fix all the other bugs in the compiler for which we have an expect_broken test, the output for those tests should probably not be updated. Before, the effect of running `make accept` could be that some tests would end up in the 'unexpected passes' group. [skip ci] Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D781 >--------------------------------------------------------------- d4cf7051bc17182238b17ba1dc42e190fa5c6f0d testsuite/driver/testlib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index e178f2a..b4c64ca 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1671,7 +1671,10 @@ def compare_outputs( kind, normaliser, expected_file, actual_file ): r = os.system( 'diff -u ' + expected_file_for_diff + \ ' ' + actual_file ) - if config.accept: + if config.accept and getTestOpts().expect == 'fail': + if_verbose(1, 'Test is expected to fail. Not accepting new output.') + return 0 + elif config.accept: if_verbose(1, 'Accepting new output.') write_file(expected_file, actual_raw) return 1 From git at git.haskell.org Wed Apr 1 17:25:10 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Apr 2015 17:25:10 +0000 (UTC) Subject: [commit: ghc] master: Change which files --make thinks are 'Haskellish' (#10220) (7cec6c7) Message-ID: <20150401172510.531433A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7cec6c7b2973b34c18da1c74c87cead33bb1bfd7/ghc >--------------------------------------------------------------- commit 7cec6c7b2973b34c18da1c74c87cead33bb1bfd7 Author: Thomas Miedema Date: Wed Apr 1 19:22:28 2015 +0200 Change which files --make thinks are 'Haskellish' (#10220) `.hspp` and `.hscpp` are haskell files that have already been preprocessed. Treat `.hspp` and `.hscpp` as Haskellish sources again, as they were before commit a10e1990. This way, ghc --make will load their imports. Make sure that `.cmm` and `.cmmcpp` are still not treated as Haskellish, by moving them out of `haskell_src_suffixes` (but still keeping them in haskellish_suffixes, though I'm not sure what the purpose of that group is). Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D778 >--------------------------------------------------------------- 7cec6c7b2973b34c18da1c74c87cead33bb1bfd7 compiler/main/DriverPhases.hs | 7 +++++-- ghc/Main.hs | 2 +- testsuite/tests/driver/T10220.hspp | 2 ++ testsuite/tests/driver/T10220B.hs | 1 + testsuite/tests/driver/all.T | 4 ++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs index e3aaf69..9d11993 100644 --- a/compiler/main/DriverPhases.hs +++ b/compiler/main/DriverPhases.hs @@ -279,11 +279,14 @@ phaseInputExt StopLn = "o" haskellish_src_suffixes, haskellish_suffixes, cish_suffixes, haskellish_user_src_suffixes, haskellish_sig_suffixes :: [String] +-- When a file with an extension in the haskellish_src_suffixes group is +-- loaded in --make mode, its imports will be loaded too. haskellish_src_suffixes = haskellish_user_src_suffixes ++ - [ "hspp", "hscpp", "cmm", "cmmcpp" ] + [ "hspp", "hscpp" ] haskellish_suffixes = haskellish_src_suffixes ++ - [ "hc" ] + [ "hc", "cmm", "cmmcpp" ] cish_suffixes = [ "c", "cpp", "C", "cc", "cxx", "s", "S", "ll", "bc", "lm_s", "m", "M", "mm" ] + -- Will not be deleted as temp files: haskellish_user_src_suffixes = haskellish_sig_suffixes ++ [ "hs", "lhs", "hs-boot", "lhs-boot" ] diff --git a/ghc/Main.hs b/ghc/Main.hs index 2f013aa..fa266a2 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -656,7 +656,7 @@ doMake srcs = do let (hs_srcs, non_hs_srcs) = partition haskellish srcs haskellish (f,Nothing) = - looksLikeModuleName f || isHaskellUserSrcFilename f || '.' `notElem` f + looksLikeModuleName f || isHaskellSrcFilename f || '.' `notElem` f haskellish (_,Just phase) = phase `notElem` [ As True, As False, Cc, Cobjc, Cobjcxx, CmmCpp, Cmm , StopLn] diff --git a/testsuite/tests/driver/T10220.hspp b/testsuite/tests/driver/T10220.hspp new file mode 100644 index 0000000..9dd6b0d --- /dev/null +++ b/testsuite/tests/driver/T10220.hspp @@ -0,0 +1,2 @@ +module T10220 where +import T10220B diff --git a/testsuite/tests/driver/T10220B.hs b/testsuite/tests/driver/T10220B.hs new file mode 100644 index 0000000..fce109b --- /dev/null +++ b/testsuite/tests/driver/T10220B.hs @@ -0,0 +1 @@ +module T10220B where diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index e1665f1..32678d3 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -427,3 +427,7 @@ test('T10219', normal, run_command, # `-x hspp` in make mode should work. # Note: need to specify `-x hspp` before the filename. ['{compiler} --make -x hspp T10219.hspp -fno-code -v0']) + +test('T10220', normal, run_command, + # Preprocessed T10220.hspp imports T10220B. Should work in --make mode. + ['{compiler} --make T10220.hspp -fno-code -v0']) From git at git.haskell.org Wed Apr 1 17:25:13 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Apr 2015 17:25:13 +0000 (UTC) Subject: [commit: ghc] master: Reformat build flavours in build.mk.sample (#10223) (3749c05) Message-ID: <20150401172513.1F5CB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3749c05216339df60e1ffbb28c8b957ad5020b00/ghc >--------------------------------------------------------------- commit 3749c05216339df60e1ffbb28c8b957ad5020b00 Author: Thomas Miedema Date: Wed Apr 1 19:24:13 2015 +0200 Reformat build flavours in build.mk.sample (#10223) Use same format for each build flavour, to make it easier to compare them. Refactoring only. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D782 >--------------------------------------------------------------- 3749c05216339df60e1ffbb28c8b957ad5020b00 mk/build.mk.sample | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/mk/build.mk.sample b/mk/build.mk.sample index fd20e69..d016e84 100644 --- a/mk/build.mk.sample +++ b/mk/build.mk.sample @@ -89,8 +89,13 @@ GhcStage1HcOpts = -O $(GhcFAsm) GhcStage2HcOpts = -O2 $(GhcFAsm) GhcHcOpts = -Rghc-timing GhcLibHcOpts = -O2 -GhcLibWays += p +#SplitObjs +#HADDOCK_DOCS +#BUILD_DOCBOOK_HTML +#BUILD_DOCBOOK_PS +#BUILD_DOCBOOK_PDF +GhcLibWays += p ifeq "$(PlatformSupportsSharedLibs)" "YES" GhcLibWays += dyn endif @@ -106,6 +111,12 @@ GhcStage1HcOpts = -O -fllvm GhcStage2HcOpts = -O2 -fllvm GhcHcOpts = -Rghc-timing GhcLibHcOpts = -O2 +#SplitObjs +#HADDOCK_DOCS +#BUILD_DOCBOOK_HTML +#BUILD_DOCBOOK_PS +#BUILD_DOCBOOK_PDF + GhcLibWays += p endif @@ -114,20 +125,21 @@ endif ifeq "$(BuildFlavour)" "perf-cross" -SRC_HC_OPTS = -O -H64m -fllvm -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O2 -fllvm -GhcHcOpts = -Rghc-timing -GhcLibHcOpts = -O2 -GhcLibWays += p -INTEGER_LIBRARY = integer-simple -Stage1Only = YES - +SRC_HC_OPTS = -O -H64m -fllvm +GhcStage1HcOpts = -O2 +GhcStage2HcOpts = -O2 -fllvm +GhcHcOpts = -Rghc-timing +GhcLibHcOpts = -O2 +#SplitObjs HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO +GhcLibWays += p + +INTEGER_LIBRARY = integer-simple +Stage1Only = YES DYNAMIC_BY_DEFAULT = NO DYNAMIC_GHC_PROGRAMS = NO @@ -194,9 +206,9 @@ HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO -INTEGER_LIBRARY = integer-simple -Stage1Only = YES +INTEGER_LIBRARY = integer-simple +Stage1Only = YES DYNAMIC_BY_DEFAULT = NO DYNAMIC_GHC_PROGRAMS = NO @@ -210,16 +222,15 @@ SRC_HC_OPTS = -H64m -O0 $(GhcFAsm) GhcStage1HcOpts = -O $(GhcFAsm) GhcStage2HcOpts = -O $(GhcFAsm) GhcLibHcOpts = -O $(GhcFAsm) - -GhcLibWays += p -GhcProfiled = YES - SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO +GhcLibWays += p +GhcProfiled = YES + endif # -------- A Development build (stage 1) -------------------------------------- @@ -227,14 +238,15 @@ endif ifeq "$(BuildFlavour)" "devel1" SRC_HC_OPTS = -H64m -O $(GhcFAsm) -GhcLibHcOpts = -O -dcore-lint GhcStage1HcOpts = -Rghc-timing -O0 -DDEBUG GhcStage2HcOpts = -Rghc-timing -O $(GhcFAsm) +GhcLibHcOpts = -O -dcore-lint SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO + LAX_DEPENDENCIES = YES endif @@ -244,14 +256,15 @@ endif ifeq "$(BuildFlavour)" "devel2" SRC_HC_OPTS = -H64m -O $(GhcFAsm) -GhcLibHcOpts = -O -dcore-lint GhcStage1HcOpts = -Rghc-timing -O $(GhcFAsm) GhcStage2HcOpts = -Rghc-timing -O0 -DDEBUG +GhcLibHcOpts = -O -dcore-lint SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO + LAX_DEPENDENCIES = YES endif @@ -297,13 +310,13 @@ GhcStage1HcOpts = -O $(GhcFAsm) GhcStage2HcOpts = -O0 $(GhcFAsm) GhcLibHcOpts = -O2 $(GhcFAsm) SplitObjs = NO -INTEGER_LIBRARY = integer-simple -Stage1Only = YES HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO +INTEGER_LIBRARY = integer-simple +Stage1Only = YES DYNAMIC_BY_DEFAULT = NO DYNAMIC_GHC_PROGRAMS = NO From git at git.haskell.org Wed Apr 1 17:30:46 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Apr 2015 17:30:46 +0000 (UTC) Subject: [commit: ghc] master: Filter out `-Rghc-timing` for V=0 builds (#10223) (43351ff) Message-ID: <20150401173046.9C6133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/43351ff0905a098c382487c502ccad53783ba9ee/ghc >--------------------------------------------------------------- commit 43351ff0905a098c382487c502ccad53783ba9ee Author: Thomas Miedema Date: Wed Apr 1 19:30:16 2015 +0200 Filter out `-Rghc-timing` for V=0 builds (#10223) Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D783 >--------------------------------------------------------------- 43351ff0905a098c382487c502ccad53783ba9ee compiler/ghc.mk | 6 ++++++ mk/build.mk.sample | 11 ++++------- validate | 1 - 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index c8cd557..0009126 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -676,9 +676,15 @@ compiler_stage2_CONFIGURE_OPTS += --disable-library-for-ghci compiler_stage3_CONFIGURE_OPTS += --disable-library-for-ghci # after build-package, because that sets compiler_stage1_HC_OPTS: +ifeq "$(V)" "0" +compiler_stage1_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage1HcOpts) +compiler_stage2_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage2HcOpts) +compiler_stage3_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage3HcOpts) +else compiler_stage1_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts) compiler_stage2_HC_OPTS += $(GhcHcOpts) $(GhcStage2HcOpts) compiler_stage3_HC_OPTS += $(GhcHcOpts) $(GhcStage3HcOpts) +endif ifneq "$(BINDIST)" "YES" diff --git a/mk/build.mk.sample b/mk/build.mk.sample index d016e84..216f92c 100644 --- a/mk/build.mk.sample +++ b/mk/build.mk.sample @@ -87,7 +87,6 @@ ifeq "$(BuildFlavour)" "perf" SRC_HC_OPTS = -O -H64m GhcStage1HcOpts = -O $(GhcFAsm) GhcStage2HcOpts = -O2 $(GhcFAsm) -GhcHcOpts = -Rghc-timing GhcLibHcOpts = -O2 #SplitObjs #HADDOCK_DOCS @@ -109,7 +108,6 @@ ifeq "$(BuildFlavour)" "perf-llvm" SRC_HC_OPTS = -O -H64m -fllvm GhcStage1HcOpts = -O -fllvm GhcStage2HcOpts = -O2 -fllvm -GhcHcOpts = -Rghc-timing GhcLibHcOpts = -O2 #SplitObjs #HADDOCK_DOCS @@ -128,7 +126,6 @@ ifeq "$(BuildFlavour)" "perf-cross" SRC_HC_OPTS = -O -H64m -fllvm GhcStage1HcOpts = -O2 GhcStage2HcOpts = -O2 -fllvm -GhcHcOpts = -Rghc-timing GhcLibHcOpts = -O2 #SplitObjs HADDOCK_DOCS = NO @@ -238,8 +235,8 @@ endif ifeq "$(BuildFlavour)" "devel1" SRC_HC_OPTS = -H64m -O $(GhcFAsm) -GhcStage1HcOpts = -Rghc-timing -O0 -DDEBUG -GhcStage2HcOpts = -Rghc-timing -O $(GhcFAsm) +GhcStage1HcOpts = -O0 -DDEBUG +GhcStage2HcOpts = -O $(GhcFAsm) GhcLibHcOpts = -O -dcore-lint SplitObjs = NO HADDOCK_DOCS = NO @@ -256,8 +253,8 @@ endif ifeq "$(BuildFlavour)" "devel2" SRC_HC_OPTS = -H64m -O $(GhcFAsm) -GhcStage1HcOpts = -Rghc-timing -O $(GhcFAsm) -GhcStage2HcOpts = -Rghc-timing -O0 -DDEBUG +GhcStage1HcOpts = -O $(GhcFAsm) +GhcStage2HcOpts = -O0 -DDEBUG GhcLibHcOpts = -O -dcore-lint SplitObjs = NO HADDOCK_DOCS = NO diff --git a/validate b/validate index 109d521..95d3af5 100755 --- a/validate +++ b/validate @@ -172,7 +172,6 @@ echo "ValidateHpc=$hpc" >> mk/are-validating.mk if [ $be_quiet -eq 1 ]; then echo "V=0" >> mk/are-validating.mk # Less gunk - echo "GhcHcOpts=" >> mk/are-validating.mk # Remove -Rghc-timing fi if [ $use_dph -eq 1 ]; then From git at git.haskell.org Thu Apr 2 01:02:56 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 01:02:56 +0000 (UTC) Subject: [commit: ghc] master: Indentation only. (f15dbc2) Message-ID: <20150402010256.C62833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f15dbc22545964f301c736dba198da643690b5a0/ghc >--------------------------------------------------------------- commit f15dbc22545964f301c736dba198da643690b5a0 Author: Edward Z. Yang Date: Sat Mar 28 22:34:32 2015 -0700 Indentation only. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- f15dbc22545964f301c736dba198da643690b5a0 compiler/typecheck/TcRnDriver.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index dca128e..9d3a1fa 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -178,7 +178,7 @@ tcRnSignature dflags hsc_src , tcg_imports = tcg_imports tcg_env `plusImportAvails` avails }) } ; - Nothing + Nothing | HsigFile <- hsc_src , HscNothing <- hscTarget dflags -> do { return tcg_env From git at git.haskell.org Thu Apr 2 09:42:16 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 09:42:16 +0000 (UTC) Subject: [commit: ghc] master: Fake (->) fixity declaration (#10145) (0721e55) Message-ID: <20150402094216.0A6473A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0721e552b863c28ffb5920c70b208947831c3dc2/ghc >--------------------------------------------------------------- commit 0721e552b863c28ffb5920c70b208947831c3dc2 Author: Oleg Grenrus Date: Thu Apr 2 11:28:03 2015 +0200 Fake (->) fixity declaration (#10145) Reviewed By: simonpj, austin Differential Revision: https://phabricator.haskell.org/D741 >--------------------------------------------------------------- 0721e552b863c28ffb5920c70b208947831c3dc2 compiler/iface/LoadIface.hs | 2 ++ testsuite/tests/ghci/scripts/T8535.stdout | 1 + testsuite/tests/ghci/scripts/ghci020.stdout | 1 + .../tests/ghci/{scripts/ghci020.script => should_run/T10145.script} | 0 testsuite/tests/ghci/{scripts/T8535.stdout => should_run/T10145.stdout} | 1 + testsuite/tests/ghci/should_run/all.T | 1 + 6 files changed, 6 insertions(+) diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs index 169e929..cfb8a11 100644 --- a/compiler/iface/LoadIface.hs +++ b/compiler/iface/LoadIface.hs @@ -46,6 +46,7 @@ import PrelNames import PrelInfo import PrimOp ( allThePrimOps, primOpFixity, primOpOcc ) import MkId ( seqId ) +import TysPrim ( funTyConName ) import Rules import TyCon import Annotations @@ -871,6 +872,7 @@ ghcPrimIface } where fixities = (getOccName seqId, Fixity 0 InfixR) -- seq is infixr 0 + : (occName funTyConName, funTyFixity) -- trac #10145 : mapMaybe mkFixity allThePrimOps mkFixity op = (,) (primOpOcc op) <$> primOpFixity op diff --git a/testsuite/tests/ghci/scripts/T8535.stdout b/testsuite/tests/ghci/scripts/T8535.stdout index 749a244..2f35e23 100644 --- a/testsuite/tests/ghci/scripts/T8535.stdout +++ b/testsuite/tests/ghci/scripts/T8535.stdout @@ -1,4 +1,5 @@ data (->) a b -- Defined in ?GHC.Prim? +infixr 0 `(->)` instance Monad ((->) r) -- Defined in ?GHC.Base? instance Functor ((->) r) -- Defined in ?GHC.Base? instance Applicative ((->) a) -- Defined in ?GHC.Base? diff --git a/testsuite/tests/ghci/scripts/ghci020.stdout b/testsuite/tests/ghci/scripts/ghci020.stdout index 749a244..2f35e23 100644 --- a/testsuite/tests/ghci/scripts/ghci020.stdout +++ b/testsuite/tests/ghci/scripts/ghci020.stdout @@ -1,4 +1,5 @@ data (->) a b -- Defined in ?GHC.Prim? +infixr 0 `(->)` instance Monad ((->) r) -- Defined in ?GHC.Base? instance Functor ((->) r) -- Defined in ?GHC.Base? instance Applicative ((->) a) -- Defined in ?GHC.Base? diff --git a/testsuite/tests/ghci/scripts/ghci020.script b/testsuite/tests/ghci/should_run/T10145.script similarity index 100% copy from testsuite/tests/ghci/scripts/ghci020.script copy to testsuite/tests/ghci/should_run/T10145.script diff --git a/testsuite/tests/ghci/scripts/T8535.stdout b/testsuite/tests/ghci/should_run/T10145.stdout similarity index 94% copy from testsuite/tests/ghci/scripts/T8535.stdout copy to testsuite/tests/ghci/should_run/T10145.stdout index 749a244..2f35e23 100644 --- a/testsuite/tests/ghci/scripts/T8535.stdout +++ b/testsuite/tests/ghci/should_run/T10145.stdout @@ -1,4 +1,5 @@ data (->) a b -- Defined in ?GHC.Prim? +infixr 0 `(->)` instance Monad ((->) r) -- Defined in ?GHC.Base? instance Functor ((->) r) -- Defined in ?GHC.Base? instance Applicative ((->) a) -- Defined in ?GHC.Base? diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T index b28e4a3..cd5b1f2 100644 --- a/testsuite/tests/ghci/should_run/all.T +++ b/testsuite/tests/ghci/should_run/all.T @@ -22,3 +22,4 @@ test('ghcirun004', just_ghci, compile_and_run, ['']) test('T8377', just_ghci, compile_and_run, ['']) test('T9914', just_ghci, ghci_script, ['T9914.script']) test('T9915', just_ghci, ghci_script, ['T9915.script']) +test('T10145', just_ghci, ghci_script, ['T10145.script']) From git at git.haskell.org Thu Apr 2 09:42:18 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 09:42:18 +0000 (UTC) Subject: [commit: ghc] master: Do not set -fasm explicitly in build.mk.sample (#10223) (9b66a7f) Message-ID: <20150402094218.C57813A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9b66a7f3d04ed93972e7daa1c6307c8d68ac3720/ghc >--------------------------------------------------------------- commit 9b66a7f3d04ed93972e7daa1c6307c8d68ac3720 Author: Thomas Miedema Date: Thu Apr 2 11:39:54 2015 +0200 Do not set -fasm explicitly in build.mk.sample (#10223) On platforms that support -fasm, it is already the default, so we don't have to set it. Reviewed By: austin, erikd (tested on powerpc and armhf) Differential Revision: https://phabricator.haskell.org/D784 >--------------------------------------------------------------- 9b66a7f3d04ed93972e7daa1c6307c8d68ac3720 mk/build.mk.sample | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/mk/build.mk.sample b/mk/build.mk.sample index 216f92c..7befbc4 100644 --- a/mk/build.mk.sample +++ b/mk/build.mk.sample @@ -71,9 +71,6 @@ V = 1 GhcLibWays = $(if $(filter $(DYNAMIC_GHC_PROGRAMS),YES),v dyn,v) -# Only use -fasm by default on platforms that support it. -GhcFAsm = $(if $(filter $(GhcWithNativeCodeGen),YES),-fasm,) - # Uncomment the following to force `integer-gmp` to use the in-tree GMP 5.0.4 # (other sometimes useful configure-options: `--with-gmp-{includes,libraries}`) #libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp @@ -85,8 +82,8 @@ ifeq "$(BuildFlavour)" "perf" # perf matches the default settings, repeated here for comparison: SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O $(GhcFAsm) -GhcStage2HcOpts = -O2 $(GhcFAsm) +GhcStage1HcOpts = -O +GhcStage2HcOpts = -O2 GhcLibHcOpts = -O2 #SplitObjs #HADDOCK_DOCS @@ -146,10 +143,10 @@ endif ifeq "$(BuildFlavour)" "quickest" -SRC_HC_OPTS = -H64m -O0 $(GhcFAsm) -GhcStage1HcOpts = -O $(GhcFAsm) -GhcStage2HcOpts = -O0 $(GhcFAsm) -GhcLibHcOpts = -O0 $(GhcFAsm) +SRC_HC_OPTS = -H64m -O0 +GhcStage1HcOpts = -O +GhcStage2HcOpts = -O0 +GhcLibHcOpts = -O0 SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO @@ -162,10 +159,10 @@ endif ifeq "$(BuildFlavour)" "quick" -SRC_HC_OPTS = -H64m -O0 $(GhcFAsm) -GhcStage1HcOpts = -O $(GhcFAsm) -GhcStage2HcOpts = -O0 $(GhcFAsm) -GhcLibHcOpts = -O $(GhcFAsm) +SRC_HC_OPTS = -H64m -O0 +GhcStage1HcOpts = -O +GhcStage2HcOpts = -O0 +GhcLibHcOpts = -O SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO @@ -215,10 +212,10 @@ endif ifeq "$(BuildFlavour)" "prof" -SRC_HC_OPTS = -H64m -O0 $(GhcFAsm) -GhcStage1HcOpts = -O $(GhcFAsm) -GhcStage2HcOpts = -O $(GhcFAsm) -GhcLibHcOpts = -O $(GhcFAsm) +SRC_HC_OPTS = -H64m -O0 +GhcStage1HcOpts = -O +GhcStage2HcOpts = -O +GhcLibHcOpts = -O SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO @@ -234,9 +231,9 @@ endif ifeq "$(BuildFlavour)" "devel1" -SRC_HC_OPTS = -H64m -O $(GhcFAsm) +SRC_HC_OPTS = -H64m -O GhcStage1HcOpts = -O0 -DDEBUG -GhcStage2HcOpts = -O $(GhcFAsm) +GhcStage2HcOpts = -O GhcLibHcOpts = -O -dcore-lint SplitObjs = NO HADDOCK_DOCS = NO @@ -252,8 +249,8 @@ endif ifeq "$(BuildFlavour)" "devel2" -SRC_HC_OPTS = -H64m -O $(GhcFAsm) -GhcStage1HcOpts = -O $(GhcFAsm) +SRC_HC_OPTS = -H64m -O +GhcStage1HcOpts = -O GhcStage2HcOpts = -O0 -DDEBUG GhcLibHcOpts = -O -dcore-lint SplitObjs = NO @@ -271,9 +268,9 @@ endif ifeq "$(BuildFlavour)" "bench" SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O $(GhcFAsm) -GhcStage2HcOpts = -O0 $(GhcFAsm) -GhcLibHcOpts = -O2 $(GhcFAsm) +GhcStage1HcOpts = -O +GhcStage2HcOpts = -O0 +GhcLibHcOpts = -O2 SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO @@ -303,9 +300,9 @@ endif ifeq "$(BuildFlavour)" "bench-cross" SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O $(GhcFAsm) -GhcStage2HcOpts = -O0 $(GhcFAsm) -GhcLibHcOpts = -O2 $(GhcFAsm) +GhcStage1HcOpts = -O +GhcStage2HcOpts = -O0 +GhcLibHcOpts = -O2 SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO From git at git.haskell.org Thu Apr 2 09:42:21 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 09:42:21 +0000 (UTC) Subject: [commit: ghc] master: Disable same warnings for normal builds as for validate (#10223) (4c1e1c8) Message-ID: <20150402094221.CE4BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4c1e1c870e294990a44d8d6837742fb0d00f5456/ghc >--------------------------------------------------------------- commit 4c1e1c870e294990a44d8d6837742fb0d00f5456 Author: Thomas Miedema Date: Thu Apr 2 11:41:47 2015 +0200 Disable same warnings for normal builds as for validate (#10223) The default validate settings currently disable some warnings in the libraries. This patch moves those settings to a new file called `mk/warnings.mk`, and applies them also to normal builds. Through uncommenting a line in build.mk, developers can now build with -Werror. -Werror is not the default, because: * We can not guarantee that the build is warning free on platforms we don't run regularly run validate (as part of continuous integration systems), and we still want the build to go through on those platforms. * quoting rwbarton on irc > "I think -Werror by default has come up in the past and the argument was that it is too annoying when you are doing nontrivial development" Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D785 >--------------------------------------------------------------- 4c1e1c870e294990a44d8d6837742fb0d00f5456 ghc.mk | 15 ++-- mk/build.mk.sample | 3 + mk/validate-settings.mk | 118 ------------------------------- mk/{validate-settings.mk => warnings.mk} | 63 ++--------------- 4 files changed, 17 insertions(+), 182 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 4c1e1c870e294990a44d8d6837742fb0d00f5456 From git at git.haskell.org Thu Apr 2 09:56:21 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 09:56:21 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T9723' created Message-ID: <20150402095621.0DCBE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T9723 Referencing: d355b1d6c05d103104667a285082bc7851f37548 From git at git.haskell.org Thu Apr 2 09:56:24 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 09:56:24 +0000 (UTC) Subject: [commit: ghc] wip/T9723: Changes 'Tab character' warnings so there is one per file (#9723) (d355b1d) Message-ID: <20150402095624.8188E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T9723 Link : http://ghc.haskell.org/trac/ghc/changeset/d355b1d6c05d103104667a285082bc7851f37548/ghc >--------------------------------------------------------------- commit d355b1d6c05d103104667a285082bc7851f37548 Author: Dave Laing Date: Thu Apr 2 11:50:54 2015 +0200 Changes 'Tab character' warnings so there is one per file (#9723) Reviewed By: thomie, nomeata Differential Revision: https://phabricator.haskell.org/D760 Signed-off-by: Dave Laing >--------------------------------------------------------------- d355b1d6c05d103104667a285082bc7851f37548 compiler/parser/Lexer.x | 38 ++++++++++++++++++++-- testsuite/tests/driver/werror.stderr | 2 +- .../should_compile/{read043.hs => T9723a.hs} | 4 +-- .../tests/parser/should_compile/T9723a.stderr | 3 ++ testsuite/tests/parser/should_compile/T9723b.hs | 21 ++++++++++++ .../tests/parser/should_compile/T9723b.stderr | 3 ++ testsuite/tests/parser/should_compile/all.T | 2 ++ .../tests/parser/should_compile/read043.stderr | 3 +- .../tests/warnings/should_compile/T9230.stderr | 2 +- 9 files changed, 69 insertions(+), 9 deletions(-) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index abb2477..d26d9ec 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -203,7 +203,7 @@ haskell :- -- everywhere: skip whitespace $white_no_nl+ ; -$tab+ { warn Opt_WarnTabs (text "Tab character") } +$tab { warnTab } -- Everywhere: deal with nested comments. We explicitly rule out -- pragmas, "{-#", so that we don't accidentally treat them as comments. @@ -1655,6 +1655,11 @@ warn option warning srcspan _buf _len = do addWarning option (RealSrcSpan srcspan) warning lexToken +warnTab :: Action +warnTab srcspan _buf _len = do + addTabWarning srcspan + lexToken + warnThen :: WarningFlag -> SDoc -> Action -> Action warnThen option warning action srcspan buf len = do addWarning option (RealSrcSpan srcspan) warning @@ -1680,6 +1685,8 @@ data PState = PState { buffer :: StringBuffer, dflags :: DynFlags, messages :: Messages, + tab_first :: Maybe RealSrcSpan, -- pos of first tab warning in the file + tab_count :: !Int, -- number of tab warnings in the file last_tk :: Maybe Token, last_loc :: RealSrcSpan, -- pos of previous token last_len :: !Int, -- len of previous token @@ -2083,6 +2090,8 @@ mkPState flags buf loc = buffer = buf, dflags = flags, messages = emptyMessages, + tab_first = Nothing, + tab_count = 0, last_tk = Nothing, last_loc = mkRealSrcSpan loc loc, last_len = 0, @@ -2146,8 +2155,33 @@ addWarning option srcspan warning ws' = if wopt option d then ws `snocBag` warning' else ws in POk s{messages=(ws', es)} () +addTabWarning :: RealSrcSpan -> P () +addTabWarning srcspan + = P $ \s at PState{tab_first=tf, tab_count=tc, dflags=d} -> + let tf' = if isJust tf then tf else Just srcspan + tc' = tc + 1 + s' = if wopt Opt_WarnTabs d + then s{tab_first = tf', tab_count = tc'} + else s + in POk s' () +addTabWarning _ + = P $ \s -> POk s () + +mkTabWarning :: PState -> Maybe ErrMsg +mkTabWarning PState{tab_first=tf, tab_count=tc, dflags=d} = + let middle = if tc == 1 + then text "" + else text ", and in" <+> speakNOf (tc - 1) (text "further location") + message = text "Tab character found here" + <> middle + <> text ". Please use spaces instead." + in fmap (\s -> mkWarnMsg d (RealSrcSpan s) alwaysQualify message) tf + getMessages :: PState -> Messages -getMessages PState{messages=ms} = ms +getMessages p at PState{messages=(ws,es)} = + let tabwarning = mkTabWarning p + ws' = maybe ws (`consBag` ws) tabwarning + in (ws', es) getContext :: P [LayoutContext] getContext = P $ \s at PState{context=ctx} -> POk s ctx diff --git a/testsuite/tests/driver/werror.stderr b/testsuite/tests/driver/werror.stderr index b723c39..47213f9 100644 --- a/testsuite/tests/driver/werror.stderr +++ b/testsuite/tests/driver/werror.stderr @@ -8,7 +8,7 @@ werror.hs:7:13: Warning: werror.hs:7:13: Warning: Defined but not used: ?main? -werror.hs:8:1: Warning: Tab character +werror.hs:8:1: Warning: Tab character found here. Please use spaces instead. werror.hs:10:1: Warning: Defined but not used: ?f? diff --git a/testsuite/tests/parser/should_compile/read043.hs b/testsuite/tests/parser/should_compile/T9723a.hs similarity index 54% copy from testsuite/tests/parser/should_compile/read043.hs copy to testsuite/tests/parser/should_compile/T9723a.hs index c663a75..b75944a 100644 --- a/testsuite/tests/parser/should_compile/read043.hs +++ b/testsuite/tests/parser/should_compile/T9723a.hs @@ -1,11 +1,9 @@ {-# OPTIONS -fwarn-tabs #-} --- Check we get a warning for tabs +-- Check we get a warning for a single tab module ShouldCompile where tab1 = 'a' -notab = 'b' -tab2 = 'c' diff --git a/testsuite/tests/parser/should_compile/T9723a.stderr b/testsuite/tests/parser/should_compile/T9723a.stderr new file mode 100644 index 0000000..4024df3 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723a.stderr @@ -0,0 +1,3 @@ + +T9723a.hs:8:5: Warning: Tab character found here. Please use spaces instead. + diff --git a/testsuite/tests/parser/should_compile/T9723b.hs b/testsuite/tests/parser/should_compile/T9723b.hs new file mode 100644 index 0000000..22bc2da --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723b.hs @@ -0,0 +1,21 @@ + +{-# OPTIONS -fwarn-tabs #-} + +-- Check we get a warning for multiple tabs, with the correct number of tabs mentioned + +module ShouldCompile where + +-- tab in middle of line +tab1 = 'a' +-- tab at end of line +tab2 = 'b' +-- two tabs in middle of line +tab3 = 'c' + +tab4 = if True +-- tab at start of line + then 'd' +-- tab at start of line + else 'e' + + -- tab before a comment starts diff --git a/testsuite/tests/parser/should_compile/T9723b.stderr b/testsuite/tests/parser/should_compile/T9723b.stderr new file mode 100644 index 0000000..c76be20 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723b.stderr @@ -0,0 +1,3 @@ + +T9723b.hs:9:5: Warning: Tab character found here, and in six further locations. Please use spaces instead. + diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 13acedf..6eb593a 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -98,3 +98,5 @@ test('T7118', normal, compile, ['']) test('T7776', normal, compile, ['']) test('RdrNoStaticPointers01', when(compiler_lt('ghc', '7.9'), skip), compile, ['']) test('T5682', normal, compile, ['']) +test('T9723a', normal, compile, ['']) +test('T9723b', normal, compile, ['']) diff --git a/testsuite/tests/parser/should_compile/read043.stderr b/testsuite/tests/parser/should_compile/read043.stderr index dc1e844..c602451 100644 --- a/testsuite/tests/parser/should_compile/read043.stderr +++ b/testsuite/tests/parser/should_compile/read043.stderr @@ -1,4 +1,3 @@ -read043.hs:8:5: Warning: Tab character +read043.hs:8:5: Warning: Tab character found here, and in one further location. Please use spaces instead. -read043.hs:10:5: Warning: Tab character diff --git a/testsuite/tests/warnings/should_compile/T9230.stderr b/testsuite/tests/warnings/should_compile/T9230.stderr index 09e1f64..e62b9dc 100644 --- a/testsuite/tests/warnings/should_compile/T9230.stderr +++ b/testsuite/tests/warnings/should_compile/T9230.stderr @@ -1,2 +1,2 @@ -T9230.hs:5:1: Warning: Tab character +T9230.hs:5:1: Warning: Tab character found here. Please use spaces instead. From git at git.haskell.org Thu Apr 2 16:52:45 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 16:52:45 +0000 (UTC) Subject: [commit: ghc] wip/T9723: Changes 'Tab character' warnings so there is one per file (#9723) (e20bbfa) Message-ID: <20150402165245.6F7373A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T9723 Link : http://ghc.haskell.org/trac/ghc/changeset/e20bbfa996ac35938d066e4eab8da777072b37cf/ghc >--------------------------------------------------------------- commit e20bbfa996ac35938d066e4eab8da777072b37cf Author: Dave Laing Date: Thu Apr 2 18:51:46 2015 +0200 Changes 'Tab character' warnings so there is one per file (#9723) Summary: Signed-off-by: Dave Laing Test Plan: validate Reviewers: austin, hvr, nomeata, thomie Reviewed By: nomeata, thomie Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D760 GHC Trac Issues: #9723 >--------------------------------------------------------------- e20bbfa996ac35938d066e4eab8da777072b37cf compiler/parser/Lexer.x | 39 ++++++++++++++++++++-- testsuite/tests/driver/werror.stderr | 4 ++- .../should_compile/{read043.hs => T9723a.hs} | 4 +-- .../tests/parser/should_compile/T9723a.stderr | 4 +++ testsuite/tests/parser/should_compile/T9723b.hs | 22 ++++++++++++ .../tests/parser/should_compile/T9723b.stderr | 4 +++ testsuite/tests/parser/should_compile/all.T | 2 ++ .../tests/parser/should_compile/read043.stderr | 6 ++-- .../tests/warnings/should_compile/T9230.stderr | 4 ++- 9 files changed, 79 insertions(+), 10 deletions(-) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index abb2477..e451b5f 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -203,7 +203,7 @@ haskell :- -- everywhere: skip whitespace $white_no_nl+ ; -$tab+ { warn Opt_WarnTabs (text "Tab character") } +$tab { warnTab } -- Everywhere: deal with nested comments. We explicitly rule out -- pragmas, "{-#", so that we don't accidentally treat them as comments. @@ -1655,6 +1655,11 @@ warn option warning srcspan _buf _len = do addWarning option (RealSrcSpan srcspan) warning lexToken +warnTab :: Action +warnTab srcspan _buf _len = do + addTabWarning srcspan + lexToken + warnThen :: WarningFlag -> SDoc -> Action -> Action warnThen option warning action srcspan buf len = do addWarning option (RealSrcSpan srcspan) warning @@ -1680,6 +1685,8 @@ data PState = PState { buffer :: StringBuffer, dflags :: DynFlags, messages :: Messages, + tab_first :: Maybe RealSrcSpan, -- pos of first tab warning in the file + tab_count :: !Int, -- number of tab warnings in the file last_tk :: Maybe Token, last_loc :: RealSrcSpan, -- pos of previous token last_len :: !Int, -- len of previous token @@ -2083,6 +2090,8 @@ mkPState flags buf loc = buffer = buf, dflags = flags, messages = emptyMessages, + tab_first = Nothing, + tab_count = 0, last_tk = Nothing, last_loc = mkRealSrcSpan loc loc, last_len = 0, @@ -2146,8 +2155,34 @@ addWarning option srcspan warning ws' = if wopt option d then ws `snocBag` warning' else ws in POk s{messages=(ws', es)} () +addTabWarning :: RealSrcSpan -> P () +addTabWarning srcspan + = P $ \s at PState{tab_first=tf, tab_count=tc, dflags=d} -> + let tf' = if isJust tf then tf else Just srcspan + tc' = tc + 1 + s' = if wopt Opt_WarnTabs d + then s{tab_first = tf', tab_count = tc'} + else s + in POk s' () +addTabWarning _ + = P $ \s -> POk s () + +mkTabWarning :: PState -> Maybe ErrMsg +mkTabWarning PState{tab_first=tf, tab_count=tc, dflags=d} = + let middle = if tc == 1 + then text "" + else text ", and in" <+> speakNOf (tc - 1) (text "further location") + message = text "Tab character found here" + <> middle + <> text "." + $+$ text "Please use spaces instead." + in fmap (\s -> mkWarnMsg d (RealSrcSpan s) alwaysQualify message) tf + getMessages :: PState -> Messages -getMessages PState{messages=ms} = ms +getMessages p at PState{messages=(ws,es)} = + let tabwarning = mkTabWarning p + ws' = maybe ws (`consBag` ws) tabwarning + in (ws', es) getContext :: P [LayoutContext] getContext = P $ \s at PState{context=ctx} -> POk s ctx diff --git a/testsuite/tests/driver/werror.stderr b/testsuite/tests/driver/werror.stderr index b723c39..5541dfc 100644 --- a/testsuite/tests/driver/werror.stderr +++ b/testsuite/tests/driver/werror.stderr @@ -8,7 +8,9 @@ werror.hs:7:13: Warning: werror.hs:7:13: Warning: Defined but not used: ?main? -werror.hs:8:1: Warning: Tab character +werror.hs:8:1: Warning: + Tab character found here. + Please use spaces instead. werror.hs:10:1: Warning: Defined but not used: ?f? diff --git a/testsuite/tests/parser/should_compile/read043.hs b/testsuite/tests/parser/should_compile/T9723a.hs similarity index 54% copy from testsuite/tests/parser/should_compile/read043.hs copy to testsuite/tests/parser/should_compile/T9723a.hs index c663a75..b75944a 100644 --- a/testsuite/tests/parser/should_compile/read043.hs +++ b/testsuite/tests/parser/should_compile/T9723a.hs @@ -1,11 +1,9 @@ {-# OPTIONS -fwarn-tabs #-} --- Check we get a warning for tabs +-- Check we get a warning for a single tab module ShouldCompile where tab1 = 'a' -notab = 'b' -tab2 = 'c' diff --git a/testsuite/tests/parser/should_compile/T9723a.stderr b/testsuite/tests/parser/should_compile/T9723a.stderr new file mode 100644 index 0000000..c445de1 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723a.stderr @@ -0,0 +1,4 @@ + +T9723a.hs:8:5: Warning: + Tab character found here. + Please use spaces instead. diff --git a/testsuite/tests/parser/should_compile/T9723b.hs b/testsuite/tests/parser/should_compile/T9723b.hs new file mode 100644 index 0000000..d84e24c --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723b.hs @@ -0,0 +1,22 @@ + +{-# OPTIONS -fwarn-tabs #-} + +-- Check we get a warning for multiple tabs, with the correct number of tabs +-- mentioned + +module ShouldCompile where + +-- tab in middle of line +tab1 = 'a' +-- tab at end of line +tab2 = 'b' +-- two tabs in middle of line +tab3 = 'c' + +tab4 = if True +-- tab at start of line + then 'd' +-- tab at start of line + else 'e' + + -- tab before a comment starts diff --git a/testsuite/tests/parser/should_compile/T9723b.stderr b/testsuite/tests/parser/should_compile/T9723b.stderr new file mode 100644 index 0000000..2526450 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723b.stderr @@ -0,0 +1,4 @@ + +T9723b.hs:9:5: Warning: + Tab character found here, and in six further locations. + Please use spaces instead. diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 13acedf..6eb593a 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -98,3 +98,5 @@ test('T7118', normal, compile, ['']) test('T7776', normal, compile, ['']) test('RdrNoStaticPointers01', when(compiler_lt('ghc', '7.9'), skip), compile, ['']) test('T5682', normal, compile, ['']) +test('T9723a', normal, compile, ['']) +test('T9723b', normal, compile, ['']) diff --git a/testsuite/tests/parser/should_compile/read043.stderr b/testsuite/tests/parser/should_compile/read043.stderr index dc1e844..76b1fb4 100644 --- a/testsuite/tests/parser/should_compile/read043.stderr +++ b/testsuite/tests/parser/should_compile/read043.stderr @@ -1,4 +1,4 @@ -read043.hs:8:5: Warning: Tab character - -read043.hs:10:5: Warning: Tab character +read043.hs:8:5: Warning: + Tab character found here, and in one further location. + Please use spaces instead. diff --git a/testsuite/tests/warnings/should_compile/T9230.stderr b/testsuite/tests/warnings/should_compile/T9230.stderr index 09e1f64..2c7cee0 100644 --- a/testsuite/tests/warnings/should_compile/T9230.stderr +++ b/testsuite/tests/warnings/should_compile/T9230.stderr @@ -1,2 +1,4 @@ -T9230.hs:5:1: Warning: Tab character +T9230.hs:5:1: Warning: + Tab character found here. + Please use spaces instead. From git at git.haskell.org Thu Apr 2 16:55:06 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 16:55:06 +0000 (UTC) Subject: [commit: ghc] wip/T9723: Change 'Tab character' warnings so there is one per file (#9723) (37b44c3) Message-ID: <20150402165506.353F03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T9723 Link : http://ghc.haskell.org/trac/ghc/changeset/37b44c34ccc8143a79c28cd416e730b334be98a9/ghc >--------------------------------------------------------------- commit 37b44c34ccc8143a79c28cd416e730b334be98a9 Author: Dave Laing Date: Thu Apr 2 18:51:46 2015 +0200 Change 'Tab character' warnings so there is one per file (#9723) Reviewed By: nomeata, thomie Differential Revision: https://phabricator.haskell.org/D760 Summary: Signed-off-by: Dave Laing >--------------------------------------------------------------- 37b44c34ccc8143a79c28cd416e730b334be98a9 compiler/parser/Lexer.x | 39 ++++++++++++++++++++-- testsuite/tests/driver/werror.stderr | 4 ++- .../should_compile/{read043.hs => T9723a.hs} | 4 +-- .../tests/parser/should_compile/T9723a.stderr | 4 +++ testsuite/tests/parser/should_compile/T9723b.hs | 22 ++++++++++++ .../tests/parser/should_compile/T9723b.stderr | 4 +++ testsuite/tests/parser/should_compile/all.T | 2 ++ .../tests/parser/should_compile/read043.stderr | 6 ++-- .../tests/warnings/should_compile/T9230.stderr | 4 ++- 9 files changed, 79 insertions(+), 10 deletions(-) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index abb2477..e451b5f 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -203,7 +203,7 @@ haskell :- -- everywhere: skip whitespace $white_no_nl+ ; -$tab+ { warn Opt_WarnTabs (text "Tab character") } +$tab { warnTab } -- Everywhere: deal with nested comments. We explicitly rule out -- pragmas, "{-#", so that we don't accidentally treat them as comments. @@ -1655,6 +1655,11 @@ warn option warning srcspan _buf _len = do addWarning option (RealSrcSpan srcspan) warning lexToken +warnTab :: Action +warnTab srcspan _buf _len = do + addTabWarning srcspan + lexToken + warnThen :: WarningFlag -> SDoc -> Action -> Action warnThen option warning action srcspan buf len = do addWarning option (RealSrcSpan srcspan) warning @@ -1680,6 +1685,8 @@ data PState = PState { buffer :: StringBuffer, dflags :: DynFlags, messages :: Messages, + tab_first :: Maybe RealSrcSpan, -- pos of first tab warning in the file + tab_count :: !Int, -- number of tab warnings in the file last_tk :: Maybe Token, last_loc :: RealSrcSpan, -- pos of previous token last_len :: !Int, -- len of previous token @@ -2083,6 +2090,8 @@ mkPState flags buf loc = buffer = buf, dflags = flags, messages = emptyMessages, + tab_first = Nothing, + tab_count = 0, last_tk = Nothing, last_loc = mkRealSrcSpan loc loc, last_len = 0, @@ -2146,8 +2155,34 @@ addWarning option srcspan warning ws' = if wopt option d then ws `snocBag` warning' else ws in POk s{messages=(ws', es)} () +addTabWarning :: RealSrcSpan -> P () +addTabWarning srcspan + = P $ \s at PState{tab_first=tf, tab_count=tc, dflags=d} -> + let tf' = if isJust tf then tf else Just srcspan + tc' = tc + 1 + s' = if wopt Opt_WarnTabs d + then s{tab_first = tf', tab_count = tc'} + else s + in POk s' () +addTabWarning _ + = P $ \s -> POk s () + +mkTabWarning :: PState -> Maybe ErrMsg +mkTabWarning PState{tab_first=tf, tab_count=tc, dflags=d} = + let middle = if tc == 1 + then text "" + else text ", and in" <+> speakNOf (tc - 1) (text "further location") + message = text "Tab character found here" + <> middle + <> text "." + $+$ text "Please use spaces instead." + in fmap (\s -> mkWarnMsg d (RealSrcSpan s) alwaysQualify message) tf + getMessages :: PState -> Messages -getMessages PState{messages=ms} = ms +getMessages p at PState{messages=(ws,es)} = + let tabwarning = mkTabWarning p + ws' = maybe ws (`consBag` ws) tabwarning + in (ws', es) getContext :: P [LayoutContext] getContext = P $ \s at PState{context=ctx} -> POk s ctx diff --git a/testsuite/tests/driver/werror.stderr b/testsuite/tests/driver/werror.stderr index b723c39..5541dfc 100644 --- a/testsuite/tests/driver/werror.stderr +++ b/testsuite/tests/driver/werror.stderr @@ -8,7 +8,9 @@ werror.hs:7:13: Warning: werror.hs:7:13: Warning: Defined but not used: ?main? -werror.hs:8:1: Warning: Tab character +werror.hs:8:1: Warning: + Tab character found here. + Please use spaces instead. werror.hs:10:1: Warning: Defined but not used: ?f? diff --git a/testsuite/tests/parser/should_compile/read043.hs b/testsuite/tests/parser/should_compile/T9723a.hs similarity index 54% copy from testsuite/tests/parser/should_compile/read043.hs copy to testsuite/tests/parser/should_compile/T9723a.hs index c663a75..b75944a 100644 --- a/testsuite/tests/parser/should_compile/read043.hs +++ b/testsuite/tests/parser/should_compile/T9723a.hs @@ -1,11 +1,9 @@ {-# OPTIONS -fwarn-tabs #-} --- Check we get a warning for tabs +-- Check we get a warning for a single tab module ShouldCompile where tab1 = 'a' -notab = 'b' -tab2 = 'c' diff --git a/testsuite/tests/parser/should_compile/T9723a.stderr b/testsuite/tests/parser/should_compile/T9723a.stderr new file mode 100644 index 0000000..c445de1 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723a.stderr @@ -0,0 +1,4 @@ + +T9723a.hs:8:5: Warning: + Tab character found here. + Please use spaces instead. diff --git a/testsuite/tests/parser/should_compile/T9723b.hs b/testsuite/tests/parser/should_compile/T9723b.hs new file mode 100644 index 0000000..d84e24c --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723b.hs @@ -0,0 +1,22 @@ + +{-# OPTIONS -fwarn-tabs #-} + +-- Check we get a warning for multiple tabs, with the correct number of tabs +-- mentioned + +module ShouldCompile where + +-- tab in middle of line +tab1 = 'a' +-- tab at end of line +tab2 = 'b' +-- two tabs in middle of line +tab3 = 'c' + +tab4 = if True +-- tab at start of line + then 'd' +-- tab at start of line + else 'e' + + -- tab before a comment starts diff --git a/testsuite/tests/parser/should_compile/T9723b.stderr b/testsuite/tests/parser/should_compile/T9723b.stderr new file mode 100644 index 0000000..2526450 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723b.stderr @@ -0,0 +1,4 @@ + +T9723b.hs:9:5: Warning: + Tab character found here, and in six further locations. + Please use spaces instead. diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 13acedf..6eb593a 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -98,3 +98,5 @@ test('T7118', normal, compile, ['']) test('T7776', normal, compile, ['']) test('RdrNoStaticPointers01', when(compiler_lt('ghc', '7.9'), skip), compile, ['']) test('T5682', normal, compile, ['']) +test('T9723a', normal, compile, ['']) +test('T9723b', normal, compile, ['']) diff --git a/testsuite/tests/parser/should_compile/read043.stderr b/testsuite/tests/parser/should_compile/read043.stderr index dc1e844..76b1fb4 100644 --- a/testsuite/tests/parser/should_compile/read043.stderr +++ b/testsuite/tests/parser/should_compile/read043.stderr @@ -1,4 +1,4 @@ -read043.hs:8:5: Warning: Tab character - -read043.hs:10:5: Warning: Tab character +read043.hs:8:5: Warning: + Tab character found here, and in one further location. + Please use spaces instead. diff --git a/testsuite/tests/warnings/should_compile/T9230.stderr b/testsuite/tests/warnings/should_compile/T9230.stderr index 09e1f64..2c7cee0 100644 --- a/testsuite/tests/warnings/should_compile/T9230.stderr +++ b/testsuite/tests/warnings/should_compile/T9230.stderr @@ -1,2 +1,4 @@ -T9230.hs:5:1: Warning: Tab character +T9230.hs:5:1: Warning: + Tab character found here. + Please use spaces instead. From git at git.haskell.org Thu Apr 2 16:58:16 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 16:58:16 +0000 (UTC) Subject: [commit: ghc] wip/T9723: Change 'Tab character' warnings so there is one per file (#9723) (afcfb62) Message-ID: <20150402165816.DD7983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T9723 Link : http://ghc.haskell.org/trac/ghc/changeset/afcfb62b748c41d31b8c8e3ef7f623fa00a1cfd2/ghc >--------------------------------------------------------------- commit afcfb62b748c41d31b8c8e3ef7f623fa00a1cfd2 Author: Dave Laing Date: Thu Apr 2 18:51:46 2015 +0200 Change 'Tab character' warnings so there is one per file (#9723) Reviewed By: nomeata, thomie Differential Revision: https://phabricator.haskell.org/D760 Signed-off-by: Dave Laing >--------------------------------------------------------------- afcfb62b748c41d31b8c8e3ef7f623fa00a1cfd2 compiler/parser/Lexer.x | 39 ++++++++++++++++++++-- testsuite/tests/driver/werror.stderr | 4 ++- .../should_compile/{read043.hs => T9723a.hs} | 4 +-- .../tests/parser/should_compile/T9723a.stderr | 4 +++ testsuite/tests/parser/should_compile/T9723b.hs | 22 ++++++++++++ .../tests/parser/should_compile/T9723b.stderr | 4 +++ testsuite/tests/parser/should_compile/all.T | 2 ++ .../tests/parser/should_compile/read043.stderr | 6 ++-- .../tests/warnings/should_compile/T9230.stderr | 4 ++- 9 files changed, 79 insertions(+), 10 deletions(-) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index abb2477..e451b5f 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -203,7 +203,7 @@ haskell :- -- everywhere: skip whitespace $white_no_nl+ ; -$tab+ { warn Opt_WarnTabs (text "Tab character") } +$tab { warnTab } -- Everywhere: deal with nested comments. We explicitly rule out -- pragmas, "{-#", so that we don't accidentally treat them as comments. @@ -1655,6 +1655,11 @@ warn option warning srcspan _buf _len = do addWarning option (RealSrcSpan srcspan) warning lexToken +warnTab :: Action +warnTab srcspan _buf _len = do + addTabWarning srcspan + lexToken + warnThen :: WarningFlag -> SDoc -> Action -> Action warnThen option warning action srcspan buf len = do addWarning option (RealSrcSpan srcspan) warning @@ -1680,6 +1685,8 @@ data PState = PState { buffer :: StringBuffer, dflags :: DynFlags, messages :: Messages, + tab_first :: Maybe RealSrcSpan, -- pos of first tab warning in the file + tab_count :: !Int, -- number of tab warnings in the file last_tk :: Maybe Token, last_loc :: RealSrcSpan, -- pos of previous token last_len :: !Int, -- len of previous token @@ -2083,6 +2090,8 @@ mkPState flags buf loc = buffer = buf, dflags = flags, messages = emptyMessages, + tab_first = Nothing, + tab_count = 0, last_tk = Nothing, last_loc = mkRealSrcSpan loc loc, last_len = 0, @@ -2146,8 +2155,34 @@ addWarning option srcspan warning ws' = if wopt option d then ws `snocBag` warning' else ws in POk s{messages=(ws', es)} () +addTabWarning :: RealSrcSpan -> P () +addTabWarning srcspan + = P $ \s at PState{tab_first=tf, tab_count=tc, dflags=d} -> + let tf' = if isJust tf then tf else Just srcspan + tc' = tc + 1 + s' = if wopt Opt_WarnTabs d + then s{tab_first = tf', tab_count = tc'} + else s + in POk s' () +addTabWarning _ + = P $ \s -> POk s () + +mkTabWarning :: PState -> Maybe ErrMsg +mkTabWarning PState{tab_first=tf, tab_count=tc, dflags=d} = + let middle = if tc == 1 + then text "" + else text ", and in" <+> speakNOf (tc - 1) (text "further location") + message = text "Tab character found here" + <> middle + <> text "." + $+$ text "Please use spaces instead." + in fmap (\s -> mkWarnMsg d (RealSrcSpan s) alwaysQualify message) tf + getMessages :: PState -> Messages -getMessages PState{messages=ms} = ms +getMessages p at PState{messages=(ws,es)} = + let tabwarning = mkTabWarning p + ws' = maybe ws (`consBag` ws) tabwarning + in (ws', es) getContext :: P [LayoutContext] getContext = P $ \s at PState{context=ctx} -> POk s ctx diff --git a/testsuite/tests/driver/werror.stderr b/testsuite/tests/driver/werror.stderr index b723c39..5541dfc 100644 --- a/testsuite/tests/driver/werror.stderr +++ b/testsuite/tests/driver/werror.stderr @@ -8,7 +8,9 @@ werror.hs:7:13: Warning: werror.hs:7:13: Warning: Defined but not used: ?main? -werror.hs:8:1: Warning: Tab character +werror.hs:8:1: Warning: + Tab character found here. + Please use spaces instead. werror.hs:10:1: Warning: Defined but not used: ?f? diff --git a/testsuite/tests/parser/should_compile/read043.hs b/testsuite/tests/parser/should_compile/T9723a.hs similarity index 54% copy from testsuite/tests/parser/should_compile/read043.hs copy to testsuite/tests/parser/should_compile/T9723a.hs index c663a75..b75944a 100644 --- a/testsuite/tests/parser/should_compile/read043.hs +++ b/testsuite/tests/parser/should_compile/T9723a.hs @@ -1,11 +1,9 @@ {-# OPTIONS -fwarn-tabs #-} --- Check we get a warning for tabs +-- Check we get a warning for a single tab module ShouldCompile where tab1 = 'a' -notab = 'b' -tab2 = 'c' diff --git a/testsuite/tests/parser/should_compile/T9723a.stderr b/testsuite/tests/parser/should_compile/T9723a.stderr new file mode 100644 index 0000000..c445de1 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723a.stderr @@ -0,0 +1,4 @@ + +T9723a.hs:8:5: Warning: + Tab character found here. + Please use spaces instead. diff --git a/testsuite/tests/parser/should_compile/T9723b.hs b/testsuite/tests/parser/should_compile/T9723b.hs new file mode 100644 index 0000000..d84e24c --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723b.hs @@ -0,0 +1,22 @@ + +{-# OPTIONS -fwarn-tabs #-} + +-- Check we get a warning for multiple tabs, with the correct number of tabs +-- mentioned + +module ShouldCompile where + +-- tab in middle of line +tab1 = 'a' +-- tab at end of line +tab2 = 'b' +-- two tabs in middle of line +tab3 = 'c' + +tab4 = if True +-- tab at start of line + then 'd' +-- tab at start of line + else 'e' + + -- tab before a comment starts diff --git a/testsuite/tests/parser/should_compile/T9723b.stderr b/testsuite/tests/parser/should_compile/T9723b.stderr new file mode 100644 index 0000000..2526450 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T9723b.stderr @@ -0,0 +1,4 @@ + +T9723b.hs:9:5: Warning: + Tab character found here, and in six further locations. + Please use spaces instead. diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 13acedf..6eb593a 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -98,3 +98,5 @@ test('T7118', normal, compile, ['']) test('T7776', normal, compile, ['']) test('RdrNoStaticPointers01', when(compiler_lt('ghc', '7.9'), skip), compile, ['']) test('T5682', normal, compile, ['']) +test('T9723a', normal, compile, ['']) +test('T9723b', normal, compile, ['']) diff --git a/testsuite/tests/parser/should_compile/read043.stderr b/testsuite/tests/parser/should_compile/read043.stderr index dc1e844..76b1fb4 100644 --- a/testsuite/tests/parser/should_compile/read043.stderr +++ b/testsuite/tests/parser/should_compile/read043.stderr @@ -1,4 +1,4 @@ -read043.hs:8:5: Warning: Tab character - -read043.hs:10:5: Warning: Tab character +read043.hs:8:5: Warning: + Tab character found here, and in one further location. + Please use spaces instead. diff --git a/testsuite/tests/warnings/should_compile/T9230.stderr b/testsuite/tests/warnings/should_compile/T9230.stderr index 09e1f64..2c7cee0 100644 --- a/testsuite/tests/warnings/should_compile/T9230.stderr +++ b/testsuite/tests/warnings/should_compile/T9230.stderr @@ -1,2 +1,4 @@ -T9230.hs:5:1: Warning: Tab character +T9230.hs:5:1: Warning: + Tab character found here. + Please use spaces instead. From git at git.haskell.org Thu Apr 2 16:59:54 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 16:59:54 +0000 (UTC) Subject: [commit: ghc] master's head updated: Change 'Tab character' warnings so there is one per file (#9723) (afcfb62) Message-ID: <20150402165954.691D63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'master' now includes: afcfb62 Change 'Tab character' warnings so there is one per file (#9723) From git at git.haskell.org Thu Apr 2 17:14:34 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 17:14:34 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T9723' deleted Message-ID: <20150402171434.CE2DD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/T9723 From git at git.haskell.org Thu Apr 2 21:05:01 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 21:05:01 +0000 (UTC) Subject: [commit: ghc] master: libffi: backport noexecstack fix for x86/win32.S (47f821a) Message-ID: <20150402210501.C30573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/47f821a1a24553dc29b9581b1a259a9b1394c955/ghc >--------------------------------------------------------------- commit 47f821a1a24553dc29b9581b1a259a9b1394c955 Author: Sergei Trofimovich Date: Thu Apr 2 22:02:57 2015 +0100 libffi: backport noexecstack fix for x86/win32.S Got detected by gentoo's QA preinstall hook: * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6.0.2 * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o Signed-off-by: Sergei Trofimovich Test Plan: built ghc-7.10.1 binary and checked stacks as NX Reviewers: rwbarton, hvr, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D764 GHC Trac Issues: #10208 >--------------------------------------------------------------- 47f821a1a24553dc29b9581b1a259a9b1394c955 libffi/ghc.mk | 3 +++ libffi/libffi.x86-execstack.patch | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/libffi/ghc.mk b/libffi/ghc.mk index a5645de..59e089d 100644 --- a/libffi/ghc.mk +++ b/libffi/ghc.mk @@ -67,6 +67,9 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP) # will use cygwin symbolic links which cannot be read by mingw gcc. chmod +x libffi/ln + # don't report nonselinux systems as selinux + ( cd libffi/build && "$(PATCH_CMD)" -p0 < ../libffi.x86-execstack.patch; ) + # We need to use -MMD rather than -MD, as otherwise we get paths # like c:/... in the dependency files on Windows, and the extra # colons break make diff --git a/libffi/libffi.x86-execstack.patch b/libffi/libffi.x86-execstack.patch new file mode 100644 index 0000000..baea18f --- /dev/null +++ b/libffi/libffi.x86-execstack.patch @@ -0,0 +1,24 @@ + * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6.0.2 + * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so + * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6 + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o + +http://bugs.gentoo.org/511634 +http://sourceware.org/ml/libffi-discuss/2014/msg00058.html + +--- src/x86/win32.S ++++ src/x86/win32.S +@@ -1304,3 +1304,6 @@ + + #endif /* !_MSC_VER */ + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"", at progbits ++#endif From git at git.haskell.org Thu Apr 2 21:06:25 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 21:06:25 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: libffi: backport noexecstack fix for x86/win32.S (56ecec4) Message-ID: <20150402210625.D34963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/56ecec4986d21468e7146017831a110bd3a4a86c/ghc >--------------------------------------------------------------- commit 56ecec4986d21468e7146017831a110bd3a4a86c Author: Sergei Trofimovich Date: Thu Apr 2 22:02:57 2015 +0100 libffi: backport noexecstack fix for x86/win32.S Got detected by gentoo's QA preinstall hook: * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6.0.2 * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o Signed-off-by: Sergei Trofimovich Test Plan: built ghc-7.10.1 binary and checked stacks as NX Reviewers: rwbarton, hvr, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D764 GHC Trac Issues: #10208 (cherry picked from commit 47f821a1a24553dc29b9581b1a259a9b1394c955) >--------------------------------------------------------------- 56ecec4986d21468e7146017831a110bd3a4a86c libffi/ghc.mk | 3 +++ libffi/libffi.x86-execstack.patch | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/libffi/ghc.mk b/libffi/ghc.mk index a5645de..59e089d 100644 --- a/libffi/ghc.mk +++ b/libffi/ghc.mk @@ -67,6 +67,9 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP) # will use cygwin symbolic links which cannot be read by mingw gcc. chmod +x libffi/ln + # don't report nonselinux systems as selinux + ( cd libffi/build && "$(PATCH_CMD)" -p0 < ../libffi.x86-execstack.patch; ) + # We need to use -MMD rather than -MD, as otherwise we get paths # like c:/... in the dependency files on Windows, and the extra # colons break make diff --git a/libffi/libffi.x86-execstack.patch b/libffi/libffi.x86-execstack.patch new file mode 100644 index 0000000..baea18f --- /dev/null +++ b/libffi/libffi.x86-execstack.patch @@ -0,0 +1,24 @@ + * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6.0.2 + * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so + * RWX --- --- usr/lib/ghc-7.10.1/rts/libffi.so.6 + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o + * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o + +http://bugs.gentoo.org/511634 +http://sourceware.org/ml/libffi-discuss/2014/msg00058.html + +--- src/x86/win32.S ++++ src/x86/win32.S +@@ -1304,3 +1304,6 @@ + + #endif /* !_MSC_VER */ + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"", at progbits ++#endif From git at git.haskell.org Thu Apr 2 22:19:43 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Apr 2015 22:19:43 +0000 (UTC) Subject: [commit: ghc] master: Fix validate linenumber off-by-one (48977c8) Message-ID: <20150402221943.1B5A23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/48977c8f23fe4a4b461366c314e07d247234b686/ghc >--------------------------------------------------------------- commit 48977c8f23fe4a4b461366c314e07d247234b686 Author: Thomas Miedema Date: Fri Apr 3 00:19:15 2015 +0200 Fix validate linenumber off-by-one >--------------------------------------------------------------- 48977c8f23fe4a4b461366c314e07d247234b686 testsuite/tests/parser/should_compile/T9723b.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/parser/should_compile/T9723b.stderr b/testsuite/tests/parser/should_compile/T9723b.stderr index 2526450..088b722 100644 --- a/testsuite/tests/parser/should_compile/T9723b.stderr +++ b/testsuite/tests/parser/should_compile/T9723b.stderr @@ -1,4 +1,4 @@ -T9723b.hs:9:5: Warning: +T9723b.hs:10:5: Warning: Tab character found here, and in six further locations. Please use spaces instead. From git at git.haskell.org Fri Apr 3 05:33:07 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:33:07 +0000 (UTC) Subject: [commit: ghc] master: clarify --no-as-needed is only needed on ELF (13a0d5a) Message-ID: <20150403053307.3E0513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/13a0d5ac95a80e8b3604e084ae189da405a47270/ghc >--------------------------------------------------------------- commit 13a0d5ac95a80e8b3604e084ae189da405a47270 Author: Peter Trommler Date: Fri Apr 3 00:22:59 2015 -0500 clarify --no-as-needed is only needed on ELF From the code it was not clear that `--no-as-needed` was not necessary on Windows. Add this fact and describe the fix for #10110 in a separate note. See audit for rGHC1b7f59769052fd8193c6acc561216e070d0ca335 raised by @thomie. Reviewed By: thomie Differential Revision: https://phabricator.haskell.org/D791 GHC Trac Issues: #10110 >--------------------------------------------------------------- 13a0d5ac95a80e8b3604e084ae189da405a47270 compiler/main/SysTools.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index e6e7fa6..f642213 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -717,6 +717,10 @@ We cache the LinkerInfo inside DynFlags, since clients may link multiple times. The definition of LinkerInfo is there to avoid a circular dependency. +-} + +{- Note [ELF needed shared libs] + Some distributions change the link editor's default handling of ELF DT_NEEDED tags to include only those shared objects that are needed to resolve undefined symbols. For Template Haskell we need @@ -724,8 +728,10 @@ the last temporary shared library also if it is not needed for the currently linked temporary shared library. We specify --no-as-needed to override the default. This flag exists in GNU ld and GNU gold. --} +The flag is only needed on ELF systems. On Windows (PE) and Mac OS X +(Mach-O) the flag is not needed. +-} neededLinkArgs :: LinkerInfo -> [Option] neededLinkArgs (GnuLD o) = o @@ -763,10 +769,13 @@ getLinkerInfo' dflags = do -- Set DT_NEEDED for all shared libraries. Trac #10110. return (GnuLD $ map Option ["-Wl,--hash-size=31", "-Wl,--reduce-memory-overheads", + -- ELF specific flag + -- see Note [ELF needed shared libs] "-Wl,--no-as-needed"]) | any ("GNU gold" `isPrefixOf`) stdo = -- GNU gold only needs --no-as-needed. Trac #10110. + -- ELF specific flag, see Note [ELF needed shared libs] return (GnuGold [Option "-Wl,--no-as-needed"]) -- Unknown linker. From git at git.haskell.org Fri Apr 3 05:33:10 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:33:10 +0000 (UTC) Subject: [commit: ghc] master: docs: remove unused -ddump flags from users guide (78c79e3) Message-ID: <20150403053310.012F73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/78c79e39b36b6e76d911ca7a25e2db79d5a01ec0/ghc >--------------------------------------------------------------- commit 78c79e39b36b6e76d911ca7a25e2db79d5a01ec0 Author: Javran Cheng Date: Fri Apr 3 00:24:06 2015 -0500 docs: remove unused -ddump flags from users guide According to https://phabricator.haskell.org/rGHC6e771fa19dbb7edc116b5974124229a2725103e8 Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D793 >--------------------------------------------------------------- 78c79e39b36b6e76d911ca7a25e2db79d5a01ec0 docs/users_guide/debugging.xml | 20 -------------------- docs/users_guide/flags.xml | 12 ------------ 2 files changed, 32 deletions(-) diff --git a/docs/users_guide/debugging.xml b/docs/users_guide/debugging.xml index 07e2a4b..aebb928 100644 --- a/docs/users_guide/debugging.xml +++ b/docs/users_guide/debugging.xml @@ -182,16 +182,6 @@ - : - - - - CPR analyser output - - - - - : @@ -262,16 +252,6 @@ - : - - - - flattened Abstract C - - - - - : diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 1385acb..4d4706b 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -2990,12 +2990,6 @@ - - - Dump output from CPR analysis - dynamic - - - - Dump CSE output dynamic @@ -3014,12 +3008,6 @@ - - - Dump “flat” C - dynamic - - - - Dump foreign export stubs dynamic From git at git.haskell.org Fri Apr 3 05:33:12 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:33:12 +0000 (UTC) Subject: [commit: ghc] master: Restore unwind information generation (59f7a7b) Message-ID: <20150403053312.D67263A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/59f7a7b6091e9c0564f3f370d09398d8c9cd8ad5/ghc >--------------------------------------------------------------- commit 59f7a7b6091e9c0564f3f370d09398d8c9cd8ad5 Author: Peter Wortmann Date: Fri Apr 3 00:23:56 2015 -0500 Restore unwind information generation While we want to reduce the amount of information generated into debug_info, it really doesn't make sense to remove block information for unwinding. This is a simple oversight introduced in 4ab57024, which severly reduces the usefulness of generated unwind data. Thanks to bitonic for spotting this! Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D792 GHC Trac Issues: #10236 >--------------------------------------------------------------- 59f7a7b6091e9c0564f3f370d09398d8c9cd8ad5 compiler/nativeGen/Dwarf.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/nativeGen/Dwarf.hs b/compiler/nativeGen/Dwarf.hs index d7c2f61..ff86fd8 100644 --- a/compiler/nativeGen/Dwarf.hs +++ b/compiler/nativeGen/Dwarf.hs @@ -35,11 +35,11 @@ dwarfGen df modLoc us blocks = do -- Convert debug data structures to DWARF info records -- We strip out block information, as it is not currently useful for -- anything. In future we might want to only do this for -g1. - let procs = map stripBlocks $ debugSplitProcs blocks + let procs = debugSplitProcs blocks stripBlocks dbg = dbg { dblBlocks = [] } compPath <- getCurrentDirectory let dwarfUnit = DwarfCompileUnit - { dwChildren = map (procToDwarf df) procs + { dwChildren = map (procToDwarf df) (map stripBlocks procs) , dwName = fromMaybe "" (ml_hs_file modLoc) , dwCompDir = addTrailingPathSeparator compPath , dwProducer = cProjectName ++ " " ++ cProjectVersion From git at git.haskell.org Fri Apr 3 05:41:59 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:41:59 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: clarify --no-as-needed is only needed on ELF (7b8da47) Message-ID: <20150403054159.3857F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/7b8da47ae8f99f7a452d83f1e09c876792c001af/ghc >--------------------------------------------------------------- commit 7b8da47ae8f99f7a452d83f1e09c876792c001af Author: Peter Trommler Date: Fri Apr 3 00:22:59 2015 -0500 clarify --no-as-needed is only needed on ELF From the code it was not clear that `--no-as-needed` was not necessary on Windows. Add this fact and describe the fix for #10110 in a separate note. See audit for rGHC1b7f59769052fd8193c6acc561216e070d0ca335 raised by @thomie. Reviewed By: thomie Differential Revision: https://phabricator.haskell.org/D791 GHC Trac Issues: #10110 (cherry picked from commit 13a0d5ac95a80e8b3604e084ae189da405a47270) >--------------------------------------------------------------- 7b8da47ae8f99f7a452d83f1e09c876792c001af compiler/main/SysTools.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 26e8cf6..8fa947c 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -715,6 +715,10 @@ We cache the LinkerInfo inside DynFlags, since clients may link multiple times. The definition of LinkerInfo is there to avoid a circular dependency. +-} + +{- Note [ELF needed shared libs] + Some distributions change the link editor's default handling of ELF DT_NEEDED tags to include only those shared objects that are needed to resolve undefined symbols. For Template Haskell we need @@ -722,8 +726,10 @@ the last temporary shared library also if it is not needed for the currently linked temporary shared library. We specify --no-as-needed to override the default. This flag exists in GNU ld and GNU gold. --} +The flag is only needed on ELF systems. On Windows (PE) and Mac OS X +(Mach-O) the flag is not needed. +-} neededLinkArgs :: LinkerInfo -> [Option] neededLinkArgs (GnuLD o) = o @@ -761,10 +767,13 @@ getLinkerInfo' dflags = do -- Set DT_NEEDED for all shared libraries. Trac #10110. return (GnuLD $ map Option ["-Wl,--hash-size=31", "-Wl,--reduce-memory-overheads", + -- ELF specific flag + -- see Note [ELF needed shared libs] "-Wl,--no-as-needed"]) | any ("GNU gold" `isPrefixOf`) stdo = -- GNU gold only needs --no-as-needed. Trac #10110. + -- ELF specific flag, see Note [ELF needed shared libs] return (GnuGold [Option "-Wl,--no-as-needed"]) -- Unknown linker. From git at git.haskell.org Fri Apr 3 05:42:02 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:42:02 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: docs: remove unused -ddump flags from users guide (c05804a) Message-ID: <20150403054202.0C6D73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/c05804aae32b476c0287d942c95e006eb530f427/ghc >--------------------------------------------------------------- commit c05804aae32b476c0287d942c95e006eb530f427 Author: Javran Cheng Date: Fri Apr 3 00:24:06 2015 -0500 docs: remove unused -ddump flags from users guide According to https://phabricator.haskell.org/rGHC6e771fa19dbb7edc116b5974124229a2725103e8 Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D793 (cherry picked from commit 78c79e39b36b6e76d911ca7a25e2db79d5a01ec0) >--------------------------------------------------------------- c05804aae32b476c0287d942c95e006eb530f427 docs/users_guide/debugging.xml | 20 -------------------- docs/users_guide/flags.xml | 12 ------------ 2 files changed, 32 deletions(-) diff --git a/docs/users_guide/debugging.xml b/docs/users_guide/debugging.xml index 07e2a4b..aebb928 100644 --- a/docs/users_guide/debugging.xml +++ b/docs/users_guide/debugging.xml @@ -182,16 +182,6 @@ - : - - - - CPR analyser output - - - - - : @@ -262,16 +252,6 @@ - : - - - - flattened Abstract C - - - - - : diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 994a2c2..a7f4473 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -2960,12 +2960,6 @@ - - - Dump output from CPR analysis - dynamic - - - - Dump CSE output dynamic @@ -2984,12 +2978,6 @@ - - - Dump “flat” C - dynamic - - - - Dump foreign export stubs dynamic From git at git.haskell.org Fri Apr 3 05:42:04 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:42:04 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Restore unwind information generation (2f7eb6c) Message-ID: <20150403054204.C2D2E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/2f7eb6c74f4c7f0f6ea4eea476cf56bdbb7d0d62/ghc >--------------------------------------------------------------- commit 2f7eb6c74f4c7f0f6ea4eea476cf56bdbb7d0d62 Author: Peter Wortmann Date: Fri Apr 3 00:23:56 2015 -0500 Restore unwind information generation While we want to reduce the amount of information generated into debug_info, it really doesn't make sense to remove block information for unwinding. This is a simple oversight introduced in 4ab57024, which severly reduces the usefulness of generated unwind data. Thanks to bitonic for spotting this! Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D792 GHC Trac Issues: #10236 (cherry picked from commit 59f7a7b6091e9c0564f3f370d09398d8c9cd8ad5) >--------------------------------------------------------------- 2f7eb6c74f4c7f0f6ea4eea476cf56bdbb7d0d62 compiler/nativeGen/Dwarf.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/nativeGen/Dwarf.hs b/compiler/nativeGen/Dwarf.hs index d7c2f61..ff86fd8 100644 --- a/compiler/nativeGen/Dwarf.hs +++ b/compiler/nativeGen/Dwarf.hs @@ -35,11 +35,11 @@ dwarfGen df modLoc us blocks = do -- Convert debug data structures to DWARF info records -- We strip out block information, as it is not currently useful for -- anything. In future we might want to only do this for -g1. - let procs = map stripBlocks $ debugSplitProcs blocks + let procs = debugSplitProcs blocks stripBlocks dbg = dbg { dblBlocks = [] } compPath <- getCurrentDirectory let dwarfUnit = DwarfCompileUnit - { dwChildren = map (procToDwarf df) procs + { dwChildren = map (procToDwarf df) (map stripBlocks procs) , dwName = fromMaybe "" (ml_hs_file modLoc) , dwCompDir = addTrailingPathSeparator compPath , dwProducer = cProjectName ++ " " ++ cProjectVersion From git at git.haskell.org Fri Apr 3 05:42:08 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:42:08 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: docs: add 7.10.2 relnotes skeleton (0953afd) Message-ID: <20150403054208.19F0C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/0953afdbee59d93a2a8ccd47e77e8eae29b5ab1c/ghc >--------------------------------------------------------------- commit 0953afdbee59d93a2a8ccd47e77e8eae29b5ab1c Author: Austin Seipp Date: Fri Apr 3 00:38:44 2015 -0500 docs: add 7.10.2 relnotes skeleton Signed-off-by: Austin Seipp >--------------------------------------------------------------- 0953afdbee59d93a2a8ccd47e77e8eae29b5ab1c docs/users_guide/7.10.2-notes.xml | 21 +++++++++++++++++++++ docs/users_guide/intro.xml | 1 + docs/users_guide/ug-ent.xml.in | 1 + 3 files changed, 23 insertions(+) diff --git a/docs/users_guide/7.10.2-notes.xml b/docs/users_guide/7.10.2-notes.xml new file mode 100644 index 0000000..12be64d --- /dev/null +++ b/docs/users_guide/7.10.2-notes.xml @@ -0,0 +1,21 @@ + + + Release notes for version 7.10.2 + + + The 7.10.2 release is a bugfix release. The major bugfixes relative + to 7.10.1 are listed below. + + + + GHC + + + + + Lorem ipsum... (issue #ABCDE). + + + + + diff --git a/docs/users_guide/intro.xml b/docs/users_guide/intro.xml index 6da7004..3292334 100644 --- a/docs/users_guide/intro.xml +++ b/docs/users_guide/intro.xml @@ -308,6 +308,7 @@ &relnotes1; +&relnotes2; diff --git a/docs/users_guide/ug-ent.xml.in b/docs/users_guide/ug-ent.xml.in index 6753ff7..b696aad 100644 --- a/docs/users_guide/ug-ent.xml.in +++ b/docs/users_guide/ug-ent.xml.in @@ -4,6 +4,7 @@ + From git at git.haskell.org Fri Apr 3 05:42:10 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:42:10 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: docs: some 7.10.2 release notes (ea93048) Message-ID: <20150403054210.CC4AE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/ea9304838f1f52b54f3167e6cb522206f775a40b/ghc >--------------------------------------------------------------- commit ea9304838f1f52b54f3167e6cb522206f775a40b Author: Austin Seipp Date: Fri Apr 3 00:42:16 2015 -0500 docs: some 7.10.2 release notes Signed-off-by: Austin Seipp >--------------------------------------------------------------- ea9304838f1f52b54f3167e6cb522206f775a40b docs/users_guide/7.10.2-notes.xml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/7.10.2-notes.xml b/docs/users_guide/7.10.2-notes.xml index 12be64d..10c6708 100644 --- a/docs/users_guide/7.10.2-notes.xml +++ b/docs/users_guide/7.10.2-notes.xml @@ -13,7 +13,21 @@ - Lorem ipsum... (issue #ABCDE). + A bug which caused GHC to generate bad DWARF unwinding + information has been fixed (issue #10236). + + + + + A bug which caused GHC's libffi.so + library to be built with executable stacks on some + platforms has been fixed (issue #10208). + + + + + A bus error on SPARC machines caused by misaligned data + accesses in the RTS has been fixed. From git at git.haskell.org Fri Apr 3 05:49:52 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:49:52 +0000 (UTC) Subject: [commit: ghc] master: parser: allow type-level cons in prefix position (012ea0b) Message-ID: <20150403054952.253C53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/012ea0b96cc041bced4565d74bef7ccb75f1af0d/ghc >--------------------------------------------------------------- commit 012ea0b96cc041bced4565d74bef7ccb75f1af0d Author: Kinokkory Date: Fri Apr 3 00:47:15 2015 -0500 parser: allow type-level cons in prefix position Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D768 GHC Trac Issues: #10188 >--------------------------------------------------------------- 012ea0b96cc041bced4565d74bef7ccb75f1af0d compiler/parser/Parser.y | 48 +++++++++++++++---------- testsuite/tests/parser/should_compile/T10188.hs | 13 +++++++ testsuite/tests/parser/should_compile/all.T | 1 + 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index d6b7ed6..67c90d5 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -89,10 +89,10 @@ import Util ( looksLikePackageName ) } -{- Last updated: 03 Mar 2015 +{- Last updated: 30 Mar 2015 -Conflicts: 48 shift/reduce - 1 reduce/reduce +Conflicts: 50 shift/reduce + 2 reduce/reduce If you modify this parser and add a conflict, please update this comment. You can learn more about the conflicts by passing 'happy' the -i flag: @@ -124,7 +124,7 @@ follows. Shift parses as if the 'module' keyword follows. ------------------------------------------------------------------------------- -state 49 contains 10 shift/reduce conflicts. +state 49 contains 11 shift/reduce conflicts. context -> btype . '~' btype (rule 279) context -> btype . (rule 280) @@ -137,7 +137,7 @@ state 49 contains 10 shift/reduce conflicts. type -> btype . SIMPLEQUOTE varop type (rule 287) btype -> btype . atype (rule 299) - Conflicts: '->' '-' '!' '*' '.' '`' VARSYM CONSYM QVARSYM QCONSYM + Conflicts: ':' '->' '-' '!' '*' '.' '`' VARSYM CONSYM QVARSYM QCONSYM Example of ambiguity: 'e :: a `b` c'; does this mean (e::a) `b` c, or @@ -197,7 +197,7 @@ a rule instructing how to rewrite the expression '[0] f'. ------------------------------------------------------------------------------- -state 285 contains 10 shift/reduce conflicts. +state 285 contains 11 shift/reduce conflicts. *** type -> btype . (rule 281) type -> btype . qtyconop type (rule 282) @@ -208,7 +208,7 @@ state 285 contains 10 shift/reduce conflicts. type -> btype . SIMPLEQUOTE varop type (rule 287) btype -> btype . atype (rule 299) - Conflicts: [elided] + Conflicts: ':' '->' '-' '!' '*' '.' '`' VARSYM CONSYM QVARSYM QCONSYM Same as State 49, but minus the context productions. @@ -218,7 +218,7 @@ state 320 contains 1 shift/reduce conflicts. tup_exprs -> commas . tup_tail (rule 502) sysdcon -> '(' commas . ')' (rule 610) - commas -> commas . ',' (rule 724) + commas -> commas . ',' (rule 725) Conflict: ')' (empty tup_tail reduces) @@ -265,7 +265,7 @@ TODO: Why? ------------------------------------------------------------------------------- -state 461 contains 1 shift/reduce conflicts. +state 462 contains 1 shift/reduce conflicts. *** strict_mark -> '{-# NOUNPACK' '#-}' . (rule 268) strict_mark -> '{-# NOUNPACK' '#-}' . '!' (rule 270) @@ -276,7 +276,7 @@ TODO: Why? ------------------------------------------------------------------------------- -state 462 contains 1 shift/reduce conflicts. +state 463 contains 1 shift/reduce conflicts. *** strict_mark -> '{-# UNPACK' '#-}' . (rule 267) strict_mark -> '{-# UNPACK' '#-}' . '!' (rule 269) @@ -287,7 +287,7 @@ Same as State 462 ------------------------------------------------------------------------------- -state 493 contains 1 shift/reduce conflicts. +state 494 contains 1 shift/reduce conflicts. context -> btype '~' btype . (rule 279) *** type -> btype '~' btype . (rule 285) @@ -299,7 +299,7 @@ TODO: Why? ------------------------------------------------------------------------------- -state 628 contains 1 shift/reduce conflicts. +state 629 contains 1 shift/reduce conflicts. *** aexp2 -> ipvar . (rule 462) dbind -> ipvar . '=' exp (rule 587) @@ -314,7 +314,7 @@ sensible meaning, namely the lhs of an implicit binding. ------------------------------------------------------------------------------- -state 695 contains 1 shift/reduce conflicts. +state 696 contains 1 shift/reduce conflicts. rule -> STRING rule_activation . rule_forall infixexp '=' exp (rule 214) @@ -331,7 +331,7 @@ doesn't include 'forall'. ------------------------------------------------------------------------------- -state 768 contains 1 shift/reduce conflicts. +state 769 contains 1 shift/reduce conflicts. *** type -> btype '~' btype . (rule 285) btype -> btype . atype (rule 299) @@ -342,11 +342,11 @@ TODO: Why? ------------------------------------------------------------------------------- -state 951 contains 1 shift/reduce conflicts. +state 952 contains 1 shift/reduce conflicts. transformqual -> 'then' 'group' . 'using' exp (rule 525) transformqual -> 'then' 'group' . 'by' exp 'using' exp (rule 526) - *** special_id -> 'group' . (rule 700) + *** special_id -> 'group' . (rule 701) Conflict: 'by' @@ -354,10 +354,21 @@ TODO: Why? ------------------------------------------------------------------------------- -state 1228 contains 1 reduce/reduce conflicts. +state 1229 contains 1 reduce/reduce conflicts. + + *** tyconsym -> ':' . (rule 642) + consym -> ':' . (rule 712) + + Conflict: ')' + +TODO: Same as State 1230 + +------------------------------------------------------------------------------- + +state 1230 contains 1 reduce/reduce conflicts. *** tyconsym -> CONSYM . (rule 640) - consym -> CONSYM . (rule 710) + consym -> CONSYM . (rule 711) Conflict: ')' @@ -2857,6 +2868,7 @@ qtyconsym :: { Located RdrName } tyconsym :: { Located RdrName } : CONSYM { sL1 $1 $! mkUnqual tcClsName (getCONSYM $1) } | VARSYM { sL1 $1 $! mkUnqual tcClsName (getVARSYM $1) } + | ':' { sL1 $1 $! consDataCon_RDR } | '*' { sL1 $1 $! mkUnqual tcClsName (fsLit "*") } | '-' { sL1 $1 $! mkUnqual tcClsName (fsLit "-") } diff --git a/testsuite/tests/parser/should_compile/T10188.hs b/testsuite/tests/parser/should_compile/T10188.hs new file mode 100644 index 0000000..f12a197 --- /dev/null +++ b/testsuite/tests/parser/should_compile/T10188.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE DataKinds, PolyKinds, TypeOperators, TypeFamilies #-} + +module T10188 where + +data Peano = Zero | Succ Peano + +type family Length (as :: [k]) :: Peano where + Length (a : as) = Succ (Length as) + Length '[] = Zero + +type family Length' (as :: [k]) :: Peano where + Length' ((:) a as) = Succ (Length' as) + Length' '[] = Zero diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 6eb593a..9e7612c 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -100,3 +100,4 @@ test('RdrNoStaticPointers01', when(compiler_lt('ghc', '7.9'), skip), compile, [' test('T5682', normal, compile, ['']) test('T9723a', normal, compile, ['']) test('T9723b', normal, compile, ['']) +test('T10188', normal, compile, ['']) From git at git.haskell.org Fri Apr 3 05:49:55 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:49:55 +0000 (UTC) Subject: [commit: ghc] master: Data.Complex: Derive Generic (3541f73) Message-ID: <20150403054955.2B67A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3541f736486d08df36863fd8e29deb1ca637a498/ghc >--------------------------------------------------------------- commit 3541f736486d08df36863fd8e29deb1ca637a498 Author: Ben Gamari Date: Fri Apr 3 00:48:51 2015 -0500 Data.Complex: Derive Generic Reviewed By: hvr, austin Differential Revision: https://phabricator.haskell.org/D770 >--------------------------------------------------------------- 3541f736486d08df36863fd8e29deb1ca637a498 libraries/base/Data/Complex.hs | 4 +++- libraries/base/changelog.md | 1 + testsuite/tests/generics/T5884.hs | 5 ++--- testsuite/tests/generics/T5884Other.hs | 3 +++ testsuite/tests/generics/all.T | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libraries/base/Data/Complex.hs b/libraries/base/Data/Complex.hs index 88aa597..c6420cd 100644 --- a/libraries/base/Data/Complex.hs +++ b/libraries/base/Data/Complex.hs @@ -1,6 +1,7 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE Trustworthy #-} {-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE DeriveGeneric #-} ----------------------------------------------------------------------------- -- | @@ -34,6 +35,7 @@ module Data.Complex ) where +import GHC.Generics (Generic) import Data.Data (Data) import Foreign (Storable, castPtr, peek, poke, pokeElemOff, peekElemOff, sizeOf, alignment) @@ -51,7 +53,7 @@ infix 6 :+ data Complex a = !a :+ !a -- ^ forms a complex number from its real and imaginary -- rectangular components. - deriving (Eq, Show, Read, Data) + deriving (Eq, Show, Read, Data, Generic) -- ----------------------------------------------------------------------------- -- Functions over Complex diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f402189..ea509af 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -29,6 +29,7 @@ * New `GHC.Stack.CallStack` data type + * `Complex` now has a `Generic` instance ## 4.8.0.0 *Mar 2015* diff --git a/testsuite/tests/generics/T5884.hs b/testsuite/tests/generics/T5884.hs index 6dfad25..92b5087 100644 --- a/testsuite/tests/generics/T5884.hs +++ b/testsuite/tests/generics/T5884.hs @@ -3,7 +3,6 @@ module T5884 where import GHC.Generics +import T5884Other -import Data.Complex - -deriving instance Generic (Complex v) +deriving instance Generic (Pair a) diff --git a/testsuite/tests/generics/T5884Other.hs b/testsuite/tests/generics/T5884Other.hs new file mode 100644 index 0000000..2cf8250 --- /dev/null +++ b/testsuite/tests/generics/T5884Other.hs @@ -0,0 +1,3 @@ +module T5884Other where + +data Pair a = Pair a a diff --git a/testsuite/tests/generics/all.T b/testsuite/tests/generics/all.T index c51de18..98116ec 100644 --- a/testsuite/tests/generics/all.T +++ b/testsuite/tests/generics/all.T @@ -26,7 +26,8 @@ test('T5462Yes2', extra_clean(['T5462Yes2/GFunctor.hi']) test('T5462No1', extra_clean(['T5462No1/GFunctor.hi']) , multimod_compile_fail, ['T5462No1', '-iGFunctor -outputdir=T5462No1']) -test('T5884', normal, compile, ['']) +test('T5884', extra_clean(['T5884Other.o', 'T5884Other.hi']) + , multimod_compile, ['T5884Other', '-v0']) test('GenNewtype', normal, compile_and_run, ['']) test('GenDerivOutput1_0', normal, compile, ['-dsuppress-uniques']) From git at git.haskell.org Fri Apr 3 05:49:57 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:49:57 +0000 (UTC) Subject: [commit: ghc] master: Remove an incorrect statement about -fwarn-tabs (2255c76) Message-ID: <20150403054957.F117E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2255c76c7049314d3d8545efb6317688ba0da72c/ghc >--------------------------------------------------------------- commit 2255c76c7049314d3d8545efb6317688ba0da72c Author: Dave Laing Date: Fri Apr 3 00:49:38 2015 -0500 Remove an incorrect statement about -fwarn-tabs Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D772 GHC Trac Issues: #10213 >--------------------------------------------------------------- 2255c76c7049314d3d8545efb6317688ba0da72c docs/users_guide/using.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 19839cf..68d2752 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -1802,8 +1802,6 @@ f "2" = 2 tabs, warning Have the compiler warn if there are tabs in your source file. - - This warning is off by default. From git at git.haskell.org Fri Apr 3 05:51:19 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 05:51:19 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Remove an incorrect statement about -fwarn-tabs (d7338ac) Message-ID: <20150403055119.5D6BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/d7338ac592838eacbac5b772cbab1d7d66848867/ghc >--------------------------------------------------------------- commit d7338ac592838eacbac5b772cbab1d7d66848867 Author: Dave Laing Date: Fri Apr 3 00:49:38 2015 -0500 Remove an incorrect statement about -fwarn-tabs Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D772 GHC Trac Issues: #10213 (cherry picked from commit 2255c76c7049314d3d8545efb6317688ba0da72c) >--------------------------------------------------------------- d7338ac592838eacbac5b772cbab1d7d66848867 docs/users_guide/using.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index c1a5196..50da497 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -1755,8 +1755,6 @@ f "2" = 2 tabs, warning Have the compiler warn if there are tabs in your source file. - - This warning is off by default. From git at git.haskell.org Fri Apr 3 12:02:17 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 12:02:17 +0000 (UTC) Subject: [commit: ghc] master: Don't `make accept` output of `expect_broken_for` tests (fd1099c) Message-ID: <20150403120217.60AB53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fd1099cb7076b94f776a06212b5ba2ae1aac0673/ghc >--------------------------------------------------------------- commit fd1099cb7076b94f776a06212b5ba2ae1aac0673 Author: Thomas Miedema Date: Fri Apr 3 14:01:15 2015 +0200 Don't `make accept` output of `expect_broken_for` tests This is a followup to d4cf7051bc17182238b17ba1dc42e190fa5c6f0d, which did the same for `expect_broken` tests. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D786 >--------------------------------------------------------------- fd1099cb7076b94f776a06212b5ba2ae1aac0673 testsuite/driver/testlib.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index b4c64ca..430779b 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1041,7 +1041,7 @@ def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts, over (platform_specific, expected_stderr_file) = platform_wordsize_qualify(namebase, 'stderr') actual_stderr_file = qualify(name, 'comp.stderr') - if not compare_outputs('stderr', + if not compare_outputs(way, 'stderr', join_normalisers(getTestOpts().extra_errmsg_normaliser, normalise_errmsg, normalise_whitespace), @@ -1071,7 +1071,8 @@ def compile_cmp_asm( name, way, extra_hc_opts ): (platform_specific, expected_asm_file) = platform_wordsize_qualify(namebase, 'asm') actual_asm_file = qualify(name, 's') - if not compare_outputs('asm', join_normalisers(normalise_errmsg, normalise_asm), \ + if not compare_outputs(way, 'asm', + join_normalisers(normalise_errmsg, normalise_asm), expected_asm_file, actual_asm_file): return failBecause('asm mismatch') @@ -1339,8 +1340,8 @@ def simple_run( name, way, prog, args ): check_prof = my_rts_flags.find("-p") != -1 if not opts.ignore_output: - bad_stderr = not opts.combined_output and not check_stderr_ok(name) - bad_stdout = not check_stdout_ok(name) + bad_stderr = not opts.combined_output and not check_stderr_ok(name, way) + bad_stdout = not check_stdout_ok(name, way) if bad_stderr: return failBecause('bad stderr') if bad_stdout: @@ -1348,7 +1349,7 @@ def simple_run( name, way, prog, args ): # exit_code > 127 probably indicates a crash, so don't try to run hp2ps. if check_hp and (exit_code <= 127 or exit_code == 251) and not check_hp_ok(name): return failBecause('bad heap profile') - if check_prof and not check_prof_ok(name): + if check_prof and not check_prof_ok(name, way): return failBecause('bad profile') return checkStats(name, way, stats_file, opts.stats_range_fields) @@ -1455,8 +1456,8 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ): # ToDo: if the sub-shell was killed by ^C, then exit - if getTestOpts().ignore_output or (check_stderr_ok(name) and - check_stdout_ok(name)): + if getTestOpts().ignore_output or (check_stderr_ok(name, way) and + check_stdout_ok(name, way)): return passed() else: return failBecause('bad stdout or stderr') @@ -1501,7 +1502,7 @@ def get_compiler_flags(override_flags, noforce): return flags -def check_stdout_ok( name ): +def check_stdout_ok(name, way): if getTestOpts().with_namebase == None: namebase = name else: @@ -1522,15 +1523,14 @@ def check_stdout_ok( name ): if check_stdout: return check_stdout(actual_stdout_file, extra_norm) - return compare_outputs('stdout', \ - extra_norm, \ + return compare_outputs(way, 'stdout', extra_norm, expected_stdout_file, actual_stdout_file) def dump_stdout( name ): print('Stdout:') print(read_no_crs(qualify(name, 'run.stdout'))) -def check_stderr_ok( name ): +def check_stderr_ok(name, way): if getTestOpts().with_namebase == None: namebase = name else: @@ -1545,7 +1545,7 @@ def check_stderr_ok( name ): else: return normalise_errmsg(str) - return compare_outputs('stderr', \ + return compare_outputs(way, 'stderr', join_normalisers(norm, getTestOpts().extra_errmsg_normaliser), \ expected_stderr_file, actual_stderr_file) @@ -1595,7 +1595,7 @@ def check_hp_ok(name): print("hp2ps error when processing heap profile for " + name) return(False) -def check_prof_ok(name): +def check_prof_ok(name, way): prof_file = qualify(name,'prof') @@ -1619,14 +1619,14 @@ def check_prof_ok(name): if not os.path.exists(expected_prof_file): return True else: - return compare_outputs('prof', \ + return compare_outputs(way, 'prof', join_normalisers(normalise_whitespace,normalise_prof), \ expected_prof_file, prof_file) # Compare expected output to actual output, and optionally accept the # new output. Returns true if output matched or was accepted, false # otherwise. -def compare_outputs( kind, normaliser, expected_file, actual_file ): +def compare_outputs(way, kind, normaliser, expected_file, actual_file): if os.path.exists(expected_file): expected_raw = read_no_crs(expected_file) # print "norm:", normaliser(expected_raw) @@ -1671,7 +1671,8 @@ def compare_outputs( kind, normaliser, expected_file, actual_file ): r = os.system( 'diff -u ' + expected_file_for_diff + \ ' ' + actual_file ) - if config.accept and getTestOpts().expect == 'fail': + if config.accept and (getTestOpts().expect == 'fail' or + way in getTestOpts().expect_fail_for): if_verbose(1, 'Test is expected to fail. Not accepting new output.') return 0 elif config.accept: From git at git.haskell.org Fri Apr 3 16:53:14 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 16:53:14 +0000 (UTC) Subject: [commit: ghc] master: Comments only, mostly typos (ab0743f) Message-ID: <20150403165314.BBCEF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ab0743f84aabc2b4f5681c09a3e11cb219d114e4/ghc >--------------------------------------------------------------- commit ab0743f84aabc2b4f5681c09a3e11cb219d114e4 Author: Thomas Miedema Date: Fri Apr 3 17:58:53 2015 +0200 Comments only, mostly typos [skip ci] >--------------------------------------------------------------- ab0743f84aabc2b4f5681c09a3e11cb219d114e4 compiler/hsSyn/HsExpr.hs | 2 +- compiler/main/GhcMake.hs | 2 +- compiler/simplCore/SimplMonad.hs | 2 +- compiler/types/TypeRep.hs | 6 +++--- ghc.mk | 6 +++--- testsuite/tests/th/all.T | 2 +- utils/ghc-pkg/Main.hs | 4 +++- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 5c5e8e4..efefd17 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -772,7 +772,7 @@ However, some code is internally generated, and in some places parens are absolutely required; so for these places we use pprParendExpr (but don't print double parens of course). -For operator applications we don't add parens, because the oprerator +For operator applications we don't add parens, because the operator fixities should do the job, except in debug mode (-dppr-debug) so we can see the structure of the parse tree. -} diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index f9e61a5..818bb73 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -97,7 +97,7 @@ label_self thread_name = do -- -- Note that each 'ModSummary' in the module graph caches its 'DynFlags'. -- These 'DynFlags' are determined by the /current/ session 'DynFlags' and the --- @OPTIONS@ and @LANGUAGE@ pragmas of the parsed module. Thus if you want to +-- @OPTIONS@ and @LANGUAGE@ pragmas of the parsed module. Thus if you want -- changes to the 'DynFlags' to take effect you need to call this function -- again. -- diff --git a/compiler/simplCore/SimplMonad.hs b/compiler/simplCore/SimplMonad.hs index 7eb6a54..bd60a79 100644 --- a/compiler/simplCore/SimplMonad.hs +++ b/compiler/simplCore/SimplMonad.hs @@ -91,7 +91,7 @@ computeMaxTicks dflags size -- MAGIC NUMBER, multiplies the simplTickFactor -- We can afford to be generous; this is really -- just checking for loops, and shouldn't usually fire - -- A figure of 20 was too small: see Trac #553 + -- A figure of 20 was too small: see Trac #5539. {-# INLINE thenSmpl #-} {-# INLINE thenSmpl_ #-} diff --git a/compiler/types/TypeRep.hs b/compiler/types/TypeRep.hs index c78c9c5..3e46de3 100644 --- a/compiler/types/TypeRep.hs +++ b/compiler/types/TypeRep.hs @@ -98,7 +98,7 @@ import qualified Data.Data as Data hiding ( TyCon ) data Type = TyVarTy Var -- ^ Vanilla type or kind variable (*never* a coercion variable) - | AppTy -- See Note [AppTy invariant] + | AppTy -- See Note [AppTy rep] Type Type -- ^ Type application to something other than a 'TyCon'. Parameters: -- @@ -107,10 +107,10 @@ data Type -- -- 2) Argument type - | TyConApp -- See Note [AppTy invariant] + | TyConApp -- See Note [AppTy rep] TyCon [KindOrType] -- ^ Application of a 'TyCon', including newtypes /and/ synonyms. - -- Invariant: saturated appliations of 'FunTyCon' must + -- Invariant: saturated applications of 'FunTyCon' must -- use 'FunTy' and saturated synonyms must use their own -- constructors. However, /unsaturated/ 'FunTyCon's -- do appear as 'TyConApp's. diff --git a/ghc.mk b/ghc.mk index 3638a1b..b9bba13 100644 --- a/ghc.mk +++ b/ghc.mk @@ -49,18 +49,18 @@ # o Build utils/ghc-pkg # o Build utils/hsc2hs # * For each package: -# o configure, generate package-data.mk and inplace-pkg-info +# o configure, generate package-data.mk and inplace-pkg-config # o register each package into inplace/lib/package.conf # * build libffi (if not disabled by --with-system-libffi) # * With bootstrapping compiler: # o Build libraries/{filepath,hpc,Cabal} # o Build compiler (stage 1) -# * With stage 1: +# * With stage 1 compiler: # o Build libraries/* # o Build rts # o Build utils/* (except haddock) # o Build compiler (stage 2) -# * With stage 2: +# * With stage 2 compiler: # o Build utils/haddock # o Build compiler (stage 3) (optional) # * With haddock: diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 5b566cb..3bc7386 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -1,6 +1,6 @@ # This test needs to come before the setTestOpts calls below, as we want -# to run it if !compiler_profiled +# to run it if compiler_profiled. test('T4255', unless(compiler_profiled(), skip), compile_fail, ['-v0']) def f(name, opts): diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index bf9de0f..1389723 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -325,7 +325,7 @@ data PackageArg -- match a single entry in the package database. | IPId InstalledPackageId -- | A glob against the package name. The first string is the literal - -- glob, the second is a function which returns @True@ if the the argument + -- glob, the second is a function which returns @True@ if the argument -- matches. | Substring String (String->Bool) @@ -2023,5 +2023,7 @@ removeFileSafe fn = removeFile fn `catchIO` \ e -> when (not $ isDoesNotExistError e) $ ioError e +-- | Turn a path relative to the current directory into a (normalised) +-- absolute path. absolutePath :: FilePath -> IO FilePath absolutePath path = return . normalise . ( path) =<< getCurrentDirectory From git at git.haskell.org Fri Apr 3 19:55:44 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 19:55:44 +0000 (UTC) Subject: [commit: ghc] master: testsuite: skip T10017 on Windows (b0ba054) Message-ID: <20150403195544.F19173A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b0ba0545b3a238d9a9b93a8f68ed96a90be20c40/ghc >--------------------------------------------------------------- commit b0ba0545b3a238d9a9b93a8f68ed96a90be20c40 Author: Austin Seipp Date: Fri Apr 3 06:33:26 2015 -0500 testsuite: skip T10017 on Windows Signed-off-by: Austin Seipp >--------------------------------------------------------------- b0ba0545b3a238d9a9b93a8f68ed96a90be20c40 testsuite/tests/rts/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 05253fe..3965ee4 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -244,7 +244,8 @@ test('T9045', [ omit_ways(['ghci']), extra_run_opts('10000 +RTS -A8k -RTS') ], c # with the non-threaded one. test('T9078', [ omit_ways(threaded_ways) ], compile_and_run, ['-with-rtsopts="-DS" -debug']) -test('T10017', [ only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], compile_and_run, ['']) +test('T10017', [ when(opsys('mingw32'), skip) + , only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], 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 Fri Apr 3 19:55:48 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 19:55:48 +0000 (UTC) Subject: [commit: ghc] master: rts/linker: make an error msg a debug msg (54b7dc5) Message-ID: <20150403195548.0ACD33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/54b7dc5537f8b871e655752bace1ad6f5e6fe89a/ghc >--------------------------------------------------------------- commit 54b7dc5537f8b871e655752bace1ad6f5e6fe89a Author: Austin Seipp Date: Fri Apr 3 06:12:35 2015 -0500 rts/linker: make an error msg a debug msg This fixes more testsuite failures on Windows. Signed-off-by: Austin Seipp >--------------------------------------------------------------- 54b7dc5537f8b871e655752bace1ad6f5e6fe89a rts/Linker.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 0bd2aa8..5015135 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -4038,8 +4038,9 @@ lookupSymbolInDLLs ( UChar *lbl ) ret->addr = sym; ret->next = indirects; indirects = ret; - errorBelch("warning: %s from %S is linked instead of %s", - (char*)(lbl+6), o_dll->name, (char*)lbl); + IF_DEBUG(linker, + debugBelch("warning: %s from %S is linked instead of %s", + (char*)(lbl+6), o_dll->name, (char*)lbl)); return (void*) & ret->addr; } } From git at git.haskell.org Fri Apr 3 19:55:51 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Apr 2015 19:55:51 +0000 (UTC) Subject: [commit: ghc] master: testsuite: fix failing amd64/Windows perf tests (a0c1c96) Message-ID: <20150403195551.4D34D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a0c1c96515f4fbe1cf04b9760ed4f87e1544fcda/ghc >--------------------------------------------------------------- commit a0c1c96515f4fbe1cf04b9760ed4f87e1544fcda Author: Austin Seipp Date: Fri Apr 3 05:59:57 2015 -0500 testsuite: fix failing amd64/Windows perf tests Signed-off-by: Austin Seipp >--------------------------------------------------------------- a0c1c96515f4fbe1cf04b9760ed4f87e1544fcda testsuite/tests/callarity/perf/all.T | 3 ++- testsuite/tests/perf/should_run/all.T | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/testsuite/tests/callarity/perf/all.T b/testsuite/tests/callarity/perf/all.T index 1c79694..83083d4 100644 --- a/testsuite/tests/callarity/perf/all.T +++ b/testsuite/tests/callarity/perf/all.T @@ -1,9 +1,10 @@ test('T3924', [stats_num_field('bytes allocated', - [ (wordsize(64), 50760, 5), + [ (wordsize(64), 50760, 8), # previously, without call-arity: 22326544 # 2014-01-18: 51480 (amd64/Linux) # 2014-07-17: 50760 (amd64/Linux) (Roundabout adjustment) + # 2015-04-03: Widen 5->8% (amd64/Windows was doing better) (wordsize(32), 44988, 5) ]), # 2014-04-04: 44988 (Windows, 64-bit machine) only_ways(['normal']) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 3731218..f680104 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -16,10 +16,11 @@ test('T3586', test('T4830', [stats_num_field('bytes allocated', - [(wordsize(64), 98248, 1), + [(wordsize(64), 98248, 4), # 127000 (amd64/Linux) # 2013-02-07: 99264 (amd64/Linux) # 2014-01-13: 98248 (amd64/Linux) due to #8647 + # 2015-04-03: Widen 1->4% (amd64/Windows was doing better) (wordsize(32), 70646, 3)]), # 2013-02-10: 69744 (x86/Windows) # 2013-02-10: 71548 (x86/OSX) @@ -39,10 +40,11 @@ test('lazy-bs-alloc', [stats_num_field('peak_megabytes_allocated', (2, 1)), # expected value: 2 (amd64/Linux) stats_num_field('bytes allocated', - [(wordsize(64), 425400, 1), + [(wordsize(64), 425400, 3), # 489776 (amd64/Linux) # 2013-02-07: 429744 (amd64/Linux) # 2013-12-12: 425400 (amd64/Linux) + # 2015-04-04: Widen 1->3% (amd64/Windows was failing) (wordsize(32), 411500, 2)]), # 2013-02-10: 421296 (x86/Windows) # 2013-02-10: 414180 (x86/OSX) @@ -58,7 +60,9 @@ test('lazy-bs-alloc', test('T876', [stats_num_field('bytes allocated', - [(wordsize(64), 63216 , 5), + [(platform('x86_64-unknown-mingw32'), 71904, 5), + # 2015-04-03: 71904 (amd64/Windows, unknown cause) + (wordsize(64), 63216 , 5), # 2013-02-14: 1263712 (x86_64/Linux) # 2014-02-10: 63216 (x86_64/Linux), call arity analysis @@ -95,10 +99,11 @@ test('T3738', stats_num_field('bytes allocated', [(wordsize(32), 45648, 5), # expected value: 50520 (x86/Linux) - (wordsize(64), 50592, 5)]), + (wordsize(64), 50592, 8)]), # prev: 49400 (amd64/Linux) # 2014-07-17: 50520 (amd64/Linux) general round of updates # 2014-09-10: 50592 (amd64/Linux) post-AMP-update + # 2015-04-03: Widen 5->8% (amd64/Windows was doing better) only_ways(['normal']) ], compile_and_run, @@ -160,9 +165,10 @@ test('T5205', [stats_num_field('bytes allocated', [(wordsize(32), 47088, 5), # expected value: 47088 (x86/Darwin) - (wordsize(64), 52600, 5)]), + (wordsize(64), 52600, 7)]), # expected value: 51320 (amd64/Linux) # 2014-07-17: 52600 (amd64/Linux) general round of updates + # 2015-04-03: Widen 5->7% (amd64/Windows was doing better) only_ways(['normal', 'optasm']) ], compile_and_run, @@ -276,9 +282,10 @@ test('T7507', omit_ways(['ghci']), compile_and_run, ['-O']) test('T7436', [stats_num_field('max_bytes_used', - [(wordsize(64), 60360, 1), + [(wordsize(64), 60360, 4), # 127000 (amd64/Linux) # 2013-02-07: 60360 (amd64/Linux) + # 2015-04-03: Widen 1->4% (amd64/Windows was doing better) (wordsize(32), 58434, 1)]), # 2013-02-10: 58032 (x86/Windows) # 2013-02-10: 58836 (x86/OSX) From git at git.haskell.org Sun Apr 5 19:40:44 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Apr 2015 19:40:44 +0000 (UTC) Subject: [commit: ghc] master: Whitespace only (89eef44) Message-ID: <20150405194044.A9CCD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/89eef443f677e5e2baf43298ddf962990e747c60/ghc >--------------------------------------------------------------- commit 89eef443f677e5e2baf43298ddf962990e747c60 Author: Reid Barton Date: Sun Apr 5 15:33:35 2015 -0400 Whitespace only >--------------------------------------------------------------- 89eef443f677e5e2baf43298ddf962990e747c60 aclocal.m4 | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index f5456ae..c247f91 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -877,7 +877,7 @@ AC_CACHE_CHECK([for version of happy], fptools_cv_happy_version, changequote(, )dnl [if test x"$HappyCmd" != x; then fptools_cv_happy_version=`"$HappyCmd" -v | - grep 'Happy Version' | sed -e 's/Happy Version \([^ ]*\).*/\1/g'` ; + grep 'Happy Version' | sed -e 's/Happy Version \([^ ]*\).*/\1/g'` ; else fptools_cv_happy_version=""; fi; @@ -904,7 +904,7 @@ AC_CACHE_CHECK([for version of alex], fptools_cv_alex_version, changequote(, )dnl [if test x"$AlexCmd" != x; then fptools_cv_alex_version=`"$AlexCmd" -v | - grep 'Alex [Vv]ersion' | sed -e 's/Alex [Vv]ersion \([0-9\.]*\).*/\1/g'` ; + grep 'Alex [Vv]ersion' | sed -e 's/Alex [Vv]ersion \([0-9\.]*\).*/\1/g'` ; else fptools_cv_alex_version=""; fi; @@ -1276,7 +1276,7 @@ if grep '^conftest.txt$' conftest.out > /dev/null 2>&1 ; then *mingw32) if test x${OSTYPE} != xmsys then - fp_prog_find="`cygpath --mixed ${fp_prog_find}`" + fp_prog_find="`cygpath --mixed ${fp_prog_find}`" AC_MSG_NOTICE([normalized find command to $fp_prog_find]) fi ;; *) ;; @@ -2099,18 +2099,18 @@ AC_DEFUN([XCODE_VERSION],[ # $4 = the version of the command to look for # AC_DEFUN([FIND_LLVM_PROG],[ - # Test for program with version name. + # Test for program with version name. FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3-$4]) if test "$$1" = ""; then - # Test for program without version name. - FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) - AC_MSG_CHECKING([$$1 is version $4]) - if test `$$1 --version | grep -c "version $4"` -gt 0 ; then + # Test for program without version name. + FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) + AC_MSG_CHECKING([$$1 is version $4]) + if test `$$1 --version | grep -c "version $4"` -gt 0 ; then AC_MSG_RESULT(yes) else - AC_MSG_RESULT(no) - $1="" - fi + AC_MSG_RESULT(no) + $1="" + fi fi ]) @@ -2124,12 +2124,12 @@ AC_DEFUN([FIND_LLVM_PROG],[ # $3 = The string to grep for to find the correct line. # AC_DEFUN([FIND_GHC_BOOTSTRAP_PROG],[ - BootstrapTmpCmd=`grep $3 $($2 --print-libdir)/settings 2>/dev/null | sed 's/.*", "//;s/".*//'` - if test -n "$BootstrapTmpCmd" && test `basename $BootstrapTmpCmd` = $BootstrapTmpCmd ; then - AC_PATH_PROG([$1], [$BootstrapTmpCmd], "") - else - $1=$BootstrapTmpCmd - fi + BootstrapTmpCmd=`grep $3 $($2 --print-libdir)/settings 2>/dev/null | sed 's/.*", "//;s/".*//'` + if test -n "$BootstrapTmpCmd" && test `basename $BootstrapTmpCmd` = $BootstrapTmpCmd ; then + AC_PATH_PROG([$1], [$BootstrapTmpCmd], "") + else + $1=$BootstrapTmpCmd + fi ]) From git at git.haskell.org Sun Apr 5 19:58:16 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Apr 2015 19:58:16 +0000 (UTC) Subject: [commit: hsc2hs] master: Fix error when cross-compiling during GHC build. (a281856) Message-ID: <20150405195816.7EBAE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/a281856375beaf9082010c445599446faad6beb9 >--------------------------------------------------------------- commit a281856375beaf9082010c445599446faad6beb9 Author: Erik de Castro Lopo Date: Fri Apr 3 19:38:32 2015 +1100 Fix error when cross-compiling during GHC build. When `hsc2hs` is built and used in the GHC build process and GHC is being built as a cross compiler, the build process calls `hsc2hs` with `--cflag=-Werror=unused-but-set-variable` but some of the generated code failed with this error turned on. Closes: https://ghc.haskell.org/trac/ghc/ticket/10237 >--------------------------------------------------------------- a281856375beaf9082010c445599446faad6beb9 CrossCodegen.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CrossCodegen.hs b/CrossCodegen.hs index bb275ff..c1d627d 100644 --- a/CrossCodegen.hs +++ b/CrossCodegen.hs @@ -544,9 +544,9 @@ runCompileBooleanTest (ZCursor s above below) booleanTest = do (concatMap outHeaderCProg' above) ++ outHeaderCProg' s ++ -- the test - "void _hsc2hs_test() {\n" ++ + "int _hsc2hs_test() {\n" ++ " static int test_array[1 - 2 * !(" ++ booleanTest ++ ")];\n" ++ - " test_array[0] = 0;\n" ++ + " return test_array[0];\n" ++ "}\n" ++ (concatMap outHeaderCProg' below) runCompileTest test From git at git.haskell.org Sun Apr 5 19:59:39 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Apr 2015 19:59:39 +0000 (UTC) Subject: [commit: ghc] master: Update hsc2hs submodule (a1404e8) Message-ID: <20150405195939.A4EB03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a1404e88e8254eadd542c31796ab469a9f79a876/ghc >--------------------------------------------------------------- commit a1404e88e8254eadd542c31796ab469a9f79a876 Author: Reid Barton Date: Sun Apr 5 15:59:14 2015 -0400 Update hsc2hs submodule >--------------------------------------------------------------- a1404e88e8254eadd542c31796ab469a9f79a876 utils/hsc2hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/hsc2hs b/utils/hsc2hs index c16032d..a281856 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit c16032d83c8ce7ac3e11b99f8e80bfdfc77f0d1f +Subproject commit a281856375beaf9082010c445599446faad6beb9 From git at git.haskell.org Sun Apr 5 20:53:07 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Apr 2015 20:53:07 +0000 (UTC) Subject: [commit: ghc] master: CmmSwitch: Do not trip over a case with no (valid) branches (a838d1f) Message-ID: <20150405205307.AF28F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a838d1f7c668f6c5886ce350cb456f3ecbcb1499/ghc >--------------------------------------------------------------- commit a838d1f7c668f6c5886ce350cb456f3ecbcb1499 Author: Joachim Breitner Date: Sun Apr 5 22:50:42 2015 +0200 CmmSwitch: Do not trip over a case with no (valid) branches This fixes #10245. I did not commit the test case, as it fails unconditionally with a compiler built with -DDEBUG, so maybe it is bogus Haskell anyways. >--------------------------------------------------------------- a838d1f7c668f6c5886ce350cb456f3ecbcb1499 compiler/cmm/CmmSwitch.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/cmm/CmmSwitch.hs b/compiler/cmm/CmmSwitch.hs index 95e57c7..09abec6 100644 --- a/compiler/cmm/CmmSwitch.hs +++ b/compiler/cmm/CmmSwitch.hs @@ -88,7 +88,8 @@ minJumpTableOffset = 2 -- We use an Integer for the keys the map so that it can be used in switches on -- unsigned as well as signed integers. -- --- The map must not be empty. +-- The map may be empty (we prune out-of-range branches here, so it could be us +-- emptying it). -- -- Before code generation, the table needs to be brought into a form where all -- entries are non-negative, so that it can be compiled into a jump table. @@ -270,6 +271,7 @@ createSwitchPlan (SwitchTargets signed mbdef range m) = --- Step 1: Splitting at large holes --- splitAtHoles :: Integer -> M.Map Integer a -> [M.Map Integer a] +splitAtHoles _ m | M.null m = [] splitAtHoles holeSize m = map (\range -> restrictMap range m) nonHoles where holes = filter (\(l,h) -> h - l > holeSize) $ zip (M.keys m) (tail (M.keys m)) @@ -282,7 +284,7 @@ splitAtHoles holeSize m = map (\range -> restrictMap range m) nonHoles --- Step 2: Avoid small jump tables --- -- We do not want jump tables below a certain size. This breaks them up --- (into singleton maps, for now) +-- (into singleton maps, for now). breakTooSmall :: M.Map Integer a -> [M.Map Integer a] breakTooSmall m | M.size m > minJumpTableSize = [m] From git at git.haskell.org Mon Apr 6 07:38:19 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Apr 2015 07:38:19 +0000 (UTC) Subject: [commit: ghc] master: Test case for #10246 (8f07092) Message-ID: <20150406073819.C949E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f0709249826dd2eda9bf53be89f176a4f30c81f/ghc >--------------------------------------------------------------- commit 8f0709249826dd2eda9bf53be89f176a4f30c81f Author: Joachim Breitner Date: Mon Apr 6 09:37:42 2015 +0200 Test case for #10246 still marked known_broken. This also adds the test case for #10245, which should pass once #10246 is fixed. >--------------------------------------------------------------- 8f0709249826dd2eda9bf53be89f176a4f30c81f testsuite/tests/codeGen/should_run/T10245.hs | 13 ++++++++++ testsuite/tests/codeGen/should_run/T10245.stdout | 3 +++ testsuite/tests/codeGen/should_run/T10246.hs | 32 ++++++++++++++++++++++++ testsuite/tests/codeGen/should_run/T10246.stdout | 4 +++ testsuite/tests/codeGen/should_run/all.T | 2 ++ 5 files changed, 54 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T10245.hs b/testsuite/tests/codeGen/should_run/T10245.hs new file mode 100644 index 0000000..7094a1d --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T10245.hs @@ -0,0 +1,13 @@ +f :: Int -> String +f n = case n of + 0x8000000000000000 -> "yes" + _ -> "no" +{-# NOINLINE f #-} + +main = do + let string = "0x8000000000000000" + let i = read string :: Integer + let i' = fromIntegral i :: Int + print i + print i' + print (f i') diff --git a/testsuite/tests/codeGen/should_run/T10245.stdout b/testsuite/tests/codeGen/should_run/T10245.stdout new file mode 100644 index 0000000..87a02ea --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T10245.stdout @@ -0,0 +1,3 @@ +9223372036854775808 +-9223372036854775808 +"yes" diff --git a/testsuite/tests/codeGen/should_run/T10246.hs b/testsuite/tests/codeGen/should_run/T10246.hs new file mode 100644 index 0000000..ab4a229 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T10246.hs @@ -0,0 +1,32 @@ +f1 :: Int -> String +f1 n = case n of + 0 -> "bar" + 0x10000000000000000 -> "foo" + _ -> "c" +{-# NOINLINE f1 #-} + +g1 :: Int -> String +g1 n = if n == 0 then "bar" else + if n == 0x10000000000000000 then "foo" else + "c" +{-# NOINLINE g1 #-} + +f2 :: Int -> String +f2 n = case n of + 0x10000000000000000 -> "foo" + 0 -> "bar" + _ -> "c" +{-# NOINLINE f2 #-} + +g2 :: Int -> String +g2 n = if n == 0x10000000000000000 then "foo" else + if n == 0 then "bar" else + "c" +{-# NOINLINE g2 #-} + +main = do + let i = read "0" :: Int + print (f1 i) + print (g1 i) + print (f2 i) + print (g2 i) diff --git a/testsuite/tests/codeGen/should_run/T10246.stdout b/testsuite/tests/codeGen/should_run/T10246.stdout new file mode 100644 index 0000000..f073017 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T10246.stdout @@ -0,0 +1,4 @@ +"bar" +"bar" +"foo" +"foo" diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 15c3476..41d18e5 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -128,3 +128,5 @@ test('T9013', omit_ways(['ghci']), # ghci doesn't support unboxed tuples test('T9340', normal, compile_and_run, ['']) test('cgrun074', normal, compile_and_run, ['']) test('CmmSwitchTest', when(fast(), skip), compile_and_run, ['']) +test('T10245', expect_broken(10246), compile_and_run, ['']) +test('T10246', expect_broken(10246), compile_and_run, ['']) From git at git.haskell.org Mon Apr 6 08:39:18 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Apr 2015 08:39:18 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T10246' created Message-ID: <20150406083918.A997F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T10246 Referencing: 4870e5259ca8669c095defaf692d8e498489604f From git at git.haskell.org Mon Apr 6 08:39:21 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Apr 2015 08:39:21 +0000 (UTC) Subject: [commit: ghc] wip/T10246: Ensure that Literals in an Int# case are in range (4870e52) Message-ID: <20150406083921.7BCC33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10246 Link : http://ghc.haskell.org/trac/ghc/changeset/4870e5259ca8669c095defaf692d8e498489604f/ghc >--------------------------------------------------------------- commit 4870e5259ca8669c095defaf692d8e498489604f Author: Joachim Breitner Date: Mon Apr 6 10:31:02 2015 +0200 Ensure that Literals in an Int# case are in range This is one way to fix #10246. Three questions: * Can we rely on the target information in dflags this way? * Where should the to{Int,Word}{,64}Range functions live? * Should the clamping be moved from hsLitKey to mkMach*, effectively introducing a new invariant for the Mach* values? >--------------------------------------------------------------- 4870e5259ca8669c095defaf692d8e498489604f compiler/deSugar/MatchLit.hs | 8 ++++---- compiler/main/DynFlags.hs | 24 ++++++++++++++++++++++++ testsuite/tests/codeGen/should_run/all.T | 4 ++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/compiler/deSugar/MatchLit.hs b/compiler/deSugar/MatchLit.hs index 25021f5..22f7e66 100644 --- a/compiler/deSugar/MatchLit.hs +++ b/compiler/deSugar/MatchLit.hs @@ -382,10 +382,10 @@ hsLitKey :: DynFlags -> HsLit -> Literal -- (and doesn't for strings) -- It only works for primitive types and strings; -- others have been removed by tidy -hsLitKey dflags (HsIntPrim _ i) = mkMachInt dflags i -hsLitKey dflags (HsWordPrim _ w) = mkMachWord dflags w -hsLitKey _ (HsInt64Prim _ i) = mkMachInt64 i -hsLitKey _ (HsWord64Prim _ w) = mkMachWord64 w +hsLitKey dflags (HsIntPrim _ i) = mkMachInt dflags (toIntRange dflags i) +hsLitKey dflags (HsWordPrim _ w) = mkMachWord dflags (toWordRange dflags w) +hsLitKey dflags (HsInt64Prim _ i) = mkMachInt64 (toInt64Range dflags i) +hsLitKey dflags (HsWord64Prim _ w) = mkMachWord64 (toWord64Range dflags w) hsLitKey _ (HsCharPrim _ c) = MachChar c hsLitKey _ (HsStringPrim _ s) = MachStr s hsLitKey _ (HsFloatPrim f) = MachFloat (fl_value f) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 0dc25e3..2c599cd 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -130,6 +130,7 @@ module DynFlags ( tAG_MASK, mAX_PTR_TAG, tARGET_MIN_INT, tARGET_MAX_INT, tARGET_MAX_WORD, + toIntRange, toInt64Range, toWordRange, toWord64Range, unsafeGlobalDynFlags, setUnsafeGlobalDynFlags, @@ -4130,6 +4131,29 @@ tARGET_MAX_WORD dflags 8 -> toInteger (maxBound :: Word64) w -> panic ("tARGET_MAX_WORD: Unknown platformWordSize: " ++ show w) +toIntRange :: DynFlags -> Integer -> Integer +toIntRange dflags i + = case platformWordSize (targetPlatform dflags) of + 4 -> toInteger (fromIntegral i :: Int32) + 8 -> toInteger (fromIntegral i :: Int64) + w -> panic ("toIntRange: Unknown platformWordSize: " ++ show w) + +toInt64Range :: DynFlags -> Integer -> Integer +toInt64Range _dflags i -- DynFlags parameter just for consistency + = toInteger (fromIntegral i :: Int64) + +toWordRange :: DynFlags -> Integer -> Integer +toWordRange dflags i + = case platformWordSize (targetPlatform dflags) of + 4 -> toInteger (fromIntegral i :: Word32) + 8 -> toInteger (fromIntegral i :: Word64) + w -> panic ("toWordRange: Unknown platformWordSize: " ++ show w) + +toWord64Range :: DynFlags -> Integer -> Integer +toWord64Range _dflags i -- DynFlags parameter just for consistency + = toInteger (fromIntegral i :: Word64) + + -- Whenever makeDynFlagsConsistent does anything, it starts over, to -- ensure that a later change doesn't invalidate an earlier check. -- Be careful not to introduce potential loops! diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 41d18e5..e44e98a 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -128,5 +128,5 @@ test('T9013', omit_ways(['ghci']), # ghci doesn't support unboxed tuples test('T9340', normal, compile_and_run, ['']) test('cgrun074', normal, compile_and_run, ['']) test('CmmSwitchTest', when(fast(), skip), compile_and_run, ['']) -test('T10245', expect_broken(10246), compile_and_run, ['']) -test('T10246', expect_broken(10246), compile_and_run, ['']) +test('T10245', normal, compile_and_run, ['']) +test('T10246', normal, compile_and_run, ['']) From git at git.haskell.org Mon Apr 6 09:52:50 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Apr 2015 09:52:50 +0000 (UTC) Subject: [commit: ghc] master: User's guide: .a files can be 2-2.5x larger with -split-objs (fef4948) Message-ID: <20150406095250.7CBDC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fef4948f172b66eaf8db520b381dd4a8237b5644/ghc >--------------------------------------------------------------- commit fef4948f172b66eaf8db520b381dd4a8237b5644 Author: Thomas Miedema Date: Mon Apr 6 11:51:34 2015 +0200 User's guide: .a files can be 2-2.5x larger with -split-objs And remove warning. This feature is available through cabal even. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D801 >--------------------------------------------------------------- fef4948f172b66eaf8db520b381dd4a8237b5644 docs/users_guide/phases.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/users_guide/phases.xml b/docs/users_guide/phases.xml index b05de99..8994ffe 100644 --- a/docs/users_guide/phases.xml +++ b/docs/users_guide/phases.xml @@ -893,10 +893,10 @@ $ cat foo.hspp executables linked against the library are smaller as they only link against the object files that they need. However, assembling all the sections separately is expensive, so this is slower than - compiling normally. - We use this feature for building GHC's libraries - (warning: don't use it unless you know what you're - doing!). + compiling normally. Additionally, the size of the library itself + (the .a file) can be a factor of 2 to 2.5 + larger. + We use this feature for building GHC's libraries. From git at git.haskell.org Mon Apr 6 10:11:42 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Apr 2015 10:11:42 +0000 (UTC) Subject: [commit: ghc] master: Stop profiling output from running together (#8811) (c81e070) Message-ID: <20150406101142.5DB8E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c81e07063dd4f792d65f5933cfb906620d120b24/ghc >--------------------------------------------------------------- commit c81e07063dd4f792d65f5933cfb906620d120b24 Author: Dave Laing Date: Mon Apr 6 12:10:29 2015 +0200 Stop profiling output from running together (#8811) Reviewed By: thomie Differential Revision: https://phabricator.haskell.org/D779 >--------------------------------------------------------------- c81e07063dd4f792d65f5933cfb906620d120b24 rts/Profiling.c | 74 ++++++++++++++++------ .../tests/profiling/should_run/T2552.prof.sample | 54 ++++++++-------- .../tests/profiling/should_run/T5559.prof.sample | 30 +++++---- .../tests/profiling/should_run/T680.prof.sample | 52 +++++++-------- .../tests/profiling/should_run/ioprof.prof.sample | 54 ++++++++-------- .../profiling/should_run/prof-doc-fib.prof.sample | 41 ++++++------ .../profiling/should_run/prof-doc-last.prof.sample | 49 +++++++------- .../profiling/should_run/profinline001.prof.sample | 39 ++++++------ .../tests/profiling/should_run/scc001.prof.sample | 52 +++++++-------- .../tests/profiling/should_run/scc002.prof.sample | 40 ++++++------ .../tests/profiling/should_run/scc003.prof.sample | 32 +++++----- .../tests/profiling/should_run/scc005.prof.sample | 36 +++++------ 12 files changed, 298 insertions(+), 255 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 c81e07063dd4f792d65f5933cfb906620d120b24 From git at git.haskell.org Mon Apr 6 10:28:31 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Apr 2015 10:28:31 +0000 (UTC) Subject: [commit: ghc] master: fix '&stg_interp_constr_entry' FFI type to be FunPtr (22eecaf) Message-ID: <20150406102831.8B8103A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/22eecaff9db1feb7eef9ee8ed11fcef4df01b08e/ghc >--------------------------------------------------------------- commit 22eecaff9db1feb7eef9ee8ed11fcef4df01b08e Author: Sergei Trofimovich Date: Mon Apr 6 11:16:30 2015 +0100 fix '&stg_interp_constr_entry' FFI type to be FunPtr Summary: It used to be Ptr, which is slightly incorrect. ia64 has different representations for those types. Found when tried to build unregisterised ghc with -flto, GCC's link-time optimisation which happens to check data / code declaration inconsistencies. It our case 'stg_interp_constr_entry' is an RTS function: StgFunPtr f (StgFunPtr) while '"&f" :: Ptr()' produces StgWordArray f[]; Signed-off-by: Sergei Trofimovich Reviewers: simonmar, hvr, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D796 >--------------------------------------------------------------- 22eecaff9db1feb7eef9ee8ed11fcef4df01b08e compiler/ghci/ByteCodeItbls.hs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/compiler/ghci/ByteCodeItbls.hs b/compiler/ghci/ByteCodeItbls.hs index 872d728..cd31acb 100644 --- a/compiler/ghci/ByteCodeItbls.hs +++ b/compiler/ghci/ByteCodeItbls.hs @@ -30,7 +30,7 @@ import Foreign import Foreign.C import GHC.Exts ( Int(I#), addr2Int# ) -import GHC.Ptr ( Ptr(..) ) +import GHC.Ptr ( FunPtr(..) ) {- Manufacturing of info tables for DataCons @@ -87,7 +87,7 @@ make_constr_itbls dflags cons mk_dirret_itbl (dcon, conNo) = mk_itbl dcon conNo stg_interp_constr_entry - mk_itbl :: DataCon -> Int -> Ptr () -> IO (Name,ItblPtr) + mk_itbl :: DataCon -> Int -> EntryFunPtr -> IO (Name,ItblPtr) mk_itbl dcon conNo entry_addr = do let rep_args = [ (typePrimRep rep_arg,rep_arg) | arg <- dataConRepArgTys dcon, rep_arg <- flattenRepType (repType arg) ] (tot_wds, ptr_wds, _) = mkVirtHeapOffsets dflags False{-not a THUNK-} rep_args @@ -128,10 +128,10 @@ make_constr_itbls dflags cons type ItblCodes = Either [Word8] [Word32] -ptrToInt :: Ptr a -> Int -ptrToInt (Ptr a#) = I# (addr2Int# a#) +funPtrToInt :: FunPtr a -> Int +funPtrToInt (FunPtr a#) = I# (addr2Int# a#) -mkJumpToAddr :: DynFlags -> Ptr () -> ItblCodes +mkJumpToAddr :: DynFlags -> EntryFunPtr -> ItblCodes mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of ArchSPARC -> -- After some consideration, we'll try this, where @@ -144,7 +144,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- 0008 81C0C000 jmp %g3 -- 000c 01000000 nop - let w32 = fromIntegral (ptrToInt a) + let w32 = fromIntegral (funPtrToInt a) hi22, lo10 :: Word32 -> Word32 lo10 x = x .&. 0x3FF @@ -163,7 +163,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- 7D8903A6 mtctr r12 -- 4E800420 bctr - let w32 = fromIntegral (ptrToInt a) + let w32 = fromIntegral (funPtrToInt a) hi16 x = (x `shiftR` 16) .&. 0xFFFF lo16 x = x .&. 0xFFFF in Right [ 0x3D800000 .|. hi16 w32, @@ -176,7 +176,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- which is -- B8 ZZ YY XX WW FF E0 - let w32 = fromIntegral (ptrToInt a) :: Word32 + let w32 = fromIntegral (funPtrToInt a) :: Word32 insnBytes :: [Word8] insnBytes = [0xB8, byte0 w32, byte1 w32, @@ -200,7 +200,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- allocated in low memory). Assuming the info pointer is aligned to -- an 8-byte boundary, the addr will also be aligned. - let w64 = fromIntegral (ptrToInt a) :: Word64 + let w64 = fromIntegral (funPtrToInt a) :: Word64 insnBytes :: [Word8] insnBytes = [0xff, 0x25, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -210,7 +210,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of Left insnBytes ArchAlpha -> - let w64 = fromIntegral (ptrToInt a) :: Word64 + let w64 = fromIntegral (funPtrToInt a) :: Word64 in Right [ 0xc3800000 -- br at, .+4 , 0xa79c000c -- ldq at, 12(at) , 0x6bfc0000 -- jmp (at) # with zero hint -- oh well @@ -227,7 +227,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- 00000000 <.addr-0x8>: -- 0: 4900 ldr r1, [pc] ; 8 <.addr> -- 4: 4708 bx r1 - let w32 = fromIntegral (ptrToInt a) :: Word32 + let w32 = fromIntegral (funPtrToInt a) :: Word32 in Left [ 0x49, 0x00 , 0x47, 0x08 , byte0 w32, byte1 w32, byte2 w32, byte3 w32] @@ -249,7 +249,8 @@ byte6 w = fromIntegral (w `shiftR` 48) byte7 w = fromIntegral (w `shiftR` 56) -- entry point for direct returns for created constr itbls -foreign import ccall "&stg_interp_constr_entry" stg_interp_constr_entry :: Ptr () +foreign import ccall "&stg_interp_constr_entry" + stg_interp_constr_entry :: EntryFunPtr @@ -285,8 +286,10 @@ pokeConItbl dflags wr_ptr ex_ptr itbl store' (sizeOfItbl dflags) (pokeItbl dflags) (infoTable itbl) unless ghciTablesNextToCode $ store (conDesc itbl) +type EntryFunPtr = FunPtr (Ptr () -> IO (Ptr ())) + data StgInfoTable = StgInfoTable { - entry :: Maybe (Ptr ()), -- Just <=> not ghciTablesNextToCode + entry :: Maybe EntryFunPtr, -- Just <=> not ghciTablesNextToCode ptrs :: HalfWord, nptrs :: HalfWord, tipe :: HalfWord, From git at git.haskell.org Mon Apr 6 11:37:19 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Apr 2015 11:37:19 +0000 (UTC) Subject: [commit: ghc] master: fix typo (7209290) Message-ID: <20150406113719.434CA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72092904e0ac1725c05c0447e1efe7ab541faa95/ghc >--------------------------------------------------------------- commit 72092904e0ac1725c05c0447e1efe7ab541faa95 Author: Javran Cheng Date: Mon Apr 6 13:36:21 2015 +0200 fix typo [skip ci] Differential Revision: https://phabricator.haskell.org/D812 >--------------------------------------------------------------- 72092904e0ac1725c05c0447e1efe7ab541faa95 compiler/main/DriverPipeline.hs | 2 +- ghc/GhciMonad.hs | 2 +- libraries/base/GHC/Base.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 498b2f0..c86667c 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1730,7 +1730,7 @@ getLinkInfo dflags dep_packages = do -- return (show link_info) --- generates a Perl skript starting a parallel prg under PVM +-- generates a Perl script starting a parallel prg under PVM mk_pvm_wrapper_script :: String -> String -> String -> String mk_pvm_wrapper_script pvm_executable pvm_executable_base sysMan = unlines $ [ diff --git a/ghc/GhciMonad.hs b/ghc/GhciMonad.hs index 19b9009..cf82161 100644 --- a/ghc/GhciMonad.hs +++ b/ghc/GhciMonad.hs @@ -85,7 +85,7 @@ data GHCiState = GHCiState -- available ghci commands ghci_commands :: [Command], -- ":" at the GHCi prompt repeats the last command, so we - -- remember is here: + -- remember it here: last_command :: Maybe Command, cmdqueue :: [String], diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index d9192d7..79942d8 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -134,7 +134,7 @@ The Integer type is special because TidyPgm uses GHC.Integer.Type.mkInteger to construct Integer literal values Currently it reads the interface file whether or not the current module *has* any Integer literals, so it's important that -GHC.Integer.Type (in patckage integer-gmp or integer-simple) is +GHC.Integer.Type (in package integer-gmp or integer-simple) is compiled before any other module. (There's a hack in GHC to disable this for packages ghc-prim, integer-gmp, integer-simple, which aren't allowed to contain any Integer literals.) From git at git.haskell.org Tue Apr 7 08:57:40 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 08:57:40 +0000 (UTC) Subject: [commit: ghc] master: Replace hooks by callbacks in RtsConfig (#8785) (a7ab161) Message-ID: <20150407085740.7EF463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a7ab161602aa0b5833d22c66e64eebb1d9275235/ghc >--------------------------------------------------------------- commit a7ab161602aa0b5833d22c66e64eebb1d9275235 Author: Simon Marlow Date: Mon Jun 9 09:18:12 2014 +0100 Replace hooks by callbacks in RtsConfig (#8785) Summary: Hooks rely on static linking semantics, and are broken by -Bsymbolic which we need when using dynamic linking. Test Plan: Built it Reviewers: austin, hvr, tibbe Differential Revision: https://phabricator.haskell.org/D8 >--------------------------------------------------------------- a7ab161602aa0b5833d22c66e64eebb1d9275235 compiler/main/SysTools.hs | 11 +-- ghc/ghc.mk | 4 + ghc/hschooks.c | 12 +++ includes/Rts.h | 1 - includes/RtsAPI.h | 33 ++++++++ rts/Linker.c | 5 -- rts/RtsFlags.c | 153 +++++++++++++++++++++++------------- rts/RtsFlags.h | 7 +- rts/RtsStartup.c | 16 +--- rts/RtsUtils.c | 13 +-- rts/Stats.c | 26 +++++- rts/Stats.h | 1 + rts/hooks/FlagDefaults.c | 5 +- {includes/rts => rts/hooks}/Hooks.h | 7 +- rts/hooks/MallocFail.c | 1 + rts/hooks/OnExit.c | 1 + rts/hooks/OutOfHeap.c | 1 + rts/hooks/StackOverflow.c | 2 +- rts/sm/GC.c | 3 + rts/sm/GCThread.h | 1 + 20 files changed, 205 insertions(+), 98 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 a7ab161602aa0b5833d22c66e64eebb1d9275235 From git at git.haskell.org Tue Apr 7 08:57:43 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 08:57:43 +0000 (UTC) Subject: [commit: ghc] master: Add +RTS -O to control the minimum old gen size (890461e) Message-ID: <20150407085743.5DDF73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/890461ee01901207f8703274ae413508a8df904a/ghc >--------------------------------------------------------------- commit 890461ee01901207f8703274ae413508a8df904a Author: Simon Marlow Date: Tue Mar 24 14:20:58 2015 +0000 Add +RTS -O to control the minimum old gen size >--------------------------------------------------------------- 890461ee01901207f8703274ae413508a8df904a docs/users_guide/runtime_control.xml | 15 +++++++++++++++ rts/RtsFlags.c | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/docs/users_guide/runtime_control.xml b/docs/users_guide/runtime_control.xml index a55a1fe..b7551eb 100644 --- a/docs/users_guide/runtime_control.xml +++ b/docs/users_guide/runtime_control.xml @@ -385,6 +385,21 @@ $ ./prog -f +RTS -H32m -S -RTS -h foo bar + + size + RTS option + old generation, size + + + [Default: 1m] Set the minimum size of the + old generation. The old generation is collected whenever it + grows to this size or the value of the option + multiplied by the size of the live data at the previous major + collection, whichever is larger. + + + + size RTS option diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index ef01ccb..5c7fcef 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -267,6 +267,7 @@ usage_text[] = { " -kb Sets the stack chunk buffer size (default 1k)", "", " -A Sets the minimum allocation area size (default 512k) Egs: -A1m -A10k", +" -O Sets the minimum size of the old generation (default 1M)", " -M Sets the maximum heap size (default unlimited) Egs: -M256k -M1G", " -H Sets the minimum heap size (default 0M) Egs: -H24m -H1G", " -m Minimum % of heap which must be available (default 3%)", @@ -971,6 +972,14 @@ error = rtsTrue; } break; + case 'O': + OPTION_UNSAFE; + RtsFlags.GcFlags.minOldGenSize = + (nat)(decodeSize(rts_argv[arg], 2, BLOCK_SIZE, + HS_WORD_MAX) + / BLOCK_SIZE); + break; + case 'I': /* idle GC delay */ OPTION_UNSAFE; if (rts_argv[arg][2] == '\0') { From git at git.haskell.org Tue Apr 7 08:57:46 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 08:57:46 +0000 (UTC) Subject: [commit: ghc] master: Add -n to the RTS help output (93f3a64) Message-ID: <20150407085746.0D03A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/93f3a64eb8865cdd407b1df41bc6709e6c3e512c/ghc >--------------------------------------------------------------- commit 93f3a64eb8865cdd407b1df41bc6709e6c3e512c Author: Simon Marlow Date: Thu Mar 26 08:47:04 2015 +0000 Add -n to the RTS help output >--------------------------------------------------------------- 93f3a64eb8865cdd407b1df41bc6709e6c3e512c rts/RtsFlags.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 5c7fcef..0fbd05a 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -267,6 +267,7 @@ usage_text[] = { " -kb Sets the stack chunk buffer size (default 1k)", "", " -A Sets the minimum allocation area size (default 512k) Egs: -A1m -A10k", +" -n Allocation area chunk size (0 = disabled, default: 0)", " -O Sets the minimum size of the old generation (default 1M)", " -M Sets the maximum heap size (default unlimited) Egs: -M256k -M1G", " -H Sets the minimum heap size (default 0M) Egs: -H24m -H1G", From git at git.haskell.org Tue Apr 7 09:49:15 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 09:49:15 +0000 (UTC) Subject: [commit: ghc] master: Typechecker: refactoring only (f745b6e) Message-ID: <20150407094915.5AFC73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f745b6e83647fb14bd80094db63ee087d69f4494/ghc >--------------------------------------------------------------- commit f745b6e83647fb14bd80094db63ee087d69f4494 Author: Thomas Miedema Date: Tue Apr 7 11:48:35 2015 +0200 Typechecker: refactoring only * don't call `nlHsPar`, as `genOpApp` already does so. * don't reimplement `isUnboxedTupleTyCon` and `isBoxedTupleTyCon`. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D798 >--------------------------------------------------------------- f745b6e83647fb14bd80094db63ee087d69f4494 compiler/typecheck/TcGenDeriv.hs | 4 ++-- compiler/types/TyCon.hs | 7 ++----- testsuite/tests/deriving/should_run/T9576.stderr | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index 6216ec2..3d43935 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -1137,8 +1137,8 @@ gen_Show_binds get_fixity loc tycon ([a_Pat, con_pat], nlHsPar (nested_compose_Expr show_thingies)) | otherwise = ([a_Pat, con_pat], - showParen_Expr (nlHsPar (genOpApp a_Expr ge_RDR - (nlHsLit (HsInt "" con_prec_plus_one)))) + showParen_Expr (genOpApp a_Expr ge_RDR + (nlHsLit (HsInt "" con_prec_plus_one))) (nlHsPar (nested_compose_Expr show_thingies))) where data_con_RDR = getRdrName data_con diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 8e0175a..ea219c1 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -1189,9 +1189,7 @@ isPrimTyCon _ = False -- only be true for primitive and unboxed-tuple 'TyCon's isUnLiftedTyCon :: TyCon -> Bool isUnLiftedTyCon (PrimTyCon {isUnLifted = is_unlifted}) = is_unlifted -isUnLiftedTyCon (TupleTyCon {tyConTupleSort = sort}) - = not (isBoxed (tupleSortBoxity sort)) -isUnLiftedTyCon _ = False +isUnLiftedTyCon tc = isUnboxedTupleTyCon tc -- | Returns @True@ if the supplied 'TyCon' resulted from either a -- @data@ or @newtype@ declaration @@ -1217,8 +1215,7 @@ isDataTyCon (AlgTyCon {algTcRhs = rhs}) NewTyCon {} -> False DataFamilyTyCon {} -> False AbstractTyCon {} -> False -- We don't know, so return False -isDataTyCon (TupleTyCon {tyConTupleSort = sort}) = isBoxed (tupleSortBoxity sort) -isDataTyCon _ = False +isDataTyCon tc = isBoxedTupleTyCon tc -- | 'isDistinctTyCon' is true of 'TyCon's that are equal only to -- themselves, even via coercions (except for unsafeCoerce). diff --git a/testsuite/tests/deriving/should_run/T9576.stderr b/testsuite/tests/deriving/should_run/T9576.stderr index 954b2d9..bc2a0b3 100644 --- a/testsuite/tests/deriving/should_run/T9576.stderr +++ b/testsuite/tests/deriving/should_run/T9576.stderr @@ -4,7 +4,7 @@ T9576: T9576.hs:6:31: In the second argument of ?showParen?, namely ?((.) (showString "MkBar ") (showsPrec 11 b1))? In the expression: - showParen ((a >= 11)) ((.) (showString "MkBar ") (showsPrec 11 b1)) + showParen (a >= 11) ((.) (showString "MkBar ") (showsPrec 11 b1)) When typechecking the code for ?showsPrec? in a derived instance for ?Show Bar?: To see the code I am typechecking, use -ddump-deriv From git at git.haskell.org Tue Apr 7 09:50:36 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 09:50:36 +0000 (UTC) Subject: [commit: ghc] master: testdriver: delete unused ways (0622970) Message-ID: <20150407095036.B33523A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0622970917cbebce01ccc1e4bfe9cbc75ab86ecf/ghc >--------------------------------------------------------------- commit 0622970917cbebce01ccc1e4bfe9cbc75ab86ecf Author: Thomas Miedema Date: Tue Apr 7 11:50:11 2015 +0200 testdriver: delete unused ways And mention more prominently that `-DDEBUG` and tests that call `compiler_stats_num_fields` don't play well together Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D799 >--------------------------------------------------------------- 0622970917cbebce01ccc1e4bfe9cbc75ab86ecf testsuite/config/ghc | 16 +++++----------- testsuite/tests/perf/compiler/all.T | 3 +++ validate | 3 ++- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/testsuite/config/ghc b/testsuite/config/ghc index c208838..6bfa535 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -14,9 +14,11 @@ config.hpc = 'hpc' config.gs = 'gs' config.confdir = '.' -# By default, we test the 'normal', 'opt' and 'hpc' ways. -# 'optasm' is added by mk/test.mk if the compiler has a native code gen, -# 'prof' is added by mk/test.mk if the profiling way is enabled. +# By default, the 'normal' and 'hpc' ways are enabled. In addition, certain +# ways are enabled automatically if this GHC supports them. Ways that fall in +# this group are 'optasm', 'optllvm', 'profasm', 'threaded1', 'threaded2', +# 'profthreaded', 'ghci', and whichever of 'static/dyn' is not this GHC's +# default mode. Other ways should be set explicitly from .T files. config.compile_ways = ['normal', 'hpc'] config.run_ways = ['normal', 'hpc'] @@ -27,8 +29,6 @@ config.other_ways = ['prof', 'threaded1_ls', 'threaded2_hT', 'llvm', 'debugllvm', 'profllvm', 'profoptllvm', 'profthreadedllvm', - 'threaded1llvm', 'threaded2llvm', - 'dynllvm', 'debug'] if (ghc_with_native_codegen == 1): @@ -110,9 +110,6 @@ config.way_flags = lambda name : { 'profllvm' : ['-prof', '-static', '-auto-all', '-fllvm'], 'profoptllvm' : ['-O', '-prof', '-static', '-auto-all', '-fllvm'], 'profthreadedllvm' : ['-O', '-prof', '-static', '-auto-all', '-threaded', '-fllvm'], - 'threaded1llvm' : ['-threaded', '-debug', '-fllvm'], - 'threaded2llvm' : ['-O', '-threaded', '-eventlog', '-fllvm'], - 'dynllvm' : ['-O', '-dynamic', '-fllvm'] } config.way_rts_flags = { @@ -143,9 +140,6 @@ config.way_rts_flags = { 'profllvm' : ['-p'], 'profoptllvm' : ['-hc', '-p'], 'profthreadedllvm' : ['-p'], - 'threaded1llvm' : [], - 'threaded2llvm' : ['-N2 -ls'], - 'dynllvm' : [] } # Useful classes of ways that can be used with only_ways() and diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 2963834..6c4ffee 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1,3 +1,6 @@ +# Tests that call 'compiler_stats_num_field' are skipped when debugging is on. +# See testsuite/driver/testlib.py. + def no_lint(name, opts): opts.compiler_always_flags = \ [opt for opt in opts.compiler_always_flags if opt != '-dcore-lint' and opt != '-dcmm-lint'] diff --git a/validate b/validate index 95d3af5..647bb45 100755 --- a/validate +++ b/validate @@ -20,7 +20,8 @@ Flags: HTML generated here: testsuite/hpc_output/hpc_index.html --normal Default settings --fast Omit dyn way, omit binary distribution - --slow Build stage2 with -DDEBUG. + --slow Build stage2 with -DDEBUG. Skips tests that call + `compiler_stats_num_field`. 2008-07-01: 14% slower than the default. --dph: Also build libraries/dph and run associated tests. --help shows this usage help. From git at git.haskell.org Tue Apr 7 13:43:18 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 13:43:18 +0000 (UTC) Subject: [commit: ghc] master: Suggest how to fix .ghci when it is group writeable (#8248) (b972de0) Message-ID: <20150407134318.1E72B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b972de0365f94e1be9d78537152eee969dc5f4cb/ghc >--------------------------------------------------------------- commit b972de0365f94e1be9d78537152eee969dc5f4cb Author: Vikas Menon Date: Tue Apr 7 15:39:44 2015 +0200 Suggest how to fix .ghci when it is group writeable (#8248) ``` chmod 664 $PATH_TO_GHCI_CONF/.ghci ``` Run ghci. You will now get a warning + a suggestion: ``` *** WARNING: $PATH_TO_GHCI_CONF/.ghci is writable by someone else, IGNORING! Suggested fix: execute 'chmod 644 $PATH_TO_GHCI_CONF/.ghci' ``` Execute fix and the warning should disappear. Reviewed By: mboes, thomie Differential Revision: https://phabricator.haskell.org/D805 >--------------------------------------------------------------- b972de0365f94e1be9d78537152eee969dc5f4cb ghc/InteractiveUI.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 9941a60..fc2883f 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -611,8 +611,10 @@ checkPerms name = groupWriteMode /= mode `intersectFileModes` groupWriteMode && otherWriteMode /= mode `intersectFileModes` otherWriteMode unless ok $ + -- #8248: Improving warning to include a possible fix. putStrLn $ "*** WARNING: " ++ name ++ - " is writable by someone else, IGNORING!" + " is writable by someone else, IGNORING!" ++ + "\nSuggested fix: execute 'chmod 644 " ++ name ++ "'" return ok #endif From git at git.haskell.org Tue Apr 7 14:10:44 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:10:44 +0000 (UTC) Subject: [commit: ghc] master: Fix a long-standing bug in the demand analyser (9f0f99f) Message-ID: <20150407141044.998183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9f0f99fd41ff82cc223d3b682703e508efb564d2/ghc >--------------------------------------------------------------- commit 9f0f99fd41ff82cc223d3b682703e508efb564d2 Author: Simon Peyton Jones Date: Mon Apr 6 14:10:52 2015 +0100 Fix a long-standing bug in the demand analyser This patch fixes Trac #10148, an outright and egregious bug in the demand analyser. It is explained in Note [Demand on case-alternative binders] in Demand.hs. I did some other minor refactoring. To my astonishment I got some big compiler perf changes * perf/compiler/T5837: bytes allocated -76% * perf/compiler/T5030: bytes allocated -10% * perf/compiler/T3294: max bytes used -25% Happy days >--------------------------------------------------------------- 9f0f99fd41ff82cc223d3b682703e508efb564d2 compiler/basicTypes/Demand.hs | 58 ++++++++++++- compiler/stranal/DmdAnal.hs | 194 ++++++++++++++++++++++++------------------ 2 files changed, 165 insertions(+), 87 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 9f0f99fd41ff82cc223d3b682703e508efb564d2 From git at git.haskell.org Tue Apr 7 14:10:47 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:10:47 +0000 (UTC) Subject: [commit: ghc] master: Reduce module qualifiers in pretty-printing (547c597) Message-ID: <20150407141047.56B8C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/547c597112954353cef7157cb0a389bc4f6303eb/ghc >--------------------------------------------------------------- commit 547c597112954353cef7157cb0a389bc4f6303eb Author: Simon Peyton Jones Date: Tue Apr 7 13:48:30 2015 +0100 Reduce module qualifiers in pretty-printing The change is in HscTypes.mkPrintUnqualified, and suppresses the module qualifier on Names from ghc-prim, base, and template-haskell, where no ambiguity can aries. It's somewhat arbitrary, but helps with things like 'Constraint' which are often not in scope, but occasionally show up in error messages. >--------------------------------------------------------------- 547c597112954353cef7157cb0a389bc4f6303eb compiler/basicTypes/Name.hs | 4 ++-- compiler/main/HscTypes.hs | 21 ++++++++++++++++++--- compiler/utils/Outputable.hs | 20 +++++++++++--------- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs index ac2071f..80b7cc8 100644 --- a/compiler/basicTypes/Name.hs +++ b/compiler/basicTypes/Name.hs @@ -534,8 +534,8 @@ pprModulePrefix sty mod occ = sdocWithDynFlags $ \dflags -> NameQual modname -> ppr modname <> dot -- Name is in scope NameNotInScope1 -> ppr mod <> dot -- Not in scope NameNotInScope2 -> ppr (modulePackageKey mod) <> colon -- Module not in - <> ppr (moduleName mod) <> dot -- scope either - _otherwise -> empty + <> ppr (moduleName mod) <> dot -- scope either + NameUnqual -> empty -- In scope unqualified ppr_underscore_unique :: Unique -> SDoc -- Print an underscore separating the name from its unique diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs index 90ed559..92c57ba 100644 --- a/compiler/main/HscTypes.hs +++ b/compiler/main/HscTypes.hs @@ -1524,11 +1524,26 @@ mkPrintUnqualified dflags env = QueryQualify qual_name (mkQualPackage dflags) where qual_name mod occ + | [] <- unqual_gres + , modulePackageKey mod `elem` [primPackageKey, basePackageKey, thPackageKey] + , not (isDerivedOccName occ) + = NameUnqual -- For names from ubiquitous packages that come with GHC, if + -- there are no entities called unqualified 'occ', then + -- print unqualified. Doing so does not cause ambiguity, + -- and it reduces the amount of qualification in error + -- messages. We can't do this for all packages, because we + -- might get errors like "Can't unify T with T". But the + -- ubiquitous packages don't contain any such gratuitous + -- name clashes. + -- + -- A motivating example is 'Constraint'. It's often not in + -- scope, but printing GHC.Prim.Constraint seems overkill. + | [gre] <- unqual_gres , right_name gre - = NameUnqual - -- If there's a unique entity that's in scope unqualified with 'occ' - -- AND that entity is the right one, then we can use the unqualified name + = NameUnqual -- If there's a unique entity that's in scope + -- unqualified with 'occ' AND that entity is + -- the right one, then we can use the unqualified name | [gre] <- qual_gres = NameQual (get_qual_mod (gre_prov gre)) diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index e6e8e02..36ac627 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -173,15 +173,17 @@ type QueryQualifyModule = Module -> Bool type QueryQualifyPackage = PackageKey -> Bool -- See Note [Printing original names] in HscTypes -data QualifyName -- given P:M.T - = NameUnqual -- refer to it as "T" - | NameQual ModuleName -- refer to it as "X.T" for the supplied X - | NameNotInScope1 - -- it is not in scope at all, but M.T is not bound in the current - -- scope, so we can refer to it as "M.T" - | NameNotInScope2 - -- it is not in scope at all, and M.T is already bound in the - -- current scope, so we must refer to it as "P:M.T" +data QualifyName -- Given P:M.T + = NameUnqual -- It's in scope unqualified as "T" + -- OR nothing called "T" is in scope + + | NameQual ModuleName -- It's in scope qualified as "X.T" + + | NameNotInScope1 -- It's not in scope at all, but M.T is not bound + -- in the current scope, so we can refer to it as "M.T" + + | NameNotInScope2 -- It's not in scope at all, and M.T is already bound in + -- the current scope, so we must refer to it as "P:M.T" reallyAlwaysQualifyNames :: QueryQualifyName reallyAlwaysQualifyNames _ _ = NameNotInScope2 From git at git.haskell.org Tue Apr 7 14:10:50 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:10:50 +0000 (UTC) Subject: [commit: ghc] master: Error msg wibbles from reduced module prefixes (c897613) Message-ID: <20150407141050.41E293A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c897613bbf6336d00c9b5433268cb5813308bee9/ghc >--------------------------------------------------------------- commit c897613bbf6336d00c9b5433268cb5813308bee9 Author: Simon Peyton Jones Date: Tue Apr 7 14:54:56 2015 +0100 Error msg wibbles from reduced module prefixes >--------------------------------------------------------------- c897613bbf6336d00c9b5433268cb5813308bee9 .../tests/annotations/should_fail/annfail05.stderr | 3 +- .../tests/annotations/should_fail/annfail08.stderr | 2 +- .../tests/annotations/should_fail/annfail10.stderr | 19 ++--- testsuite/tests/deriving/should_fail/T4846.stderr | 5 +- .../tests/ghci.debugger/scripts/break006.stderr | 8 +-- .../tests/ghci.debugger/scripts/break024.stdout | 9 +-- .../tests/ghci.debugger/scripts/print026.stdout | 0 .../tests/ghci.debugger/scripts/print028.stdout | 7 +- testsuite/tests/ghci/scripts/T2182ghci2.stderr | 10 ++- testsuite/tests/ghci/scripts/T5417.stdout | 0 testsuite/tests/ghci/scripts/T8469.stdout | 2 +- testsuite/tests/ghci/scripts/T9181.stdout | 83 ++++++++-------------- testsuite/tests/ghci/scripts/T9881.stdout | 3 +- testsuite/tests/ghci/scripts/ghci008.stdout | 12 ++-- testsuite/tests/ghci/scripts/ghci019.stderr | 4 +- testsuite/tests/ghci/scripts/ghci019.stdout | 2 +- testsuite/tests/ghci/scripts/ghci023.stdout | 16 ++--- testsuite/tests/ghci/scripts/ghci025.stdout | 26 ++++--- testsuite/tests/ghci/scripts/ghci027.stdout | 8 +-- .../indexed-types/should_compile/T3017.stderr | 0 .../tests/indexed-types/should_fail/Over.stderr | 0 .../tests/indexed-types/should_fail/T9580.stderr | 0 .../tests/numeric/should_compile/T7116.stdout | 25 ++----- .../should_fail/overloadedlistsfail01.stderr | 14 ++-- .../should_fail/overloadedlistsfail02.stderr | 6 +- .../should_compile/ExtraConstraints3.stderr | 47 ++++++------ testsuite/tests/rebindable/rebindable6.stderr | 2 +- testsuite/tests/th/T3319.stderr | 2 +- testsuite/tests/th/T5700.stderr | 2 +- testsuite/tests/th/T7276.stderr | 7 +- testsuite/tests/th/TH_foreignInterruptible.stderr | 3 +- testsuite/tests/typecheck/should_fail/T5095.stderr | 27 +++---- testsuite/tests/typecheck/should_fail/T8262.stderr | 2 +- .../should_fail/TcStaticPointersFail02.stderr | 5 +- .../tests/typecheck/should_fail/tcfail068.stderr | 28 ++++---- .../tests/typecheck/should_fail/tcfail123.stderr | 2 +- .../tests/typecheck/should_fail/tcfail128.stderr | 2 +- .../tests/typecheck/should_fail/tcfail200.stderr | 2 +- .../tests/typecheck/should_fail/tcfail220.stderr | 4 +- 39 files changed, 162 insertions(+), 237 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 c897613bbf6336d00c9b5433268cb5813308bee9 From git at git.haskell.org Tue Apr 7 14:10:53 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:10:53 +0000 (UTC) Subject: [commit: ghc] master: GHC.Prim.Constraint is not built-in syntax (74d2c33) Message-ID: <20150407141053.7CB583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/74d2c33a1f4ebe3de090bc73d08910bbdd31f8f1/ghc >--------------------------------------------------------------- commit 74d2c33a1f4ebe3de090bc73d08910bbdd31f8f1 Author: Simon Peyton Jones Date: Tue Apr 7 13:55:43 2015 +0100 GHC.Prim.Constraint is not built-in syntax This fixes Trac #10233 >--------------------------------------------------------------- 74d2c33a1f4ebe3de090bc73d08910bbdd31f8f1 compiler/prelude/TysPrim.hs | 31 +++++++++++++++++-------------- testsuite/tests/module/T10233.hs | 2 ++ testsuite/tests/module/T10233a.hs | 3 +++ testsuite/tests/module/all.T | 2 ++ 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index 298103c..b1007e0 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -10,8 +10,6 @@ -- | This module defines TyCons that can't be expressed in Haskell. -- They are all, therefore, wired-in TyCons. C.f module TysWiredIn module TysPrim( - mkPrimTyConName, -- For implicit parameters in TysWiredIn only - tyVarList, alphaTyVars, betaTyVars, alphaTyVar, betaTyVar, gammaTyVar, deltaTyVar, alphaTy, betaTy, gammaTy, deltaTy, openAlphaTy, openBetaTy, openAlphaTyVar, openBetaTyVar, openAlphaTyVars, @@ -331,20 +329,25 @@ constraintKindTyCon = mkKindTyCon constraintKindTyConName superKind -- If you edit these, you may need to update the GHC formalism -- See Note [GHC Formalism] in coreSyn/CoreLint.hs -superKindTyConName = mkPrimTyConName (fsLit "BOX") superKindTyConKey superKindTyCon -anyKindTyConName = mkPrimTyConName (fsLit "AnyK") anyKindTyConKey anyKindTyCon -liftedTypeKindTyConName = mkPrimTyConName (fsLit "*") liftedTypeKindTyConKey liftedTypeKindTyCon -openTypeKindTyConName = mkPrimTyConName (fsLit "OpenKind") openTypeKindTyConKey openTypeKindTyCon -unliftedTypeKindTyConName = mkPrimTyConName (fsLit "#") unliftedTypeKindTyConKey unliftedTypeKindTyCon -constraintKindTyConName = mkPrimTyConName (fsLit "Constraint") constraintKindTyConKey constraintKindTyCon +superKindTyConName = mkPrimTyConName (fsLit "BOX") superKindTyConKey superKindTyCon +anyKindTyConName = mkPrimTyConName (fsLit "AnyK") anyKindTyConKey anyKindTyCon +liftedTypeKindTyConName = mkPrimTyConName (fsLit "*") liftedTypeKindTyConKey liftedTypeKindTyCon +openTypeKindTyConName = mkPrimTyConName (fsLit "OpenKind") openTypeKindTyConKey openTypeKindTyCon +unliftedTypeKindTyConName = mkPrimTyConName (fsLit "#") unliftedTypeKindTyConKey unliftedTypeKindTyCon mkPrimTyConName :: FastString -> Unique -> TyCon -> Name -mkPrimTyConName occ key tycon = mkWiredInName gHC_PRIM (mkTcOccFS occ) - key - (ATyCon tycon) - BuiltInSyntax - -- All of the super kinds and kinds are defined in Prim and use BuiltInSyntax, - -- because they are never in scope in the source +mkPrimTyConName = mkPrimTcName BuiltInSyntax + -- All of the super kinds and kinds are defined in Prim, + -- and use BuiltInSyntax, because they are never in scope in the source + +constraintKindTyConName -- Unlike the others, Constraint does *not* use BuiltInSyntax, + -- and can be imported/exported like any other type constructor + = mkPrimTcName UserSyntax (fsLit "Constraint") constraintKindTyConKey constraintKindTyCon + + +mkPrimTcName :: BuiltInSyntax -> FastString -> Unique -> TyCon -> Name +mkPrimTcName built_in_syntax occ key tycon + = mkWiredInName gHC_PRIM (mkTcOccFS occ) key (ATyCon tycon) built_in_syntax kindTyConType :: TyCon -> Type kindTyConType kind = TyConApp kind [] -- mkTyConApp isn't defined yet diff --git a/testsuite/tests/module/T10233.hs b/testsuite/tests/module/T10233.hs new file mode 100644 index 0000000..965b413 --- /dev/null +++ b/testsuite/tests/module/T10233.hs @@ -0,0 +1,2 @@ +module T10233 where +import T10233a( Constraint, Int ) diff --git a/testsuite/tests/module/T10233a.hs b/testsuite/tests/module/T10233a.hs new file mode 100644 index 0000000..b3282d9 --- /dev/null +++ b/testsuite/tests/module/T10233a.hs @@ -0,0 +1,3 @@ +module T10233a ( module GHC.Exts ) where +import GHC.Exts ( Constraint, Int ) + diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T index 1507ffb..c4c2fff 100644 --- a/testsuite/tests/module/all.T +++ b/testsuite/tests/module/all.T @@ -345,3 +345,5 @@ test('T3776', normal, compile, ['']) test('T7765', normal, compile_fail, ['']) test('T9061', normal, compile, ['']) test('T9997', normal, compile, ['']) +test('T10233', extra_clean(['T01233a.hi', 'T01233a.o']), + multimod_compile, ['T10233', '-v0']) From git at git.haskell.org Tue Apr 7 14:10:56 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:10:56 +0000 (UTC) Subject: [commit: ghc] master: Do not quantify over the function itself in a RULE (cfb6042) Message-ID: <20150407141056.A314D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cfb60421a43f23e75ead85d99cec207a156f9312/ghc >--------------------------------------------------------------- commit cfb60421a43f23e75ead85d99cec207a156f9312 Author: Simon Peyton Jones Date: Tue Apr 7 14:01:39 2015 +0100 Do not quantify over the function itself in a RULE We were erroneously quantifying over the function when it had a dictionary type. A bit pathological, but possible. This fixes Trac #10251 >--------------------------------------------------------------- cfb60421a43f23e75ead85d99cec207a156f9312 compiler/deSugar/DsBinds.hs | 43 ++++++++++++++---------- testsuite/tests/deSugar/should_compile/T10251.hs | 41 ++++++++++++++++++++++ testsuite/tests/deSugar/should_compile/all.T | 1 + 3 files changed, 68 insertions(+), 17 deletions(-) diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index 488ffa3..c2d21bd 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -569,37 +569,46 @@ decomposeRuleLhs orig_bndrs orig_lhs -- See Note [Unused spec binders] = Left (vcat (map dead_msg unbound)) - | Var fn_var <- fun - , not (fn_var `elemVarSet` orig_bndr_set) + | Just (fn_id, args) <- decompose fun2 args2 + , let extra_dict_bndrs = mk_extra_dict_bndrs fn_id args = -- pprTrace "decmposeRuleLhs" (vcat [ ptext (sLit "orig_bndrs:") <+> ppr orig_bndrs -- , ptext (sLit "orig_lhs:") <+> ppr orig_lhs -- , ptext (sLit "lhs1:") <+> ppr lhs1 - -- , ptext (sLit "bndrs1:") <+> ppr bndrs1 - -- , ptext (sLit "fn_var:") <+> ppr fn_var + -- , ptext (sLit "extra_dict_bndrs:") <+> ppr extra_dict_bndrs + -- , ptext (sLit "fn_id:") <+> ppr fn_id -- , ptext (sLit "args:") <+> ppr args]) $ - Right (bndrs1, fn_var, args) - - | Case scrut bndr ty [(DEFAULT, _, body)] <- fun - , isDeadBinder bndr -- Note [Matching seqId] - , let args' = [Type (idType bndr), Type ty, scrut, body] - = Right (bndrs1, seqId, args' ++ args) + Right (orig_bndrs ++ extra_dict_bndrs, fn_id, args) | otherwise = Left bad_shape_msg where - lhs1 = drop_dicts orig_lhs - lhs2 = simpleOptExpr lhs1 -- See Note [Simplify rule LHS] - (fun,args) = collectArgs lhs2 + lhs1 = drop_dicts orig_lhs + lhs2 = simpleOptExpr lhs1 -- See Note [Simplify rule LHS] + (fun2,args2) = collectArgs lhs2 + lhs_fvs = exprFreeVars lhs2 unbound = filterOut (`elemVarSet` lhs_fvs) orig_bndrs - bndrs1 = orig_bndrs ++ extra_dict_bndrs orig_bndr_set = mkVarSet orig_bndrs -- Add extra dict binders: Note [Free dictionaries] - extra_dict_bndrs = [ mkLocalId (localiseName (idName d)) (idType d) - | d <- varSetElems (lhs_fvs `delVarSetList` orig_bndrs) - , isDictId d ] + mk_extra_dict_bndrs fn_id args + = [ mkLocalId (localiseName (idName d)) (idType d) + | d <- varSetElems (exprsFreeVars args `delVarSetList` (fn_id : orig_bndrs)) + -- fn_id: do not quantify over the function itself, which may + -- itself be a dictionary (in pathological cases, Trac #10251) + , isDictId d ] + + decompose (Var fn_id) args + | not (fn_id `elemVarSet` orig_bndr_set) + = Just (fn_id, args) + + decompose (Case scrut bndr ty [(DEFAULT, _, body)]) args + | isDeadBinder bndr -- Note [Matching seqId] + , let args' = [Type (idType bndr), Type ty, scrut, body] + = Just (seqId, args' ++ args) + + decompose _ _ = Nothing bad_shape_msg = hang (ptext (sLit "RULE left-hand side too complicated to desugar")) 2 (vcat [ text "Optimised lhs:" <+> ppr lhs2 diff --git a/testsuite/tests/deSugar/should_compile/T10251.hs b/testsuite/tests/deSugar/should_compile/T10251.hs new file mode 100644 index 0000000..afca7fb --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T10251.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -O #-} +module T10251 where + +data D = D +data E = E + +class Storable a where + poke2 :: a -> E +instance Storable D where + poke2 = poke2 -- undefined + +class Foo a where +instance Foo D where + +class (Foo t, Storable t) => FooStorable t where + +instance FooStorable D where + {-# SPECIALIZE instance FooStorable D #-} + +{-# SPECIALIZE bug :: D -> E #-} + +bug + :: FooStorable t + => t + -> E +bug = poke2 +{- +sf 9160 # ghc -c -fforce-recomp -Wall B.hs + +ghc: panic! (the 'impossible' happened) + (GHC version 7.10.1 for x86_64-unknown-linux): + Template variable unbound in rewrite rule + $fFooStorableD_XU + [$fFooStorableD_XU] + [$fFooStorableD_XU] + [] + [] + +Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug +-} diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index ac8f95c..956f951 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -103,3 +103,4 @@ test('T5252Take2', test('T2431', normal, compile, ['-ddump-simpl -dsuppress-uniques']) test('T7669', normal, compile, ['']) test('T8470', normal, compile, ['']) +test('T10251', normal, compile, ['']) From git at git.haskell.org Tue Apr 7 14:10:59 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:10:59 +0000 (UTC) Subject: [commit: ghc] master: Put quotes round a Name in an error message (6ca7b84) Message-ID: <20150407141059.710023A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ca7b847ffc2c46b7fdde059bb57422354b3da89/ghc >--------------------------------------------------------------- commit 6ca7b847ffc2c46b7fdde059bb57422354b3da89 Author: Simon Peyton Jones Date: Tue Apr 7 14:06:11 2015 +0100 Put quotes round a Name in an error message Cosmetic consistency only >--------------------------------------------------------------- 6ca7b847ffc2c46b7fdde059bb57422354b3da89 compiler/typecheck/TcRnDriver.hs | 8 ++++---- testsuite/tests/driver/sigof04/sigof04.stderr | 2 +- testsuite/tests/rename/should_fail/rnfail047.stderr | 2 +- testsuite/tests/rename/should_fail/rnfail055.stderr | 6 +++--- testsuite/tests/simplCore/should_compile/T3717.stderr | 17 ++++++++--------- testsuite/tests/typecheck/should_fail/tcfail222.stderr | 2 +- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 9d3a1fa..170445b 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -1043,10 +1043,10 @@ emptyRnEnv2 = mkRnEnv2 emptyInScopeSet ---------------- missingBootThing :: Bool -> Name -> String -> SDoc missingBootThing is_boot name what - = ppr name <+> ptext (sLit "is exported by the") <+> - (if is_boot then ptext (sLit "hs-boot") else ptext (sLit "hsig")) - <+> ptext (sLit "file, but not") - <+> text what <+> ptext (sLit "the module") + = quotes (ppr name) <+> ptext (sLit "is exported by the") + <+> (if is_boot then ptext (sLit "hs-boot") else ptext (sLit "hsig")) + <+> ptext (sLit "file, but not") + <+> text what <+> ptext (sLit "the module") bootMisMatch :: Bool -> SDoc -> TyThing -> TyThing -> SDoc bootMisMatch is_boot extra_info real_thing boot_thing diff --git a/testsuite/tests/driver/sigof04/sigof04.stderr b/testsuite/tests/driver/sigof04/sigof04.stderr index acb0467..4be1bfd 100644 --- a/testsuite/tests/driver/sigof04/sigof04.stderr +++ b/testsuite/tests/driver/sigof04/sigof04.stderr @@ -1,3 +1,3 @@ : - insert is exported by the hsig file, but not exported by the module + ?insert? is exported by the hsig file, but not exported by the module diff --git a/testsuite/tests/rename/should_fail/rnfail047.stderr b/testsuite/tests/rename/should_fail/rnfail047.stderr index 380bbd9..f62870e 100644 --- a/testsuite/tests/rename/should_fail/rnfail047.stderr +++ b/testsuite/tests/rename/should_fail/rnfail047.stderr @@ -1,3 +1,3 @@ RnFail047_A.hs-boot:5:1: - RnFail047_A.y is exported by the hs-boot file, but not exported by the module + ?RnFail047_A.y? is exported by the hs-boot file, but not exported by the module diff --git a/testsuite/tests/rename/should_fail/rnfail055.stderr b/testsuite/tests/rename/should_fail/rnfail055.stderr index 1c002ac..05cec42 100644 --- a/testsuite/tests/rename/should_fail/rnfail055.stderr +++ b/testsuite/tests/rename/should_fail/rnfail055.stderr @@ -44,10 +44,10 @@ RnFail055.hs-boot:14:1: The datatype contexts do not match RnFail055.hs-boot:16:11: - T3 is exported by the hs-boot file, but not exported by the module + ?T3? is exported by the hs-boot file, but not exported by the module RnFail055.hs-boot:17:12: - T3' is exported by the hs-boot file, but not exported by the module + ?T3'? is exported by the hs-boot file, but not exported by the module RnFail055.hs-boot:21:1: Type constructor ?T5? has conflicting definitions in the module @@ -76,7 +76,7 @@ RnFail055.hs-boot:25:1: The constructors do not match: The types for ?T7? differ RnFail055.hs-boot:27:22: - RnFail055.m1 is exported by the hs-boot file, but not exported by the module + ?RnFail055.m1? is exported by the hs-boot file, but not exported by the module RnFail055.hs-boot:28:1: Class ?C2? has conflicting definitions in the module diff --git a/testsuite/tests/simplCore/should_compile/T3717.stderr b/testsuite/tests/simplCore/should_compile/T3717.stderr index a437bb8..d466e32 100644 --- a/testsuite/tests/simplCore/should_compile/T3717.stderr +++ b/testsuite/tests/simplCore/should_compile/T3717.stderr @@ -3,13 +3,12 @@ Result size of Tidy Core = {terms: 22, types: 10, coercions: 0} Rec { -T3717.$wfoo [InlPrag=[0], Occ=LoopBreaker] - :: GHC.Prim.Int# -> GHC.Prim.Int# +$wfoo [InlPrag=[0], Occ=LoopBreaker] :: Int# -> Int# [GblId, Arity=1, Caf=NoCafRefs, Str=DmdType ] -T3717.$wfoo = - \ (ww :: GHC.Prim.Int#) -> +$wfoo = + \ (ww :: Int#) -> case ww of ds { - __DEFAULT -> T3717.$wfoo (GHC.Prim.-# ds 1#); + __DEFAULT -> $wfoo (-# ds 1#); 0# -> 0# } end Rec } @@ -23,13 +22,13 @@ foo [InlPrag=INLINE[0]] :: Int -> Int WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (w [Occ=Once!] :: Int) -> - case w of _ [Occ=Dead] { GHC.Types.I# ww1 [Occ=Once] -> - case T3717.$wfoo ww1 of ww2 { __DEFAULT -> GHC.Types.I# ww2 } + case w of _ [Occ=Dead] { I# ww1 [Occ=Once] -> + case $wfoo ww1 of ww2 { __DEFAULT -> I# ww2 } }}] foo = \ (w :: Int) -> - case w of _ [Occ=Dead] { GHC.Types.I# ww1 -> - case T3717.$wfoo ww1 of ww2 { __DEFAULT -> GHC.Types.I# ww2 } + case w of _ [Occ=Dead] { I# ww1 -> + case $wfoo ww1 of ww2 { __DEFAULT -> I# ww2 } } diff --git a/testsuite/tests/typecheck/should_fail/tcfail222.stderr b/testsuite/tests/typecheck/should_fail/tcfail222.stderr index 86242b1..1293b78 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail222.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail222.stderr @@ -1,4 +1,4 @@ [1 of 1] Compiling ShouldFail[sig of Data.STRef] ( tcfail222.hsig, nothing ) : - newSTRef is exported by the hsig file, but not exported by the module + ?newSTRef? is exported by the hsig file, but not exported by the module From git at git.haskell.org Tue Apr 7 14:11:02 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:11:02 +0000 (UTC) Subject: [commit: ghc] master: More aggressive Given/Wanted overlap check (8b7ceec) Message-ID: <20150407141102.9DB2C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8b7ceece52d2a0bb8a4ea5609da286fb76d88211/ghc >--------------------------------------------------------------- commit 8b7ceece52d2a0bb8a4ea5609da286fb76d88211 Author: Simon Peyton Jones Date: Tue Apr 7 14:29:10 2015 +0100 More aggressive Given/Wanted overlap check This fixes Trac #10195 For some reason we considered untouchability before, but Trac #10195 shows that this is positively worng. See Note [Instance and Given overlap] in TcInteract. Looking at the Git log, it seems that this bug was introduced at the same time that we introduced the Given/Wanted overlap check in the first place. >--------------------------------------------------------------- 8b7ceece52d2a0bb8a4ea5609da286fb76d88211 compiler/typecheck/TcInteract.hs | 93 ++++++++++++---------- compiler/typecheck/TcType.hs | 4 +- testsuite/tests/typecheck/should_compile/T10195.hs | 31 ++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 83 insertions(+), 46 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 8b7ceece52d2a0bb8a4ea5609da286fb76d88211 From git at git.haskell.org Tue Apr 7 14:11:05 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:11:05 +0000 (UTC) Subject: [commit: ghc] master: Look inside synonyms for foralls when unifying (553c518) Message-ID: <20150407141106.006AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/553c5182156c5e4c15e3bd1c17c6d83a95a6c408/ghc >--------------------------------------------------------------- commit 553c5182156c5e4c15e3bd1c17c6d83a95a6c408 Author: Simon Peyton Jones Date: Tue Apr 7 14:45:04 2015 +0100 Look inside synonyms for foralls when unifying This fixes Trac #10194 >--------------------------------------------------------------- 553c5182156c5e4c15e3bd1c17c6d83a95a6c408 compiler/typecheck/TcType.hs | 10 +++++++--- compiler/typecheck/TcUnify.hs | 5 ++++- testsuite/tests/typecheck/should_fail/T10194.hs | 7 +++++++ testsuite/tests/typecheck/should_fail/T10194.stderr | 7 +++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 42c9af3..ca1ecaa 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -859,7 +859,7 @@ mkTcEqPredRole Nominal = mkTcEqPred mkTcEqPredRole Representational = mkTcReprEqPred mkTcEqPredRole Phantom = panic "mkTcEqPredRole Phantom" --- @isTauTy@ tests for nested for-alls. It should not be called on a boxy type. +-- @isTauTy@ tests for nested for-alls. isTauTy :: Type -> Bool isTauTy ty | Just ty' <- tcView ty = isTauTy ty' @@ -1234,7 +1234,7 @@ occurCheckExpand dflags tv ty -- True => fine fast_check (LitTy {}) = True fast_check (TyVarTy tv') = tv /= tv' - fast_check (TyConApp _ tys) = all fast_check tys + fast_check (TyConApp tc tys) = all fast_check tys && (isTauTyCon tc || impredicative) fast_check (FunTy arg res) = fast_check arg && fast_check res fast_check (AppTy fun arg) = fast_check fun && fast_check arg fast_check (ForAllTy tv' ty) = impredicative @@ -1268,7 +1268,11 @@ occurCheckExpand dflags tv ty -- it and try again. go ty@(TyConApp tc tys) = case do { tys <- mapM go tys; return (mkTyConApp tc tys) } of - OC_OK ty -> return ty -- First try to eliminate the tyvar from the args + OC_OK ty + | impredicative || isTauTyCon tc + -> return ty -- First try to eliminate the tyvar from the args + | otherwise + -> OC_Forall -- A type synonym with a forall on the RHS bad | Just ty' <- tcView ty -> go ty' | otherwise -> bad -- Failing that, try to expand a synonym diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index f732515..754d310 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -1026,10 +1026,13 @@ checkTauTvUpdate dflags tv ty defer_me :: TcType -> Bool -- Checks for (a) occurrence of tv -- (b) type family applications + -- (c) foralls -- See Note [Conservative unification check] defer_me (LitTy {}) = False defer_me (TyVarTy tv') = tv == tv' - defer_me (TyConApp tc tys) = isTypeFamilyTyCon tc || any defer_me tys + defer_me (TyConApp tc tys) = isTypeFamilyTyCon tc + || any defer_me tys + || not (impredicative || isTauTyCon tc) defer_me (FunTy arg res) = defer_me arg || defer_me res defer_me (AppTy fun arg) = defer_me fun || defer_me arg defer_me (ForAllTy _ ty) = not impredicative || defer_me ty diff --git a/testsuite/tests/typecheck/should_fail/T10194.hs b/testsuite/tests/typecheck/should_fail/T10194.hs new file mode 100644 index 0000000..2174a59 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T10194.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes #-} +module T10194 where + +type X = forall a . a + +comp :: (X -> c) -> (a -> X) -> (a -> c) +comp = (.) diff --git a/testsuite/tests/typecheck/should_fail/T10194.stderr b/testsuite/tests/typecheck/should_fail/T10194.stderr new file mode 100644 index 0000000..53ee74b --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T10194.stderr @@ -0,0 +1,7 @@ + +T10194.hs:7:8: + Cannot instantiate unification variable ?b0? + with a type involving foralls: X + Perhaps you want ImpredicativeTypes + In the expression: (.) + In an equation for ?comp?: comp = (.) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 7efbb70..ea53e39 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -354,3 +354,4 @@ test('T8044', normal, compile_fail, ['']) test('T4921', normal, compile_fail, ['']) test('T9605', normal, compile_fail, ['']) test('T9999', normal, compile_fail, ['']) +test('T10194', normal, compile_fail, ['']) From git at git.haskell.org Tue Apr 7 14:13:29 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:13:29 +0000 (UTC) Subject: [commit: ghc] master: Replace endian test by 64-bit word access in T7600 (4f8e348) Message-ID: <20150407141329.489B13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4f8e34822f18cf3d31414676f900b3714367d38e/ghc >--------------------------------------------------------------- commit 4f8e34822f18cf3d31414676f900b3714367d38e Author: Peter Trommler Date: Tue Apr 7 09:08:29 2015 -0500 Replace endian test by 64-bit word access in T7600 In commit 3f30912f an include `ghcconfig.h` was added for `WORDS_BIGENDIAN`. Converting the floating point array to a `Word64` array avoids using the preprocessor altogether and leads to smaller code. Fixes #10239 Reviewed By: rwbarton, austin Differential Revision: https://phabricator.haskell.org/D795 GHC Trac Issues: #10239 >--------------------------------------------------------------- 4f8e34822f18cf3d31414676f900b3714367d38e testsuite/tests/codeGen/should_run/T7600_A.hs | 46 +++++++-------------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/testsuite/tests/codeGen/should_run/T7600_A.hs b/testsuite/tests/codeGen/should_run/T7600_A.hs index df31b83..6338c9d 100644 --- a/testsuite/tests/codeGen/should_run/T7600_A.hs +++ b/testsuite/tests/codeGen/should_run/T7600_A.hs @@ -1,6 +1,5 @@ -- !!! Bug # 7600. -- See file T7600 for main description. -{-# LANGUAGE CPP #-} module T7600_A (test_run) where import Control.Monad.ST @@ -12,8 +11,6 @@ import Numeric import GHC.Float -#include "ghcconfig.h" - -- Test run test_run :: Float -> Double -> IO () test_run float_number double_number = do @@ -41,45 +38,26 @@ widen' :: Float -> Double {-# NOINLINE widen' #-} widen' = float2Double -doubleToBytes :: Double -> [Int] -doubleToBytes d +doubleToWord64 :: Double -> Word64 +doubleToWord64 d = runST (do - arr <- newArray_ ((0::Int),7) + arr <- newArray_ ((0::Int),0) writeArray arr 0 d - arr <- castDoubleToWord8Array arr - i0 <- readArray arr 0 - i1 <- readArray arr 1 - i2 <- readArray arr 2 - i3 <- readArray arr 3 - i4 <- readArray arr 4 - i5 <- readArray arr 5 - i6 <- readArray arr 6 - i7 <- readArray arr 7 - return (map fromIntegral [i0,i1,i2,i3,i4,i5,i6,i7]) + arr <- castDoubleToWord64Array arr + readArray arr 0 ) -castFloatToWord8Array :: STUArray s Int Float -> ST s (STUArray s Int Word8) -castFloatToWord8Array = castSTUArray +castFloatToWord64Array :: STUArray s Int Float -> ST s (STUArray s Int Word64) +castFloatToWord64Array = castSTUArray -castDoubleToWord8Array :: STUArray s Int Double -> ST s (STUArray s Int Word8) -castDoubleToWord8Array = castSTUArray +castDoubleToWord64Array :: STUArray s Int Double -> ST s (STUArray s Int Word64) +castDoubleToWord64Array = castSTUArray dToStr :: Double -> String dToStr d - = let bs = doubleToBytes d - hex d' = case showHex d' "" of - [] -> error "dToStr: too few hex digits for float" - [x] -> ['0',x] - [x,y] -> [x,y] - _ -> error "dToStr: too many hex digits for float" + = let bs = doubleToWord64 d + hex d' = showHex d' "" - str = map toUpper $ concat . fixEndian . (map hex) $ bs + str = map toUpper $ hex bs in "0x" ++ str -fixEndian :: [a] -> [a] -#ifdef WORDS_BIGENDIAN -fixEndian = id -#else -fixEndian = reverse -#endif - From git at git.haskell.org Tue Apr 7 14:13:32 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:13:32 +0000 (UTC) Subject: [commit: ghc] master: rts/Linker.c: distinct between DATA and CODE labels when importing (ab76b09) Message-ID: <20150407141332.28CAB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ab76b0990e9f7d20bde403be38935f9d16491806/ghc >--------------------------------------------------------------- commit ab76b0990e9f7d20bde403be38935f9d16491806 Author: Sergei Trofimovich Date: Tue Apr 7 09:08:37 2015 -0500 rts/Linker.c: distinct between DATA and CODE labels when importing The patch is a last major piece to make unregisterised GHC build under GCC's link-time optimizer. Before the patch we imported everything external as functions. Now we distinct between global variables and functions. The difference is crucial on ia64 and a complement to fixes: > d82f592522eb8e063276a8a8c87ab93e18353c6b > CMM: add a mechanism to import C .data labels > e18525fae273f4c1ad8d6cbe1dea4fc074cac721 > pprC: declare extern cmm primitives as functions, not data Signed-off-by: Sergei Trofimovich Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D797 >--------------------------------------------------------------- ab76b0990e9f7d20bde403be38935f9d16491806 rts/Linker.c | 60 ++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 3323037..9d3ca12 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -365,7 +365,7 @@ typedef struct _RtsSymbolVal { SymI_HasProto(stg_sig_install) \ SymI_HasProto(rtsTimerSignal) \ SymI_HasProto(atexit) \ - SymI_NeedsProto(nocldstop) + SymI_NeedsDataProto(nocldstop) #endif #if defined (cygwin32_HOST_OS) @@ -890,18 +890,18 @@ typedef struct _RtsSymbolVal { #define RTS_LIBFFI_SYMBOLS \ SymE_NeedsProto(ffi_prep_cif) \ SymE_NeedsProto(ffi_call) \ - SymE_NeedsProto(ffi_type_void) \ - SymE_NeedsProto(ffi_type_float) \ - SymE_NeedsProto(ffi_type_double) \ - SymE_NeedsProto(ffi_type_sint64) \ - SymE_NeedsProto(ffi_type_uint64) \ - SymE_NeedsProto(ffi_type_sint32) \ - SymE_NeedsProto(ffi_type_uint32) \ - SymE_NeedsProto(ffi_type_sint16) \ - SymE_NeedsProto(ffi_type_uint16) \ - SymE_NeedsProto(ffi_type_sint8) \ - SymE_NeedsProto(ffi_type_uint8) \ - SymE_NeedsProto(ffi_type_pointer) + SymE_NeedsDataProto(ffi_type_void) \ + SymE_NeedsDataProto(ffi_type_float) \ + SymE_NeedsDataProto(ffi_type_double) \ + SymE_NeedsDataProto(ffi_type_sint64) \ + SymE_NeedsDataProto(ffi_type_uint64) \ + SymE_NeedsDataProto(ffi_type_sint32) \ + SymE_NeedsDataProto(ffi_type_uint32) \ + SymE_NeedsDataProto(ffi_type_sint16) \ + SymE_NeedsDataProto(ffi_type_uint16) \ + SymE_NeedsDataProto(ffi_type_sint8) \ + SymE_NeedsDataProto(ffi_type_uint8) \ + SymE_NeedsDataProto(ffi_type_pointer) #ifdef TABLES_NEXT_TO_CODE #define RTS_RET_SYMBOLS /* nothing */ @@ -931,8 +931,8 @@ typedef struct _RtsSymbolVal { /* Modules compiled with -ticky may mention ticky counters */ /* This list should marry up with the one in $(TOP)/includes/stg/Ticky.h */ #define RTS_TICKY_SYMBOLS \ - SymI_NeedsProto(ticky_entry_ctrs) \ - SymI_NeedsProto(top_ct) \ + SymI_NeedsDataProto(ticky_entry_ctrs) \ + SymI_NeedsDataProto(top_ct) \ \ SymI_HasProto(ENT_VIA_NODE_ctr) \ SymI_HasProto(ENT_STATIC_THK_SINGLE_ctr) \ @@ -1405,9 +1405,9 @@ typedef struct _RtsSymbolVal { SymI_HasProto(getAllocations) \ SymI_HasProto(revertCAFs) \ SymI_HasProto(RtsFlags) \ - SymI_NeedsProto(rts_breakpoint_io_action) \ - SymI_NeedsProto(rts_stop_next_breakpoint) \ - SymI_NeedsProto(rts_stop_on_exception) \ + SymI_NeedsDataProto(rts_breakpoint_io_action) \ + SymI_NeedsDataProto(rts_stop_next_breakpoint) \ + SymI_NeedsDataProto(rts_stop_on_exception) \ SymI_HasProto(stopTimer) \ SymI_HasProto(n_capabilities) \ SymI_HasProto(enabled_capabilities) \ @@ -1457,15 +1457,19 @@ typedef struct _RtsSymbolVal { /* entirely bogus claims about types of these symbols */ #define SymI_NeedsProto(vvv) extern void vvv(void); +#define SymI_NeedsDataProto(vvv) extern StgWord vvv[]; #if defined(COMPILING_WINDOWS_DLL) #define SymE_HasProto(vvv) SymE_HasProto(vvv); # if defined(x86_64_HOST_ARCH) # define SymE_NeedsProto(vvv) extern void __imp_ ## vvv (void); +# define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv) # else # define SymE_NeedsProto(vvv) extern void _imp__ ## vvv (void); +# define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv) # endif #else #define SymE_NeedsProto(vvv) SymI_NeedsProto(vvv); +#define SymE_NeedsDataProto(vvv) SymI_NeedsDataProto(vvv); #define SymE_HasProto(vvv) SymI_HasProto(vvv) #endif #define SymI_HasProto(vvv) /**/ @@ -1479,10 +1483,13 @@ RTS_DARWIN_ONLY_SYMBOLS RTS_LIBGCC_SYMBOLS RTS_LIBFFI_SYMBOLS #undef SymI_NeedsProto +#undef SymI_NeedsDataProto #undef SymI_HasProto #undef SymI_HasProto_redirect #undef SymE_HasProto +#undef SymE_HasDataProto #undef SymE_NeedsProto +#undef SymE_NeedsDataProto #ifdef LEADING_UNDERSCORE #define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s) @@ -1492,11 +1499,17 @@ RTS_LIBFFI_SYMBOLS #define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ (void*)(&(vvv)) }, +#define SymI_HasDataProto(vvv) \ + SymI_HasProto(vvv) #define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ (void*)DLL_IMPORT_DATA_REF(vvv) }, +#define SymE_HasDataProto(vvv) \ + SymE_HasProto(vvv) #define SymI_NeedsProto(vvv) SymI_HasProto(vvv) +#define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv) #define SymE_NeedsProto(vvv) SymE_HasProto(vvv) +#define SymE_NeedsDataProto(vvv) SymE_HasDataProto(vvv) // SymI_HasProto_redirect allows us to redirect references to one symbol to // another symbol. See newCAF/newDynCAF for an example. @@ -7339,20 +7352,31 @@ machoInitSymbolsWithoutUnderscore(void) __asm__ volatile(".globl _symbolsWithoutUnderscore\n.data\n_symbolsWithoutUnderscore:"); #undef SymI_NeedsProto +#undef SymI_NeedsDataProto + #define SymI_NeedsProto(x) \ __asm__ volatile(".long " # x); +#define SymI_NeedsDataProto(x) \ + SymI_NeedsProto(x) + RTS_MACHO_NOUNDERLINE_SYMBOLS __asm__ volatile(".text"); #undef SymI_NeedsProto +#undef SymI_NeedsDataProto + #define SymI_NeedsProto(x) \ ghciInsertSymbolTable("(GHCi built-in symbols)", symhash, #x, *p++, HS_BOOL_FALSE, NULL); +#define SymI_NeedsDataProto(x) \ + SymI_NeedsProto(x) + RTS_MACHO_NOUNDERLINE_SYMBOLS #undef SymI_NeedsProto +#undef SymI_NeedsDataProto } #endif From git at git.haskell.org Tue Apr 7 14:13:35 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:13:35 +0000 (UTC) Subject: [commit: ghc] master: Don't repeat package key with -dppr-debug when package info is missing. (cf1d975) Message-ID: <20150407141335.0EC593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cf1d9751e7ca85e9b3284ad57882958b8dc73d16/ghc >--------------------------------------------------------------- commit cf1d9751e7ca85e9b3284ad57882958b8dc73d16 Author: Edward Z. Yang Date: Tue Apr 7 09:08:54 2015 -0500 Don't repeat package key with -dppr-debug when package info is missing. Signed-off-by: Edward Z. Yang Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D802 >--------------------------------------------------------------- cf1d9751e7ca85e9b3284ad57882958b8dc73d16 compiler/basicTypes/Module.hs | 12 +++++++----- compiler/main/Packages.hs | 8 +++----- compiler/main/Packages.hs-boot | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/compiler/basicTypes/Module.hs b/compiler/basicTypes/Module.hs index 1cf0cbf..a20de2d 100644 --- a/compiler/basicTypes/Module.hs +++ b/compiler/basicTypes/Module.hs @@ -326,11 +326,13 @@ stablePackageKeyCmp p1 p2 = packageKeyFS p1 `compare` packageKeyFS p2 instance Outputable PackageKey where ppr pk = getPprStyle $ \sty -> sdocWithDynFlags $ \dflags -> - text (packageKeyPackageIdString dflags pk) - -- Don't bother qualifying if it's wired in! - <> (if qualPackage sty pk && not (pk `elem` wiredInPackageKeys) - then char '@' <> ftext (packageKeyFS pk) - else empty) + case packageKeyPackageIdString dflags pk of + Nothing -> ftext (packageKeyFS pk) + Just pkg -> text pkg + -- Don't bother qualifying if it's wired in! + <> (if qualPackage sty pk && not (pk `elem` wiredInPackageKeys) + then char '@' <> ftext (packageKeyFS pk) + else empty) instance Binary PackageKey where put_ bh pid = put_ bh (packageKeyFS pid) diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 4f8afb5..70476a1 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -1354,12 +1354,10 @@ missingDependencyMsg (Just parent) -- ----------------------------------------------------------------------------- -packageKeyPackageIdString :: DynFlags -> PackageKey -> String +packageKeyPackageIdString :: DynFlags -> PackageKey -> Maybe String packageKeyPackageIdString dflags pkg_key - | pkg_key == mainPackageKey = "main" - | otherwise = maybe "(unknown)" - sourcePackageIdString - (lookupPackage dflags pkg_key) + | pkg_key == mainPackageKey = Just "main" + | otherwise = fmap sourcePackageIdString (lookupPackage dflags pkg_key) -- | Will the 'Name' come from a dynamically linked library? isDllName :: DynFlags -> PackageKey -> Module -> Name -> Bool diff --git a/compiler/main/Packages.hs-boot b/compiler/main/Packages.hs-boot index 2f898f1..f2343b6 100644 --- a/compiler/main/Packages.hs-boot +++ b/compiler/main/Packages.hs-boot @@ -3,4 +3,4 @@ module Packages where import {-# SOURCE #-} Module (PackageKey) import {-# SOURCE #-} DynFlags (DynFlags) data PackageState -packageKeyPackageIdString :: DynFlags -> PackageKey -> String +packageKeyPackageIdString :: DynFlags -> PackageKey -> Maybe String From git at git.haskell.org Tue Apr 7 14:13:37 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:13:37 +0000 (UTC) Subject: [commit: ghc] master: The production for squals is incorrect; see D806 for specifics. (cf19640) Message-ID: <20150407141337.D777E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cf196400609d920e7f8189b9376833f4f5886360/ghc >--------------------------------------------------------------- commit cf196400609d920e7f8189b9376833f4f5886360 Author: Alan Zimmerman Date: Tue Apr 7 09:10:27 2015 -0500 The production for squals is incorrect; see D806 for specifics. This diff depends on D803. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D806 GHC Trac Issues: #10214 >--------------------------------------------------------------- cf196400609d920e7f8189b9376833f4f5886360 compiler/parser/Parser.y | 20 ++++----- .../ghc-api/annotations/ListComprehensions.hs | 6 +++ testsuite/tests/ghc-api/annotations/Makefile | 2 +- .../tests/ghc-api/annotations/listcomps.stdout | 50 ++++++++++++++++++++-- .../tests/parser/should_fail/readFail042.stderr | 4 +- .../tests/parser/should_fail/readFail043.stderr | 18 ++++---- testsuite/tests/typecheck/should_fail/mc19.stderr | 2 +- testsuite/tests/typecheck/should_fail/mc21.stderr | 2 +- testsuite/tests/typecheck/should_fail/mc22.stderr | 4 +- testsuite/tests/typecheck/should_fail/mc25.stderr | 2 +- .../tests/typecheck/should_fail/tcfail191.stderr | 2 +- .../tests/typecheck/should_fail/tcfail193.stderr | 2 +- 12 files changed, 81 insertions(+), 33 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 cf196400609d920e7f8189b9376833f4f5886360 From git at git.haskell.org Tue Apr 7 14:13:41 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:13:41 +0000 (UTC) Subject: [commit: ghc] master: The production for `pquals` is incorrect; the specifics are in D803. (f1a4e42) Message-ID: <20150407141341.AC1643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f1a4e42ea2e5302147dcb69b9baa6f4aa3af6e37/ghc >--------------------------------------------------------------- commit f1a4e42ea2e5302147dcb69b9baa6f4aa3af6e37 Author: Alan Zimmerman Date: Tue Apr 7 09:10:18 2015 -0500 The production for `pquals` is incorrect; the specifics are in D803. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D803 GHC Trac Issues: #10207 >--------------------------------------------------------------- f1a4e42ea2e5302147dcb69b9baa6f4aa3af6e37 compiler/parser/Parser.y | 2 +- testsuite/tests/ghc-api/annotations/.gitignore | 1 + .../ghc-api/annotations/ListComprehensions.hs | 22 ++++ testsuite/tests/ghc-api/annotations/Makefile | 7 +- testsuite/tests/ghc-api/annotations/all.T | 2 +- .../annotations/{exampleTest.hs => listcomps.hs} | 11 +- .../tests/ghc-api/annotations/listcomps.stdout | 116 +++++++++++++++++++++ .../tests/parser/should_fail/readFail038.stderr | 2 +- 8 files changed, 152 insertions(+), 11 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 f1a4e42ea2e5302147dcb69b9baa6f4aa3af6e37 From git at git.haskell.org Tue Apr 7 14:28:45 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:28:45 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: User's guide: .a files can be 2-2.5x larger with -split-objs (7ffd7f4) Message-ID: <20150407142845.13F213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/7ffd7f45f9b9471a7deb8f5d4ec54e5ba5da3779/ghc >--------------------------------------------------------------- commit 7ffd7f45f9b9471a7deb8f5d4ec54e5ba5da3779 Author: Thomas Miedema Date: Mon Apr 6 11:51:34 2015 +0200 User's guide: .a files can be 2-2.5x larger with -split-objs And remove warning. This feature is available through cabal even. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D801 (cherry picked from commit fef4948f172b66eaf8db520b381dd4a8237b5644) >--------------------------------------------------------------- 7ffd7f45f9b9471a7deb8f5d4ec54e5ba5da3779 docs/users_guide/phases.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/users_guide/phases.xml b/docs/users_guide/phases.xml index b05de99..8994ffe 100644 --- a/docs/users_guide/phases.xml +++ b/docs/users_guide/phases.xml @@ -893,10 +893,10 @@ $ cat foo.hspp executables linked against the library are smaller as they only link against the object files that they need. However, assembling all the sections separately is expensive, so this is slower than - compiling normally. - We use this feature for building GHC's libraries - (warning: don't use it unless you know what you're - doing!). + compiling normally. Additionally, the size of the library itself + (the .a file) can be a factor of 2 to 2.5 + larger. + We use this feature for building GHC's libraries. From git at git.haskell.org Tue Apr 7 14:28:47 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:28:47 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: fix '&stg_interp_constr_entry' FFI type to be FunPtr (ff95018) Message-ID: <20150407142847.C6D643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/ff950183d246f8d1edfd0cc83eec047f033c556a/ghc >--------------------------------------------------------------- commit ff950183d246f8d1edfd0cc83eec047f033c556a Author: Sergei Trofimovich Date: Mon Apr 6 11:16:30 2015 +0100 fix '&stg_interp_constr_entry' FFI type to be FunPtr Summary: It used to be Ptr, which is slightly incorrect. ia64 has different representations for those types. Found when tried to build unregisterised ghc with -flto, GCC's link-time optimisation which happens to check data / code declaration inconsistencies. It our case 'stg_interp_constr_entry' is an RTS function: StgFunPtr f (StgFunPtr) while '"&f" :: Ptr()' produces StgWordArray f[]; Signed-off-by: Sergei Trofimovich Reviewers: simonmar, hvr, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D796 (cherry picked from commit 22eecaff9db1feb7eef9ee8ed11fcef4df01b08e) >--------------------------------------------------------------- ff950183d246f8d1edfd0cc83eec047f033c556a compiler/ghci/ByteCodeItbls.hs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/compiler/ghci/ByteCodeItbls.hs b/compiler/ghci/ByteCodeItbls.hs index d6399ba..5cc537a 100644 --- a/compiler/ghci/ByteCodeItbls.hs +++ b/compiler/ghci/ByteCodeItbls.hs @@ -30,7 +30,7 @@ import Foreign import Foreign.C import GHC.Exts ( Int(I#), addr2Int# ) -import GHC.Ptr ( Ptr(..) ) +import GHC.Ptr ( FunPtr(..) ) {- Manufacturing of info tables for DataCons @@ -87,7 +87,7 @@ make_constr_itbls dflags cons mk_dirret_itbl (dcon, conNo) = mk_itbl dcon conNo stg_interp_constr_entry - mk_itbl :: DataCon -> Int -> Ptr () -> IO (Name,ItblPtr) + mk_itbl :: DataCon -> Int -> EntryFunPtr -> IO (Name,ItblPtr) mk_itbl dcon conNo entry_addr = do let rep_args = [ (typePrimRep rep_arg,rep_arg) | arg <- dataConRepArgTys dcon, rep_arg <- flattenRepType (repType arg) ] (tot_wds, ptr_wds, _) = mkVirtHeapOffsets dflags False{-not a THUNK-} rep_args @@ -128,10 +128,10 @@ make_constr_itbls dflags cons type ItblCodes = Either [Word8] [Word32] -ptrToInt :: Ptr a -> Int -ptrToInt (Ptr a#) = I# (addr2Int# a#) +funPtrToInt :: FunPtr a -> Int +funPtrToInt (FunPtr a#) = I# (addr2Int# a#) -mkJumpToAddr :: DynFlags -> Ptr () -> ItblCodes +mkJumpToAddr :: DynFlags -> EntryFunPtr -> ItblCodes mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of ArchSPARC -> -- After some consideration, we'll try this, where @@ -144,7 +144,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- 0008 81C0C000 jmp %g3 -- 000c 01000000 nop - let w32 = fromIntegral (ptrToInt a) + let w32 = fromIntegral (funPtrToInt a) hi22, lo10 :: Word32 -> Word32 lo10 x = x .&. 0x3FF @@ -163,7 +163,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- 7D8903A6 mtctr r12 -- 4E800420 bctr - let w32 = fromIntegral (ptrToInt a) + let w32 = fromIntegral (funPtrToInt a) hi16 x = (x `shiftR` 16) .&. 0xFFFF lo16 x = x .&. 0xFFFF in Right [ 0x3D800000 .|. hi16 w32, @@ -176,7 +176,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- which is -- B8 ZZ YY XX WW FF E0 - let w32 = fromIntegral (ptrToInt a) :: Word32 + let w32 = fromIntegral (funPtrToInt a) :: Word32 insnBytes :: [Word8] insnBytes = [0xB8, byte0 w32, byte1 w32, @@ -200,7 +200,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- allocated in low memory). Assuming the info pointer is aligned to -- an 8-byte boundary, the addr will also be aligned. - let w64 = fromIntegral (ptrToInt a) :: Word64 + let w64 = fromIntegral (funPtrToInt a) :: Word64 insnBytes :: [Word8] insnBytes = [0xff, 0x25, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -210,7 +210,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of Left insnBytes ArchAlpha -> - let w64 = fromIntegral (ptrToInt a) :: Word64 + let w64 = fromIntegral (funPtrToInt a) :: Word64 in Right [ 0xc3800000 -- br at, .+4 , 0xa79c000c -- ldq at, 12(at) , 0x6bfc0000 -- jmp (at) # with zero hint -- oh well @@ -227,7 +227,7 @@ mkJumpToAddr dflags a = case platformArch (targetPlatform dflags) of -- 00000000 <.addr-0x8>: -- 0: 4900 ldr r1, [pc] ; 8 <.addr> -- 4: 4708 bx r1 - let w32 = fromIntegral (ptrToInt a) :: Word32 + let w32 = fromIntegral (funPtrToInt a) :: Word32 in Left [ 0x49, 0x00 , 0x47, 0x08 , byte0 w32, byte1 w32, byte2 w32, byte3 w32] @@ -247,7 +247,8 @@ byte6 w = fromIntegral (w `shiftR` 48) byte7 w = fromIntegral (w `shiftR` 56) -- entry point for direct returns for created constr itbls -foreign import ccall "&stg_interp_constr_entry" stg_interp_constr_entry :: Ptr () +foreign import ccall "&stg_interp_constr_entry" + stg_interp_constr_entry :: EntryFunPtr @@ -283,8 +284,10 @@ pokeConItbl dflags wr_ptr ex_ptr itbl store' (sizeOfItbl dflags) (pokeItbl dflags) (infoTable itbl) unless ghciTablesNextToCode $ store (conDesc itbl) +type EntryFunPtr = FunPtr (Ptr () -> IO (Ptr ())) + data StgInfoTable = StgInfoTable { - entry :: Maybe (Ptr ()), -- Just <=> not ghciTablesNextToCode + entry :: Maybe EntryFunPtr, -- Just <=> not ghciTablesNextToCode ptrs :: HalfWord, nptrs :: HalfWord, tipe :: HalfWord, From git at git.haskell.org Tue Apr 7 14:28:50 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:28:50 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Suggest how to fix .ghci when it is group writeable (#8248) (53f7235) Message-ID: <20150407142850.B8F5F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/53f723589819f5e232d2333a993a4d0341702dc4/ghc >--------------------------------------------------------------- commit 53f723589819f5e232d2333a993a4d0341702dc4 Author: Vikas Menon Date: Tue Apr 7 15:39:44 2015 +0200 Suggest how to fix .ghci when it is group writeable (#8248) ``` chmod 664 $PATH_TO_GHCI_CONF/.ghci ``` Run ghci. You will now get a warning + a suggestion: ``` *** WARNING: $PATH_TO_GHCI_CONF/.ghci is writable by someone else, IGNORING! Suggested fix: execute 'chmod 644 $PATH_TO_GHCI_CONF/.ghci' ``` Execute fix and the warning should disappear. Reviewed By: mboes, thomie Differential Revision: https://phabricator.haskell.org/D805 (cherry picked from commit b972de0365f94e1be9d78537152eee969dc5f4cb) >--------------------------------------------------------------- 53f723589819f5e232d2333a993a4d0341702dc4 ghc/InteractiveUI.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 7310dca..06fbc57 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -611,8 +611,10 @@ checkPerms name = groupWriteMode /= mode `intersectFileModes` groupWriteMode && otherWriteMode /= mode `intersectFileModes` otherWriteMode unless ok $ + -- #8248: Improving warning to include a possible fix. putStrLn $ "*** WARNING: " ++ name ++ - " is writable by someone else, IGNORING!" + " is writable by someone else, IGNORING!" ++ + "\nSuggested fix: execute 'chmod 644 " ++ name ++ "'" return ok #endif From git at git.haskell.org Tue Apr 7 14:28:53 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:28:53 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: rts/Linker.c: distinct between DATA and CODE labels when importing (623e203) Message-ID: <20150407142853.93A7B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/623e2033d0caf18c363526fb5c3fffed1785c75f/ghc >--------------------------------------------------------------- commit 623e2033d0caf18c363526fb5c3fffed1785c75f Author: Sergei Trofimovich Date: Tue Apr 7 09:08:37 2015 -0500 rts/Linker.c: distinct between DATA and CODE labels when importing The patch is a last major piece to make unregisterised GHC build under GCC's link-time optimizer. Before the patch we imported everything external as functions. Now we distinct between global variables and functions. The difference is crucial on ia64 and a complement to fixes: > d82f592522eb8e063276a8a8c87ab93e18353c6b > CMM: add a mechanism to import C .data labels > e18525fae273f4c1ad8d6cbe1dea4fc074cac721 > pprC: declare extern cmm primitives as functions, not data Signed-off-by: Sergei Trofimovich Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D797 (cherry picked from commit ab76b0990e9f7d20bde403be38935f9d16491806) >--------------------------------------------------------------- 623e2033d0caf18c363526fb5c3fffed1785c75f rts/Linker.c | 60 ++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 0bd2aa8..5b30b84 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -365,7 +365,7 @@ typedef struct _RtsSymbolVal { SymI_HasProto(stg_sig_install) \ SymI_HasProto(rtsTimerSignal) \ SymI_HasProto(atexit) \ - SymI_NeedsProto(nocldstop) + SymI_NeedsDataProto(nocldstop) #endif #if defined (cygwin32_HOST_OS) @@ -890,18 +890,18 @@ typedef struct _RtsSymbolVal { #define RTS_LIBFFI_SYMBOLS \ SymE_NeedsProto(ffi_prep_cif) \ SymE_NeedsProto(ffi_call) \ - SymE_NeedsProto(ffi_type_void) \ - SymE_NeedsProto(ffi_type_float) \ - SymE_NeedsProto(ffi_type_double) \ - SymE_NeedsProto(ffi_type_sint64) \ - SymE_NeedsProto(ffi_type_uint64) \ - SymE_NeedsProto(ffi_type_sint32) \ - SymE_NeedsProto(ffi_type_uint32) \ - SymE_NeedsProto(ffi_type_sint16) \ - SymE_NeedsProto(ffi_type_uint16) \ - SymE_NeedsProto(ffi_type_sint8) \ - SymE_NeedsProto(ffi_type_uint8) \ - SymE_NeedsProto(ffi_type_pointer) + SymE_NeedsDataProto(ffi_type_void) \ + SymE_NeedsDataProto(ffi_type_float) \ + SymE_NeedsDataProto(ffi_type_double) \ + SymE_NeedsDataProto(ffi_type_sint64) \ + SymE_NeedsDataProto(ffi_type_uint64) \ + SymE_NeedsDataProto(ffi_type_sint32) \ + SymE_NeedsDataProto(ffi_type_uint32) \ + SymE_NeedsDataProto(ffi_type_sint16) \ + SymE_NeedsDataProto(ffi_type_uint16) \ + SymE_NeedsDataProto(ffi_type_sint8) \ + SymE_NeedsDataProto(ffi_type_uint8) \ + SymE_NeedsDataProto(ffi_type_pointer) #ifdef TABLES_NEXT_TO_CODE #define RTS_RET_SYMBOLS /* nothing */ @@ -931,8 +931,8 @@ typedef struct _RtsSymbolVal { /* Modules compiled with -ticky may mention ticky counters */ /* This list should marry up with the one in $(TOP)/includes/stg/Ticky.h */ #define RTS_TICKY_SYMBOLS \ - SymI_NeedsProto(ticky_entry_ctrs) \ - SymI_NeedsProto(top_ct) \ + SymI_NeedsDataProto(ticky_entry_ctrs) \ + SymI_NeedsDataProto(top_ct) \ \ SymI_HasProto(ENT_VIA_NODE_ctr) \ SymI_HasProto(ENT_STATIC_THK_SINGLE_ctr) \ @@ -1410,9 +1410,9 @@ typedef struct _RtsSymbolVal { SymI_HasProto(getAllocations) \ SymI_HasProto(revertCAFs) \ SymI_HasProto(RtsFlags) \ - SymI_NeedsProto(rts_breakpoint_io_action) \ - SymI_NeedsProto(rts_stop_next_breakpoint) \ - SymI_NeedsProto(rts_stop_on_exception) \ + SymI_NeedsDataProto(rts_breakpoint_io_action) \ + SymI_NeedsDataProto(rts_stop_next_breakpoint) \ + SymI_NeedsDataProto(rts_stop_on_exception) \ SymI_HasProto(stopTimer) \ SymI_HasProto(n_capabilities) \ SymI_HasProto(enabled_capabilities) \ @@ -1462,15 +1462,19 @@ typedef struct _RtsSymbolVal { /* entirely bogus claims about types of these symbols */ #define SymI_NeedsProto(vvv) extern void vvv(void); +#define SymI_NeedsDataProto(vvv) extern StgWord vvv[]; #if defined(COMPILING_WINDOWS_DLL) #define SymE_HasProto(vvv) SymE_HasProto(vvv); # if defined(x86_64_HOST_ARCH) # define SymE_NeedsProto(vvv) extern void __imp_ ## vvv (void); +# define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv) # else # define SymE_NeedsProto(vvv) extern void _imp__ ## vvv (void); +# define SymE_NeedsDataProto(vvv) SymE_NeedsProto(vvv) # endif #else #define SymE_NeedsProto(vvv) SymI_NeedsProto(vvv); +#define SymE_NeedsDataProto(vvv) SymI_NeedsDataProto(vvv); #define SymE_HasProto(vvv) SymI_HasProto(vvv) #endif #define SymI_HasProto(vvv) /**/ @@ -1484,10 +1488,13 @@ RTS_DARWIN_ONLY_SYMBOLS RTS_LIBGCC_SYMBOLS RTS_LIBFFI_SYMBOLS #undef SymI_NeedsProto +#undef SymI_NeedsDataProto #undef SymI_HasProto #undef SymI_HasProto_redirect #undef SymE_HasProto +#undef SymE_HasDataProto #undef SymE_NeedsProto +#undef SymE_NeedsDataProto #ifdef LEADING_UNDERSCORE #define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s) @@ -1497,11 +1504,17 @@ RTS_LIBFFI_SYMBOLS #define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ (void*)(&(vvv)) }, +#define SymI_HasDataProto(vvv) \ + SymI_HasProto(vvv) #define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ (void*)DLL_IMPORT_DATA_REF(vvv) }, +#define SymE_HasDataProto(vvv) \ + SymE_HasProto(vvv) #define SymI_NeedsProto(vvv) SymI_HasProto(vvv) +#define SymI_NeedsDataProto(vvv) SymI_HasDataProto(vvv) #define SymE_NeedsProto(vvv) SymE_HasProto(vvv) +#define SymE_NeedsDataProto(vvv) SymE_HasDataProto(vvv) // SymI_HasProto_redirect allows us to redirect references to one symbol to // another symbol. See newCAF/newDynCAF for an example. @@ -7343,20 +7356,31 @@ machoInitSymbolsWithoutUnderscore(void) __asm__ volatile(".globl _symbolsWithoutUnderscore\n.data\n_symbolsWithoutUnderscore:"); #undef SymI_NeedsProto +#undef SymI_NeedsDataProto + #define SymI_NeedsProto(x) \ __asm__ volatile(".long " # x); +#define SymI_NeedsDataProto(x) \ + SymI_NeedsProto(x) + RTS_MACHO_NOUNDERLINE_SYMBOLS __asm__ volatile(".text"); #undef SymI_NeedsProto +#undef SymI_NeedsDataProto + #define SymI_NeedsProto(x) \ ghciInsertSymbolTable("(GHCi built-in symbols)", symhash, #x, *p++, HS_BOOL_FALSE, NULL); +#define SymI_NeedsDataProto(x) \ + SymI_NeedsProto(x) + RTS_MACHO_NOUNDERLINE_SYMBOLS #undef SymI_NeedsProto +#undef SymI_NeedsDataProto } #endif From git at git.haskell.org Tue Apr 7 14:28:57 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:28:57 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: The production for `pquals` is incorrect; the specifics are in D803. (9fd6fae) Message-ID: <20150407142857.5783B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/9fd6faeebf66426113a2edbc3a282f833ca29065/ghc >--------------------------------------------------------------- commit 9fd6faeebf66426113a2edbc3a282f833ca29065 Author: Alan Zimmerman Date: Tue Apr 7 09:10:18 2015 -0500 The production for `pquals` is incorrect; the specifics are in D803. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D803 GHC Trac Issues: #10207 (cherry picked from commit f1a4e42ea2e5302147dcb69b9baa6f4aa3af6e37) >--------------------------------------------------------------- 9fd6faeebf66426113a2edbc3a282f833ca29065 compiler/parser/Parser.y | 2 +- testsuite/tests/ghc-api/annotations/.gitignore | 1 + .../ghc-api/annotations/ListComprehensions.hs | 22 ++++ testsuite/tests/ghc-api/annotations/Makefile | 5 + testsuite/tests/ghc-api/annotations/all.T | 2 +- .../annotations/{exampleTest.hs => listcomps.hs} | 11 +- .../tests/ghc-api/annotations/listcomps.stdout | 116 +++++++++++++++++++++ .../tests/parser/should_fail/readFail038.stderr | 2 +- 8 files changed, 151 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 9fd6faeebf66426113a2edbc3a282f833ca29065 From git at git.haskell.org Tue Apr 7 14:29:00 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:29:00 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: The production for squals is incorrect; see D806 for specifics. (0e34751) Message-ID: <20150407142900.3971C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/0e34751d7161fd0b9de125e5378482a30370653f/ghc >--------------------------------------------------------------- commit 0e34751d7161fd0b9de125e5378482a30370653f Author: Alan Zimmerman Date: Tue Apr 7 09:10:27 2015 -0500 The production for squals is incorrect; see D806 for specifics. This diff depends on D803. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D806 GHC Trac Issues: #10214 (cherry picked from commit cf196400609d920e7f8189b9376833f4f5886360) >--------------------------------------------------------------- 0e34751d7161fd0b9de125e5378482a30370653f compiler/parser/Parser.y | 20 ++++----- .../ghc-api/annotations/ListComprehensions.hs | 6 +++ .../tests/ghc-api/annotations/listcomps.stdout | 50 ++++++++++++++++++++-- .../tests/parser/should_fail/readFail042.stderr | 4 +- .../tests/parser/should_fail/readFail043.stderr | 18 ++++---- testsuite/tests/typecheck/should_fail/mc19.stderr | 2 +- testsuite/tests/typecheck/should_fail/mc21.stderr | 2 +- testsuite/tests/typecheck/should_fail/mc22.stderr | 4 +- testsuite/tests/typecheck/should_fail/mc25.stderr | 2 +- .../tests/typecheck/should_fail/tcfail191.stderr | 2 +- .../tests/typecheck/should_fail/tcfail193.stderr | 2 +- 11 files changed, 80 insertions(+), 32 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 0e34751d7161fd0b9de125e5378482a30370653f From git at git.haskell.org Tue Apr 7 14:36:04 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:36:04 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Add a bizarre corner-case to cgExpr (Trac #9964) (c2ef5ab) Message-ID: <20150407143604.4FBFC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/c2ef5ab30b8b5992f7eca971da31e0e903e85b71/ghc >--------------------------------------------------------------- commit c2ef5ab30b8b5992f7eca971da31e0e903e85b71 Author: Simon Peyton Jones Date: Fri Feb 20 08:49:32 2015 +0000 Add a bizarre corner-case to cgExpr (Trac #9964) David Feuer managed to tickle a corner case in the code generator. See Note [Scrutinising VoidRep] in StgCmmExpr. I rejigged the comments in that area of the code generator Note [Dodgy unsafeCoerce 1] Note [Dodgy unsafeCoerce 2] but I can't say I fully understand them, alas. (cherry picked from commit 9c78d09e344e97d2d5c37b9bb46e311a3cf031e2) >--------------------------------------------------------------- c2ef5ab30b8b5992f7eca971da31e0e903e85b71 compiler/codeGen/StgCmmExpr.hs | 78 +++++++++++++++++-------- testsuite/tests/codeGen/should_compile/T9964.hs | 11 ++++ testsuite/tests/codeGen/should_compile/all.T | 1 + 3 files changed, 67 insertions(+), 23 deletions(-) diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index e54ae46..57ac626 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -355,30 +355,59 @@ of Bool-returning primops was that tagToEnum# was added implicitly in the codegen and then optimized away. Now the call to tagToEnum# is explicit in the source code, which allows to optimize it away at the earlier stages of compilation (i.e. at the Core level). + +Note [Scrutinising VoidRep] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Suppose we have this STG code: + f = \[s : State# RealWorld] -> + case s of _ -> blah +This is very odd. Why are we scrutinising a state token? But it +can arise with bizarre NOINLINE pragmas (Trac #9964) + crash :: IO () + crash = IO (\s -> let {-# NOINLINE s' #-} + s' = s + in (# s', () #)) + +Now the trouble is that 's' has VoidRep, and we do not bind void +arguments in the environment; they don't live anywhere. See the +calls to nonVoidIds in various places. So we must not look up +'s' in the environment. Instead, just evaluate the RHS! Simple. + +Note [Dodgy unsafeCoerce 1] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + case (x :: MutVar# Int) |> co of (y :: HValue) + DEFAULT -> ... +We want to gnerate an assignment + y := x +We want to allow this assignment to be generated in the case when the +types are compatible, because this allows some slightly-dodgy but +occasionally-useful casts to be used, such as in RtClosureInspect +where we cast an HValue to a MutVar# so we can print out the contents +of the MutVar#. If instead we generate code that enters the HValue, +then we'll get a runtime panic, because the HValue really is a +MutVar#. The types are compatible though, so we can just generate an +assignment. + +Note [Dodgy unsafeCoerce 2] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Note [ticket #3132]: we might be looking at a case of a lifted Id that +was cast to an unlifted type. The Id will always be bottom, but we +don't want the code generator to fall over here. If we just emit an +assignment here, the assignment will be type-incorrect Cmm. Hence, we +emit the usual enter/return code, (and because bottom must be +untagged, it will be entered and the program will crash). The Sequel +is a type-correct assignment, albeit bogus. The (dead) continuation +loops; it would be better to invoke some kind of panic function here. -} +cgCase (StgApp v []) _ (PrimAlt _) alts + | isVoidRep (idPrimRep v) -- See Note [Scrutinising VoidRep] + , [(DEFAULT, _, _, rhs)] <- alts + = cgExpr rhs - -- Note [ticket #3132]: we might be looking at a case of a lifted Id - -- that was cast to an unlifted type. The Id will always be bottom, - -- but we don't want the code generator to fall over here. If we - -- just emit an assignment here, the assignment will be - -- type-incorrect Cmm. Hence, we emit the usual enter/return code, - -- (and because bottom must be untagged, it will be entered and the - -- program will crash). - -- The Sequel is a type-correct assignment, albeit bogus. - -- The (dead) continuation loops; it would be better to invoke some kind - -- of panic function here. - -- - -- However, we also want to allow an assignment to be generated - -- in the case when the types are compatible, because this allows - -- some slightly-dodgy but occasionally-useful casts to be used, - -- such as in RtClosureInspect where we cast an HValue to a MutVar# - -- so we can print out the contents of the MutVar#. If we generate - -- code that enters the HValue, then we'll get a runtime panic, because - -- the HValue really is a MutVar#. The types are compatible though, - -- so we can just generate an assignment. cgCase (StgApp v []) bndr alt_type@(PrimAlt _) alts - | isUnLiftedType (idType v) + | isUnLiftedType (idType v) -- Note [Dodgy unsafeCoerce 1] || reps_compatible = -- assignment suffices for unlifted types do { dflags <- getDynFlags @@ -392,7 +421,7 @@ cgCase (StgApp v []) bndr alt_type@(PrimAlt _) alts reps_compatible = idPrimRep v == idPrimRep bndr cgCase scrut@(StgApp v []) _ (PrimAlt _) _ - = -- fail at run-time, not compile-time + = -- See Note [Dodgy unsafeCoerce 2] do { dflags <- getDynFlags ; mb_cc <- maybeSaveCostCentre True ; _ <- withSequel (AssignTo [idToReg dflags (NonVoid v)] False) (cgExpr scrut) @@ -403,7 +432,9 @@ cgCase scrut@(StgApp v []) _ (PrimAlt _) _ ; emit (mkBranch l) ; return AssignedDirectly } -{- + +{- Note [Handle seq#] +~~~~~~~~~~~~~~~~~~~~~ case seq# a s of v (# s', a' #) -> e @@ -417,7 +448,8 @@ is the same as the return convention for just 'a') -} cgCase (StgOpApp (StgPrimOp SeqOp) [StgVarArg a, _] _) bndr alt_type alts - = -- handle seq#, same return convention as vanilla 'a'. + = -- Note [Handle seq#] + -- Use the same return convention as vanilla 'a'. cgCase (StgApp a []) bndr alt_type alts cgCase scrut bndr alt_type alts diff --git a/testsuite/tests/codeGen/should_compile/T9964.hs b/testsuite/tests/codeGen/should_compile/T9964.hs new file mode 100644 index 0000000..df15d47 --- /dev/null +++ b/testsuite/tests/codeGen/should_compile/T9964.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE UnboxedTuples #-} +module T9964 where + +import GHC.Base + +crash :: IO () +crash = IO (\s -> + let + {-# NOINLINE s' #-} + s' = s + in (# s', () #)) diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T index b571839..e06cead 100644 --- a/testsuite/tests/codeGen/should_compile/all.T +++ b/testsuite/tests/codeGen/should_compile/all.T @@ -29,3 +29,4 @@ test('T9329', [cmm_src], compile, ['']) test('debug', extra_clean(['debug.cmm']), run_command, ['$MAKE -s --no-print-directory debug']) +test('T9964', normal, compile, ['-O']) From git at git.haskell.org Tue Apr 7 14:39:54 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:39:54 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Do not quantify over the function itself in a RULE (211cc28) Message-ID: <20150407143954.A6E063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/211cc28688c9424105c204f535ff54033a2c657e/ghc >--------------------------------------------------------------- commit 211cc28688c9424105c204f535ff54033a2c657e Author: Simon Peyton Jones Date: Tue Apr 7 14:01:39 2015 +0100 Do not quantify over the function itself in a RULE We were erroneously quantifying over the function when it had a dictionary type. A bit pathological, but possible. This fixes Trac #10251 (cherry picked from commit cfb60421a43f23e75ead85d99cec207a156f9312) >--------------------------------------------------------------- 211cc28688c9424105c204f535ff54033a2c657e compiler/deSugar/DsBinds.hs | 43 ++++++++++++++---------- testsuite/tests/deSugar/should_compile/T10251.hs | 41 ++++++++++++++++++++++ testsuite/tests/deSugar/should_compile/all.T | 1 + 3 files changed, 68 insertions(+), 17 deletions(-) diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index 76b53ac..51679a8 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -603,37 +603,46 @@ decomposeRuleLhs orig_bndrs orig_lhs -- See Note [Unused spec binders] = Left (vcat (map dead_msg unbound)) - | Var fn_var <- fun - , not (fn_var `elemVarSet` orig_bndr_set) + | Just (fn_id, args) <- decompose fun2 args2 + , let extra_dict_bndrs = mk_extra_dict_bndrs fn_id args = -- pprTrace "decmposeRuleLhs" (vcat [ ptext (sLit "orig_bndrs:") <+> ppr orig_bndrs -- , ptext (sLit "orig_lhs:") <+> ppr orig_lhs -- , ptext (sLit "lhs1:") <+> ppr lhs1 - -- , ptext (sLit "bndrs1:") <+> ppr bndrs1 - -- , ptext (sLit "fn_var:") <+> ppr fn_var + -- , ptext (sLit "extra_dict_bndrs:") <+> ppr extra_dict_bndrs + -- , ptext (sLit "fn_id:") <+> ppr fn_id -- , ptext (sLit "args:") <+> ppr args]) $ - Right (bndrs1, fn_var, args) - - | Case scrut bndr ty [(DEFAULT, _, body)] <- fun - , isDeadBinder bndr -- Note [Matching seqId] - , let args' = [Type (idType bndr), Type ty, scrut, body] - = Right (bndrs1, seqId, args' ++ args) + Right (orig_bndrs ++ extra_dict_bndrs, fn_id, args) | otherwise = Left bad_shape_msg where - lhs1 = drop_dicts orig_lhs - lhs2 = simpleOptExpr lhs1 -- See Note [Simplify rule LHS] - (fun,args) = collectArgs lhs2 + lhs1 = drop_dicts orig_lhs + lhs2 = simpleOptExpr lhs1 -- See Note [Simplify rule LHS] + (fun2,args2) = collectArgs lhs2 + lhs_fvs = exprFreeVars lhs2 unbound = filterOut (`elemVarSet` lhs_fvs) orig_bndrs - bndrs1 = orig_bndrs ++ extra_dict_bndrs orig_bndr_set = mkVarSet orig_bndrs -- Add extra dict binders: Note [Free dictionaries] - extra_dict_bndrs = [ mkLocalId (localiseName (idName d)) (idType d) - | d <- varSetElems (lhs_fvs `delVarSetList` orig_bndrs) - , isDictId d ] + mk_extra_dict_bndrs fn_id args + = [ mkLocalId (localiseName (idName d)) (idType d) + | d <- varSetElems (exprsFreeVars args `delVarSetList` (fn_id : orig_bndrs)) + -- fn_id: do not quantify over the function itself, which may + -- itself be a dictionary (in pathological cases, Trac #10251) + , isDictId d ] + + decompose (Var fn_id) args + | not (fn_id `elemVarSet` orig_bndr_set) + = Just (fn_id, args) + + decompose (Case scrut bndr ty [(DEFAULT, _, body)]) args + | isDeadBinder bndr -- Note [Matching seqId] + , let args' = [Type (idType bndr), Type ty, scrut, body] + = Just (seqId, args' ++ args) + + decompose _ _ = Nothing bad_shape_msg = hang (ptext (sLit "RULE left-hand side too complicated to desugar")) 2 (vcat [ text "Optimised lhs:" <+> ppr lhs2 diff --git a/testsuite/tests/deSugar/should_compile/T10251.hs b/testsuite/tests/deSugar/should_compile/T10251.hs new file mode 100644 index 0000000..afca7fb --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T10251.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE NoImplicitPrelude #-} +{-# OPTIONS_GHC -O #-} +module T10251 where + +data D = D +data E = E + +class Storable a where + poke2 :: a -> E +instance Storable D where + poke2 = poke2 -- undefined + +class Foo a where +instance Foo D where + +class (Foo t, Storable t) => FooStorable t where + +instance FooStorable D where + {-# SPECIALIZE instance FooStorable D #-} + +{-# SPECIALIZE bug :: D -> E #-} + +bug + :: FooStorable t + => t + -> E +bug = poke2 +{- +sf 9160 # ghc -c -fforce-recomp -Wall B.hs + +ghc: panic! (the 'impossible' happened) + (GHC version 7.10.1 for x86_64-unknown-linux): + Template variable unbound in rewrite rule + $fFooStorableD_XU + [$fFooStorableD_XU] + [$fFooStorableD_XU] + [] + [] + +Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug +-} diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index ac8f95c..956f951 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -103,3 +103,4 @@ test('T5252Take2', test('T2431', normal, compile, ['-ddump-simpl -dsuppress-uniques']) test('T7669', normal, compile, ['']) test('T8470', normal, compile, ['']) +test('T10251', normal, compile, ['']) From git at git.haskell.org Tue Apr 7 14:39:58 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 14:39:58 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Look inside synonyms for foralls when unifying (681d82c) Message-ID: <20150407143958.59E733A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/681d82c0d44f06f0b958b75778c30b0910df982b/ghc >--------------------------------------------------------------- commit 681d82c0d44f06f0b958b75778c30b0910df982b Author: Simon Peyton Jones Date: Tue Apr 7 14:45:04 2015 +0100 Look inside synonyms for foralls when unifying This fixes Trac #10194 (cherry picked from commit 553c5182156c5e4c15e3bd1c17c6d83a95a6c408) >--------------------------------------------------------------- 681d82c0d44f06f0b958b75778c30b0910df982b compiler/typecheck/TcType.hs | 10 +++++++--- compiler/typecheck/TcUnify.hs | 5 ++++- testsuite/tests/typecheck/should_fail/T10194.hs | 7 +++++++ testsuite/tests/typecheck/should_fail/T10194.stderr | 7 +++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 2d567ce..b7dc58e 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -853,7 +853,7 @@ mkTcEqPredRole Nominal = mkTcEqPred mkTcEqPredRole Representational = mkTcReprEqPred mkTcEqPredRole Phantom = panic "mkTcEqPredRole Phantom" --- @isTauTy@ tests for nested for-alls. It should not be called on a boxy type. +-- @isTauTy@ tests for nested for-alls. isTauTy :: Type -> Bool isTauTy ty | Just ty' <- tcView ty = isTauTy ty' @@ -1228,7 +1228,7 @@ occurCheckExpand dflags tv ty -- True => fine fast_check (LitTy {}) = True fast_check (TyVarTy tv') = tv /= tv' - fast_check (TyConApp _ tys) = all fast_check tys + fast_check (TyConApp tc tys) = all fast_check tys && (isTauTyCon tc || impredicative) fast_check (FunTy arg res) = fast_check arg && fast_check res fast_check (AppTy fun arg) = fast_check fun && fast_check arg fast_check (ForAllTy tv' ty) = impredicative @@ -1262,7 +1262,11 @@ occurCheckExpand dflags tv ty -- it and try again. go ty@(TyConApp tc tys) = case do { tys <- mapM go tys; return (mkTyConApp tc tys) } of - OC_OK ty -> return ty -- First try to eliminate the tyvar from the args + OC_OK ty + | impredicative || isTauTyCon tc + -> return ty -- First try to eliminate the tyvar from the args + | otherwise + -> OC_Forall -- A type synonym with a forall on the RHS bad | Just ty' <- tcView ty -> go ty' | otherwise -> bad -- Failing that, try to expand a synonym diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index b4a6ada..ef21d87 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -1012,10 +1012,13 @@ checkTauTvUpdate dflags tv ty defer_me :: TcType -> Bool -- Checks for (a) occurrence of tv -- (b) type family applications + -- (c) foralls -- See Note [Conservative unification check] defer_me (LitTy {}) = False defer_me (TyVarTy tv') = tv == tv' - defer_me (TyConApp tc tys) = isTypeFamilyTyCon tc || any defer_me tys + defer_me (TyConApp tc tys) = isTypeFamilyTyCon tc + || any defer_me tys + || not (impredicative || isTauTyCon tc) defer_me (FunTy arg res) = defer_me arg || defer_me res defer_me (AppTy fun arg) = defer_me fun || defer_me arg defer_me (ForAllTy _ ty) = not impredicative || defer_me ty diff --git a/testsuite/tests/typecheck/should_fail/T10194.hs b/testsuite/tests/typecheck/should_fail/T10194.hs new file mode 100644 index 0000000..2174a59 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T10194.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes #-} +module T10194 where + +type X = forall a . a + +comp :: (X -> c) -> (a -> X) -> (a -> c) +comp = (.) diff --git a/testsuite/tests/typecheck/should_fail/T10194.stderr b/testsuite/tests/typecheck/should_fail/T10194.stderr new file mode 100644 index 0000000..53ee74b --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T10194.stderr @@ -0,0 +1,7 @@ + +T10194.hs:7:8: + Cannot instantiate unification variable ?b0? + with a type involving foralls: X + Perhaps you want ImpredicativeTypes + In the expression: (.) + In an equation for ?comp?: comp = (.) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index f5d4d0e..8ae6410 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -354,3 +354,4 @@ test('T8044', normal, compile_fail, ['']) test('T4921', normal, compile_fail, ['']) test('T9605', normal, compile_fail, ['']) test('T9999', normal, compile_fail, ['']) +test('T10194', normal, compile_fail, ['']) From git at git.haskell.org Tue Apr 7 16:45:40 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 16:45:40 +0000 (UTC) Subject: [commit: packages/array] master: Error message wibble following module suppression (0b23a9b) Message-ID: <20150407164540.127743A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/0b23a9b9a0a8e89336687aa318d9142e2f542db3 >--------------------------------------------------------------- commit 0b23a9b9a0a8e89336687aa318d9142e2f542db3 Author: Simon Peyton Jones Date: Tue Apr 7 17:46:03 2015 +0100 Error message wibble following module suppression >--------------------------------------------------------------- 0b23a9b9a0a8e89336687aa318d9142e2f542db3 tests/T9220.stdout | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/T9220.stdout b/tests/T9220.stdout index 71582f2..41287b1 100644 --- a/tests/T9220.stdout +++ b/tests/T9220.stdout @@ -1,26 +1,23 @@ type role Data.Array.Base.UArray nominal nominal data Data.Array.Base.UArray i e - = Data.Array.Base.UArray !i - !i - {-# UNPACK #-}Int - GHC.Prim.ByteArray# + = Data.Array.Base.UArray !i !i {-# UNPACK #-}Int ByteArray# -- Defined in ?Data.Array.Base? -instance (GHC.Arr.Ix ix, Eq e, +instance (Ix ix, Eq e, Data.Array.Base.IArray Data.Array.Base.UArray e) => Eq (Data.Array.Base.UArray ix e) -- Defined in ?Data.Array.Base? -instance (GHC.Arr.Ix ix, Ord e, +instance (Ix ix, Ord e, Data.Array.Base.IArray Data.Array.Base.UArray e) => Ord (Data.Array.Base.UArray ix e) -- Defined in ?Data.Array.Base? -instance (GHC.Arr.Ix ix, Show ix, Show e, +instance (Ix ix, Show ix, Show e, Data.Array.Base.IArray Data.Array.Base.UArray e) => Show (Data.Array.Base.UArray ix e) -- Defined in ?Data.Array.Base? type role Data.Array.IO.Internals.IOUArray nominal nominal newtype Data.Array.IO.Internals.IOUArray i e = Data.Array.IO.Internals.IOUArray (Data.Array.Base.STUArray - GHC.Prim.RealWorld i e) + RealWorld i e) -- Defined in ?Data.Array.IO.Internals? instance Eq (Data.Array.IO.Internals.IOUArray i e) -- Defined in ?Data.Array.IO.Internals? @@ -29,7 +26,7 @@ data Data.Array.Base.STUArray s i e = Data.Array.Base.STUArray !i !i {-# UNPACK #-}Int - (GHC.Prim.MutableByteArray# s) + (MutableByteArray# s) -- Defined in ?Data.Array.Base? instance Eq (Data.Array.Base.STUArray s i e) -- Defined in ?Data.Array.Base? @@ -38,5 +35,5 @@ data Data.Array.Storable.Internals.StorableArray i e = Data.Array.Storable.Internals.StorableArray !i !i Int - !(GHC.ForeignPtr.ForeignPtr e) + !(ForeignPtr e) -- Defined in ?Data.Array.Storable.Internals? From git at git.haskell.org Tue Apr 7 16:48:30 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 16:48:30 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #10148 (eacda92) Message-ID: <20150407164830.493093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eacda9244913709ed025767418468b4cfc878cf9/ghc >--------------------------------------------------------------- commit eacda9244913709ed025767418468b4cfc878cf9 Author: Simon Peyton Jones Date: Tue Apr 7 17:20:43 2015 +0100 Test Trac #10148 >--------------------------------------------------------------- eacda9244913709ed025767418468b4cfc878cf9 testsuite/tests/stranal/should_run/T10148.hs | 28 ++++++++++++++++++++++ .../tests/stranal/should_run/T10148.stdout | 0 testsuite/tests/stranal/should_run/all.T | 1 + 3 files changed, 29 insertions(+) diff --git a/testsuite/tests/stranal/should_run/T10148.hs b/testsuite/tests/stranal/should_run/T10148.hs new file mode 100644 index 0000000..cba925e --- /dev/null +++ b/testsuite/tests/stranal/should_run/T10148.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE BangPatterns #-} +module Main where + +import Debug.Trace + +data Machine = Machine (Int -> Machine) Int + +main :: IO () +main = (go 7 $ Machine (gstep (Array 99)) 8) `seq` return () + where + go :: Int -> Machine -> Int + go 0 (Machine _ done) = done + go nq (Machine step _) = go (nq-1) $ step 0 + +gstep :: Array Int -> Int -> Machine +gstep m x = Machine (gstep m') (mindexA m) + where + !m' = adjustA x m + +data Array a = Array a + +adjustA :: (Show a) => Int -> Array a -> Array a +adjustA i (Array t) + | i < 0 = undefined i -- not just undefined! + | otherwise = Array $ trace ("adj " ++ show t) $ t + +mindexA :: Array a -> a +mindexA (Array v) = v diff --git a/libraries/base/tests/IO/misc001.stdout b/testsuite/tests/stranal/should_run/T10148.stdout similarity index 100% copy from libraries/base/tests/IO/misc001.stdout copy to testsuite/tests/stranal/should_run/T10148.stdout diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index 2ca65b5..7f64f85 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -8,3 +8,4 @@ test('strun004', normal, compile_and_run, ['']) test('T2756b', normal, compile_and_run, ['']) test('T7649', normal, compile_and_run, ['']) test('T9254', normal, compile_and_run, ['']) +test('T10148', normal, compile_and_run, ['']) From git at git.haskell.org Tue Apr 7 16:48:33 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 16:48:33 +0000 (UTC) Subject: [commit: ghc] master: More error message wibbles (e6e0415) Message-ID: <20150407164833.72D6C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e6e0415befc9784f8631360fe51b34232ad589e9/ghc >--------------------------------------------------------------- commit e6e0415befc9784f8631360fe51b34232ad589e9 Author: Simon Peyton Jones Date: Tue Apr 7 17:33:44 2015 +0100 More error message wibbles ..due to suppressing base-package module names. Needs a submodule update on array. >--------------------------------------------------------------- e6e0415befc9784f8631360fe51b34232ad589e9 libraries/array | 2 +- .../tests/simplCore/should_compile/T3717.stderr | 10 +-- .../tests/simplCore/should_compile/T3772.stdout | 15 ++-- .../tests/simplCore/should_compile/T4908.stderr | 10 +-- .../tests/simplCore/should_compile/T4930.stderr | 16 ++-- .../tests/simplCore/should_compile/T5366.stdout | 2 +- .../tests/simplCore/should_compile/T7360.stderr | 22 ++---- .../tests/simplCore/should_compile/T7865.stdout | 4 +- .../tests/simplCore/should_compile/T9400.stderr | 3 +- .../simplCore/should_compile/spec-inline.stderr | 87 ++++++++-------------- .../typecheck/should_fail/TcCoercibleFail.stderr | 3 +- 11 files changed, 69 insertions(+), 105 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 e6e0415befc9784f8631360fe51b34232ad589e9 From git at git.haskell.org Tue Apr 7 16:52:03 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 16:52:03 +0000 (UTC) Subject: [commit: ghc] master: Final error message wibble (a058ad6) Message-ID: <20150407165203.D13E03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a058ad65e0936c1b7104ee976cbf80d97fd7232e/ghc >--------------------------------------------------------------- commit a058ad65e0936c1b7104ee976cbf80d97fd7232e Author: Simon Peyton Jones Date: Tue Apr 7 17:52:14 2015 +0100 Final error message wibble >--------------------------------------------------------------- a058ad65e0936c1b7104ee976cbf80d97fd7232e testsuite/tests/simplCore/should_compile/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 724cd3e..a7460b0 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -83,7 +83,7 @@ simpl021: .PHONY: T5327 T5327: $(RM) -f T5327.hi T5327.o - '$(TEST_HC)' $(TEST_HC_OPTS) -c T5327.hs -O -ddump-simpl | grep -c 'GHC.Prim.># 34# ' + '$(TEST_HC)' $(TEST_HC_OPTS) -c T5327.hs -O -ddump-simpl | grep -c '># 34# ' .PHONY: T5623 T5623: From git at git.haskell.org Tue Apr 7 18:55:37 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 18:55:37 +0000 (UTC) Subject: [commit: ghc] master: Support for multiple signature files in scope. (a7524ea) Message-ID: <20150407185537.572DE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a7524eaed33324e2155c47d4a705bef1d70a2b5b/ghc >--------------------------------------------------------------- commit a7524eaed33324e2155c47d4a705bef1d70a2b5b Author: Edward Z. Yang Date: Tue Oct 7 20:54:54 2014 -0700 Support for multiple signature files in scope. Summary: A common pattern when programming with signatures is to combine multiple signatures together (signature linking). We achieve this by making it not-an-error to have multiple, distinct interface files for the same module name, as long as they have the same backing implementation. When a user imports a module name, they get ALL matching signatures dumped into their scope. On the way, I refactored the module finder code, which now distinguishes between exact finds (when you had a 'Module') and regular finds (when you had a 'ModuleName'). I also refactored the package finder code to use a Monoid instance on LookupResult to collect together various results. ToDo: At the moment, if a signature is declared in the local package, it completely overrides any remote signatures. Eventually, we'll want to also pull in the remote signatures (or even override the local signature, if the full implementation is available.) There are bunch of ToDos in the code for what to do once this is done. ToDo: At the moment, whenever a module name lookup occurs in GHCi and we would have seen a signature, we instead continue and return the Module for the backing implementation. This is correct for most cases, but there might be some situations where we want something a little more fine-grained (e.g. :browse should only list identifiers which are available through the in-scope signatures, and not ALL of them.) Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, hvr, austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D790 GHC Trac Issues: #9252 >--------------------------------------------------------------- a7524eaed33324e2155c47d4a705bef1d70a2b5b compiler/deSugar/DsMonad.hs | 2 +- compiler/ghci/Linker.hs | 46 +++-- compiler/iface/LoadIface.hs | 18 +- compiler/iface/MkIface.hs | 18 +- compiler/main/DriverMkDepend.hs | 5 +- compiler/main/DynamicLoading.hs | 21 +- compiler/main/Finder.hs | 77 +++++--- compiler/main/GHC.hs | 30 ++- compiler/main/GhcMake.hs | 19 +- compiler/main/HscTypes.hs | 36 +++- compiler/main/Packages.hs | 212 ++++++++++++++------- docs/users_guide/separate_compilation.xml | 5 + ghc/Main.hs | 5 +- testsuite/.gitignore | 6 + testsuite/tests/cabal/sigcabal02/Main.hs | 7 + testsuite/tests/cabal/sigcabal02/Makefile | 34 ++++ .../tests/cabal/{cabal05 => sigcabal02}/Setup.hs | 0 testsuite/tests/cabal/sigcabal02/ShouldFail.hs | 1 + testsuite/tests/cabal/sigcabal02/all.T | 9 + .../tests/cabal/{cabal05 => sigcabal02}/p/LICENSE | 0 testsuite/tests/cabal/sigcabal02/p/Map.hsig | 18 ++ testsuite/tests/cabal/sigcabal02/p/P.hs | 12 ++ testsuite/tests/cabal/sigcabal02/p/Set.hsig | 13 ++ testsuite/tests/cabal/sigcabal02/p/p.cabal | 14 ++ .../cabal/{cabal05/p => sigcabal02/q}/LICENSE | 0 testsuite/tests/cabal/sigcabal02/q/Map.hsig | 7 + testsuite/tests/cabal/sigcabal02/q/Q.hs | 7 + testsuite/tests/cabal/sigcabal02/q/q.cabal | 13 ++ testsuite/tests/cabal/sigcabal02/sigcabal02.stderr | 4 + testsuite/tests/cabal/sigcabal02/sigcabal02.stdout | 5 + testsuite/tests/driver/recomp014/Makefile | 4 +- testsuite/tests/driver/recomp014/recomp014.stdout | 1 + testsuite/tests/driver/sigof01/Makefile | 6 + testsuite/tests/driver/sigof01/all.T | 10 + testsuite/tests/driver/sigof01/sigof01i.script | 1 + .../sigof01/{sigof01.stdout => sigof01i.stdout} | 0 testsuite/tests/driver/sigof01/sigof01i2.script | 3 + testsuite/tests/driver/sigof01/sigof01i2.stdout | 8 + testsuite/tests/package/package09e.stderr | 2 +- 39 files changed, 540 insertions(+), 139 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 a7524eaed33324e2155c47d4a705bef1d70a2b5b From git at git.haskell.org Tue Apr 7 18:58:54 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 18:58:54 +0000 (UTC) Subject: [commit: ghc] master: Commit missing T10148 files and ignore the built executable. (9e7802f) Message-ID: <20150407185854.660643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9e7802fc0c305b9b971000ddf69e717defc9d8b5/ghc >--------------------------------------------------------------- commit 9e7802fc0c305b9b971000ddf69e717defc9d8b5 Author: Edward Z. Yang Date: Tue Apr 7 11:59:09 2015 -0700 Commit missing T10148 files and ignore the built executable. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 9e7802fc0c305b9b971000ddf69e717defc9d8b5 testsuite/tests/stranal/should_run/.gitignore | 1 + testsuite/tests/stranal/should_run/T10148.stderr | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/testsuite/tests/stranal/should_run/.gitignore b/testsuite/tests/stranal/should_run/.gitignore new file mode 100644 index 0000000..b7834ad --- /dev/null +++ b/testsuite/tests/stranal/should_run/.gitignore @@ -0,0 +1 @@ +T10148 diff --git a/testsuite/tests/stranal/should_run/T10148.stderr b/testsuite/tests/stranal/should_run/T10148.stderr new file mode 100644 index 0000000..39ff4d1 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T10148.stderr @@ -0,0 +1,6 @@ +adj 99 +adj 99 +adj 99 +adj 99 +adj 99 +adj 99 From git at git.haskell.org Tue Apr 7 21:58:36 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 21:58:36 +0000 (UTC) Subject: [commit: ghc] master: Axe one-shot sig-of (1d5c887) Message-ID: <20150407215836.761F53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1d5c887ca0e6d1332c2655d73fab0dc72c53530d/ghc >--------------------------------------------------------------- commit 1d5c887ca0e6d1332c2655d73fab0dc72c53530d Author: Edward Z. Yang Date: Tue Dec 2 01:08:59 2014 -0800 Axe one-shot sig-of Summary: We're getting rid of -sig-of foo:A usage, because it doesn't make sense in any compilation mode besides one-shot, and we don't expect users to use it anyway. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D789 >--------------------------------------------------------------- 1d5c887ca0e6d1332c2655d73fab0dc72c53530d compiler/main/DynFlags.hs | 18 +++++------------- docs/users_guide/separate_compilation.xml | 10 +++++----- testsuite/tests/driver/recomp014/Makefile | 4 ++-- testsuite/tests/driver/sigof01/Makefile | 2 +- testsuite/tests/driver/sigof02/Makefile | 8 ++++---- testsuite/tests/driver/sigof03/Makefile | 4 ++-- testsuite/tests/driver/sigof04/Makefile | 2 +- testsuite/tests/typecheck/should_compile/all.T | 2 +- testsuite/tests/typecheck/should_fail/all.T | 8 ++++---- 9 files changed, 25 insertions(+), 33 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 1d5c887ca0e6d1332c2655d73fab0dc72c53530d From git at git.haskell.org Tue Apr 7 22:00:32 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Apr 2015 22:00:32 +0000 (UTC) Subject: [commit: ghc] master: Ignore temporary ./configure files. (3c6448c) Message-ID: <20150407220032.DA12E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3c6448c15381bfe5b14e5e72b9e3e331a5c2dbaa/ghc >--------------------------------------------------------------- commit 3c6448c15381bfe5b14e5e72b9e3e331a5c2dbaa Author: Edward Z. Yang Date: Tue Apr 7 13:44:51 2015 -0700 Ignore temporary ./configure files. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 3c6448c15381bfe5b14e5e72b9e3e331a5c2dbaa .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index a71cfd8..bb4a293 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,11 @@ config.log config.status configure +# Temporarily generated configure files +confdefs.h +conftest-book.xml +conftest.xml + # ----------------------------------------------------------------------------- # Ignore any overlapped darcs repos and back up files From git at git.haskell.org Wed Apr 8 08:44:22 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Apr 2015 08:44:22 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #8030 (53cc9af) Message-ID: <20150408084422.21C133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/53cc9af94122866aaae751f94f83ce7b940e5494/ghc >--------------------------------------------------------------- commit 53cc9af94122866aaae751f94f83ce7b940e5494 Author: Simon Peyton Jones Date: Wed Apr 8 09:43:20 2015 +0100 Test Trac #8030 >--------------------------------------------------------------- 53cc9af94122866aaae751f94f83ce7b940e5494 testsuite/tests/typecheck/should_fail/T8030.hs | 11 ++++++++++ testsuite/tests/typecheck/should_fail/T8030.stderr | 24 ++++++++++++++++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 3 files changed, 36 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T8030.hs b/testsuite/tests/typecheck/should_fail/T8030.hs new file mode 100644 index 0000000..970ae9b --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T8030.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE PolyKinds, FlexibleContexts, TypeFamilies #-} +module T8030 where + +-- The types of op1 and op2 are both ambiguous +-- and should be reported as such + +class C (a :: k) where + type Pr a :: * + op1 :: Pr a + op2 :: Pr a -> Pr a -> Pr a + diff --git a/testsuite/tests/typecheck/should_fail/T8030.stderr b/testsuite/tests/typecheck/should_fail/T8030.stderr new file mode 100644 index 0000000..8dd752e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T8030.stderr @@ -0,0 +1,24 @@ + +T8030.hs:9:3: + Couldn't match expected type ?Pr a? with actual type ?Pr a0? + NB: ?Pr? is a type function, and may not be injective + The type variable ?a0? is ambiguous + In the ambiguity check for the type signature for ?op1?: + op1 :: forall (k :: BOX) (a :: k). C a => Pr a + To defer the ambiguity check to use sites, enable AllowAmbiguousTypes + When checking the class method: + op1 :: forall (k :: BOX) (a :: k). C a => Pr a + In the class declaration for ?C? + +T8030.hs:10:3: + Couldn't match type ?Pr a0? with ?Pr a? + NB: ?Pr? is a type function, and may not be injective + The type variable ?a0? is ambiguous + Expected type: Pr a -> Pr a -> Pr a + Actual type: Pr a0 -> Pr a0 -> Pr a0 + In the ambiguity check for the type signature for ?op2?: + op2 :: forall (k :: BOX) (a :: k). C a => Pr a -> Pr a -> Pr a + To defer the ambiguity check to use sites, enable AllowAmbiguousTypes + When checking the class method: + op2 :: forall (k :: BOX) (a :: k). C a => Pr a -> Pr a -> Pr a + In the class declaration for ?C? diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 9b71388..5d31bcd 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -355,3 +355,4 @@ test('T4921', normal, compile_fail, ['']) test('T9605', normal, compile_fail, ['']) test('T9999', normal, compile_fail, ['']) test('T10194', normal, compile_fail, ['']) +test('T8030', normal, compile_fail, ['']) From git at git.haskell.org Wed Apr 8 18:39:13 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Apr 2015 18:39:13 +0000 (UTC) Subject: [commit: ghc] master: Fixes a compiler error with -DDEBUG (#10265) (6b96eeb) Message-ID: <20150408183913.A54F03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6b96eeb72a17e35c59830952732170d29d99a598/ghc >--------------------------------------------------------------- commit 6b96eeb72a17e35c59830952732170d29d99a598 Author: Dave Laing Date: Wed Apr 8 14:38:59 2015 -0400 Fixes a compiler error with -DDEBUG (#10265) Test Plan: validate Reviewers: austin, ezyang, erikd, rwbarton Reviewed By: ezyang, erikd, rwbarton Subscribers: erikd, thomie Differential Revision: https://phabricator.haskell.org/D821 GHC Trac Issues: #10265 >--------------------------------------------------------------- 6b96eeb72a17e35c59830952732170d29d99a598 compiler/main/Packages.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index a25e8e7..985a11a 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -1266,9 +1266,9 @@ instance Monoid LookupResult where l `mappend` LookupHidden{} = l LookupFound m1 `mappend` LookupFound m2 - = ASSERT (fst m1 /= fst m2) LookupMultiple [m1, m2] + = ASSERT(fst m1 /= fst m2) LookupMultiple [m1, m2] LookupFound m `mappend` LookupMultiple ms - = ASSERT (not (any ((==fst m).fst) ms)) LookupMultiple (m:ms) + = ASSERT(not (any ((==fst m).fst) ms)) LookupMultiple (m:ms) LookupFound m `mappend` LookupFoundSigs ms check | fst m == check = LookupFound m | otherwise = LookupMultiple (m:ms) @@ -1283,7 +1283,7 @@ instance Monoid LookupResult where = l2 `mappend` l1 LookupFoundSigs ms1 m1 `mappend` LookupFoundSigs ms2 m2 - = ASSERT (m1 /= m2) LookupMultiple (ms1 ++ ms2) + = ASSERT(m1 /= m2) LookupMultiple (ms1 ++ ms2) data ModuleSuggestion = SuggestVisible ModuleName Module ModuleOrigin | SuggestHidden ModuleName Module ModuleOrigin From git at git.haskell.org Thu Apr 9 15:31:26 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Apr 2015 15:31:26 +0000 (UTC) Subject: [commit: ghc] master: Import rand using capi (f536d89) Message-ID: <20150409153126.E58E13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f536d89603bb49dea192b47f54416dc88da980af/ghc >--------------------------------------------------------------- commit f536d89603bb49dea192b47f54416dc88da980af Author: Reid Barton Date: Thu Apr 9 11:31:20 2015 -0400 Import rand using capi Summary: Android has no rand symbol (it's a static inline function there). Test Plan: ghc-android builds Reviewers: trofi, austin, hvr Reviewed By: hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D826 GHC Trac Issues: #10274 >--------------------------------------------------------------- f536d89603bb49dea192b47f54416dc88da980af libraries/base/System/IO.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs index 52931fd..7b13552 100644 --- a/libraries/base/System/IO.hs +++ b/libraries/base/System/IO.hs @@ -1,5 +1,5 @@ {-# LANGUAGE Trustworthy #-} -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE CPP, NoImplicitPrelude, CApiFFI #-} ----------------------------------------------------------------------------- -- | @@ -509,7 +509,7 @@ openTempFile' loc tmp_dir template binary mode = findTempName | otherwise = a ++ [pathSeparator] ++ b -- int rand(void) from , limited by RAND_MAX (small value, 32768) -foreign import ccall "rand" c_rand :: IO CInt +foreign import capi "stdlib.h rand" c_rand :: IO CInt -- build large digit-alike number rand_string :: IO String From git at git.haskell.org Thu Apr 9 16:36:42 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Apr 2015 16:36:42 +0000 (UTC) Subject: [commit: ghc] master: Comments about AnyK (2d68aa6) Message-ID: <20150409163642.BF97F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2d68aa650b2c47e011aaa7e51227491c3f1e9866/ghc >--------------------------------------------------------------- commit 2d68aa650b2c47e011aaa7e51227491c3f1e9866 Author: Simon Peyton Jones Date: Thu Apr 9 15:02:08 2015 +0100 Comments about AnyK >--------------------------------------------------------------- 2d68aa650b2c47e011aaa7e51227491c3f1e9866 compiler/prelude/TysPrim.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index b1007e0..19c64ef 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -728,16 +728,20 @@ The type constructor Any of kind forall k. k has these properties: Note [Any kinds] ~~~~~~~~~~~~~~~~ - The type constructor AnyK (of sort BOX) is used internally only to zonk kind variables with no constraints on them. It appears in similar circumstances to Any, but at the kind level. For example: type family Length (l :: [k]) :: Nat - type instance Length [] = Zero -Length is kind-polymorphic, and when applied to the empty (promoted) list it -will have the kind Length AnyK []. + f :: Proxy (Length []) -> Int + f = .... + +Length is kind-polymorphic. So what is the elaborated type of f? + f :: Proxy (Length AnyK ([] AnyK)) -> Int + +Just like (length []) at the term level, which elaborates to + length (Any *) ([] (Any *)) Note [Strangely-kinded void TyCons] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Thu Apr 9 16:36:45 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Apr 2015 16:36:45 +0000 (UTC) Subject: [commit: ghc] master: Comments in rejigConRes (d9b0be3) Message-ID: <20150409163645.ADCE63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d9b0be3cb888a6342af7e4737dd034b68fe77543/ghc >--------------------------------------------------------------- commit d9b0be3cb888a6342af7e4737dd034b68fe77543 Author: Simon Peyton Jones Date: Thu Apr 9 15:02:34 2015 +0100 Comments in rejigConRes >--------------------------------------------------------------- d9b0be3cb888a6342af7e4737dd034b68fe77543 compiler/typecheck/TcTyClsDecls.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 9c9481f..2f9d336 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -1323,11 +1323,13 @@ rejigConRes tmpl_tvs res_ty dc_tvs ResTyH98 = (tmpl_tvs, dc_tvs, [], res_ty) -- In H98 syntax the dc_tvs are the existential ones -- data T a b c = forall d e. MkT ... - -- The {a,b,c} are tc_tvs, and {d,e} are dc_tvs + -- The universals {a,b,c} are tc_tvs, and the existentials {d,e} are dc_tvs rejigConRes tmpl_tvs res_tmpl dc_tvs (ResTyGADT _ res_ty) -- E.g. data T [a] b c where -- MkT :: forall x y z. T [(x,y)] z z + -- The {a,b,c} are the tmpl_tvs, and the {x,y,z} are the dc_tvs + -- (NB: unlike the H98 case, the dc_tvs are not all existential) -- Then we generate -- Univ tyvars Eq-spec -- a a~(x,y) @@ -1340,7 +1342,10 @@ rejigConRes tmpl_tvs res_tmpl dc_tvs (ResTyGADT _ res_ty) Just subst = tcMatchTy (mkVarSet tmpl_tvs) res_tmpl res_ty -- This 'Just' pattern is sure to match, because if not -- checkValidDataCon will complain first. - -- See Note [Checking GADT return types] + -- But care: this only works if the result of rejigConRes + -- is not demanded until checkValidDataCon has + -- first succeeded + -- See Note [Checking GADT return types] -- /Lazily/ figure out the univ_tvs etc -- Each univ_tv is either a dc_tv or a tmpl_tv From git at git.haskell.org Thu Apr 9 16:36:48 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Apr 2015 16:36:48 +0000 (UTC) Subject: [commit: ghc] master: Comments only (702fc77) Message-ID: <20150409163648.7CF093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/702fc77e20073941be26ccdaa7e75fed6655dbc3/ghc >--------------------------------------------------------------- commit 702fc77e20073941be26ccdaa7e75fed6655dbc3 Author: Simon Peyton Jones Date: Thu Apr 9 15:03:05 2015 +0100 Comments only >--------------------------------------------------------------- 702fc77e20073941be26ccdaa7e75fed6655dbc3 compiler/types/Coercion.hs | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 4be4e92..ef70884 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -470,26 +470,31 @@ which the coercion proves equality. The choice of this parameter affects the required roles of the arguments of the TyConAppCo. To help explain it, assume the following definition: -newtype Age = MkAge Int - -Nominal: All arguments must have role Nominal. Why? So that Foo Age ~N Foo Int -does *not* hold. - -Representational: All arguments must have the roles corresponding to the -result of tyConRoles on the TyCon. This is the whole point of having -roles on the TyCon to begin with. So, we can have Foo Age ~R Foo Int, -if Foo's parameter has role R. + type instance F Int = Bool -- Axiom axF : F Int ~N Bool + newtype Age = MkAge Int -- Axiom axAge : Age ~R Int + data Foo a = MkFoo a -- Role on Foo's parameter is Represntational -If a Representational TyConAppCo is over-saturated (which is otherwise fine), -the spill-over arguments must all be at Nominal. This corresponds to the -behavior for AppCo. +TyConAppCo Nominal Foo axF : Foo (F Int) ~N Foo Bool + For (TyConAppCo Nominal) all arguments must have role Nominal. Why? + So that Foo Age ~N Foo Int does *not* hold. -Phantom: All arguments must have role Phantom. This one isn't strictly -necessary for soundness, but this choice removes ambiguity. +TyConAppCo Representational Foo (SubCo axF) : Foo (F Int) ~R Foo Bool +TyConAppCo Representational Foo axAge : Foo Age ~R Foo Int + For (TyConAppCo Representational), all arguments must have the roles + corresponding to the result of tyConRoles on the TyCon. This is the + whole point of having roles on the TyCon to begin with. So, we can + have Foo Age ~R Foo Int, if Foo's parameter has role R. + If a Representational TyConAppCo is over-saturated (which is otherwise fine), + the spill-over arguments must all be at Nominal. This corresponds to the + behavior for AppCo. +TyConAppCo Phantom Foo (UnivCo Phantom Int Bool) : Foo Int ~P Foo Bool + All arguments must have role Phantom. This one isn't strictly + necessary for soundness, but this choice removes ambiguity. -The rules here also dictate what the parameters to mkTyConAppCo. +The rules here dictate the roles of the parameters to mkTyConAppCo +(should be checked by Lint). ************************************************************************ * * @@ -1079,7 +1084,10 @@ mkSubCo co = ASSERT2( coercionRole co == Nominal, ppr co <+> ppr (coercionRole c -- only *downgrades* a role. See Note [Role twiddling functions] downgradeRole_maybe :: Role -- desired role -> Role -- current role - -> Coercion -> Maybe Coercion + -> Coercion + -> Maybe Coercion +-- In (downgradeRole_maybe dr cr co) it's a precondition that +-- cr = coercionRole co downgradeRole_maybe Representational Nominal co = Just (mkSubCo co) downgradeRole_maybe Nominal Representational _ = Nothing downgradeRole_maybe Phantom Phantom co = Just co From git at git.haskell.org Thu Apr 9 16:36:51 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Apr 2015 16:36:51 +0000 (UTC) Subject: [commit: ghc] master: Make the evidence in a CtGiven into an EvId (fa46c59) Message-ID: <20150409163651.C84983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa46c597db9939de1de4bc9b917c8dc1d9e2093a/ghc >--------------------------------------------------------------- commit fa46c597db9939de1de4bc9b917c8dc1d9e2093a Author: Simon Peyton Jones Date: Thu Apr 9 17:36:41 2015 +0100 Make the evidence in a CtGiven into an EvId Note [Bind new Givens immediately] in TcRnTypes We were never using the generality. Result: less code, more efficient. Cake for everyone. >--------------------------------------------------------------- fa46c597db9939de1de4bc9b917c8dc1d9e2093a compiler/deSugar/DsBinds.hs | 14 ++++------- compiler/typecheck/TcCanonical.hs | 50 +++++++++++++-------------------------- compiler/typecheck/TcEvidence.hs | 30 +++++++++++------------ compiler/typecheck/TcHsSyn.hs | 9 +++---- compiler/typecheck/TcInstDcls.hs | 8 +++---- compiler/typecheck/TcInteract.hs | 12 ++++------ compiler/typecheck/TcMType.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 47 +++++++++++++++++++++++++----------- compiler/typecheck/TcSMonad.hs | 8 +++---- 9 files changed, 85 insertions(+), 95 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 fa46c597db9939de1de4bc9b917c8dc1d9e2093a From git at git.haskell.org Fri Apr 10 08:13:08 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Apr 2015 08:13:08 +0000 (UTC) Subject: [commit: ghc] master: Typos in error messages and in comments (9d16808) Message-ID: <20150410081308.CC02C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9d16808e1b6dd2fb7ab3eb5712d9842e77d57631/ghc >--------------------------------------------------------------- commit 9d16808e1b6dd2fb7ab3eb5712d9842e77d57631 Author: Gabor Greif Date: Fri Apr 10 10:00:50 2015 +0200 Typos in error messages and in comments >--------------------------------------------------------------- 9d16808e1b6dd2fb7ab3eb5712d9842e77d57631 compiler/basicTypes/DataCon.hs | 2 +- compiler/basicTypes/Demand.hs | 2 +- compiler/cmm/CmmLex.x | 2 +- compiler/cmm/CmmParse.y | 2 +- compiler/coreSyn/CoreSubst.hs | 10 +++++----- compiler/deSugar/DsExpr.hs | 2 +- compiler/iface/MkIface.hs | 2 +- compiler/parser/Parser.y | 2 +- compiler/simplCore/Simplify.hs | 2 +- compiler/specialise/SpecConstr.hs | 2 +- compiler/stranal/DmdAnal.hs | 2 +- compiler/typecheck/TcDeriv.hs | 2 +- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcPat.hs | 2 +- compiler/typecheck/TcSimplify.hs | 2 +- compiler/typecheck/TcSplice.hs | 2 +- compiler/typecheck/TcType.hs | 4 ++-- compiler/types/Coercion.hs | 2 +- compiler/utils/GraphOps.hs | 4 ++-- compiler/utils/Pretty.hs | 2 +- compiler/vectorise/Vectorise/Generic/PAMethods.hs | 2 +- compiler/vectorise/Vectorise/Utils/Base.hs | 2 +- docs/users_guide/debugging.xml | 2 +- docs/users_guide/glasgow_exts.xml | 2 +- includes/Rts.h | 2 +- rts/RetainerProfile.c | 2 +- rts/ghc.mk | 2 +- testsuite/tests/ffi/should_fail/ccfail004.stderr | 6 +++--- testsuite/tests/perf/compiler/all.T | 4 ++-- testsuite/tests/programs/galois_raytrace/Data.hs | 2 +- testsuite/tests/stranal/should_compile/newtype.hs | 2 +- testsuite/tests/typecheck/should_compile/tc202.hs | 2 +- utils/genprimopcode/Lexer.x | 2 +- utils/genprimopcode/Parser.y | 2 +- utils/hpc/HpcParser.y | 2 +- 35 files changed, 44 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 9d16808e1b6dd2fb7ab3eb5712d9842e77d57631 From git at git.haskell.org Fri Apr 10 20:46:13 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Apr 2015 20:46:13 +0000 (UTC) Subject: [commit: ghc] master: configure : LLVM and LD detections improvements (#10234). (485dba8) Message-ID: <20150410204613.EE7013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/485dba86d2519cc4855e01db279e127d0221f88a/ghc >--------------------------------------------------------------- commit 485dba86d2519cc4855e01db279e127d0221f88a Author: Erik de Castro Lopo Date: Wed Apr 8 15:11:38 2015 +1000 configure : LLVM and LD detections improvements (#10234). * distrib/configure.ac.in : Detect correct version of LLVM tools as was done for the top level configure.ac in 42448e3757. * aclocal.m4 : Add a FIND_LD macro that can be used in both configure scripts. * Use new FIND_LD macro in both configure scripts. Signed-off-by: Erik de Castro Lopo Test Plan: validate on amd64-linux and armhf-linux. Reviewers: rwbarton, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D828 GHC Trac Issues: #10234 >--------------------------------------------------------------- 485dba86d2519cc4855e01db279e127d0221f88a aclocal.m4 | 22 ++++++++++++++++++++++ configure.ac | 21 +++++---------------- distrib/configure.ac.in | 21 +++++++++++++++++++-- 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index c247f91..226e15a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2114,6 +2114,28 @@ AC_DEFUN([FIND_LLVM_PROG],[ fi ]) +# FIND_LD +# Find the version of `ld` to use. This is used in both in the top level +# configure.ac and in distrib/configure.ac.in. +# +# $1 = the variable to set +# +AC_DEFUN([FIND_LD],[ + FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) + case $target in + arm*linux*) + # Arm requires use of the binutils ld.gold linker. + # This case should catch at least arm-unknown-linux-gnueabihf and + # arm-linux-androideabi. + FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold]) + $1="$LD_GOLD" + ;; + *) + $1="$LD" + ;; + esac +]) + # FIND_GHC_BOOTSTRAP_PROG() # -------------------------------- # Parse the bootstrap GHC's compier settings file for the location of things diff --git a/configure.ac b/configure.ac index fc6b3c2..d5d9ab3 100644 --- a/configure.ac +++ b/configure.ac @@ -437,19 +437,7 @@ AC_SUBST([HaskellCPPArgs]) dnl ** Which ld to use? dnl -------------------------------------------------------------- -FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) -case $target in -arm*linux*) - # Arm requires use of the binutils ld.gold linker. - # This case should catch at least arm-unknown-linux-gnueabihf and - # arm-linux-androideabi. - FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold]) - LdCmd="$LD_GOLD" - ;; -*) - LdCmd="$LD" - ;; -esac +FIND_LD([LdCmd]) AC_SUBST([LdCmd]) dnl ** Which nm to use? @@ -487,17 +475,18 @@ esac # tools we are looking for. In the past, GHC supported a number of # versions of LLVM simultaneously, but that stopped working around # 3.5/3.6 release of LLVM. -llvm_version=3.6 +LlvmVersion=3.6 +AC_SUBST([LlvmVersion]) dnl ** Which LLVM llc to use? dnl -------------------------------------------------------------- -FIND_LLVM_PROG([LLC], [llc], [llc], [$llvm_version]) +FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion]) LlcCmd="$LLC" AC_SUBST([LlcCmd]) dnl ** Which LLVM opt to use? dnl -------------------------------------------------------------- -FIND_LLVM_PROG([OPT], [opt], [opt], [$llvm_version]) +FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion]) OptCmd="$OPT" AC_SUBST([OptCmd]) diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index ab5c299..0fcd869 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -68,10 +68,27 @@ FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs) AC_SUBST([HaskellCPPCmd]) AC_SUBST([HaskellCPPArgs]) +# Here is where we re-target which specific version of the LLVM +# tools we are looking for. In the past, GHC supported a number of +# versions of LLVM simultaneously, but that stopped working around +# 3.5/3.6 release of LLVM. +LlvmVersion=@LlvmVersion@ + +dnl ** Which LLVM llc to use? +dnl -------------------------------------------------------------- +FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion]) +LlcCmd="$LLC" +AC_SUBST([LlcCmd]) + +dnl ** Which LLVM opt to use? +dnl -------------------------------------------------------------- +FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion]) +OptCmd="$OPT" +AC_SUBST([OptCmd]) + dnl ** Which ld to use? dnl -------------------------------------------------------------- -FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) -LdCmd="$LD" +FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION From git at git.haskell.org Tue Apr 14 06:20:08 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 06:20:08 +0000 (UTC) Subject: [commit: ghc] master: Fix autoconf's check for create_timer() (edc059a) Message-ID: <20150414062008.5BBD63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/edc059a425068f9bf4a60520e8d8906bc764e2b5/ghc >--------------------------------------------------------------- commit edc059a425068f9bf4a60520e8d8906bc764e2b5 Author: Austin Seipp Date: Tue Apr 14 01:12:09 2015 -0500 Fix autoconf's check for create_timer() GHC build system have custom autoconf check for `create_timer()` function from librt. Check description says that it checks for `CLOCK_REALTIME` timer, but checking code also checks for `CLOCK_PROCESS_CPUTIME_ID` timer, which is not commonly present (for example, FreeBSD doesn't have it). This makes whole check fail despite the fact that FreeBSD have `create_timer()` call and supports `CLOCK_REALTIME`. As a consequence, GHC RTS falls back to using SIGALRM for its timing machinery. Not only it's very ancient codepath, it also break some FFI bindings to C code that isn't prepared for syscall interruption caused by SIGALRM delivery. Grepping through ghc source code reveals that `USE_TIMER_CREATE` defininition in the config.h doesn't imply having `CLOCK_PROCESS_CPUTIME_ID`. The only place where `CLOCK_PROCESS_CPUTIME_ID` is used is rts/posix/GetTime.c and this code handles the absence of `CLOCK_PROCESS_CPUTIME_ID` gracefully. This patch makes autoconf checking code to check only for `timer_create(CLOCK_REALTIME, ...)` and fixes check description. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D831 >--------------------------------------------------------------- edc059a425068f9bf4a60520e8d8906bc764e2b5 aclocal.m4 | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 226e15a..33a51ba 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1654,7 +1654,7 @@ then then # We can't test timer_create when we're cross-compiling, so we # optimistiaclly assume that it actually works properly. - AC_DEFINE([USE_TIMER_CREATE], 1, [Define to 1 if we can use timer_create(CLOCK_PROCESS_CPUTIME_ID,...)]) + AC_DEFINE([USE_TIMER_CREATE], 1, [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]) else AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], [fptools_cv_timer_create_works], @@ -1715,36 +1715,6 @@ int main(int argc, char *argv[]) } alarm(1); - if (timer_create(CLOCK_PROCESS_CPUTIME_ID, &ev, &timer) != 0) { - fprintf(stderr,"No CLOCK_PROCESS_CPUTIME_ID timer\n"); - exit(1); - } - - it.it_value.tv_sec = 0; - it.it_value.tv_nsec = 1; - it.it_interval = it.it_value; - if (timer_settime(timer, 0, &it, NULL) != 0) { - fprintf(stderr,"settime problem\n"); - exit(4); - } - - tock = 0; - - for(n = 3; n < 20000; n++){ - for(m = 2; m <= n/2; m++){ - if (!(n%m)) count++; - if (tock) goto out; - } - } -out: - - if (!tock) { - fprintf(stderr,"no CLOCK_PROCESS_CPUTIME_ID signal\n"); - exit(5); - } - - timer_delete(timer); - if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) { fprintf(stderr,"No CLOCK_REALTIME timer\n"); exit(2); @@ -1777,7 +1747,7 @@ out: ]) case $fptools_cv_timer_create_works in yes) AC_DEFINE([USE_TIMER_CREATE], 1, - [Define to 1 if we can use timer_create(CLOCK_PROCESS_CPUTIME_ID,...)]);; + [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; esac fi fi From git at git.haskell.org Tue Apr 14 06:20:11 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 06:20:11 +0000 (UTC) Subject: [commit: ghc] master: Derive Generic instance for System.Exit.ExitCode (a5745d2) Message-ID: <20150414062011.438443A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a5745d2b3112312a9e8c486142fb99b9d02e9827/ghc >--------------------------------------------------------------- commit a5745d2b3112312a9e8c486142fb99b9d02e9827 Author: Herbert Valerio Riedel Date: Tue Apr 14 01:12:22 2015 -0500 Derive Generic instance for System.Exit.ExitCode Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D830 >--------------------------------------------------------------- a5745d2b3112312a9e8c486142fb99b9d02e9827 libraries/base/GHC/IO/Exception.hs | 5 +++-- libraries/base/changelog.md | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/IO/Exception.hs b/libraries/base/GHC/IO/Exception.hs index b7e05b5..9cf78b3 100644 --- a/libraries/base/GHC/IO/Exception.hs +++ b/libraries/base/GHC/IO/Exception.hs @@ -1,5 +1,5 @@ {-# LANGUAGE Trustworthy #-} -{-# LANGUAGE NoImplicitPrelude, MagicHash, +{-# LANGUAGE DeriveGeneric, NoImplicitPrelude, MagicHash, ExistentialQuantification #-} {-# OPTIONS_GHC -funbox-strict-fields #-} {-# OPTIONS_HADDOCK hide #-} @@ -44,6 +44,7 @@ module GHC.IO.Exception ( ) where import GHC.Base +import GHC.Generics import GHC.List import GHC.IO import GHC.Show @@ -225,7 +226,7 @@ data ExitCode -- The exact interpretation of the code is -- operating-system dependent. In particular, some values -- may be prohibited (e.g. 0 on a POSIX-compliant system). - deriving (Eq, Ord, Read, Show) + deriving (Eq, Ord, Read, Show, Generic) instance Exception ExitCode diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index ea509af..56b9fae 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -31,6 +31,8 @@ * `Complex` now has a `Generic` instance + * `System.Exit.ExitCode` now has a `Generic` instance + ## 4.8.0.0 *Mar 2015* * Bundled with GHC 7.10.1 From git at git.haskell.org Tue Apr 14 06:20:14 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 06:20:14 +0000 (UTC) Subject: [commit: ghc] master: Derive Generic instance for Data.Version.Version (c327393) Message-ID: <20150414062014.3B1FC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c327393314a27ea77716c25b9cf56d45960f7876/ghc >--------------------------------------------------------------- commit c327393314a27ea77716c25b9cf56d45960f7876 Author: Herbert Valerio Riedel Date: Tue Apr 14 01:12:38 2015 -0500 Derive Generic instance for Data.Version.Version Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D827 >--------------------------------------------------------------- c327393314a27ea77716c25b9cf56d45960f7876 libraries/base/Data/Version.hs | 4 +++- libraries/base/changelog.md | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Version.hs b/libraries/base/Data/Version.hs index 20060c4..aba8cf7 100644 --- a/libraries/base/Data/Version.hs +++ b/libraries/base/Data/Version.hs @@ -1,4 +1,5 @@ {-# LANGUAGE Safe #-} +{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NoImplicitPrelude #-} ----------------------------------------------------------------------------- @@ -43,6 +44,7 @@ import Data.Int ( Int ) import Data.List import Data.Ord import Data.String ( String ) +import GHC.Generics import GHC.Read import GHC.Show import Text.ParserCombinators.ReadP @@ -91,7 +93,7 @@ data Version = -- The interpretation of the list of tags is entirely dependent -- on the entity that this version applies to. } - deriving (Read,Show) + deriving (Read,Show,Generic) {-# DEPRECATED versionTags "See GHC ticket #2496" #-} -- TODO. Remove all references to versionTags in GHC 7.12 release. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 56b9fae..5bf5418 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -33,6 +33,8 @@ * `System.Exit.ExitCode` now has a `Generic` instance + * `Data.Version.Version` now has a `Generic` instance + ## 4.8.0.0 *Mar 2015* * Bundled with GHC 7.10.1 From git at git.haskell.org Tue Apr 14 06:20:17 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 06:20:17 +0000 (UTC) Subject: [commit: ghc] master: use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir (6109b31) Message-ID: <20150414062017.573EF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6109b312cdd9dfe4bdad4030e0185dd67e6ec18d/ghc >--------------------------------------------------------------- commit 6109b312cdd9dfe4bdad4030e0185dd67e6ec18d Author: Luite Stegeman Date: Tue Apr 14 01:13:27 2015 -0500 use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir Reviewed By: edsko, austin Differential Revision: https://phabricator.haskell.org/D824 GHC Trac Issues: #10232 >--------------------------------------------------------------- 6109b312cdd9dfe4bdad4030e0185dd67e6ec18d compiler/main/DynFlags.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index bd20457..f3e3066 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1021,7 +1021,7 @@ opt_lc dflags = sOpt_lc (settings dflags) versionedAppDir :: DynFlags -> IO FilePath versionedAppDir dflags = do appdir <- getAppUserDataDirectory (programName dflags) - return $ appdir (TARGET_ARCH ++ '-':TARGET_OS ++ '-':cProjectVersion) + return $ appdir (TARGET_ARCH ++ '-':TARGET_OS ++ '-':projectVersion dflags) -- | The target code type of the compilation (if any). -- From git at git.haskell.org Tue Apr 14 06:20:20 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 06:20:20 +0000 (UTC) Subject: [commit: ghc] master: parser: opt_kind_sig has incorrect SrcSpan (8aefc9b) Message-ID: <20150414062020.4FB823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8aefc9b746512e91891879ad546e850e8a427d23/ghc >--------------------------------------------------------------- commit 8aefc9b746512e91891879ad546e850e8a427d23 Author: Alan Zimmerman Date: Tue Apr 14 01:16:48 2015 -0500 parser: opt_kind_sig has incorrect SrcSpan The production for opt_kind_sig is opt_kind_sig :: { Located (Maybe (LHsKind RdrName)) } : { noLoc Nothing } | '::' kind {% ajl (sLL $1 $> (Just $2)) AnnDcolon (gl $1) } The outer Location is used only to get the full span for the enclosing declration, and is then stripped. The inner LHsKind then has a SrcSpan that does not include the '::' Extend the SrcSpan on $2 to include $1 Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D813 GHC Trac Issues: #10209 >--------------------------------------------------------------- 8aefc9b746512e91891879ad546e850e8a427d23 compiler/hsSyn/HsDecls.hs | 7 ++-- compiler/hsSyn/HsTypes.hs | 3 ++ compiler/parser/Parser.y | 38 +++++++++++----------- .../tests/ghc-api/annotations/AnnotationTuple.hs | 5 ++- .../tests/ghc-api/annotations/exampleTest.stdout | 16 +++++++-- .../tests/ghc-api/annotations/parseTree.stdout | 14 ++++++-- 6 files changed, 56 insertions(+), 27 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 8aefc9b746512e91891879ad546e850e8a427d23 From git at git.haskell.org Tue Apr 14 06:20:23 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 06:20:23 +0000 (UTC) Subject: [commit: ghc] master: parser: API Annotations : guardquals1 does not annotate commas properly (9eab6fe) Message-ID: <20150414062023.60C463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9eab6feed44ad8beb6703d2e27ce47a8f79d0f49/ghc >--------------------------------------------------------------- commit 9eab6feed44ad8beb6703d2e27ce47a8f79d0f49 Author: Alan Zimmerman Date: Tue Apr 14 01:17:48 2015 -0500 parser: API Annotations : guardquals1 does not annotate commas properly The `guardquals1` production includes : guardquals1 ',' qual {% addAnnotation (gl $ last $ unLoc $1) AnnComma (gl $2) >> return (sLL $1 $> ($3 : unLoc $1)) } The AnnComma should be attached to `(gl $ head $ unLoc $1)`, rather than `last`. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D818 GHC Trac Issues: #10256 >--------------------------------------------------------------- 9eab6feed44ad8beb6703d2e27ce47a8f79d0f49 compiler/parser/Parser.y | 2 +- .../tests/ghc-api/annotations/AnnotationTuple.hs | 8 +- .../tests/ghc-api/annotations/exampleTest.stdout | 138 ++++++++++-------- .../tests/ghc-api/annotations/parseTree.stdout | 158 ++++++++++++--------- 4 files changed, 174 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 9eab6feed44ad8beb6703d2e27ce47a8f79d0f49 From git at git.haskell.org Tue Apr 14 06:20:26 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 06:20:26 +0000 (UTC) Subject: [commit: ghc] master: parser : the API annotation on opt_sig is being discarded (919b511) Message-ID: <20150414062026.291EC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/919b51174163907d2bc3bb41aadf56aa8bb42e9b/ghc >--------------------------------------------------------------- commit 919b51174163907d2bc3bb41aadf56aa8bb42e9b Author: Alan Zimmerman Date: Tue Apr 14 01:17:58 2015 -0500 parser : the API annotation on opt_sig is being discarded The opt_sig production is defined as opt_sig :: { ([AddAnn],Maybe (LHsType RdrName)) } : {- empty -} { ([],Nothing) } | '::' sigtype { ([mj AnnDcolon $1],Just $2) } It is used in the alt and decl_no_th productions, but neither of them add the returned annotations. This commit captures the annotations in the calling productions. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D822 GHC Trac Issues: #10254 >--------------------------------------------------------------- 919b51174163907d2bc3bb41aadf56aa8bb42e9b compiler/parser/Parser.y | 6 +++--- testsuite/tests/ghc-api/annotations/AnnotationTuple.hs | 4 +++- testsuite/tests/ghc-api/annotations/exampleTest.stdout | 12 +++++++++--- testsuite/tests/ghc-api/annotations/parseTree.stdout | 10 ++++++++-- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 3a879ba..48bc637 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -1999,9 +1999,9 @@ decl_no_th :: { Located (OrdList (LHsDecl RdrName)) } let { l = comb2 $1 $> }; case r of { (FunBind n _ _ _ _ _) -> - ams (L l ()) [mj AnnFunId n] >> return () ; + ams (L l ()) (mj AnnFunId n:(fst $2)) >> return () ; _ -> return () } ; - _ <- ams (L l ()) (fst $ unLoc $3); + _ <- ams (L l ()) ((fst $2) ++ (fst $ unLoc $3)); return $! (sL l (unitOL $! (sL l $ ValD r))) } } | pattern_synonym_decl { sLL $1 $> $ unitOL $1 } | docdecl { sLL $1 $> $ unitOL $1 } @@ -2573,7 +2573,7 @@ alts1 :: { Located ([AddAnn],[LMatch RdrName (LHsExpr RdrName)]) } alt :: { LMatch RdrName (LHsExpr RdrName) } : pat opt_sig alt_rhs {%ams (sLL $1 $> (Match Nothing [$1] (snd $2) (snd $ unLoc $3))) - (fst $ unLoc $3)} + ((fst $2) ++ (fst $ unLoc $3))} alt_rhs :: { Located ([AddAnn],GRHSs RdrName (LHsExpr RdrName)) } : ralt wherebinds { sLL $1 $> (fst $ unLoc $2, diff --git a/testsuite/tests/ghc-api/annotations/AnnotationTuple.hs b/testsuite/tests/ghc-api/annotations/AnnotationTuple.hs index 5df7cf7..73015a6 100644 --- a/testsuite/tests/ghc-api/annotations/AnnotationTuple.hs +++ b/testsuite/tests/ghc-api/annotations/AnnotationTuple.hs @@ -1,5 +1,5 @@ {-# LANGUAGE TupleSections,TypeFamilies #-} -{-# LANGUAGE PatternGuards #-} +{-# LANGUAGE PatternGuards,ScopedTypeVariables #-} module AnnotationTuple (foo) where { @@ -22,6 +22,8 @@ match n , Just 6 <- Nothing , Just 7 <- Just 9 = Just 8 +; +boo :: Int = 3 } -- Note: the trailing whitespace in this file is used to check that we -- have an annotation for it. diff --git a/testsuite/tests/ghc-api/annotations/exampleTest.stdout b/testsuite/tests/ghc-api/annotations/exampleTest.stdout index 1c3eed5..128b70a 100644 --- a/testsuite/tests/ghc-api/annotations/exampleTest.stdout +++ b/testsuite/tests/ghc-api/annotations/exampleTest.stdout @@ -2,12 +2,12 @@ [ (AK AnnotationTuple.hs:14:39 AnnComma = [AnnotationTuple.hs:14:39]) -(AK AnnEofPos = [AnnotationTuple.hs:30:1]) +(AK AnnEofPos = [AnnotationTuple.hs:32:1]) ] -------------------------------- [ -(AK AnnotationTuple.hs:1:1 AnnCloseC = [AnnotationTuple.hs:25:1]) +(AK AnnotationTuple.hs:1:1 AnnCloseC = [AnnotationTuple.hs:27:1]) (AK AnnotationTuple.hs:1:1 AnnModule = [AnnotationTuple.hs:3:1-6]) @@ -133,6 +133,8 @@ (AK AnnotationTuple.hs:(20,1)-(24,14) AnnFunId = [AnnotationTuple.hs:20:1-5]) +(AK AnnotationTuple.hs:(20,1)-(24,14) AnnSemi = [AnnotationTuple.hs:25:1]) + (AK AnnotationTuple.hs:(21,7)-(24,14) AnnEqual = [AnnotationTuple.hs:24:7]) (AK AnnotationTuple.hs:(21,7)-(24,14) AnnVbar = [AnnotationTuple.hs:21:7]) @@ -147,6 +149,10 @@ (AK AnnotationTuple.hs:23:9-24 AnnLarrow = [AnnotationTuple.hs:23:16-17]) -(AK AnnEofPos = [AnnotationTuple.hs:30:1]) +(AK AnnotationTuple.hs:26:1-14 AnnDcolon = [AnnotationTuple.hs:26:5-6]) + +(AK AnnotationTuple.hs:26:1-14 AnnEqual = [AnnotationTuple.hs:26:12]) + +(AK AnnEofPos = [AnnotationTuple.hs:32:1]) ] diff --git a/testsuite/tests/ghc-api/annotations/parseTree.stdout b/testsuite/tests/ghc-api/annotations/parseTree.stdout index 90f9d8c..9965fd2 100644 --- a/testsuite/tests/ghc-api/annotations/parseTree.stdout +++ b/testsuite/tests/ghc-api/annotations/parseTree.stdout @@ -11,7 +11,7 @@ (AnnotationTuple.hs:16:25, [m], ()), (AnnotationTuple.hs:16:26, [m], ())] [ -(AK AnnotationTuple.hs:1:1 AnnCloseC = [AnnotationTuple.hs:25:1]) +(AK AnnotationTuple.hs:1:1 AnnCloseC = [AnnotationTuple.hs:27:1]) (AK AnnotationTuple.hs:1:1 AnnModule = [AnnotationTuple.hs:3:1-6]) @@ -137,6 +137,8 @@ (AK AnnotationTuple.hs:(20,1)-(24,14) AnnFunId = [AnnotationTuple.hs:20:1-5]) +(AK AnnotationTuple.hs:(20,1)-(24,14) AnnSemi = [AnnotationTuple.hs:25:1]) + (AK AnnotationTuple.hs:(21,7)-(24,14) AnnEqual = [AnnotationTuple.hs:24:7]) (AK AnnotationTuple.hs:(21,7)-(24,14) AnnVbar = [AnnotationTuple.hs:21:7]) @@ -151,6 +153,10 @@ (AK AnnotationTuple.hs:23:9-24 AnnLarrow = [AnnotationTuple.hs:23:16-17]) -(AK AnnEofPos = [AnnotationTuple.hs:30:1]) +(AK AnnotationTuple.hs:26:1-14 AnnDcolon = [AnnotationTuple.hs:26:5-6]) + +(AK AnnotationTuple.hs:26:1-14 AnnEqual = [AnnotationTuple.hs:26:12]) + +(AK AnnEofPos = [AnnotationTuple.hs:32:1]) ] From git at git.haskell.org Tue Apr 14 12:13:42 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:13:42 +0000 (UTC) Subject: [commit: ghc] master: Zap usage info in CSE (Trac #10218) (d261d4c) Message-ID: <20150414121342.B78643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d261d4cbcc867405f71d7c9580628f52978e2267/ghc >--------------------------------------------------------------- commit d261d4cbcc867405f71d7c9580628f52978e2267 Author: Simon Peyton Jones Date: Tue Apr 14 09:20:42 2015 +0100 Zap usage info in CSE (Trac #10218) Trac #10218 reports a subtle bug that turned out to be: - CSE invalidated the usage information computed by earlier demand analysis, by increasing sharing - that made a single-entry thunk into a multi-entry thunk - and with -feager-blackholing, that led to <> The patch fixes it by making the CSE pass zap usage information for let-bound identifiers. It can be restored by -flate-dmd-anal. (But making -flate-dmd-anal the default needs some careful work; see Trac #7782.) >--------------------------------------------------------------- d261d4cbcc867405f71d7c9580628f52978e2267 compiler/basicTypes/Demand.hs | 33 +++++++++++++------- compiler/basicTypes/Id.hs | 10 +++++-- compiler/basicTypes/IdInfo.hs | 8 +++-- compiler/simplCore/CSE.hs | 35 ++++++++++++++-------- compiler/simplCore/SetLevels.hs | 2 +- compiler/stranal/DmdAnal.hs | 4 +-- .../tests/simplCore/should_compile/EvalTest.hs | 2 +- testsuite/tests/stranal/should_run/T10218.hs | 18 +++++++++++ .../should_run/T10218.stdout} | 1 - testsuite/tests/stranal/should_run/all.T | 1 + 10 files changed, 82 insertions(+), 32 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 d261d4cbcc867405f71d7c9580628f52978e2267 From git at git.haskell.org Tue Apr 14 12:13:45 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:13:45 +0000 (UTC) Subject: [commit: ghc] master: Comments only (25f2d68) Message-ID: <20150414121345.91AE73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/25f2d68849288a57ae4c6ce492f9e0bdd6df83bb/ghc >--------------------------------------------------------------- commit 25f2d68849288a57ae4c6ce492f9e0bdd6df83bb Author: Simon Peyton Jones Date: Tue Apr 14 09:21:00 2015 +0100 Comments only >--------------------------------------------------------------- 25f2d68849288a57ae4c6ce492f9e0bdd6df83bb compiler/hsSyn/HsTypes.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/hsSyn/HsTypes.hs b/compiler/hsSyn/HsTypes.hs index 8c7a524..ebd3bd4 100644 --- a/compiler/hsSyn/HsTypes.hs +++ b/compiler/hsSyn/HsTypes.hs @@ -417,7 +417,7 @@ After renaming Qualified currently behaves exactly as Implicit, but it is deprecated to use it for implicit quantification. In this case, GHC 7.10 gives a warning; see -Note [Context quantification] and Trac #4426. +Note [Context quantification] in RnTypes, and Trac #4426. In GHC 7.12, Qualified will no longer bind variables and this will become an error. @@ -506,7 +506,12 @@ data HsTupleSort = HsUnboxedTuple | HsBoxedOrConstraintTuple deriving (Data, Typeable) -data HsExplicitFlag = Qualified | Implicit | Explicit deriving (Data, Typeable) +data HsExplicitFlag + = Explicit -- An explicit forall, eg f :: forall a. a-> a + | Implicit -- No explicit forall, eg f :: a -> a, or f :: Eq a => a -> a + | Qualified -- A *nested* occurrences of (ctxt => ty), with no explicit forall + -- e.g. f :: (Eq a => a -> a) -> Int + deriving (Data, Typeable) type LConDeclField name = Located (ConDeclField name) -- ^ May have 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnComma' when @@ -571,6 +576,8 @@ Qualified `plus` Qualified = Qualified Explicit `plus` _ = Explicit _ `plus` Explicit = Explicit _ `plus` _ = Implicit + -- NB: Implicit `plus` Qualified = Implicit + -- so that f :: Eq a => a -> a ends up Implicit hsExplicitTvs :: LHsType Name -> [Name] -- The explicitly-given forall'd type variables of a HsType From git at git.haskell.org Tue Apr 14 12:13:48 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:13:48 +0000 (UTC) Subject: [commit: ghc] master: Comments and white space only (a2ce3af) Message-ID: <20150414121348.754633A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a2ce3afaeb5c32556760b9b5185778a4062ba998/ghc >--------------------------------------------------------------- commit a2ce3afaeb5c32556760b9b5185778a4062ba998 Author: Simon Peyton Jones Date: Tue Apr 14 09:21:27 2015 +0100 Comments and white space only >--------------------------------------------------------------- a2ce3afaeb5c32556760b9b5185778a4062ba998 compiler/typecheck/TcFlatten.hs | 0 compiler/typecheck/TcRules.hs | 8 ++++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcRules.hs b/compiler/typecheck/TcRules.hs index 1684118..084e5de 100644 --- a/compiler/typecheck/TcRules.hs +++ b/compiler/typecheck/TcRules.hs @@ -227,11 +227,15 @@ revert to SimplCheck when going under an implication. ------------------------ So the plan is this ----------------------- +* Step 0: typecheck the LHS and RHS to get constraints from each + * Step 1: Simplify the LHS and RHS constraints all together in one bag We do this to discover all unification equalities -* Step 2: Zonk the ORIGINAL lhs constraints, and partition them into - the ones we will quantify over, and the others +* Step 2: Zonk the ORIGINAL (unsimplified) lhs constraints, to take + advantage of those unifications, and partition them into the + ones we will quantify over, and the others + See Note [RULE quantification over equalities] * Step 3: Decide on the type variables to quantify over From git at git.haskell.org Tue Apr 14 12:33:22 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:33:22 +0000 (UTC) Subject: [commit: ghc] master: Add "error:" prefix to error-messages (7febc2b) Message-ID: <20150414123322.888543A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7febc2bb86b238713cfb9f52dff32039464dfe66/ghc >--------------------------------------------------------------- commit 7febc2bb86b238713cfb9f52dff32039464dfe66 Author: Konstantine Rybnikov Date: Tue Apr 14 01:38:54 2015 -0500 Add "error:" prefix to error-messages Add "error:" prefix to error-messages, also lowercase "Warning:" message to match GCC behavior closer. Reviewed By: thomie, austin Differential Revision: https://phabricator.haskell.org/D811 GHC Trac Issues: #10021 >--------------------------------------------------------------- 7febc2bb86b238713cfb9f52dff32039464dfe66 compiler/main/ErrUtils.hs | 15 +++++++-------- testsuite/driver/testlib.py | 12 ++++++++++++ testsuite/tests/safeHaskell/ghci/p4.stderr | 7 ++++--- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs index 5762a57..d42db57 100644 --- a/compiler/main/ErrUtils.hs +++ b/compiler/main/ErrUtils.hs @@ -111,10 +111,6 @@ data Severity | SevError | SevFatal -isWarning :: Severity -> Bool -isWarning SevWarning = True -isWarning _ = False - instance Show ErrMsg where show em = errMsgShortString em @@ -132,10 +128,13 @@ mkLocMessage severity locn msg else ppr (srcSpanStart locn) in hang (locn' <> colon <+> sev_info) 4 msg where - sev_info = ppWhen (isWarning severity) - (ptext (sLit "Warning:")) - -- For warnings, print Foo.hs:34: Warning: - -- + -- Add prefixes, like Foo.hs:34: warning: + -- + sev_info = case severity of + SevWarning -> ptext (sLit "warning:") + SevError -> ptext (sLit "error:") + SevFatal -> ptext (sLit "fatal:") + _ -> empty makeIntoWarning :: ErrMsg -> ErrMsg makeIntoWarning err = err { errMsgSeverity = SevWarning } diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 430779b..4e877f5 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1689,6 +1689,11 @@ def normalise_whitespace( str ): return str def normalise_errmsg( str ): + # remove " error:" and lower-case " Warning:" to make patch for + # trac issue #10021 smaller + str = modify_lines(str, lambda l: re.sub(' error:', '', l)) + str = modify_lines(str, lambda l: re.sub(' Warning:', ' warning:', l)) + # If somefile ends in ".exe" or ".exe:", zap ".exe" (for Windows) # the colon is there because it appears in error messages; this # hacky solution is used in place of more sophisticated filename @@ -1744,6 +1749,10 @@ def normalise_exe_( str ): return str def normalise_output( str ): + # remove " error:" and lower-case " Warning:" to make patch for + # trac issue #10021 smaller + str = modify_lines(str, lambda l: re.sub(' error:', '', l)) + str = modify_lines(str, lambda l: re.sub(' Warning:', ' warning:', l)) # Remove a .exe extension (for Windows) # This can occur in error messages generated by the program. str = re.sub('([^\\s])\\.exe', '\\1', str) @@ -2291,3 +2300,6 @@ def getStdout(cmd_and_args): return stdout else: raise Exception("Need subprocess to get stdout, but don't have it") + +def modify_lines(s, f): + return '\n'.join([f(l) for l in s.splitlines()]) diff --git a/testsuite/tests/safeHaskell/ghci/p4.stderr b/testsuite/tests/safeHaskell/ghci/p4.stderr index c7eb607..961e1fd 100644 --- a/testsuite/tests/safeHaskell/ghci/p4.stderr +++ b/testsuite/tests/safeHaskell/ghci/p4.stderr @@ -1,6 +1,7 @@ -:6:9: Not in scope: ?System.IO.Unsafe.unsafePerformIO? +:6:9: error: + Not in scope: ?System.IO.Unsafe.unsafePerformIO? -:7:9: Not in scope: ?x? +:7:9: error: Not in scope: ?x? -:8:1: Not in scope: ?y? +:8:1: error: Not in scope: ?y? From git at git.haskell.org Tue Apr 14 12:33:25 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:33:25 +0000 (UTC) Subject: [commit: ghc] master: Remove LlvmCodeGen panic variants. (79bfe27) Message-ID: <20150414123325.7B0993A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/79bfe27d9157fb3d44b4cc64f168bc11191d3f9b/ghc >--------------------------------------------------------------- commit 79bfe27d9157fb3d44b4cc64f168bc11191d3f9b Author: Edward Z. Yang Date: Tue Apr 14 07:32:17 2015 -0500 Remove LlvmCodeGen panic variants. It's pretty irritating having hasktags with multiple top-level declarations with the same type; hasktags can't figure out which declaration you actually wanted. Signed-off-by: Edward Z. Yang Reviewed By: dterei, austin Differential Revision: https://phabricator.haskell.org/D819 >--------------------------------------------------------------- 79bfe27d9157fb3d44b4cc64f168bc11191d3f9b compiler/llvmGen/LlvmCodeGen/Base.hs | 10 +--------- compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 11 +---------- compiler/llvmGen/LlvmCodeGen/Data.hs | 10 +--------- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs index 15918a3..5ef0a4b 100644 --- a/compiler/llvmGen/LlvmCodeGen/Base.hs +++ b/compiler/llvmGen/LlvmCodeGen/Base.hs @@ -45,7 +45,7 @@ import CodeGen.Platform ( activeStgRegs ) import DynFlags import FastString import Cmm -import qualified Outputable as Outp +import Outputable as Outp import qualified Pretty as Prt import Platform import UniqFM @@ -538,11 +538,3 @@ aliasify (LMGlobal var val) = do -- away with casting the alias to the desired type in @getSymbolPtr@ -- and instead just emit a reference to the definition symbol directly. -- This is the @Just@ case in @getSymbolPtr at . - --- ---------------------------------------------------------------------------- --- * Misc --- - --- | Error function -panic :: String -> a -panic s = Outp.panic $ "LlvmCodeGen.Base." ++ s diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs index 4f864b6..3a7c05b 100644 --- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs @@ -24,8 +24,7 @@ import Hoopl import DynFlags import FastString import ForeignCall -import Outputable hiding ( panic, pprPanic ) -import qualified Outputable +import Outputable import Platform import OrdList import UniqSupply @@ -1673,14 +1672,6 @@ toIWord :: Integral a => DynFlags -> a -> LlvmVar toIWord dflags = mkIntLit (llvmWord dflags) --- | Error functions -panic :: String -> a -panic s = Outputable.panic $ "LlvmCodeGen.CodeGen." ++ s - -pprPanic :: String -> SDoc -> a -pprPanic s d = Outputable.pprPanic ("LlvmCodeGen.CodeGen." ++ s) d - - -- | Returns TBAA meta data by unique getTBAAMeta :: Unique -> LlvmM [MetaAnnot] getTBAAMeta u = do diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs index 42f4dcd..b306748 100644 --- a/compiler/llvmGen/LlvmCodeGen/Data.hs +++ b/compiler/llvmGen/LlvmCodeGen/Data.hs @@ -17,7 +17,7 @@ import CLabel import Cmm import FastString -import qualified Outputable +import Outputable -- ---------------------------------------------------------------------------- -- * Constants @@ -127,11 +127,3 @@ genStaticLit (CmmBlock b) = genStaticLit $ CmmLabel $ infoTblLbl b genStaticLit (CmmHighStackMark) = panic "genStaticLit: CmmHighStackMark unsupported!" - --- ----------------------------------------------------------------------------- --- * Misc --- - --- | Error Function -panic :: String -> a -panic s = Outputable.panic $ "LlvmCodeGen.Data." ++ s From git at git.haskell.org Tue Apr 14 12:33:29 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:33:29 +0000 (UTC) Subject: [commit: ghc] master: API Annotations : ExprWithTySig processing discards annotated spans (8dc2944) Message-ID: <20150414123329.73DCD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8dc294487fdaf102349c373c7db4796693573310/ghc >--------------------------------------------------------------- commit 8dc294487fdaf102349c373c7db4796693573310 Author: Alan Zimmerman Date: Tue Apr 14 07:32:40 2015 -0500 API Annotations : ExprWithTySig processing discards annotated spans In RdrHsSyn.checkAPat the processing for ExprWithTySig is defined as ExprWithTySig e t _ -> do e <- checkLPat msg e -- Pattern signatures are parsed as sigtypes, -- but they aren't explicit forall points. Hence -- we have to remove the implicit forall here. let t' = case t of L _ (HsForAllTy Implicit _ _ (L _ []) ty) -> ty other -> other return (SigPatIn e (mkHsWithBndrs t')) The t' variable ends up losing its original SrcSpan in the first case branch. This results in annotations becoming detached from the AST. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D823 GHC Trac Issues: #10255 >--------------------------------------------------------------- 8dc294487fdaf102349c373c7db4796693573310 compiler/parser/RdrHsSyn.hs | 3 +- testsuite/tests/ghc-api/annotations/.gitignore | 1 + testsuite/tests/ghc-api/annotations/Makefile | 7 ++++- testsuite/tests/ghc-api/annotations/T10255.stderr | 3 ++ testsuite/tests/ghc-api/annotations/T10255.stdout | 36 ++++++++++++++++++++++ testsuite/tests/ghc-api/annotations/Test10255.hs | 7 +++++ testsuite/tests/ghc-api/annotations/all.T | 1 + .../annotations/{exampleTest.hs => t10255.hs} | 8 +---- 8 files changed, 57 insertions(+), 9 deletions(-) diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index 6bf8bc3..06c6564 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -847,7 +847,8 @@ checkAPat msg loc e0 = do L _ (HsForAllTy Implicit _ _ (L _ []) ty) -> ty other -> other - return (SigPatIn e (mkHsWithBndrs t')) + return (SigPatIn e (mkHsWithBndrs + (L (getLoc t) (HsParTy t')))) -- n+k patterns OpApp (L nloc (HsVar n)) (L _ (HsVar plus)) _ diff --git a/testsuite/tests/ghc-api/annotations/.gitignore b/testsuite/tests/ghc-api/annotations/.gitignore index ba31dbb..d142368 100644 --- a/testsuite/tests/ghc-api/annotations/.gitignore +++ b/testsuite/tests/ghc-api/annotations/.gitignore @@ -3,6 +3,7 @@ parseTree comments exampleTest listcomps +t10255 *.hi *.o *.run.* diff --git a/testsuite/tests/ghc-api/annotations/Makefile b/testsuite/tests/ghc-api/annotations/Makefile index 383fb26..08a6d49 100644 --- a/testsuite/tests/ghc-api/annotations/Makefile +++ b/testsuite/tests/ghc-api/annotations/Makefile @@ -31,4 +31,9 @@ listcomps: '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc listcomps ./listcomps "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" -.PHONY: clean annotations parseTree comments exampleTest listcomps +t10255: + rm -f t10255.o t10255.hi + '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc t10255 + ./t10255 "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" + +.PHONY: clean annotations parseTree comments exampleTest listcomps t10255 diff --git a/testsuite/tests/ghc-api/annotations/T10255.stderr b/testsuite/tests/ghc-api/annotations/T10255.stderr new file mode 100644 index 0000000..be1a915 --- /dev/null +++ b/testsuite/tests/ghc-api/annotations/T10255.stderr @@ -0,0 +1,3 @@ + +Test10255.hs:1:14: Warning: + -XPatternSignatures is deprecated: use -XScopedTypeVariables or pragma {-# LANGUAGE ScopedTypeVariables #-} instead diff --git a/testsuite/tests/ghc-api/annotations/T10255.stdout b/testsuite/tests/ghc-api/annotations/T10255.stdout new file mode 100644 index 0000000..099ef54 --- /dev/null +++ b/testsuite/tests/ghc-api/annotations/T10255.stdout @@ -0,0 +1,36 @@ +---Problems--------------------- +[ +(AK AnnEofPos = [Test10255.hs:8:1]) +] + +-------------------------------- +[ +(AK Test10255.hs:1:1 AnnModule = [Test10255.hs:2:1-6]) + +(AK Test10255.hs:1:1 AnnWhere = [Test10255.hs:2:18-22]) + +(AK Test10255.hs:4:1-17 AnnImport = [Test10255.hs:4:1-6]) + +(AK Test10255.hs:4:1-17 AnnSemi = [Test10255.hs:6:1]) + +(AK Test10255.hs:(6,1)-(7,11) AnnEqual = [Test10255.hs:6:29]) + +(AK Test10255.hs:(6,1)-(7,11) AnnFunId = [Test10255.hs:6:1-3]) + +(AK Test10255.hs:(6,1)-(7,11) AnnSemi = [Test10255.hs:8:1]) + +(AK Test10255.hs:6:5-27 AnnCloseP = [Test10255.hs:6:27]) + +(AK Test10255.hs:6:5-27 AnnOpenP = [Test10255.hs:6:5]) + +(AK Test10255.hs:6:6-26 AnnDcolon = [Test10255.hs:6:8-9]) + +(AK Test10255.hs:6:11-26 AnnCloseP = [Test10255.hs:6:26]) + +(AK Test10255.hs:6:11-26 AnnOpenP = [Test10255.hs:6:11]) + +(AK Test10255.hs:6:12-25 AnnRarrow = [Test10255.hs:6:20-21]) + +(AK AnnEofPos = [Test10255.hs:8:1]) +] + diff --git a/testsuite/tests/ghc-api/annotations/Test10255.hs b/testsuite/tests/ghc-api/annotations/Test10255.hs new file mode 100644 index 0000000..386452d --- /dev/null +++ b/testsuite/tests/ghc-api/annotations/Test10255.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE PatternSignatures #-} +module Test10255 where + +import Data.Maybe + +fob (f :: (Maybe t -> Int)) = + undefined diff --git a/testsuite/tests/ghc-api/annotations/all.T b/testsuite/tests/ghc-api/annotations/all.T index 9dadf7a..ed888a3 100644 --- a/testsuite/tests/ghc-api/annotations/all.T +++ b/testsuite/tests/ghc-api/annotations/all.T @@ -3,3 +3,4 @@ test('parseTree', normal, run_command, ['$MAKE -s --no-print-directory parseTr test('comments', normal, run_command, ['$MAKE -s --no-print-directory comments']) test('exampleTest', normal, run_command, ['$MAKE -s --no-print-directory exampleTest']) test('listcomps', normal, run_command, ['$MAKE -s --no-print-directory listcomps']) +test('T10255', normal, run_command, ['$MAKE -s --no-print-directory t10255']) diff --git a/testsuite/tests/ghc-api/annotations/exampleTest.hs b/testsuite/tests/ghc-api/annotations/t10255.hs similarity index 91% copy from testsuite/tests/ghc-api/annotations/exampleTest.hs copy to testsuite/tests/ghc-api/annotations/t10255.hs index 0b6c224..49c68e2 100644 --- a/testsuite/tests/ghc-api/annotations/exampleTest.hs +++ b/testsuite/tests/ghc-api/annotations/t10255.hs @@ -24,7 +24,7 @@ import Data.Dynamic ( fromDynamic,Dynamic ) main::IO() main = do [libdir] <- getArgs - testOneFile libdir "AnnotationTuple" + testOneFile libdir "Test10255" testOneFile libdir fileName = do ((anns,cs),p) <- runGhc (Just libdir) $ do @@ -37,16 +37,10 @@ testOneFile libdir fileName = do load LoadAllTargets modSum <- getModSummary mn p <- parseModule modSum - t <- typecheckModule p - d <- desugarModule t - l <- loadModule d - let ts=typecheckedSource l - r =renamedSource l return (pm_annotations p,p) let spans = Set.fromList $ getAllSrcSpans (pm_parsed_source p) - -- putStrLn (pp spans) problems = filter (\(s,a) -> not (Set.member s spans)) $ getAnnSrcSpans (anns,cs) putStrLn "---Problems---------------------" From git at git.haskell.org Tue Apr 14 12:33:32 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:33:32 +0000 (UTC) Subject: [commit: ghc] master: ApiAnnotations : lexer discards comment close in nested comment (5fded20) Message-ID: <20150414123332.9E33A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5fded20c51ae61770f909351c851aaca3d3e331c/ghc >--------------------------------------------------------------- commit 5fded20c51ae61770f909351c851aaca3d3e331c Author: Alan Zimmerman Date: Tue Apr 14 07:32:52 2015 -0500 ApiAnnotations : lexer discards comment close in nested comment When parsing a nested comment, such as {- {- nested comment -} {-# nested pragma #-} -} The lexer returns the comment annotation as {- {- nested comment {-# nested pragma # -} Restore the missing comment end markers in the annotation. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D829 GHC Trac Issues: #10277 >--------------------------------------------------------------- 5fded20c51ae61770f909351c851aaca3d3e331c compiler/parser/Lexer.x | 6 +++--- .../ghc-api/annotations-literals/literals.stdout | 2 +- .../tests/ghc-api/annotations/CommentsTest.hs | 2 ++ .../tests/ghc-api/annotations/comments.stdout | 22 +++++++++++----------- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index e451b5f..1be7245 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -970,7 +970,7 @@ lineCommentToken span buf len = do nested_comment :: P (RealLocated Token) -> Action nested_comment cont span buf len = do input <- getInput - go (reverse $ drop 2 $ lexemeToString buf len) (1::Int) input + go (reverse $ lexemeToString buf len) (1::Int) input where go commentAcc 0 input = do setInput input @@ -982,9 +982,9 @@ nested_comment cont span buf len = do Nothing -> errBrace input span Just ('-',input) -> case alexGetChar' input of Nothing -> errBrace input span - Just ('\125',input) -> go commentAcc (n-1) input + Just ('\125',input) -> go ('\125':'-':commentAcc) (n-1) input -- '}' Just (_,_) -> go ('-':commentAcc) n input - Just ('\123',input) -> case alexGetChar' input of + Just ('\123',input) -> case alexGetChar' input of -- '{' char Nothing -> errBrace input span Just ('-',input) -> go ('-':'\123':commentAcc) (n+1) input Just (_,_) -> go ('\123':commentAcc) n input diff --git a/testsuite/tests/ghc-api/annotations-literals/literals.stdout b/testsuite/tests/ghc-api/annotations-literals/literals.stdout index ded26da..ff4f63f 100644 --- a/testsuite/tests/ghc-api/annotations-literals/literals.stdout +++ b/testsuite/tests/ghc-api/annotations-literals/literals.stdout @@ -1,4 +1,4 @@ -(LiteralsTest.hs:1:1-26,ITblockComment "# LANGUAGE MagicHash #",[{-# LANGUAGE MagicHash #-}]), +(LiteralsTest.hs:1:1-26,ITblockComment "{-# LANGUAGE MagicHash #-}",[{-# LANGUAGE MagicHash #-}]), (LiteralsTest.hs:2:1-6,ITmodule,[module]), diff --git a/testsuite/tests/ghc-api/annotations/CommentsTest.hs b/testsuite/tests/ghc-api/annotations/CommentsTest.hs index ce0f336..c6cf79c 100644 --- a/testsuite/tests/ghc-api/annotations/CommentsTest.hs +++ b/testsuite/tests/ghc-api/annotations/CommentsTest.hs @@ -2,6 +2,8 @@ module CommentsTest (foo) where {- An opening comment + {- with a nested one -} + {-# nested PRAGMA #-} -} import qualified Data.List as DL diff --git a/testsuite/tests/ghc-api/annotations/comments.stdout b/testsuite/tests/ghc-api/annotations/comments.stdout index 25cf555..06273ba 100644 --- a/testsuite/tests/ghc-api/annotations/comments.stdout +++ b/testsuite/tests/ghc-api/annotations/comments.stdout @@ -1,25 +1,25 @@ [ -( CommentsTest.hs:9:1-33 = -[(CommentsTest.hs:9:1-33,AnnDocCommentNext " The function @foo@ does blah")]) +( CommentsTest.hs:11:1-33 = +[(CommentsTest.hs:11:1-33,AnnDocCommentNext " The function @foo@ does blah")]) -( CommentsTest.hs:(10,7)-(13,14) = -[(CommentsTest.hs:12:15-24,AnnLineComment "-- value 2")]) +( CommentsTest.hs:(12,7)-(15,14) = +[(CommentsTest.hs:14:15-24,AnnLineComment "-- value 2")]) ( = -[(CommentsTest.hs:(3,1)-(5,2),AnnBlockComment "\nAn opening comment\n"), +[(CommentsTest.hs:(3,1)-(7,2),AnnBlockComment "{-\nAn opening comment\n {- with a nested one -}\n {-# nested PRAGMA #-}\n-}"), -(CommentsTest.hs:1:1-31,AnnBlockComment "# LANGUAGE DeriveFoldable #")]) +(CommentsTest.hs:1:1-31,AnnBlockComment "{-# LANGUAGE DeriveFoldable #-}")]) ] [ -( CommentsTest.hs:(10,7)-(13,14) = -[(CommentsTest.hs:12:15-24,AnnLineComment "-- value 2")]) +( CommentsTest.hs:(12,7)-(15,14) = +[(CommentsTest.hs:14:15-24,AnnLineComment "-- value 2")]) ( = -[(CommentsTest.hs:9:1-33,AnnLineComment "-- | The function @foo@ does blah"), +[(CommentsTest.hs:11:1-33,AnnLineComment "-- | The function @foo@ does blah"), -(CommentsTest.hs:(3,1)-(5,2),AnnBlockComment "\nAn opening comment\n"), +(CommentsTest.hs:(3,1)-(7,2),AnnBlockComment "{-\nAn opening comment\n {- with a nested one -}\n {-# nested PRAGMA #-}\n-}"), -(CommentsTest.hs:1:1-31,AnnBlockComment "# LANGUAGE DeriveFoldable #")]) +(CommentsTest.hs:1:1-31,AnnBlockComment "{-# LANGUAGE DeriveFoldable #-}")]) ] From git at git.haskell.org Tue Apr 14 12:49:30 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:49:30 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Fix a long-standing bug in the demand analyser (37f928a) Message-ID: <20150414124930.345253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/37f928aa8bb55f888ca6e22ec9f8605f695d0b44/ghc >--------------------------------------------------------------- commit 37f928aa8bb55f888ca6e22ec9f8605f695d0b44 Author: Simon Peyton Jones Date: Mon Apr 6 14:10:52 2015 +0100 Fix a long-standing bug in the demand analyser This patch fixes Trac #10148, an outright and egregious bug in the demand analyser. It is explained in Note [Demand on case-alternative binders] in Demand.hs. I did some other minor refactoring. To my astonishment I got some big compiler perf changes * perf/compiler/T5837: bytes allocated -76% * perf/compiler/T5030: bytes allocated -10% * perf/compiler/T3294: max bytes used -25% Happy days (cherry picked from commit 9f0f99fd41ff82cc223d3b682703e508efb564d2) >--------------------------------------------------------------- 37f928aa8bb55f888ca6e22ec9f8605f695d0b44 compiler/basicTypes/Demand.hs | 58 ++++++++++++- compiler/stranal/DmdAnal.hs | 194 ++++++++++++++++++++++++------------------ 2 files changed, 165 insertions(+), 87 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 37f928aa8bb55f888ca6e22ec9f8605f695d0b44 From git at git.haskell.org Tue Apr 14 12:49:33 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:49:33 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Test Trac #10148 (a818ca7) Message-ID: <20150414124933.685563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/a818ca74e7670f12d95f4d8b2a7ebd67295061bf/ghc >--------------------------------------------------------------- commit a818ca74e7670f12d95f4d8b2a7ebd67295061bf Author: Simon Peyton Jones Date: Tue Apr 7 17:20:43 2015 +0100 Test Trac #10148 (cherry picked from commit eacda9244913709ed025767418468b4cfc878cf9) >--------------------------------------------------------------- a818ca74e7670f12d95f4d8b2a7ebd67295061bf testsuite/tests/stranal/should_run/T10148.hs | 28 ++++++++++++++++++++++ .../tests/stranal/should_run/T10148.stdout | 0 testsuite/tests/stranal/should_run/all.T | 1 + 3 files changed, 29 insertions(+) diff --git a/testsuite/tests/stranal/should_run/T10148.hs b/testsuite/tests/stranal/should_run/T10148.hs new file mode 100644 index 0000000..cba925e --- /dev/null +++ b/testsuite/tests/stranal/should_run/T10148.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE BangPatterns #-} +module Main where + +import Debug.Trace + +data Machine = Machine (Int -> Machine) Int + +main :: IO () +main = (go 7 $ Machine (gstep (Array 99)) 8) `seq` return () + where + go :: Int -> Machine -> Int + go 0 (Machine _ done) = done + go nq (Machine step _) = go (nq-1) $ step 0 + +gstep :: Array Int -> Int -> Machine +gstep m x = Machine (gstep m') (mindexA m) + where + !m' = adjustA x m + +data Array a = Array a + +adjustA :: (Show a) => Int -> Array a -> Array a +adjustA i (Array t) + | i < 0 = undefined i -- not just undefined! + | otherwise = Array $ trace ("adj " ++ show t) $ t + +mindexA :: Array a -> a +mindexA (Array v) = v diff --git a/libraries/base/tests/IO/misc001.stdout b/testsuite/tests/stranal/should_run/T10148.stdout similarity index 100% copy from libraries/base/tests/IO/misc001.stdout copy to testsuite/tests/stranal/should_run/T10148.stdout diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index 2ca65b5..7f64f85 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -8,3 +8,4 @@ test('strun004', normal, compile_and_run, ['']) test('T2756b', normal, compile_and_run, ['']) test('T7649', normal, compile_and_run, ['']) test('T9254', normal, compile_and_run, ['']) +test('T10148', normal, compile_and_run, ['']) From git at git.haskell.org Tue Apr 14 12:49:36 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:49:36 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Zap usage info in CSE (Trac #10218) (5c10c69) Message-ID: <20150414124936.F19243A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/5c10c69849c8029db5b5e7ee540df308d8941957/ghc >--------------------------------------------------------------- commit 5c10c69849c8029db5b5e7ee540df308d8941957 Author: Simon Peyton Jones Date: Tue Apr 14 09:20:42 2015 +0100 Zap usage info in CSE (Trac #10218) Trac #10218 reports a subtle bug that turned out to be: - CSE invalidated the usage information computed by earlier demand analysis, by increasing sharing - that made a single-entry thunk into a multi-entry thunk - and with -feager-blackholing, that led to <> The patch fixes it by making the CSE pass zap usage information for let-bound identifiers. It can be restored by -flate-dmd-anal. (But making -flate-dmd-anal the default needs some careful work; see Trac #7782.) (cherry picked from commit d261d4cbcc867405f71d7c9580628f52978e2267) >--------------------------------------------------------------- 5c10c69849c8029db5b5e7ee540df308d8941957 compiler/basicTypes/Demand.hs | 33 +++++++++++++------- compiler/basicTypes/Id.hs | 10 +++++-- compiler/basicTypes/IdInfo.hs | 8 +++-- compiler/simplCore/CSE.hs | 35 ++++++++++++++-------- compiler/simplCore/SetLevels.hs | 2 +- compiler/stranal/DmdAnal.hs | 4 +-- .../tests/simplCore/should_compile/EvalTest.hs | 2 +- testsuite/tests/stranal/should_run/T10218.hs | 18 +++++++++++ .../should_run/T10218.stdout} | 1 - testsuite/tests/stranal/should_run/all.T | 1 + 10 files changed, 82 insertions(+), 32 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 5c10c69849c8029db5b5e7ee540df308d8941957 From git at git.haskell.org Tue Apr 14 12:51:43 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:51:43 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Import rand using capi (cf621d9) Message-ID: <20150414125143.09B6D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/cf621d936eea7406bc87daa97346ec15a16c36f9/ghc >--------------------------------------------------------------- commit cf621d936eea7406bc87daa97346ec15a16c36f9 Author: Reid Barton Date: Thu Apr 9 11:31:20 2015 -0400 Import rand using capi Summary: Android has no rand symbol (it's a static inline function there). Test Plan: ghc-android builds Reviewers: trofi, austin, hvr Reviewed By: hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D826 GHC Trac Issues: #10274 (cherry picked from commit f536d89603bb49dea192b47f54416dc88da980af) >--------------------------------------------------------------- cf621d936eea7406bc87daa97346ec15a16c36f9 libraries/base/System/IO.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs index 52931fd..7b13552 100644 --- a/libraries/base/System/IO.hs +++ b/libraries/base/System/IO.hs @@ -1,5 +1,5 @@ {-# LANGUAGE Trustworthy #-} -{-# LANGUAGE CPP, NoImplicitPrelude #-} +{-# LANGUAGE CPP, NoImplicitPrelude, CApiFFI #-} ----------------------------------------------------------------------------- -- | @@ -509,7 +509,7 @@ openTempFile' loc tmp_dir template binary mode = findTempName | otherwise = a ++ [pathSeparator] ++ b -- int rand(void) from , limited by RAND_MAX (small value, 32768) -foreign import ccall "rand" c_rand :: IO CInt +foreign import capi "stdlib.h rand" c_rand :: IO CInt -- build large digit-alike number rand_string :: IO String From git at git.haskell.org Tue Apr 14 12:51:45 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:51:45 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir (c46e4b1) Message-ID: <20150414125145.C736A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/c46e4b184e0abc158ad8f1eff6b3f0421acaf984/ghc >--------------------------------------------------------------- commit c46e4b184e0abc158ad8f1eff6b3f0421acaf984 Author: Luite Stegeman Date: Tue Apr 14 01:13:27 2015 -0500 use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir Reviewed By: edsko, austin Differential Revision: https://phabricator.haskell.org/D824 GHC Trac Issues: #10232 (cherry picked from commit 6109b312cdd9dfe4bdad4030e0185dd67e6ec18d) >--------------------------------------------------------------- c46e4b184e0abc158ad8f1eff6b3f0421acaf984 compiler/main/DynFlags.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 93c386c..1acdd10 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1026,7 +1026,7 @@ opt_lc dflags = sOpt_lc (settings dflags) versionedAppDir :: DynFlags -> IO FilePath versionedAppDir dflags = do appdir <- getAppUserDataDirectory (programName dflags) - return $ appdir (TARGET_ARCH ++ '-':TARGET_OS ++ '-':cProjectVersion) + return $ appdir (TARGET_ARCH ++ '-':TARGET_OS ++ '-':projectVersion dflags) -- | The target code type of the compilation (if any). -- From git at git.haskell.org Tue Apr 14 12:53:47 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:53:47 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Move libffi configuration after basic toolchain setup (d86de4a) Message-ID: <20150414125347.B73F83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/d86de4a856f61ad4172d6fbdd28ae5906b0d2168/ghc >--------------------------------------------------------------- commit d86de4a856f61ad4172d6fbdd28ae5906b0d2168 Author: Reid Barton Date: Mon Jan 12 10:59:11 2015 -0500 Move libffi configuration after basic toolchain setup Summary: The relevant aspect is that the libffi configuration's AC_CHECK_LIB and AC_CHECK_HEADERS are moved after FIND_GCC. There are two reasons to do this: 1. We should detect the presence of libffi using the C compiler that we are eventually going to use to build GHC. 2. Running AC_CHECK_HEADERS before FIND_GCC pollutes the CPP variable with "gcc -E" (wrong when cross-compiling), and CPP is not reset by FIND_GCC. Thus this patch fixes x86_64 -> i386 cross-compilation of integer-gmp2. Test Plan: Local x86_64 -> i386 cross-compiling validate; Harbormaster Reviewers: austin Reviewed By: austin Subscribers: erikd, carter, thomie Differential Revision: https://phabricator.haskell.org/D597 (cherry picked from commit a5bc2579afac3268c31626777406c295c7e67755) >--------------------------------------------------------------- d86de4a856f61ad4172d6fbdd28ae5906b0d2168 configure.ac | 112 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/configure.ac b/configure.ac index 8200b90..4f88de0 100644 --- a/configure.ac +++ b/configure.ac @@ -355,62 +355,6 @@ then fi fi -# system libffi - -AC_ARG_WITH([system-libffi], -[AC_HELP_STRING([--with-system-libffi], - [Use system provided libffi for RTS [default=no]]) -]) - -AS_IF([test "x$with_system_libffi" = "xyes"], - [UseSystemLibFFI="YES"], [UseSystemLibFFI="NO"] -) - - -AC_SUBST(UseSystemLibFFI) - -AC_ARG_WITH([ffi-includes], -[AC_HELP_STRING([--with-ffi-includes=ARG], - [Find includes for libffi in ARG [default=system default]]) -], -[ - if test "x$UseSystemLibFFI" != "xYES"; then - AC_MSG_WARN([--with-ffi-includes will be ignored, --with-system-libffi not set]) - else - FFIIncludeDir="$withval" - LIBFFI_CFLAGS="-I$withval" - fi -]) - -AC_SUBST(FFIIncludeDir) - -AC_ARG_WITH([ffi-libraries], -[AC_HELP_STRING([--with-ffi-libraries=ARG], - [Find libffi in ARG [default=system default]]) -], -[ - if test "x$UseSystemLibFFI" != "xYES"; then - AC_MSG_WARN([--with-ffi-libraries will be ignored, --with-system-libffi not set]) - else - FFILibDir="$withval" LIBFFI_LDFLAGS="-L$withval" - fi -]) - -AC_SUBST(FFILibDir) - -AS_IF([test "$UseSystemLibFFI" = "YES"], [ - CFLAGS2="$CFLAGS" - CFLAGS="$LIBFFI_CFLAGS $CFLAGS" - LDFLAGS2="$LDFLAGS" - LDFLAGS="$LIBFFI_LDFLAGS $LDFLAGS" - AC_CHECK_LIB(ffi, ffi_call, - [AC_CHECK_HEADERS([ffi.h], [break], []) - AC_DEFINE([HAVE_LIBFFI], [1], [Define to 1 if you have libffi.])], - [AC_MSG_ERROR([Cannot find system libffi])]) - CFLAGS="$CFLAGS2" - LDFLAGS="$LDFLAGS2" -]) - FP_ICONV FP_GMP FP_CURSES @@ -867,6 +811,62 @@ dnl ################################################################ dnl Check for libraries dnl ################################################################ +# system libffi + +AC_ARG_WITH([system-libffi], +[AC_HELP_STRING([--with-system-libffi], + [Use system provided libffi for RTS [default=no]]) +]) + +AS_IF([test "x$with_system_libffi" = "xyes"], + [UseSystemLibFFI="YES"], [UseSystemLibFFI="NO"] +) + + +AC_SUBST(UseSystemLibFFI) + +AC_ARG_WITH([ffi-includes], +[AC_HELP_STRING([--with-ffi-includes=ARG], + [Find includes for libffi in ARG [default=system default]]) +], +[ + if test "x$UseSystemLibFFI" != "xYES"; then + AC_MSG_WARN([--with-ffi-includes will be ignored, --with-system-libffi not set]) + else + FFIIncludeDir="$withval" + LIBFFI_CFLAGS="-I$withval" + fi +]) + +AC_SUBST(FFIIncludeDir) + +AC_ARG_WITH([ffi-libraries], +[AC_HELP_STRING([--with-ffi-libraries=ARG], + [Find libffi in ARG [default=system default]]) +], +[ + if test "x$UseSystemLibFFI" != "xYES"; then + AC_MSG_WARN([--with-ffi-libraries will be ignored, --with-system-libffi not set]) + else + FFILibDir="$withval" LIBFFI_LDFLAGS="-L$withval" + fi +]) + +AC_SUBST(FFILibDir) + +AS_IF([test "$UseSystemLibFFI" = "YES"], [ + CFLAGS2="$CFLAGS" + CFLAGS="$LIBFFI_CFLAGS $CFLAGS" + LDFLAGS2="$LDFLAGS" + LDFLAGS="$LIBFFI_LDFLAGS $LDFLAGS" + AC_CHECK_LIB(ffi, ffi_call, + [AC_CHECK_HEADERS([ffi.h], [break], []) + AC_DEFINE([HAVE_LIBFFI], [1], [Define to 1 if you have libffi.])], + [AC_MSG_ERROR([Cannot find system libffi])]) + CFLAGS="$CFLAGS2" + LDFLAGS="$LDFLAGS2" +]) + dnl ** check whether we need -ldl to get dlopen() AC_CHECK_LIB(dl, dlopen) From git at git.haskell.org Tue Apr 14 12:53:50 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:53:50 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Fix detection of llvm-x.x (335c025) Message-ID: <20150414125350.B70BF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/335c02562af599434ff42e5f3dac160a76229999/ghc >--------------------------------------------------------------- commit 335c02562af599434ff42e5f3dac160a76229999 Author: Thomas Miedema Date: Mon Mar 2 11:09:33 2015 -0600 Fix detection of llvm-x.x Summary: Four bug fixes and a little refactoring. * `find -perm \mode` should be `find -perm /mode` (#9697) * `find -regex '$3' should be `find -regex "$3"` (#7661) From `man sh` on my system (Ubuntu 14.04): "Enclosing characters in single quotes preserves the literal meaning of all the characters ..." * LlcCmd and OptCmd should be passed to ghc, using `-pgmlo` and `-pgmlc`, for detection of #9439. * -pgmlo and -pgmlc were undocumented because of an xml tag misplacement. Test Plan: The aclocal.m4 macro has seen about 10 iterations since its inception. Without a testsuite, I can't guarantee this version is bug free either. It's all pretty frustrating. Reviewers: bgamari, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D683 GHC Trac Issues: #9697, #7661, #9439 (cherry picked from commit 1dfab7a8ace5f09f00f8fb695932b4324e88b822) >--------------------------------------------------------------- 335c02562af599434ff42e5f3dac160a76229999 aclocal.m4 | 20 +++++++++++++++----- configure.ac | 4 ++-- docs/users_guide/flags.xml | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index f3f7406..049a846 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2100,21 +2100,31 @@ AC_DEFUN([XCODE_VERSION],[ AC_DEFUN([FIND_LLVM_PROG],[ FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) if test "$$1" = ""; then + echo -n "checking for $3-x.x... " save_IFS=$IFS IFS=":;" + if test "$windows" = YES; then + PERM= + MODE= + else + # Search for executables. + PERM="-perm" + MODE="/+x" + fi for p in ${PATH}; do if test -d "${p}"; then - if test "$windows" = YES; then - $1=`${FindCmd} "${p}" -type f -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' -or -type l -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' | ${SortCmd} -n | tail -1` - else - $1=`${FindCmd} "${p}" -type f -perm \111 -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' -or -type l -perm \111 -maxdepth 1 -regex '.*/$3-[[0-9]]\.[[0-9]]' | ${SortCmd} -n | tail -1` - fi + $1=`${FindCmd} "${p}" -maxdepth 1 \( -type f -o -type l \) ${PERM} ${MODE} -regex ".*/$3-[[0-9]]\.[[0-9]]" | ${SortCmd} -n | tail -1` if test -n "$$1"; then break fi fi done IFS=$save_IFS + if test -n "$$1"; then + echo "$$1" + else + echo "no" + fi fi ]) diff --git a/configure.ac b/configure.ac index 4f88de0..b25e3ff 100644 --- a/configure.ac +++ b/configure.ac @@ -514,7 +514,7 @@ then echo "main = putStrLn \"%function\"" > conftestghc.hs # Check whether LLVM backend is default for this platform - "${WithGhc}" conftestghc.hs 2>&1 >/dev/null + "${WithGhc}" -pgmlc="${LlcCmd}" -pgmlo="${OptCmd}" conftestghc.hs 2>&1 >/dev/null res=`./conftestghc` if test "x$res" = "x%object" then @@ -531,7 +531,7 @@ then # -fllvm is not the default, but set a flag so the Makefile can check # -for it in the build flags later on - "${WithGhc}" -fforce-recomp -fllvm conftestghc.hs 2>&1 >/dev/null + "${WithGhc}" -fforce-recomp -pgmlc="${LlcCmd}" -pgmlo="${OptCmd}" -fllvm conftestghc.hs 2>&1 >/dev/null if test $? = 0 then res=`./conftestghc` diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index a7f4473..f019854 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -2722,6 +2722,7 @@ Use cmd as the C compiler dynamic - + cmd Use cmd as the LLVM optimiser @@ -2734,7 +2735,6 @@ dynamic - - cmd Use cmd as the splitter From git at git.haskell.org Tue Apr 14 12:53:53 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 12:53:53 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Do version specific detection of LLVM tools (#10170). (07da52c) Message-ID: <20150414125353.814173A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/07da52ce2db15da1d495baa213f3bdca158b6843/ghc >--------------------------------------------------------------- commit 07da52ce2db15da1d495baa213f3bdca158b6843 Author: Erik de Castro Lopo Date: Fri Mar 20 12:16:23 2015 +1100 Do version specific detection of LLVM tools (#10170). The LLVM developers seem to make breaking changes in the LLVM IR language between major releases. As a consumer of the LLVM tools GHC now needs to be locked more tightly to a single version of the LLVM tools. GHC HEAD currently only supports LLVM version 3.6. This commit changes the configure script to look for `llc-3.6` and `opt-3.6` before looking for `llc` and `opt`. If the former are not found, but the later are, check that they actually are version 3.6. At the same time, when detecting known problems with the LLVM tools (ie #9439) test for it using the versions of the LLVM tools retrieved from the bootstrap compiler's settings file. Test Plan: Manual testing. Reviewers: thomie, rwbarton, nomeata, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D745 GHC Trac Issues: #10170 (cherry picked from commit 42448e3757f25735a0a5b5e2b7ee456b5e8b0039) >--------------------------------------------------------------- 07da52ce2db15da1d495baa213f3bdca158b6843 aclocal.m4 | 55 ++++++++++++++++++++++++++++++------------------------- configure.ac | 27 ++++++++++++++++++++++----- 2 files changed, 52 insertions(+), 30 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 049a846..671f545 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2096,38 +2096,43 @@ AC_DEFUN([XCODE_VERSION],[ # $1 = the variable to set # $2 = the with option name # $3 = the command to look for +# $4 = the version of the command to look for # AC_DEFUN([FIND_LLVM_PROG],[ - FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) + # Test for program with version name. + FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3-$4]) if test "$$1" = ""; then - echo -n "checking for $3-x.x... " - save_IFS=$IFS - IFS=":;" - if test "$windows" = YES; then - PERM= - MODE= + # Test for program without version name. + FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) + AC_MSG_CHECKING([$$1 is version $4]) + if test `$$1 --version | grep -c "version $4"` -gt 0 ; then + AC_MSG_RESULT(yes) else - # Search for executables. - PERM="-perm" - MODE="/+x" - fi - for p in ${PATH}; do - if test -d "${p}"; then - $1=`${FindCmd} "${p}" -maxdepth 1 \( -type f -o -type l \) ${PERM} ${MODE} -regex ".*/$3-[[0-9]]\.[[0-9]]" | ${SortCmd} -n | tail -1` - if test -n "$$1"; then - break - fi - fi - done - IFS=$save_IFS - if test -n "$$1"; then - echo "$$1" - else - echo "no" - fi + AC_MSG_RESULT(no) + $1="" + fi fi ]) +# FIND_GHC_BOOTSTRAP_PROG() +# -------------------------------- +# Parse the bootstrap GHC's compier settings file for the location of things +# like the `llc` and `opt` commands. +# +# $1 = the variable to set +# $2 = The bootstrap compiler. +# $3 = The string to grep for to find the correct line. +# +AC_DEFUN([FIND_GHC_BOOTSTRAP_PROG],[ + BootstrapTmpCmd=`grep $3 $($2 --print-libdir)/settings 2>/dev/null | sed 's/.*", "//;s/".*//'` + if test -n "$BootstrapTmpCmd" && test `basename $BootstrapTmpCmd` = $BootstrapTmpCmd ; then + AC_PATH_PROG([$1], [$BootstrapTmpCmd], "") + else + $1=$BootstrapTmpCmd + fi +]) + + # FIND_GCC() # -------------------------------- # Finds where gcc is diff --git a/configure.ac b/configure.ac index b25e3ff..c231434 100644 --- a/configure.ac +++ b/configure.ac @@ -478,15 +478,21 @@ cygwin32|mingw32) ;; esac +# Here is where we re-target which specific version of the LLVM +# tools we are looking for. In the past, GHC supported a number of +# versions of LLVM simultaneously, but that stopped working around +# 3.5/3.6 release of LLVM. +llvm_version=3.6 + dnl ** Which LLVM llc to use? dnl -------------------------------------------------------------- -FIND_LLVM_PROG([LLC], [llc], [llc]) +FIND_LLVM_PROG([LLC], [llc], [llc], [$llvm_version]) LlcCmd="$LLC" AC_SUBST([LlcCmd]) dnl ** Which LLVM opt to use? dnl -------------------------------------------------------------- -FIND_LLVM_PROG([OPT], [opt], [opt]) +FIND_LLVM_PROG([OPT], [opt], [opt], [$llvm_version]) OptCmd="$OPT" AC_SUBST([OptCmd]) @@ -508,13 +514,24 @@ dnl whether -fllvm is the stage 0 compiler's default. If so we dnl fail. If not, we check whether -fllvm is affected explicitly and dnl if so set a flag. The build system will later check this flag dnl after the desired build flags are known. -if test -n "$LlcCmd" && test -n "$OptCmd" + +dnl This problem is further complicated by the fact that the llvm +dnl version used by the bootstrap compiler may be different from the +dnl version we arre trying to compile GHC against. Therefore, we need +dnl to find the boostrap compiler's `settings` file then check to see +dnl if the `opt` and `llc` command strings are non-empty and if these +dnl programs exist. Only if they exist to we test for bug #9439. + +FIND_GHC_BOOTSTRAP_PROG([BootstrapLlcCmd], [${WithGhc}], "LLVM llc command") +FIND_GHC_BOOTSTRAP_PROG([BootstrapOptCmd], [${WithGhc}], "LLVM opt command") + +if test -n "$BootstrapLlcCmd" && test -n "$BootstrapOptCmd" then AC_MSG_CHECKING(whether bootstrap compiler is affected by bug 9439) echo "main = putStrLn \"%function\"" > conftestghc.hs # Check whether LLVM backend is default for this platform - "${WithGhc}" -pgmlc="${LlcCmd}" -pgmlo="${OptCmd}" conftestghc.hs 2>&1 >/dev/null + "${WithGhc}" -pgmlc="${BootstrapLlcCmd}" -pgmlo="${BootstrapOptCmd}" conftestghc.hs 2>&1 >/dev/null res=`./conftestghc` if test "x$res" = "x%object" then @@ -531,7 +548,7 @@ then # -fllvm is not the default, but set a flag so the Makefile can check # -for it in the build flags later on - "${WithGhc}" -fforce-recomp -pgmlc="${LlcCmd}" -pgmlo="${OptCmd}" -fllvm conftestghc.hs 2>&1 >/dev/null + "${WithGhc}" -fforce-recomp -pgmlc="${BootstrapLlcCmd}" -pgmlo="${BootstrapOptCmd}" -fllvm conftestghc.hs 2>&1 >/dev/null if test $? = 0 then res=`./conftestghc` From git at git.haskell.org Tue Apr 14 13:11:11 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 13:11:11 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: More aggressive Given/Wanted overlap check (49d4282) Message-ID: <20150414131111.D2CE83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/49d42827e8875de3d4a953371e98ef5ef71d2038/ghc >--------------------------------------------------------------- commit 49d42827e8875de3d4a953371e98ef5ef71d2038 Author: Simon Peyton Jones Date: Tue Apr 7 14:29:10 2015 +0100 More aggressive Given/Wanted overlap check This fixes Trac #10195 For some reason we considered untouchability before, but Trac #10195 shows that this is positively worng. See Note [Instance and Given overlap] in TcInteract. Looking at the Git log, it seems that this bug was introduced at the same time that we introduced the Given/Wanted overlap check in the first place. (cherry picked from commit 8b7ceece52d2a0bb8a4ea5609da286fb76d88211) >--------------------------------------------------------------- 49d42827e8875de3d4a953371e98ef5ef71d2038 compiler/typecheck/TcInteract.hs | 141 +++++++++++---------- compiler/typecheck/TcType.hs | 4 +- testsuite/tests/typecheck/should_compile/T10195.hs | 31 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 110 insertions(+), 67 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 49d42827e8875de3d4a953371e98ef5ef71d2038 From git at git.haskell.org Tue Apr 14 13:17:49 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 13:17:49 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: GHC.Prim.Constraint is not built-in syntax (f6c690b) Message-ID: <20150414131749.6F0C73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/f6c690ba6491e0e943bd07763c0063a55ff0c760/ghc >--------------------------------------------------------------- commit f6c690ba6491e0e943bd07763c0063a55ff0c760 Author: Simon Peyton Jones Date: Tue Apr 7 13:55:43 2015 +0100 GHC.Prim.Constraint is not built-in syntax This fixes Trac #10233 (cherry picked from commit 74d2c33a1f4ebe3de090bc73d08910bbdd31f8f1) >--------------------------------------------------------------- f6c690ba6491e0e943bd07763c0063a55ff0c760 compiler/prelude/TysPrim.hs | 33 ++++++++++++++++++--------------- testsuite/tests/module/T10233.hs | 2 ++ testsuite/tests/module/T10233a.hs | 3 +++ testsuite/tests/module/all.T | 2 ++ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index e8542eb..6cb1006 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -10,8 +10,6 @@ -- | This module defines TyCons that can't be expressed in Haskell. -- They are all, therefore, wired-in TyCons. C.f module TysWiredIn module TysPrim( - mkPrimTyConName, -- For implicit parameters in TysWiredIn only - tyVarList, alphaTyVars, betaTyVars, alphaTyVar, betaTyVar, gammaTyVar, deltaTyVar, alphaTy, betaTy, gammaTy, deltaTy, openAlphaTy, openBetaTy, openAlphaTyVar, openBetaTyVar, openAlphaTyVars, @@ -330,21 +328,26 @@ constraintKindTyCon = mkKindTyCon constraintKindTyConName superKind -- ... and now their names -- If you edit these, you may need to update the GHC formalism --- See Note [GHC Formalism] in coreSyn/CoreLint.lhs -superKindTyConName = mkPrimTyConName (fsLit "BOX") superKindTyConKey superKindTyCon -anyKindTyConName = mkPrimTyConName (fsLit "AnyK") anyKindTyConKey anyKindTyCon -liftedTypeKindTyConName = mkPrimTyConName (fsLit "*") liftedTypeKindTyConKey liftedTypeKindTyCon -openTypeKindTyConName = mkPrimTyConName (fsLit "OpenKind") openTypeKindTyConKey openTypeKindTyCon -unliftedTypeKindTyConName = mkPrimTyConName (fsLit "#") unliftedTypeKindTyConKey unliftedTypeKindTyCon -constraintKindTyConName = mkPrimTyConName (fsLit "Constraint") constraintKindTyConKey constraintKindTyCon +-- See Note [GHC Formalism] in coreSyn/CoreLint.hs +superKindTyConName = mkPrimTyConName (fsLit "BOX") superKindTyConKey superKindTyCon +anyKindTyConName = mkPrimTyConName (fsLit "AnyK") anyKindTyConKey anyKindTyCon +liftedTypeKindTyConName = mkPrimTyConName (fsLit "*") liftedTypeKindTyConKey liftedTypeKindTyCon +openTypeKindTyConName = mkPrimTyConName (fsLit "OpenKind") openTypeKindTyConKey openTypeKindTyCon +unliftedTypeKindTyConName = mkPrimTyConName (fsLit "#") unliftedTypeKindTyConKey unliftedTypeKindTyCon mkPrimTyConName :: FastString -> Unique -> TyCon -> Name -mkPrimTyConName occ key tycon = mkWiredInName gHC_PRIM (mkTcOccFS occ) - key - (ATyCon tycon) - BuiltInSyntax - -- All of the super kinds and kinds are defined in Prim and use BuiltInSyntax, - -- because they are never in scope in the source +mkPrimTyConName = mkPrimTcName BuiltInSyntax + -- All of the super kinds and kinds are defined in Prim, + -- and use BuiltInSyntax, because they are never in scope in the source + +constraintKindTyConName -- Unlike the others, Constraint does *not* use BuiltInSyntax, + -- and can be imported/exported like any other type constructor + = mkPrimTcName UserSyntax (fsLit "Constraint") constraintKindTyConKey constraintKindTyCon + + +mkPrimTcName :: BuiltInSyntax -> FastString -> Unique -> TyCon -> Name +mkPrimTcName built_in_syntax occ key tycon + = mkWiredInName gHC_PRIM (mkTcOccFS occ) key (ATyCon tycon) built_in_syntax kindTyConType :: TyCon -> Type kindTyConType kind = TyConApp kind [] -- mkTyConApp isn't defined yet diff --git a/testsuite/tests/module/T10233.hs b/testsuite/tests/module/T10233.hs new file mode 100644 index 0000000..965b413 --- /dev/null +++ b/testsuite/tests/module/T10233.hs @@ -0,0 +1,2 @@ +module T10233 where +import T10233a( Constraint, Int ) diff --git a/testsuite/tests/module/T10233a.hs b/testsuite/tests/module/T10233a.hs new file mode 100644 index 0000000..b3282d9 --- /dev/null +++ b/testsuite/tests/module/T10233a.hs @@ -0,0 +1,3 @@ +module T10233a ( module GHC.Exts ) where +import GHC.Exts ( Constraint, Int ) + diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T index 58632be..2e4aedd 100644 --- a/testsuite/tests/module/all.T +++ b/testsuite/tests/module/all.T @@ -345,3 +345,5 @@ test('T414b', normal, compile, ['']) test('T3776', normal, compile, ['']) test('T9061', normal, compile, ['']) test('T9997', normal, compile, ['']) +test('T10233', extra_clean(['T01233a.hi', 'T01233a.o']), + multimod_compile, ['T10233', '-v0']) From git at git.haskell.org Tue Apr 14 14:11:21 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 14:11:21 +0000 (UTC) Subject: [commit: ghc] master: Implement -f[no-]print-unicode-syntax flag for unicode syntax output (#8959) (6dd2765) Message-ID: <20150414141121.0CDE13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6dd2765a300bb139b4ab67688dbc6f48de66969b/ghc >--------------------------------------------------------------- commit 6dd2765a300bb139b4ab67688dbc6f48de66969b Author: Bertram Felgenhauer Date: Tue Apr 14 09:10:52 2015 -0500 Implement -f[no-]print-unicode-syntax flag for unicode syntax output (#8959) There is currently no way to separate whether UnicodeSyntax is accepted for input from the corresponding output syntax using unicode symbols. This patch implements a separate flag for affecting ghc(i)'s output. Signed-off-by: Bertram Felgenhauer Reviewed By: nomeata, austin Differential Revision: https://phabricator.haskell.org/D807 GHC Trac Issues: #8959 >--------------------------------------------------------------- 6dd2765a300bb139b4ab67688dbc6f48de66969b compiler/main/DynFlags.hs | 5 ++++- docs/users_guide/flags.xml | 10 ++++++++-- docs/users_guide/using.xml | 14 ++++++++++++-- ghc/InteractiveUI.hs | 1 + testsuite/tests/ghci/scripts/T8959.script | 4 ++-- testsuite/tests/ghci/scripts/T8959b.script | 1 + testsuite/tests/ghci/scripts/all.T | 2 +- 7 files changed, 29 insertions(+), 8 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index f3e3066..446381e 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -329,6 +329,7 @@ data GeneralFlag | Opt_PrintExplicitForalls | Opt_PrintExplicitKinds + | Opt_PrintUnicodeSyntax -- optimisation opts | Opt_CallArity @@ -1767,8 +1768,9 @@ lang_set dflags lang = extensionFlags = flattenExtensionFlags lang (extensions dflags) } +-- | Check whether to use unicode syntax for output useUnicodeSyntax :: DynFlags -> Bool -useUnicodeSyntax = xopt Opt_UnicodeSyntax +useUnicodeSyntax = gopt Opt_PrintUnicodeSyntax -- | Set the Haskell language standard to use setLanguage :: Language -> DynP () @@ -2972,6 +2974,7 @@ fFlags = [ flagGhciSpec "print-evld-with-show" Opt_PrintEvldWithShow, flagSpec "print-explicit-foralls" Opt_PrintExplicitForalls, flagSpec "print-explicit-kinds" Opt_PrintExplicitKinds, + flagSpec "print-unicode-syntax" Opt_PrintUnicodeSyntax, flagSpec "prof-cafs" Opt_AutoSccsOnIndividualCafs, flagSpec "prof-count-entries" Opt_ProfCountEntries, flagSpec "regs-graph" Opt_RegsGraph, diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index 4d4706b..f62fe22 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -37,17 +37,23 @@ - print explicit forall quantification in types + Print explicit forall quantification in types. See also dynamic -fno-print-explicit-foralls - print explicit kind foralls and kind arguments in types + Print explicit kind foralls and kind arguments in types. See also dynamic -fno-print-explicit-kinds + + Use unicode syntax when printing expressions, types and kinds. See also + dynamic + -fno-print-unicode-syntax + + output full span in error messages dynamic diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml index 68d2752..2ac51f6 100644 --- a/docs/users_guide/using.xml +++ b/docs/users_guide/using.xml @@ -896,12 +896,13 @@ ghc -c Foo.hs - + + - These two flags control the way in which GHC displays types, in error messages and in GHCi. + These three flags control the way in which GHC displays types, in error messages and in GHCi. Using makes GHC print explicit forall quantification at the top level of a type; normally this is suppressed. For example, in GHCi: @@ -946,6 +947,15 @@ ghci> :t MkT MkT :: forall (k :: BOX) (a :: k). T k a + + When is enabled, GHC prints type signatures using + the unicode symbols from the extension. + +ghci> :set -fprint-unicode-syntax +ghci> :t (>>) +(>>) :: ∀ (m :: * → *) a b. Monad m ⇒ m a → m b → m b + + diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index fc2883f..f5b69ae 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -2073,6 +2073,7 @@ showDynFlags show_all dflags = do DynFlags.fFlags flgs = [ Opt_PrintExplicitForalls , Opt_PrintExplicitKinds + , Opt_PrintUnicodeSyntax , Opt_PrintBindResult , Opt_BreakOnException , Opt_BreakOnError diff --git a/testsuite/tests/ghci/scripts/T8959.script b/testsuite/tests/ghci/scripts/T8959.script index 124b2ab..da60aeb 100644 --- a/testsuite/tests/ghci/scripts/T8959.script +++ b/testsuite/tests/ghci/scripts/T8959.script @@ -5,14 +5,14 @@ :t () >- () -< () >>- () -<< () let fun foo | True <- () = () -:set -XUnicodeSyntax +:set -fprint-unicode-syntax :t lookup :t undefined :: (forall a. a -> a) -> a :t () >- () -< () >>- () -<< () let fun foo | True <- () = () -:set -XNoUnicodeSyntax +:set -fno-print-unicode-syntax :t lookup :t undefined :: (forall a. a -> a) -> a diff --git a/testsuite/tests/ghci/scripts/T8959b.script b/testsuite/tests/ghci/scripts/T8959b.script index f3c23c9..e4d0df6 100644 --- a/testsuite/tests/ghci/scripts/T8959b.script +++ b/testsuite/tests/ghci/scripts/T8959b.script @@ -1 +1,2 @@ +:set -fprint-unicode-syntax :l T8959b.hs diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index b576a63..b97eede 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -187,7 +187,7 @@ test('T8831', normal, ghci_script, ['T8831.script']) test('T8917', normal, ghci_script, ['T8917.script']) test('T8931', normal, ghci_script, ['T8931.script']) test('T8959', normal, ghci_script, ['T8959.script']) -test('T8959b', expect_broken(8959), ghci_script, ['T8959b.script']) +test('T8959b', normal, ghci_script, ['T8959b.script']) test('T9181', normal, ghci_script, ['T9181.script']) test('T9086b', normal, ghci_script, ['T9086b.script']) test('T9140', combined_output, ghci_script, ['T9140.script']) From git at git.haskell.org Tue Apr 14 14:40:24 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Apr 2015 14:40:24 +0000 (UTC) Subject: [commit: ghc] master: Do not allow Typeable on constraints (Trac #9858) (7b042d5) Message-ID: <20150414144024.9E4563A302@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7b042d5adabdb0fc06286db1a7f9cbf1e9fd1fbf/ghc >--------------------------------------------------------------- commit 7b042d5adabdb0fc06286db1a7f9cbf1e9fd1fbf Author: Simon Peyton Jones Date: Tue Apr 14 15:39:01 2015 +0100 Do not allow Typeable on constraints (Trac #9858) The astonishingly-ingenious trio of Shachaf Ben-Kiki, ?rjan Johansen and Nathan van Doorn managed to persuade GHC 7.10.1 to cough up unsafeCoerce. That is very bad. This patch fixes it by no allowing Typable on Constraint-kinded things. And that seems right, since it is, in effect, a form of impredicative polymorphism, which Typeable definitely doesn't support. We may want to creep back in the direction of allowing Typeable on constraints one day, but this is a good fix for now, and closes a terrible hole. >--------------------------------------------------------------- 7b042d5adabdb0fc06286db1a7f9cbf1e9fd1fbf compiler/typecheck/TcInteract.hs | 39 ++++++++++++++++++++-- compiler/types/TypeRep.hs | 14 ++++++-- testsuite/tests/typecheck/should_fail/T9858a.hs | 35 +++++++++++++++++++ .../tests/typecheck/should_fail/T9858a.stderr | 12 +++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + testsuite/tests/typecheck/should_run/T9858b.hs | 8 +++++ .../tests/typecheck/should_run/T9858b.stdout | 0 testsuite/tests/typecheck/should_run/all.T | 1 + 8 files changed, 106 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 8494153..271f973 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -14,7 +14,7 @@ import TcCanonical import TcFlatten import VarSet import Type -import Kind (isKind) +import Kind (isKind, isConstraintKind) import Unify import InstEnv( DFunInstType, lookupInstEnv, instanceDFunId ) import CoAxiom(sfInteractTop, sfInteractInert) @@ -1847,7 +1847,9 @@ isCallStackIP _ _ _ -- and it was applied to the correct argument. matchTypeableClass :: Class -> Kind -> Type -> CtLoc -> TcS LookupInstResult matchTypeableClass clas k t loc - | isForAllTy k = return NoInstance + | isForAllTy t = return NoInstance + | isConstraintKind k = return NoInstance + -- See Note [No Typeable for qualified types] | Just (tc, ks) <- splitTyConApp_maybe t , all isKind ks = doTyCon tc ks | Just (f,kt) <- splitAppTy_maybe t = doTyApp f kt @@ -1895,3 +1897,36 @@ matchTypeableClass clas k t loc mkSimpEv ev = return (GenInst [] (EvTypeable ev)) +{- Note [No Typeable for polytype or for constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We do not support impredicative typeable, such as + Typeable (forall a. a->a) + Typeable (Eq a => a -> a) + Typeable (Eq a) + Typeable (() :: Constraint) + Typeable (() => Int) + Typeable (((),()) => Int) + +See Trac #9858. For forall's the case is clear: we simply don't have +a TypeRep for them. For qualified but not polymorphic types, like +(Eq a => a -> a), things are murkier. But: + + * We don't need a TypeRep for these things. TypeReps are for + monotypes only. + + * The types (Eq a, Show a) => ...blah... + and Eq a => Show a => ...blah... + are represented the same way, as a curried function; + that is, the tuple before the '=>' is just syntactic + sugar. But since we can abstract over tuples of constraints, + we really do have tuples of constraints as well. + + This dichotomy is not well worked out, and Trac #9858 comment:76 + shows that Typeable treated it one way, while newtype instance + matching treated it another. Or maybe it was the fact that + '*' and Constraint are distinct to the type checker, but are + the same afterwards. Anyway, the result was a function of + type (forall ab. a -> b), which is pretty dire. + +So the simple solution is not to attempt Typable for constraints. +-} diff --git a/compiler/types/TypeRep.hs b/compiler/types/TypeRep.hs index 3e46de3..8ed07c1 100644 --- a/compiler/types/TypeRep.hs +++ b/compiler/types/TypeRep.hs @@ -730,8 +730,7 @@ pprTcApp _ pp tc [ty] pprTcApp p pp tc tys | isTupleTyCon tc && tyConArity tc == length tys - = pprPromotionQuote tc <> - tupleParens (tupleTyConSort tc) (sep (punctuate comma (map (pp TopPrec) tys))) + = pprTupleApp p pp tc tys | Just dc <- isPromotedDataCon_maybe tc , let dc_tc = dataConTyCon dc @@ -746,6 +745,17 @@ pprTcApp p pp tc tys | otherwise = sdocWithDynFlags (pprTcApp_help p pp tc tys) +pprTupleApp :: TyPrec -> (TyPrec -> a -> SDoc) -> TyCon -> [a] -> SDoc +-- Print a saturated tuple +pprTupleApp p pp tc tys + | null tys + , ConstraintTuple <- tupleTyConSort tc + = maybeParen p TopPrec $ + ppr tc <+> dcolon <+> ppr (tyConKind tc) + | otherwise + = pprPromotionQuote tc <> + tupleParens (tupleTyConSort tc) (sep (punctuate comma (map (pp TopPrec) tys))) + pprTcApp_help :: TyPrec -> (TyPrec -> a -> SDoc) -> TyCon -> [a] -> DynFlags -> SDoc -- This one has accss to the DynFlags pprTcApp_help p pp tc tys dflags diff --git a/testsuite/tests/typecheck/should_fail/T9858a.hs b/testsuite/tests/typecheck/should_fail/T9858a.hs new file mode 100644 index 0000000..fda55c2 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T9858a.hs @@ -0,0 +1,35 @@ +-- From comment:76 in Trac #9858 +-- This exploit still works in GHC 7.10.1. +-- By Shachaf Ben-Kiki, ?rjan Johansen and Nathan van Doorn + +{-# LANGUAGE Safe #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE ImpredicativeTypes #-} + +module T9858a where + +import Data.Typeable + +type E = (:~:) +type PX = Proxy (((),()) => ()) +type PY = Proxy (() -> () -> ()) + +data family F p a b + +newtype instance F a b PX = ID (a -> a) +newtype instance F a b PY = UC (a -> b) + +{-# NOINLINE ecast #-} +ecast :: E p q -> f p -> f q +ecast Refl = id + +supercast :: F a b PX -> F a b PY +supercast = case cast e of + Just e' -> ecast e' + where + e = Refl + e :: E PX PX + +uc :: a -> b +uc = case supercast (ID id) of UC f -> f diff --git a/testsuite/tests/typecheck/should_fail/T9858a.stderr b/testsuite/tests/typecheck/should_fail/T9858a.stderr new file mode 100644 index 0000000..72b72e9 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T9858a.stderr @@ -0,0 +1,12 @@ + +T9858a.hs:28:18: error: + No instance for (Typeable (() :: Constraint)) + arising from a use of ?cast? + In the expression: cast e + In the expression: case cast e of { Just e' -> ecast e' } + In an equation for ?supercast?: + supercast + = case cast e of { Just e' -> ecast e' } + where + e = Refl + e :: E PX PX diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 5d31bcd..ac91670 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -356,3 +356,4 @@ test('T9605', normal, compile_fail, ['']) test('T9999', normal, compile_fail, ['']) test('T10194', normal, compile_fail, ['']) test('T8030', normal, compile_fail, ['']) +test('T9858a', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_run/T9858b.hs b/testsuite/tests/typecheck/should_run/T9858b.hs new file mode 100644 index 0000000..3c680c2 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T9858b.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE DataKinds #-} +module Main where + +import Data.Typeable + +data A = A + +main = print $ typeRep (Proxy :: Proxy A) == typeRep (Proxy :: Proxy 'A) diff --git a/libraries/base/tests/dynamic003.stdout b/testsuite/tests/typecheck/should_run/T9858b.stdout similarity index 100% copy from libraries/base/tests/dynamic003.stdout copy to testsuite/tests/typecheck/should_run/T9858b.stdout diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index f0a5eb6..4868db3 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -116,3 +116,4 @@ test('T8739', normal, compile_and_run, ['']) test('T9497a-run', [exit_code(1)], compile_and_run, ['-fdefer-typed-holes']) test('T9497b-run', [exit_code(1)], compile_and_run, ['-fdefer-typed-holes -fno-warn-typed-holes']) test('T9497c-run', [exit_code(1)], compile_and_run, ['-fdefer-type-errors -fno-warn-typed-holes']) +test('T9858b', normal, compile_and_run, ['']) From git at git.haskell.org Wed Apr 15 09:28:46 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Apr 2015 09:28:46 +0000 (UTC) Subject: [commit: ghc] master: Fix fundep coverage-condition check for poly-kinds (49d9b00) Message-ID: <20150415092846.E31183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/49d9b009a2affb6015b8f6e2f15e4660a53c0d9a/ghc >--------------------------------------------------------------- commit 49d9b009a2affb6015b8f6e2f15e4660a53c0d9a Author: Simon Peyton Jones Date: Wed Apr 15 10:28:40 2015 +0100 Fix fundep coverage-condition check for poly-kinds See Note [Closing over kinds in coverage] in FunDeps. I'd already fixed this bug once, for Trac #8391, but I put the call to closeOverKinds in the wrong place, so Trac #10109 failed. (It checks the /liberal/ coverage condition, which The fix was easy: move the call to the right place! >--------------------------------------------------------------- 49d9b009a2affb6015b8f6e2f15e4660a53c0d9a compiler/typecheck/FunDeps.hs | 9 +++++---- testsuite/tests/typecheck/should_compile/T10109.hs | 10 ++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/FunDeps.hs b/compiler/typecheck/FunDeps.hs index 2d0ac33..53ecb48 100644 --- a/compiler/typecheck/FunDeps.hs +++ b/compiler/typecheck/FunDeps.hs @@ -382,11 +382,12 @@ checkInstCoverage be_liberal clas theta inst_taus = NotValid msg where (ls,rs) = instFD fd tyvars inst_taus - ls_tvs = closeOverKinds (tyVarsOfTypes ls) -- See Note [Closing over kinds in coverage] + ls_tvs = tyVarsOfTypes ls rs_tvs = tyVarsOfTypes rs - conservative_ok = rs_tvs `subVarSet` ls_tvs - liberal_ok = rs_tvs `subVarSet` oclose theta ls_tvs + conservative_ok = rs_tvs `subVarSet` closeOverKinds ls_tvs + liberal_ok = rs_tvs `subVarSet` closeOverKinds (oclose theta ls_tvs) + -- closeOverKinds: see Note [Closing over kinds in coverage] msg = vcat [ sep [ ptext (sLit "The") <+> ppWhen be_liberal (ptext (sLit "liberal")) @@ -419,7 +420,7 @@ Example (Trac #8391), using liberal coverage instance Bar a (Foo a) In the instance decl, (a:k) does fix (Foo k a), but only if we notice -that (a:k) fixes k. +that (a:k) fixes k. Trac #10109 is another example. Note [The liberal coverage condition] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/testsuite/tests/typecheck/should_compile/T10109.hs b/testsuite/tests/typecheck/should_compile/T10109.hs new file mode 100644 index 0000000..a61b2bc --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T10109.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE PolyKinds, MultiParamTypeClasses, FunctionalDependencies, + UndecidableInstances, FlexibleInstances #-} + +module T10109 where + +data Succ a + +class Add (a :: k1) (b :: k2) (ab :: k3) | a b -> ab +instance (Add a b ab) => Add (Succ a) b (Succ ab) + diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 827811f..d7b3fad 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -448,3 +448,4 @@ test('T10156', normal, compile, ['']) test('T10177', normal, compile, ['']) test('T10185', expect_broken(10185), compile, ['']) test('T10195', normal, compile, ['']) +test('T10109', normal, compile, ['']) From git at git.haskell.org Wed Apr 15 14:33:35 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Apr 2015 14:33:35 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T10293' created Message-ID: <20150415143335.034BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T10293 Referencing: 1bcd749cf322b3782fa5a9f169d0f91e3b87735f From git at git.haskell.org Wed Apr 15 14:33:37 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Apr 2015 14:33:37 +0000 (UTC) Subject: [commit: ghc] wip/T10293: Improve Call Arity performance (7fffa7a) Message-ID: <20150415143337.DD5333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10293 Link : http://ghc.haskell.org/trac/ghc/changeset/7fffa7ac6aee5e5b3188dd864b409e857ae75d86/ghc >--------------------------------------------------------------- commit 7fffa7ac6aee5e5b3188dd864b409e857ae75d86 Author: Joachim Breitner Date: Wed Apr 15 13:32:32 2015 +0200 Improve Call Arity performance This improves how the Call Arity deals with "boring" variables. Boring variables are those where it does not bother to include in the analysis result, so whenever something is looked up in the analysis result, we have to make a conservative assumption about them. Previously, we extended the result with such conservative information about them, to keep the code uniform, but that could blow up the amount of data passed around, even if only temporarily, and slowed things down. We now pass around an explicit list (well, set) of variable that are boring and take that into account whenever we use the result. Not as pretty, but noticably faster. >--------------------------------------------------------------- 7fffa7ac6aee5e5b3188dd864b409e857ae75d86 compiler/simplCore/CallArity.hs | 127 +++++++++++---------- testsuite/tests/callarity/unittest/CallArity1.hs | 5 + .../tests/callarity/unittest/CallArity1.stderr | 6 +- 3 files changed, 78 insertions(+), 60 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 7fffa7ac6aee5e5b3188dd864b409e857ae75d86 From git at git.haskell.org Wed Apr 15 14:33:40 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Apr 2015 14:33:40 +0000 (UTC) Subject: [commit: ghc] wip/T10293: Call Arity: Trade precision for performance in large mutually recursive groups (1bcd749) Message-ID: <20150415143340.9BB553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10293 Link : http://ghc.haskell.org/trac/ghc/changeset/1bcd749cf322b3782fa5a9f169d0f91e3b87735f/ghc >--------------------------------------------------------------- commit 1bcd749cf322b3782fa5a9f169d0f91e3b87735f Author: Joachim Breitner Date: Wed Apr 15 16:25:13 2015 +0200 Call Arity: Trade precision for performance in large mutually recursive groups Sometimes (especial with derived Data instances, it seems), one can have very large mutually recursive bindings. Calculating the Call Arity analysis result with full precision is an expensive operation in these case. So above a certain threshold (25, for no good reason besides intuition), skip this calculation and assume the recursion is not linear, which is a conservative result. With this, the Call Arity analysis accounts for 3.7% of the compile time of haskell-src-exts. >--------------------------------------------------------------- 1bcd749cf322b3782fa5a9f169d0f91e3b87735f compiler/simplCore/CallArity.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/simplCore/CallArity.hs b/compiler/simplCore/CallArity.hs index 4e4555c..c2a5ad0 100644 --- a/compiler/simplCore/CallArity.hs +++ b/compiler/simplCore/CallArity.hs @@ -630,6 +630,9 @@ callArityRecEnv any_boring ae_rhss ae_body cross_calls -- See Note [Taking boring variables into account] | any_boring = completeGraph (domRes ae_combined) + -- Also, calculating cross_calls is expensive. Simply be conservative + -- if the mutually recursive group becomes too large. + | length ae_rhss > 25 = completeGraph (domRes ae_combined) | otherwise = unionUnVarGraphs $ map cross_call ae_rhss cross_call (v, ae_rhs) = completeBipartiteGraph called_by_v called_with_v where From git at git.haskell.org Wed Apr 15 14:39:11 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Apr 2015 14:39:11 +0000 (UTC) Subject: [commit: ghc] wip/T10293: Improve Call Arity performance (a9ca67f) Message-ID: <20150415143911.50D553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10293 Link : http://ghc.haskell.org/trac/ghc/changeset/a9ca67f6bfb45d13944ba15452d3af613ec84d8b/ghc >--------------------------------------------------------------- commit a9ca67f6bfb45d13944ba15452d3af613ec84d8b Author: Joachim Breitner Date: Wed Apr 15 13:32:32 2015 +0200 Improve Call Arity performance This improves how the Call Arity deals with "boring" variables. Boring variables are those where it does not bother to include in the analysis result, so whenever something is looked up in the analysis result, we have to make a conservative assumption about them. Previously, we extended the result with such conservative information about them, to keep the code uniform, but that could blow up the amount of data passed around, even if only temporarily, and slowed things down. We now pass around an explicit list (well, set) of variable that are boring and take that into account whenever we use the result. Not as pretty, but noticably faster. >--------------------------------------------------------------- a9ca67f6bfb45d13944ba15452d3af613ec84d8b compiler/simplCore/CallArity.hs | 127 +++++++++++---------- testsuite/tests/callarity/unittest/CallArity1.hs | 5 + .../tests/callarity/unittest/CallArity1.stderr | 6 +- 3 files changed, 78 insertions(+), 60 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 a9ca67f6bfb45d13944ba15452d3af613ec84d8b From git at git.haskell.org Wed Apr 15 14:39:14 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Apr 2015 14:39:14 +0000 (UTC) Subject: [commit: ghc] wip/T10293: Call Arity: Trade precision for performance in large mutually recursive groups (2f3aa54) Message-ID: <20150415143914.1F00E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10293 Link : http://ghc.haskell.org/trac/ghc/changeset/2f3aa542cf9db37360925c27bd6646a1ce9dd852/ghc >--------------------------------------------------------------- commit 2f3aa542cf9db37360925c27bd6646a1ce9dd852 Author: Joachim Breitner Date: Wed Apr 15 16:25:13 2015 +0200 Call Arity: Trade precision for performance in large mutually recursive groups Sometimes (especial with derived Data instances, it seems), one can have very large mutually recursive bindings. Calculating the Call Arity analysis result with full precision is an expensive operation in these case. So above a certain threshold (25, for no good reason besides intuition), skip this calculation and assume the recursion is not linear, which is a conservative result. With this, the Call Arity analysis accounts for 3.7% of the compile time of haskell-src-exts. >--------------------------------------------------------------- 2f3aa542cf9db37360925c27bd6646a1ce9dd852 compiler/simplCore/CallArity.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/simplCore/CallArity.hs b/compiler/simplCore/CallArity.hs index 4e4555c..c2a5ad0 100644 --- a/compiler/simplCore/CallArity.hs +++ b/compiler/simplCore/CallArity.hs @@ -630,6 +630,9 @@ callArityRecEnv any_boring ae_rhss ae_body cross_calls -- See Note [Taking boring variables into account] | any_boring = completeGraph (domRes ae_combined) + -- Also, calculating cross_calls is expensive. Simply be conservative + -- if the mutually recursive group becomes too large. + | length ae_rhss > 25 = completeGraph (domRes ae_combined) | otherwise = unionUnVarGraphs $ map cross_call ae_rhss cross_call (v, ae_rhs) = completeBipartiteGraph called_by_v called_with_v where From git at git.haskell.org Wed Apr 15 14:39:16 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Apr 2015 14:39:16 +0000 (UTC) Subject: [commit: ghc] wip/T10293's head updated: Call Arity: Trade precision for performance in large mutually recursive groups (2f3aa54) Message-ID: <20150415143916.5E4B73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T10293' now includes: edc059a Fix autoconf's check for create_timer() a5745d2 Derive Generic instance for System.Exit.ExitCode c327393 Derive Generic instance for Data.Version.Version 6109b31 use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir 8aefc9b parser: opt_kind_sig has incorrect SrcSpan 9eab6fe parser: API Annotations : guardquals1 does not annotate commas properly 919b511 parser : the API annotation on opt_sig is being discarded d261d4c Zap usage info in CSE (Trac #10218) 25f2d68 Comments only a2ce3af Comments and white space only 7febc2b Add "error:" prefix to error-messages 79bfe27 Remove LlvmCodeGen panic variants. 8dc2944 API Annotations : ExprWithTySig processing discards annotated spans 5fded20 ApiAnnotations : lexer discards comment close in nested comment 6dd2765 Implement -f[no-]print-unicode-syntax flag for unicode syntax output (#8959) 7b042d5 Do not allow Typeable on constraints (Trac #9858) 49d9b00 Fix fundep coverage-condition check for poly-kinds a9ca67f Improve Call Arity performance 2f3aa54 Call Arity: Trade precision for performance in large mutually recursive groups From git at git.haskell.org Thu Apr 16 12:06:58 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Apr 2015 12:06:58 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T10293' deleted Message-ID: <20150416120658.0380F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/T10293 From git at git.haskell.org Thu Apr 16 12:07:00 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Apr 2015 12:07:00 +0000 (UTC) Subject: [commit: ghc] master: Call Arity: Trade precision for performance in large mutually recursive groups (9654a7c) Message-ID: <20150416120700.CC81C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9654a7cf8580bc3a027bf8b39c06d916050c446d/ghc >--------------------------------------------------------------- commit 9654a7cf8580bc3a027bf8b39c06d916050c446d Author: Joachim Breitner Date: Wed Apr 15 16:25:13 2015 +0200 Call Arity: Trade precision for performance in large mutually recursive groups Sometimes (especial with derived Data instances, it seems), one can have very large mutually recursive bindings. Calculating the Call Arity analysis result with full precision is an expensive operation in these case. So above a certain threshold (25, for no good reason besides intuition), skip this calculation and assume the recursion is not linear, which is a conservative result. With this, the Call Arity analysis accounts for 3.7% of the compile time of haskell-src-exts. Fixes #10293 Differential Revision: https://phabricator.haskell.org/D843 >--------------------------------------------------------------- 9654a7cf8580bc3a027bf8b39c06d916050c446d compiler/simplCore/CallArity.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/simplCore/CallArity.hs b/compiler/simplCore/CallArity.hs index 4e4555c..c2a5ad0 100644 --- a/compiler/simplCore/CallArity.hs +++ b/compiler/simplCore/CallArity.hs @@ -630,6 +630,9 @@ callArityRecEnv any_boring ae_rhss ae_body cross_calls -- See Note [Taking boring variables into account] | any_boring = completeGraph (domRes ae_combined) + -- Also, calculating cross_calls is expensive. Simply be conservative + -- if the mutually recursive group becomes too large. + | length ae_rhss > 25 = completeGraph (domRes ae_combined) | otherwise = unionUnVarGraphs $ map cross_call ae_rhss cross_call (v, ae_rhs) = completeBipartiteGraph called_by_v called_with_v where From git at git.haskell.org Thu Apr 16 12:07:03 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Apr 2015 12:07:03 +0000 (UTC) Subject: [commit: ghc] master's head updated: Call Arity: Trade precision for performance in large mutually recursive groups (9654a7c) Message-ID: <20150416120703.0A51F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'master' now includes: a9ca67f Improve Call Arity performance 9654a7c Call Arity: Trade precision for performance in large mutually recursive groups From git at git.haskell.org Thu Apr 16 16:47:32 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Apr 2015 16:47:32 +0000 (UTC) Subject: [commit: ghc] master: Add exception for `KnownNat` and `KnownSymbol` in super classes. (1fb4dd3) Message-ID: <20150416164732.EDD693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1fb4dd32406863c8cc745fb3d5da51fb390ea35a/ghc >--------------------------------------------------------------- commit 1fb4dd32406863c8cc745fb3d5da51fb390ea35a Author: Iavor S. Diatchki Date: Thu Apr 16 09:47:28 2015 -0700 Add exception for `KnownNat` and `KnownSymbol` in super classes. The situation is similar to `Typeable`---we can't set the evidence outside the solver because we have custom solving rules. This is safe because the computed super-class instances can't possibly depend on the new instance. >--------------------------------------------------------------- 1fb4dd32406863c8cc745fb3d5da51fb390ea35a compiler/typecheck/TcInstDcls.hs | 22 ++++++++++++++++---- .../should_compile/TcCustomSolverSuper.hs | 24 ++++++++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index b1a28c7..119998a 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -43,7 +43,8 @@ import Class import Var import VarEnv import VarSet -import PrelNames ( typeableClassName, genericClassNames ) +import PrelNames ( typeableClassName, genericClassNames + , knownNatClassName, knownSymbolClassName ) import Bag import BasicTypes import DynFlags @@ -1065,9 +1066,10 @@ tcSuperClasses dfun_id cls tyvars dfun_evs inst_tys dfun_ev_binds fam_envs sc_th | (sc_co, norm_sc_pred) <- normaliseType fam_envs Nominal sc_pred -- sc_co :: sc_pred ~ norm_sc_pred , ClassPred cls tys <- classifyPredType norm_sc_pred - , className cls /= typeableClassName - -- `Typeable` has custom solving rules, which is why we exclude it - -- from the short cut, and fall through to calling the solver. + , not (usesCustomSolver cls) + -- Some classes (e.g., `Typeable`, `KnownNat`) have custom solving + -- rules, which is why we exclude it from the short cut, + -- and fall through to calling the solver. = do { sc_ev_tm <- emit_sc_cls_pred norm_sc_pred cls tys ; sc_ev_id <- newEvVar sc_pred @@ -1109,6 +1111,18 @@ tcSuperClasses dfun_id cls tyvars dfun_evs inst_tys dfun_ev_binds fam_envs sc_th ; traceTc "tcSuperClass 3" (ppr sc_pred $$ ppr sc_ev) ; return (ctEvTerm sc_ev) } } + + +-- | Do we use a custom solver, which is safe to use when solving super-class +-- constraints. +usesCustomSolver :: Class -> Bool +usesCustomSolver cls = name == typeableClassName + || name == knownNatClassName + || name == knownSymbolClassName + where + name = className cls + + ------------------- checkInstConstraints :: (EvBindsVar -> TcM result) -> TcM (Implication, result) diff --git a/testsuite/tests/typecheck/should_compile/TcCustomSolverSuper.hs b/testsuite/tests/typecheck/should_compile/TcCustomSolverSuper.hs new file mode 100644 index 0000000..c401e1c --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/TcCustomSolverSuper.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleInstances #-} +module TcCustomSolverSuper where + +import GHC.TypeLits +import Data.Typeable + +{- + +When solving super-class instances, GHC solves the evidence without +using the solver (see `tcSuperClasses` in `TcInstDecls`). + +However, some classes need to be excepted from this behavior, +as they have custom solving rules, and this test checks that +we got this right. +-} + + +class (Typeable x, KnownNat x) => C x +class (Typeable x, KnownSymbol x) => D x + +instance C 2 +instance D "2" + diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index d7b3fad..e60fdc8 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -449,3 +449,4 @@ test('T10177', normal, compile, ['']) test('T10185', expect_broken(10185), compile, ['']) test('T10195', normal, compile, ['']) test('T10109', normal, compile, ['']) +test('TcCustomSolverSuper', normal, compile, ['']) From git at git.haskell.org Thu Apr 16 18:13:02 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Apr 2015 18:13:02 +0000 (UTC) Subject: [commit: ghc] master: Fixes (hopefully!) T9858 (d8d541d) Message-ID: <20150416181302.3D02F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d8d541d85defcf3bbbddaeee8cfac70b74f47ffc/ghc >--------------------------------------------------------------- commit d8d541d85defcf3bbbddaeee8cfac70b74f47ffc Author: Iavor S. Diatchki Date: Thu Apr 16 11:13:24 2015 -0700 Fixes (hopefully!) T9858 The changes are: 1. No impredicative types in `Typeable` 2. Distinguish normal tuples, from tuples of constraints. >--------------------------------------------------------------- d8d541d85defcf3bbbddaeee8cfac70b74f47ffc compiler/deSugar/DsBinds.hs | 6 +++- compiler/typecheck/TcInteract.hs | 34 +++++++++------------- testsuite/tests/typecheck/should_fail/T9858b.hs | 10 +++++++ .../tests/typecheck/should_fail/T9858b.stderr | 8 +++++ testsuite/tests/typecheck/should_fail/all.T | 1 + testsuite/tests/typecheck/should_run/T9858c.hs | 19 ++++++++++++ testsuite/tests/typecheck/should_run/T9858c.stdout | 1 + testsuite/tests/typecheck/should_run/all.T | 1 + 8 files changed, 58 insertions(+), 22 deletions(-) diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index 30b6c5a..42f4555 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -41,10 +41,11 @@ import Digraph import PrelNames import TysPrim ( mkProxyPrimTy ) import TyCon ( isTupleTyCon, tyConDataCons_maybe - , tyConName, isPromotedTyCon, isPromotedDataCon ) + , tyConName, isPromotedTyCon, isPromotedDataCon, tyConKind ) import TcEvidence import TcType import Type +import Kind (returnsConstraintKind) import Coercion hiding (substCo) import TysWiredIn ( eqBoxDataCon, coercibleDataCon, tupleCon, mkListTy , mkBoxedTupleTy, stringTy ) @@ -983,6 +984,9 @@ dsEvTypeable ev = hash_name_fs | isPromotedTyCon tc = appendFS (mkFastString "$k") name_fs | isPromotedDataCon tc = appendFS (mkFastString "$c") name_fs + | isTupleTyCon tc && + returnsConstraintKind (tyConKind tc) + = appendFS (mkFastString "$p") name_fs | otherwise = name_fs hashThis = unwords $ map unpackFS [pkg_fs, modl_fs, hash_name_fs] diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 271f973..2ccfcb1 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -14,7 +14,7 @@ import TcCanonical import TcFlatten import VarSet import Type -import Kind (isKind, isConstraintKind) +import Kind (isKind, isConstraintKind ) import Unify import InstEnv( DFunInstType, lookupInstEnv, instanceDFunId ) import CoAxiom(sfInteractTop, sfInteractInert) @@ -1846,10 +1846,14 @@ isCallStackIP _ _ _ -- | Assumes that we've checked that this is the 'Typeable' class, -- and it was applied to the correct argument. matchTypeableClass :: Class -> Kind -> Type -> CtLoc -> TcS LookupInstResult -matchTypeableClass clas k t loc +matchTypeableClass clas _k t loc + + -- See Note [No Typeable for qualified types] | isForAllTy t = return NoInstance - | isConstraintKind k = return NoInstance - -- See Note [No Typeable for qualified types] + -- Is the type of the form `C => t`? + | Just (t1,_) <- splitFunTy_maybe t, + isConstraintKind (typeKind t1) = return NoInstance + | Just (tc, ks) <- splitTyConApp_maybe t , all isKind ks = doTyCon tc ks | Just (f,kt) <- splitAppTy_maybe t = doTyApp f kt @@ -1902,8 +1906,6 @@ matchTypeableClass clas k t loc We do not support impredicative typeable, such as Typeable (forall a. a->a) Typeable (Eq a => a -> a) - Typeable (Eq a) - Typeable (() :: Constraint) Typeable (() => Int) Typeable (((),()) => Int) @@ -1914,19 +1916,9 @@ a TypeRep for them. For qualified but not polymorphic types, like * We don't need a TypeRep for these things. TypeReps are for monotypes only. - * The types (Eq a, Show a) => ...blah... - and Eq a => Show a => ...blah... - are represented the same way, as a curried function; - that is, the tuple before the '=>' is just syntactic - sugar. But since we can abstract over tuples of constraints, - we really do have tuples of constraints as well. - - This dichotomy is not well worked out, and Trac #9858 comment:76 - shows that Typeable treated it one way, while newtype instance - matching treated it another. Or maybe it was the fact that - '*' and Constraint are distinct to the type checker, but are - the same afterwards. Anyway, the result was a function of - type (forall ab. a -> b), which is pretty dire. - -So the simple solution is not to attempt Typable for constraints. + * Perhaps we could treat `=>` as another type constructor for `Typeable` + purposes, and thus support things like `Eq Int => Int`, however, + at the current state of affairs this would be an odd exception as + no other class works with impredicative types. + For now we leave it off, until we have a better story for impredicativity. -} diff --git a/testsuite/tests/typecheck/should_fail/T9858b.hs b/testsuite/tests/typecheck/should_fail/T9858b.hs new file mode 100644 index 0000000..643002f --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T9858b.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE ImpredicativeTypes #-} +{-# LANGUAGE FlexibleContexts #-} + +module T9858b where +import Data.Typeable + +test = typeRep (Proxy :: Proxy (Eq Int => Int)) + + + diff --git a/testsuite/tests/typecheck/should_fail/T9858b.stderr b/testsuite/tests/typecheck/should_fail/T9858b.stderr new file mode 100644 index 0000000..b57098e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T9858b.stderr @@ -0,0 +1,8 @@ + +T9858b.hs:7:8: error: + No instance for (Typeable (Eq Int => Int)) + (maybe you haven't applied a function to enough arguments?) + arising from a use of ?typeRep? + In the expression: typeRep (Proxy :: Proxy (Eq Int => Int)) + In an equation for ?test?: + test = typeRep (Proxy :: Proxy (Eq Int => Int)) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index ac91670..7147a26 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -357,3 +357,4 @@ test('T9999', normal, compile_fail, ['']) test('T10194', normal, compile_fail, ['']) test('T8030', normal, compile_fail, ['']) test('T9858a', normal, compile_fail, ['']) +test('T9858b', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_run/T9858c.hs b/testsuite/tests/typecheck/should_run/T9858c.hs new file mode 100644 index 0000000..7120715 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T9858c.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE KindSignatures #-} +module Main(main) where + +import Data.Typeable +import GHC.Exts + +test1 :: Bool +test1 = typeRep (Proxy :: Proxy (() :: *)) == + typeRep (Proxy :: Proxy (() :: Constraint)) + +test2 :: Bool +test2 = typeRepTyCon (typeRep (Proxy :: Proxy (Int,Int))) == + typeRepTyCon (typeRep (Proxy :: Proxy (Eq Int, Eq Int))) + +main :: IO () +main = print (test1,test2) + + + diff --git a/testsuite/tests/typecheck/should_run/T9858c.stdout b/testsuite/tests/typecheck/should_run/T9858c.stdout new file mode 100644 index 0000000..78a8f06 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T9858c.stdout @@ -0,0 +1 @@ +(False,False) diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 4868db3..ca1058d 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -117,3 +117,4 @@ test('T9497a-run', [exit_code(1)], compile_and_run, ['-fdefer-typed-holes']) test('T9497b-run', [exit_code(1)], compile_and_run, ['-fdefer-typed-holes -fno-warn-typed-holes']) test('T9497c-run', [exit_code(1)], compile_and_run, ['-fdefer-type-errors -fno-warn-typed-holes']) test('T9858b', normal, compile_and_run, ['']) +test('T9858c', normal, compile_and_run, ['']) From git at git.haskell.org Thu Apr 16 19:40:47 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Apr 2015 19:40:47 +0000 (UTC) Subject: [commit: ghc] master: Fix test output. (e68e8ca) Message-ID: <20150416194047.103EC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e68e8ca1371ae8ba3880e15b921a8413fdfdb84c/ghc >--------------------------------------------------------------- commit e68e8ca1371ae8ba3880e15b921a8413fdfdb84c Author: Iavor S. Diatchki Date: Thu Apr 16 12:41:16 2015 -0700 Fix test output. >--------------------------------------------------------------- e68e8ca1371ae8ba3880e15b921a8413fdfdb84c testsuite/tests/typecheck/should_fail/T9858a.stderr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_fail/T9858a.stderr b/testsuite/tests/typecheck/should_fail/T9858a.stderr index 72b72e9..2f815b1 100644 --- a/testsuite/tests/typecheck/should_fail/T9858a.stderr +++ b/testsuite/tests/typecheck/should_fail/T9858a.stderr @@ -1,6 +1,8 @@ T9858a.hs:28:18: error: - No instance for (Typeable (() :: Constraint)) + No instance for (Typeable + (((() :: Constraint), (() :: Constraint)) => ())) + (maybe you haven't applied a function to enough arguments?) arising from a use of ?cast? In the expression: cast e In the expression: case cast e of { Just e' -> ecast e' } From git at git.haskell.org Thu Apr 16 19:44:31 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Apr 2015 19:44:31 +0000 (UTC) Subject: [commit: ghc] master: Fix test output (ea579d9) Message-ID: <20150416194431.439313A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ea579d9e4ae91bda93f692e110de0a97b9dda6f7/ghc >--------------------------------------------------------------- commit ea579d9e4ae91bda93f692e110de0a97b9dda6f7 Author: Iavor S. Diatchki Date: Thu Apr 16 12:45:01 2015 -0700 Fix test output >--------------------------------------------------------------- ea579d9e4ae91bda93f692e110de0a97b9dda6f7 testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr index 85b988a..84e0862 100644 --- a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr +++ b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr @@ -1,12 +1,12 @@ -TcStaticPointersFail02.hs:9:6: +TcStaticPointersFail02.hs:9:6: error: No instance for (Typeable b) arising from a static form In the expression: static (undefined :: (forall a. a -> a) -> b) In an equation for ?f1?: f1 = static (undefined :: (forall a. a -> a) -> b) -TcStaticPointersFail02.hs:12:6: - No instance for (Typeable m) +TcStaticPointersFail02.hs:12:6: error: + No instance for (Typeable (Monad m => a -> m a)) (maybe you haven't applied a function to enough arguments?) arising from a static form In the expression: static return From git at git.haskell.org Thu Apr 16 21:28:38 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Apr 2015 21:28:38 +0000 (UTC) Subject: [commit: ghc] master: Rename tests so that they have a unique name. (3b90d8c) Message-ID: <20150416212838.411FB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3b90d8c8cfb4f56cec3eb5e1ede12c22a9e28d79/ghc >--------------------------------------------------------------- commit 3b90d8c8cfb4f56cec3eb5e1ede12c22a9e28d79 Author: Iavor S. Diatchki Date: Thu Apr 16 14:29:07 2015 -0700 Rename tests so that they have a unique name. >--------------------------------------------------------------- 3b90d8c8cfb4f56cec3eb5e1ede12c22a9e28d79 testsuite/tests/typecheck/should_run/{T9858b.hs => T9858d.hs} | 0 testsuite/tests/typecheck/should_run/{T9858b.stdout => T9858d.stdout} | 0 testsuite/tests/typecheck/should_run/all.T | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_run/T9858b.hs b/testsuite/tests/typecheck/should_run/T9858d.hs similarity index 100% rename from testsuite/tests/typecheck/should_run/T9858b.hs rename to testsuite/tests/typecheck/should_run/T9858d.hs diff --git a/testsuite/tests/typecheck/should_run/T9858b.stdout b/testsuite/tests/typecheck/should_run/T9858d.stdout similarity index 100% rename from testsuite/tests/typecheck/should_run/T9858b.stdout rename to testsuite/tests/typecheck/should_run/T9858d.stdout diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index ca1058d..9cf7a80 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -116,5 +116,5 @@ test('T8739', normal, compile_and_run, ['']) test('T9497a-run', [exit_code(1)], compile_and_run, ['-fdefer-typed-holes']) test('T9497b-run', [exit_code(1)], compile_and_run, ['-fdefer-typed-holes -fno-warn-typed-holes']) test('T9497c-run', [exit_code(1)], compile_and_run, ['-fdefer-type-errors -fno-warn-typed-holes']) -test('T9858b', normal, compile_and_run, ['']) test('T9858c', normal, compile_and_run, ['']) +test('T9858d', normal, compile_and_run, ['']) From git at git.haskell.org Fri Apr 17 02:50:56 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Apr 2015 02:50:56 +0000 (UTC) Subject: [commit: ghc] master: Better hints when RTS options not available (Trac #9579) (51af102) Message-ID: <20150417025056.730D23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/51af102e5c6c56e0987432aa5a21fe10e24090e9/ghc >--------------------------------------------------------------- commit 51af102e5c6c56e0987432aa5a21fe10e24090e9 Author: Javran Cheng Date: Fri Apr 17 10:52:00 2015 +1000 Better hints when RTS options not available (Trac #9579) This patch provides user with a better hint when most RTS options are not available (not compiled with `-rtsopts`). A new field "rtsOptsEnabled" is added into RtsFlags.MiscFlags to tell the availablity of RTS options. Some concerns: * Unlike other flag fields in "libraries/base/GHC/RTS/Flags.hsc", "RtsOptsEnabled" is defined in "includes/RtsAPI.h" and lacks constant macros. Therefore In "GHC.RTS", "RtsOptsEnabled" simply derives Enum instance and reads as of type "CInt". * There are other ways to change RTS options (e.g. `-with-rtsopts`), but it might be too verbose to mention. Test Plan: validate Reviewers: austin, hvr, thomie, simonmar Reviewed By: thomie Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D767 GHC Trac Issues: #9579 >--------------------------------------------------------------- 51af102e5c6c56e0987432aa5a21fe10e24090e9 rts/ProfHeap.c | 9 ++++++- rts/hooks/OutOfHeap.c | 14 +++++++---- rts/hooks/StackOverflow.c | 10 +++++++- testsuite/tests/rts/T9579/Makefile | 27 ++++++++++++++++++++ testsuite/tests/rts/T9579/OutOfHeap.hs | 10 ++++++++ testsuite/tests/rts/T9579/StackOverflow.hs | 4 +++ .../T9579/T9579_outofheap_rtsall.stderr} | 2 +- .../tests/rts/T9579/T9579_outofheap_rtsnone.stderr | 3 +++ .../tests/rts/T9579/T9579_outofheap_rtssome.stderr | 3 +++ .../rts/T9579/T9579_stackoverflow_rtsall.stderr | 2 ++ .../rts/T9579/T9579_stackoverflow_rtsnone.stderr | 2 ++ .../rts/T9579/T9579_stackoverflow_rtssome.stderr | 2 ++ testsuite/tests/rts/T9579/all.T | 29 ++++++++++++++++++++++ 13 files changed, 109 insertions(+), 8 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 51af102e5c6c56e0987432aa5a21fe10e24090e9 From git at git.haskell.org Fri Apr 17 03:22:32 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Apr 2015 03:22:32 +0000 (UTC) Subject: [commit: packages/haskeline] master: Linux to Windows cross-compile fix (Trac #10273) (e9157f4) Message-ID: <20150417032232.39AC03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/e9157f484fae8964baf8164d220650f64f693b47 >--------------------------------------------------------------- commit e9157f484fae8964baf8164d220650f64f693b47 Author: Erik de Castro Lopo Date: Sat Apr 11 18:13:55 2015 +1000 Linux to Windows cross-compile fix (Trac #10273) The #include of doesn't work when cross-compiling from Linux to Windows because the Linux file system is case sensitive and on Linux the file is . This change does not affect Windows builds because the Windows file system is case insensitive (this change has been built and tested on Windows). Signed-off-by: Erik de Castro Lopo >--------------------------------------------------------------- e9157f484fae8964baf8164d220650f64f693b47 System/Console/Haskeline/Directory.hsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/Console/Haskeline/Directory.hsc b/System/Console/Haskeline/Directory.hsc index b2deb22..9eb0952 100644 --- a/System/Console/Haskeline/Directory.hsc +++ b/System/Console/Haskeline/Directory.hsc @@ -19,7 +19,7 @@ import qualified System.Directory #endif #include -#include +#include ##if defined(i386_HOST_ARCH) ## define WINDOWS_CCONV stdcall From git at git.haskell.org Fri Apr 17 10:10:22 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Apr 2015 10:10:22 +0000 (UTC) Subject: [commit: ghc] master: Documentation for rnImports/rnImportDecl. (2483644) Message-ID: <20150417101022.40FAC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2483644374373f078826bf463f47152e0520f62b/ghc >--------------------------------------------------------------- commit 2483644374373f078826bf463f47152e0520f62b Author: Edward Z. Yang Date: Thu Apr 2 20:59:07 2015 -0700 Documentation for rnImports/rnImportDecl. Signed-off-by: Edward Z. Yang Test Plan: comments only Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D816 >--------------------------------------------------------------- 2483644374373f078826bf463f47152e0520f62b compiler/rename/RnNames.hs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index 102deb0..5541e8b 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -136,9 +136,10 @@ trust network' to get everything working. Due to this invasive nature of going with yes we have gone with no for now. -} --- | Process Import Decls --- Do the non SOURCE ones first, so that we get a helpful warning for SOURCE --- ones that are unnecessary +-- | Process Import Decls. See 'rnImportDecl' for a description of what +-- the return types represent. +-- Note: Do the non SOURCE ones first, so that we get a helpful warning +-- for SOURCE ones that are unnecessary rnImports :: [LImportDecl RdrName] -> RnM ([LImportDecl Name], GlobalRdrEnv, ImportAvails, AnyHpcUsage) rnImports imports = do @@ -163,6 +164,21 @@ rnImports imports = do imp_avails1 `plusImportAvails` imp_avails2, hpc_usage1 || hpc_usage2 ) +-- | Given a located import declaration @decl@ from @this_mod@, +-- calculate the following pieces of information: +-- +-- 1. An updated 'LImportDecl', where all unresolved 'RdrName' in +-- the entity lists have been resolved into 'Name's, +-- +-- 2. A 'GlobalRdrEnv' representing the new identifiers that were +-- brought into scope (taking into account module qualification +-- and hiding), +-- +-- 3. 'ImportAvails' summarizing the identifiers that were imported +-- by this declaration, and +-- +-- 4. A boolean 'AnyHpcUsage' which is true if the imported module +-- used HPC. rnImportDecl :: Module -> LImportDecl RdrName -> RnM (LImportDecl Name, GlobalRdrEnv, ImportAvails, AnyHpcUsage) rnImportDecl this_mod From git at git.haskell.org Fri Apr 17 10:10:24 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Apr 2015 10:10:24 +0000 (UTC) Subject: [commit: ghc] master: Comments only. (2b3766b) Message-ID: <20150417101024.EE3B33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2b3766b59f58ad12e86b11ef0322ab0bcc490e52/ghc >--------------------------------------------------------------- commit 2b3766b59f58ad12e86b11ef0322ab0bcc490e52 Author: Edward Z. Yang Date: Tue Apr 7 13:38:52 2015 -0700 Comments only. Signed-off-by: Edward Z. Yang Test Plan: comments only Reviewers: simonpj, austin, goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D820 >--------------------------------------------------------------- 2b3766b59f58ad12e86b11ef0322ab0bcc490e52 compiler/typecheck/TcRnTypes.hs | 3 +++ compiler/types/TypeRep.hs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 0cc0663..0d42334 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -796,6 +796,9 @@ data ArrowCtxt -- Note [Escaping the arrow scope] -- TcTyThing --------------------------- +-- | A typecheckable thing available in a local context. Could be +-- 'AGlobal' 'TyThing', but also lexically scoped variables, etc. +-- See 'TcEnv' for how to retrieve a 'TyThing' given a 'Name'. data TcTyThing = AGlobal TyThing -- Used only in the return type of a lookup diff --git a/compiler/types/TypeRep.hs b/compiler/types/TypeRep.hs index 8ed07c1..c91ddda 100644 --- a/compiler/types/TypeRep.hs +++ b/compiler/types/TypeRep.hs @@ -352,7 +352,10 @@ as ATyCon. You can tell the difference, and get to the class, with The Class and its associated TyCon have the same Name. -} --- | A typecheckable-thing, essentially anything that has a name +-- | A global typecheckable-thing, essentially anything that has a name. +-- Not to be confused with a 'TcTyThing', which is also a typecheckable +-- thing but in the *local* context. See 'TcEnv' for how to retrieve +-- a 'TyThing' given a 'Name'. data TyThing = AnId Id | AConLike ConLike From git at git.haskell.org Fri Apr 17 10:10:27 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Apr 2015 10:10:27 +0000 (UTC) Subject: [commit: ghc] master: Stub out pkgState with non-error, helps with debugging. (ad6d6a7) Message-ID: <20150417101027.A146B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad6d6a76eeeb9e33a96054f18c1306e9ebafa652/ghc >--------------------------------------------------------------- commit ad6d6a76eeeb9e33a96054f18c1306e9ebafa652 Author: Edward Z. Yang Date: Mon Apr 6 11:32:14 2015 -0700 Stub out pkgState with non-error, helps with debugging. Summary: When we use -dppr-debug, we'll sometimes attempt to hit the pkgState to give more detailed information. It's pretty annoying to have this fail because we haven't filled in the pkgState: we can still get useful debugging information by printing the raw package key. To avoid this, we just put in some empty stub pkgState, to be filled in later. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D817 >--------------------------------------------------------------- ad6d6a76eeeb9e33a96054f18c1306e9ebafa652 compiler/main/DynFlags.hs | 5 +++-- compiler/main/Packages.hs | 9 +++++++++ compiler/main/Packages.hs-boot | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 446381e..094984b 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -157,7 +157,7 @@ import Module import PackageConfig import {-# SOURCE #-} Hooks import {-# SOURCE #-} PrelNames ( mAIN ) -import {-# SOURCE #-} Packages (PackageState) +import {-# SOURCE #-} Packages (PackageState, emptyPackageState) import DriverPhases ( Phase(..), phaseInputExt ) import Config import CmdLineParser @@ -1480,7 +1480,8 @@ defaultDynFlags mySettings = packageFlags = [], packageEnv = Nothing, pkgDatabase = Nothing, - pkgState = panic "no package state yet: call GHC.setSessionDynFlags", + -- This gets filled in with GHC.setSessionDynFlags + pkgState = emptyPackageState, ways = defaultWays mySettings, buildTag = mkBuildTag (defaultWays mySettings), rtsBuildTag = mkBuildTag (defaultWays mySettings), diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 985a11a..16ee352 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -8,6 +8,7 @@ module Packages ( -- * Reading the package config, and processing cmdline args PackageState(preloadPackages), + emptyPackageState, initPackages, readPackageConfigs, getPackageConfRefs, @@ -287,6 +288,14 @@ data PackageState = PackageState { installedPackageIdMap :: InstalledPackageIdMap } +emptyPackageState :: PackageState +emptyPackageState = PackageState { + pkgIdMap = emptyUFM, + preloadPackages = [], + moduleNameDb = Map.empty, + installedPackageIdMap = Map.empty + } + type InstalledPackageIdMap = Map InstalledPackageId PackageKey type InstalledPackageIndex = Map InstalledPackageId PackageConfig diff --git a/compiler/main/Packages.hs-boot b/compiler/main/Packages.hs-boot index f2343b6..bac04bc 100644 --- a/compiler/main/Packages.hs-boot +++ b/compiler/main/Packages.hs-boot @@ -4,3 +4,4 @@ import {-# SOURCE #-} Module (PackageKey) import {-# SOURCE #-} DynFlags (DynFlags) data PackageState packageKeyPackageIdString :: DynFlags -> PackageKey -> Maybe String +emptyPackageState :: PackageState From git at git.haskell.org Fri Apr 17 10:14:35 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Apr 2015 10:14:35 +0000 (UTC) Subject: [commit: ghc] master: Make T9579 parallel-safe and add build outputs to .gitignore (619a324) Message-ID: <20150417101435.0FBFD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/619a324ed6a35708e4a3746f48c23b4f294e82df/ghc >--------------------------------------------------------------- commit 619a324ed6a35708e4a3746f48c23b4f294e82df Author: Edward Z. Yang Date: Fri Apr 17 03:14:41 2015 -0700 Make T9579 parallel-safe and add build outputs to .gitignore Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 619a324ed6a35708e4a3746f48c23b4f294e82df testsuite/tests/rts/T9579/.gitignore | 6 ++++++ testsuite/tests/rts/T9579/Makefile | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/testsuite/tests/rts/T9579/.gitignore b/testsuite/tests/rts/T9579/.gitignore new file mode 100644 index 0000000..e3a88e5 --- /dev/null +++ b/testsuite/tests/rts/T9579/.gitignore @@ -0,0 +1,6 @@ +T9579_outofheap_rtsall +T9579_outofheap_rtsnone +T9579_outofheap_rtssome +T9579_stackoverflow_rtsall +T9579_stackoverflow_rtsnone +T9579_stackoverflow_rtssome diff --git a/testsuite/tests/rts/T9579/Makefile b/testsuite/tests/rts/T9579/Makefile index b970047..a205eac 100644 --- a/testsuite/tests/rts/T9579/Makefile +++ b/testsuite/tests/rts/T9579/Makefile @@ -4,24 +4,30 @@ include $(TOP)/mk/test.mk T9579_stackoverflow_rtsnone: '$(TEST_HC)' $(TEST_HC_OPTS) -rtsopts=none -fforce-recomp -with-rtsopts -K1m \ + -outputdir tmp_T9579_stackoverflow_rtsnone \ StackOverflow.hs -o T9579_stackoverflow_rtsnone T9579_stackoverflow_rtssome: '$(TEST_HC)' $(TEST_HC_OPTS) -rtsopts=some -fforce-recomp -with-rtsopts -K1m \ + -outputdir tmp_T9579_stackoverflow_rtssome \ StackOverflow.hs -o T9579_stackoverflow_rtssome T9579_stackoverflow_rtsall: '$(TEST_HC)' $(TEST_HC_OPTS) -rtsopts=all -fforce-recomp -with-rtsopts -K1m \ + -outputdir tmp_T9579_stackoverflow_rtsall \ StackOverflow.hs -o T9579_stackoverflow_rtsall T9579_outofheap_rtsnone: '$(TEST_HC)' $(TEST_HC_OPTS) -rtsopts=none -fforce-recomp -with-rtsopts -M1m \ + -outputdir tmp_T9579_outofheap_rtsnone \ OutOfHeap.hs -o T9579_outofheap_rtsnone T9579_outofheap_rtssome: '$(TEST_HC)' $(TEST_HC_OPTS) -rtsopts=some -fforce-recomp -with-rtsopts -M1m \ + -outputdir tmp_T9579_outofheap_rtssome \ OutOfHeap.hs -o T9579_outofheap_rtssome T9579_outofheap_rtsall: '$(TEST_HC)' $(TEST_HC_OPTS) -rtsopts=all -fforce-recomp -with-rtsopts -M1m \ + -outputdir tmp_T9579_outofheap_rtsall \ OutOfHeap.hs -o T9579_outofheap_rtsall From git at git.haskell.org Sat Apr 18 18:05:24 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Apr 2015 18:05:24 +0000 (UTC) Subject: [commit: ghc] master: Test case for indirect dependencies in ghci linker (#10322) (88b8406) Message-ID: <20150418180524.8D34D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/88b84063c11a48820011805a8341d95f7fcd59db/ghc >--------------------------------------------------------------- commit 88b84063c11a48820011805a8341d95f7fcd59db Author: Reid Barton Date: Wed Apr 15 16:46:47 2015 -0400 Test case for indirect dependencies in ghci linker (#10322) >--------------------------------------------------------------- 88b84063c11a48820011805a8341d95f7fcd59db testsuite/tests/ghci/scripts/T10322.script | 5 +++++ testsuite/tests/ghci/scripts/{T8696.stdout => T10322.stdout} | 1 + testsuite/tests/ghci/scripts/{T8696A.hs => T10322A.hs} | 2 +- testsuite/tests/ghci/scripts/T10322B.hs | 4 ++++ testsuite/tests/ghci/scripts/T10322C.hs | 5 +++++ testsuite/tests/ghci/scripts/all.T | 2 ++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/ghci/scripts/T10322.script b/testsuite/tests/ghci/scripts/T10322.script new file mode 100644 index 0000000..75f2a39 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10322.script @@ -0,0 +1,5 @@ +:set -fobject-code +:load T10322A T10322B T10322C +T10322A.a +T10322B.b +T10322C.c diff --git a/testsuite/tests/ghci/scripts/T8696.stdout b/testsuite/tests/ghci/scripts/T10322.stdout similarity index 66% copy from testsuite/tests/ghci/scripts/T8696.stdout copy to testsuite/tests/ghci/scripts/T10322.stdout index b944734..de9da6d 100644 --- a/testsuite/tests/ghci/scripts/T8696.stdout +++ b/testsuite/tests/ghci/scripts/T10322.stdout @@ -1,2 +1,3 @@ 3 4 +7 diff --git a/testsuite/tests/ghci/scripts/T8696A.hs b/testsuite/tests/ghci/scripts/T10322A.hs similarity index 57% copy from testsuite/tests/ghci/scripts/T8696A.hs copy to testsuite/tests/ghci/scripts/T10322A.hs index 465af37..ba01fd2 100644 --- a/testsuite/tests/ghci/scripts/T8696A.hs +++ b/testsuite/tests/ghci/scripts/T10322A.hs @@ -1,4 +1,4 @@ -module T8696A (a) where +module T10322A (a) where {-# NOINLINE a #-} a :: Int a = 3 diff --git a/testsuite/tests/ghci/scripts/T10322B.hs b/testsuite/tests/ghci/scripts/T10322B.hs new file mode 100644 index 0000000..aa0b73a --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10322B.hs @@ -0,0 +1,4 @@ +module T10322B (b) where +import T10322A (a) +b :: Int +b = a+1 diff --git a/testsuite/tests/ghci/scripts/T10322C.hs b/testsuite/tests/ghci/scripts/T10322C.hs new file mode 100644 index 0000000..b6ad6e9 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10322C.hs @@ -0,0 +1,5 @@ +module T10322C (c) where +import T10322A (a) +import T10322B (b) +c :: Int +c = a+b diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index b97eede..01de663 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -207,3 +207,5 @@ test('T9878b', extra_clean(['T9878b.hi','T9878b.o'])], ghci_script, ['T9878b.script']) test('T10122', normal, ghci_script, ['T10122.script']) +test('T10322', when(opsys('darwin'), expect_broken(10322)), + ghci_script, ['T10322.script']) From git at git.haskell.org Mon Apr 20 11:31:29 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Apr 2015 11:31:29 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T9020' created Message-ID: <20150420113129.17B0B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T9020 Referencing: ea40430343ee07e1bdc6ee948d7a27aa65dbf936 From git at git.haskell.org Mon Apr 20 11:31:31 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Apr 2015 11:31:31 +0000 (UTC) Subject: [commit: ghc] wip/T9020: Do not eta-expand in SimplGentl (ea40430) Message-ID: <20150420113131.D37383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T9020 Link : http://ghc.haskell.org/trac/ghc/changeset/ea40430343ee07e1bdc6ee948d7a27aa65dbf936/ghc >--------------------------------------------------------------- commit ea40430343ee07e1bdc6ee948d7a27aa65dbf936 Author: Joachim Breitner Date: Fri Apr 17 16:00:50 2015 +0200 Do not eta-expand in SimplGentl Eta-expansion can seriously blow up the size of the code, if there are newtypes and coercions involved; see #9020 for a particularly good example. It may work out well in a full simplifier phase, when the additional coercions can be optimized away, e.g. after inlining. But the gentle phase does less, in particular no inlining, so chances are high that we will blow up our code for on good reason. If this change works out, there is no need for #10319 anymore. >--------------------------------------------------------------- ea40430343ee07e1bdc6ee948d7a27aa65dbf936 compiler/simplCore/SimplCore.hs | 19 ++++++++++++++++--- compiler/simplCore/SimplUtils.hs | 36 ++++++------------------------------ 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 0fd929a..38ba186 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -179,9 +179,11 @@ getCoreToDo dflags , sm_names = ["Gentle"] , sm_rules = rules_on -- Note [RULEs enabled in SimplGently] , sm_inline = False - , sm_case_case = False }) - -- Don't do case-of-case transformations. - -- This makes full laziness work better + , sm_case_case = False + -- Don't do case-of-case transformations. + -- This makes full laziness work better + , sm_eta_expand = False}) + -- Note [Do not eta-expand in SimplGently] -- New demand analyser demand_analyser = (CoreDoPasses ([ @@ -946,3 +948,14 @@ transferIdInfo exported_id local_id (specInfo local_info) -- Remember to set the function-name field of the -- rules as we transfer them from one function to another + +-- Note [Do not eta-expand in SimplGently] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- +-- Eta-expansion can seriously blow up the size of the code, if there are +-- newtypes and coercions involved; see #9020 for a particularly good example. +-- +-- It may work out well in a full simplifier phase, when the additional +-- coercions can be optimized away, e.g. after inlining. But the gentle phase +-- does less, in particular no inlining, so chances are high that we will blow +-- up our code for on good reason. diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 4c469d1..777eae2 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -1273,7 +1273,7 @@ tryEtaExpandRhs env bndr rhs ; WARN( new_arity < old_id_arity, (ptext (sLit "Arity decrease:") <+> (ppr bndr <+> ppr old_id_arity - <+> ppr old_arity <+> ppr new_arity) $$ ppr new_rhs) ) + <+> ppr old_manifest_arity <+> ppr new_arity) $$ ppr new_rhs) ) -- Note [Arity decrease] in Simplify return (new_arity, new_rhs) } where @@ -1282,17 +1282,17 @@ tryEtaExpandRhs env bndr rhs = return (exprArity rhs, rhs) | sm_eta_expand (getMode env) -- Provided eta-expansion is on - , let new_arity1 = findRhsArity dflags bndr rhs old_arity + , let new_arity1 = findRhsArity dflags bndr rhs old_manifest_arity new_arity2 = idCallArity bndr new_arity = max new_arity1 new_arity2 - , new_arity > old_arity -- And the current manifest arity isn't enough + , new_arity > old_manifest_arity -- And the current manifest arity isn't enough = do { tick (EtaExpansion bndr) ; return (new_arity, etaExpand new_arity rhs) } | otherwise - = return (old_arity, rhs) + = return (old_manifest_arity, rhs) - old_arity = exprArity rhs -- See Note [Do not expand eta-expand PAPs] - old_id_arity = idArity bndr + old_manifest_arity = manifestArity rhs + old_id_arity = idArity bndr {- Note [Eta-expanding at let bindings] @@ -1319,30 +1319,6 @@ because then 'genMap' will inline, and it really shouldn't: at least as far as the programmer is concerned, it's not applied to two arguments! -Note [Do not eta-expand PAPs] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We used to have old_arity = manifestArity rhs, which meant that we -would eta-expand even PAPs. But this gives no particular advantage, -and can lead to a massive blow-up in code size, exhibited by Trac #9020. -Suppose we have a PAP - foo :: IO () - foo = returnIO () -Then we can eta-expand do - foo = (\eta. (returnIO () |> sym g) eta) |> g -where - g :: IO () ~ State# RealWorld -> (# State# RealWorld, () #) - -But there is really no point in doing this, and it generates masses of -coercions and whatnot that eventually disappear again. For T9020, GHC -allocated 6.6G beore, and 0.8G afterwards; and residency dropped from -1.8G to 45M. - -But note that this won't eta-expand, say - f = \g -> map g -Does it matter not eta-expanding such functions? I'm not sure. Perhaps -strictness analysis will have less to bite on? - - ************************************************************************ * * \subsection{Floating lets out of big lambdas} From git at git.haskell.org Mon Apr 20 15:00:30 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Apr 2015 15:00:30 +0000 (UTC) Subject: [commit: ghc] master: Update Cabal submodule to 1.22.3.0 release (4bc925a) Message-ID: <20150420150030.C946A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4bc925a67285a71ddd14642e218d85de83bc214a/ghc >--------------------------------------------------------------- commit 4bc925a67285a71ddd14642e218d85de83bc214a Author: Herbert Valerio Riedel Date: Mon Apr 20 16:19:53 2015 +0200 Update Cabal submodule to 1.22.3.0 release Highlights since 1.22.2.0: - cabal check will fail on -fprof-auto passed as a ghc-option - filterConfigureFlags: filter more flags. - fix ghcjs-pkg version number handling Addresses #10304 >--------------------------------------------------------------- 4bc925a67285a71ddd14642e218d85de83bc214a libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index 5386dd5..bda1ce6 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 5386dd5c167a7fe7c3d17ba93803e1f477360df3 +Subproject commit bda1ce6b757cdaca93f2eba4e1906a4658719537 From git at git.haskell.org Tue Apr 21 08:18:19 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Apr 2015 08:18:19 +0000 (UTC) Subject: [commit: ghc] master: Teach DmdAnal that coercions are value arguments! (d5773a4) Message-ID: <20150421081819.C73C43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d5773a4939b1feea51ec0db6624c9462751e948a/ghc >--------------------------------------------------------------- commit d5773a4939b1feea51ec0db6624c9462751e948a Author: Simon Peyton Jones Date: Mon Apr 20 15:43:32 2015 +0100 Teach DmdAnal that coercions are value arguments! The demand analyser was treating coercion args like type args, which meant that the arguments in a strictness signature got out of step with the arguments of a call. Result chaos and disaster. Trac #10288 showed it up. It's hard to get this bug to show up in practice because - functions abstracted over coercions are usually abstracted over *boxed* coercions - we don't currently unbox a boxed-coercion arg because it's GADT (I see how to fix this too) But after floating, optimisation, and so on, Trac #10288 did get a function abstracted over an unboxed coercion, and then the -flate-dmd-anal pass went wrong. I don't think I can come up with a test case, but I don't think it matters too much. Still to come - Fix a second bug, namely that coercion variables are wrongly marked as absent because DmdAnal doesn't check the the free variables of casts. I think this never bites in practice (see the follow-up commit) - Make GADT products work with strictness analysis >--------------------------------------------------------------- d5773a4939b1feea51ec0db6624c9462751e948a compiler/stranal/DmdAnal.hs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index bf6ca7d..2520f2a 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -164,15 +164,13 @@ dmdAnal' env dmd (App fun (Type ty)) where (fun_ty, fun') = dmdAnal env dmd fun -dmdAnal' sigs dmd (App fun (Coercion co)) - = (fun_ty, App fun' (Coercion co)) - where - (fun_ty, fun') = dmdAnal sigs dmd fun - -- Lots of the other code is there to make this -- beautiful, compositional, application rule :-) -dmdAnal' env dmd (App fun arg) -- Non-type arguments - = let -- [Type arg handled above] +dmdAnal' env dmd (App fun arg) + = -- This case handles value arguments (type args handled above) + -- Crucially, coercions /are/ handled here, because they are + -- value arguments (Trac #10288) + = let call_dmd = mkCallDmd dmd (fun_ty, fun') = dmdAnal env call_dmd fun (arg_dmd, res_ty) = splitDmdTy fun_ty From git at git.haskell.org Tue Apr 21 08:18:22 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Apr 2015 08:18:22 +0000 (UTC) Subject: [commit: ghc] master: Teach DmdAnal about free coercion variables (3bec1ac) Message-ID: <20150421081822.9CE753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3bec1ac0117d4c46b2cc5012dca9a07d481137be/ghc >--------------------------------------------------------------- commit 3bec1ac0117d4c46b2cc5012dca9a07d481137be Author: Simon Peyton Jones Date: Mon Apr 20 15:57:54 2015 +0100 Teach DmdAnal about free coercion variables Coercion variables are used in casts and coercions, so the demand analyser should jolly well not regard them as absent! In fact this bug never makes a difference because even absent unboxed-coercion arguments are passed anyway; see WwLib.mk_abesnt_let, which returns Nothing for coercion Ids. But it was simply wrong before and that is never cool. >--------------------------------------------------------------- 3bec1ac0117d4c46b2cc5012dca9a07d481137be compiler/stranal/DmdAnal.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 2520f2a..4117eae 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -27,6 +27,7 @@ import Id import CoreUtils ( exprIsHNF, exprType, exprIsTrivial ) import TyCon import Type +import Coercion ( Coercion, coVarsOfCo ) import FamInstEnv import Util import Maybes ( isJust ) @@ -131,13 +132,14 @@ dmdAnal env d e = -- pprTrace "dmdAnal" (ppr d <+> ppr e) $ dmdAnal' _ _ (Lit lit) = (nopDmdType, Lit lit) dmdAnal' _ _ (Type ty) = (nopDmdType, Type ty) -- Doesn't happen, in fact -dmdAnal' _ _ (Coercion co) = (nopDmdType, Coercion co) +dmdAnal' _ _ (Coercion co) + = (unitDmdType (coercionDmdEnv co), Coercion co) dmdAnal' env dmd (Var var) = (dmdTransform env var dmd, Var var) dmdAnal' env dmd (Cast e co) - = (dmd_ty, Cast e' co) + = (dmd_ty `bothDmdType` mkBothDmdArg (coercionDmdEnv co), Cast e' co) where (dmd_ty, e') = dmdAnal env dmd e @@ -504,7 +506,7 @@ dmdTransform env var dmd else addVarDmd fn_ty var (mkOnceUsedDmd dmd) | otherwise -- Local non-letrec-bound thing - = unitVarDmd var (mkOnceUsedDmd dmd) + = unitDmdType (unitVarEnv var (mkOnceUsedDmd dmd)) {- ************************************************************************ @@ -700,9 +702,12 @@ a product type. ************************************************************************ -} -unitVarDmd :: Var -> Demand -> DmdType -unitVarDmd var dmd - = DmdType (unitVarEnv var dmd) [] topRes +unitDmdType :: DmdEnv -> DmdType +unitDmdType dmd_env = DmdType dmd_env [] topRes + +coercionDmdEnv :: Coercion -> DmdEnv +coercionDmdEnv co = mapVarEnv (const topDmd) (coVarsOfCo co) + -- The VarSet from coVarsOfCo is really a VarEnv Var addVarDmd :: DmdType -> Var -> Demand -> DmdType addVarDmd (DmdType fv ds res) var dmd From git at git.haskell.org Tue Apr 21 08:18:25 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Apr 2015 08:18:25 +0000 (UTC) Subject: [commit: ghc] master: Spelling in comment (d12c7cb) Message-ID: <20150421081825.4B6B93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d12c7cb9ee81a68bfcb5f254c016c3c25ed207a4/ghc >--------------------------------------------------------------- commit d12c7cb9ee81a68bfcb5f254c016c3c25ed207a4 Author: Simon Peyton Jones Date: Mon Apr 20 15:58:31 2015 +0100 Spelling in comment >--------------------------------------------------------------- d12c7cb9ee81a68bfcb5f254c016c3c25ed207a4 compiler/simplCore/CSE.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index fa517c2..7d43d54 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -112,7 +112,7 @@ We do not expect the rule to fire. But if we do CSE, then we risk getting yes=no, and the rule does fire. Actually, it won't because NOINLINE means that 'yes' will never be inlined, not even if we have yes=no. So that's fine (now; perhaps in the olden days, yes=no would -have substituted even if 'yes' was NOINLINE. +have substituted even if 'yes' was NOINLINE). But we do need to take care. Consider From git at git.haskell.org Tue Apr 21 08:18:28 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Apr 2015 08:18:28 +0000 (UTC) Subject: [commit: ghc] master: Support unboxing for GADT product types (f2d1b7f) Message-ID: <20150421081828.0AE1E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f2d1b7fcbbc55e33375a7321222a9f4ee189aa38/ghc >--------------------------------------------------------------- commit f2d1b7fcbbc55e33375a7321222a9f4ee189aa38 Author: Simon Peyton Jones Date: Mon Apr 20 16:00:49 2015 +0100 Support unboxing for GADT product types Beofre this commit we never unboxed GADT, even if they are perfectly civilised products. This patch liberalises unboxing slightly. See Note [Product types] in TyCon. Still to come - for strictness, we could maybe deal with existentials too - todo: unboxing constructor arguments >--------------------------------------------------------------- f2d1b7fcbbc55e33375a7321222a9f4ee189aa38 compiler/basicTypes/DataCon.hs | 4 ++-- compiler/basicTypes/DataCon.hs-boot | 3 ++- compiler/basicTypes/MkId.hs | 6 +++--- compiler/stranal/DmdAnal.hs | 5 ++++- compiler/types/TyCon.hs | 38 ++++++++++++++++++++++++++++++++----- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/compiler/basicTypes/DataCon.hs b/compiler/basicTypes/DataCon.hs index a6db5ac..46d79d8 100644 --- a/compiler/basicTypes/DataCon.hs +++ b/compiler/basicTypes/DataCon.hs @@ -928,11 +928,11 @@ dataConInstArgTys :: DataCon -- ^ A datacon with no existentials or equality -- class dictionary, with superclasses) -> [Type] -- ^ Instantiated at these types -> [Type] -dataConInstArgTys dc@(MkData {dcUnivTyVars = univ_tvs, dcEqSpec = eq_spec, +dataConInstArgTys dc@(MkData {dcUnivTyVars = univ_tvs, dcExTyVars = ex_tvs}) inst_tys = ASSERT2( length univ_tvs == length inst_tys , ptext (sLit "dataConInstArgTys") <+> ppr dc $$ ppr univ_tvs $$ ppr inst_tys) - ASSERT2( null ex_tvs && null eq_spec, ppr dc ) + ASSERT2( null ex_tvs, ppr dc ) map (substTyWith univ_tvs inst_tys) (dataConRepArgTys dc) -- | Returns just the instantiated /value/ argument types of a 'DataCon', diff --git a/compiler/basicTypes/DataCon.hs-boot b/compiler/basicTypes/DataCon.hs-boot index 5370a87..4f19ffc 100644 --- a/compiler/basicTypes/DataCon.hs-boot +++ b/compiler/basicTypes/DataCon.hs-boot @@ -1,4 +1,5 @@ module DataCon where +import Var( TyVar ) import Name( Name, NamedThing ) import {-# SOURCE #-} TyCon( TyCon ) import Unique ( Uniquable ) @@ -8,7 +9,7 @@ data DataCon data DataConRep dataConName :: DataCon -> Name dataConTyCon :: DataCon -> TyCon -isVanillaDataCon :: DataCon -> Bool +dataConExTyVars :: DataCon -> [TyVar] instance Eq DataCon instance Ord DataCon diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 98e6847..365ed82 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -422,7 +422,7 @@ dataConCPR :: DataCon -> DmdResult dataConCPR con | isDataTyCon tycon -- Real data types only; that is, -- not unboxed tuples or newtypes - , isVanillaDataCon con -- No existentials + , null (dataConExTyVars con) -- No existentials , wkr_arity > 0 , wkr_arity <= mAX_CPR_SIZE = if is_prod then vanillaCprProdRes (dataConRepArity con) @@ -430,8 +430,8 @@ dataConCPR con | otherwise = topRes where - is_prod = isProductTyCon tycon - tycon = dataConTyCon con + is_prod = isProductTyCon tycon + tycon = dataConTyCon con wkr_arity = dataConRepArity con mAX_CPR_SIZE :: Arity diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 4117eae..21a71de 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -211,7 +211,7 @@ dmdAnal' env dmd (Lam var body) dmdAnal' env dmd (Case scrut case_bndr ty [(DataAlt dc, bndrs, rhs)]) -- Only one alternative with a product constructor | let tycon = dataConTyCon dc - , isProductTyCon tycon + , isJust (isDataProductTyCon_maybe tycon) , Just rec_tc' <- checkRecTc (ae_rec_tc env) tycon = let env_w_tc = env { ae_rec_tc = rec_tc' } @@ -257,6 +257,9 @@ dmdAnal' env dmd (Case scrut case_bndr ty alts) (alt_tys, alts') = mapAndUnzip (dmdAnalAlt env dmd case_bndr) alts (scrut_ty, scrut') = dmdAnal env cleanEvalDmd scrut (alt_ty, case_bndr') = annotateBndr env (foldr lubDmdType botDmdType alt_tys) case_bndr + -- NB: Base case is botDmdType, for empty case alternatives + -- This is a unit for lubDmdType, and the right result + -- when there really are no alternatives res_ty = alt_ty `bothDmdType` toBothDmdArg scrut_ty in -- pprTrace "dmdAnal:Case2" (vcat [ text "scrut" <+> ppr scrut diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index ea219c1..4db72f6 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -95,7 +95,7 @@ module TyCon( #include "HsVersions.h" import {-# SOURCE #-} TypeRep ( Kind, Type, PredType ) -import {-# SOURCE #-} DataCon ( DataCon, isVanillaDataCon ) +import {-# SOURCE #-} DataCon ( DataCon, dataConExTyVars ) import Var import Class @@ -1262,10 +1262,11 @@ unwrapNewTyConEtad_maybe _ = Nothing isProductTyCon :: TyCon -> Bool -- True of datatypes or newtypes that have --- one, vanilla, data constructor +-- one, non-existential, data constructor +-- See Note [Product types] isProductTyCon tc@(AlgTyCon {}) = case algTcRhs tc of DataTyCon{ data_cons = [data_con] } - -> isVanillaDataCon data_con + -> null (dataConExTyVars data_con) NewTyCon {} -> True _ -> False isProductTyCon (TupleTyCon {}) = True @@ -1275,14 +1276,41 @@ isProductTyCon _ = False isDataProductTyCon_maybe :: TyCon -> Maybe DataCon -- True of datatypes (not newtypes) with -- one, vanilla, data constructor +-- See Note [Product types] isDataProductTyCon_maybe (AlgTyCon { algTcRhs = DataTyCon { data_cons = cons } }) - | [con] <- cons -- Singleton - , isVanillaDataCon con -- Vanilla + | [con] <- cons -- Singleton + , null (dataConExTyVars con) -- non-existential = Just con isDataProductTyCon_maybe (TupleTyCon { dataCon = con }) = Just con isDataProductTyCon_maybe _ = Nothing +{- Note [Product types] +~~~~~~~~~~~~~~~~~~~~~~~ +A product type is + * A data type (not a newtype) + * With one, boxed data constructor + * That binds no existential type variables + +The main point is that product types are amenable to unboxing for + * Strict function calls; we can transform + f (D a b) = e + to + fw a b = e + via the worker/wrapper transformation. (Question: couldn't this + work for existentials too?) + + * CPR for function results; we can transform + f x y = let ... in D a b + to + fw x y = let ... in (# a, b #) + +Note that the data constructor /can/ have evidence arguments: equality +constraints, type classes etc. So it can be GADT. These evidence +arguments are simply value arguments, and should not get in the way. +-} + + -- | Is this a 'TyCon' representing a regular H98 type synonym (@type@)? isTypeSynonymTyCon :: TyCon -> Bool isTypeSynonymTyCon (SynonymTyCon {}) = True From git at git.haskell.org Tue Apr 21 08:28:49 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Apr 2015 08:28:49 +0000 (UTC) Subject: [commit: ghc] master: Wibble to DmdAnal (5c7e4db) Message-ID: <20150421082849.85B383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5c7e4db5ce84395eb0d727eb3b0f505a00191164/ghc >--------------------------------------------------------------- commit 5c7e4db5ce84395eb0d727eb3b0f505a00191164 Author: Simon Peyton Jones Date: Tue Apr 21 09:29:13 2015 +0100 Wibble to DmdAnal This fixes a typo in d5773a4939b1feea51ec0db6624c9462751e948a Teach DmdAnal that coercions are value arguments! (Trac #10288) Sorry about that; I'm not sure how it slipped through. >--------------------------------------------------------------- 5c7e4db5ce84395eb0d727eb3b0f505a00191164 compiler/stranal/DmdAnal.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 21a71de..a345e45 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -169,10 +169,10 @@ dmdAnal' env dmd (App fun (Type ty)) -- Lots of the other code is there to make this -- beautiful, compositional, application rule :-) dmdAnal' env dmd (App fun arg) - = -- This case handles value arguments (type args handled above) - -- Crucially, coercions /are/ handled here, because they are - -- value arguments (Trac #10288) - = let + = -- This case handles value arguments (type args handled above) + -- Crucially, coercions /are/ handled here, because they are + -- value arguments (Trac #10288) + let call_dmd = mkCallDmd dmd (fun_ty, fun') = dmdAnal env call_dmd fun (arg_dmd, res_ty) = splitDmdTy fun_ty From git at git.haskell.org Tue Apr 21 08:53:40 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Apr 2015 08:53:40 +0000 (UTC) Subject: [commit: ghc] master: GADTs now are CPR-able (b9f20bd) Message-ID: <20150421085340.DF7BD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b9f20bd478306a77b27983410eeaf5d8da65eac2/ghc >--------------------------------------------------------------- commit b9f20bd478306a77b27983410eeaf5d8da65eac2 Author: Simon Peyton Jones Date: Tue Apr 21 09:54:03 2015 +0100 GADTs now are CPR-able Accompanies f2d1b7fcbbc55e33375a7321222a9f4ee189aa38 Support unboxing for GADT product types >--------------------------------------------------------------- b9f20bd478306a77b27983410eeaf5d8da65eac2 testsuite/tests/deSugar/should_compile/T2431.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/deSugar/should_compile/T2431.stderr b/testsuite/tests/deSugar/should_compile/T2431.stderr index edc2772..607ecc1 100644 --- a/testsuite/tests/deSugar/should_compile/T2431.stderr +++ b/testsuite/tests/deSugar/should_compile/T2431.stderr @@ -5,7 +5,7 @@ Result size of Tidy Core = {terms: 8, types: 19, coercions: 1} T2431.$WRefl [InlPrag=INLINE] :: forall a. a :~: a [GblId[DataConWrapper], Caf=NoCafRefs, - Str=DmdType, + Str=DmdType m, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=0,unsat_ok=False,boring_ok=False) From git at git.haskell.org Tue Apr 21 23:12:57 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Apr 2015 23:12:57 +0000 (UTC) Subject: [commit: ghc] master: Enable SMP and GHCi support for Aarch64 (1e8c9b8) Message-ID: <20150421231257.05AC73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e8c9b81a819da8eb54405a029fc33a9f5220321/ghc >--------------------------------------------------------------- commit 1e8c9b81a819da8eb54405a029fc33a9f5220321 Author: Erik de Castro Lopo Date: Wed Apr 1 04:46:01 2015 +0000 Enable SMP and GHCi support for Aarch64 Signed-off-by: Erik de Castro Lopo Test Plan: Full build on Aarch64 Reviewers: rwbarton, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D859 >--------------------------------------------------------------- 1e8c9b81a819da8eb54405a029fc33a9f5220321 mk/config.mk.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mk/config.mk.in b/mk/config.mk.in index f4cb52b..d6831c9 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -172,7 +172,7 @@ HaveLibDL = @HaveLibDL@ # ArchSupportsSMP should be set iff there is support for that arch in # includes/stg/SMP.h -ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc arm))) +ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc arm aarch64))) GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO)) @@ -180,7 +180,7 @@ GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised # has support for this OS/ARCH combination. OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu))) -ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc sparc sparc64 arm))) +ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc sparc sparc64 arm aarch64))) ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES" GhcWithInterpreter=YES From git at git.haskell.org Tue Apr 21 23:12:59 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Apr 2015 23:12:59 +0000 (UTC) Subject: [commit: ghc] master: Use the gold linker for aarch64/linux (#9673) (0bbc2ac) Message-ID: <20150421231259.BFCA33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0bbc2ac6dae9ce2838f23a75a6a989826c06f3f5/ghc >--------------------------------------------------------------- commit 0bbc2ac6dae9ce2838f23a75a6a989826c06f3f5 Author: Erik de Castro Lopo Date: Mon Apr 20 20:22:44 2015 +0000 Use the gold linker for aarch64/linux (#9673) Like 32 bit Arm, Aarch64 requires use of the gold linker. Signed-off-by: Erik de Castro Lopo Test Plan: 'make install' on aarch64, validate elsewhere Reviewers: rwbarton, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D858 GHC Trac Issues: #9673 >--------------------------------------------------------------- 0bbc2ac6dae9ce2838f23a75a6a989826c06f3f5 aclocal.m4 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 33a51ba..d6352cf 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -565,9 +565,11 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS], $3="$$3 -D_HPUX_SOURCE" $5="$$5 -D_HPUX_SOURCE" ;; - arm*linux*) - # On arm/linux and arm/android, tell gcc to link using the gold linker. - # Forcing LD to be ld.gold is done in configre.ac. + arm*linux* | \ + aarch64*linux* ) + # On arm/linux, aarch64/linux, arm/android and aarch64/android, tell + # gcc to link using the gold linker. + # Forcing LD to be ld.gold is done in FIND_LD m4 macro. $3="$$3 -fuse-ld=gold" ;; esac @@ -2093,10 +2095,12 @@ AC_DEFUN([FIND_LLVM_PROG],[ AC_DEFUN([FIND_LD],[ FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) case $target in - arm*linux*) - # Arm requires use of the binutils ld.gold linker. - # This case should catch at least arm-unknown-linux-gnueabihf and - # arm-linux-androideabi. + arm*linux* | \ + aarch64*linux* ) + # Arm and Aarch64 requires use of the binutils ld.gold linker. + # This case should catch at least arm-unknown-linux-gnueabihf, + # arm-linux-androideabi, arm64-unknown-linux and + # aarch64-linux-android FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold]) $1="$LD_GOLD" ;; From git at git.haskell.org Wed Apr 22 08:49:29 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 08:49:29 +0000 (UTC) Subject: [commit: ghc] master: Add a blank line (3b932cc) Message-ID: <20150422084929.D2EE03A302@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3b932cc0ad885cc6eb9cef49fc1fe96bb9ff241e/ghc >--------------------------------------------------------------- commit 3b932cc0ad885cc6eb9cef49fc1fe96bb9ff241e Author: Simon Peyton Jones Date: Wed Apr 22 07:48:18 2015 +0100 Add a blank line >--------------------------------------------------------------- 3b932cc0ad885cc6eb9cef49fc1fe96bb9ff241e compiler/coreSyn/CoreArity.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs index 47c8085..79e3463 100644 --- a/compiler/coreSyn/CoreArity.hs +++ b/compiler/coreSyn/CoreArity.hs @@ -111,6 +111,7 @@ typeArity ty | Just (arg,res) <- splitFunTy_maybe ty = typeOneShot arg : go rec_nts res + | Just (tc,tys) <- splitTyConApp_maybe ty , Just (ty', _) <- instNewTyCon_maybe tc tys , Just rec_nts' <- checkRecTc rec_nts tc -- See Note [Expanding newtypes] From git at git.haskell.org Wed Apr 22 08:49:32 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 08:49:32 +0000 (UTC) Subject: [commit: ghc] master: Fix the boot dfun impedence-matching binding (9b9fc4c) Message-ID: <20150422084932.8936E3A302@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9b9fc4c732baab126b057b4031bebcbd67d6e348/ghc >--------------------------------------------------------------- commit 9b9fc4c732baab126b057b4031bebcbd67d6e348 Author: Simon Peyton Jones Date: Wed Apr 22 09:29:24 2015 +0100 Fix the boot dfun impedence-matching binding In TcRnDriver.checkHiBootIface' we were generating an impedence-matching binding $fxToRecMaybe = $fToRecMaybe but the type of the former was gotten from the *hi-boot* file, so its type constructor was not fully fleshed out. That should never happen. Fix is easy, happily. A dark corner. >--------------------------------------------------------------- 9b9fc4c732baab126b057b4031bebcbd67d6e348 compiler/typecheck/TcRnDriver.hs | 53 ++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 170445b..3455a64 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -705,23 +705,20 @@ checkHiBootIface :: TcGblEnv -> ModDetails -> TcM TcGblEnv -- with the type environment we've just come up with -- In the common case where there is no hi-boot file, the list -- of boot_names is empty. --- --- The bindings we return give bindings for the dfuns defined in the --- hs-boot file, such as $fbEqT = $fEqT checkHiBootIface - tcg_env@(TcGblEnv { tcg_src = hs_src, tcg_binds = binds, - tcg_insts = local_insts, - tcg_type_env = local_type_env, tcg_exports = local_exports }) + tcg_env@(TcGblEnv { tcg_src = hs_src, tcg_binds = binds + , tcg_insts = local_insts + , tcg_type_env = local_type_env + , tcg_exports = local_exports }) boot_details | HsBootFile <- hs_src -- Current module is already a hs-boot file! = return tcg_env | otherwise - = do { mb_dfun_prs <- checkHiBootIface' local_insts local_type_env - local_exports boot_details - ; let dfun_prs = catMaybes mb_dfun_prs - boot_dfuns = map fst dfun_prs + = do { dfun_prs <- checkHiBootIface' local_insts local_type_env + local_exports boot_details + ; let boot_dfuns = map fst dfun_prs dfun_binds = listToBag [ mkVarBind boot_dfun (nlHsVar dfun) | (boot_dfun, dfun) <- dfun_prs ] type_env' = extendTypeEnvWithIds local_type_env boot_dfuns @@ -734,9 +731,15 @@ checkHiBootIface -- can "see" that boot dfun. See Trac #4003 checkHiBootIface' :: [ClsInst] -> TypeEnv -> [AvailInfo] - -> ModDetails -> TcM [Maybe (Id, Id)] + -> ModDetails -> TcM [(Id, Id)] -- Variant which doesn't require a full TcGblEnv; you could get the -- local components from another ModDetails. +-- +-- We return a list of "impedence-matching" bindings for the dfuns +-- defined in the hs-boot file, such as +-- $fxEqT = $fEqT +-- We need these because the module and hi-boot file might differ in +-- the name it chose for the dfun. checkHiBootIface' local_insts local_type_env local_exports @@ -757,11 +760,12 @@ checkHiBootIface' -- instances? We can't easily equate tycons... -- Check instance declarations + -- and generate an impedence-matching binding ; mb_dfun_prs <- mapM check_inst boot_insts ; failIfErrsM - ; return mb_dfun_prs } + ; return (catMaybes mb_dfun_prs) } where check_export boot_avail -- boot_avail is exported by the boot iface @@ -804,18 +808,25 @@ checkHiBootIface' check_inst boot_inst = case [dfun | inst <- local_insts, let dfun = instanceDFunId inst, - idType dfun `eqType` boot_inst_ty ] of - [] -> do { traceTc "check_inst" (vcat [ text "local_insts" <+> vcat (map (ppr . idType . instanceDFunId) local_insts) - , text "boot_inst" <+> ppr boot_inst - , text "boot_inst_ty" <+> ppr boot_inst_ty - ]) + idType dfun `eqType` boot_dfun_ty ] of + [] -> do { traceTc "check_inst" $ vcat + [ text "local_insts" <+> vcat (map (ppr . idType . instanceDFunId) local_insts) + , text "boot_inst" <+> ppr boot_inst + , text "boot_dfun_ty" <+> ppr boot_dfun_ty + ] ; addErrTc (instMisMatch True boot_inst); return Nothing } (dfun:_) -> return (Just (local_boot_dfun, dfun)) + where + local_boot_dfun = Id.mkExportedLocalId VanillaId boot_dfun_name (idType dfun) + -- Name from the /boot-file/ ClsInst, but type from the dfun + -- defined in /this module/. That ensures that the TyCon etc + -- inside the type are the ones defined in this module, not + -- the ones gotten from the hi-boot file, which may have + -- a lot less info (Trac #T8743, comment:10). where - boot_dfun = instanceDFunId boot_inst - boot_inst_ty = idType boot_dfun - local_boot_dfun = Id.mkExportedLocalId VanillaId (idName boot_dfun) boot_inst_ty - + boot_dfun = instanceDFunId boot_inst + boot_dfun_ty = idType boot_dfun + boot_dfun_name = idName boot_dfun -- This has to compare the TyThing from the .hi-boot file to the TyThing -- in the current source file. We must be careful to allow alpha-renaming From git at git.haskell.org Wed Apr 22 08:49:35 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 08:49:35 +0000 (UTC) Subject: [commit: ghc] master: Do not decompose => (Trac #9858) (c0b5adb) Message-ID: <20150422084935.46A8C3A302@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c0b5adbd1a04dd1c7916c1240e50a936e826136d/ghc >--------------------------------------------------------------- commit c0b5adbd1a04dd1c7916c1240e50a936e826136d Author: Simon Peyton Jones Date: Wed Apr 22 09:45:52 2015 +0100 Do not decompose => (Trac #9858) We really don't want to unify (a b) with (Eq a => ty). The ever-ingenious Oerjan discovered this problem; see comment:101 in Trac #9858. See Note [Decomposing fat arrow c=>t] in Type.hs >--------------------------------------------------------------- c0b5adbd1a04dd1c7916c1240e50a936e826136d compiler/types/Type.hs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index a2d3392..f29791c 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -333,6 +333,26 @@ allDistinctTyVars tkvs = go emptyVarSet tkvs We need to be pretty careful with AppTy to make sure we obey the invariant that a TyConApp is always visibly so. mkAppTy maintains the invariant: use it. + +Note [Decomposing fat arrow c=>t] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Can we unify (a b) with (Eq a => ty)? If we do so, we end up with +a partial application like ((=>) Eq a) which doesn't make sense in +source Haskell. In constrast, we *can* unify (a b) with (t1 -> t2). +Here's an example (Trac #9858) of how you might do it: + i :: (Typeable a, Typeable b) => Proxy (a b) -> TypeRep + i p = typeRep p + + j = i (Proxy :: Proxy (Eq Int => Int)) +The type (Proxy (Eq Int => Int)) is only accepted with -XImpredicativeTypes, +but suppose we want that. But then in the call to 'i', we end +up decomposing (Eq Int => Int), and we definitely don't want that. + +This really only applies to the type checker; in Core, '=>' and '->' +are the same, as are 'Constraint' and '*'. But for now I've put +the test in repSplitAppTy_maybe, which applies throughout, because +the other calls to splitAppTy are in Unify, which is also used by +the type checker (e.g. when matching type-function equations). -} -- | Applies a type to another, as in e.g. @k a@ @@ -366,7 +386,9 @@ splitAppTy_maybe ty = repSplitAppTy_maybe ty repSplitAppTy_maybe :: Type -> Maybe (Type,Type) -- ^ Does the AppTy split as in 'splitAppTy_maybe', but assumes that -- any Core view stuff is already done -repSplitAppTy_maybe (FunTy ty1 ty2) = Just (TyConApp funTyCon [ty1], ty2) +repSplitAppTy_maybe (FunTy ty1 ty2) + | isConstraintKind (typeKind ty1) = Nothing -- See Note [Decomposing fat arrow c=>t] + | otherwise = Just (TyConApp funTyCon [ty1], ty2) repSplitAppTy_maybe (AppTy ty1 ty2) = Just (ty1, ty2) repSplitAppTy_maybe (TyConApp tc tys) | isDecomposableTyCon tc || tys `lengthExceeds` tyConArity tc From git at git.haskell.org Wed Apr 22 09:08:00 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 09:08:00 +0000 (UTC) Subject: [commit: ghc] master: Mark T8743 as passing (1bb1ff2) Message-ID: <20150422090800.1D9823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1bb1ff2253a7f235f7ef45b06321b104c0365d99/ghc >--------------------------------------------------------------- commit 1bb1ff2253a7f235f7ef45b06321b104c0365d99 Author: Joachim Breitner Date: Wed Apr 22 11:07:37 2015 +0200 Mark T8743 as passing as Simons recent commit 9b9fc4c732baab126b057b4031bebcbd67d6e348 fixed this. >--------------------------------------------------------------- 1bb1ff2253a7f235f7ef45b06321b104c0365d99 testsuite/tests/stranal/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T index eae3ba0..35f22a1 100644 --- a/testsuite/tests/stranal/should_compile/all.T +++ b/testsuite/tests/stranal/should_compile/all.T @@ -18,7 +18,7 @@ test('newtype', req_profiling, compile, ['-prof -auto-all']) test('T1988', normal, compile, ['']) test('T8467', normal, compile, ['']) test('T8037', normal, compile, ['']) -test('T8743', [ extra_clean(['T8743.o-boot', 'T8743.hi-boot']), expect_broken(10182) ], multimod_compile, ['T8743', '-v0']) +test('T8743', extra_clean(['T8743.o-boot', 'T8743.hi-boot']), multimod_compile, ['T8743', '-v0']) test('T9208', when(compiler_debugged(), expect_broken(9208)), compile, ['']) # T9208 fails (and should do so) if you have assertion checking on in the compiler From git at git.haskell.org Wed Apr 22 12:39:34 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 12:39:34 +0000 (UTC) Subject: [commit: ghc] master: Don't use self {-# SOURCE #-} import in test-cases. (1bd1cef) Message-ID: <20150422123934.85ABB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1bd1ceffce7f3027ae632086844f95976ed600c8/ghc >--------------------------------------------------------------- commit 1bd1ceffce7f3027ae632086844f95976ed600c8 Author: Edward Z. Yang Date: Tue Apr 21 10:26:25 2015 -0700 Don't use self {-# SOURCE #-} import in test-cases. Summary: It's kind of buggy, c.f. #10182, and isn't motivated by any real world programs, so we're going to get rid of it (despite it being handy for GHC test cases.) Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D862 >--------------------------------------------------------------- 1bd1ceffce7f3027ae632086844f95976ed600c8 testsuite/tests/deriving/should_compile/Makefile | 1 + testsuite/tests/deriving/should_compile/T1133.hs | 2 +- testsuite/tests/deriving/should_compile/T1133a.hs | 3 +++ testsuite/tests/deriving/should_compile/all.T | 2 +- testsuite/tests/deriving/should_fail/Makefile | 7 ++----- testsuite/tests/deriving/should_fail/T1133A.hs | 2 +- testsuite/tests/deriving/should_fail/T1133Aa.hs | 3 +++ testsuite/tests/deriving/should_fail/all.T | 2 +- testsuite/tests/indexed-types/should_compile/ClosedFam1.hs | 2 +- testsuite/tests/indexed-types/should_compile/ClosedFam1a.hs | 3 +++ testsuite/tests/indexed-types/should_compile/ClosedFam2.hs | 2 +- testsuite/tests/indexed-types/should_compile/ClosedFam2a.hs | 2 ++ testsuite/tests/indexed-types/should_compile/all.T | 4 ++-- testsuite/tests/indexed-types/should_fail/ClosedFam3.hs | 2 +- testsuite/tests/indexed-types/should_fail/ClosedFam3a.hs | 3 +++ testsuite/tests/indexed-types/should_fail/all.T | 2 +- testsuite/tests/roles/should_fail/Makefile | 2 ++ testsuite/tests/roles/should_fail/Roles12.hs | 2 +- testsuite/tests/roles/should_fail/Roles12a.hs | 2 ++ testsuite/tests/roles/should_fail/T9204.hs | 2 +- testsuite/tests/roles/should_fail/T9204a.hs | 2 ++ testsuite/tests/roles/should_fail/all.T | 4 ++-- testsuite/tests/stranal/should_compile/T8743.hs | 2 +- testsuite/tests/stranal/should_compile/T8743a.hs | 3 +++ testsuite/tests/stranal/should_compile/all.T | 2 +- testsuite/tests/typecheck/should_fail/T3468.hs | 2 +- testsuite/tests/typecheck/should_fail/T3468a.hs | 3 +++ testsuite/tests/typecheck/should_fail/all.T | 2 +- 28 files changed, 47 insertions(+), 23 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 1bd1ceffce7f3027ae632086844f95976ed600c8 From git at git.haskell.org Wed Apr 22 12:39:37 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 12:39:37 +0000 (UTC) Subject: [commit: ghc] master: Fix #10182 by disallowing/avoiding self {-# SOURCE #-} imports (a2f9fef) Message-ID: <20150422123937.9DD053A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a2f9fef1d90c073ad9c2a727c5ee617057ca6c1d/ghc >--------------------------------------------------------------- commit a2f9fef1d90c073ad9c2a727c5ee617057ca6c1d Author: Edward Z. Yang Date: Tue Apr 21 06:46:32 2015 -0700 Fix #10182 by disallowing/avoiding self {-# SOURCE #-} imports Summary: hs-boot declarations were leaking into the EPS due to self {-# SOURCE #-} imports, and interface loading induced by orphan instances. For the former, we simply disallow self {-# SOURCE #-} imports; for the latter, we simply just don't load an interface if it would be ourself. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D860 GHC Trac Issues: #10182 >--------------------------------------------------------------- a2f9fef1d90c073ad9c2a727c5ee617057ca6c1d compiler/iface/LoadIface.hs | 11 ++++++++++- compiler/iface/MkIface.hs | 15 +++++++++++++-- compiler/rename/RnNames.hs | 14 ++++++++++---- compiler/typecheck/TcRnDriver.hs | 5 +++-- testsuite/tests/driver/Makefile | 7 +++++++ testsuite/tests/driver/T10182.hs | 4 ++++ testsuite/tests/driver/T10182.hs-boot | 2 ++ testsuite/tests/driver/T10182a.hs | 2 ++ testsuite/tests/driver/all.T | 5 +++++ 9 files changed, 56 insertions(+), 9 deletions(-) diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs index 9571cec..defaa91 100644 --- a/compiler/iface/LoadIface.hs +++ b/compiler/iface/LoadIface.hs @@ -413,6 +413,7 @@ loadInterface :: SDoc -> Module -> WhereFrom loadInterface doc_str mod from = do { -- Read the state (eps,hpt) <- getEpsAndHpt + ; gbl_env <- getGblEnv ; traceIf (text "Considering whether to load" <+> ppr mod <+> ppr from) @@ -429,7 +430,15 @@ loadInterface doc_str mod from -- READ THE MODULE IN ; read_result <- case (wantHiBootFile dflags eps mod from) of Failed err -> return (Failed err) - Succeeded hi_boot_file -> findAndReadIface doc_str mod hi_boot_file + Succeeded hi_boot_file -> + -- Stoutly warn against an EPS-updating import + -- of one's own boot file! (one-shot only) + --See Note [Do not update EPS with your own hi-boot] + -- in MkIface. + WARN( hi_boot_file && + fmap fst (if_rec_types gbl_env) == Just mod, + ppr mod ) + findAndReadIface doc_str mod hi_boot_file ; case read_result of { Failed err -> do { let fake_iface = emptyModIface mod diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 2b094a0..5e16c16 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -560,10 +560,21 @@ addFingerprints hsc_env mb_old_fingerprint iface0 new_decls -- dependency tree. We only care about orphan modules in the current -- package, because changes to orphans outside this package will be -- tracked by the usage on the ABI hash of package modules that we import. - let orph_mods = filter ((== this_pkg) . modulePackageKey) - $ dep_orphs sorted_deps + let orph_mods + = filter (/= this_mod) -- Note [Do not update EPS with your own hi-boot] + . filter ((== this_pkg) . modulePackageKey) + $ dep_orphs sorted_deps dep_orphan_hashes <- getOrphanHashes hsc_env orph_mods + -- Note [Do not update EPS with your own hi-boot] + -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + -- (See also Trac #10182). When your hs-boot file includes an orphan + -- instance declaration, you may find that the dep_orphs of a module you + -- import contains reference to yourself. DO NOT actually load this module + -- or add it to the orphan hashes: you're going to provide the orphan + -- 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) (map ifDFun orph_insts, orph_rules, orph_fis) diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index 5541e8b..036d652 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -200,10 +200,16 @@ rnImportDecl this_mod -- Check for self-import, which confuses the typechecker (Trac #9032) -- ghc --make rejects self-import cycles already, but batch-mode may not -- at least not until TcIface.tcHiBootIface, which is too late to avoid - -- typechecker crashes. ToDo: what about indirect self-import? - -- But 'import {-# SOURCE #-} M' is ok, even if a bit odd - when (not want_boot && - imp_mod_name == moduleName this_mod && + -- typechecker crashes. (Indirect self imports are not caught until + -- TcIface, see #10337 tracking how to make this error better.) + -- + -- Originally, we also allowed 'import {-# SOURCE #-} M', but this + -- caused bug #10182: in one-shot mode, we should never load an hs-boot + -- file for the module we are compiling into the EPS. In principle, + -- it should be possible to support this mode of use, but we would have to + -- extend Provenance to support a local definition in a qualified location. + -- For now, we don't support it, but see #10336 + when (imp_mod_name == moduleName this_mod && (case mb_pkg of -- If we have import "" M, then we should -- check that "" is "this" (which is magic) -- or the name of this_mod's package. Yurgh! diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 3455a64..60a6860 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -438,9 +438,10 @@ tcRnImports hsc_env import_decls -- Load any orphan-module and family instance-module -- interfaces, so that their rules and instance decls will be - -- found. + -- found. But filter out a self hs-boot: these instances + -- will be checked when we define them locally. ; loadModuleInterfaces (ptext (sLit "Loading orphan modules")) - (imp_orphs imports) + (filter (/= this_mod) (imp_orphs imports)) -- Check type-family consistency ; traceRn (text "rn1: checking family instance consistency") diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile index 3bec5b7..dafb76e 100644 --- a/testsuite/tests/driver/Makefile +++ b/testsuite/tests/driver/Makefile @@ -598,3 +598,10 @@ T9938B: $(RM) -rf T9938B.o T9938B.hi T9938B "$(TEST_HC)" $(TEST_HC_OPTS) -O2 -c T9938B.hs "$(TEST_HC)" $(TEST_HC_OPTS) -O2 T9938B.o -o T9938B + +.PHONY: T10182 +T10182: + $(RM) -rf T10182.o T10182a.o T10182.o-boot T10182.hi T10182a.hi T10182.hi-boot + "$(TEST_HC)" $(TEST_HC_OPTS) -c T10182.hs-boot + "$(TEST_HC)" $(TEST_HC_OPTS) -c T10182a.hs + "$(TEST_HC)" $(TEST_HC_OPTS) -c T10182.hs diff --git a/testsuite/tests/driver/T10182.hs b/testsuite/tests/driver/T10182.hs new file mode 100644 index 0000000..0cf1911 --- /dev/null +++ b/testsuite/tests/driver/T10182.hs @@ -0,0 +1,4 @@ +module T10182 where +import T10182a +instance Show (a -> b) where + show _ = "" diff --git a/testsuite/tests/driver/T10182.hs-boot b/testsuite/tests/driver/T10182.hs-boot new file mode 100644 index 0000000..83b160f --- /dev/null +++ b/testsuite/tests/driver/T10182.hs-boot @@ -0,0 +1,2 @@ +module T10182 where +instance Show (a -> b) -- ORPHAN INSTANCE diff --git a/testsuite/tests/driver/T10182a.hs b/testsuite/tests/driver/T10182a.hs new file mode 100644 index 0000000..b1c9371 --- /dev/null +++ b/testsuite/tests/driver/T10182a.hs @@ -0,0 +1,2 @@ +module T10182a where +import {-# SOURCE #-} T10182 diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T index 32678d3..48ec649 100644 --- a/testsuite/tests/driver/all.T +++ b/testsuite/tests/driver/all.T @@ -431,3 +431,8 @@ test('T10219', normal, run_command, test('T10220', normal, run_command, # Preprocessed T10220.hspp imports T10220B. Should work in --make mode. ['{compiler} --make T10220.hspp -fno-code -v0']) + +test('T10182', + extra_clean(['T10182.o', 'T10182a.o', 'T10182.o-boot', 'T10182.hi', 'T10182a.hi', 'T10182.hi-boot']), + run_command, + ['$MAKE -s --no-print-directory T10182']) From git at git.haskell.org Wed Apr 22 13:04:57 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 13:04:57 +0000 (UTC) Subject: [commit: ghc] master: Fix superclass generation in an instance (646866f) Message-ID: <20150422130457.E40553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/646866ff318d6eb8beeed98032644182dd9d997b/ghc >--------------------------------------------------------------- commit 646866ff318d6eb8beeed98032644182dd9d997b Author: Simon Peyton Jones Date: Tue Apr 21 13:38:32 2015 +0100 Fix superclass generation in an instance More fallout from the silent-superclass refactoring; nothing drastic. Fixes Trac #10335. >--------------------------------------------------------------- 646866ff318d6eb8beeed98032644182dd9d997b compiler/deSugar/DsBinds.hs | 7 ++-- compiler/typecheck/TcCanonical.hs | 3 +- compiler/typecheck/TcEvidence.hs | 20 ++++++++--- compiler/typecheck/TcHsSyn.hs | 4 ++- compiler/typecheck/TcInstDcls.hs | 40 +++++++++++----------- testsuite/tests/typecheck/should_compile/T10335.hs | 16 +++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 7 files changed, 61 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 646866ff318d6eb8beeed98032644182dd9d997b From git at git.haskell.org Wed Apr 22 13:05:00 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 13:05:00 +0000 (UTC) Subject: [commit: ghc] master: Comments only (9d3bd3d) Message-ID: <20150422130500.BCD1C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9d3bd3dca889af558737282ad2509b32ded93e6a/ghc >--------------------------------------------------------------- commit 9d3bd3dca889af558737282ad2509b32ded93e6a Author: Simon Peyton Jones Date: Tue Apr 21 13:39:46 2015 +0100 Comments only >--------------------------------------------------------------- 9d3bd3dca889af558737282ad2509b32ded93e6a compiler/typecheck/TcFlatten.hs | 2 +- compiler/typecheck/TcMType.hs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 89431f8..a5ece16 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -1744,7 +1744,7 @@ Note [Unflatten using funeqs first] [W] F (G a) ~ G a do not want to end up with - [W} F Int ~ Int + [W] F Int ~ Int because that might actually hold! Better to end up with the two above unsolved constraints. The flat form will be diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 2fffcd4..0eaae8f 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -454,11 +454,16 @@ tcInstTyVarX subst tyvar = do { uniq <- newUnique ; details <- newMetaDetails (TauTv False) ; let name = mkSystemName uniq (getOccName tyvar) + -- See Note [Name of an instantiated type variable] kind = substTy subst (tyVarKind tyvar) new_tv = mkTcTyVar name kind details ; return (extendTvSubst subst tyvar (mkTyVarTy new_tv), new_tv) } -{- +{- Note [Name of an instantiated type variable] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +At the moment we give a unification variable a System Name, which +influences the way it is tidied; see TypeRep.tidyTyVarBndr. + ************************************************************************ * * Quantification From git at git.haskell.org Wed Apr 22 13:05:03 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 13:05:03 +0000 (UTC) Subject: [commit: ghc] master: Improve error reporting for impredicative types (c715166) Message-ID: <20150422130503.825203A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c715166f9860635d84e4beaa76bf4e23ab764342/ghc >--------------------------------------------------------------- commit c715166f9860635d84e4beaa76bf4e23ab764342 Author: Simon Peyton Jones Date: Tue Apr 21 13:43:46 2015 +0100 Improve error reporting for impredicative types Don't suggest -XImpredicativeTypes; and document its flakiness Fixes Trac #10325 >--------------------------------------------------------------- c715166f9860635d84e4beaa76bf4e23ab764342 compiler/typecheck/TcErrors.hs | 2 +- compiler/typecheck/TcValidity.hs | 2 +- docs/users_guide/glasgow_exts.xml | 14 +++++++------- testsuite/tests/typecheck/should_fail/T10194.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/T2538.stderr | 8 ++++---- testsuite/tests/typecheck/should_fail/T7809.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/tcfail127.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/tcfail197.stderr | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 6b37e80..f32215b 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -919,7 +919,7 @@ mkTyVarEqErr dflags ctxt extra ct oriented tv1 ty2 = do { let msg = vcat [ ptext (sLit "Cannot instantiate unification variable") <+> quotes (ppr tv1) , hang (ptext (sLit "with a type involving foralls:")) 2 (ppr ty2) - , nest 2 (ptext (sLit "Perhaps you want ImpredicativeTypes")) ] + , nest 2 (ptext (sLit "GHC doesn't yet support impredicative polymorphism")) ] ; mkErrorMsgFromCt ctxt ct msg } -- If the immediately-enclosing implication has 'tv' a skolem, and diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index d3000a6..53b492d 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -360,7 +360,7 @@ data Rank = ArbitraryRank -- Any rank ok rankZeroMonoType, tyConArgMonoType, synArgMonoType :: Rank rankZeroMonoType = MonoType (ptext (sLit "Perhaps you intended to use RankNTypes or Rank2Types")) -tyConArgMonoType = MonoType (ptext (sLit "Perhaps you intended to use ImpredicativeTypes")) +tyConArgMonoType = MonoType (ptext (sLit "GHC doesn't yet support impredicative polymorphism")) synArgMonoType = MonoType (ptext (sLit "Perhaps you intended to use LiberalTypeSynonyms")) funArgResRank :: Rank -> (Rank, Rank) -- Function argument and result diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 630f2b4..b594fe0 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -8220,9 +8220,9 @@ for rank-2 types. Impredicative polymorphism -GHC supports impredicative polymorphism, +GHC has extremely flaky support for impredicative polymorphism, enabled with . -This means +If it worked, this would mean that you can call a polymorphic function at a polymorphic type, and parameterise data structures over polymorphic types. For example: @@ -8233,11 +8233,11 @@ parameterise data structures over polymorphic types. For example: Notice here that the Maybe type is parameterised by the polymorphic type (forall a. [a] -> [a]). - -The technical details of this extension are described in the paper -Boxy types: -type inference for higher-rank types and impredicativity, -which appeared at ICFP 2006. +However the extension should be considered highly experimental, and certainly un-supported. +You are welcome to try it, but please don't rely on it working consistently, or +working the same in subsequent releases. See +this wiki page +for more details. diff --git a/testsuite/tests/typecheck/should_fail/T10194.stderr b/testsuite/tests/typecheck/should_fail/T10194.stderr index 53ee74b..7bc79b2 100644 --- a/testsuite/tests/typecheck/should_fail/T10194.stderr +++ b/testsuite/tests/typecheck/should_fail/T10194.stderr @@ -1,7 +1,7 @@ -T10194.hs:7:8: +T10194.hs:7:8: error: Cannot instantiate unification variable ?b0? with a type involving foralls: X - Perhaps you want ImpredicativeTypes + GHC doesn't yet support impredicative polymorphism In the expression: (.) In an equation for ?comp?: comp = (.) diff --git a/testsuite/tests/typecheck/should_fail/T2538.stderr b/testsuite/tests/typecheck/should_fail/T2538.stderr index 884eafb..94583a4 100644 --- a/testsuite/tests/typecheck/should_fail/T2538.stderr +++ b/testsuite/tests/typecheck/should_fail/T2538.stderr @@ -1,14 +1,14 @@ -T2538.hs:6:6: +T2538.hs:6:6: error: Illegal polymorphic or qualified type: Eq a => a -> a Perhaps you intended to use RankNTypes or Rank2Types In the type signature for ?f?: f :: (Eq a => a -> a) -> Int -T2538.hs:9:6: +T2538.hs:9:6: error: Illegal polymorphic or qualified type: Eq a => a -> a - Perhaps you intended to use ImpredicativeTypes + GHC doesn't yet support impredicative polymorphism In the type signature for ?g?: g :: [Eq a => a -> a] -> Int -T2538.hs:12:6: +T2538.hs:12:6: error: Illegal polymorphic or qualified type: Eq a => a -> a In the type signature for ?h?: h :: Ix (Eq a => a -> a) => Int diff --git a/testsuite/tests/typecheck/should_fail/T7809.stderr b/testsuite/tests/typecheck/should_fail/T7809.stderr index e306f8d..153c4d1 100644 --- a/testsuite/tests/typecheck/should_fail/T7809.stderr +++ b/testsuite/tests/typecheck/should_fail/T7809.stderr @@ -1,5 +1,5 @@ -T7809.hs:8:8: +T7809.hs:8:8: error: Illegal polymorphic or qualified type: PolyId - Perhaps you intended to use ImpredicativeTypes + GHC doesn't yet support impredicative polymorphism In the type signature for ?foo?: foo :: F PolyId diff --git a/testsuite/tests/typecheck/should_fail/tcfail127.stderr b/testsuite/tests/typecheck/should_fail/tcfail127.stderr index d05a234..32af3d8 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail127.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail127.stderr @@ -1,5 +1,5 @@ -tcfail127.hs:3:8: +tcfail127.hs:3:8: error: Illegal polymorphic or qualified type: Num a => a -> a - Perhaps you intended to use ImpredicativeTypes + GHC doesn't yet support impredicative polymorphism In the type signature for ?foo?: foo :: IO (Num a => a -> a) diff --git a/testsuite/tests/typecheck/should_fail/tcfail197.stderr b/testsuite/tests/typecheck/should_fail/tcfail197.stderr index 35d24e4..c15af60 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail197.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail197.stderr @@ -1,5 +1,5 @@ -tcfail197.hs:5:8: +tcfail197.hs:5:8: error: Illegal polymorphic or qualified type: forall a. a - Perhaps you intended to use ImpredicativeTypes + GHC doesn't yet support impredicative polymorphism In the type signature for ?foo?: foo :: [forall a. a] -> Int From git at git.haskell.org Wed Apr 22 13:05:06 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 13:05:06 +0000 (UTC) Subject: [commit: ghc] master: Better documetation of higher rank types (746f086) Message-ID: <20150422130506.4CE3F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/746f086eae9e54ef9e02cf06b71c4f39e27617d5/ghc >--------------------------------------------------------------- commit 746f086eae9e54ef9e02cf06b71c4f39e27617d5 Author: Simon Peyton Jones Date: Wed Apr 22 14:05:03 2015 +0100 Better documetation of higher rank types In response to suggestions on Trac #10281 >--------------------------------------------------------------- 746f086eae9e54ef9e02cf06b71c4f39e27617d5 docs/users_guide/glasgow_exts.xml | 60 ++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index b594fe0..e9410f3 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -7979,10 +7979,21 @@ are clearly not Haskell-98, and an extra flag did not seem worth the bother. -The obselete language options and -are synonyms for . They used to specify finer distinctions that -GHC no longer makes. (They should really elicit a deprecation warning, but they don't, purely -to avoid the need to library authors to change their old flags specifciations.) +In particular, in data and +newtype declarations the constructor arguments may +be polymorphic types of any rank; see examples in . +Note that the declared types are +nevertheless always monomorphic. This is important because by default +GHC will not instantiate type variables to a polymorphic type +(). + + +The obsolete language options +and are synonyms for +. They used to specify finer +distinctions that GHC no longer makes. (They should really elicit a +deprecation warning, but they don't, purely to avoid the need to +library authors to change their old flags specifciations.) @@ -7990,12 +8001,8 @@ to avoid the need to library authors to change their old flags specifciations.) -In a data or newtype declaration one can quantify -the types of the constructor arguments. Here are several examples: - - - - +These are examples of data and newtype +declarations whose data constructors have polymorphic argument types: data T a = T1 (forall b. b -> b -> b) a @@ -8220,10 +8227,24 @@ for rank-2 types. Impredicative polymorphism +In general, GHC will only instantiate a polymorphic function at +a monomorphic type (one with no foralls). For example, + +runST :: (forall s. ST s a) -> a +id :: forall b. b -> b + +foo = id runST -- Rejected + +The definition of foo is rejected because one would have to instantiate +id's type with b := (forall s. ST s a) -> a, and +that is not allowed. +Instanting polymorpic type variables with polymorphic types is called impredicative polymorphism. + + GHC has extremely flaky support for impredicative polymorphism, enabled with . If it worked, this would mean -that you can call a polymorphic function at a polymorphic type, and +that you could call a polymorphic function at a polymorphic type, and parameterise data structures over polymorphic types. For example: f :: Maybe (forall a. [a] -> [a]) -> Maybe ([Int], [Char]) @@ -8231,14 +8252,27 @@ parameterise data structures over polymorphic types. For example: f Nothing = Nothing Notice here that the Maybe type is parameterised by the -polymorphic type (forall a. [a] -> -[a]). +polymorphic type (forall a. [a] -> [a]). However the extension should be considered highly experimental, and certainly un-supported. You are welcome to try it, but please don't rely on it working consistently, or working the same in subsequent releases. See this wiki page for more details. +If you want impredicative polymorphism, the main workaround is to use a newtype wrapper. +The id runST example can be written using theis workaround like this: + +runST :: (forall s. ST s a) -> a +id :: forall b. b -> b + +nwetype Wrap a = Wrap { unWrap :: (forall s. ST s a) -> a } + +foo :: (forall s. ST s a) -> a +foo = unWrap (id (Wrap runST)) + -- Here id is called at monomorphic type (Wrap a) + + + From git at git.haskell.org Wed Apr 22 13:18:29 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 13:18:29 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #9858 comment:101 (932f086) Message-ID: <20150422131829.C4E1B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/932f08677ca07f1793398e4c3456b81359728483/ghc >--------------------------------------------------------------- commit 932f08677ca07f1793398e4c3456b81359728483 Author: Simon Peyton Jones Date: Wed Apr 22 14:18:56 2015 +0100 Test Trac #9858 comment:101 >--------------------------------------------------------------- 932f08677ca07f1793398e4c3456b81359728483 testsuite/tests/typecheck/should_fail/T9858c.hs | 9 +++++++++ testsuite/tests/typecheck/should_fail/T9858c.stderr | 9 +++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 3 files changed, 19 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T9858c.hs b/testsuite/tests/typecheck/should_fail/T9858c.hs new file mode 100644 index 0000000..116a50b --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T9858c.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE ImpredicativeTypes, FlexibleContexts #-} + +module T9858b where +import Data.Typeable + +i :: (Typeable a, Typeable b) => Proxy (a b) -> TypeRep +i p = typeRep p + +j = i (Proxy :: Proxy (Eq Int => Int)) diff --git a/testsuite/tests/typecheck/should_fail/T9858c.stderr b/testsuite/tests/typecheck/should_fail/T9858c.stderr new file mode 100644 index 0000000..c2d0f22 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T9858c.stderr @@ -0,0 +1,9 @@ + +T9858c.hs:9:8: error: + Couldn't match type ?Eq Int => Int? with ?a0 b0? + Expected type: Proxy (a0 b0) + Actual type: Proxy (Eq Int => Int) + In the first argument of ?i?, namely + ?(Proxy :: Proxy (Eq Int => Int))? + In the expression: i (Proxy :: Proxy (Eq Int => Int)) + In an equation for ?j?: j = i (Proxy :: Proxy (Eq Int => Int)) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 1590020..befe8e3 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -358,3 +358,4 @@ test('T10194', normal, compile_fail, ['']) test('T8030', normal, compile_fail, ['']) test('T9858a', normal, compile_fail, ['']) test('T9858b', normal, compile_fail, ['']) +test('T9858c', normal, compile_fail, ['']) From git at git.haskell.org Wed Apr 22 14:18:01 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 14:18:01 +0000 (UTC) Subject: [commit: ghc] master: Rename new T9858c to T9858d to avoid test name clash (43d7137) Message-ID: <20150422141801.677E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/43d7137399e6edcf950b3ed43b752b06ad550d2e/ghc >--------------------------------------------------------------- commit 43d7137399e6edcf950b3ed43b752b06ad550d2e Author: Joachim Breitner Date: Wed Apr 22 16:18:27 2015 +0200 Rename new T9858c to T9858d to avoid test name clash >--------------------------------------------------------------- 43d7137399e6edcf950b3ed43b752b06ad550d2e testsuite/tests/typecheck/should_fail/{T9858c.hs => T9858d.hs} | 2 +- testsuite/tests/typecheck/should_fail/{T9858c.stderr => T9858d.stderr} | 2 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/typecheck/should_fail/T9858c.hs b/testsuite/tests/typecheck/should_fail/T9858d.hs similarity index 90% rename from testsuite/tests/typecheck/should_fail/T9858c.hs rename to testsuite/tests/typecheck/should_fail/T9858d.hs index 116a50b..dedd71c 100644 --- a/testsuite/tests/typecheck/should_fail/T9858c.hs +++ b/testsuite/tests/typecheck/should_fail/T9858d.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ImpredicativeTypes, FlexibleContexts #-} -module T9858b where +module T9858d where import Data.Typeable i :: (Typeable a, Typeable b) => Proxy (a b) -> TypeRep diff --git a/testsuite/tests/typecheck/should_fail/T9858c.stderr b/testsuite/tests/typecheck/should_fail/T9858d.stderr similarity index 94% rename from testsuite/tests/typecheck/should_fail/T9858c.stderr rename to testsuite/tests/typecheck/should_fail/T9858d.stderr index c2d0f22..9bc62f7 100644 --- a/testsuite/tests/typecheck/should_fail/T9858c.stderr +++ b/testsuite/tests/typecheck/should_fail/T9858d.stderr @@ -1,5 +1,5 @@ -T9858c.hs:9:8: error: +T9858d.hs:9:8: error: Couldn't match type ?Eq Int => Int? with ?a0 b0? Expected type: Proxy (a0 b0) Actual type: Proxy (Eq Int => Int) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index befe8e3..57569b9 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -358,4 +358,4 @@ test('T10194', normal, compile_fail, ['']) test('T8030', normal, compile_fail, ['']) test('T9858a', normal, compile_fail, ['']) test('T9858b', normal, compile_fail, ['']) -test('T9858c', normal, compile_fail, ['']) +test('T9858d', normal, compile_fail, ['']) From git at git.haskell.org Wed Apr 22 16:50:15 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Apr 2015 16:50:15 +0000 (UTC) Subject: [commit: ghc] master: Rename new T9858d to T9858e to avoid test name clash (a55bfab) Message-ID: <20150422165015.7F4013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a55bfabbed21f17064f863450f9d94d45db9c478/ghc >--------------------------------------------------------------- commit a55bfabbed21f17064f863450f9d94d45db9c478 Author: Joachim Breitner Date: Wed Apr 22 18:50:00 2015 +0200 Rename new T9858d to T9858e to avoid test name clash (Next time, when fixing someone else?s mistake, I really shouldn?t do the precise same thing.) >--------------------------------------------------------------- a55bfabbed21f17064f863450f9d94d45db9c478 testsuite/tests/typecheck/should_fail/{T9858d.hs => T9858e.hs} | 2 +- testsuite/tests/typecheck/should_fail/{T9858d.stderr => T9858e.stderr} | 2 +- testsuite/tests/typecheck/should_fail/all.T | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/typecheck/should_fail/T9858d.hs b/testsuite/tests/typecheck/should_fail/T9858e.hs similarity index 90% rename from testsuite/tests/typecheck/should_fail/T9858d.hs rename to testsuite/tests/typecheck/should_fail/T9858e.hs index dedd71c..0ec39a6 100644 --- a/testsuite/tests/typecheck/should_fail/T9858d.hs +++ b/testsuite/tests/typecheck/should_fail/T9858e.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ImpredicativeTypes, FlexibleContexts #-} -module T9858d where +module T9858e where import Data.Typeable i :: (Typeable a, Typeable b) => Proxy (a b) -> TypeRep diff --git a/testsuite/tests/typecheck/should_fail/T9858d.stderr b/testsuite/tests/typecheck/should_fail/T9858e.stderr similarity index 94% rename from testsuite/tests/typecheck/should_fail/T9858d.stderr rename to testsuite/tests/typecheck/should_fail/T9858e.stderr index 9bc62f7..04e0800 100644 --- a/testsuite/tests/typecheck/should_fail/T9858d.stderr +++ b/testsuite/tests/typecheck/should_fail/T9858e.stderr @@ -1,5 +1,5 @@ -T9858d.hs:9:8: error: +T9858e.hs:9:8: error: Couldn't match type ?Eq Int => Int? with ?a0 b0? Expected type: Proxy (a0 b0) Actual type: Proxy (Eq Int => Int) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 57569b9..abddd3e 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -358,4 +358,4 @@ test('T10194', normal, compile_fail, ['']) test('T8030', normal, compile_fail, ['']) test('T9858a', normal, compile_fail, ['']) test('T9858b', normal, compile_fail, ['']) -test('T9858d', normal, compile_fail, ['']) +test('T9858e', normal, compile_fail, ['']) From git at git.haskell.org Thu Apr 23 17:10:24 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Apr 2015 17:10:24 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Update Cabal submodule to 1.22.3.0 release (c09f4f8) Message-ID: <20150423171024.31F493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/c09f4f8015b29e723f057d0e1abb4bde611a55f6/ghc >--------------------------------------------------------------- commit c09f4f8015b29e723f057d0e1abb4bde611a55f6 Author: Herbert Valerio Riedel Date: Mon Apr 20 16:19:53 2015 +0200 Update Cabal submodule to 1.22.3.0 release Highlights since 1.22.2.0: - cabal check will fail on -fprof-auto passed as a ghc-option - filterConfigureFlags: filter more flags. - fix ghcjs-pkg version number handling Addresses #10304 (cherry picked from commit 4bc925a67285a71ddd14642e218d85de83bc214a) >--------------------------------------------------------------- c09f4f8015b29e723f057d0e1abb4bde611a55f6 libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index 5386dd5..bda1ce6 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 5386dd5c167a7fe7c3d17ba93803e1f477360df3 +Subproject commit bda1ce6b757cdaca93f2eba4e1906a4658719537 From git at git.haskell.org Fri Apr 24 09:15:08 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 09:15:08 +0000 (UTC) Subject: [commit: ghc] master: Make sure GHC.List.last is memory-efficient (524ddbd) Message-ID: <20150424091508.08E093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/524ddbdad5816f77b7b719cac0671eebd3473616/ghc >--------------------------------------------------------------- commit 524ddbdad5816f77b7b719cac0671eebd3473616 Author: Joachim Breitner Date: Thu Apr 16 14:49:23 2015 +0200 Make sure GHC.List.last is memory-efficient by eta-expanding its definition so that GHC optmizes the foldl here. Also make sure that other uses of last go via foldl as well, to allow list fusion (tested in T9339). Fixes #10260. >--------------------------------------------------------------- 524ddbdad5816f77b7b719cac0671eebd3473616 libraries/base/GHC/List.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index a712f9e..fcc89d3 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -84,8 +84,15 @@ last [x] = x last (_:xs) = last xs last [] = errorEmptyList "last" #else --- use foldl to allow fusion -last = foldl (\_ x -> x) (errorEmptyList "last") +-- Use foldl to make last a good consumer. +-- This will compile to good code for the actual GHC.List.last. +-- (At least as long it is eta-expaned, otherwise it does not, #10260.) +last xs = foldl (\_ x -> x) lastError xs +{-# INLINE last #-} +-- The inline pragma is required to make GHC remember the implementation via +-- foldl. +lastError :: a +lastError = errorEmptyList "last" #endif -- | Return all the elements of a list except the last one. From git at git.haskell.org Fri Apr 24 14:15:27 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 14:15:27 +0000 (UTC) Subject: [commit: nofib] master: Add exact-real-arithmetic benchmark from David Lester (20ae911) Message-ID: <20150424141527.77E663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/20ae9113ad31eca426883544f597a3cae9b60d94/nofib >--------------------------------------------------------------- commit 20ae9113ad31eca426883544f597a3cae9b60d94 Author: Simon Peyton Jones Date: Fri Apr 24 15:10:02 2015 +0100 Add exact-real-arithmetic benchmark from David Lester >--------------------------------------------------------------- 20ae9113ad31eca426883544f597a3cae9b60d94 spectral/exact-reals/Era.hs | 221 ++++++++++++++++++++++ {real/cacheprof => spectral/exact-reals}/Makefile | 0 spectral/exact-reals/exact-reals.stdout | 1 + 3 files changed, 222 insertions(+) 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 20ae9113ad31eca426883544f597a3cae9b60d94 From git at git.haskell.org Fri Apr 24 21:02:07 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 21:02:07 +0000 (UTC) Subject: [commit: ghc] master: Rename role annotations w.r.t only local decls. (6ab5da9) Message-ID: <20150424210207.D3E223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ab5da9913e4f8a8dcc8bda3c77d4e896fd67352/ghc >--------------------------------------------------------------- commit 6ab5da9913e4f8a8dcc8bda3c77d4e896fd67352 Author: Richard Eisenberg Date: Fri Apr 10 22:25:29 2015 +0100 Rename role annotations w.r.t only local decls. Fix #10263. >--------------------------------------------------------------- 6ab5da9913e4f8a8dcc8bda3c77d4e896fd67352 compiler/rename/RnEnv.hs | 15 +++++++++++++-- compiler/rename/RnSource.hs | 19 ++++++++++++------- testsuite/tests/ghci/scripts/T8485.stderr | 6 +++--- testsuite/tests/roles/should_compile/T10263.hs | 5 +++++ testsuite/tests/roles/should_compile/all.T | 1 + 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index d9d471a..0794412 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -17,6 +17,7 @@ module RnEnv ( reportUnboundName, HsSigCtxt(..), lookupLocalTcNames, lookupSigOccRn, + lookupSigCtxtOccRn, lookupFixityRn, lookupTyFixityRn, lookupInstDeclBndr, lookupSubBndrOcc, lookupFamInstName, @@ -1064,13 +1065,22 @@ data HsSigCtxt | ClsDeclCtxt Name -- Class decl for this class | InstDeclCtxt Name -- Intsance decl for this class | HsBootCtxt -- Top level of a hs-boot file + | RoleAnnotCtxt NameSet -- A role annotation, with the names of all types + -- in the group lookupSigOccRn :: HsSigCtxt -> Sig RdrName -> Located RdrName -> RnM (Located Name) -lookupSigOccRn ctxt sig +lookupSigOccRn ctxt sig = lookupSigCtxtOccRn ctxt (hsSigDoc sig) + +-- | Lookup a name in relation to the names in a 'HsSigCtxt' +lookupSigCtxtOccRn :: HsSigCtxt + -> SDoc -- ^ description of thing we're looking up, + -- like "type family" + -> Located RdrName -> RnM (Located Name) +lookupSigCtxtOccRn ctxt what = wrapLocM $ \ rdr_name -> - do { mb_name <- lookupBindGroupOcc ctxt (hsSigDoc sig) rdr_name + do { mb_name <- lookupBindGroupOcc ctxt what rdr_name ; case mb_name of Left err -> do { addErr err; return (mkUnboundName rdr_name) } Right name -> return name } @@ -1098,6 +1108,7 @@ lookupBindGroupOcc ctxt what rdr_name = case ctxt of HsBootCtxt -> lookup_top (const True) True TopSigCtxt ns meth_ok -> lookup_top (`elemNameSet` ns) meth_ok + RoleAnnotCtxt ns -> lookup_top (`elemNameSet` ns) False LocalBindCtxt ns -> lookup_group ns ClsDeclCtxt cls -> lookup_cls_op cls InstDeclCtxt cls -> lookup_cls_op cls diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index 5b250c6..a54aaf0 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -951,7 +951,8 @@ rnTyClDecls :: Maybe FreeVars -> [TyClGroup RdrName] -- Rename the declarations and do depedency analysis on them rnTyClDecls extra_deps tycl_ds = do { ds_w_fvs <- mapM (wrapLocFstM rnTyClDecl) (tyClGroupConcat tycl_ds) - ; role_annot_env <- rnRoleAnnots (concatMap group_roles tycl_ds) + ; let decl_names = mkNameSet (map (tcdName . unLoc . fst) ds_w_fvs) + ; role_annot_env <- rnRoleAnnots decl_names (concatMap group_roles tycl_ds) ; this_mod <- getModule ; let add_boot_deps :: FreeVars -> FreeVars -- See Note [Extra dependencies from .hs-boot files] @@ -1094,13 +1095,14 @@ rnTyClDecl (ClassDecl {tcdCtxt = context, tcdLName = lcls, rnTySyn :: HsDocContext -> LHsType RdrName -> RnM (LHsType Name, FreeVars) rnTySyn doc rhs = rnLHsType doc rhs --- Renames role annotations, returning them as the values in a NameEnv +-- | Renames role annotations, returning them as the values in a NameEnv -- and checks for duplicate role annotations. -- It is quite convenient to do both of these in the same place. -- See also Note [Role annotations in the renamer] -rnRoleAnnots :: [LRoleAnnotDecl RdrName] - -> RnM (NameEnv (LRoleAnnotDecl Name)) -rnRoleAnnots role_annots +rnRoleAnnots :: NameSet -- ^ of the decls in this group + -> [LRoleAnnotDecl RdrName] + -> RnM (NameEnv (LRoleAnnotDecl Name)) +rnRoleAnnots decl_names role_annots = do { -- check for duplicates *before* renaming, to avoid lumping -- together all the unboundNames let (no_dups, dup_annots) = removeDups role_annots_cmp role_annots @@ -1116,8 +1118,11 @@ rnRoleAnnots role_annots , not (isUnboundName name) ] } where rn_role_annot1 (RoleAnnotDecl tycon roles) - = do { -- the name is an *occurrence* - tycon' <- wrapLocM lookupGlobalOccRn tycon + = do { -- the name is an *occurrence*, but look it up only in the + -- decls defined in this group (see #10263) + tycon' <- lookupSigCtxtOccRn (RoleAnnotCtxt decl_names) + (text "role annotation") + tycon ; return $ RoleAnnotDecl tycon' roles } dupRoleAnnotErr :: [LRoleAnnotDecl RdrName] -> RnM () diff --git a/testsuite/tests/ghci/scripts/T8485.stderr b/testsuite/tests/ghci/scripts/T8485.stderr index 6635882..bbef720 100644 --- a/testsuite/tests/ghci/scripts/T8485.stderr +++ b/testsuite/tests/ghci/scripts/T8485.stderr @@ -1,4 +1,4 @@ -:3:1: - Role annotation for a type previously declared: type role X nominal - (The role annotation must be given where ?X? is declared.) +:3:11: error: + The role annotation for ?X? lacks an accompanying binding + (The role annotation must be given where ?X? is declared) diff --git a/testsuite/tests/roles/should_compile/T10263.hs b/testsuite/tests/roles/should_compile/T10263.hs new file mode 100644 index 0000000..d12a3a4 --- /dev/null +++ b/testsuite/tests/roles/should_compile/T10263.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE RoleAnnotations #-} +module T10263 where + +data Maybe a = AF +type role Maybe representational diff --git a/testsuite/tests/roles/should_compile/all.T b/testsuite/tests/roles/should_compile/all.T index 0bd779f..2e0d8ea 100644 --- a/testsuite/tests/roles/should_compile/all.T +++ b/testsuite/tests/roles/should_compile/all.T @@ -5,3 +5,4 @@ test('Roles4', only_ways('normal'), compile, ['-ddump-tc']) test('Roles13', only_ways('normal'), compile, ['-ddump-simpl -dsuppress-uniques']) test('Roles14', only_ways('normal'), compile, ['-ddump-tc']) test('T8958', [normalise_fun(normalise_errmsg), only_ways('normal')], compile, ['-ddump-tc -dsuppress-uniques']) +test('T10263', normal, compile, ['']) From git at git.haskell.org Fri Apr 24 21:02:11 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 21:02:11 +0000 (UTC) Subject: [commit: ghc] master: Fix #10285 by refusing to use NthCo on a newtype. (a8d39a7) Message-ID: <20150424210211.5F7DE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a8d39a7255df187b742fecc049f0de6528b9acad/ghc >--------------------------------------------------------------- commit a8d39a7255df187b742fecc049f0de6528b9acad Author: Richard Eisenberg Date: Thu Apr 23 15:31:37 2015 -0400 Fix #10285 by refusing to use NthCo on a newtype. During this commit, I tested to make sure that CoreLint actually catches the Core error if the typechecker doesn't. Test case: typecheck/should_fail/T10285 >--------------------------------------------------------------- a8d39a7255df187b742fecc049f0de6528b9acad compiler/coreSyn/CoreLint.hs | 2 ++ compiler/typecheck/TcCanonical.hs | 25 ++++++++++++++--- compiler/types/Coercion.hs | 31 +++++++++++++++++++++- testsuite/tests/typecheck/should_fail/T10285.hs | 11 ++++++++ .../tests/typecheck/should_fail/T10285.stderr | 20 ++++++++++++++ testsuite/tests/typecheck/should_fail/T10285a.hs | 11 ++++++++ testsuite/tests/typecheck/should_fail/all.T | 4 +++ 7 files changed, 99 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 256a682..ec0bb5e 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1255,6 +1255,8 @@ lintCoercion the_co@(NthCo n co) ; case (splitTyConApp_maybe s, splitTyConApp_maybe t) of (Just (tc_s, tys_s), Just (tc_t, tys_t)) | tc_s == tc_t + , isDistinctTyCon tc_s || r /= Representational + -- see Note [NthCo and newtypes] in Coercion , tys_s `equalLength` tys_t , n < length tys_s -> return (ks, ts, tt, tr) diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index 80768a6..e9e35a4 100644 --- a/compiler/typecheck/TcCanonical.hs +++ b/compiler/typecheck/TcCanonical.hs @@ -684,11 +684,14 @@ canDecomposableTyConApp :: CtEvidence -> EqRel -- See Note [Decomposing TyConApps] canDecomposableTyConApp ev eq_rel tc1 tys1 tc2 tys2 | tc1 == tc2 - , length tys1 == length tys2 -- Success: decompose! - = do { traceTcS "canDecomposableTyConApp" + , length tys1 == length tys2 + = if eq_rel == NomEq || ctEvFlavour ev /= Given || isDistinctTyCon tc1 + -- See Note [Decomposing newtypes] + then do { traceTcS "canDecomposableTyConApp" (ppr ev $$ ppr eq_rel $$ ppr tc1 $$ ppr tys1 $$ ppr tys2) - ; canDecomposableTyConAppOK ev eq_rel tc1 tys1 tys2 - ; stopWith ev "Decomposed TyConApp" } + ; canDecomposableTyConAppOK ev eq_rel tc1 tys1 tys2 + ; stopWith ev "Decomposed TyConApp" } + else canEqFailure ev eq_rel ty1 ty2 -- Fail straight away for better error messages -- See Note [Use canEqFailure in canDecomposableTyConApp] @@ -714,6 +717,20 @@ Here is the case: Suppose we are canonicalising (Int ~R DF (T a)), where we don't yet know `a`. This is *not* a hard failure, because we might soon learn that `a` is, in fact, Char, and then the equality succeeds. + +Note [Decomposing newtypes] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +As explained in Note [NthCo and newtypes] in Coercion, we can't use +NthCo on representational coercions over newtypes. So we avoid doing +so. + +But is it sensible to decompose *Wanted* constraints over newtypes? +Yes. By the time we reach canDecomposableTyConApp, we know that any +newtypes that can be unwrapped have been. So, without importing more +constructors, say, we know there is no way forward other than decomposition. +So we take the one route we have available. This *does* mean that +importing a newtype's constructor might make code that previously +compiled fail to do so. (If that newtype is perversely recursive, say.) -} canDecomposableTyConAppOK :: CtEvidence -> EqRel diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index e6e21b1..797f785 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -190,6 +190,8 @@ data Coercion | NthCo Int Coercion -- Zero-indexed; decomposes (T t0 ... tn) -- :: _ -> e -> ?? (inverse of TyConAppCo, see Note [TyConAppCo roles]) + -- See Note [NthCo and newtypes] + | LRCo LeftOrRight Coercion -- Decomposes (t_left t_right) -- :: _ -> N -> N | InstCo Coercion Type @@ -496,6 +498,34 @@ TyConAppCo Phantom Foo (UnivCo Phantom Int Bool) : Foo Int ~P Foo Bool The rules here dictate the roles of the parameters to mkTyConAppCo (should be checked by Lint). +Note [NthCo and newtypes] +~~~~~~~~~~~~~~~~~~~~~~~~~ +Suppose we have + + newtype N a = MkN Int + type role N representational + +This yields axiom + + NTCo:N :: forall a. N a ~R Int + +We can then build + + co :: forall a b. N a ~R N b + co = NTCo:N a ; sym (NTCo:N b) + +for any `a` and `b`. Because of the role annotation on N, if we use +NthCo, we'll get out a representational coercion. That is: + + NthCo 0 co :: forall a b. a ~R b + +Yikes! Clearly, this is terrible. The solution is simple: forbid +NthCo to be used on newtypes if the internal coercion is representational. + +This is not just some corner case discovered by a segfault somewhere; +it was discovered in the proof of soundness of roles and described +in the "Safe Coercions" paper (ICFP '14). + ************************************************************************ * * \subsection{Coercion variables} @@ -1988,4 +2018,3 @@ Kind coercions are only of the form: Refl kind. They are only used to instantiate kind polymorphic type constructors in TyConAppCo. Remember that kind instantiation only happens with TyConApp, not AppTy. -} - diff --git a/testsuite/tests/typecheck/should_fail/T10285.hs b/testsuite/tests/typecheck/should_fail/T10285.hs new file mode 100644 index 0000000..cebdfe1 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T10285.hs @@ -0,0 +1,11 @@ +module T10285 where + +import T10285a +import Data.Type.Coercion +import Data.Coerce + +oops :: Coercion (N a) (N b) -> a -> b +oops Coercion = coerce + +unsafeCoerce :: a -> b +unsafeCoerce = oops coercion diff --git a/testsuite/tests/typecheck/should_fail/T10285.stderr b/testsuite/tests/typecheck/should_fail/T10285.stderr new file mode 100644 index 0000000..b56f124 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T10285.stderr @@ -0,0 +1,20 @@ + +T10285.hs:8:17: error: + Could not deduce: a ~ b + from the context: Coercible (N a) (N b) + bound by a pattern with constructor: + Coercion :: forall (k :: BOX) (a :: k) (b :: k). + Coercible a b => + Coercion a b, + in an equation for ?oops? + at T10285.hs:8:6-13 + ?a? is a rigid type variable bound by + the type signature for: oops :: Coercion (N a) (N b) -> a -> b + at T10285.hs:7:9 + ?b? is a rigid type variable bound by + the type signature for: oops :: Coercion (N a) (N b) -> a -> b + at T10285.hs:7:9 + Relevant bindings include + oops :: Coercion (N a) (N b) -> a -> b (bound at T10285.hs:8:1) + In the expression: coerce + In an equation for ?oops?: oops Coercion = coerce diff --git a/testsuite/tests/typecheck/should_fail/T10285a.hs b/testsuite/tests/typecheck/should_fail/T10285a.hs new file mode 100644 index 0000000..53a468b --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T10285a.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE RoleAnnotations #-} + +module T10285a (N, coercion) where + +import Data.Type.Coercion + +newtype N a = MkN Int +type role N representational + +coercion :: Coercion (N a) (N b) +coercion = Coercion diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index abddd3e..110f29f 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -359,3 +359,7 @@ test('T8030', normal, compile_fail, ['']) test('T9858a', normal, compile_fail, ['']) test('T9858b', normal, compile_fail, ['']) test('T9858e', normal, compile_fail, ['']) + +test('T10285', + extra_clean(['T10285a.hi', 'T10285a.o']), + multimod_compile_fail, ['T10285', '-v0']) From git at git.haskell.org Fri Apr 24 21:02:14 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 21:02:14 +0000 (UTC) Subject: [commit: ghc] master: Fix the formal operational semantics (#10121) (414e20b) Message-ID: <20150424210214.50C263A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/414e20bc7f5166d020ace3d92cd605e121d5eb3c/ghc >--------------------------------------------------------------- commit 414e20bc7f5166d020ace3d92cd605e121d5eb3c Author: Richard Eisenberg Date: Thu Apr 23 16:02:43 2015 -0400 Fix the formal operational semantics (#10121) This adapts the work of Christiaan Baaij to present a sensible operational semantics for FC with mutual recursion. >--------------------------------------------------------------- 414e20bc7f5166d020ace3d92cd605e121d5eb3c docs/core-spec/CoreLint.ott | 2 +- docs/core-spec/CoreSyn.ott | 6 +++++- docs/core-spec/OpSem.ott | 48 +++++++++++++++++++++++++++---------------- docs/core-spec/core-spec.mng | 8 +++++--- docs/core-spec/core-spec.pdf | Bin 340768 -> 342464 bytes 5 files changed, 41 insertions(+), 23 deletions(-) diff --git a/docs/core-spec/CoreLint.ott b/docs/core-spec/CoreLint.ott index 6015731..7058e8a 100644 --- a/docs/core-spec/CoreLint.ott +++ b/docs/core-spec/CoreLint.ott @@ -209,7 +209,7 @@ G |-co z_(s ~R#k t) : s ~Rep k t G |-ty t1 : k1 G |-ty t2 : k2 -R <= Phant \/ not (k1 <: OpenKind) \/ not (k2 <: OpenKind) \/ compatibleUnBoxedTys t1 t2 +R <= Ph \/ not (k1 <: OpenKind) \/ not (k2 <: OpenKind) \/ compatibleUnBoxedTys t1 t2 ------------------------------------------------------------------------ :: UnivCo G |-co t1 ==>!_R t2 : t1 ~R k2 t2 diff --git a/docs/core-spec/CoreSyn.ott b/docs/core-spec/CoreSyn.ott index d64667a..247fd05 100644 --- a/docs/core-spec/CoreSyn.ott +++ b/docs/core-spec/CoreSyn.ott @@ -69,10 +69,12 @@ e, u :: 'Expr_' ::= {{ com Expressions, \coderef{coreSyn/CoreSyn.lhs}{Expr} }} | ( e ) :: M :: Parens {{ com Parenthesized expression }} | e :: M :: Apps {{ com Nested application }} | S ( n ) :: M :: Lookup {{ com Lookup in the runtime store }} + | \\ e :: M :: Newline + {{ tex \qquad \\ \multicolumn{1}{r}{[[e]]} }} binding :: 'Bind_' ::= {{ com Let-bindings, \coderef{coreSyn/CoreSyn.lhs}{Bind} }} | n = e :: :: NonRec {{ com Non-recursive binding }} - | rec :: :: Rec {{ com Recursive binding }} + | rec :: :: Rec {{ com Recursive binding }} alt :: 'Alt_' ::= {{ com Case alternative, \coderef{coreSyn/CoreSyn.lhs}{Alt} }} | Kp -> e :: :: Alt {{ com Constructor applied to fresh names }} @@ -265,6 +267,7 @@ terminals :: 'terminals_' ::= {{ tex \twoheadrightarrow\!\!\!\!\!\! \raisebox{-.3ex}{!} \,\,\,\,\, }} | sym :: :: sym {{ tex \textsf{sym} }} | ; :: :: trans {{ tex \fatsemi }} + | ;; :: :: semi {{ tex ; }} | Left :: :: Left {{ tex \textsf{left} }} | Right :: :: Right {{ tex \textsf{right} }} | _ :: :: wildcard {{ tex \text{\textvisiblespace} }} @@ -314,6 +317,7 @@ terminals :: 'terminals_' ::= | take :: :: take {{ tex \textsf{take}\! }} | coaxrProves :: :: coaxrProves {{ tex \textsf{coaxrProves} }} | Just :: :: Just {{ tex \textsf{Just} }} + | \\ :: :: newline {{ tex \\ }} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Formulae %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/docs/core-spec/OpSem.ott b/docs/core-spec/OpSem.ott index 1c21ada..ed59e95 100644 --- a/docs/core-spec/OpSem.ott +++ b/docs/core-spec/OpSem.ott @@ -20,7 +20,7 @@ defns OpSem :: '' ::= defn S |- e --> e' :: :: step :: 'S_' {{ com Single step semantics }} -{{ tex [[S]] \labeledjudge{op} [[e]] [[-->]] [[e']] }} +{{ tex \begin{array}{l} [[S]] \labeledjudge{op} [[e]] [[-->]] [[e']] \end{array} }} by S(n) = e @@ -50,18 +50,16 @@ g2 = nth 1 g ------------------------------- :: CPush S |- ((\n.e) |> g) g' --> (\n.e |> g2) (g0 ; g' ; g1) ------------------ :: LetNonRec -S |- let n = e1 in e2 --> e2[n |-> e1] - - -S, ei] // i /> |- u --> u' ------------------------------------- :: LetRec -S |- let rec in u --> let rec in u' +--------------------------------------- :: Trans +S |- (e |> g1) |> g2 --> e |> (g1 ; g2) -fv(u) \inter = empty ------------------------------------------- :: LetRecReturn -S |- let rec in u --> u +S |- e --> e' +------------------------ :: Cast +S |- e |> g --> e' |> g +S |- e --> e' +------------------------------ :: Tick +S |- e { tick } --> e' { tick } S |- e --> e' --------------------------------------- :: Case @@ -85,13 +83,27 @@ T ~#k T = coercionKind g forall . forall . @-> T = dataConRepType K (t1cc @ nth aa g] // aa /> _Nom] // bb />) // cc /> --------------------------- :: CasePush -S |- case (K ) |> g as n return t2 of --> case K as n return t2 of +S |- case (K ) |> g as n return t2 of --> \\ case K as n return t2 of -S |- e --> e' ------------------------- :: Cast -S |- e |> g --> e' |> g +----------------- :: LetNonRec +S |- let n = e1 in e2 --> e2[n |-> e1] -S |- e --> e' ------------------------------- :: Tick -S |- e { tick } --> e' { tick } +S, ei] // i /> |- u --> u' +------------------------------------ :: LetRec +S |- let rec in u --> let rec in u' + +--------------- :: LetRecApp +S |- (let rec in u) e' --> let rec in (u e') + +---------------- :: LetRecCast +S |- (let rec in u) |> g --> let rec in (u |> g) +--------------- :: LetRecCase +S |- case (let rec in u) as n0 return t of --> \\ let rec in (case u as n0 return t of ) + +--------------- :: LetRecFlat +S |- let rec in (let rec in u) --> let rec ;; in u + +fv(u) \inter = empty +--------------------------------- :: LetRecReturn +S |- let rec in u --> u diff --git a/docs/core-spec/core-spec.mng b/docs/core-spec/core-spec.mng index ddbc614..7830e89 100644 --- a/docs/core-spec/core-spec.mng +++ b/docs/core-spec/core-spec.mng @@ -30,7 +30,7 @@ System FC, as implemented in GHC\footnote{This document was originally prepared by Richard Eisenberg (\texttt{eir at cis.upenn.edu}), but it should be maintained by anyone who edits the functions or data structures mentioned in this file. Please feel free to contact Richard for more information.}\\ -\Large 21 November, 2013 +\Large 23 April 2015 \end{center} \section{Introduction} @@ -446,11 +446,13 @@ use of FC does not require modeling recursion, you will not need to track $[[S]] \subsection{Notes} \begin{itemize} -\item The \ottdrulename{S\_LetRec} and \ottdrulename{S\_LetRecReturn} rules +\item The \ottdrulename{S\_LetRec} rules implement recursion. \ottdrulename{S\_LetRec} adds to the context $[[S]]$ bindings for all of the mutually recursive equations. Then, after perhaps many steps, when the body of the $[[let]]\ [[rec]]$ contains no variables that are bound -in the $[[let]]\ [[rec]]$, the context is popped. +in the $[[let]]\ [[rec]]$, the context is popped in \ottdrulename{S\_LetRecReturn}. +The other \ottdrulename{S\_LetRecXXX} +rules are there to prevent reduction from getting stuck. \item In the $[[case]]$ rules, a constructor $[[K]]$ is written taking three lists of arguments: two lists of types and a list of terms. The types passed in are the universally and, respectively, existentially quantified type variables diff --git a/docs/core-spec/core-spec.pdf b/docs/core-spec/core-spec.pdf index 8d2e5cb..93242e9 100644 Binary files a/docs/core-spec/core-spec.pdf and b/docs/core-spec/core-spec.pdf differ From git at git.haskell.org Fri Apr 24 21:02:17 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 21:02:17 +0000 (UTC) Subject: [commit: ghc] master: Test #10321 in ghci/scripts/T10321 (d4cf559) Message-ID: <20150424210217.CED823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4cf5591e51e2b91b3877a05f8153db1f5328994/ghc >--------------------------------------------------------------- commit d4cf5591e51e2b91b3877a05f8153db1f5328994 Author: Richard Eisenberg Date: Thu Apr 23 16:57:34 2015 -0400 Test #10321 in ghci/scripts/T10321 >--------------------------------------------------------------- d4cf5591e51e2b91b3877a05f8153db1f5328994 testsuite/tests/ghci/scripts/T10321.hs | 14 ++++++++++++++ testsuite/tests/ghci/scripts/T10321.script | 2 ++ testsuite/tests/ghci/scripts/all.T | 2 ++ 3 files changed, 18 insertions(+) diff --git a/testsuite/tests/ghci/scripts/T10321.hs b/testsuite/tests/ghci/scripts/T10321.hs new file mode 100644 index 0000000..44d264a --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10321.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE TypeOperators #-} + +module T10321 where + +import GHC.TypeLits + +data Vec :: Nat -> * -> * where + Nil :: Vec 0 a + (:>) :: a -> Vec n a -> Vec (n + 1) a + +infixr 5 :> diff --git a/testsuite/tests/ghci/scripts/T10321.script b/testsuite/tests/ghci/scripts/T10321.script new file mode 100644 index 0000000..1ec4792 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T10321.script @@ -0,0 +1,2 @@ +:load T10321 +:t 3 :> 4 :> 5 :> Nil diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 01de663..c562903 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -209,3 +209,5 @@ test('T9878b', test('T10122', normal, ghci_script, ['T10122.script']) test('T10322', when(opsys('darwin'), expect_broken(10322)), ghci_script, ['T10322.script']) + +test('T10321', expect_broken(10321), ghci_script, ['T10321.script']) From git at git.haskell.org Fri Apr 24 21:02:21 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 21:02:21 +0000 (UTC) Subject: [commit: ghc] master: Change default roles in hs-boot files. (#9204) (72a9272) Message-ID: <20150424210221.38EE33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72a927267d9c658a2e5d226a855702d348472516/ghc >--------------------------------------------------------------- commit 72a927267d9c658a2e5d226a855702d348472516 Author: Richard Eisenberg Date: Thu Apr 23 22:34:33 2015 -0400 Change default roles in hs-boot files. (#9204) Test case: roles/should_compile/T9204b >--------------------------------------------------------------- 72a927267d9c658a2e5d226a855702d348472516 compiler/typecheck/TcRnDriver.hs | 6 ++-- compiler/typecheck/TcTyDecls.hs | 6 ++-- docs/users_guide/7.12.1-notes.xml | 13 ++++++- docs/users_guide/separate_compilation.xml | 2 +- .../tests/rename/should_fail/rnfail055.stderr | 41 ++++++++++++---------- testsuite/tests/roles/should_compile/T9204b.hs | 5 +++ .../tests/roles/should_compile/T9204b.hs-boot | 3 ++ testsuite/tests/roles/should_compile/T9204b2.hs | 3 ++ testsuite/tests/roles/should_compile/all.T | 1 + testsuite/tests/roles/should_fail/Roles12.stderr | 5 +-- testsuite/tests/roles/should_fail/T9204.stderr | 5 +-- .../tests/typecheck/should_fail/tcfail220.stderr | 10 +++--- 12 files changed, 65 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 72a927267d9c658a2e5d226a855702d348472516 From git at git.haskell.org Fri Apr 24 21:02:24 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 21:02:24 +0000 (UTC) Subject: [commit: ghc] master: Test case for #10141 (dc587fe) Message-ID: <20150424210224.B294A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dc587fe7f27e2bc762d8a6cae3687ca2ebbbdb9b/ghc >--------------------------------------------------------------- commit dc587fe7f27e2bc762d8a6cae3687ca2ebbbdb9b Author: Richard Eisenberg Date: Thu Apr 23 17:02:32 2015 -0400 Test case for #10141 >--------------------------------------------------------------- dc587fe7f27e2bc762d8a6cae3687ca2ebbbdb9b testsuite/tests/indexed-types/should_fail/T10141.hs | 8 ++++++++ testsuite/tests/indexed-types/should_fail/T10141.stderr | 6 ++++++ testsuite/tests/indexed-types/should_fail/all.T | 1 + 3 files changed, 15 insertions(+) diff --git a/testsuite/tests/indexed-types/should_fail/T10141.hs b/testsuite/tests/indexed-types/should_fail/T10141.hs new file mode 100644 index 0000000..a2b3931 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T10141.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TypeFamilies, PolyKinds #-} + +module T10141 where + +type family G (a :: k) where + G Int = Bool + G Bool = Int + G a = a diff --git a/testsuite/tests/indexed-types/should_fail/T10141.stderr b/testsuite/tests/indexed-types/should_fail/T10141.stderr new file mode 100644 index 0000000..2cb2652 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T10141.stderr @@ -0,0 +1,6 @@ + +T10141.hs:6:6: error: + The first argument of ?G? should have kind ?k?, + but ?Int? has kind ?*? + In the type ?Int? + In the type family declaration for ?G? diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index 2954458..6615c02 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -136,3 +136,4 @@ test('T6088', normal, compile_fail, ['']) test('T7788', normal, compile_fail, ['']) test('T8550', normal, compile_fail, ['']) test('T9554', normal, compile_fail, ['']) +test('T10141', normal, compile_fail, ['']) From git at git.haskell.org Fri Apr 24 23:12:34 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Apr 2015 23:12:34 +0000 (UTC) Subject: [commit: ghc] master: Updates to Backpack documentation based on recent visit to MSRC. (bbabb71) Message-ID: <20150424231234.2ED903A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bbabb711b2a7bdc87045202d5233f57135c21649/ghc >--------------------------------------------------------------- commit bbabb711b2a7bdc87045202d5233f57135c21649 Author: Edward Z. Yang Date: Mon Apr 20 22:52:19 2015 +0100 Updates to Backpack documentation based on recent visit to MSRC. Includes lots of shaping examples, and a shaping algorithm description. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- bbabb711b2a7bdc87045202d5233f57135c21649 docs/backpack/Makefile | 8 +- docs/backpack/algorithm.pdf | Bin 0 -> 164855 bytes docs/backpack/algorithm.tex | 413 ++++++++++++++++ docs/backpack/backpack-impl.pdf | Bin 436175 -> 437394 bytes docs/backpack/backpack-impl.tex | 27 ++ docs/backpack/backpack-manual.pdf | Bin 202608 -> 151402 bytes docs/backpack/backpack-manual.tex | 946 ++++++++++++++----------------------- docs/backpack/backpack-shaping.pdf | Bin 0 -> 238012 bytes docs/backpack/backpack-shaping.tex | 692 +++++++++++++++++++++++++++ 9 files changed, 1491 insertions(+), 595 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 bbabb711b2a7bdc87045202d5233f57135c21649 From git at git.haskell.org Sat Apr 25 06:16:41 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 06:16:41 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: configure: LLVM and LD detection improvements (#10329) (99e4e26) Message-ID: <20150425061641.2815B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/99e4e26a2672f7697cf1f76306c3dfb63125e035/ghc >--------------------------------------------------------------- commit 99e4e26a2672f7697cf1f76306c3dfb63125e035 Author: Erik de Castro Lopo Date: Sat Apr 25 08:14:48 2015 +0200 configure: LLVM and LD detection improvements (#10329) The ghc-7.10 branch *only* works with llvm-3.5. This commit is basically the ghc-7.10 branch version of 485dba86d2 in the master branch. Signed-off-by: Erik de Castro Lopo Differential Revision: https://phabricator.haskell.org/D856 >--------------------------------------------------------------- 99e4e26a2672f7697cf1f76306c3dfb63125e035 aclocal.m4 | 50 +++++++++++++++++++++++++++++++++++-------------- configure.ac | 21 +++++---------------- distrib/configure.ac.in | 23 +++++++++++++++++++++-- 3 files changed, 62 insertions(+), 32 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 671f545..63e21e5 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2099,21 +2099,43 @@ AC_DEFUN([XCODE_VERSION],[ # $4 = the version of the command to look for # AC_DEFUN([FIND_LLVM_PROG],[ - # Test for program with version name. + # Test for program with version name. FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3-$4]) if test "$$1" = ""; then - # Test for program without version name. - FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) - AC_MSG_CHECKING([$$1 is version $4]) - if test `$$1 --version | grep -c "version $4"` -gt 0 ; then + # Test for program without version name. + FP_ARG_WITH_PATH_GNU_PROG_OPTIONAL_NOTARGET([$1], [$2], [$3]) + AC_MSG_CHECKING([$$1 is version $4]) + if test `$$1 --version | grep -c "version $4"` -gt 0 ; then AC_MSG_RESULT(yes) else - AC_MSG_RESULT(no) - $1="" - fi + AC_MSG_RESULT(no) + $1="" + fi fi ]) +# FIND_LD +# Find the version of `ld` to use. This is used in both in the top level +# configure.ac and in distrib/configure.ac.in. +# +# $1 = the variable to set +# +AC_DEFUN([FIND_LD],[ + FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) + case $target in + arm*linux*) + # Arm requires use of the binutils ld.gold linker. + # This case should catch at least arm-unknown-linux-gnueabihf and + # arm-linux-androideabi. + FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold]) + $1="$LD_GOLD" + ;; + *) + $1="$LD" + ;; + esac +]) + # FIND_GHC_BOOTSTRAP_PROG() # -------------------------------- # Parse the bootstrap GHC's compier settings file for the location of things @@ -2124,12 +2146,12 @@ AC_DEFUN([FIND_LLVM_PROG],[ # $3 = The string to grep for to find the correct line. # AC_DEFUN([FIND_GHC_BOOTSTRAP_PROG],[ - BootstrapTmpCmd=`grep $3 $($2 --print-libdir)/settings 2>/dev/null | sed 's/.*", "//;s/".*//'` - if test -n "$BootstrapTmpCmd" && test `basename $BootstrapTmpCmd` = $BootstrapTmpCmd ; then - AC_PATH_PROG([$1], [$BootstrapTmpCmd], "") - else - $1=$BootstrapTmpCmd - fi + BootstrapTmpCmd=`grep $3 $($2 --print-libdir)/settings 2>/dev/null | sed 's/.*", "//;s/".*//'` + if test -n "$BootstrapTmpCmd" && test `basename $BootstrapTmpCmd` = $BootstrapTmpCmd ; then + AC_PATH_PROG([$1], [$BootstrapTmpCmd], "") + else + $1=$BootstrapTmpCmd + fi ]) diff --git a/configure.ac b/configure.ac index c231434..d99d1d5 100644 --- a/configure.ac +++ b/configure.ac @@ -432,19 +432,7 @@ FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs) dnl ** Which ld to use? dnl -------------------------------------------------------------- -FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) -case $target in -arm*linux*) - # Arm requires use of the binutils ld.gold linker. - # This case should catch at least arm-unknown-linux-gnueabihf and - # arm-linux-androideabi. - FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold]) - LdCmd="$LD_GOLD" - ;; -*) - LdCmd="$LD" - ;; -esac +FIND_LD([LdCmd]) AC_SUBST([LdCmd]) dnl ** Which nm to use? @@ -482,17 +470,18 @@ esac # tools we are looking for. In the past, GHC supported a number of # versions of LLVM simultaneously, but that stopped working around # 3.5/3.6 release of LLVM. -llvm_version=3.6 +LlvmVersion=3.5 +AC_SUBST([LlvmVersion]) dnl ** Which LLVM llc to use? dnl -------------------------------------------------------------- -FIND_LLVM_PROG([LLC], [llc], [llc], [$llvm_version]) +FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion]) LlcCmd="$LLC" AC_SUBST([LlcCmd]) dnl ** Which LLVM opt to use? dnl -------------------------------------------------------------- -FIND_LLVM_PROG([OPT], [opt], [opt], [$llvm_version]) +FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion]) OptCmd="$OPT" AC_SUBST([OptCmd]) diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 2ae0072..0fcd869 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -65,11 +65,30 @@ export CC # --with-hs-cpp/--with-hs-cpp-flags FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs) +AC_SUBST([HaskellCPPCmd]) +AC_SUBST([HaskellCPPArgs]) + +# Here is where we re-target which specific version of the LLVM +# tools we are looking for. In the past, GHC supported a number of +# versions of LLVM simultaneously, but that stopped working around +# 3.5/3.6 release of LLVM. +LlvmVersion=@LlvmVersion@ + +dnl ** Which LLVM llc to use? +dnl -------------------------------------------------------------- +FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion]) +LlcCmd="$LLC" +AC_SUBST([LlcCmd]) + +dnl ** Which LLVM opt to use? +dnl -------------------------------------------------------------- +FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion]) +OptCmd="$OPT" +AC_SUBST([OptCmd]) dnl ** Which ld to use? dnl -------------------------------------------------------------- -FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) -LdCmd="$LD" +FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION From git at git.haskell.org Sat Apr 25 06:28:54 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 06:28:54 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: configure: Test for #9920 when compiling for arm (b856f3f) Message-ID: <20150425062854.D0E453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/b856f3f3d7850ca0456dd80aaa59241b3d297ab9/ghc >--------------------------------------------------------------- commit b856f3f3d7850ca0456dd80aaa59241b3d297ab9 Author: Erik de Castro Lopo Date: Sat Apr 25 08:27:49 2015 +0200 configure: Test for #9920 when compiling for arm The ghc-7.10 branch requires use of llvm-3.5, but the llvm-3.5.0 release had a bug that was fixed in llvm-3.5.1. When we are targeting arm, test for this bug in the llvm program `llc` during confgure and if present, abort configuration with an informative error message. Signed-off-by: Erik de Castro Lopo Differential Revision: https://phabricator.haskell.org/D857 >--------------------------------------------------------------- b856f3f3d7850ca0456dd80aaa59241b3d297ab9 configure.ac | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/configure.ac b/configure.ac index d99d1d5..bbf346b 100644 --- a/configure.ac +++ b/configure.ac @@ -558,6 +558,40 @@ then fi AC_SUBST([GHC_LLVM_AFFECTED_BY_9439]) +dnl ** Bug 9920: Llvm version 3.5.0 was released with a bug in the ARM version +dnl of the GHC calling convention implementation. This bug was fixed in the +dnl 3.5.1 release but some Linux distributions are likely to patch llvm +dnl 3.5.0 rather than release a new 3.5.1 version. +dnl +dnl Unfortunately we don't know whether the user is going to request a +dnl build with the LLVM backend as this is only given in build.mk. + +if test ${TargetArch} = arm ; then + AC_MSG_CHECKING(if llvm version is affected by bug 9920) + rm -f conftest.ll conftest.asm + cat << LLVM_IR_CODE > conftest.ll +declare cc10 void @target_function() +define cc10 void @test_direct_tail() { + tail call cc10 void @target_function() + ret void +} +LLVM_IR_CODE + + res=$(${LlcCmd} -mtriple=armv7-eabi conftest.ll -o conftest.asm) + if test $? -eq 0 ; then + if test $(grep -c target_function conftest.asm) -eq 1 ; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + echo + AC_MSG_FAILURE([Cannot compile for ARM with ${LlcCmd}. See GHC trac ticket #9920.], 1) + fi + else + AC_MSG_WARN([unexpected output $res]) + fi + rm -f conftest.ll conftest.asm +fi + dnl ** Can the unix package be built? dnl -------------------------------------------------------------- From git at git.haskell.org Sat Apr 25 07:49:19 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 07:49:19 +0000 (UTC) Subject: [commit: ghc] master: Bump base version to 4.8.2.0 (c4e8097) Message-ID: <20150425074919.388013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c4e8097ea8dd6e43eae7aadd6bae7e13272ba74d/ghc >--------------------------------------------------------------- commit c4e8097ea8dd6e43eae7aadd6bae7e13272ba74d Author: Herbert Valerio Riedel Date: Sat Apr 25 08:53:38 2015 +0200 Bump base version to 4.8.2.0 This is needed because GHC 7.10.2 requires a minor version bump to base-4.8.1.0 Several test outputs needed base-4.8.1.0 replaced by base-4.8.2.0 >--------------------------------------------------------------- c4e8097ea8dd6e43eae7aadd6bae7e13272ba74d libraries/base/base.cabal | 2 +- libraries/base/changelog.md | 6 +++++- testsuite/tests/cabal/cabal06/q/q-1.0.conf | 2 +- testsuite/tests/ghci/scripts/ghci008.stdout | 2 +- .../tests/indexed-types/should_compile/T3017.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/ADT.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr1.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr2.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr3.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr4.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr5.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr6.stderr | 2 +- .../tests/partial-sigs/should_compile/BoolToBool.stderr | 2 +- .../partial-sigs/should_compile/Defaulting1MROn.stderr | 2 +- .../partial-sigs/should_compile/Defaulting2MROff.stderr | 2 +- .../partial-sigs/should_compile/Defaulting2MROn.stderr | 2 +- .../tests/partial-sigs/should_compile/Either.stderr | 2 +- .../should_compile/EqualityConstraint.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Every.stderr | 2 +- .../tests/partial-sigs/should_compile/EveryNamed.stderr | 2 +- .../partial-sigs/should_compile/ExpressionSig.stderr | 2 +- .../should_compile/ExpressionSigNamed.stderr | 2 +- .../partial-sigs/should_compile/ExtraConstraints1.stderr | 2 +- .../partial-sigs/should_compile/ExtraConstraints2.stderr | 2 +- .../partial-sigs/should_compile/ExtraConstraints3.stderr | 2 +- .../partial-sigs/should_compile/ExtraNumAMROff.stderr | 2 +- .../partial-sigs/should_compile/ExtraNumAMROn.stderr | 2 +- .../tests/partial-sigs/should_compile/Forall1.stderr | 2 +- .../tests/partial-sigs/should_compile/GenNamed.stderr | 2 +- .../tests/partial-sigs/should_compile/HigherRank1.stderr | 2 +- .../tests/partial-sigs/should_compile/HigherRank2.stderr | 2 +- .../should_compile/LocalDefinitionBug.stderr | 2 +- .../tests/partial-sigs/should_compile/Meltdown.stderr | 2 +- .../partial-sigs/should_compile/MonoLocalBinds.stderr | 2 +- .../tests/partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../should_compile/ParensAroundContext.stderr | 2 +- .../tests/partial-sigs/should_compile/PatBind.stderr | 2 +- .../tests/partial-sigs/should_compile/PatBind2.stderr | 2 +- .../tests/partial-sigs/should_compile/PatternSig.stderr | 2 +- .../tests/partial-sigs/should_compile/Recursive.stderr | 2 +- .../should_compile/ScopedNamedWildcards.stderr | 2 +- .../should_compile/ScopedNamedWildcardsGood.stderr | 2 +- .../tests/partial-sigs/should_compile/ShowNamed.stderr | 2 +- .../tests/partial-sigs/should_compile/SimpleGen.stderr | 2 +- .../tests/partial-sigs/should_compile/SkipMany.stderr | 2 +- .../partial-sigs/should_compile/SomethingShowable.stderr | 2 +- .../tests/partial-sigs/should_compile/Uncurry.stderr | 2 +- .../partial-sigs/should_compile/UncurryNamed.stderr | 2 +- .../should_compile/WarningWildcardInstantiations.stderr | 2 +- testsuite/tests/rename/should_fail/rnfail040.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 2 +- testsuite/tests/roles/should_compile/Roles14.stderr | 2 +- testsuite/tests/roles/should_compile/Roles2.stderr | 2 +- testsuite/tests/roles/should_compile/Roles3.stderr | 2 +- testsuite/tests/roles/should_compile/Roles4.stderr | 2 +- testsuite/tests/roles/should_compile/T8958.stderr | 2 +- testsuite/tests/safeHaskell/check/Check01.stderr | 2 +- testsuite/tests/safeHaskell/check/Check06.stderr | 2 +- testsuite/tests/safeHaskell/check/Check08.stderr | 2 +- testsuite/tests/safeHaskell/check/Check09.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr | 2 +- .../tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr | 2 +- .../tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout | 16 ++++++++-------- testsuite/tests/safeHaskell/flags/SafeFlags17.stderr | 2 +- testsuite/tests/th/TH_Roles2.stderr | 2 +- testsuite/tests/typecheck/should_compile/tc231.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail182.stderr | 2 +- 69 files changed, 80 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 c4e8097ea8dd6e43eae7aadd6bae7e13272ba74d From git at git.haskell.org Sat Apr 25 07:49:21 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 07:49:21 +0000 (UTC) Subject: [commit: ghc] master: Add missing since-annotations for c024af131b9e2538 (75adc35) Message-ID: <20150425074921.E20913A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/75adc352549a43d4c37bd3bdade55cecf3d75bb1/ghc >--------------------------------------------------------------- commit 75adc352549a43d4c37bd3bdade55cecf3d75bb1 Author: Herbert Valerio Riedel Date: Sat Apr 25 09:12:44 2015 +0200 Add missing since-annotations for c024af131b9e2538 See also #9049 >--------------------------------------------------------------- 75adc352549a43d4c37bd3bdade55cecf3d75bb1 libraries/base/GHC/SrcLoc.hs | 7 +++++++ libraries/base/GHC/Stack.hsc | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/base/GHC/SrcLoc.hs b/libraries/base/GHC/SrcLoc.hs index 16ebbab..23a109b 100644 --- a/libraries/base/GHC/SrcLoc.hs +++ b/libraries/base/GHC/SrcLoc.hs @@ -1,4 +1,6 @@ {-# LANGUAGE RecordWildCards #-} + +-- | @since 4.8.2.0 module GHC.SrcLoc ( SrcLoc , srcLocPackage @@ -14,6 +16,8 @@ module GHC.SrcLoc ) where -- | A single location in the source code. +-- +-- @since 4.8.2.0 data SrcLoc = SrcLoc { srcLocPackage :: String , srcLocModule :: String @@ -24,6 +28,9 @@ data SrcLoc = SrcLoc , srcLocEndCol :: Int } deriving (Show, Eq) +-- | Pretty print 'SrcLoc' +-- +-- @since 4.8.2.0 showSrcLoc :: SrcLoc -> String showSrcLoc SrcLoc {..} = concat [ srcLocFile, ":" diff --git a/libraries/base/GHC/Stack.hsc b/libraries/base/GHC/Stack.hsc index 8c9f0c1..40fba7d 100644 --- a/libraries/base/GHC/Stack.hsc +++ b/libraries/base/GHC/Stack.hsc @@ -24,6 +24,8 @@ module GHC.Stack ( errorWithStackTrace, -- ** Explicitly created via implicit-parameters + -- + -- @since 4.8.2.0 CallStack, getCallStack, showCallStack, @@ -171,11 +173,14 @@ errorWithStackTrace x = unsafeDupablePerformIO $ do -- that was called, the 'SrcLoc' is the call-site. The list is ordered with the -- most recently called function at the head. -- --- @since 4.9.0.0 +-- @since 4.8.2.0 data CallStack = CallStack { getCallStack :: [(String, SrcLoc)] } -- See Note [Overview of implicit CallStacks] deriving (Show, Eq) +-- | Pretty print 'CallStack' +-- +-- @since 4.8.2.0 showCallStack :: CallStack -> String showCallStack (CallStack (root:rest)) = unlines (showCallSite root : map (indent . showCallSite) rest) From git at git.haskell.org Sat Apr 25 07:49:24 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 07:49:24 +0000 (UTC) Subject: [commit: ghc] master: base: Export GHC.Event(.Internal).Lifetime (9a0c179) Message-ID: <20150425074924.A16C43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9a0c17950fdfd0c89c672da9d8b25a419f66c1f8/ghc >--------------------------------------------------------------- commit 9a0c17950fdfd0c89c672da9d8b25a419f66c1f8 Author: Ben Gamari Date: Sat Apr 25 09:13:49 2015 +0200 base: Export GHC.Event(.Internal).Lifetime This was an unfortunate oversight in the original event manager rework patch. Fixes #10308 Differential Revision: https://phabricator.haskell.org/D845 >--------------------------------------------------------------- 9a0c17950fdfd0c89c672da9d8b25a419f66c1f8 libraries/base/GHC/Event.hs | 1 + libraries/base/GHC/Event/Internal.hs | 2 ++ libraries/base/changelog.md | 2 ++ 3 files changed, 5 insertions(+) diff --git a/libraries/base/GHC/Event.hs b/libraries/base/GHC/Event.hs index 436914c..9f1d3df 100644 --- a/libraries/base/GHC/Event.hs +++ b/libraries/base/GHC/Event.hs @@ -25,6 +25,7 @@ module GHC.Event , evtWrite , IOCallback , FdKey(keyFd) + , Lifetime(..) , registerFd , unregisterFd , unregisterFd_ diff --git a/libraries/base/GHC/Event/Internal.hs b/libraries/base/GHC/Event/Internal.hs index c18bd7f..3b75c8b 100644 --- a/libraries/base/GHC/Event/Internal.hs +++ b/libraries/base/GHC/Event/Internal.hs @@ -84,6 +84,8 @@ evtConcat = foldl' evtCombine evtNothing {-# INLINE evtConcat #-} -- | The lifetime of a registration. +-- +-- @since 4.8.1.0 data Lifetime = OneShot | MultiShot deriving (Show, Eq) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 813ac6b..ad3a74d 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -39,6 +39,8 @@ * Bundled with GHC 7.10.2 + * `Lifetime` is now exported from `GHC.Event` + ## 4.8.0.0 *Mar 2015* * Bundled with GHC 7.10.1 From git at git.haskell.org Sat Apr 25 09:25:23 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 09:25:23 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: T10195: Drop -fno-warn-redundant-constraints for GHC 7.10 (a76e360) Message-ID: <20150425092523.8EC913A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/a76e360406cae88a8601b11d5b256d4a47305d0b/ghc >--------------------------------------------------------------- commit a76e360406cae88a8601b11d5b256d4a47305d0b Author: Herbert Valerio Riedel Date: Sat Apr 25 10:43:50 2015 +0200 T10195: Drop -fno-warn-redundant-constraints for GHC 7.10 >--------------------------------------------------------------- a76e360406cae88a8601b11d5b256d4a47305d0b testsuite/tests/typecheck/should_compile/T10195.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_compile/T10195.hs b/testsuite/tests/typecheck/should_compile/T10195.hs index 7ec4e9e..92ee3b3 100644 --- a/testsuite/tests/typecheck/should_compile/T10195.hs +++ b/testsuite/tests/typecheck/should_compile/T10195.hs @@ -1,7 +1,6 @@ {-# LANGUAGE MultiParamTypeClasses, TypeFamilies, GADTs, ConstraintKinds, DataKinds, KindSignatures, FlexibleInstances #-} -{-# OPTIONS -fno-warn-redundant-constraints #-} module T10195 where From git at git.haskell.org Sat Apr 25 09:25:26 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 09:25:26 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: base: Export GHC.Event(.Internal).Lifetime (b324fac) Message-ID: <20150425092526.478493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/b324fac4e9769c963620ccfc645e0ee2890da5b7/ghc >--------------------------------------------------------------- commit b324fac4e9769c963620ccfc645e0ee2890da5b7 Author: Ben Gamari Date: Sat Apr 25 09:13:49 2015 +0200 base: Export GHC.Event(.Internal).Lifetime This was an unfortunate oversight in the original event manager rework patch. Fixes #10308 Differential Revision: https://phabricator.haskell.org/D845 (cherry picked from commit 9a0c17950fdfd0c89c672da9d8b25a419f66c1f8) >--------------------------------------------------------------- b324fac4e9769c963620ccfc645e0ee2890da5b7 libraries/base/GHC/Event.hs | 1 + libraries/base/GHC/Event/Internal.hs | 2 ++ libraries/base/changelog.md | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/libraries/base/GHC/Event.hs b/libraries/base/GHC/Event.hs index 436914c..9f1d3df 100644 --- a/libraries/base/GHC/Event.hs +++ b/libraries/base/GHC/Event.hs @@ -25,6 +25,7 @@ module GHC.Event , evtWrite , IOCallback , FdKey(keyFd) + , Lifetime(..) , registerFd , unregisterFd , unregisterFd_ diff --git a/libraries/base/GHC/Event/Internal.hs b/libraries/base/GHC/Event/Internal.hs index c18bd7f..3b75c8b 100644 --- a/libraries/base/GHC/Event/Internal.hs +++ b/libraries/base/GHC/Event/Internal.hs @@ -84,6 +84,8 @@ evtConcat = foldl' evtCombine evtNothing {-# INLINE evtConcat #-} -- | The lifetime of a registration. +-- +-- @since 4.8.1.0 data Lifetime = OneShot | MultiShot deriving (Show, Eq) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 4facf0c..f7f1b5b 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -1,5 +1,11 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) +## 4.8.1.0 *TBA* + + * Bundled with GHC 7.10.2 + + * `Lifetime` is now exported from `GHC.Event` + ## 4.8.0.0 *Mar 2015* * Bundled with GHC 7.10.1 From git at git.haskell.org Sat Apr 25 09:25:29 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 09:25:29 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Accept changed DmdType in spec-inline test output (2c7b616) Message-ID: <20150425092529.106303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/2c7b6163937358c476f2d31576514a584286da3b/ghc >--------------------------------------------------------------- commit 2c7b6163937358c476f2d31576514a584286da3b Author: Herbert Valerio Riedel Date: Sat Apr 25 10:55:57 2015 +0200 Accept changed DmdType in spec-inline test output In GHC HEAD the corresponding update occured in e6e0415befc97 >--------------------------------------------------------------- 2c7b6163937358c476f2d31576514a584286da3b testsuite/tests/simplCore/should_compile/spec-inline.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/simplCore/should_compile/spec-inline.stderr b/testsuite/tests/simplCore/should_compile/spec-inline.stderr index 29c8a91..acf799b 100644 --- a/testsuite/tests/simplCore/should_compile/spec-inline.stderr +++ b/testsuite/tests/simplCore/should_compile/spec-inline.stderr @@ -120,7 +120,7 @@ foo :: Int -> Int [GblId, Arity=1, Caf=NoCafRefs, - Str=DmdType m, + Str=DmdType m, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) From git at git.haskell.org Sat Apr 25 09:25:31 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 09:25:31 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: testsuite: Accept qualified GHC.Prim.Constraint (36a4c2d) Message-ID: <20150425092531.D9D603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/36a4c2d7382c306543739d8dc660e8aa4f5817a0/ghc >--------------------------------------------------------------- commit 36a4c2d7382c306543739d8dc660e8aa4f5817a0 Author: Herbert Valerio Riedel Date: Sat Apr 25 10:45:16 2015 +0200 testsuite: Accept qualified GHC.Prim.Constraint I suspect this was caused by f6c690ba6491e0e943bd07763c0063a55ff0c760 which would be compensated by 547c597112954353cef7157cb0a389bc4f6303eb (which OTOH was not cherry-picked into 7.10) >--------------------------------------------------------------- 36a4c2d7382c306543739d8dc660e8aa4f5817a0 testsuite/tests/deriving/should_fail/T7959.stderr | 3 ++- testsuite/tests/deriving/should_fail/drvfail005.stderr | 4 ++-- testsuite/tests/deriving/should_fail/drvfail009.stderr | 4 ++-- testsuite/tests/indexed-types/should_fail/SimpleFail14.stderr | 2 +- testsuite/tests/typecheck/should_fail/T2994.stderr | 2 +- testsuite/tests/typecheck/should_fail/T3540.stderr | 10 +++++----- testsuite/tests/typecheck/should_fail/T7778.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail036.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail057.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail063.stderr | 3 ++- testsuite/tests/typecheck/should_fail/tcfail134.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail146.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail147.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail151.stderr | 3 ++- testsuite/tests/typecheck/should_fail/tcfail209.stderr | 2 +- 15 files changed, 24 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 36a4c2d7382c306543739d8dc660e8aa4f5817a0 From git at git.haskell.org Sat Apr 25 09:25:34 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 09:25:34 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Bump base version to 4.8.1.0 (ab6cce5) Message-ID: <20150425092534.8A3AA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/ab6cce5e967812ab8fb6ebb7bc2297e360916e9f/ghc >--------------------------------------------------------------- commit ab6cce5e967812ab8fb6ebb7bc2297e360916e9f Author: Herbert Valerio Riedel Date: Sat Apr 25 09:55:06 2015 +0200 Bump base version to 4.8.1.0 Several test outputs needed base-4.8.0.0 replaced by base-4.8.1.0 >--------------------------------------------------------------- ab6cce5e967812ab8fb6ebb7bc2297e360916e9f libraries/base/base.cabal | 2 +- testsuite/tests/cabal/cabal06/q/q-1.0.conf | 2 +- testsuite/tests/ghci/scripts/ghci008.stdout | 4 ++-- .../tests/indexed-types/should_compile/T3017.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/ADT.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr1.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr2.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr3.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr4.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr5.stderr | 2 +- .../tests/partial-sigs/should_compile/AddAndOr6.stderr | 2 +- .../tests/partial-sigs/should_compile/BoolToBool.stderr | 2 +- .../partial-sigs/should_compile/Defaulting1MROn.stderr | 2 +- .../partial-sigs/should_compile/Defaulting2MROff.stderr | 2 +- .../partial-sigs/should_compile/Defaulting2MROn.stderr | 2 +- .../tests/partial-sigs/should_compile/Either.stderr | 2 +- .../should_compile/EqualityConstraint.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/Every.stderr | 2 +- .../tests/partial-sigs/should_compile/EveryNamed.stderr | 2 +- .../partial-sigs/should_compile/ExpressionSig.stderr | 2 +- .../should_compile/ExpressionSigNamed.stderr | 2 +- .../partial-sigs/should_compile/ExtraConstraints1.stderr | 2 +- .../partial-sigs/should_compile/ExtraConstraints2.stderr | 2 +- .../partial-sigs/should_compile/ExtraConstraints3.stderr | 2 +- .../partial-sigs/should_compile/ExtraNumAMROff.stderr | 2 +- .../partial-sigs/should_compile/ExtraNumAMROn.stderr | 2 +- .../tests/partial-sigs/should_compile/Forall1.stderr | 2 +- .../tests/partial-sigs/should_compile/GenNamed.stderr | 2 +- .../tests/partial-sigs/should_compile/HigherRank1.stderr | 2 +- .../tests/partial-sigs/should_compile/HigherRank2.stderr | 2 +- .../should_compile/LocalDefinitionBug.stderr | 2 +- .../tests/partial-sigs/should_compile/Meltdown.stderr | 2 +- .../partial-sigs/should_compile/MonoLocalBinds.stderr | 2 +- .../tests/partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../should_compile/ParensAroundContext.stderr | 2 +- .../tests/partial-sigs/should_compile/PatBind.stderr | 2 +- .../tests/partial-sigs/should_compile/PatBind2.stderr | 2 +- .../tests/partial-sigs/should_compile/PatternSig.stderr | 2 +- .../tests/partial-sigs/should_compile/Recursive.stderr | 2 +- .../should_compile/ScopedNamedWildcards.stderr | 2 +- .../should_compile/ScopedNamedWildcardsGood.stderr | 2 +- .../tests/partial-sigs/should_compile/ShowNamed.stderr | 2 +- .../tests/partial-sigs/should_compile/SimpleGen.stderr | 2 +- .../tests/partial-sigs/should_compile/SkipMany.stderr | 2 +- .../partial-sigs/should_compile/SomethingShowable.stderr | 2 +- .../tests/partial-sigs/should_compile/Uncurry.stderr | 2 +- .../partial-sigs/should_compile/UncurryNamed.stderr | 2 +- .../should_compile/WarningWildcardInstantiations.stderr | 2 +- testsuite/tests/rename/should_fail/rnfail040.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 2 +- testsuite/tests/roles/should_compile/Roles14.stderr | 2 +- testsuite/tests/roles/should_compile/Roles2.stderr | 2 +- testsuite/tests/roles/should_compile/Roles3.stderr | 2 +- testsuite/tests/roles/should_compile/Roles4.stderr | 2 +- testsuite/tests/roles/should_compile/T8958.stderr | 2 +- testsuite/tests/safeHaskell/check/Check01.stderr | 2 +- testsuite/tests/safeHaskell/check/Check06.stderr | 2 +- testsuite/tests/safeHaskell/check/Check08.stderr | 2 +- testsuite/tests/safeHaskell/check/Check09.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe01.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe04.stderr | 2 +- .../tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr | 2 +- .../tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/safePkg01.stdout | 16 ++++++++-------- testsuite/tests/safeHaskell/flags/SafeFlags17.stderr | 2 +- testsuite/tests/th/TH_Roles2.stderr | 2 +- testsuite/tests/typecheck/should_compile/tc231.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail182.stderr | 2 +- 68 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 ab6cce5e967812ab8fb6ebb7bc2297e360916e9f From git at git.haskell.org Sat Apr 25 09:25:37 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Apr 2015 09:25:37 +0000 (UTC) Subject: [commit: ghc] ghc-7.10: Commit missing T10148 files and ignore the built executable. (0e5c4af) Message-ID: <20150425092537.90CD23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-7.10 Link : http://ghc.haskell.org/trac/ghc/changeset/0e5c4af22f104ef2786eef8c606855b74e49c6ca/ghc >--------------------------------------------------------------- commit 0e5c4af22f104ef2786eef8c606855b74e49c6ca Author: Edward Z. Yang Date: Tue Apr 7 11:59:09 2015 -0700 Commit missing T10148 files and ignore the built executable. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 0e5c4af22f104ef2786eef8c606855b74e49c6ca testsuite/tests/stranal/should_run/.gitignore | 1 + testsuite/tests/stranal/should_run/T10148.stderr | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/testsuite/tests/stranal/should_run/.gitignore b/testsuite/tests/stranal/should_run/.gitignore new file mode 100644 index 0000000..b7834ad --- /dev/null +++ b/testsuite/tests/stranal/should_run/.gitignore @@ -0,0 +1 @@ +T10148 diff --git a/testsuite/tests/stranal/should_run/T10148.stderr b/testsuite/tests/stranal/should_run/T10148.stderr new file mode 100644 index 0000000..39ff4d1 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T10148.stderr @@ -0,0 +1,6 @@ +adj 99 +adj 99 +adj 99 +adj 99 +adj 99 +adj 99 From git at git.haskell.org Mon Apr 27 16:35:06 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Apr 2015 16:35:06 +0000 (UTC) Subject: [commit: ghc] master: Flesh out some more Backpack examples in the merging section. (5f127fc) Message-ID: <20150427163506.2588E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5f127fc62e171fc89dc9fa0827310cc54d6ab48b/ghc >--------------------------------------------------------------- commit 5f127fc62e171fc89dc9fa0827310cc54d6ab48b Author: Edward Z. Yang Date: Mon Apr 27 09:25:41 2015 -0700 Flesh out some more Backpack examples in the merging section. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 5f127fc62e171fc89dc9fa0827310cc54d6ab48b docs/backpack/algorithm.pdf | Bin 164855 -> 178593 bytes docs/backpack/algorithm.tex | 87 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/docs/backpack/algorithm.pdf b/docs/backpack/algorithm.pdf index cf191fe..7b6deca 100644 Binary files a/docs/backpack/algorithm.pdf and b/docs/backpack/algorithm.pdf differ diff --git a/docs/backpack/algorithm.tex b/docs/backpack/algorithm.tex index 18faa11..a930e2f 100644 --- a/docs/backpack/algorithm.tex +++ b/docs/backpack/algorithm.tex @@ -259,9 +259,92 @@ provides: A -> THIS:A { q():A.T } requires: (nothing) \end{verbatim} -\Red{Example of canonical choice for signature merging} +Here are some more involved examples, which illustrate some important +cases: -\Red{Example of how provides DO NOT merge} +\subsubsection{Sharing constraints} + +Suppose you have two signature which both independently define a type, +and you would like to assert that these two types are the same. In the +ML world, such a constraint is known as a sharing constraint. Sharing +constraints can be encoded in Backpacks via clever use of reexports; +they are also an instructive example for signature merging. +For brevity, we've omitted \verb|provided| from the shapes in this example. + +\begin{verbatim} +signature A(T) where + data T +signature B(T) where + data T + +-- requires: A -> HOLE:A { HOLE:A.T } + B -> HOLE:B { HOLE:B.T } + +-- the sharing constraint! +signature A(T) where + import B(T) +-- (shape to merge) +-- requires: A -> HOLE:A { HOLE:B.T } + +-- (after merge) +-- requires: A -> HOLE:A { HOLE:A.T } +-- B -> HOLE:B { HOLE:A.T } +\end{verbatim} + +Notably, we could equivalently have chosen \verb|HOLE:B.T| as the post-merge +name. \Red{Actually, I don't think any choice can be wrong. The point is to +ensure that the substitution applies to everything we know about, and since requirements +monotonically increase in size (or are filled), this will hold.} + +\subsubsection{Provision linking does not discharge requirements} + +It is not an error to define a module, and then define a signature +afterwards: this can be useful for checking if a module implements +a signature, and also for sharing constraints: + +\begin{verbatim} +module M(T) where + data T = T +signature S(T) where + data T + +signature M(T) + import S(T) +-- (partial) +-- provides: S -> HOLE:S { THIS:M.T } -- resolved! + +-- alternately: +signature S(T) where + import M(T) +\end{verbatim} + +However, in some circumstances, linking a signature to a module can cause an +unrelated requirement to be ``filled'': + +\begin{verbatim} +package p (S) requires (S) where + signature S where + data T + +package q (A) requires (B) where + include S (S as A) requires (S as B) + +package r where + module A where + data T = T + include q (A) requires (B) + -- provides: A -> THIS:A { THIS:A.T } + -- requires: B -> { THIS:A.T } +\end{verbatim} + +How mysterious! We really ought to have discharged the requirement when +this occurred. But, from just looking at \verb|r|, it's not obvious that +\verb|B|'s requirement will get filled when you link with \verb|A|. + +It would seem safest to disallow this form of linking, appealing to the +fact that it doesn't make much sense for two provisions to be assigned +the same name. But there's a counterexample for this: you want to be able +to include two different signatures and see the merged version. \Red{How to relax this so hs-boot works} From git at git.haskell.org Mon Apr 27 17:33:46 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Apr 2015 17:33:46 +0000 (UTC) Subject: [commit: ghc] master: Backpack docs: explain alternate merging scheme. (d0898ca) Message-ID: <20150427173346.F1E333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d0898cac1e878f3a22664c01df40c84fa305b817/ghc >--------------------------------------------------------------- commit d0898cac1e878f3a22664c01df40c84fa305b817 Author: Edward Z. Yang Date: Mon Apr 27 10:34:23 2015 -0700 Backpack docs: explain alternate merging scheme. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- d0898cac1e878f3a22664c01df40c84fa305b817 docs/backpack/algorithm.pdf | Bin 178593 -> 184236 bytes docs/backpack/algorithm.tex | 60 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/docs/backpack/algorithm.pdf b/docs/backpack/algorithm.pdf index 7b6deca..e7e88fb 100644 Binary files a/docs/backpack/algorithm.pdf and b/docs/backpack/algorithm.pdf differ diff --git a/docs/backpack/algorithm.tex b/docs/backpack/algorithm.tex index a930e2f..bd4bd5c 100644 --- a/docs/backpack/algorithm.tex +++ b/docs/backpack/algorithm.tex @@ -277,18 +277,18 @@ signature A(T) where signature B(T) where data T --- requires: A -> HOLE:A { HOLE:A.T } - B -> HOLE:B { HOLE:B.T } +-- requires: A -> HOLE:A { HOLE:A.T } + B -> HOLE:B { HOLE:B.T } -- the sharing constraint! signature A(T) where import B(T) -- (shape to merge) --- requires: A -> HOLE:A { HOLE:B.T } +-- requires: A -> HOLE:A { HOLE:B.T } -- (after merge) --- requires: A -> HOLE:A { HOLE:A.T } --- B -> HOLE:B { HOLE:A.T } +-- requires: A -> HOLE:A { HOLE:A.T } +-- B -> HOLE:B { HOLE:A.T } \end{verbatim} Notably, we could equivalently have chosen \verb|HOLE:B.T| as the post-merge @@ -334,17 +334,51 @@ package r where data T = T include q (A) requires (B) -- provides: A -> THIS:A { THIS:A.T } - -- requires: B -> { THIS:A.T } + -- requires: (nothing) \end{verbatim} -How mysterious! We really ought to have discharged the requirement when -this occurred. But, from just looking at \verb|r|, it's not obvious that -\verb|B|'s requirement will get filled when you link with \verb|A|. +Notice that the requirement was discharged because we unified \verb|HOLE:B| +with \verb|THIS:A|. While this is certainly the most accurate picture +of the package we can get from this situation, it is a bit unsatisfactory +in that looking at the text of module \verb|r|, it is not obvious that +all the requirements were filled; only that there is some funny business +going on with multiple provisions with \verb|A|. + +Note that we \emph{cannot} disallow multiple bindings to the same provision: +this is a very important use-case when you want to include one signature, +include another signature, and see the merge of the two signatures in your +context. \Red{So maybe this is what we should do.} However, there is +a saving grace, which is signature-signature linking can be done when +linking requirements; linking provisions is unnecessary in this case. +So perhaps the merge rule should be something like: + +\begin{enumerate} + \item \emph{Fill every requirement of $q$ with provided modules from + $p$.} For each requirement $M$ of $q$ that is provided by $p$, + substitute each \verb|Module| occurrence of \verb|HOLE:M| with the + provided $p(M)$, merge the names, and remove the requirement from $q$. + \item \emph{Merge requirements.} For each requirement $M$ of $q$ that is not + provided by $p$ but required by $p$, merge the names. + \item \emph{Add provisions of $q$.} For each provision $M$ of $q$: + add it to $p$, erroring if the addition is incompatible with an + existing entry in $p$. +\end{enumerate} + +Now, because there is no provision linking, and the requirement \verb|B| is +not linked against anything, \verb|A| ends up being incompatible with +the \verb|A| in context and is rejected. We also reject situations where +a provision unification would require us to pick a signature: -It would seem safest to disallow this form of linking, appealing to the -fact that it doesn't make much sense for two provisions to be assigned -the same name. But there's a counterexample for this: you want to be able -to include two different signatures and see the merged version. +\begin{verbatim} +package p (S) requires (S) where + signature S + +package q where + include p (S) requires (S as A) + include p (S) requires (S as B) + -- rejected; provided S doesn't unify + -- (if we accepted, what's the requirement? A? B?) +\end{verbatim} \Red{How to relax this so hs-boot works} From git at git.haskell.org Mon Apr 27 22:40:43 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Apr 2015 22:40:43 +0000 (UTC) Subject: [commit: ghc] branch 'ghc-july' created Message-ID: <20150427224043.5D7B63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : ghc-july Referencing: 541aa7f01b96bc0af962f97de5c831a2fd872aad From git at git.haskell.org Mon Apr 27 22:40:46 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Apr 2015 22:40:46 +0000 (UTC) Subject: [commit: ghc] ghc-july: Full type checking Backpack details. (541aa7f) Message-ID: <20150427224046.450EB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-july Link : http://ghc.haskell.org/trac/ghc/changeset/541aa7f01b96bc0af962f97de5c831a2fd872aad/ghc >--------------------------------------------------------------- commit 541aa7f01b96bc0af962f97de5c831a2fd872aad Author: Edward Z. Yang Date: Mon Apr 27 15:41:29 2015 -0700 Full type checking Backpack details. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 541aa7f01b96bc0af962f97de5c831a2fd872aad docs/backpack/algorithm.pdf | Bin 184236 -> 190653 bytes docs/backpack/algorithm.tex | 214 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 180 insertions(+), 34 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 541aa7f01b96bc0af962f97de5c831a2fd872aad From git at git.haskell.org Mon Apr 27 22:40:56 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Apr 2015 22:40:56 +0000 (UTC) Subject: [commit: ghc] master's head updated: Full type checking Backpack details. (541aa7f) Message-ID: <20150427224056.F358D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'master' now includes: 541aa7f Full type checking Backpack details. From git at git.haskell.org Wed Apr 29 00:42:36 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Apr 2015 00:42:36 +0000 (UTC) Subject: [commit: ghc] master: Backpack docs: merge backpack-shaping into algorithm, sigs no longer provide (21a37ca) Message-ID: <20150429004236.80E333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/21a37cae5eeec1d26ff840de9a4281e44c130cec/ghc >--------------------------------------------------------------- commit 21a37cae5eeec1d26ff840de9a4281e44c130cec Author: Edward Z. Yang Date: Tue Apr 28 15:14:28 2015 -0700 Backpack docs: merge backpack-shaping into algorithm, sigs no longer provide Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 21a37cae5eeec1d26ff840de9a4281e44c130cec docs/backpack/Makefile | 5 +- docs/backpack/algorithm.pdf | Bin 190653 -> 215876 bytes docs/backpack/algorithm.tex | 613 +++++++++++++++++++------------- docs/backpack/backpack-shaping.pdf | Bin 238012 -> 0 bytes docs/backpack/backpack-shaping.tex | 692 ------------------------------------- 5 files changed, 376 insertions(+), 934 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 21a37cae5eeec1d26ff840de9a4281e44c130cec From git at git.haskell.org Wed Apr 29 14:05:12 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Apr 2015 14:05:12 +0000 (UTC) Subject: [commit: ghc] master: Seed SpecConstr from local calls (b61562f) Message-ID: <20150429140512.B07113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b61562feb87689a202118ca08ef270422c69dcc2/ghc >--------------------------------------------------------------- commit b61562feb87689a202118ca08ef270422c69dcc2 Author: Simon Peyton Jones Date: Tue Apr 28 17:42:37 2015 +0100 Seed SpecConstr from local calls Seed SpecConstr based on *local* calls as well as *RHS* calls. See Note [Seeding top-level recursive groups]. The change here is mentioned here: NB: before Apr 15 we used (a) only, but Dimitrios had an example where (b) was crucial, so I added that. This is a pretty small change, requested by Dimitrios, that adds SpecConstr call patterns from the rest of the module, as well as ones from the RHS. Still to come: #10346. >--------------------------------------------------------------- b61562feb87689a202118ca08ef270422c69dcc2 compiler/specialise/SpecConstr.hs | 76 ++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 24 deletions(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 42c2558..42e9f52 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -397,25 +397,41 @@ then we will end up calling the un-specialised function, so then we *should* use the calls in the un-specialised RHS as seeds. We call these "boring call patterns", and callsToPats reports if it finds any of these. - -Note [Top-level recursive groups] +Note [Seeding top-level recursive groups] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If all the bindings in a top-level recursive group are local (not -exported), then all the calls are in the rest of the top-level -bindings. This means we can specialise with those call patterns -instead of with the RHSs of the recursive group. - -(Question: maybe we should *also* use calls in the rest of the -top-level bindings as seeds? - -To get the call usage information, we work backwards through the -top-level bindings so we see the usage before we get to the binding of -the function. Before we can collect the usage though, we go through -all the bindings and add them to the environment. This is necessary -because usage is only tracked for functions in the environment. - -The actual seeding of the specialisation is very similar to Note [Local recursive group]. +This seeding is done in the binding for seed_calls in specRec. + +1. If all the bindings in a top-level recursive group are local (not + exported), then all the calls are in the rest of the top-level + bindings. This means we can specialise with those call patterns + ONLY, and NOT with the RHSs of the recursive group (exactly like + Note [Local recursive groups]) + +2. But if any of the bindings are exported, the function may be called + with any old arguments, so (for lack of anything better) we specialise + based on + (a) the call patterns in the RHS + (b) the call patterns in the rest of the top-level bindings + NB: before Apr 15 we used (a) only, but Dimitrios had an example + where (b) was crucial, so I added that. + +Actually in case (2), instead of using the calls from the RHS, it +would be better to specialise in the importing module. We'd need to +add an INLINEABLE pragma to the function, and then it can be +specialised in the importing scope, just as is done for type classes +in Specialise.specImports. This remains to be done (#10346). +Note [Top-level recursive groups] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +To get the call usage information from "the rest of the top level +bindings" (c.f. Note [Seeding top-level recursive groups]), we work +backwards through the top-level bindings so we see the usage before we +get to the binding of the function. Before we can collect the usage +though, we go through all the bindings and add them to the +environment. This is necessary because usage is only tracked for +functions in the environment. These two passes are called + 'go' and 'goEnv' +in specConstrProgram. (Looks a bit revolting to me.) Note [Do not specialise diverging functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -670,15 +686,21 @@ specConstrProgram guts let binds' = reverse $ fst $ initUs us $ do -- Note [Top-level recursive groups] (env, binds) <- goEnv (initScEnv dflags annos) (mg_binds guts) + -- binds is identical to (mg_binds guts), except that the + -- binders on the LHS have been replaced by extendBndr + -- (SPJ this seems like overkill; I don't think the binders + -- will change at all; and we don't substitute in the RHSs anyway!!) go env nullUsage (reverse binds) return (guts { mg_binds = binds' }) where + -- See Note [Top-level recursive groups] goEnv env [] = return (env, []) goEnv env (bind:binds) = do (env', bind') <- scTopBindEnv env bind (env'', binds') <- goEnv env' binds return (env'', bind' : binds') + -- Arg list of bindings is in reverse order go _ _ [] = return [] go env usg (bind:binds) = do (usg', bind') <- scTopBind env usg bind binds' <- go env usg' binds @@ -1026,6 +1048,11 @@ data Call = Call Id [CoreArg] ValueEnv -- env giving the constructor bindings at the call site -- We keep the function mainly for debug output +instance Outputable ScUsage where + ppr (SCU { scu_calls = calls, scu_occs = occs }) + = ptext (sLit "SCU") <+> braces (sep [ ptext (sLit "calls =") <+> ppr calls + , ptext (sLit "occs =") <+> ppr occs ]) + instance Outputable Call where ppr (Call fn args _) = ppr fn <+> fsep (map pprParendExpr args) @@ -1133,7 +1160,6 @@ scExpr, scExpr' :: ScEnv -> CoreExpr -> UniqSM (ScUsage, CoreExpr) scExpr env e = scExpr' env e - scExpr' env (Var v) = case scSubstId env v of Var v' -> return (mkVarUsage env v' [], Var v') e' -> scExpr (zapScSubst env) e' @@ -1442,14 +1468,16 @@ specRec top_lvl env body_usg rhs_infos = do { (spec_usg, spec_infos) <- go seed_calls nullUsage init_spec_infos ; return (spec_usg, [ s | SI s _ _ <- spec_infos ]) } where - (seed_calls, init_spec_infos) -- Note [Top-level recursive groups] + (seed_calls, init_spec_infos) -- Note [Seeding top-level recursive groups] | isTopLevel top_lvl - , any (isExportedId . ri_fn) rhs_infos -- Seed from RHSs - = (calls_in_rhss, [SI [] 0 Nothing | _ <- rhs_infos]) - | otherwise -- Seed from body only - = (scu_calls body_usg, [SI [] 0 (Just (ri_rhs_usg ri)) | ri <- rhs_infos]) + , any (isExportedId . ri_fn) rhs_infos -- Seed from body and RHSs + = (all_calls, [SI [] 0 Nothing | _ <- rhs_infos]) + | otherwise -- Seed from body only + = (calls_in_body, [SI [] 0 (Just (ri_rhs_usg ri)) | ri <- rhs_infos]) + calls_in_body = scu_calls body_usg calls_in_rhss = foldr (combineCalls . scu_calls . ri_rhs_usg) emptyVarEnv rhs_infos + all_calls = calls_in_rhss `combineCalls` calls_in_body -- Loop, specialising, until you get no new specialisations go seed_calls usg_so_far spec_infos @@ -1898,7 +1926,7 @@ argToPat env in_scope val_env arg arg_occ | otherwise -> Nothing -- Check if the argument is a variable that - -- (a) is used in an interesting way in the body + -- (a) is used in an interesting way in the function body -- (b) we know what its value is -- In that case it counts as "interesting" argToPat env in_scope val_env (Var v) arg_occ From git at git.haskell.org Wed Apr 29 14:05:15 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Apr 2015 14:05:15 +0000 (UTC) Subject: [commit: ghc] master: A little outright bug in canEqTyVar2 (168c883) Message-ID: <20150429140515.815113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/168c88312b4ebe595c4332dde460e987f6fd9108/ghc >--------------------------------------------------------------- commit 168c88312b4ebe595c4332dde460e987f6fd9108 Author: Simon Peyton Jones Date: Wed Apr 29 11:23:05 2015 +0100 A little outright bug in canEqTyVar2 I had 'ev' where I should have had 'new_ev'. It's quite hard to make this bug cause a failure, but I did eventually get a Lint error somewhere. Anyway, it's just a typo, I think. >--------------------------------------------------------------- 168c88312b4ebe595c4332dde460e987f6fd9108 compiler/typecheck/TcCanonical.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index e9e35a4..b850318 100644 --- a/compiler/typecheck/TcCanonical.hs +++ b/compiler/typecheck/TcCanonical.hs @@ -948,7 +948,7 @@ canEqTyVar2 dflags ev eq_rel swapped tv1 xi2 = rewriteEqEvidence ev eq_rel swapped xi1 xi2 co1 co2 `andWhenContinue` \ new_ev -> case eq_rel of - NomEq -> do { emitInsoluble (mkNonCanonical ev) + NomEq -> do { emitInsoluble (mkNonCanonical new_ev) -- If we have a ~ [a], it is not canonical, and in particular -- we don't want to rewrite existing inerts with it, otherwise -- we'd risk divergence in the constraint solver From git at git.haskell.org Wed Apr 29 14:05:18 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Apr 2015 14:05:18 +0000 (UTC) Subject: [commit: ghc] master: Don't print evidence in TcFlatten (d9bb0ee) Message-ID: <20150429140518.8EE2C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d9bb0ee78b2104bd5c71508080d068804086ae84/ghc >--------------------------------------------------------------- commit d9bb0ee78b2104bd5c71508080d068804086ae84 Author: Simon Peyton Jones Date: Wed Apr 29 11:26:23 2015 +0100 Don't print evidence in TcFlatten Because when flattening a Derived constraint, the evidence doesn't exist (it's an error thunk) >--------------------------------------------------------------- d9bb0ee78b2104bd5c71508080d068804086ae84 compiler/typecheck/TcFlatten.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index a5ece16..ff7b7ff 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -920,7 +920,7 @@ flatten_one (TyVarTy tv) Right (ty1, co1) -- Recurse -> do { (ty2, co2) <- flatten_one ty1 - ; traceFlat "flattenTyVar2" (ppr tv $$ ppr ty2 $$ ppr co1) + ; traceFlat "flattenTyVar2" (ppr tv $$ ppr ty2) ; return (ty2, co2 `mkTcTransCo` co1) } } flatten_one (AppTy ty1 ty2) @@ -937,7 +937,7 @@ flatten_one (AppTy ty1 ty2) = do { (xi2,co2) <- setEqRel eq_rel2 $ flatten_one ty2 ; traceFlat "flatten/appty" (ppr ty1 $$ ppr ty2 $$ ppr xi1 $$ - ppr co1 $$ ppr xi2 $$ ppr co2) + ppr co1 $$ ppr xi2) ; role1 <- getRole ; let role2 = eqRelRole eq_rel2 ; return ( mkAppTy xi1 xi2 @@ -1104,7 +1104,7 @@ flatten_exact_fam_app_fully tc tys | (flav, NomEq) `canRewriteOrSameFR` flavour_role -> -- Usable hit in the flat-cache -- We certainly *can* use a Wanted for a Wanted - do { traceFlat "flatten/flat-cache hit" $ (ppr tc <+> ppr xis $$ ppr rhs_ty $$ ppr co) + do { traceFlat "flatten/flat-cache hit" $ (ppr tc <+> ppr xis $$ ppr rhs_ty) ; (fsk_xi, fsk_co) <- flatten_one rhs_ty -- The fsk may already have been unified, so flatten it -- fsk_co :: fsk_xi ~ fsk @@ -1131,7 +1131,7 @@ flatten_exact_fam_app_fully tc tys , cc_fsk = fsk } ; emitFlatWork ct - ; traceFlat "flatten/flat-cache miss" $ (ppr fam_ty $$ ppr fsk $$ ppr ev) + ; traceFlat "flatten/flat-cache miss" $ (ppr fam_ty $$ ppr fsk) ; return (fsk_ty, maybeTcSubCo eq_rel (mkTcSymCo co) `mkTcTransCo` ret_co) } From git at git.haskell.org Wed Apr 29 14:05:22 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Apr 2015 14:05:22 +0000 (UTC) Subject: [commit: ghc] master: Improve improvement in the constraint solver (a1275a7) Message-ID: <20150429140522.8FD0E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a1275a762ec04c1159ae37199b1c8f998a5c5499/ghc >--------------------------------------------------------------- commit a1275a762ec04c1159ae37199b1c8f998a5c5499 Author: Simon Peyton Jones Date: Wed Apr 29 13:43:09 2015 +0100 Improve improvement in the constraint solver This regrettably-big patch substantially improves the way in which "improvement" happens in the constraint solver. It was triggered by trying to crack Trac #10009, but it turned out to solve #10340 as well. The big picture, with several of the trickiest examples, is described in Note [The improvement story] in TcInteract. The major change is this: * After solving we explicitly try "improvement", by - making the unsolved Wanteds into Deriveds - allowing Deriveds to rewrite Deriveds This more aggressive rewriting "unlocks" some extra guess-free unifications. * The main loop is in TcInteract.solveSimpleWanteds, but I also ended up refactoring TcSimplify.simpl_loop, and its surrounding code. Notably, any insolubles from the Givens are pulled out and treated separately, rather than staying in the inert set during the solveSimpleWanteds loop. There are a lot of follow-on changes * Do not emit generate Derived improvements from Wanteds. This saves work in the common case where they aren't needed. * For improvement we should really do type-class reduction on Derived constraints in doTopReactDict. That entailed changing the GenInst constructor a bit; a local and minor change * Some annoying faffing about with dropping derived constraints; see dropDerivedWC, dropDerivedSimples, dropDerivedInsols, and their Notes. * Some substantial refactoring in TcErrors.reportWanteds. This work wasn't strictly forced, but I got sucked into it. All the changes are in TcErrors. * Use TcS.unifyTyVar consistently, rather than setWantedTyBind, so that unifications are properly tracked. * Refactoring around solveWantedsTcM, solveWantedsAndDrop. They previously guaranteed a zonked result, but it's more straightforward for clients to zonk. >--------------------------------------------------------------- a1275a762ec04c1159ae37199b1c8f998a5c5499 compiler/typecheck/TcCanonical.hs | 36 +- compiler/typecheck/TcDeriv.hs | 7 +- compiler/typecheck/TcErrors.hs | 163 +++--- compiler/typecheck/TcFlatten.hs | 87 +-- compiler/typecheck/TcInteract.hs | 610 ++++++++++++++++----- compiler/typecheck/TcRnTypes.hs | 79 ++- compiler/typecheck/TcSMonad.hs | 167 +++--- compiler/typecheck/TcSimplify.hs | 234 +++----- .../tests/indexed-types/should_compile/T10340.hs | 17 + testsuite/tests/indexed-types/should_compile/all.T | 1 + .../indexed-types/should_fail/ExtraTcsUntch.stderr | 16 +- .../tests/indexed-types/should_fail/T4093a.hs | 2 + .../tests/indexed-types/should_fail/T4093a.stderr | 18 +- .../tests/indexed-types/should_fail/T4254.stderr | 4 + .../tests/indexed-types/should_fail/T7729.stderr | 4 +- .../tests/indexed-types/should_fail/T9662.stderr | 72 +-- testsuite/tests/module/mod71.stderr | 14 +- testsuite/tests/typecheck/should_compile/FD3.hs | 9 + .../tests/typecheck/should_compile/FD3.stderr | 13 +- .../tests/typecheck/should_compile/Improvement.hs | 17 + testsuite/tests/typecheck/should_compile/T10009.hs | 62 +++ testsuite/tests/typecheck/should_compile/all.T | 2 + .../tests/typecheck/should_fail/FDsFromGivens.hs | 15 +- .../typecheck/should_fail/FDsFromGivens.stderr | 27 +- .../{FDsFromGivens.hs => FDsFromGivens2.hs} | 12 +- ...{FDsFromGivens.stderr => FDsFromGivens2.stderr} | 8 +- testsuite/tests/typecheck/should_fail/T1899.stderr | 6 +- testsuite/tests/typecheck/should_fail/T5246.stderr | 2 +- testsuite/tests/typecheck/should_fail/T5570.stderr | 2 +- testsuite/tests/typecheck/should_fail/T5689.stderr | 26 +- testsuite/tests/typecheck/should_fail/T5691.hs | 0 testsuite/tests/typecheck/should_fail/T5691.stderr | 14 +- testsuite/tests/typecheck/should_fail/T5978.stderr | 8 +- testsuite/tests/typecheck/should_fail/T7368.stderr | 2 +- .../tests/typecheck/should_fail/T7368a.stderr | 2 +- testsuite/tests/typecheck/should_fail/T7453.stderr | 20 +- testsuite/tests/typecheck/should_fail/T7696.stderr | 8 +- testsuite/tests/typecheck/should_fail/T8142.stderr | 26 +- testsuite/tests/typecheck/should_fail/T8262.stderr | 2 +- testsuite/tests/typecheck/should_fail/T8603.stderr | 13 +- testsuite/tests/typecheck/should_fail/T9612.stderr | 2 +- testsuite/tests/typecheck/should_fail/all.T | 1 + testsuite/tests/typecheck/should_fail/mc25.stderr | 4 +- .../tests/typecheck/should_fail/tcfail090.stderr | 2 +- .../tests/typecheck/should_fail/tcfail122.stderr | 2 +- .../tests/typecheck/should_fail/tcfail123.stderr | 2 +- .../tests/typecheck/should_fail/tcfail143.stderr | 6 +- .../tests/typecheck/should_fail/tcfail159.stderr | 2 +- .../tests/typecheck/should_fail/tcfail200.stderr | 2 +- .../tests/typecheck/should_fail/tcfail201.stderr | 4 +- 50 files changed, 1095 insertions(+), 759 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 a1275a762ec04c1159ae37199b1c8f998a5c5499 From git at git.haskell.org Wed Apr 29 14:10:39 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Apr 2015 14:10:39 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #10226 (d4a926b) Message-ID: <20150429141039.B0F673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4a926ba52fbbbdeaadfff7c86e7175c8cc1b97c/ghc >--------------------------------------------------------------- commit d4a926ba52fbbbdeaadfff7c86e7175c8cc1b97c Author: Simon Peyton Jones Date: Wed Apr 29 15:11:15 2015 +0100 Test Trac #10226 Fixed by the patch for #10009 >--------------------------------------------------------------- d4a926ba52fbbbdeaadfff7c86e7175c8cc1b97c .../tests/indexed-types/should_compile/T10226.hs | 59 ++++++++++++++++++++++ testsuite/tests/indexed-types/should_compile/all.T | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/indexed-types/should_compile/T10226.hs b/testsuite/tests/indexed-types/should_compile/T10226.hs new file mode 100644 index 0000000..947429d --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/T10226.hs @@ -0,0 +1,59 @@ +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE AllowAmbiguousTypes #-} -- only necessary in 7.10 +{-# LANGUAGE FlexibleContexts #-} -- necessary for showFromF' example +{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} + +module T10226 where + +type family F a +type family FInv a + +-- This definition is accepted in 7.8 without anything extra, but requires +-- AllowAmbiguousTypes in 7.10 (this, by itself, is not a problem): +showFromF :: (Show a, FInv (F a) ~ a) => F a -> String +showFromF fa = undefined + +-- Consider what happens when we attempt to call `showFromF` at some type b. +-- In order to check that this is valid, we have to find an a such that +-- +-- > b ~ F a /\ Show a /\ FInv (F a) ~ a +-- +-- Introducing an intermeidate variable `x` for the result of `F a` gives us +-- +-- > b ~ F a /\ Show a /\ FInv x ~ a /\ F a ~ x +-- +-- Simplifying +-- +-- > b ~ x /\ Show a /\ FInv x ~ a /\ F a ~ x +-- +-- Set x := b +-- +-- > Show a /\ FInv b ~ a /\ F a ~ b +-- +-- Set a := FInv b +-- +-- > Show (FInv b) /\ FInv b ~ FInv b /\ F (FInv b) ~ b +-- +-- Simplifying +-- +-- > Show (FInv b) /\ F (FInv b) ~ b +-- +-- Indeed, we can give this definition in 7.8, but not in 7.10: +showFromF' :: (Show (FInv b), F (FInv b) ~ b) => b -> String +showFromF' = showFromF + +{------------------------------------------------------------------------------- + In 7.10 the definition of showFromF' is not accepted, but it gets stranger. + In 7.10 we cannot _call_ showFromF at all all, even at a concrete type. Below + we try to call it at type b ~ Int. It would need to show + + > Show (FInv Int) /\ F (FInt Int) ~ Int + + all of which should easily get resolved, but somehow don't. +-------------------------------------------------------------------------------} + +type instance F Int = Int +type instance FInv Int = Int + +test :: String +test = showFromF (0 :: Int) diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T index 1cd1ea2..20f2c0a 100644 --- a/testsuite/tests/indexed-types/should_compile/all.T +++ b/testsuite/tests/indexed-types/should_compile/all.T @@ -254,4 +254,4 @@ test('T10020', normal, compile, ['']) test('T10079', normal, compile, ['']) test('T10139', normal, compile, ['']) test('T10340', normal, compile, ['']) - +test('T10226', normal, compile, ['']) From git at git.haskell.org Wed Apr 29 23:19:58 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Apr 2015 23:19:58 +0000 (UTC) Subject: [commit: ghc] master: Typeset Backpack syntax in a figure (54cefbd) Message-ID: <20150429231958.A17A43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/54cefbd753b516fe8645c1470750ad7f65352844/ghc >--------------------------------------------------------------- commit 54cefbd753b516fe8645c1470750ad7f65352844 Author: Simon Peyton Jones Date: Thu Apr 30 00:19:45 2015 +0100 Typeset Backpack syntax in a figure >--------------------------------------------------------------- 54cefbd753b516fe8645c1470750ad7f65352844 docs/backpack/algorithm.tex | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/docs/backpack/algorithm.tex b/docs/backpack/algorithm.tex index 956480b..68ea228 100644 --- a/docs/backpack/algorithm.tex +++ b/docs/backpack/algorithm.tex @@ -48,19 +48,31 @@ which allow us to hide requirements from import. \section{Front-end syntax} -For completeness, here is the package language we will be shaping and typechecking: - -\begin{verbatim} - package ::= "package" pkgname [pkgexports] "where" pkgbody - pkgbody ::= "{" pkgdecl_0 ";" ... ";" pkgdecl_n "}" - pkgdecl ::= "module" modid [exports] where body - | "signature" modid [exports] where body - | "include" pkgname [inclspec] - inclspec ::= "(" renaming_0 "," ... "," renaming_n [","] ")" - [ "requires" "(" renaming_0 "," ... "," renaming_n [","] ")" ] - pkgexports ::= inclspec - renaming ::= modid "as" modid -\end{verbatim} +\begin{figure} +$$ +\begin{array}{rcll} +p,q,r && \mbox{Package names} \\ +m,n && \mbox{Module names} \\[1em] +\multicolumn{3}{l}{\mbox{\bf Packages}} \\ + pkg & ::= & \verb|package|\; p\; [provreq]\; \verb|where {| d_1 \verb|;| \ldots \verb|;| d_n \verb|}| \\[1em] +\multicolumn{3}{l}{\mbox{\bf Declarations}} \\ + d & ::= & \verb|module|\; m \; [exports]\; \verb|where|\; body \\ + & | & \verb|signature|\; m \; [exports]\; \verb|where|\; body \\ + & | & \verb|include|\; p \; [provreq] \\[1em] +\multicolumn{3}{l}{\mbox{\bf Provides/requires specification}} \\ +provreq & ::= & \verb|(| \, rns \, \verb|)| \; + [ \verb|requires(|\, rns \, \verb|)| ] \\ +rns & ::= & rn_0 \verb|,| \, \ldots \verb|,| \, rn_n [\verb|,|] & \mbox{Renamings} \\ +rn & ::= & m\, \verb|as| \, n & \mbox{Renaming} \\[1em] +\multicolumn{3}{l}{\mbox{\bf Haskell code}} \\ +exports & & \mbox{A Haskell module export list} \\ +body & & \mbox{A Haskell module body} \\ +\end{array} +$$ +\caption{Syntax of Backpack} \label{fig:syntax} +\end{figure} + +The syntax of Backpack is given in Figure~\ref{fig:syntax}. See the ``Backpack manual'' for more explanation about the syntax. It is slightly simplified here by removing any constructs which are easily implemented as syntactic sugar (e.g., a \verb|modid| renaming is simply \verb|modid as modid|.) From git at git.haskell.org Thu Apr 30 08:22:06 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Apr 2015 08:22:06 +0000 (UTC) Subject: [commit: ghc] master: Tidy up treatment of FlexibleContexts (b83160d) Message-ID: <20150430082206.22EC03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b83160d07e626bee685f329a9a73e90a4a6074ae/ghc >--------------------------------------------------------------- commit b83160d07e626bee685f329a9a73e90a4a6074ae Author: Simon Peyton Jones Date: Thu Apr 30 09:18:49 2015 +0100 Tidy up treatment of FlexibleContexts Previously (Trac #10351) we could get Non type-variable argument in the constraint: C [t] (Use FlexibleContexts to permit this) When checking that `f' has the inferred type f :: forall t. C [t] => t -> () which is a bit stupid: we have *inferred* a type that we immediately *reject*. This patch arranges that that the generalisation mechanism (TcSimplify.decideQuantification) doesn't pick a predicate that will be rejected by the subsequent validity check. This forced some minor refactoring, as usual. >--------------------------------------------------------------- b83160d07e626bee685f329a9a73e90a4a6074ae compiler/main/DynFlags.hs | 5 - compiler/typecheck/TcBinds.hs | 5 +- compiler/typecheck/TcSimplify.hs | 57 ++++++----- compiler/typecheck/TcType.hs | 31 ++++++ compiler/typecheck/TcValidity.hs | 109 +++++++++------------ testsuite/tests/typecheck/should_fail/T10351.hs | 6 ++ .../tests/typecheck/should_fail/T10351.stderr | 5 + testsuite/tests/typecheck/should_fail/T6022.stderr | 11 ++- testsuite/tests/typecheck/should_fail/T8883.stderr | 16 +-- testsuite/tests/typecheck/should_fail/all.T | 1 + .../tests/typecheck/should_fail/tcfail108.stderr | 9 +- 11 files changed, 147 insertions(+), 108 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 b83160d07e626bee685f329a9a73e90a4a6074ae From git at git.haskell.org Thu Apr 30 09:49:29 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Apr 2015 09:49:29 +0000 (UTC) Subject: [commit: ghc] master: Typo fixes (mostly in comments) (a3f7517) Message-ID: <20150430094929.2D7E73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a3f7517e1d21228d0af4d0373a29c8c5b708e5bd/ghc >--------------------------------------------------------------- commit a3f7517e1d21228d0af4d0373a29c8c5b708e5bd Author: Gabor Greif Date: Thu Apr 30 11:47:08 2015 +0200 Typo fixes (mostly in comments) >--------------------------------------------------------------- a3f7517e1d21228d0af4d0373a29c8c5b708e5bd compiler/rename/RnExpr.hs | 2 +- compiler/rename/RnSource.hs | 2 +- compiler/rename/RnTypes.hs | 2 +- compiler/typecheck/TcInteract.hs | 28 +++++++++++----------- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcSMonad.hs | 2 +- docs/users_guide/glasgow_exts.xml | 4 ++-- .../tests/indexed-types/should_compile/T10226.hs | 4 ++-- testsuite/tests/programs/andy_cherry/DataTypes.hs | 6 ++--- testsuite/tests/typecheck/should_compile/T10009.hs | 2 +- 10 files changed, 27 insertions(+), 27 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 a3f7517e1d21228d0af4d0373a29c8c5b708e5bd From git at git.haskell.org Thu Apr 30 22:53:26 2015 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Apr 2015 22:53:26 +0000 (UTC) Subject: [commit: ghc] master: Typeset Backpack semantic entities in figure, figure-ify all asides. (fe5ccbb) Message-ID: <20150430225326.C9DE33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fe5ccbb1e12952ebab8a12ed7b11d6a315cac671/ghc >--------------------------------------------------------------- commit fe5ccbb1e12952ebab8a12ed7b11d6a315cac671 Author: Edward Z. Yang Date: Thu Apr 30 15:54:09 2015 -0700 Typeset Backpack semantic entities in figure, figure-ify all asides. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- fe5ccbb1e12952ebab8a12ed7b11d6a315cac671 docs/backpack/algorithm.pdf | Bin 215876 -> 237551 bytes docs/backpack/algorithm.tex | 69 ++++++++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/docs/backpack/algorithm.pdf b/docs/backpack/algorithm.pdf index 8865b94..de25194 100644 Binary files a/docs/backpack/algorithm.pdf and b/docs/backpack/algorithm.pdf differ diff --git a/docs/backpack/algorithm.tex b/docs/backpack/algorithm.tex index 68ea228..86e7538 100644 --- a/docs/backpack/algorithm.tex +++ b/docs/backpack/algorithm.tex @@ -1,6 +1,5 @@ \documentclass{article} -\usepackage{mdframed} \usepackage{pifont} \usepackage{graphicx} %[pdftex] OR [dvips] \usepackage{fullpage} @@ -16,13 +15,35 @@ \usepackage{algpseudocode} \usepackage{bigfoot} \usepackage{amssymb} +\usepackage{framed} + +% Alter some LaTeX defaults for better treatment of figures: +% See p.105 of "TeX Unbound" for suggested values. +% See pp. 199-200 of Lamport's "LaTeX" book for details. +% General parameters, for ALL pages: +\renewcommand{\topfraction}{0.9} % max fraction of floats at top +\renewcommand{\bottomfraction}{0.8} % max fraction of floats at bottom +% Parameters for TEXT pages (not float pages): +\setcounter{topnumber}{2} +\setcounter{bottomnumber}{2} +\setcounter{totalnumber}{4} % 2 may work better +\setcounter{dbltopnumber}{2} % for 2-column pages +\renewcommand{\dbltopfraction}{0.9} % fit big float above 2-col. text +\renewcommand{\textfraction}{0.07} % allow minimal text w. figs +% Parameters for FLOAT pages (not text pages): +\renewcommand{\floatpagefraction}{0.7} % require fuller float pages +% N.B.: floatpagefraction MUST be less than topfraction !! +\renewcommand{\dblfloatpagefraction}{0.7} % require fuller float pages + +% remember to use [htp] or [htpb] for placement + + +\newcommand{\optionrule}{\noindent\rule{1.0\textwidth}{0.75pt}} \newenvironment{aside} - {\begin{mdframed}[style=0,% - leftline=false,rightline=false,leftmargin=2em,rightmargin=2em,% - innerleftmargin=0pt,innerrightmargin=0pt,linewidth=0.75pt,% - skipabove=7pt,skipbelow=7pt]\small} - {\end{mdframed}} + {\begin{figure}\def\FrameCommand{\hspace{2em}} + \MakeFramed {\advance\hsize-\width}\optionrule\small} +{\par\vskip-\smallskipamount\optionrule\endMakeFramed\end{figure}} \setlength{\droptitle}{-6em} @@ -48,7 +69,7 @@ which allow us to hide requirements from import. \section{Front-end syntax} -\begin{figure} +\begin{figure}[htpb] $$ \begin{array}{rcll} p,q,r && \mbox{Package names} \\ @@ -63,7 +84,7 @@ m,n && \mbox{Module names} \\[1em] provreq & ::= & \verb|(| \, rns \, \verb|)| \; [ \verb|requires(|\, rns \, \verb|)| ] \\ rns & ::= & rn_0 \verb|,| \, \ldots \verb|,| \, rn_n [\verb|,|] & \mbox{Renamings} \\ -rn & ::= & m\, \verb|as| \, n & \mbox{Renaming} \\[1em] +rn & ::= & m\; \verb|as| \; n & \mbox{Renaming} \\[1em] \multicolumn{3}{l}{\mbox{\bf Haskell code}} \\ exports & & \mbox{A Haskell module export list} \\ body & & \mbox{A Haskell module body} \\ @@ -75,22 +96,26 @@ $$ The syntax of Backpack is given in Figure~\ref{fig:syntax}. See the ``Backpack manual'' for more explanation about the syntax. It is slightly simplified here by removing any constructs which are easily implemented as -syntactic sugar (e.g., a \verb|modid| renaming is simply \verb|modid as modid|.) +syntactic sugar (e.g., a bare $m$ in a renaming is simply $m\; \verb|as|\; m$.) +\newpage \section{Shaping} -Shaping computes a \verb|Shape| which has this form: +\begin{figure}[htpb] +$$ +\begin{array}{rcll} +Shape & ::= & \verb|provides:|\; m \; \verb|->|\; Module\; \verb|{|\, Name \verb|,|\, \ldots \, \verb|};| \ldots \\ + & & \verb|requires:| \; m \; \verb|->|\; \textcolor{white}{Module}\; \verb|{| \, Name \verb|,| \, \ldots \, \verb|}| \verb|;| \ldots \\ +PkgKey & ::= & p \verb|(| \, m \; \verb|->| \; Module \verb|,|\, \ldots\, \verb|)| \\ +Module & ::= & PkgKey \verb|:| m \\ +Name & ::= & Module \verb|.| OccName \\ +OccName & & \mbox{Unqualified name in a namespace} +\end{array} +$$ +\caption{Semantic entities in Backpack} \label{fig:semantic} +\end{figure} -\begin{verbatim} - Shape ::= provides: { ModName -> Module { Name } } - requires: { ModName -> { Name } } - - PkgKey ::= SrcPkgId "(" { ModName "->" Module } ")" - | HOLE - Module ::= PkgKey ":" ModName - Name ::= Module "." OccName - OccName ::= undefined | Bool | Int | ... -\end{verbatim} +Shaping computes a $Shape$, whose form is described in Figure~\ref{fig:semantic}. Starting with the empty shape, we incrementally construct a shape by shaping package declarations (the partially constructed shape serves as a context for renaming modules and signatures and instantiating @@ -235,7 +260,7 @@ A module declaration provides a module \verb|THIS:M| at module name \verb|M|. It has the shape: \begin{verbatim} - provides: { M -> THIS:M { exports of renamed M } } + provides: M -> THIS:M { exports of renamed M } requires: (nothing) \end{verbatim} Example: @@ -255,7 +280,7 @@ A signature declaration creates a requirement at module name \verb|M|. It has t \begin{verbatim} provides: (nothing) - requires: { M -> { exports of renamed M } } + requires: M -> { exports of renamed M } \end{verbatim} \noindent Example: