Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ghc/ghc
  • bgamari/ghc
  • syd/ghc
  • ggreif/ghc
  • watashi/ghc
  • RolandSenn/ghc
  • mpickering/ghc
  • DavidEichmann/ghc
  • carter/ghc
  • harpocrates/ghc
  • ethercrow/ghc
  • mijicd/ghc
  • adamse/ghc
  • alexbiehl/ghc
  • gridaphobe/ghc
  • trofi/ghc
  • supersven/ghc
  • ppk/ghc
  • ulysses4ever/ghc
  • AndreasK/ghc
  • ghuntley/ghc
  • shayne-fletcher-da/ghc
  • fgaz/ghc
  • yav/ghc
  • osa1/ghc
  • mbbx6spp/ghc
  • JulianLeviston/ghc
  • reactormonk/ghc
  • rae/ghc
  • takenobu-hs/ghc
  • michalt/ghc
  • andrewthad/ghc
  • hsyl20/ghc
  • scottgw/ghc
  • sjakobi/ghc
  • angerman/ghc
  • RyanGlScott/ghc
  • hvr/ghc
  • howtonotwin/ghc
  • chessai/ghc
  • m-renaud/ghc
  • brprice/ghc
  • stevehartdata/ghc
  • sighingnow/ghc
  • kgardas/ghc
  • ckoparkar/ghc
  • alp/ghc
  • smaeul/ghc
  • kakkun61/ghc
  • sykloid/ghc
  • newhoggy/ghc
  • toonn/ghc
  • nineonine/ghc
  • Phyx/ghc
  • ezyang/ghc
  • tweag/ghc
  • langston/ghc
  • ndmitchell/ghc
  • rockbmb/ghc
  • artempyanykh/ghc
  • mniip/ghc
  • mynguyenbmc/ghc
  • alexfmpe/ghc
  • crockeea/ghc
  • nh2/ghc
  • vaibhavsagar/ghc
  • phadej/ghc
  • Haskell-mouse/ghc
  • lolotp/ghc
  • spacekitteh/ghc
  • michaelpj/ghc
  • mgsloan/ghc
  • HPCohen/ghc
  • tmobile/ghc
  • radrow/ghc
  • simonmar/ghc
  • _deepfire/ghc
  • Ericson2314/ghc
  • leitao/ghc
  • fumieval/ghc
  • trac-isovector/ghc
  • cblp/ghc
  • xich/ghc
  • ciil/ghc
  • erthalion/ghc
  • xldenis/ghc
  • autotaker/ghc
  • haskell-wasm/ghc
  • kcsongor/ghc
  • agander/ghc
  • Baranowski/ghc
  • trac-dredozubov/ghc
  • 23Skidoo/ghc
  • iustin/ghc
  • ningning/ghc
  • josefs/ghc
  • kabuhr/ghc
  • gallais/ghc
  • dten/ghc
  • expipiplus1/ghc
  • Pluralia/ghc
  • rohanjr/ghc
  • intricate/ghc
  • kirelagin/ghc
  • Javran/ghc
  • DanielG/ghc
  • trac-mizunashi_mana/ghc
  • pparkkin/ghc
  • bollu/ghc
  • ntc2/ghc
  • jaspervdj/ghc
  • JoshMeredith/ghc
  • wz1000/ghc
  • zkourouma/ghc
  • code5hot/ghc
  • jdprice/ghc
  • tdammers/ghc
  • J-mie6/ghc
  • trac-lantti/ghc
  • ch1bo/ghc
  • cgohla/ghc
  • lucamolteni/ghc
  • acairncross/ghc
  • amerocu/ghc
  • chreekat/ghc
  • txsmith/ghc
  • trupill/ghc
  • typetetris/ghc
  • sergv/ghc
  • fryguybob/ghc
  • erikd/ghc
  • trac-roland/ghc
  • setupminimal/ghc
  • Friede80/ghc
  • SkyWriter/ghc
  • xplorld/ghc
  • abrar/ghc
  • obsidiansystems/ghc
  • Icelandjack/ghc
  • adinapoli/ghc
  • trac-matthewbauer/ghc
  • heatsink/ghc
  • dwijnand/ghc
  • Cmdv/ghc
  • alinab/ghc
  • pepeiborra/ghc
  • fommil/ghc
  • luochen1990/ghc
  • rlupton20/ghc
  • applePrincess/ghc
  • lehins/ghc
  • ronmrdechai/ghc
  • leeadam/ghc
  • harendra/ghc
  • mightymosquito1991/ghc
  • trac-gershomb/ghc
  • lucajulian/ghc
  • Rizary/ghc
  • VictorCMiraldo/ghc
  • jamesbrock/ghc
  • andrewdmeier/ghc
  • luke/ghc
  • pranaysashank/ghc
  • cocreature/ghc
  • hithroc/ghc
  • obreitwi/ghc
  • slrtbtfs/ghc
  • kaol/ghc
  • yairchu/ghc
  • Mathemagician98/ghc
  • trac-taylorfausak/ghc
  • leungbk/ghc
  • MichaWiedenmann/ghc
  • chris-martin/ghc
  • TDecki/ghc
  • adithyaov/ghc
  • trac-gelisam/ghc
  • Lysxia/ghc
  • complyue/ghc
  • bwignall/ghc
  • sternmull/ghc
  • sonika/ghc
  • leif/ghc
  • broadwaylamb/ghc
  • myszon/ghc
  • danbroooks/ghc
  • Mechachleopteryx/ghc
  • zardyh/ghc
  • trac-vdukhovni/ghc
  • OmarKhaledAbdo/ghc
  • arrowd/ghc
  • Bodigrim/ghc
  • matheus23/ghc
  • cardenaso11/ghc
  • trac-Athas/ghc
  • mb720/ghc
  • DylanZA/ghc
  • liff/ghc
  • typedrat/ghc
  • trac-claude/ghc
  • jbm/ghc
  • Gertjan423/ghc
  • PHO/ghc
  • JKTKops/ghc
  • kockahonza/ghc
  • msakai/ghc
  • Sir4ur0n/ghc
  • barambani/ghc
  • vishnu.c/ghc
  • dcoutts/ghc
  • trac-runeks/ghc
  • trac-MaxGabriel/ghc
  • lexi.lambda/ghc
  • strake/ghc
  • spavikevik/ghc
  • JakobBruenker/ghc
  • rmanne/ghc
  • gdziadkiewicz/ghc
  • ani/ghc
  • iliastsi/ghc
  • smunix/ghc
  • judah/ghc
  • blackgnezdo/ghc
  • emilypi/ghc
  • trac-bpfoley/ghc
  • muesli4/ghc
  • trac-gkaracha/ghc
  • Kleidukos/ghc
  • nek0/ghc
  • TristanCacqueray/ghc
  • dwulive/ghc
  • mbakke/ghc
  • arybczak/ghc
  • Yang123321/ghc
  • maksbotan/ghc
  • QuietMisdreavus/ghc
  • trac-olshanskydr/ghc
  • emekoi/ghc
  • samuela/ghc
  • josephcsible/ghc
  • dramforever/ghc
  • lpsmith/ghc
  • DenisFrezzato/ghc
  • michivi/ghc
  • jneira/ghc
  • jeffhappily/ghc
  • Ivan-Yudin/ghc
  • nakaji-dayo/ghc
  • gdevanla/ghc
  • galen/ghc
  • fendor/ghc
  • yaitskov/ghc
  • rcythr/ghc
  • awpr/ghc
  • jeremyschlatter/ghc
  • Aver1y/ghc
  • mitchellvitez/ghc
  • merijn/ghc
  • tomjaguarpaw1/ghc
  • trac-NoidedSuper/ghc
  • erewok/ghc
  • trac-junji.hashimoto/ghc
  • adamwespiser/ghc
  • bjaress/ghc
  • jhrcek/ghc
  • leonschoorl/ghc
  • lukasz-golebiewski/ghc
  • sheaf/ghc
  • last-g/ghc
  • carassius1014/ghc
  • eschwartz/ghc
  • dwincort/ghc
  • felixwiemuth/ghc
  • TimWSpence/ghc
  • marcusmonteirodesouza/ghc
  • WJWH/ghc
  • vtols/ghc
  • theobat/ghc
  • BinderDavid/ghc
  • ckoparkar0/ghc
  • alexander-kjeldaas/ghc
  • dme2/ghc
  • philderbeast/ghc
  • aaronallen8455/ghc
  • rayshih/ghc
  • benkard/ghc
  • mpardalos/ghc
  • saidelman/ghc
  • leiftw/ghc
  • ca333/ghc
  • bwroga/ghc
  • nmichael44/ghc
  • trac-crobbins/ghc
  • felixonmars/ghc
  • adityagupta1089/ghc
  • hgsipiere/ghc
  • treeowl/ghc
  • alexpeits/ghc
  • CraigFe/ghc
  • dnlkrgr/ghc
  • kerckhove_ts/ghc
  • cptwunderlich/ghc
  • eiais/ghc
  • hahohihu/ghc
  • sanchayan/ghc
  • lemmih/ghc
  • sehqlr/ghc
  • trac-dbeacham/ghc
  • luite/ghc
  • trac-f-a/ghc
  • vados/ghc
  • luntain/ghc
  • fatho/ghc
  • alexbiehl-gc/ghc
  • dcbdan/ghc
  • tvh/ghc
  • liam-ly/ghc
  • timbobbarnes/ghc
  • GovanifY/ghc
  • shanth2600/ghc
  • gliboc/ghc
  • duog/ghc
  • moxonsghost/ghc
  • zander/ghc
  • masaeedu/ghc
  • georgefst/ghc
  • guibou/ghc
  • nicuveo/ghc
  • mdebruijne/ghc
  • stjordanis/ghc
  • emiflake/ghc
  • wygulmage/ghc
  • frasertweedale/ghc
  • coot/ghc
  • aratamizuki/ghc
  • tsandstr/ghc
  • mrBliss/ghc
  • Anton-Latukha/ghc
  • tadfisher/ghc
  • vapourismo/ghc
  • Sorokin-Anton/ghc
  • basile-henry/ghc
  • trac-mightybyte/ghc
  • AbsoluteNikola/ghc
  • cobrien99/ghc
  • songzh/ghc
  • blamario/ghc
  • aj4ayushjain/ghc
  • trac-utdemir/ghc
  • tangcl/ghc
  • hdgarrood/ghc
  • maerwald/ghc
  • arjun/ghc
  • ratherforky/ghc
  • haskieLambda/ghc
  • EmilGedda/ghc
  • Bogicevic/ghc
  • eddiejessup/ghc
  • kozross/ghc
  • AlistairB/ghc
  • 3Rafal/ghc
  • christiaanb/ghc
  • trac-bit/ghc
  • matsumonkie/ghc
  • trac-parsonsmatt/ghc
  • chisui/ghc
  • jaro/ghc
  • trac-kmiyazato/ghc
  • davidsd/ghc
  • Tritlo/ghc
  • I-B-3/ghc
  • lykahb/ghc
  • AriFordsham/ghc
  • turion1/ghc
  • berberman/ghc
  • christiantakle/ghc
  • zyklotomic/ghc
  • trac-ocramz/ghc
  • CSEdd/ghc
  • doyougnu/ghc
  • mmhat/ghc
  • why-not-try-calmer/ghc
  • plutotulp/ghc
  • kjekac/ghc
  • Manvi07/ghc
  • teo/ghc
  • cactus/ghc
  • CarrieMY/ghc
  • abel/ghc
  • yihming/ghc
  • tsakki/ghc
  • jessicah/ghc
  • oliverbunting/ghc
  • meld/ghc
  • friedbrice/ghc
  • Joald/ghc
  • abarbu/ghc
  • DigitalBrains1/ghc
  • sterni/ghc
  • alexDarcy/ghc
  • hexchain/ghc
  • minimario/ghc
  • zliu41/ghc
  • tommd/ghc
  • jazcarate/ghc
  • peterbecich/ghc
  • alirezaghey/ghc
  • solomon/ghc
  • mikael.urankar/ghc
  • davjam/ghc
  • int-index/ghc
  • MorrowM/ghc
  • nrnrnr/ghc
  • Sonfamm/ghc-test-only
  • afzt1/ghc
  • nguyenhaibinh-tpc/ghc
  • trac-lierdakil/ghc
  • MichaWiedenmann1/ghc
  • jmorag/ghc
  • Ziharrk/ghc
  • trac-MitchellSalad/ghc
  • juampe/ghc
  • jwaldmann/ghc
  • snowleopard/ghc
  • juhp/ghc
  • normalcoder/ghc
  • ksqsf/ghc
  • trac-jberryman/ghc
  • roberth/ghc
  • 1ntEgr8/ghc
  • epworth/ghc
  • MrAdityaAlok/ghc
  • JunmingZhao42/ghc
  • jappeace/ghc
  • trac-Gabriel439/ghc
  • alt-romes/ghc
  • HugoPeters1024/ghc
  • 10ne1/ghc-fork
  • agentultra/ghc
  • Garfield1002/ghc
  • ChickenProp/ghc
  • clyring/ghc
  • MaxHearnden/ghc
  • jumper149/ghc
  • vem/ghc
  • ketzacoatl/ghc
  • Rosuavio/ghc
  • jackohughes/ghc
  • p4l1ly/ghc
  • konsumlamm/ghc
  • shlevy/ghc
  • torsten.schmits/ghc
  • andremarianiello/ghc
  • amesgen/ghc
  • googleson78/ghc
  • InfiniteVerma/ghc
  • uhbif19/ghc
  • yiyunliu/ghc
  • raehik/ghc
  • mrkun/ghc
  • telser/ghc
  • 1Jajen1/ghc
  • slotThe/ghc
  • WinstonHartnett/ghc
  • mpilgrem/ghc
  • dreamsmasher/ghc
  • schuelermine/ghc
  • trac-Viwor/ghc
  • undergroundquizscene/ghc
  • evertedsphere/ghc
  • coltenwebb/ghc
  • oberblastmeister/ghc
  • agrue/ghc
  • lf-/ghc
  • zacwood9/ghc
  • steshaw/ghc
  • high-cloud/ghc
  • SkamDart/ghc
  • PiDelport/ghc
  • maoif/ghc
  • RossPaterson/ghc
  • CharlesTaylor7/ghc
  • ribosomerocker/ghc
  • trac-ramirez7/ghc
  • daig/ghc
  • NicolasT/ghc
  • FinleyMcIlwaine/ghc
  • lawtonnichols/ghc
  • jmtd/ghc
  • ozkutuk/ghc
  • wildsebastian/ghc
  • nikshalark/ghc
  • lrzlin/ghc
  • tobias/ghc
  • fw/ghc
  • hawkinsw/ghc
  • type-dance/ghc
  • rui314/ghc
  • ocharles/ghc
  • wavewave/ghc
  • TheKK/ghc
  • nomeata/ghc
  • trac-csabahruska/ghc
  • jonathanjameswatson/ghc
  • L-as/ghc
  • Axman6/ghc
  • barracuda156/ghc
  • trac-jship/ghc
  • jake-87/ghc
  • meooow/ghc
  • rebeccat/ghc
  • hamana55/ghc
  • Enigmage/ghc
  • kokobd/ghc
  • agevelt/ghc
  • gshen42/ghc
  • chrismwendt/ghc
  • MangoIV/ghc
  • teto/ghc
  • Sookr1/ghc
  • trac-thomasjm/ghc
  • barci2/ghc-dev
  • trac-m4dc4p/ghc
  • dixonary/ghc
  • breakerzirconia/ghc
  • alexsio27444/ghc
  • glocq/ghc
  • sourabhxyz/ghc
  • ryantrinkle/ghc
  • Jade/ghc
  • scedfaliako/ghc
  • martijnbastiaan/ghc
  • trac-george.colpitts/ghc
  • ammarbinfaisal/ghc
  • mimi.vx/ghc
  • lortabac/ghc
  • trac-zyla/ghc
  • benbellick/ghc
  • aadaa-fgtaa/ghc
  • jvanbruegge/ghc
  • archbung/ghc
  • gilmi/ghc
  • mfonism/ghc
  • alex-mckenna/ghc
  • Ei30metry/ghc
  • DiegoDiverio/ghc
  • jorgecunhamendes/ghc
  • liesnikov/ghc
  • akrmn/ghc
  • trac-simplifierticks/ghc
  • jacco/ghc
  • rhendric/ghc
  • damhiya/ghc
  • ryndubei/ghc
  • DaveBarton/ghc
  • trac-Profpatsch/ghc
  • GZGavinZhao/ghc
  • ncfavier/ghc
  • jameshaydon/ghc
  • ajccosta/ghc
  • dschrempf/ghc
  • cydparser/ghc
  • LinuxUserGD/ghc
  • elodielander/ghc
  • facundominguez/ghc
  • psilospore/ghc
  • lachrimae/ghc
  • dylan-thinnes/ghc-type-errors-plugin
  • hamishmack/ghc
  • Leary/ghc
  • lzszt/ghc
  • lyokha/ghc
  • trac-glaubitz/ghc
  • Rewbert/ghc
  • andreabedini/ghc
  • Jasagredo/ghc
  • sol/ghc
  • OlegAlexander/ghc
  • trac-sthibaul/ghc
  • avdv/ghc
  • Wendaolee/ghc
  • ur4t/ghc
  • daylily/ghc
  • boltzmannrain/ghc
  • mmzk1526/ghc
  • trac-fizzixnerd/ghc
  • soulomoon/ghc
  • rwmjones/ghc
  • j14i/ghc
  • tracsis/ghc
  • gesh/ghc
  • flip101/ghc
  • eldritch-cookie/ghc
  • LemonjamesD/ghc
  • pgujjula/ghc
  • skeuchel/ghc
  • noteed/ghc
  • gulin.serge/ghc
  • Torrekie/ghc
  • jlwoodwa/ghc
  • ayanamists/ghc
  • husong998/ghc
  • trac-edmundnoble/ghc
  • josephf/ghc
  • contrun/ghc
  • baulig/ghc
  • edsko/ghc
  • mzschr/ghc-issue-24732
  • ulidtko/ghc
  • Arsen/ghc
  • trac-sjoerd_visscher/ghc
  • crumbtoo/ghc
  • L0neGamer/ghc
  • DrewFenwick/ghc
  • benz0li/ghc
  • MaciejWas/ghc
  • jordanrule/ghc
  • trac-qqwy/ghc
  • LiamGoodacre/ghc
  • isomorpheme/ghc
  • trac-danidiaz/ghc
  • Kariim/ghc
  • MTaimoorZaeem/ghc
  • hololeap/ghc
  • ticat-fp/ghc
  • meritamen/ghc
  • criskell/ghc
  • trac-kraai/ghc
  • aergus/ghc
  • jdral/ghc
  • SamB/ghc
  • Tristian/ghc
  • ywgrit/ghc
  • KatsuPatrick/ghc
  • OsePedro/ghc
  • mpscholten/ghc
  • fp/ghc
  • zaquest/ghc
  • fangyi-zhou/ghc
  • augyg/ghc
