Final fix to #7134 (and #8717 as well.)

Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit 2b33f6e8045fcd00f19883bb5e8895cbaf1bf81e)
Add test-case for #8726

This tests various properties expected to hold for
quotRem, divMod, div, mod, quot, and rem.

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>

(cherry picked from commit 5f64b2c6e8f1799d7015098598f7d6e826707e6c)
Tweak holes documentation

type holes -> typed holes, reorder, minor changes

Signed-off-by: Austin Seipp <aseipp@pobox.com>

(cherry picked from commit 2f6d36f64730f044bb038e2d3da2b97ee571d763)
Fix #8698 by properly handling long section names and reenabling .ctors handling

Our old function for searching for sections could only deal
with section names that were eight bytes or shorter; this
patch adds support for long section names.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>

(cherry picked from commit 40ce20357fb6266471a53cec7de0a810a3070f36)
Mention that MR is off by default in GHCi in documentation

(cherry picked from commit 5bda0d08d8fec86433917b65a93836d2372a5b5c)
Tweak documentation of monomorphism restriction

Suggested by Gabor Greif on ghc-devs

(cherry picked from commit 41cfc96b55a4a44953fc20aa72ef50789ba6ceab)
Fix __thread detection (#8722)

Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit 298a25bdfd02bb591fde2dd0590bd7af81a91b94)
Remove ios_HOST check for GCTDecl.h

Following 298a25bdf and #8722 as Peter mentioned, this probably isn't
needed anymore.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit b4eb630c7480bc56c673a463f274aec18e237e8c)
Add test case for #8743

which only occurs when the instance being compiled is also present from
a .hs-boot file.

(cherry picked from commit c3ff5f29c80680a09c7779aee2535fa64b880cd9)
In deepSplitCprType_maybe, be more forgiving

the ConTag may be out of range (e.g. if the type constructor is imported
via SOURCE and we don't know any of its data constructors); just return
Nothing without complaining in that case. This fixes #8743.

(cherry picked from commit 312686c172eefb74237c8a61e2cca1b2af7459c1)
Fix #8706, documenting that type operators are not promoted.

(cherry picked from commit 218dead0d85a136b5d5648e4d6c4c9cc9467eb45)
Fix #8631.

This patch allows turning on ImpredicativeTypes while type-checking
the code generated by GeneralizedNewtypeDeriving. It does this
by adding a field ib_extensions to InstBindings, informing the
type-checker what extensions should be enabled while type-checking
the instance.

(cherry picked from commit 674c969c240632da70ed2928fa30c20a9a52e5dc)
Issue an error for pattern synonyms defined in a local scope (#8757)

This also fixes the internal crash when using pattern synonyms
in GHCi (#8749)

(cherry picked from commit e0a55415545074bc7a757462624079f54f7785e2)
Add test suite for #8757

(cherry picked from commit 719108f8d70aa50cdaccf564dbc463445a03988e)
Move test case for #8631 to the correct directory.

(cherry picked from commit 02c7135dfce049b53bd38aa35c175302652af507)
Fix #8758 by assuming RankNTypes when checking GND code.

(cherry picked from commit 8cc398ff8b3f7408327d99347f440693cb204c0a)
Test #6147, which was fixed with the roles commit.

(cherry picked from commit 9e0c1ae57526bacaca044a7ce5a6491fb6a7cb42)
Test #7481, which had already been fixed.

(cherry picked from commit d1dff94c9a82ffeff0bf92d0f90231a639ade59c)
Fix #8759 by not panicking with TH and patsyns.

We should still have pattern synonyms in TH, though.

(cherry picked from commit 6122efcabe6e08375f69ee19148ba3838c332559)