[GHC] #10382: Template Haskell quotes should work with stage 1 compiler

#10382: Template Haskell quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature | Status: new request | Milestone: 7.12.1 Priority: normal | Version: 7.11 Component: Template | Operating System: Unknown/Multiple Haskell | Type of failure: None/Unknown Keywords: | Blocked By: Architecture: | Related Tickets: Unknown/Multiple | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Right now, you must enable the `TemplateHaskell` extension to use quotes, and `TemplateHaskell` is not supported by the stage 1 compiler. But there actually is no good reason why this should be the case: quoting doesn't require any user-written code to be loaded up and run, so it should be doable by the stage 1 compiler. I propose adding a new extension, `Quotation`, which turns on JUST quotation and works with the stage 1 compiler. This will solve len's problem https://github.com/ekmett/lens/issues/496 where they want to rename some syntax using quotation, but don't want break compilation on a stage 1 compiler. See also #10279. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Changes (by ezyang): * differential: => Phab:D876 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Description changed by ezyang: Old description:
Right now, you must enable the `TemplateHaskell` extension to use quotes, and `TemplateHaskell` is not supported by the stage 1 compiler. But there actually is no good reason why this should be the case: quoting doesn't require any user-written code to be loaded up and run, so it should be doable by the stage 1 compiler. I propose adding a new extension, `Quotation`, which turns on JUST quotation and works with the stage 1 compiler.
This will solve len's problem https://github.com/ekmett/lens/issues/496 where they want to rename some syntax using quotation, but don't want break compilation on a stage 1 compiler.
See also #10279.
New description: Right now, you must enable the `TemplateHaskell` extension to use quotes, and `TemplateHaskell` is not supported by the stage 1 compiler. But there actually is no good reason why this should be the case: quoting doesn't require any user-written code to be loaded up and run, so it should be doable by the stage 1 compiler. I propose adding a new extension, `Quotes`, which turns on JUST quotation and works with the stage 1 compiler. This will solve len's problem https://github.com/ekmett/lens/issues/496 where they want to rename some syntax using quotation, but don't want break compilation on a stage 1 compiler. See also #10279. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Comment (by simonpj): I'm not sure about this. Minor point: we already have a language extension `Opt_QuasiQuotes`. Surely we don't need another! Medium point: this change really only relates to building GHC ''itself'', so it's fairly parochial. For example if we have `[qq| blah |]` in GHC itself, then to compile stage 2 we must have `qq` defined in some library that is compiled with stage 1; a boot library in other words. And the boot libraries are fairly limited. Main thing: It does add complexity. If you write `[qq| blah |]` then: * In stage 1 we must find and dynamically link function `qq`, against the bootstrap compiler * In stage 2 we must find and dynamically link function `qq`, against the stage 1 compiler Moreover, if `HsSyn` has changed, then function `qq` must change too. And if you can manage all this version skew stuff, what's to stop us allowing ''all'' Template Haskell splices in stage 1? I thought it was obvious, but now I can't quite see it! Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Comment (by ezyang): To be clear, I am NOT suggesting quasi-quotes be supported by this; just plain old brackets! (Apologies for the bad names; perhaps "expression quotation" is a more accurate name?) With plain quotes, we don't have to find and link `qq` with this complexity. See the diff that's been attached, which I know works and is not all that complicated. Whether or not the change is parochial, I think it relates to more than just GHC; it applies to any platform where we can compile GHC, but dynamic code loading is not supported (i.e. no GHCi support). Now, you might wonder, "why would anyone need to use TH quotes, without any TH splices?" but Edward Kmett gives an example of one such case, where he wants to put his TH library code (no splices) in a main library, while still supporting platforms without GHCi, without macroing the business. Unusual? Maybe. But someone wants it, and it doesn't seem too hard to give them, so let's do it! If we don't like the language extension, we could alternate make `TemplateHaskell` not immediately error on stage 1 compilation, and just error when we actually reach a splice site. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Description changed by ezyang: Old description:
Right now, you must enable the `TemplateHaskell` extension to use quotes, and `TemplateHaskell` is not supported by the stage 1 compiler. But there actually is no good reason why this should be the case: quoting doesn't require any user-written code to be loaded up and run, so it should be doable by the stage 1 compiler. I propose adding a new extension, `Quotes`, which turns on JUST quotation and works with the stage 1 compiler.
This will solve len's problem https://github.com/ekmett/lens/issues/496 where they want to rename some syntax using quotation, but don't want break compilation on a stage 1 compiler.
See also #10279.
New description: Right now, you must enable the `TemplateHaskell` extension to use (non- quasi) quotes, and `TemplateHaskell` is not supported by the stage 1 compiler. But there actually is no good reason why this should be the case: (non-quasi) quoting doesn't require any user-written code to be loaded up and run, so it should be doable by the stage 1 compiler. I propose adding a new extension, `Quotes`, which turns on JUST quotation (NOT quasiquoting) and works with the stage 1 compiler. This will solve len's problem https://github.com/ekmett/lens/issues/496 where they want to rename some syntax using quotation, but don't want break compilation on a stage 1 compiler. See also #10279. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Comment (by ekmett): The current situation: On one hand I have a number of packages that provide `TemplateHaskell` convenience functions for users, `lens` being the go-to example. But on the other hand, I have a bunch of folks who maintain releases for my packages on platforms where only a stage1 compiler is available, Joachim Breitner and the Debian folks used to maintain patches and versions of my code that removed large chunks of the libraries to build on those platforms. When i found out, I offered to support stage1 compilers myself more directly. This ensured a more uniform API, and that different distributions weren't crippling my code in different ways, making it so certain combinators or modules just weren't available on certain platforms. But then we ran into an issue, we needed to generate names that linked to the right places within our code. So we manually construct all of our names ourselves, using the cabal-supplied version number or package key when needed: https://github.com/ekmett/lens/blob/9a247b52ed20e578d9c843d8cc6dad5433a1c186... Then we just don't use the TemplateHaskell extension ourselves, despite linking against the `template-haskell` package and everything is good enough for us to limp along. I would love to eventually be able to drop this set of hoops, but I have few opinions on the best way to get there. That said, Edward's suggestion of making TemplateHaskell just bomb when you reach a splice site in stage1 rather than immediately would avoid introducing any new flags and sounds pretty simple. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Comment (by goldfire): Seems sensible to me, if we just piggyback on the `TemplateHaskell` extension. (I, too, don't like `Quotes`!) If Phab is to be believed that almost all the code changes there are code ''movement'' and not code ''changes'', it does look indeed very simple to implement. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Comment (by ezyang): I can rewrite the code motion to be added ifdef macros, but it seemed cleaner to just hoist them all out. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: new Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Comment (by angerman): Sorry for being a little late to the discussion. Ideally, I would prefer that a stage1 compiler would try and go ahead with compiling template haskell, until it figures it can't. Motivation being: when ever I find time to hack on out-of-process-template-haskell (effectively trying to bring over luites th approach from ghcjs), I have to inject lots of ifdefs into the ghc code to even get ghc to the point where it starts to complain that it can't compile the splice instead of refusing to even try it right from the start. I haven't had much time to work on it throughout the last half year but would love to continue with it. I'll leave some of the relevant links here: - https://mail.haskell.org/pipermail/ghc-devs/2014-December/007555.html - https://ghc.haskell.org/trac/ghc/wiki/TemplateHaskell/CrossCompilation From my understanding, and please correct me if I'm wrong, th splices fall into three categories: - (a) IO - can be anything includiing arbitarary IO actions at compile time. - (b) Target dependent - reading target intrinsic values (maxBound :: Int) - (c) everything else that does not include (a) or (b). where (c) should be fine to compile on the host, (b) could probably be also compiled on the host if all the target intrinsic information is taken care of. (a) is going to be interesting, as at least with the out-of- process-th appraoch, you would be running the code on a device that might not have the same environment. Such that thinks like looking up git revisions would have to fail. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: ezyang
Type: feature request | Status: new
Priority: normal | Milestone: 7.12.1
Component: Template Haskell | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: Phab:D876
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: ezyang
Type: feature request | Status: new
Priority: normal | Milestone: 7.12.1
Component: Template Haskell | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: Phab:D876
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: ezyang
Type: feature request | Status: new
Priority: normal | Milestone: 7.12.1
Component: Template Haskell | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: Phab:D876
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: closed Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Changes (by ezyang): * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: ezyang
Type: feature request | Status: closed
Priority: normal | Milestone: 7.12.1
Component: Template Haskell | Version: 7.11
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: Phab:D876
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: closed Priority: normal | Milestone: 7.12.1 Component: Template Haskell | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D876 -------------------------------------+------------------------------------- Comment (by ezyang): There was a bug: template-haskell needs to build with GHC 7.8, which it does not right now. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: ezyang
Type: feature request | Status: closed
Priority: normal | Milestone: 7.12.1
Component: Template Haskell | Version: 7.11
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: Phab:D876
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: feature request | Status: closed Priority: normal | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): I was trying to update TH parts of user manual about which quotes can be run by stage1 compiler, and on the way I found out that tests in `quotes/` directory are currently not running under stage1. I tried this: - I run a test using top-level Makefile, e.g. `make TEST=T2632` in `testsuite/`. - I realized it's running using stage2 compiler. But the whole point of moving these tests to a new directory was to test them using stage1 compiler. - When I tried compiling the test using stage1 compiler(I copied the command and replaced stage2 with stage1), it failed with this: {{{ $ ./tests/quotes && "/home/omer/haskell/ghc/inplace/test spaces/ghc- stage1" -c T2632.hs -fforce-recomp -dcore-lint -dcmm-lint -dno-debug- output -no-user-package-db -rtsopts -fno-warn-tabs -fno-warn-missed- specialisations -fno-ghci-history -XTemplateHaskell -package template- haskell T2632.hs:10:9: error: Can't find interface-file declaration for type constructor or class DecsQ Probable cause: bug in .hi-boot file, or inconsistent .hi file Use -ddump-if-trace to get an idea of which file caused the error In the expression: [d| func = 0 `op` 3 |] In an equation for ‘decl1’: decl1 = [d| func = 0 `op` 3 |] T2632.hs:12:9: error: Can't find interface-file declaration for type constructor or class DecsQ Probable cause: bug in .hi-boot file, or inconsistent .hi file Use -ddump-if-trace to get an idea of which file caused the error In the expression: [d| op x y = x func = 0 `op` 3 |] In an equation for ‘decl2’: decl2 = [d| op x y = x func = 0 `op` 3 |] }}} I also tried the same thing on some manually created simple TH code and they all failed with same error. It seems like there's a bug somewhere. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * owner: ezyang => * status: closed => new * resolution: fixed => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): We also need a way to force the test suite to run stage1 in some cases, so we can catch this regression next time. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Comment (by thomie): Replying to [comment:20 ezyang]:
We also need a way to force the test suite to run stage1 in some cases, so we can catch this regression next time.
I see three options: * Option 1 (change validate) - create a directory with tests that should be tested with the stage1 compiler. - In ./validate, add something like `make -C testsuite/tests/stage1-tests stage=1` (The full command would also include: `$MAKE_TEST_TARGET $BINDIST $TEST_VERBOSITY THREADS=$threads SUMMARY_FILE=...)` - Make sure the grepping for results in testsuite_summary.txt still does the right thing (bit fiddly) - Minor point: define target synonyms `fasttest` and `slowtest` in `testsuite/Makefile` and `testsuite/mk/test.mk`) * Option 2 (driver support) - add a new setup function to testsuite/driver/testlib.py: something like `def stage(n)` or `def stage1()` - assign the `STAGE1_GHC` variable from testsuite/mk/boilerplate.mk should to a new option config.stage1 (add `--config 'stage1=$(call quote_path,$(STAGE1_GHC))'` to RUNTEST_OPTS in testsuite/mk/test.mk, and change testsuite/driver/runtests.py and testsuite/driver/testglobals.py. - add a `compiler` field to TestOptions (testsuite/driver/testglobals.py). By default it should contain config.compiler (do so in `def test` in testsuite/driver/testlib.py, not sure..) - the setup function `stage1()` sets opts.compiler to config.stage1, but only when the stage1 compiler is available. When TEST_HC is specified or when TEST_HC is implied to be an installed compiler, STAGE1_GHC won't be defined. - change all uses of config.compiler to opts.compiler (grep also for '{compiler}'). * Option 3 (Makefile) - define the test in a Makefile. Refer to `STAGE1_GHC` instead of `TEST_HC`. Skip if empty. The drawback of option 1 is that a failing validate might confuse GHC developers, because they can't reproduce the test failure when running the test locally (they'd have to specify make stage=1, which isn't obvious). Many questions on IRC/Phabricator/mail. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): Reading these options, an alternative comes to mind: what if we just made stage1 another WAY just like prof, etc.? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): As far as I can see WAY only effects the arguments passed to GHC, so it doesn't help unless we do some refactoring in the test driver, and the test driver is ... messy. Can we do this with less amount of work by adding a new field to `testglobals.TestOptions`, something like `stage`, and then in `testlib.simple_build()` we check the option and override `compiler` variable? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: patch Priority: high | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * priority: normal => high * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: feature request | Status: patch
Priority: high | Milestone: 8.0.1
Component: Template Haskell | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D876
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: merge Priority: high | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge Comment: Hasn't been merged yet. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: closed Priority: high | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D876 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as 745bdd88f9e4f9c85d46e84c58d6799bf71725b7. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10382#comment:27 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10382: Template Haskell (non-quasi) quotes should work with stage 1 compiler
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: feature request | Status: closed
Priority: high | Milestone: 8.0.1
Component: Template Haskell | Version: 7.11
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D876
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Thomas Miedema
participants (1)
-
GHC