640 results
Show changes
Commits on Source (14)
  • Ben Gamari's avatar
    nativeGen: Explicitly set flags of text sections on Windows · 3ece9856
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    The binutils documentation (for COFF) claims,
    
    > If no flags are specified, the default flags depend upon the section
    > name. If the section name is not recognized, the default will be for the
    > section to be loaded and writable.
    
    We previously assumed that this would do the right thing for split
    sections (e.g. a section named `.text$foo` would be correctly inferred
    to be a text section). However, we have observed that this is not the
    case (at least under the clang toolchain used on Windows): when
    split-sections is enabled, text sections are treated by the assembler as
    data (matching the "default" behavior specified by the documentation).
    
    Avoid this by setting section flags explicitly. This should fix split
    sections on Windows.
    
    Fixes #22834.
    3ece9856
  • Ben Gamari's avatar
    nativeGen: Set explicit section types on all platforms · db7f7240
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    db7f7240
  • Finley McIlwaine's avatar
    Insert documentation into parsed signature modules · b444c16f
    Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
    Causes haddock comments in signature modules to be properly
    inserted into the AST (just as they are for regular modules)
    if the `-haddock` flag is given.
    
    Also adds a test that compares `-ddump-parsed-ast` output
    for a signature module to prevent further regressions.
    
    Fixes #23315
    b444c16f
  • Ben Gamari's avatar
    primops: Introduce unsafeThawByteArray# · c30cea53
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This addresses an odd asymmetry in the ByteArray# primops, which
    previously provided unsafeFreezeByteArray# but no corresponding
    thaw operation.
    
    Closes #22710
    c30cea53
  • Ben Gamari's avatar
    testsuite: Elaborate in interface stability README · 87f9bd47
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    This discussion didn't make it into the original MR.
    87f9bd47
  • Matthew Pickering's avatar
    Allow users to override non-essential haddock options in a Flavour · e4350b41
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    We now supply the non-essential options to haddock using the `extraArgs`
    field, which can be specified in a Flavour so that if an advanced user
    wants to change how documentation is generated then they can use
    something other than the `defaultHaddockExtraArgs`.
    
    This does have the potential to regress some packaging if a user has
    overridden `extraArgs` themselves, because now they also need to add
    the haddock options to extraArgs. This can easily be done by appending
    `defaultHaddockExtraArgs` to their extraArgs invocation but someone
    might not notice this behaviour has changed.
    
    In any case, I think passing the non-essential options in this manner is
    the right thing to do and matches what we do for the "ghc" builder,
    which by default doesn't pass any optmisation levels, and would likewise
    be very bad if someone didn't pass suitable `-O` levels for builds.
    
    Fixes #23625
    e4350b41
  • Ilias Tsitsimpis's avatar
    ghc-prim: Link against libatomic · fc186b0c
    Ilias Tsitsimpis authored and Marge Bot's avatar Marge Bot committed
    Commit b4d39adb made 'hs_cmpxchg64()' available to all architectures.
    Unfortunately this made GHC to fail to build on armel, since armel needs
    libatomic to support atomic operations on 64-bit word sizes.
    
    Configure libraries/ghc-prim/ghc-prim.cabal to link against libatomic,
    the same way as we do in rts/rts.cabal.
    fc186b0c
  • Matthew Pickering's avatar
    simplifier: Correct InScopeSet in rule matching · 4f5538a8
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    The in-scope set passedto the `exprIsLambda_maybe` call lacked all the
    in-scope binders. @simonpj suggests this fix where we augment the
    in-scope set with the free variables of expression which fixes this
    failure mode in quite a direct way.
    
    Fixes #23630
    4f5538a8
  • Krzysztof Gogolewski's avatar
    Add a test for #23413 · 5ad8d597
    Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
    It was fixed by commit e1590ddc: Add the SolverStage monad.
    5ad8d597
  • sheaf's avatar
    Finish migration of diagnostics in GHC.Tc.Validity · 7e05f6df
    sheaf authored and Marge Bot's avatar Marge Bot committed
    This patch finishes migrating the error messages in GHC.Tc.Validity
    to use the new diagnostic infrastructure.
    
    It also refactors the error message datatypes for class and family
    instances, to common them up under a single datatype as much as possible.
    7e05f6df
  • Matthew Pickering's avatar
    ci: Enable some more jobs to run in a marge batch · 4876fddc
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    In !10907 I made the majority of jobs not run on a validate pipeline but
    then forgot to renable a select few jobs on the marge batch MR.
    4876fddc
  • Jens Petersen's avatar
    user_guide/flags.py: python-3.12 no longer includes distutils · 026991d7
    Jens Petersen authored and Marge Bot's avatar Marge Bot committed
    packaging.version seems able to handle this fine
    026991d7
  • Matthew Pickering's avatar
    ci: Mention ~full-ci label in MR template · b91bbc2b
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    We mention that if you need a full validation pipeline then you can
    apply the ~full-ci label to your MR in order to test against the full
    validation pipeline (like we do for marge).
    b91bbc2b
  • Krzysztof Gogolewski's avatar
    Misc cleanup · 509860a7
    Krzysztof Gogolewski authored
    - Remove unused RDR names
    - Fix typos in comments
    - Deriving: simplify boxConTbl and remove unused litConTbl
    - chmod -x GHC/Exts.hs, this seems accidental
    509860a7
