Simon Jakobi pushed to branch wip/sjakobi/T13729 at Glasgow Haskell Compiler / GHC
Commits:
-
9cd32e92
by Simon Jakobi at 2026-03-06T15:05:27+01:00
11 changed files:
- + testsuite/tests/driver/T13729/A/Setup.hs
- + testsuite/tests/driver/T13729/A/TH.hs
- + testsuite/tests/driver/T13729/A/Types1.hs
- + testsuite/tests/driver/T13729/A/Types2.hs
- + testsuite/tests/driver/T13729/A/p.cabal
- + testsuite/tests/driver/T13729/B/Main.hs
- + testsuite/tests/driver/T13729/B/Setup.hs
- + testsuite/tests/driver/T13729/B/q.cabal
- + testsuite/tests/driver/T13729/Makefile
- + testsuite/tests/driver/T13729/Setup.hs
- + testsuite/tests/driver/T13729/all.T
Changes:
| 1 | +import Distribution.Simple
|
|
| 2 | +main = defaultMain |
| 1 | +{-# LANGUAGE TemplateHaskell #-}
|
|
| 2 | +module TH where
|
|
| 3 | + |
|
| 4 | +import Language.Haskell.TH
|
|
| 5 | +import Language.Haskell.TH.Syntax
|
|
| 6 | +import Types
|
|
| 7 | + |
|
| 8 | +th_string = lift . show =<< reify ''Foo |
| 1 | +module Types where
|
|
| 2 | + |
|
| 3 | +data Foo = Bar |
| 1 | +module Types where
|
|
| 2 | + |
|
| 3 | +data Foo = Bar | Baz |
| 1 | +cabal-version: 2.2
|
|
| 2 | +name: A
|
|
| 3 | +version: 0.1.0.0
|
|
| 4 | +build-type: Simple
|
|
| 5 | + |
|
| 6 | +library
|
|
| 7 | + exposed-modules: TH, Types
|
|
| 8 | + hs-source-dirs: .
|
|
| 9 | + build-depends: base >=4.14 && <5, template-haskell
|
|
| 10 | + default-language: Haskell2010 |
| 1 | +{-# LANGUAGE TemplateHaskell #-}
|
|
| 2 | +module Main where
|
|
| 3 | + |
|
| 4 | +import TH
|
|
| 5 | + |
|
| 6 | +main = putStrLn $(th_string) |
| 1 | +import Distribution.Simple
|
|
| 2 | +main = defaultMain |
| 1 | +cabal-version: 2.2
|
|
| 2 | +name: B
|
|
| 3 | +version: 0.1.0.0
|
|
| 4 | +build-type: Simple
|
|
| 5 | + |
|
| 6 | +executable B
|
|
| 7 | + main-is: Main.hs
|
|
| 8 | + hs-source-dirs: .
|
|
| 9 | + build-depends: base >=4.14 && <5, A
|
|
| 10 | + default-language: Haskell2010 |
| 1 | +TOP=../../..
|
|
| 2 | +include $(TOP)/mk/boilerplate.mk
|
|
| 3 | +include $(TOP)/mk/test.mk
|
|
| 4 | + |
|
| 5 | +SETUP='$(PWD)/Setup' -v0
|
|
| 6 | +CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --with-hc-pkg='$(GHC_PKG)' --ghc-options='$(filter-out -rtsopts,$(TEST_HC_OPTS))' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' $(VANILLA) $(PROF) $(DYN)
|
|
| 7 | + |
|
| 8 | +T13729:
|
|
| 9 | + '$(GHC_PKG)' init tmp.d
|
|
| 10 | + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
|
|
| 11 | + |
|
| 12 | + # Build package A with the first Foo definition.
|
|
| 13 | + rm -rf A/dist
|
|
| 14 | + cp A/Types1.hs A/Types.hs
|
|
| 15 | + (cd A; $(CONFIGURE) --ipid "A-0.1")
|
|
| 16 | + (cd A; $(SETUP) build)
|
|
| 17 | + (cd A; $(SETUP) copy)
|
|
| 18 | + (cd A; $(SETUP) register)
|
|
| 19 | + |
|
| 20 | + # Build package B and record the splice output.
|
|
| 21 | + rm -rf B/dist
|
|
| 22 | + (cd B; $(CONFIGURE) --ipid "B-0.1")
|
|
| 23 | + (cd B; $(SETUP) build)
|
|
| 24 | + (cd B; $(SETUP) copy)
|
|
| 25 | + (cd B; $(SETUP) register)
|
|
| 26 | + ./inst/bin/B > out1
|
|
| 27 | + grep -q Bar out1
|
|
| 28 | + ! grep -q Baz out1
|
|
| 29 | + |
|
| 30 | + # Overwrite Types.hs with the second Foo definition, rebuild A, then rebuild B
|
|
| 31 | + # without -fforce-recomp.
|
|
| 32 | + cp A/Types2.hs A/Types.hs
|
|
| 33 | + (cd A; $(SETUP) build)
|
|
| 34 | + (cd A; $(SETUP) copy)
|
|
| 35 | + (cd A; $(SETUP) register)
|
|
| 36 | + (cd B; $(SETUP) build)
|
|
| 37 | + (cd B; $(SETUP) copy)
|
|
| 38 | + (cd B; $(SETUP) register)
|
|
| 39 | + ./inst/bin/B > out2
|
|
| 40 | + grep -q Baz out2 |
| 1 | +import Distribution.Simple
|
|
| 2 | +main = defaultMain |
| 1 | +if config.have_vanilla:
|
|
| 2 | + vanilla = '--enable-library-vanilla'
|
|
| 3 | +else:
|
|
| 4 | + vanilla = '--disable-library-vanilla'
|
|
| 5 | + |
|
| 6 | +if config.have_profiling:
|
|
| 7 | + prof = '--enable-library-profiling'
|
|
| 8 | +else:
|
|
| 9 | + prof = '--disable-library-profiling'
|
|
| 10 | + |
|
| 11 | +if not config.compiler_profiled and config.have_dynamic:
|
|
| 12 | + dyn = '--enable-shared'
|
|
| 13 | +else:
|
|
| 14 | + dyn = '--disable-shared'
|
|
| 15 | + |
|
| 16 | +test('T13729', [extra_files(['A', 'B', 'Setup.hs']),
|
|
| 17 | + when(fast(), skip),
|
|
| 18 | + js_broken(22349)],
|
|
| 19 | + run_command,
|
|
| 20 | + ['$MAKE -s --no-print-directory T13729 VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn]) |