Showing
with 896 additions and 609 deletions
......@@ -433,6 +433,7 @@ hadrian-multi:
- cabal-cache
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
############################################################
# stack-hadrian-build
......@@ -511,7 +512,7 @@ doc-tarball:
optional: true
- job: nightly-x86_64-windows-validate
optional: true
- job: release-x86_64-windows-release+no_split_sections
- job: release-x86_64-windows-release
optional: true
tags:
......@@ -535,7 +536,7 @@ doc-tarball:
|| mv "ghc-x86_64-linux-deb10-release.tar.xz" "$LINUX_BINDIST" \
|| true
mv "ghc-x86_64-windows-validate.tar.xz" "$WINDOWS_BINDIST" \
|| mv "ghc-x86_64-windows-release+no_split_sections.tar.xz" "$WINDOWS_BINDIST" \
|| mv "ghc-x86_64-windows-release.tar.xz" "$WINDOWS_BINDIST" \
|| true
if [ ! -f "$LINUX_BINDIST" ]; then
echo "Error: $LINUX_BINDIST does not exist. Did the Debian 9 job fail?"
......@@ -831,6 +832,7 @@ perf-nofib:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
tags:
- x86_64-linux
before_script:
......@@ -898,6 +900,7 @@ perf:
- out
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
############################################################
# ABI testing
......@@ -938,6 +941,7 @@ abi-test:
- out
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
############################################################
......
......@@ -921,8 +921,8 @@ job_groups =
-- This job is only for generating head.hackage docs
, hackage_doc_job (disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora33) releaseConfig))
, disableValidate (standardBuildsWithConfig Amd64 (Linux Fedora33) dwarf)
, fastCI (standardBuildsWithConfig Amd64 Windows (splitSectionsBroken vanilla))
, disableValidate (standardBuildsWithConfig Amd64 Windows (splitSectionsBroken nativeInt))
, fastCI (standardBuildsWithConfig Amd64 Windows vanilla)
, disableValidate (standardBuildsWithConfig Amd64 Windows nativeInt)
, standardBuilds Amd64 Darwin
, allowFailureGroup (addValidateRule FreeBSDLabel (validateBuilds Amd64 FreeBSD13 vanilla))
, fastCI (standardBuilds AArch64 Darwin)
......
......@@ -3577,7 +3577,7 @@
"XZ_OPT": "-9"
}
},
"release-x86_64-windows-int_native-release+no_split_sections": {
"release-x86_64-windows-int_native-release": {
"after_script": [
"bash .gitlab/ci.sh save_cache",
"bash .gitlab/ci.sh save_test_output",
......@@ -3587,7 +3587,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
"ghc-x86_64-windows-int_native-release+no_split_sections.tar.xz",
"ghc-x86_64-windows-int_native-release.tar.xz",
"junit.xml",
"unexpected-test-output.tar.gz"
],
......@@ -3626,8 +3626,8 @@
],
"variables": {
"BIGNUM_BACKEND": "native",
"BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release+no_split_sections",
"BUILD_FLAVOUR": "release+no_split_sections",
"BIN_DIST_NAME": "ghc-x86_64-windows-int_native-release",
"BUILD_FLAVOUR": "release",
"CABAL_INSTALL_VERSION": "3.8.1.0",
"CONFIGURE_ARGS": "",
"GHC_VERSION": "9.4.3",
......@@ -3636,11 +3636,11 @@
"LANG": "en_US.UTF-8",
"MSYSTEM": "CLANG64",
"RUNTEST_ARGS": "",
"TEST_ENV": "x86_64-windows-int_native-release+no_split_sections",
"TEST_ENV": "x86_64-windows-int_native-release",
"XZ_OPT": "-9"
}
},
"release-x86_64-windows-release+no_split_sections": {
"release-x86_64-windows-release": {
"after_script": [
"bash .gitlab/ci.sh save_cache",
"bash .gitlab/ci.sh save_test_output",
......@@ -3650,7 +3650,7 @@
"artifacts": {
"expire_in": "1 year",
"paths": [
"ghc-x86_64-windows-release+no_split_sections.tar.xz",
"ghc-x86_64-windows-release.tar.xz",
"junit.xml",
"unexpected-test-output.tar.gz"
],
......@@ -3689,8 +3689,8 @@
],
"variables": {
"BIGNUM_BACKEND": "gmp",
"BIN_DIST_NAME": "ghc-x86_64-windows-release+no_split_sections",
"BUILD_FLAVOUR": "release+no_split_sections",
"BIN_DIST_NAME": "ghc-x86_64-windows-release",
"BUILD_FLAVOUR": "release",
"CABAL_INSTALL_VERSION": "3.8.1.0",
"CONFIGURE_ARGS": "",
"GHC_VERSION": "9.4.3",
......@@ -3699,7 +3699,7 @@
"LANG": "en_US.UTF-8",
"MSYSTEM": "CLANG64",
"RUNTEST_ARGS": "",
"TEST_ENV": "x86_64-windows-release+no_split_sections",
"TEST_ENV": "x86_64-windows-release",
"XZ_OPT": "-9"
}
},
......
......@@ -25,6 +25,10 @@ If you have any questions don't hesitate to open your merge request and inquire
in a comment. If your patch isn't quite done yet please do add prefix your MR
title with `WIP:`.
By default a minimal validation pipeline is run on each merge request, the ~full-ci
label can be applied to perform additional validation checks if your MR affects a more
unusual configuration.
Once your change is ready please remove the `WIP:` tag and wait for review. If
no one has offerred review in a few days then please leave a comment mentioning
@triagers and apply the ~"Blocked on Review" label.
......
......@@ -716,14 +716,6 @@ ltTag_RDR = nameRdrName ordLTDataConName
eqTag_RDR = nameRdrName ordEQDataConName
gtTag_RDR = nameRdrName ordGTDataConName
eqClass_RDR, numClass_RDR, ordClass_RDR, enumClass_RDR, monadClass_RDR
:: RdrName
eqClass_RDR = nameRdrName eqClassName
numClass_RDR = nameRdrName numClassName
ordClass_RDR = nameRdrName ordClassName
enumClass_RDR = nameRdrName enumClassName
monadClass_RDR = nameRdrName monadClassName
map_RDR, append_RDR :: RdrName
map_RDR = nameRdrName mapName
append_RDR = nameRdrName appendName
......@@ -750,41 +742,10 @@ enumFromTo_RDR = nameRdrName enumFromToName
enumFromThen_RDR = nameRdrName enumFromThenName
enumFromThenTo_RDR = nameRdrName enumFromThenToName
ratioDataCon_RDR, integerAdd_RDR, integerMul_RDR :: RdrName
ratioDataCon_RDR = nameRdrName ratioDataConName
integerAdd_RDR = nameRdrName integerAddName
integerMul_RDR = nameRdrName integerMulName
ioDataCon_RDR :: RdrName
ioDataCon_RDR = nameRdrName ioDataConName
newStablePtr_RDR :: RdrName
newStablePtr_RDR = nameRdrName newStablePtrName
bindIO_RDR, returnIO_RDR :: RdrName
bindIO_RDR = nameRdrName bindIOName
returnIO_RDR = nameRdrName returnIOName
fromInteger_RDR, fromRational_RDR, minus_RDR, times_RDR, plus_RDR :: RdrName
fromInteger_RDR = nameRdrName fromIntegerName
fromRational_RDR = nameRdrName fromRationalName
minus_RDR = nameRdrName minusName
times_RDR, plus_RDR :: RdrName
times_RDR = varQual_RDR gHC_NUM (fsLit "*")
plus_RDR = varQual_RDR gHC_NUM (fsLit "+")
toInteger_RDR, toRational_RDR, fromIntegral_RDR :: RdrName
toInteger_RDR = nameRdrName toIntegerName
toRational_RDR = nameRdrName toRationalName
fromIntegral_RDR = nameRdrName fromIntegralName
fromString_RDR :: RdrName
fromString_RDR = nameRdrName fromStringName
fromList_RDR, fromListN_RDR, toList_RDR :: RdrName
fromList_RDR = nameRdrName fromListName
fromListN_RDR = nameRdrName fromListNName
toList_RDR = nameRdrName toListName
compose_RDR :: RdrName
compose_RDR = varQual_RDR gHC_BASE (fsLit ".")
......
......@@ -1147,29 +1147,7 @@ bndrInvisKey = mkPreludeMiscIdUnique 801
************************************************************************
-}
lift_RDR, liftTyped_RDR, mkNameG_dRDR, mkNameG_vRDR, mkNameG_fldRDR,
unsafeCodeCoerce_RDR :: RdrName
lift_RDR, liftTyped_RDR, unsafeCodeCoerce_RDR :: RdrName
lift_RDR = nameRdrName liftName
liftTyped_RDR = nameRdrName liftTypedName
unsafeCodeCoerce_RDR = nameRdrName unsafeCodeCoerceName
mkNameG_dRDR = nameRdrName mkNameG_dName
mkNameG_vRDR = nameRdrName mkNameG_vName
mkNameG_fldRDR = nameRdrName mkNameG_fldName
-- data Exp = ...
conE_RDR, litE_RDR, appE_RDR, infixApp_RDR :: RdrName
conE_RDR = nameRdrName conEName
litE_RDR = nameRdrName litEName
appE_RDR = nameRdrName appEName
infixApp_RDR = nameRdrName infixAppName
-- data Lit = ...
stringL_RDR, intPrimL_RDR, wordPrimL_RDR, floatPrimL_RDR,
doublePrimL_RDR, stringPrimL_RDR, charPrimL_RDR :: RdrName
stringL_RDR = nameRdrName stringLName
intPrimL_RDR = nameRdrName intPrimLName
wordPrimL_RDR = nameRdrName wordPrimLName
floatPrimL_RDR = nameRdrName floatPrimLName
doublePrimL_RDR = nameRdrName doublePrimLName
stringPrimL_RDR = nameRdrName stringPrimLName
charPrimL_RDR = nameRdrName charPrimLName
......@@ -1929,6 +1929,14 @@ primop UnsafeFreezeByteArrayOp "unsafeFreezeByteArray#" GenPrimOp
with
has_side_effects = True
primop UnsafeThawByteArrayOp "unsafeThawByteArray#" GenPrimOp
ByteArray# -> State# s -> (# State# s, MutableByteArray# s #)
{Make an immutable byte array mutable, without copying.
@since 0.12.0.0}
with
has_side_effects = True
primop SizeofByteArrayOp "sizeofByteArray#" GenPrimOp
ByteArray# -> Int#
{Return the size of the array in bytes.}
......
......@@ -245,6 +245,10 @@ pprGNUSectionHeader config t suffix =
OtherSection _ ->
panic "PprBase.pprGNUSectionHeader: unknown section type"
flags = case t of
Text
| OSMinGW32 <- platformOS platform
-> text ",\"xr\""
| otherwise -> text ",\"ax\"," <> sectionType platform "progbits"
CString
| OSMinGW32 <- platformOS platform
-> empty
......
......@@ -451,7 +451,7 @@ TL;DR: we relaxed the let/app invariant to become the let-can-float invariant.
Note [Core top-level string literals]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As an exception to the usual rule that top-level binders must be lifted,
we allow binding primitive string literals (of type Addr#) of type Addr# at the
we allow binding primitive string literals (of type Addr#) at the
top level. This allows us to share string literals earlier in the pipeline and
crucially allows other optimizations in the Core2Core pipeline to fire.
Consider,
......@@ -629,7 +629,7 @@ Note [Representation polymorphism invariants]
GHC allows us to abstract over calling conventions using **representation polymorphism**.
For example, we have:
($) :: forall (r :: RuntimeRep) (a :: Type) (b :: TYPE r). a -> b -> b
($) :: forall (r :: RuntimeRep) (a :: Type) (b :: TYPE r). (a -> b) -> a -> b
In this example, the type `b` is representation-polymorphic: it has kind `TYPE r`,
where the type variable `r :: RuntimeRep` abstracts over the runtime representation
......@@ -662,14 +662,14 @@ Note that these two invariants require us to check other types than just the
types of bound variables and types of function arguments, due to transformations
that GHC performs. For example, the definition
myCoerce :: forall {r1 r2} (a :: TYPE r1) (b :: TYPE r2). Coercible a b => a -> b
myCoerce :: forall {r} (a :: TYPE r) (b :: TYPE r). Coercible a b => a -> b
myCoerce = coerce
is invalid, because `coerce` has no binding (see GHC.Types.Id.Make.coerceId).
So, before code-generation, GHC saturates the RHS of 'myCoerce' by performing
an eta-expansion (see GHC.CoreToStg.Prep.maybeSaturate):
myCoerce = \ (x :: TYPE r1) -> coerce x
myCoerce = \ (x :: TYPE r) -> coerce x
However, this transformation would be invalid, because now the binding of x
in the lambda abstraction would violate I1.
......
......@@ -888,9 +888,6 @@ So we must add the template vars to the in-scope set before starting;
see `init_menv` in `matchN`.
-}
rvInScopeEnv :: RuleMatchEnv -> InScopeEnv
rvInScopeEnv renv = ISE (rnInScopeSet (rv_lcl renv)) (rv_unf renv)
-- * The domain of the TvSubstEnv and IdSubstEnv are the template
-- variables passed into the match.
--
......@@ -1271,7 +1268,16 @@ match renv subst e1 (Let bind e2) mco
------------------------ Lambdas ---------------------
match renv subst (Lam x1 e1) e2 mco
| Just (x2, e2', ts) <- exprIsLambda_maybe (rvInScopeEnv renv) (mkCastMCo e2 mco)
| let casted_e2 = mkCastMCo e2 mco
in_scope = extendInScopeSetSet (rnInScopeSet (rv_lcl renv))
(exprFreeVars casted_e2)
in_scope_env = ISE in_scope (rv_unf renv)
-- extendInScopeSetSet: The InScopeSet of rn_env is not necessarily
-- a superset of the free vars of e2; it is only guaranteed a superset of
-- applyng the (rnEnvR rn_env) substitution to e2. But exprIsLambda_maybe
-- wants an in-scope set that includes all the free vars of its argument.
-- Hence adding adding (exprFreeVars casted_e2) to the in-scope set (#23630)
, Just (x2, e2', ts) <- exprIsLambda_maybe in_scope_env casted_e2
-- See Note [Lambdas in the template]
= let renv' = rnMatchBndr2 renv x1 x2
subst' = subst { rs_binds = rs_binds subst . flip (foldr mkTick) ts }
......
......@@ -828,7 +828,7 @@ runtimeRepLevity_maybe rep
-- Splitting Levity
--------------------------------------------
-- | `levity_maybe` takes a Type of kind Levity, and returns its levity
-- | `levityType_maybe` takes a Type of kind Levity, and returns its levity
-- May not be possible for a type variable or type family application
levityType_maybe :: LevityType -> Maybe Levity
levityType_maybe lev
......
......@@ -58,7 +58,6 @@ import GHC.Builtin.Types.Prim
import GHC.Builtin.Names
import GHC.Data.FastString
import GHC.Data.Pair
import GHC.Data.Maybe
import GHC.Utils.Outputable
......@@ -83,7 +82,7 @@ dsJsFExport
dsJsFExport fn_id co ext_name cconv isDyn = do
let
ty = pSnd $ coercionKind co
ty = coercionRKind co
(_tvs,sans_foralls) = tcSplitForAllTyVars ty
(fe_arg_tys', orig_res_ty) = tcSplitFunTys sans_foralls
-- We must use tcSplits here, because we want to see
......@@ -242,7 +241,7 @@ dsJsImport
-> Maybe Header
-> DsM ([Binding], CHeader, CStub)
dsJsImport id co (CLabel cid) cconv _ _ = do
let ty = pFst $ coercionKind co
let ty = coercionLKind co
fod = case tyConAppTyCon_maybe (dropForAlls ty) of
Just tycon
| tyConUnique tycon == funPtrTyConKey ->
......@@ -272,7 +271,7 @@ dsJsFExportDynamic :: Id
-> DsM ([Binding], CHeader, CStub)
dsJsFExportDynamic id co0 cconv = do
let
ty = pFst (coercionKind co0)
ty = coercionLKind co0
(tvs,sans_foralls) = tcSplitForAllTyVars ty
([Scaled arg_mult arg_ty], fn_res_ty) = tcSplitFunTys sans_foralls
(io_tc, res_ty) = expectJust "dsJsFExportDynamic: IO type expected"
......@@ -342,7 +341,7 @@ dsJsCall :: Id -> Coercion -> ForeignCall -> Maybe Header
-> DsM ([(Id, Expr TyVar)], CHeader, CStub)
dsJsCall fn_id co (CCall (CCallSpec target cconv safety)) _mDeclHeader = do
let
ty = pFst $ coercionKind co
ty = coercionLKind co
(tv_bndrs, rho) = tcSplitForAllTyVarBinders ty
(arg_tys, io_res_ty) = tcSplitFunTys rho
......
......@@ -751,7 +751,7 @@ TH_QQUASIQUOTE { L _ (ITqQuasiQuote _) }
-- Exported parsers
%name parseModuleNoHaddock module
%name parseSignature signature
%name parseSignatureNoHaddock signature
%name parseImport importdecl
%name parseStatement e_stmt
%name parseDeclaration topdecl
......@@ -4416,18 +4416,29 @@ pvL :: MonadP m => m (LocatedAn t a) -> m (Located a)
pvL a = do { av <- a
; return (reLoc av) }
-- | Parse a Haskell module with Haddock comments.
-- This is done in two steps:
-- | Parse a Haskell module with Haddock comments. This is done in two steps:
--
-- * 'parseModuleNoHaddock' to build the AST
-- * 'addHaddockToModule' to insert Haddock comments into it
--
-- This is the only parser entry point that deals with Haddock comments.
-- The other entry points ('parseDeclaration', 'parseExpression', etc) do
-- not insert them into the AST.
-- This and the signature module parser are the only parser entry points that
-- deal with Haddock comments. The other entry points ('parseDeclaration',
-- 'parseExpression', etc) do not insert them into the AST.
parseModule :: P (Located (HsModule GhcPs))
parseModule = parseModuleNoHaddock >>= addHaddockToModule
-- | Parse a Haskell signature module with Haddock comments. This is done in two
-- steps:
--
-- * 'parseSignatureNoHaddock' to build the AST
-- * 'addHaddockToModule' to insert Haddock comments into it
--
-- This and the module parser are the only parser entry points that deal with
-- Haddock comments. The other entry points ('parseDeclaration',
-- 'parseExpression', etc) do not insert them into the AST.
parseSignature :: P (Located (HsModule GhcPs))
parseSignature = parseSignatureNoHaddock >>= addHaddockToModule
commentsA :: (Monoid ann) => SrcSpan -> EpAnnComments -> SrcSpanAnn' (EpAnn ann)
commentsA loc cs = SrcSpanAnn (EpAnn (Anchor (rs loc) UnchangedAnchor) mempty cs) loc
......
......@@ -39,6 +39,7 @@ import GHC.Rename.Names
import GHC.Tc.Errors.Types
import GHC.Tc.Gen.Annotation ( annCtxt )
import GHC.Tc.Utils.Monad
import GHC.Tc.Types.Origin ( TypedThing(..) )
import GHC.Types.ForeignCall ( CCallTarget(..) )
import GHC.Unit
......@@ -574,10 +575,13 @@ rnClsInstDecl (ClsInstDecl { cid_poly_ty = inst_ty, cid_binds = mbinds
-- class type constructor...
eith_cls = case hsTyGetAppHead_maybe head_ty' of
Just (L _ cls) -> Right cls
Nothing -> Left
( getLocA head_ty'
, TcRnIllegalInstanceHeadDecl head_ty'
)
Nothing ->
Left
( getLocA head_ty'
, TcRnIllegalInstance $
IllegalClassInstance (HsTypeRnThing $ unLoc head_ty') $
IllegalInstanceHead $ InstHeadNonClass Nothing
)
-- ...finally, attempt to retrieve the class type constructor, failing
-- with an error message if there isn't one. To avoid excessive
-- amounts of error messages, we will only report one of the errors
......@@ -721,7 +725,9 @@ rnFamEqn doc atfi
&& not (cls_tkv `elemNameSet` pat_fvs)
-- ...but not bound on the LHS.
bad_tvs = filter improperly_scoped inst_head_tvs
; unless (null bad_tvs) (addErr (TcRnBadAssocRhs bad_tvs))
; unless (null bad_tvs) $ addErr $
TcRnIllegalInstance $ IllegalFamilyInstance $
FamInstRHSOutOfScopeTyVars Nothing bad_tvs
; let eqn_fvs = rhs_fvs `plusFV` pat_fvs
-- See Note [Type family equations and occurrences]
......
......@@ -371,6 +371,10 @@ emitPrimOp cfg primop =
UnsafeFreezeByteArrayOp -> \[arg] -> opIntoRegs $ \[res] ->
emitAssign (CmmLocal res) arg
-- #define unsafeThawByteArrayzh(r,a) r=(a)
UnsafeThawByteArrayOp -> \[arg] -> opIntoRegs $ \[res] ->
emitAssign (CmmLocal res) arg
-- Reading/writing pointer arrays
ReadArrayOp -> \[obj, ix] -> opIntoRegs $ \[res] ->
......
......@@ -652,6 +652,7 @@ genPrim prof bound ty op = case op of
ShrinkMutableByteArrayOp_Char -> \[] [a,n] -> PrimInline $ appS "h$shrinkMutableByteArray" [a,n]
ResizeMutableByteArrayOp_Char -> \[r] [a,n] -> PrimInline $ r |= app "h$resizeMutableByteArray" [a,n]
UnsafeFreezeByteArrayOp -> \[a] [b] -> PrimInline $ a |= b
UnsafeThawByteArrayOp -> \[a] [b] -> PrimInline $ a |= b
SizeofByteArrayOp -> \[r] [a] -> PrimInline $ r |= a .^ "len"
SizeofMutableByteArrayOp -> \[r] [a] -> PrimInline $ r |= a .^ "len"
GetSizeofMutableByteArrayOp -> \[r] [a] -> PrimInline $ r |= a .^ "len"
......
......@@ -34,7 +34,7 @@ module GHC.Tc.Deriv.Generate (
gen_Newtype_fam_insts,
mkCoerceClassMethEqn,
genAuxBinds,
ordOpTbl, boxConTbl, litConTbl,
ordOpTbl, boxConTbl,
mkRdrFunBind, mkRdrFunBindEC, mkRdrFunBindSE, error_Expr,
getPossibleDataCons,
......@@ -2363,7 +2363,7 @@ box :: String -- The class involved
-> Type -- The argument type
-> LHsExpr GhcPs -- Boxed version of the arg
-- See Note [Deriving and unboxed types] in GHC.Tc.Deriv.Infer
box cls_str arg arg_ty = assoc_ty_id cls_str boxConTbl arg_ty arg
box cls_str arg arg_ty = nlHsApp (assoc_ty_id cls_str boxConTbl arg_ty) arg
---------------------
primOrdOps :: String -- The class involved
......@@ -2403,23 +2403,22 @@ ordOpTbl
,(doublePrimTy, (ltDouble_RDR, leDouble_RDR
, eqDouble_RDR, geDouble_RDR, gtDouble_RDR)) ]
-- A mapping from a primitive type to a function that constructs its boxed
-- version.
boxConTbl :: [(Type, LHsExpr GhcPs -> LHsExpr GhcPs)]
-- A mapping from a primitive type to a DataCon of its boxed version.
boxConTbl :: [(Type, LHsExpr GhcPs)]
boxConTbl =
[ (charPrimTy , nlHsApp (nlHsVar $ getRdrName charDataCon))
, (intPrimTy , nlHsApp (nlHsVar $ getRdrName intDataCon))
, (wordPrimTy , nlHsApp (nlHsVar $ getRdrName wordDataCon ))
, (floatPrimTy , nlHsApp (nlHsVar $ getRdrName floatDataCon ))
, (doublePrimTy, nlHsApp (nlHsVar $ getRdrName doubleDataCon))
, (int8PrimTy, nlHsApp (nlHsVar int8DataCon_RDR))
, (word8PrimTy, nlHsApp (nlHsVar word8DataCon_RDR))
, (int16PrimTy, nlHsApp (nlHsVar int16DataCon_RDR))
, (word16PrimTy, nlHsApp (nlHsVar word16DataCon_RDR))
, (int32PrimTy, nlHsApp (nlHsVar int32DataCon_RDR))
, (word32PrimTy, nlHsApp (nlHsVar word32DataCon_RDR))
, (int64PrimTy, nlHsApp (nlHsVar int64DataCon_RDR))
, (word64PrimTy, nlHsApp (nlHsVar word64DataCon_RDR))
[ (charPrimTy , nlHsVar $ getRdrName charDataCon)
, (intPrimTy , nlHsVar $ getRdrName intDataCon)
, (wordPrimTy , nlHsVar $ getRdrName wordDataCon)
, (floatPrimTy , nlHsVar $ getRdrName floatDataCon)
, (doublePrimTy, nlHsVar $ getRdrName doubleDataCon)
, (int8PrimTy, nlHsVar int8DataCon_RDR)
, (word8PrimTy, nlHsVar word8DataCon_RDR)
, (int16PrimTy, nlHsVar int16DataCon_RDR)
, (word16PrimTy, nlHsVar word16DataCon_RDR)
, (int32PrimTy, nlHsVar int32DataCon_RDR)
, (word32PrimTy, nlHsVar word32DataCon_RDR)
, (int64PrimTy, nlHsVar int64DataCon_RDR)
, (word64PrimTy, nlHsVar word64DataCon_RDR)
]
......@@ -2443,26 +2442,6 @@ postfixModTbl
,(word64PrimTy, "#Word64")
]
litConTbl :: [(Type, LHsExpr GhcPs -> LHsExpr GhcPs)]
litConTbl
= [(charPrimTy , nlHsApp (nlHsVar charPrimL_RDR))
,(intPrimTy , nlHsApp (nlHsVar intPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(wordPrimTy , nlHsApp (nlHsVar wordPrimL_RDR)
. nlHsApp (nlHsVar toInteger_RDR))
,(addrPrimTy , nlHsApp (nlHsVar stringPrimL_RDR)
. nlHsApp (nlHsApp
(nlHsVar map_RDR)
(compose_RDR `nlHsApps`
[ nlHsVar fromIntegral_RDR
, nlHsVar fromEnum_RDR
])))
,(floatPrimTy , nlHsApp (nlHsVar floatPrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
,(doublePrimTy, nlHsApp (nlHsVar doublePrimL_RDR)
. nlHsApp (nlHsVar toRational_RDR))
]
-- | Lookup `Type` in an association list.
assoc_ty_id :: HasCallStack => String -- The class involved
-> [(Type,a)] -- The table
......
......@@ -56,6 +56,7 @@ import GHC.Core.PatSyn ( patSynName, pprPatSynType )
import GHC.Core.Predicate
import GHC.Core.Type
import GHC.Core.FVs( orphNamesOfTypes )
import GHC.CoreToIface
import GHC.Driver.Flags
import GHC.Driver.Backend
......@@ -91,7 +92,7 @@ import GHC.Types.Fixity (defaultFixity)
import GHC.Iface.Errors.Types
import GHC.Iface.Errors.Ppr
import GHC.Iface.Syntax ( ShowSub(..), ShowForAllFlag(..), showToHeader )
import GHC.Iface.Syntax
import GHC.Unit.State
import GHC.Unit.Module
......@@ -140,9 +141,14 @@ instance Diagnostic TcRnMessage where
(diagnosticMessage opts msg)
TcRnWithHsDocContext ctxt msg
-> messageWithHsDocContext opts ctxt (diagnosticMessage opts msg)
TcRnSolverReport msg _ _
-> mkSimpleDecorated $ pprSolverReportWithCtxt msg
TcRnSolverDepthError ty depth -> mkSimpleDecorated msg
where
msg =
vcat [ text "Reduction stack overflow; size =" <+> ppr depth
, hang (text "When simplifying the following type:")
2 (ppr ty) ]
TcRnRedundantConstraints redundants (info, show_info)
-> mkSimpleDecorated $
text "Redundant constraint" <> plural redundants <> colon
......@@ -385,13 +391,6 @@ instance Diagnostic TcRnMessage where
2 (ppr sig)
TcRnTupleConstraintInst _
-> mkSimpleDecorated $ text "You can't specify an instance for a tuple constraint"
TcRnAbstractClassInst clas
-> mkSimpleDecorated $
text "Cannot define instance for abstract class" <+>
quotes (ppr (className clas))
TcRnNoClassInstHead tau
-> mkSimpleDecorated $
hang (text "Instance head is not headed by a class:") 2 (pprType tau)
TcRnUserTypeError ty
-> mkSimpleDecorated (pprUserTypeErrorTy ty)
TcRnConstraintInKind ty
......@@ -433,11 +432,8 @@ instance Diagnostic TcRnMessage where
n_arguments | thing_arity == 0 = text "no arguments"
| thing_arity == 1 = text "1 argument"
| True = hsep [int thing_arity, text "arguments"]
TcRnIllegalInstanceDecl cls tys reason
-> mkSimpleDecorated $
hang (hang (text "Illegal instance declaration for")
2 (quotes (pprClassPred cls tys)) <> colon)
2 (pprIllegalInstanceReason cls tys reason)
TcRnIllegalInstance reason ->
mkSimpleDecorated $ pprIllegalInstance reason
TcRnVDQInTermType mb_ty
-> mkSimpleDecorated $ vcat
[ case mb_ty of
......@@ -465,18 +461,10 @@ instance Diagnostic TcRnMessage where
TcRnIllegalConstraintSynonymOfKind kind
-> mkSimpleDecorated $
text "Illegal constraint synonym of kind:" <+> quotes (pprKind kind)
TcRnIllegalClassInst tcf
-> mkSimpleDecorated $
vcat [ text "Illegal instance for a" <+> ppr tcf
, text "A class instance must be for a class" ]
TcRnOversaturatedVisibleKindArg ty
-> mkSimpleDecorated $
text "Illegal oversaturated visible kind argument:" <+>
quotes (char '@' <> pprParendType ty)
TcRnBadAssociatedType clas tc
-> mkSimpleDecorated $
hsep [ text "Class", quotes (ppr clas)
, text "does not have an associated type", quotes (ppr tc) ]
TcRnForAllRankErr rank ty
-> let herald = case tcSplitForAllTyVars ty of
([], _) -> text "Illegal qualified type:"
......@@ -790,18 +778,6 @@ instance Diagnostic TcRnMessage where
TcRnArrowProcGADTPattern
-> mkSimpleDecorated $
text "Proc patterns cannot use existential or GADT data constructors"
TcRnSpecialClassInst cls because_safeHaskell
-> mkSimpleDecorated $
text "Class" <+> quotes (ppr $ className cls)
<+> text "does not support user-specified instances"
<> safeHaskell_msg
where
safeHaskell_msg
| because_safeHaskell
= text " when Safe Haskell is enabled."
| otherwise
= dot
TcRnForallIdentifier rdr_name
-> mkSimpleDecorated $
fsep [ text "The use of" <+> quotes (ppr rdr_name)
......@@ -1163,11 +1139,6 @@ instance Diagnostic TcRnMessage where
-> mkSimpleDecorated $
hsep [text "Class", quotes (ppr badMethodErrClassName),
text "does not have a method", quotes (ppr badMethodErrMethodName)]
TcRnNoExplicitAssocTypeOrDefaultDeclaration name
-> mkSimpleDecorated $
text "No explicit" <+> text "associated type"
<+> text "or default declaration for"
<+> quotes (ppr name)
TcRnIllegalTypeData
-> mkSimpleDecorated $
text "Illegal type-level data declaration"
......@@ -1218,17 +1189,6 @@ instance Diagnostic TcRnMessage where
2 (hang (pprPrefixName name)
2 (dcolon <+> ppr hs_ty))
]
TcRnIllegalFamilyInstance tycon
-> mkSimpleDecorated $
vcat [ text "Illegal family instance for" <+> quotes (ppr tycon)
, nest 2 $ parens (ppr tycon <+> text "is not an indexed type family")]
TcRnMissingClassAssoc name
-> mkSimpleDecorated $
text "Associated type" <+> quotes (ppr name) <+>
text "must be inside a class instance"
TcRnNotOpenFamily tc
-> mkSimpleDecorated $
text "Illegal instance for closed family" <+> quotes (ppr tc)
TcRnNoRebindableSyntaxRecordDot -> mkSimpleDecorated $
text "RebindableSyntax is required if OverloadedRecordUpdate is enabled."
TcRnNoFieldPunsRecordDot -> mkSimpleDecorated $
......@@ -1359,14 +1319,6 @@ instance Diagnostic TcRnMessage where
= vcat [ text "Starting from GHC 9.10, this warning will turn into an error." ]
user_manual =
vcat [ text "See the user manual, § Undecidable instances and loopy superclasses." ]
TcRnIllegalInstanceHeadDecl head_ty -> mkSimpleDecorated $
hang (text "Illegal head of an instance declaration:"
<+> quotes (ppr head_ty))
2 (vcat [ text "Instance heads must be of the form"
, nest 2 $ text "C ty_1 ... ty_n"
, text "where" <+> quotes (char 'C')
<+> text "is a class"
])
TcRnUnexpectedStandaloneDerivingDecl -> mkSimpleDecorated $
text "Illegal standalone deriving declaration"
TcRnUnusedVariableInRuleDecl name var -> mkSimpleDecorated $
......@@ -1385,11 +1337,6 @@ instance Diagnostic TcRnMessage where
err = case errReason of
UnboundVariable uv nis -> pprScopeError uv nis
IllegalExpression -> text "Illegal expression:" <+> ppr bad_e
TcRnBadAssocRhs ns -> mkSimpleDecorated $
hang (text "The RHS of an associated type declaration mentions"
<+> text "out-of-scope variable" <> plural ns
<+> pprWithCommas (quotes . ppr) ns)
2 (text "All such variables must be bound on the LHS")
TcRnDuplicateRoleAnnot list -> mkSimpleDecorated $
hang (text "Duplicate role annotations for" <+>
quotes (ppr $ roleAnnotDeclName first_decl) <> colon)
......@@ -1506,9 +1453,6 @@ instance Diagnostic TcRnMessage where
<+> quotes (ppr ps_name) <> colon)
2 (pprPatSynInvalidRhsReason reason)
, text "RHS pattern:" <+> ppr lpat ]
TcRnMultiAssocTyFamDefaults name -> mkSimpleDecorated $
text "More than one default declaration for"
<+> ppr name
TcRnTyFamDepsDisabled -> mkSimpleDecorated $
text "Illegal injectivity annotation"
TcRnAbstractClosedTyFamDecl -> mkSimpleDecorated $
......@@ -1538,6 +1482,46 @@ instance Diagnostic TcRnMessage where
(sort, name) = case reason of
TyFamsDisabledFamily n -> ("declaration", ppr n)
TyFamsDisabledInstance n -> ("instance", ppr n)
TcRnBadTyConTelescope tc -> mkSimpleDecorated $
vcat [ hang (text "The kind of" <+> quotes (ppr tc) <+> text "is ill-scoped")
2 pp_tc_kind
, extra
, hang (text "Perhaps try this order instead:")
2 (pprTyVars sorted_tvs) ]
where
pp_tc_kind = text "Inferred kind:" <+> ppr tc <+> dcolon <+> ppr_untidy (tyConKind tc)
ppr_untidy ty = pprIfaceType (toIfaceType ty)
-- We need ppr_untidy here because pprType will tidy the type, which
-- will turn the bogus kind we are trying to report
-- T :: forall (a::k) k (b::k) -> blah
-- into a misleadingly sanitised version
-- T :: forall (a::k) k1 (b::k1) -> blah
tcbs = tyConBinders tc
tvs = binderVars tcbs
sorted_tvs = scopedSort tvs
inferred_tvs = [ binderVar tcb
| tcb <- tcbs, Inferred == tyConBinderForAllTyFlag tcb ]
specified_tvs = [ binderVar tcb
| tcb <- tcbs, Specified == tyConBinderForAllTyFlag tcb ]
extra
| null inferred_tvs && null specified_tvs
= empty
| null inferred_tvs
= hang (text "NB: Specified variables")
2 (sep [pp_spec, text "always come first"])
| null specified_tvs
= hang (text "NB: Inferred variables")
2 (sep [pp_inf, text "always come first"])
| otherwise
= hang (text "NB: Inferred variables")
2 (vcat [ sep [ pp_inf, text "always come first"]
, sep [text "then Specified variables", pp_spec]])
pp_inf = parens (text "namely:" <+> pprTyVars inferred_tvs)
pp_spec = parens (text "namely:" <+> pprTyVars specified_tvs)
TcRnTyFamResultDisabled tc_name tvb -> mkSimpleDecorated $
text "Illegal result type variable" <+> ppr tvb <+> text "for" <+> quotes (ppr tc_name)
TcRnRoleValidationFailed role reason -> mkSimpleDecorated $
......@@ -1553,10 +1537,6 @@ instance Diagnostic TcRnMessage where
text "give different types for field", quotes (ppr field_name)]
TcRnClassExtensionDisabled cls reason -> mkSimpleDecorated $
pprDisabledClassExtension cls reason
TcRnAssocNoClassTyVar cls fam_tc -> mkSimpleDecorated $
sep [ text "The associated type" <+> quotes (ppr fam_tc <+> hsep (map ppr (tyConTyVars fam_tc)))
, text "mentions none of the type or kind variables of the class" <+>
quotes (ppr cls <+> hsep (map ppr (classTyVars cls)))]
TcRnDataConParentTypeMismatch data_con res_ty_tmpl -> mkSimpleDecorated $
hang (text "Data constructor" <+> quotes (ppr data_con) <+>
text "returns type" <+> quotes (ppr actual_res_ty))
......@@ -1581,16 +1561,6 @@ instance Diagnostic TcRnMessage where
with_sig (tc_name, ksig) = ppr tc_name <+> dcolon <+> ppr ksig
TcRnEmptyDataDeclsDisabled tycon -> mkSimpleDecorated $
quotes (ppr tycon) <+> text "has no constructors"
TcRnFamilyCategoryMismatch family -> mkSimpleDecorated $
text "Wrong category of family instance; declaration was for a"
<+> kindOfFamily
where
kindOfFamily | isTypeFamilyTyCon family = text "type family"
| isDataFamilyTyCon family = text "data family"
| otherwise = pprPanic "wrongKindOfFamily" (ppr family)
TcRnFamilyArityMismatch _ max_args -> mkSimpleDecorated $
text "Number of parameters must match family declaration; expected"
<+> ppr max_args
TcRnRoleMismatch var annot inferred -> mkSimpleDecorated $
hang (text "Role mismatch on variable" <+> ppr var <> colon)
2 (sep [ text "Annotation says", ppr annot
......@@ -1609,11 +1579,6 @@ instance Diagnostic TcRnMessage where
TcRnIncoherentRoles _ -> mkSimpleDecorated $
(text "Roles other than" <+> quotes (text "nominal") <+>
text "for class parameters can lead to incoherence.")
TcRnTyFamNameMismatch fam_tc_name eqn_tc_name -> mkSimpleDecorated $
hang (text "Mismatched type name in type family instance.")
2 (vcat [ text "Expected:" <+> ppr fam_tc_name
, text " Actual:" <+> ppr eqn_tc_name ])
TcRnUnexpectedKindVar tv_name
-> mkSimpleDecorated $ text "Unexpected kind variable" <+> quotes (ppr tv_name)
......@@ -1869,6 +1834,8 @@ instance Diagnostic TcRnMessage where
-> diagnosticReason msg
TcRnSolverReport _ reason _
-> reason -- Error, or a Warning if we are deferring type errors
TcRnSolverDepthError {}
-> ErrorWithoutFlag
TcRnRedundantConstraints {}
-> WarningWithFlag Opt_WarnRedundantConstraints
TcRnInaccessibleCode {}
......@@ -1957,10 +1924,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnTupleConstraintInst{}
-> ErrorWithoutFlag
TcRnAbstractClassInst{}
-> ErrorWithoutFlag
TcRnNoClassInstHead{}
-> ErrorWithoutFlag
TcRnUserTypeError{}
-> ErrorWithoutFlag
TcRnConstraintInKind{}
......@@ -1975,8 +1938,8 @@ instance Diagnostic TcRnMessage where
-> WarningWithFlag Opt_WarnSimplifiableClassConstraints
TcRnArityMismatch{}
-> ErrorWithoutFlag
TcRnIllegalInstanceDecl{}
-> ErrorWithoutFlag
TcRnIllegalInstance rea
-> illegalInstanceReason rea
TcRnVDQInTermType{}
-> ErrorWithoutFlag
TcRnBadQuantPredHead{}
......@@ -1989,12 +1952,8 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnIllegalConstraintSynonymOfKind{}
-> ErrorWithoutFlag
TcRnIllegalClassInst{}
-> ErrorWithoutFlag
TcRnOversaturatedVisibleKindArg{}
-> ErrorWithoutFlag
TcRnBadAssociatedType{}
-> ErrorWithoutFlag
TcRnForAllRankErr{}
-> ErrorWithoutFlag
TcRnMonomorphicBindings{}
......@@ -2098,8 +2057,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnArrowProcGADTPattern
-> ErrorWithoutFlag
TcRnSpecialClassInst {}
-> ErrorWithoutFlag
TcRnForallIdentifier {}
-> WarningWithFlag Opt_WarnForallIdentifier
TcRnTypeEqualityOutOfScope
......@@ -2206,8 +2163,6 @@ instance Diagnostic TcRnMessage where
-> WarningWithoutFlag
TcRnBadMethodErr{}
-> ErrorWithoutFlag
TcRnNoExplicitAssocTypeOrDefaultDeclaration{}
-> WarningWithFlag (Opt_WarnMissingMethods)
TcRnIllegalTypeData
-> ErrorWithoutFlag
TcRnIllegalQuasiQuotes{}
......@@ -2222,12 +2177,6 @@ instance Diagnostic TcRnMessage where
-> WarningWithFlag (Opt_WarnMissingMethods)
TcRnMisplacedInstSig{}
-> ErrorWithoutFlag
TcRnIllegalFamilyInstance{}
-> ErrorWithoutFlag
TcRnMissingClassAssoc{}
-> ErrorWithoutFlag
TcRnNotOpenFamily{}
-> ErrorWithoutFlag
TcRnNoRebindableSyntaxRecordDot{}
-> ErrorWithoutFlag
TcRnNoFieldPunsRecordDot{}
......@@ -2272,8 +2221,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnLoopySuperclassSolve{}
-> WarningWithFlag Opt_WarnLoopySuperclassSolve
TcRnIllegalInstanceHeadDecl{}
-> ErrorWithoutFlag
TcRnUnexpectedStandaloneDerivingDecl{}
-> ErrorWithoutFlag
TcRnUnusedVariableInRuleDecl{}
......@@ -2282,8 +2229,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnIllegalRuleLhs{}
-> ErrorWithoutFlag
TcRnBadAssocRhs{}
-> ErrorWithoutFlag
TcRnDuplicateRoleAnnot{}
-> ErrorWithoutFlag
TcRnDuplicateKindSig{}
......@@ -2322,8 +2267,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnPatSynInvalidRhs{}
-> ErrorWithoutFlag
TcRnMultiAssocTyFamDefaults{}
-> ErrorWithoutFlag
TcRnTyFamDepsDisabled{}
-> ErrorWithoutFlag
TcRnAbstractClosedTyFamDecl{}
......@@ -2340,6 +2283,8 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnTyFamsDisabled{}
-> ErrorWithoutFlag
TcRnBadTyConTelescope {}
-> ErrorWithoutFlag
TcRnTyFamResultDisabled{}
-> ErrorWithoutFlag
TcRnRoleValidationFailed{}
......@@ -2350,8 +2295,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnClassExtensionDisabled{}
-> ErrorWithoutFlag
TcRnAssocNoClassTyVar{}
-> ErrorWithoutFlag
TcRnDataConParentTypeMismatch{}
-> ErrorWithoutFlag
TcRnGADTsDisabled{}
......@@ -2366,10 +2309,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnEmptyDataDeclsDisabled{}
-> ErrorWithoutFlag
TcRnFamilyCategoryMismatch{}
-> ErrorWithoutFlag
TcRnFamilyArityMismatch{}
-> ErrorWithoutFlag
TcRnRoleMismatch{}
-> ErrorWithoutFlag
TcRnRoleCountMismatch{}
......@@ -2380,8 +2319,6 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnIncoherentRoles{}
-> ErrorWithoutFlag
TcRnTyFamNameMismatch{}
-> ErrorWithoutFlag
TcRnUnexpectedKindVar{}
-> ErrorWithoutFlag
TcRnNegativeNumTypeLiteral{}
......@@ -2492,6 +2429,8 @@ instance Diagnostic TcRnMessage where
-> diagnosticHints msg
TcRnSolverReport _ _ hints
-> hints
TcRnSolverDepthError {}
-> [SuggestIncreaseReductionDepth]
TcRnRedundantConstraints{}
-> noHints
TcRnInaccessibleCode{}
......@@ -2588,10 +2527,6 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnTupleConstraintInst{}
-> noHints
TcRnAbstractClassInst{}
-> noHints
TcRnNoClassInstHead{}
-> noHints
TcRnUserTypeError{}
-> noHints
TcRnConstraintInKind{}
......@@ -2614,12 +2549,8 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnIllegalConstraintSynonymOfKind{}
-> [suggestExtension LangExt.ConstraintKinds]
TcRnIllegalClassInst{}
-> noHints
TcRnOversaturatedVisibleKindArg{}
-> noHints
TcRnBadAssociatedType{}
-> noHints
TcRnForAllRankErr rank _
-> case rank of
LimitedRank{} -> [suggestExtension LangExt.RankNTypes]
......@@ -2632,8 +2563,8 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnArityMismatch{}
-> noHints
TcRnIllegalInstanceDecl _ _ reason
-> illegalInstanceHints reason
TcRnIllegalInstance rea
-> illegalInstanceHints rea
TcRnMonomorphicBindings bindings
-> case bindings of
[] -> noHints
......@@ -2727,8 +2658,6 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnArrowProcGADTPattern
-> noHints
TcRnSpecialClassInst {}
-> noHints
TcRnForallIdentifier {}
-> [SuggestRenameForall]
TcRnTypeEqualityOutOfScope
......@@ -2852,8 +2781,6 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnBadMethodErr{}
-> noHints
TcRnNoExplicitAssocTypeOrDefaultDeclaration{}
-> noHints
TcRnIllegalTypeData
-> [suggestExtension LangExt.TypeData]
TcRnTypeDataForbids{}
......@@ -2864,12 +2791,6 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnMisplacedInstSig{}
-> [suggestExtension LangExt.InstanceSigs]
TcRnIllegalFamilyInstance{}
-> noHints
TcRnMissingClassAssoc{}
-> noHints
TcRnNotOpenFamily{}
-> noHints
TcRnNoRebindableSyntaxRecordDot{}
-> noHints
TcRnNoFieldPunsRecordDot{}
......@@ -2924,8 +2845,6 @@ instance Diagnostic TcRnMessage where
cls_or_qc = case ctLocOrigin wtd_loc of
ScOrigin c_or_q _ -> c_or_q
_ -> IsClsInst -- shouldn't happen
TcRnIllegalInstanceHeadDecl{}
-> noHints
TcRnUnexpectedStandaloneDerivingDecl{}
-> [suggestExtension LangExt.StandaloneDeriving]
TcRnUnusedVariableInRuleDecl{}
......@@ -2934,8 +2853,6 @@ instance Diagnostic TcRnMessage where
-> [suggestExtension LangExt.StandaloneKindSignatures]
TcRnIllegalRuleLhs{}
-> noHints
TcRnBadAssocRhs{}
-> noHints
TcRnDuplicateRoleAnnot{}
-> noHints
TcRnDuplicateKindSig{}
......@@ -2978,8 +2895,6 @@ instance Diagnostic TcRnMessage where
-> [SuggestExplicitBidiPatSyn name pat args]
TcRnPatSynInvalidRhs{}
-> noHints
TcRnMultiAssocTyFamDefaults{}
-> noHints
TcRnTyFamDepsDisabled{}
-> [suggestExtension LangExt.TypeFamilyDependencies]
TcRnAbstractClosedTyFamDecl{}
......@@ -2996,6 +2911,8 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnTyFamsDisabled{}
-> [suggestExtension LangExt.TypeFamilies]
TcRnBadTyConTelescope{}
-> noHints
TcRnTyFamResultDisabled{}
-> [suggestExtension LangExt.TypeFamilyDependencies]
TcRnRoleValidationFailed{}
......@@ -3010,8 +2927,6 @@ instance Diagnostic TcRnMessage where
-> [suggestExtension LangExt.FunctionalDependencies]
TcRnClassExtensionDisabled _ ConstrainedClassMethodsDisabled{}
-> [suggestExtension LangExt.ConstrainedClassMethods]
TcRnAssocNoClassTyVar{}
-> noHints
TcRnDataConParentTypeMismatch{}
-> noHints
TcRnGADTsDisabled{}
......@@ -3027,10 +2942,6 @@ instance Diagnostic TcRnMessage where
-> [suggestExtension LangExt.KindSignatures]
TcRnEmptyDataDeclsDisabled{}
-> [suggestExtension LangExt.EmptyDataDecls]
TcRnFamilyCategoryMismatch{}
-> noHints
TcRnFamilyArityMismatch{}
-> noHints
TcRnRoleMismatch{}
-> noHints
TcRnRoleCountMismatch{}
......@@ -3041,8 +2952,6 @@ instance Diagnostic TcRnMessage where
-> [suggestExtension LangExt.RoleAnnotations]
TcRnIncoherentRoles{}
-> [suggestExtension LangExt.IncoherentInstances]
TcRnTyFamNameMismatch{}
-> noHints
TcRnUnexpectedKindVar{}
-> [suggestExtension LangExt.PolyKinds]
TcRnNegativeNumTypeLiteral{}
......@@ -5817,21 +5726,74 @@ pprBootDataConMismatchErr dc1 dc2 = \case
--------------------------------------------------------------------------------
-- Illegal instance errors
pprIllegalInstanceReason :: Class -> [Type] -> IllegalInstanceReason -> SDoc
pprIllegalInstanceReason cls tys = \case
IllegalInstanceHeadTypeSynonym ->
pprIllegalInstance :: IllegalInstanceReason -> SDoc
pprIllegalInstance = \case
IllegalClassInstance head_ty reason ->
pprIllegalClassInstanceReason head_ty reason
IllegalFamilyInstance reason ->
pprIllegalFamilyInstance reason
IllegalFamilyApplicationInInstance inst_ty invis_arg tf_tc tf_args ->
pprWithExplicitKindsWhen invis_arg $
hang (text "Illegal type synonym family application"
<+> quotes (ppr tf_ty) <+> text "in instance" <> colon)
2 (ppr inst_ty)
where
tf_ty = mkTyConApp tf_tc tf_args
pprIllegalClassInstanceReason :: TypedThing -> IllegalClassInstanceReason -> SDoc
pprIllegalClassInstanceReason head_ty = \case
IllegalInstanceHead reason ->
pprIllegalInstanceHeadReason head_ty reason
IllegalHasFieldInstance has_field_err ->
with_illegal_instance_header head_ty $
pprIllegalHasFieldInstance has_field_err
IllegalSpecialClassInstance cls because_safeHaskell ->
text "Class" <+> quotes (ppr $ className cls)
<+> text "does not support user-specified instances"
<> safeHaskell_msg
where
safeHaskell_msg
| because_safeHaskell
= text " when Safe Haskell is enabled."
| otherwise
= dot
IllegalInstanceFailsCoverageCondition cls coverage_failure ->
with_illegal_instance_header head_ty $
pprNotCovered cls coverage_failure
pprIllegalInstanceHeadReason :: TypedThing
-> IllegalInstanceHeadReason -> SDoc
pprIllegalInstanceHeadReason head_ty = \case
InstHeadTySynArgs -> with_illegal_instance_header head_ty $
text "All instance types must be of the form (T t1 ... tn)" $$
text "where T is not a synonym."
IllegalInstanceHeadNonTyVarArgs -> vcat [
InstHeadNonTyVarArgs -> with_illegal_instance_header head_ty $ vcat [
text "All instance types must be of the form (T a1 ... an)",
text "where a1 ... an are *distinct type variables*,",
text "and each type variable appears at most once in the instance head."]
IllegalMultiParamInstance -> parens $
InstHeadMultiParam -> with_illegal_instance_header head_ty $ parens $
text "Only one type can be given in an instance head."
IllegalHasFieldInstance has_field_err ->
pprIllegalHasFieldInstance has_field_err
IllegalInstanceFailsCoverageCondition coverage_failure ->
pprNotCovered cls tys coverage_failure
InstHeadAbstractClass clas ->
text "Cannot define instance for abstract class" <+>
quotes (ppr (className clas))
InstHeadNonClass bad_head ->
vcat [ text "Illegal" <+> what_illegal <> dot
, text "Instance heads must be of the form"
, nest 2 $ text "C ty_1 ... ty_n"
, text "where" <+> quotes (char 'C') <+> text "is a class."
]
where
what_illegal = case bad_head of
Just tc ->
text "instance for" <+> ppr (tyConFlavour tc) <+> quotes (ppr $ tyConName tc)
Nothing ->
text "head of an instance declaration:" <+> quotes (ppr head_ty)
with_illegal_instance_header :: TypedThing -> SDoc -> SDoc
with_illegal_instance_header head_ty msg =
hang (hang (text "Illegal instance declaration for")
2 (quotes (ppr head_ty)) <> colon)
2 msg
pprIllegalHasFieldInstance :: IllegalHasFieldInstance -> SDoc
pprIllegalHasFieldInstance = \case
......@@ -5846,8 +5808,8 @@ pprIllegalHasFieldInstance = \case
, text "could unify with one of the field labels of" <+> ppr_tc <> dot ]
where ppr_tc = quotes (ppr tc)
pprNotCovered :: Class -> [Type] -> CoverageProblem -> SDoc
pprNotCovered clas _tys
pprNotCovered :: Class -> CoverageProblem -> SDoc
pprNotCovered clas
CoverageProblem
{ not_covered_fundep = fd
, not_covered_fundep_inst = (ls, rs)
......@@ -5879,17 +5841,72 @@ pprNotCovered clas _tys
illegalInstanceHints :: IllegalInstanceReason -> [GhcHint]
illegalInstanceHints = \case
IllegalInstanceHeadTypeSynonym ->
[suggestExtension LangExt.TypeSynonymInstances]
IllegalInstanceHeadNonTyVarArgs ->
[suggestExtension LangExt.FlexibleInstances]
IllegalMultiParamInstance ->
[suggestExtension LangExt.MultiParamTypeClasses]
IllegalClassInstance _ reason ->
illegalClassInstanceHints reason
IllegalFamilyInstance reason ->
illegalFamilyInstanceHints reason
IllegalFamilyApplicationInInstance {} ->
noHints
illegalInstanceReason :: IllegalInstanceReason -> DiagnosticReason
illegalInstanceReason = \case
IllegalClassInstance _ reason ->
illegalClassInstanceReason reason
IllegalFamilyInstance reason ->
illegalFamilyInstanceReason reason
IllegalFamilyApplicationInInstance {} ->
ErrorWithoutFlag
illegalClassInstanceHints :: IllegalClassInstanceReason -> [GhcHint]
illegalClassInstanceHints = \case
IllegalInstanceHead reason ->
illegalInstanceHeadHints reason
IllegalHasFieldInstance has_field_err ->
illegalHasFieldInstanceHints has_field_err
IllegalInstanceFailsCoverageCondition coverage_failure ->
IllegalSpecialClassInstance {} -> noHints
IllegalInstanceFailsCoverageCondition _ coverage_failure ->
failedCoverageConditionHints coverage_failure
illegalClassInstanceReason :: IllegalClassInstanceReason -> DiagnosticReason
illegalClassInstanceReason = \case
IllegalInstanceHead reason ->
illegalInstanceHeadReason reason
IllegalHasFieldInstance has_field_err ->
illegalHasFieldInstanceReason has_field_err
IllegalSpecialClassInstance {} -> ErrorWithoutFlag
IllegalInstanceFailsCoverageCondition _ coverage_failure ->
failedCoverageConditionReason coverage_failure
illegalInstanceHeadHints :: IllegalInstanceHeadReason -> [GhcHint]
illegalInstanceHeadHints = \case
InstHeadTySynArgs ->
[suggestExtension LangExt.TypeSynonymInstances]
InstHeadNonTyVarArgs ->
[suggestExtension LangExt.FlexibleInstances]
InstHeadMultiParam ->
[suggestExtension LangExt.MultiParamTypeClasses]
InstHeadAbstractClass {} ->
noHints
InstHeadNonClass {} ->
noHints
illegalInstanceHeadReason :: IllegalInstanceHeadReason -> DiagnosticReason
illegalInstanceHeadReason = \case
-- These are serious
InstHeadAbstractClass {} ->
ErrorWithoutFlag
InstHeadNonClass {} ->
ErrorWithoutFlag
-- These are less serious (enable an extension)
InstHeadTySynArgs ->
ErrorWithoutFlag
InstHeadNonTyVarArgs ->
ErrorWithoutFlag
InstHeadMultiParam ->
ErrorWithoutFlag
illegalHasFieldInstanceHints :: IllegalHasFieldInstance -> [GhcHint]
illegalHasFieldInstanceHints = \case
IllegalHasFieldInstanceNotATyCon
......@@ -5901,6 +5918,17 @@ illegalHasFieldInstanceHints = \case
IllegalHasFieldInstanceTyConHasFields {}
-> noHints
illegalHasFieldInstanceReason :: IllegalHasFieldInstance -> DiagnosticReason
illegalHasFieldInstanceReason = \case
IllegalHasFieldInstanceNotATyCon
-> ErrorWithoutFlag
IllegalHasFieldInstanceFamilyTyCon
-> ErrorWithoutFlag
IllegalHasFieldInstanceTyConHasField {}
-> ErrorWithoutFlag
IllegalHasFieldInstanceTyConHasFields {}
-> ErrorWithoutFlag
failedCoverageConditionHints :: CoverageProblem -> [GhcHint]
failedCoverageConditionHints (CoverageProblem { not_covered_liberal = failed_cc })
= case failed_cc of
......@@ -5912,6 +5940,184 @@ failedCoverageConditionHints (CoverageProblem { not_covered_liberal = failed_cc
then noHints
else [suggestExtension LangExt.UndecidableInstances]
failedCoverageConditionReason :: CoverageProblem -> DiagnosticReason
failedCoverageConditionReason _ = ErrorWithoutFlag
pprIllegalFamilyInstance :: IllegalFamilyInstanceReason -> SDoc
pprIllegalFamilyInstance = \case
InvalidAssoc reason -> pprInvalidAssoc reason
NotAFamilyTyCon ty_or_data tc ->
vcat [ text "Illegal family instance for" <+> quotes (ppr tc)
, nest 2 $ parens (quotes (ppr tc) <+> text "is not a" <+> what) ]
where
what = ppr ty_or_data <+> text "family"
NotAnOpenFamilyTyCon tc ->
text "Illegal instance for closed family" <+> quotes (ppr tc)
FamilyCategoryMismatch tc ->
text "Wrong category of family instance; declaration was for a" <+> what <> dot
where
what = case tyConFlavour tc of
OpenFamilyFlavour IAmData _ -> text "data family"
_ -> text "type family"
FamilyArityMismatch _ max_args ->
text "Number of parameters must match family declaration; expected"
<+> ppr max_args <> dot
TyFamNameMismatch fam_tc_name eqn_tc_name ->
hang (text "Mismatched type name in type family instance.")
2 (vcat [ text "Expected:" <+> ppr fam_tc_name
, text " Actual:" <+> ppr eqn_tc_name ])
FamInstRHSOutOfScopeTyVars mb_dodgy tvs ->
hang (text "Out of scope type variable" <> plural tvs
<+> pprWithCommas (quotes . ppr) tvs
<+> text "in the RHS of a family instance.")
2 (text "All such variables must be bound on the LHS.")
$$ mk_extra
where
-- mk_extra: #7536: give a decent error message for
-- type T a = Int
-- type instance F (T a) = a
mk_extra = case mb_dodgy of
Nothing -> empty
Just (fam_tc, pats, dodgy_tvs) ->
ppWhen (any (`elemVarSetByKey` dodgy_tvs) (map nameUnique tvs)) $
hang (text "The real LHS (expanding synonyms) is:")
2 (pprTypeApp fam_tc (map expandTypeSynonyms pats))
FamInstLHSUnusedBoundTyVars tvs ->
hang (text "Type variable" <> plural tvs <+> pprQuotedList tvs
<+> isOrAre tvs <+> text "bound by a forall,")
2 (text "but not used in the family instance.")
illegalFamilyInstanceHints :: IllegalFamilyInstanceReason -> [GhcHint]
illegalFamilyInstanceHints = \case
InvalidAssoc rea -> invalidAssocHints rea
NotAFamilyTyCon {} -> noHints
NotAnOpenFamilyTyCon {} -> noHints
FamilyCategoryMismatch {} -> noHints
FamilyArityMismatch {} -> noHints
TyFamNameMismatch {} -> noHints
FamInstRHSOutOfScopeTyVars {} -> noHints
FamInstLHSUnusedBoundTyVars {} -> noHints
illegalFamilyInstanceReason :: IllegalFamilyInstanceReason -> DiagnosticReason
illegalFamilyInstanceReason = \case
InvalidAssoc rea -> invalidAssocReason rea
NotAFamilyTyCon {} -> ErrorWithoutFlag
NotAnOpenFamilyTyCon {} -> ErrorWithoutFlag
FamilyCategoryMismatch {} -> ErrorWithoutFlag
FamilyArityMismatch {} -> ErrorWithoutFlag
TyFamNameMismatch {} -> ErrorWithoutFlag
FamInstRHSOutOfScopeTyVars {} -> ErrorWithoutFlag
FamInstLHSUnusedBoundTyVars {} -> ErrorWithoutFlag
pprInvalidAssoc :: InvalidAssoc -> SDoc
pprInvalidAssoc = \case
InvalidAssocInstance rea -> pprInvalidAssocInstance rea
InvalidAssocDefault rea -> pprInvalidAssocDefault rea
pprInvalidAssocInstance :: InvalidAssocInstance -> SDoc
pprInvalidAssocInstance = \case
AssocInstanceMissing name ->
text "No explicit" <+> text "associated type"
<+> text "or default declaration for"
<+> quotes (ppr name)
AssocInstanceNotInAClass fam_tc ->
text "Associated type" <+> quotes (ppr fam_tc) <+>
text "must be inside a class instance"
AssocNotInThisClass cls fam_tc ->
hsep [ text "Class", quotes (ppr cls)
, text "does not have an associated type", quotes (ppr fam_tc) ]
AssocNoClassTyVar cls fam_tc ->
sep [ text "The associated type" <+> quotes (ppr fam_tc <+> hsep (map ppr (tyConTyVars fam_tc)))
, text "mentions none of the type or kind variables of the class" <+>
quotes (ppr cls <+> hsep (map ppr (classTyVars cls)))]
AssocTyVarsDontMatch vis fam_tc exp_tys act_tys ->
pprWithExplicitKindsWhen (isInvisibleForAllTyFlag vis) $
vcat [ text "Type indexes must match class instance head"
, text "Expected:" <+> pp exp_tys
, text " Actual:" <+> pp act_tys ]
where
pp tys = pprIfaceTypeApp topPrec (toIfaceTyCon fam_tc) $
toIfaceTcArgs fam_tc tys
pprInvalidAssocDefault :: InvalidAssocDefault -> SDoc
pprInvalidAssocDefault = \case
AssocDefaultNotAssoc cls tc ->
hsep [ text "Class", quotes (ppr cls)
, text "does not have an associated type", quotes (ppr tc) ]
AssocMultipleDefaults name ->
text "More than one default declaration for" <+> quotes (ppr name)
AssocDefaultBadArgs fam_tc pat_tys bad_arg ->
let (pat_vis, main_msg) = case bad_arg of
AssocDefaultNonTyVarArg (pat_ty, pat_vis) ->
(pat_vis,
text "Illegal argument" <+> quotes (ppr pat_ty) <+> text "in:")
AssocDefaultDuplicateTyVars dups ->
let (pat_tv, pat_vis) = NE.head dups
in (pat_vis,
text "Illegal duplicate variable" <+> quotes (ppr pat_tv) <+> text "in:")
in pprWithExplicitKindsWhen (isInvisibleForAllTyFlag pat_vis) $
hang main_msg
2 (vcat [ppr_eqn, suggestion])
where
ppr_eqn :: SDoc
ppr_eqn =
quotes (text "type" <+> ppr (mkTyConApp fam_tc pat_tys)
<+> equals <+> text "...")
suggestion :: SDoc
suggestion = text "The arguments to" <+> quotes (ppr fam_tc)
<+> text "must all be distinct type variables."
invalidAssocHints :: InvalidAssoc -> [GhcHint]
invalidAssocHints = \case
InvalidAssocInstance rea -> invalidAssocInstanceHints rea
InvalidAssocDefault rea -> invalidAssocDefaultHints rea
invalidAssocInstanceHints :: InvalidAssocInstance -> [GhcHint]
invalidAssocInstanceHints = \case
AssocInstanceMissing {} -> noHints
AssocInstanceNotInAClass {} -> noHints
AssocNotInThisClass {} -> noHints
AssocNoClassTyVar {} -> noHints
AssocTyVarsDontMatch {} -> noHints
invalidAssocDefaultHints :: InvalidAssocDefault -> [GhcHint]
invalidAssocDefaultHints = \case
AssocDefaultNotAssoc {} -> noHints
AssocMultipleDefaults {} -> noHints
AssocDefaultBadArgs _ _ bad ->
assocDefaultBadArgHints bad
assocDefaultBadArgHints :: AssocDefaultBadArgs -> [GhcHint]
assocDefaultBadArgHints = \case
AssocDefaultNonTyVarArg {} -> noHints
AssocDefaultDuplicateTyVars {} -> noHints
invalidAssocReason :: InvalidAssoc -> DiagnosticReason
invalidAssocReason = \case
InvalidAssocInstance rea -> invalidAssocInstanceReason rea
InvalidAssocDefault rea -> invalidAssocDefaultReason rea
invalidAssocInstanceReason :: InvalidAssocInstance -> DiagnosticReason
invalidAssocInstanceReason = \case
AssocInstanceMissing {} -> WarningWithFlag (Opt_WarnMissingMethods)
AssocInstanceNotInAClass {} -> ErrorWithoutFlag
AssocNotInThisClass {} -> ErrorWithoutFlag
AssocNoClassTyVar {} -> ErrorWithoutFlag
AssocTyVarsDontMatch {} -> ErrorWithoutFlag
invalidAssocDefaultReason :: InvalidAssocDefault -> DiagnosticReason
invalidAssocDefaultReason = \case
AssocDefaultNotAssoc {} -> ErrorWithoutFlag
AssocMultipleDefaults {} -> ErrorWithoutFlag
AssocDefaultBadArgs _ _ rea ->
assocDefaultBadArgReason rea
assocDefaultBadArgReason :: AssocDefaultBadArgs -> DiagnosticReason
assocDefaultBadArgReason = \case
AssocDefaultNonTyVarArg {} -> ErrorWithoutFlag
AssocDefaultDuplicateTyVars {} -> ErrorWithoutFlag
--------------------------------------------------------------------------------
-- Template Haskell quotes and splices
......
......@@ -130,10 +130,15 @@ module GHC.Tc.Errors.Types (
, SynAbstractDataError(..)
, BootListMismatch(..), BootListMismatches
-- * Instance errors
-- * Class and family instance errors
, IllegalInstanceReason(..)
, IllegalClassInstanceReason(..)
, IllegalInstanceHeadReason(..)
, IllegalHasFieldInstance(..)
, CoverageProblem(..), FailedCoverageCondition(..)
, IllegalFamilyInstanceReason(..)
, InvalidAssoc(..), InvalidAssocInstance(..)
, InvalidAssocDefault(..), AssocDefaultBadArgs(..)
-- * Template Haskell errors
, THError(..), THSyntaxError(..), THNameError(..)
......@@ -196,7 +201,7 @@ import GHC.Core.InstEnv (LookupInstanceErrReason, ClsInst, DFunId)
import GHC.Core.PatSyn (PatSyn)
import GHC.Core.Predicate (EqRel, predTypeEqRel)
import GHC.Core.TyCon (TyCon, Role, FamTyConFlav, AlgTyConRhs)
import GHC.Core.Type (Kind, Type, ThetaType, PredType, ErrorMsgType)
import GHC.Core.Type (Kind, Type, ThetaType, PredType, ErrorMsgType, ForAllTyFlag)
import GHC.Driver.Backend (Backend)
import GHC.Unit.State (UnitState)
import GHC.Utils.Misc (filterOut)
......@@ -225,11 +230,8 @@ data TcRnMessageOpts = TcRnMessageOpts { tcOptsShowContext :: !Bool -- ^ Whether
, tcOptsIfaceOpts :: !IfaceMessageOpts
}
{-
Note [Migrating TcM Messages]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{- Note [Migrating TcM Messages]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As part of #18516, we are slowly migrating the diagnostic messages emitted
and reported in the TcM from SDoc to TcRnMessage. Historically, GHC emitted
some diagnostics in 3 pieces, i.e. there were lots of error-reporting functions
......@@ -258,7 +260,6 @@ diagnostic API inside Tc.Utils.Monad, enabling further refactorings.
In the future, once the conversion will be complete and we will successfully eradicate
any use of SDoc in the diagnostic reporting of GHC, we can surely revisit the usage and
existence of these two types, which for now remain a "necessary evil".
-}
-- The majority of TcRn messages come with extra context about the error,
......@@ -270,7 +271,6 @@ data ErrInfo = ErrInfo {
-- ^ Extra supplementary info associated to the error.
}
-- | 'TcRnMessageDetailed' is an \"internal\" type (used only inside
-- 'GHC.Tc.Utils.Monad' that wraps a 'TcRnMessage' while also providing
-- any extra info needed to correctly pretty-print this diagnostic later on.
......@@ -283,6 +283,11 @@ data TcRnMessageDetailed
mkTcRnUnknownMessage :: (Diagnostic a, Typeable a, DiagnosticOpts a ~ NoDiagnosticOpts)
=> a -> TcRnMessage
mkTcRnUnknownMessage diag = TcRnUnknownMessage (mkSimpleUnknownDiagnostic diag)
-- Please don't use this function inside the GHC codebase;
-- it mainly exists for users of the GHC API, such as plugins.
--
-- If you need to emit a new error message in the typechecker,
-- you should add a new constructor to 'TcRnMessage' instead.
-- | An error which might arise during typechecking/renaming.
data TcRnMessage where
......@@ -318,7 +323,7 @@ data TcRnMessage where
{-| TcRnSolverReport is the constructor used to report unsolved constraints
after constraint solving, as well as other errors such as hole fit errors.
See the documentation of the 'TcSolverReportMsg' datatype for an overview
See the documentation of t'TcSolverReportMsg' datatype for an overview
of the different errors.
-}
TcRnSolverReport :: SolverReportWithCtxt
......@@ -329,6 +334,30 @@ data TcRnMessage where
-- so that we can compute the reason and hints, as opposed
-- to having to pass them here.
{-| TcRnSolverDepthError is an error that occurs when the constraint solver
exceeds the maximum recursion depth.
Example:
class C a where { meth :: a }
instance Cls [a] => Cls a where { meth = head . meth }
t :: ()
t = meth
Test cases:
T7788
T8550
T9554
T15316A
T17267{∅,a,b,c,e}
T17458
ContextStack1
T22924b
TcCoercibleFail
-}
TcRnSolverDepthError :: !Type -> !SubGoalDepth -> TcRnMessage
{-| TcRnRedundantConstraints is a warning that is emitted when a binding
has a user-written type signature which contains superfluous constraints.
......@@ -533,7 +562,6 @@ data TcRnMessage where
-}
TcRnInvalidWarningCategory :: !WarningCategory -> TcRnMessage
{-| TcRnDuplicateWarningDecls is an error that occurs whenever
a warning is declared twice.
......@@ -680,7 +708,6 @@ data TcRnMessage where
saks_fail003
T15433a
-}
TcRnIllegalWildcardInType
:: Maybe Name
-- ^ the wildcard name, or 'Nothing' for an anonymous wildcard
......@@ -998,44 +1025,6 @@ data TcRnMessage where
-}
TcRnTupleConstraintInst :: !Class -> TcRnMessage
{-| TcRnAbstractClassInst is an error that occurs whenever an instance
of an abstract class is specified.
Examples(s):
-- A.hs-boot
module A where
class C a
-- B.hs
module B where
import {-# SOURCE #-} A
instance C Int where
-- A.hs
module A where
import B
class C a where
f :: a
-- Main.hs
import A
main = print (f :: Int)
Test cases: typecheck/should_fail/T13068
-}
TcRnAbstractClassInst :: !Class -> TcRnMessage
{-| TcRnNoClassInstHead is an error that occurs whenever an instance
head is not headed by a class.
Examples(s):
instance c
Test cases: typecheck/rename/T5513
typecheck/rename/T16385
-}
TcRnNoClassInstHead :: !Type -> TcRnMessage
{-| TcRnUserTypeError is an error that occurs due to a user's custom type error,
which can be triggered by adding a `TypeError` constraint in a type signature
or typeclass instance.
......@@ -1200,21 +1189,6 @@ data TcRnMessage where
-}
TcRnIllegalConstraintSynonymOfKind :: !Type -> TcRnMessage
{-| TcRnIllegalClassInst is an error that occurs whenever a class instance is specified
for a non-class.
This also includes derived instances. See the T23522 test case.
Examples(s):
type C1 a = (Show (a -> Bool))
instance C1 Int where
Test cases:
polykinds/T13267
deriving/should_fail/T23522
-}
TcRnIllegalClassInst :: !(TyConFlavour TyCon) -> TcRnMessage
{-| TcRnOversaturatedVisibleKindArg is an error that occurs whenever an illegal oversaturated
visible kind argument is specified.
......@@ -1228,21 +1202,6 @@ data TcRnMessage where
-}
TcRnOversaturatedVisibleKindArg :: !Type -> TcRnMessage
{-| TcRnBadAssociatedType is an error that occurs whenever a class doesn't have an
associated type.
Examples(s):
$(do d <- instanceD (cxt []) (conT ''Eq `appT` conT ''Foo)
[tySynInstD $ tySynEqn Nothing (conT ''Rep `appT` conT ''Foo) (conT ''Maybe)]
return [d])
======>
instance Eq Foo where
type Rep Foo = Maybe
Test cases: th/T12387a
-}
TcRnBadAssociatedType :: {-Class-} !Name -> {-TyCon-} !Name -> TcRnMessage
{-| TcRnForAllRankErr is an error that occurs whenever an illegal ranked type
is specified.
......@@ -1319,13 +1278,12 @@ data TcRnMessage where
-> !Arity -- ^ actual arity
-> TcRnMessage
{-| TcRnIllegalInstanceDecl is an error that arises from an invalid class
instance declaration.
{-| TcRnIllegalClassInstance is a collection of diagnostics that arise
from an invalid class or family instance declaration.
See 'IllegalInstanceReason'.
See t'IllegalInstanceReason'.
-}
TcRnIllegalInstanceDecl :: !Class -> ![Type] -> IllegalInstanceReason
-> TcRnMessage
TcRnIllegalInstance :: IllegalInstanceReason -> TcRnMessage
{-| TcRnMonomorphicBindings is a warning (controlled by -Wmonomorphism-restriction)
that arises when the monomorphism restriction applies to the given bindings.
......@@ -1429,7 +1387,15 @@ data TcRnMessage where
-}
TcRnConflictingFamInstDecls :: NE.NonEmpty FamInst -> TcRnMessage
TcRnFamInstNotInjective :: InjectivityErrReason -> TyCon -> NE.NonEmpty CoAxBranch -> TcRnMessage
{-| TcRnFamInstNotInjective is a collection of errors that arise from
a type family equation violating the injectivity annotation.
See 'InjectivityErrReason'.
-}
TcRnFamInstNotInjective :: InjectivityErrReason -- ^ the violation
-> TyCon -- ^ the family 'TyCon'
-> NE.NonEmpty CoAxBranch -- ^ the family equations
-> TcRnMessage
{-| TcRnBangOnUnliftedType is a warning (controlled by -Wredundant-strictness-flags) that
occurs when a strictness annotation is applied to an unlifted type.
......@@ -1765,21 +1731,6 @@ data TcRnMessage where
rename/should_fail/RnStaticPointersFail03
-}
TcRnStaticFormNotClosed :: Name -> NotClosedReason -> TcRnMessage
{-| TcRnSpecialClassInst is an error that occurs when a user
attempts to define an instance for a built-in typeclass such as
'Coercible', 'Typeable', or 'KnownNat', outside of a signature file.
Test cases: deriving/should_fail/T9687
deriving/should_fail/T14916
polykinds/T8132
typecheck/should_fail/TcCoercibleFail2
typecheck/should_fail/T12837
typecheck/should_fail/T14390
-}
TcRnSpecialClassInst :: !Class
-> !Bool -- ^ Whether the error is due to Safe Haskell being enabled
-> TcRnMessage
{-| TcRnUselessTypeable is a warning (controlled by -Wderiving-typeable) that
occurs when trying to derive an instance of the 'Typeable' class. Deriving
......@@ -1988,7 +1939,6 @@ data TcRnMessage where
-}
TcRnIllegalTypeOperatorDecl :: !RdrName -> TcRnMessage
{-| TcRnGADTMonoLocalBinds is a warning controlled by -Wgadt-mono-local-binds
that occurs when pattern matching on a GADT when -XMonoLocalBinds is off.
......@@ -1997,6 +1947,7 @@ data TcRnMessage where
Test cases: T20485, T20485a
-}
TcRnGADTMonoLocalBinds :: TcRnMessage
{-| The TcRnNotInScope constructor is used for various not-in-scope errors.
See 'NotInScopeError' for more details. -}
TcRnNotInScope :: NotInScopeError -- ^ what the problem is
......@@ -2004,6 +1955,19 @@ data TcRnMessage where
-> [ImportError] -- ^ import errors that are relevant
-> [GhcHint] -- ^ hints, e.g. enable DataKinds to refer to a promoted data constructor
-> TcRnMessage
{-| TcRnTermNameInType is an error that occurs when a term-level identifier
is used in a type.
Example:
import qualified Prelude
bad :: Prelude.fst (Bool, Float)
bad = False
Test cases: T21605{c,d}
-}
TcRnTermNameInType :: RdrName -> [GhcHint] -> TcRnMessage
{-| TcRnUntickedPromotedThing is a warning (controlled with -Wunticked-promoted-constructors)
......@@ -2607,7 +2571,7 @@ data TcRnMessage where
meth = 0
Test case:
testsuite/tests/typecheck/should_fail/MissingDefaultMethodBinding.hs
typecheck/should_fail/MissingDefaultMethodBinding.hs
-}
TcRnBadGenericMethod :: !Name -- ^ 'Name' of the class
-> !Name -- ^ Problematic method
......@@ -2622,7 +2586,7 @@ data TcRnMessage where
{-# MINIMAL #-} -- warning!
Test case:
testsuite/tests/warnings/minimal/WarnMinimal.hs:
warnings/minimal/WarnMinimal.hs:
-}
TcRnWarningMinimalDefIncomplete :: ClassMinimalDef -> TcRnMessage
......@@ -2646,8 +2610,8 @@ data TcRnMessage where
a default method pragma is missing an accompanying binding.
Test cases:
testsuite/tests/typecheck/should_fail/T5084.hs
testsuite/tests/typecheck/should_fail/T2354.hs
typecheck/should_fail/T5084.hs
typecheck/should_fail/T2354.hs
-}
TcRnDefaultMethodForPragmaLacksBinding
:: Id -- ^ method
......@@ -2662,27 +2626,16 @@ data TcRnMessage where
:: !Name
-> TcRnMessage
{-| TcRnBadMethodErr is an error that happens when one attempts to provide a method
in a class instance, when the class doesn't have a method by that name.
in a class instance, when the class doesn't have a method by that name.
Test case:
testsuite/tests/th/T12387
th/T12387
-}
TcRnBadMethodErr
:: { badMethodErrClassName :: !Name
, badMethodErrMethodName :: !Name
} -> TcRnMessage
{-| TcRnNoExplicitAssocTypeOrDefaultDeclaration is an error that occurs
when a class instance does not provide an expected associated type
or default declaration.
Test cases:
testsuite/tests/deriving/should_compile/T14094
testsuite/tests/indexed-types/should_compile/Simple2
testsuite/tests/typecheck/should_compile/tc254
-}
TcRnNoExplicitAssocTypeOrDefaultDeclaration
:: Name
-> TcRnMessage
{-| TcRnIllegalNewtype is an error that occurs when a newtype:
* Does not have exactly one field, or
......@@ -2693,18 +2646,18 @@ data TcRnMessage where
* has strictness annotations.
Test cases:
testsuite/tests/gadt/T14719
testsuite/tests/indexed-types/should_fail/T14033
testsuite/tests/indexed-types/should_fail/T2334A
testsuite/tests/linear/should_fail/LinearGADTNewtype
testsuite/tests/parser/should_fail/readFail008
testsuite/tests/polykinds/T11459
testsuite/tests/typecheck/should_fail/T15523
testsuite/tests/typecheck/should_fail/T15796
testsuite/tests/typecheck/should_fail/T17955
testsuite/tests/typecheck/should_fail/T18891a
testsuite/tests/typecheck/should_fail/T21447
testsuite/tests/typecheck/should_fail/tcfail156
gadt/T14719
indexed-types/should_fail/T14033
indexed-types/should_fail/T2334A
linear/should_fail/LinearGADTNewtype
parser/should_fail/readFail008
polykinds/T11459
typecheck/should_fail/T15523
typecheck/should_fail/T15796
typecheck/should_fail/T17955
typecheck/should_fail/T18891a
typecheck/should_fail/T21447
typecheck/should_fail/tcfail156
-}
TcRnIllegalNewtype
:: DataCon
......@@ -2718,7 +2671,7 @@ data TcRnMessage where
See Note [Type data declarations]
Test case:
testsuite/tests/type-data/should_fail/TDNoPragma
type-data/should_fail/TDNoPragma
-}
TcRnIllegalTypeData :: TcRnMessage
......@@ -2729,11 +2682,11 @@ data TcRnMessage where
See Note [Type data declarations]
Test cases:
testsuite/tests/type-data/should_fail/TDDeriving
testsuite/tests/type-data/should_fail/TDRecordsGADT
testsuite/tests/type-data/should_fail/TDRecordsH98
testsuite/tests/type-data/should_fail/TDStrictnessGADT
testsuite/tests/type-data/should_fail/TDStrictnessH98
type-data/should_fail/TDDeriving
type-data/should_fail/TDRecordsGADT
type-data/should_fail/TDRecordsH98
type-data/should_fail/TDStrictnessGADT
type-data/should_fail/TDStrictnessH98
-}
TcRnTypeDataForbids :: !TypeDataForbids -> TcRnMessage
......@@ -2746,35 +2699,35 @@ data TcRnMessage where
instance C () -- | foo needs to be defined here
Test cases:
testsuite/tests/typecheck/prog001/typecheck.prog001
testsuite/tests/typecheck/should_compile/tc126
testsuite/tests/typecheck/should_compile/T7903
testsuite/tests/typecheck/should_compile/tc116
testsuite/tests/typecheck/should_compile/tc175
testsuite/tests/typecheck/should_compile/HasKey
testsuite/tests/typecheck/should_compile/tc125
testsuite/tests/typecheck/should_compile/tc078
testsuite/tests/typecheck/should_compile/tc161
testsuite/tests/typecheck/should_fail/T5051
testsuite/tests/typecheck/should_compile/T21583
testsuite/tests/backpack/should_compile/bkp47
testsuite/tests/backpack/should_fail/bkpfail25
testsuite/tests/parser/should_compile/T2245
testsuite/tests/parser/should_compile/read014
testsuite/tests/indexed-types/should_compile/Class3
testsuite/tests/indexed-types/should_compile/Simple2
testsuite/tests/indexed-types/should_fail/T7862
testsuite/tests/deriving/should_compile/deriving-1935
testsuite/tests/deriving/should_compile/T9968a
testsuite/tests/deriving/should_compile/drv003
testsuite/tests/deriving/should_compile/T4966
testsuite/tests/deriving/should_compile/T14094
testsuite/tests/perf/compiler/T15304
testsuite/tests/warnings/minimal/WarnMinimal
testsuite/tests/simplCore/should_compile/simpl020
testsuite/tests/deSugar/should_compile/T14546d
testsuite/tests/ghci/scripts/T5820
testsuite/tests/ghci/scripts/ghci019
typecheck/prog001/typecheck.prog001
typecheck/should_compile/tc126
typecheck/should_compile/T7903
typecheck/should_compile/tc116
typecheck/should_compile/tc175
typecheck/should_compile/HasKey
typecheck/should_compile/tc125
typecheck/should_compile/tc078
typecheck/should_compile/tc161
typecheck/should_fail/T5051
typecheck/should_compile/T21583
backpack/should_compile/bkp47
backpack/should_fail/bkpfail25
parser/should_compile/T2245
parser/should_compile/read014
indexed-types/should_compile/Class3
indexed-types/should_compile/Simple2
indexed-types/should_fail/T7862
deriving/should_compile/deriving-1935
deriving/should_compile/T9968a
deriving/should_compile/drv003
deriving/should_compile/T4966
deriving/should_compile/T14094
perf/compiler/T15304
warnings/minimal/WarnMinimal
simplCore/should_compile/simpl020
deSugar/should_compile/T14546d
ghci/scripts/T5820
ghci/scripts/ghci019
-}
TcRnUnsatisfiedMinimalDef :: ClassMinimalDef -> TcRnMessage
......@@ -2782,33 +2735,9 @@ data TcRnMessage where
a class instance is given a type signature, but the user has not
enabled the @InstanceSigs@ extension.
Test case:
testsuite/tests/module/mod45
Test case: module/mod45
-}
TcRnMisplacedInstSig :: Name -> (LHsSigType GhcRn) -> TcRnMessage
{-| 'TcRnIllegalFamilyInstance' is an error that occurs when an associated
type or data family is given a top-level instance.
Test case:
testsuite/tests/indexed-types/should_fail/T3092
-}
TcRnIllegalFamilyInstance :: TyCon -> TcRnMessage
{-| 'TcRnMissingClassAssoc' is an error that occurs when a class instance
for a class with an associated type or data family is missing a corresponding
family instance declaration.
Test case:
testsuite/tests/indexed-types/should_fail/SimpleFail7
-}
TcRnMissingClassAssoc :: TyCon -> TcRnMessage
{-| 'TcRnNotOpenFamily' is an error that is triggered by attempting to give
a top-level (open) type family instance for a closed type family.
Test cases:
testsuite/tests/indexed-types/should_fail/Overlap7
testsuite/tests/indexed-types/should_fail/Overlap3
-}
TcRnNotOpenFamily :: TyCon -> TcRnMessage
{-| TcRnNoRebindableSyntaxRecordDot is an error triggered by an overloaded record update
without RebindableSyntax enabled.
......@@ -3153,20 +3082,6 @@ data TcRnMessage where
-> PredType -- ^ Wanted 'PredType'
-> TcRnMessage
{-| TcRnIllegalInstanceHeadDecl is an error triggered by malformed head of
type class instance
Examples:
instance 42
instance !Show D
Test cases: parser/should_fail/T3811c
rename/should_fail/T18240a
-}
TcRnIllegalInstanceHeadDecl :: LHsType GhcRn -> TcRnMessage
{-| TcRnUnexpectedStandaloneDerivingDecl is an error thrown when a user uses
standalone deriving without enabling the StandaloneDeriving extension.
......@@ -3219,20 +3134,6 @@ data TcRnMessage where
-> HsExpr GhcRn -- Bad expression
-> TcRnMessage
{-| TcRnBadAssocRhs is an error triggered by out-of-scope type variables
occurred in right-hand side of an associated type declaration
Example:
instance forall a. C Int where
data instance D Int = MkD1 a
cases: indexed-types/should_fail/T5515
polykinds/T9574
rename/should_fail/T18021
-}
TcRnBadAssocRhs :: [Name] -> TcRnMessage
{-| TcRnDuplicateRoleAnnot is an error triggered by two or more role
annotations for one type
......@@ -3489,15 +3390,6 @@ data TcRnMessage where
-}
TcRnZonkerMessage :: ZonkerMessage -> TcRnMessage
{-| TcRnMultiAssocTyFamDefaults is an error indicating that multiple default
declarations were specified for an associated type family.
Test cases:
none
-}
TcRnMultiAssocTyFamDefaults :: !(IdP GhcRn) -- ^ Name of the associated type
-> TcRnMessage
{-| TcRnTyFamDepsDisabled is an error indicating that a type family injectivity
annotation was used without enabling the extension TypeFamilyDependencies.
......@@ -3560,6 +3452,26 @@ data TcRnMessage where
TcRnTyFamsDisabled :: !TyFamsDisabledReason -- ^ The name of the family or instance
-> TcRnMessage
{-| TcRnBadTyConTelescope is an error caused by an ill-scoped 'TyCon' kind,
due to type variables being out of dependency order.
Example:
class C a (b :: Proxy a) (c :: Proxy b) where
type T c a
Test cases:
BadTelescope{∅,3,4}
T14066{f,g}
T14887
T15591{b,c}
T15743{c,d}
T15764
T23252
-}
TcRnBadTyConTelescope :: !TyCon -> TcRnMessage
{-| TcRnTyFamResultDisabled is an error indicating that a result variable
was used on a type family while the extension TypeFamilyDependencies was
disabled.
......@@ -3610,16 +3522,6 @@ data TcRnMessage where
-> !DisabledClassExtension -- ^ The extension
-> TcRnMessage
{-| TcRnAssocNoClassTyVar is an error indicating that no class parameters
are used in an associated type family.
Test cases:
T2888, T9167, T12867
-}
TcRnAssocNoClassTyVar :: !Class -- ^ The class
-> !TyCon -- ^ The associated family
-> TcRnMessage
{-| TcRnDataConParentTypeMismatch is an error indicating that a data
constructor was declared with a type that doesn't match its type
constructor (i.e. a GADT result type and its data name).
......@@ -3687,27 +3589,6 @@ data TcRnMessage where
TcRnEmptyDataDeclsDisabled :: !Name -- ^ The data type name
-> TcRnMessage
{-| TcRnFamilyCategoryMismatch is an error indicating that a family instance
was declared for a family of a different kind, i.e. data vs type family.
Test cases:
T9896, SimpleFail3a
-}
TcRnFamilyCategoryMismatch :: !TyCon -- ^ The family tycon
-> TcRnMessage
{-| TcRnFamilyArityMismatch is an error indicating that a family instance
was declared with a different number of arguments than the family.
See Note [Oversaturated type family equations] in "GHC.Tc.Validity".
Test cases:
TyFamArity1, TyFamArity2, T11136, Overlap4, AssocTyDef05, AssocTyDef06,
T14110
-}
TcRnFamilyArityMismatch :: !TyCon -- ^ The family tycon
-> !Arity -- ^ The right number of parameters
-> TcRnMessage
{-| TcRnRoleMismatch is an error indicating that the role specified
in an annotation differs from its inferred role.
......@@ -3755,17 +3636,6 @@ data TcRnMessage where
-}
TcRnIncoherentRoles :: !TyCon -- ^ The class tycon
-> TcRnMessage
{-| TcRnIncoherentRoles is an error indicating that a type family equation
used a different name than the family.
Test cases:
Overlap5, T15362, T16002, T20260, T11623
-}
TcRnTyFamNameMismatch :: !Name -- ^ The family name
-> !Name -- ^ The name used in the equation
-> TcRnMessage
{-| TcRnPrecedenceParsingError is an error caused by attempting to
use operators with the same precedence in one infix expression.
......@@ -4175,6 +4045,8 @@ data ZonkerMessage where
deriving Generic
----
-- | Things forbidden in @type data@ declarations.
-- See Note [Type data declarations]
data TypeDataForbids
......@@ -4506,6 +4378,245 @@ data SoleExtraConstraintWildcardAllowed
= SoleExtraConstraintWildcardNotAllowed
| SoleExtraConstraintWildcardAllowed
-- | Why is a class instance head invalid?
data IllegalInstanceHeadReason
-- | An instance for an abstract class from an hs-boot or Backpack
-- hsig file.
--
-- Example:
--
-- -- A.hs-boot
-- module A where
-- class C a
--
-- -- B.hs
-- module B where
-- import {-# SOURCE #-} A
-- instance C Int where
--
-- -- A.hs
-- module A where
-- import B
-- class C a where
-- f :: a
--
-- Test cases: typecheck/should_fail/T13068
= InstHeadAbstractClass !Class
-- | An instance whose head is not a class.
--
-- Examples(s):
--
-- instance c
--
-- instance 42
--
-- instance !Show D
--
-- type C1 a = (Show (a -> Bool))
-- instance C1 Int where
--
-- Test cases: typecheck/rename/T5513
-- typecheck/rename/T16385
-- parser/should_fail/T3811c
-- rename/should_fail/T18240a
-- polykinds/T13267
-- deriving/should_fail/T23522
| InstHeadNonClass
!(Maybe TyCon) -- ^ the 'TyCon' at the head of the instance head,
-- or 'Nothing' if the instance head is not even headed
-- by a 'TyCon'
-- | Instance head was headed by a type synonym.
--
-- Example:
-- type MyInt = Int
-- class C a where {..}
-- instance C MyInt where {..}
--
-- Test cases: drvfail015, mod42, TidyClassKinds, tcfail139
| InstHeadTySynArgs
-- | Instance head was not of the form @T a1 ... an@,
-- where @a1, ..., an@ are all type variables or literals.
--
-- Example:
--
-- instance Num [Int] where {..}
--
-- Test cases: mod41, mod42, tcfail044, tcfail047.
| InstHeadNonTyVarArgs
-- | Multi-param instance without -XMultiParamTypeClasses.
--
-- Example:
--
-- instance C a b where {..}
--
-- Test case: IllegalMultiParamInstance
| InstHeadMultiParam
deriving Generic
-- | Why is a (type or data) family instance invalid?
data IllegalFamilyInstanceReason
{-| A top-level family instance for a 'TyCon' that isn't a family 'TyCon'.
Example:
data D a = MkD
type instance D Int = Bool
Test case: indexed-types/should_fail/T3092
-}
= NotAFamilyTyCon
!TypeOrData -- ^ was this a 'type' or a 'data' instance?
!TyCon
{-| A top-level (open) type family instance for a closed type family.
Test cases:
indexed-types/should_fail/Overlap7
indexed-types/should_fail/Overlap3
-}
| NotAnOpenFamilyTyCon !TyCon
{-| A family instance was declared for a family of a different kind,
e.g. a data instance for a type family 'TyCon'.
Test cases:
T9896, SimpleFail3a
-}
| FamilyCategoryMismatch !TyCon -- ^ The family tycon
{-| A family instance was declared with a different number of arguments
than expected.
See Note [Oversaturated type family equations] in "GHC.Tc.Validity".
Test cases:
TyFamArity1, TyFamArity2, T11136, Overlap4, AssocTyDef05, AssocTyDef06,
T14110
-}
| FamilyArityMismatch !TyCon -- ^ The family tycon
!Arity -- ^ The right number of parameters
{-| A closed type family equation used a different name than the parent family.
Example:
type family F a where
G Int = Bool
Test cases:
Overlap5, T15362, T16002, T20260, T11623
-}
| TyFamNameMismatch !Name -- ^ The family name
!Name -- ^ The name used in the equation
-- | There are out-of-scope type variables in the right-hand side
-- of an associated type or data family instance.
--
-- Example:
--
-- instance forall a. C Int where
-- data instance D Int = MkD1 a
--
-- Test cases: indexed-types/should_fail/T5515, polykinds/T9574, rename/should_fail/T18021
| FamInstRHSOutOfScopeTyVars
!(Maybe (TyCon, [Type], TyVarSet))
-- ^ family 'TyCon', arguments, and set of "dodgy" type variables
-- See Note [Dodgy binding sites in type family instances]
-- in GHC.Tc.Validity
![Name] -- ^ the out-of-scope type variables
| FamInstLHSUnusedBoundTyVars
![Name] -- ^ the unused bound type variables
| InvalidAssoc !InvalidAssoc
deriving Generic
data InvalidAssoc
-- | An invalid associated family instance.
--
-- See t'InvalidAssocInstance'.Builder
= InvalidAssocInstance !InvalidAssocInstance
-- | An invalid associated family default declaration.
--
-- See t'InvalidAssocDefault'.
| InvalidAssocDefault !InvalidAssocDefault
deriving Generic
-- | The reason that an associated family instance was invalid.
data InvalidAssocInstance
-- | A class instance is missing its expected associated type/data instance.
--
-- Test cases: deriving/should_compile/T14094
-- indexed-types/should_compile/Simple2
-- typecheck/should_compile/tc254
= AssocInstanceMissing !Name
-- | A top-level instance for an associated family 'TyCon'.
--
-- Example:
--
-- class C a where { type T a }
-- instance T Int = Bool
--
-- Test case: indexed-types/should_fail/SimpleFail7
| AssocInstanceNotInAClass !TyCon
-- | An associated type instance is provided for a class that doesn't have
-- that associated type.
--
-- Examples(s):
-- $(do d <- instanceD (cxt []) (conT ''Eq `appT` conT ''Foo)
-- [tySynInstD $ tySynEqn Nothing (conT ''Rep `appT` conT ''Foo) (conT ''Maybe)]
-- return [d])
-- ======>
-- instance Eq Foo where
-- type Rep Foo = Maybe
--
-- Test cases: th/T12387a
| AssocNotInThisClass !Class !TyCon
-- | An associated family instance does not mention any of the parent 'Class'
-- 'TyVar's.
--
-- Test cases: T2888, T9167, T12867
| AssocNoClassTyVar !Class !TyCon
| AssocTyVarsDontMatch
!ForAllTyFlag
!TyCon -- ^ family 'TyCon'
![Type] -- ^ expected type arguments
![Type] -- ^ actual type arguments
deriving Generic
-- | The reason that an associated family default declaration was invalid.
data InvalidAssocDefault
-- | An associated family default declaration for something that isn't
-- an associated family.
= AssocDefaultNotAssoc !Name -- ^ 'Class' 'Name'
!Name -- ^ 'TyCon' 'Name'
-- | Multiple default declarations were given for an associated
-- family instance.
--
-- Test cases: none.
| AssocMultipleDefaults !Name
-- | Invalid arguments in an associated family instance.
--
-- See t'AssocDefaultBadArgs'.
| AssocDefaultBadArgs !TyCon ![Type] AssocDefaultBadArgs
deriving Generic
-- | Invalid arguments in an associated family instance declaration.
data AssocDefaultBadArgs
-- | An argument which isn't a type variable in an associated
-- family instance default declaration.
= AssocDefaultNonTyVarArg !(Type, ForAllTyFlag)
-- | Duplicate occurrence of a type variable in an associated
-- family instance default declaration.
| AssocDefaultDuplicateTyVars !(NE.NonEmpty (TyCoVar, ForAllTyFlag))
deriving Generic
-- | A type representing whether or not the input type has associated data family instances.
data HasAssociatedDataFamInsts
= YesHasAdfs
......@@ -5815,34 +5926,35 @@ data NonCanonical_Monad =
-- | Why was an instance declaration rejected?
data IllegalInstanceReason
-- | Instance head was headed by a type synonym.
--
-- Example:
-- type MyInt = Int
-- class C a where {..}
-- instance C MyInt where {..}
--
-- Test cases: drvfail015, mod42, TidyClassKinds, tcfail139
= IllegalInstanceHeadTypeSynonym
-- | Instance head was not of the form @T a1 ... an@,
-- where @a1, ..., an@ are all type variables or literals.
--
-- Example:
--
-- instance Num [Int] where {..}
--
-- Test cases: mod41, mod42, tcfail044, tcfail047.
| IllegalInstanceHeadNonTyVarArgs
-- | Multi-param instance without -XMultiParamTypeClasses.
--
-- Example:
--
-- instance C a b where {..}
= IllegalClassInstance
!TypedThing -- ^ the instance head type
!IllegalClassInstanceReason -- ^ the problem with the instance head
| IllegalFamilyInstance !IllegalFamilyInstanceReason
| IllegalFamilyApplicationInInstance
!Type -- ^ the instance head type
!Bool -- ^ is this an invisible argument?
!TyCon -- ^ type family
![Type] -- ^ type family argument
deriving Generic
-- | Why was a class instance declaration rejected?
data IllegalClassInstanceReason
-- | An illegal type at the head of the instance.
--
-- Test case: IllegalMultiParamInstance
| IllegalMultiParamInstance
-- See t'IllegalInstanceHeadReason'.
= IllegalInstanceHead !IllegalInstanceHeadReason
-- | An illegal HasField instance. See t'IllegalHasFieldInstance'.
| IllegalHasFieldInstance !IllegalHasFieldInstance
-- | An illegal instance for a built-in typeclass such as
-- 'Coercible', 'Typeable', or 'KnownNat', outside of a signature file.
--
-- Test cases: deriving/should_fail/T9687
-- deriving/should_fail/T14916
-- polykinds/T8132
-- typecheck/should_fail/TcCoercibleFail2
-- typecheck/should_fail/T12837
-- typecheck/should_fail/T14390
| IllegalSpecialClassInstance !Class !Bool -- ^ Whether the error is due to Safe Haskell being enabled
-- | The instance failed the coverage condition, i.e. the functional
-- dependencies were not respected.
--
......@@ -5853,7 +5965,7 @@ data IllegalInstanceReason
--
-- Test cases: T9106, T10570, T2247, T12803, tcfail170.
| IllegalInstanceFailsCoverageCondition
!CoverageProblem
!Class !CoverageProblem
deriving Generic
-- | Why was a HasField instance declaration rejected?
......
......@@ -644,7 +644,11 @@ tcHsDeriv hs_ty
case tyConClass_maybe tyCon of
Just clas ->
return (tvs, clas, tyConArgs, map scaledThing kind_args)
Nothing -> failWithTc $ TcRnIllegalClassInst (tyConFlavour tyCon)
Nothing -> failWithTc $ TcRnIllegalInstance
$ IllegalClassInstance
(TypeThing ty)
$ IllegalInstanceHead
$ InstHeadNonClass (Just tyCon)
Nothing -> failWithTc $ TcRnIllegalDerivingItem hs_ty
}
......@@ -3548,7 +3552,7 @@ filterConstrainedCandidates
-> TcM CandidatesQTvs
-- filterConstrainedCandidates removes any candidates that are free in
-- 'wanted'; instead, it promotes them. This bit is very much like
-- decideMonoTyVars in GHC.Tc.Solver, but constraints are so much
-- decidePromotedTyVars in GHC.Tc.Solver, but constraints are so much
-- simpler in kinds, it is much easier here. (In particular, we never
-- quantify over a constraint in a type.)
filterConstrainedCandidates wanted dvs
......