Make splitStrProdDmd (and similarly Use) more robust

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

(cherry picked from commit b60df0fa017eac8800a3848650dbad09acb6f1b8)
Line up kind and type variables correctly when desugaring TH brackets

This bug was causing Trac #9199

(cherry picked from commit 571f0adccda687098d59f63524357f4ac98e72fb)

Conflicts:
	testsuite/tests/th/all.T
Fix Trac #9071, an egregious bug in TcDeriv.inferConstraints

The constraints for Functor don't line up 1-1 with the arguments
(they are fetched out from sub-terms of the type), but the surrounding
code was mistakenly assuming they were in 1-1 association.

(cherry picked from commit 13a330e87cf459311a7f164e1e57baf877741da6)

Conflicts:
	compiler/typecheck/TcDeriv.lhs
Adding missing test files for #9071

(cherry picked from commit 59b4e6d0ba504b33cc7064d489b8ec485a7703f4)
Fix elemLocalRdrEnv (Trac #9160)

This was pretty obscure.  elemLocalRdrEnv was utterly wrong (replied
False when it should reply True) when given an Exact Name. That
doesn't happen often, but it does happen in the result of a TH splice.
The result was that an associated type didn't get a type variable that
lined up with its parent class (elemLocalRdrEnv is used in
RnTypes.bindHsTyVars), and that messed up the singletons package.

I've made a completely different test case to show up the bug:
indexed_types/should_fail/T9160

I also refactored RdrName.LocalRdrEnv to be a record with named
fields, which makes the code more robust and easy to understand.

(cherry picked from commit b637585dcbfc1ba53aa49bcb9b730cd08fea4b59)

Conflicts:
	testsuite/tests/indexed-types/should_fail/all.T
Fix merge fallout, killing validate

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix T9160 under ./validate

Signed-off-by: Austin Seipp <austin@well-typed.com>
Control CPP through settings file (#8683)

Summary:
Allow the CPP program and flag choices for GHC
be configured via the the ghc settings file

Test Plan: ran validate yesterday

Reviewers: hvr, austin, mzero, simonmar

Reviewed By: austin, mzero, simonmar

Subscribers: mzero, simonmar, relrod, carter

Differential Revision: https://phabricator.haskell.org/D26

(cherry picked from commit 34f7e9a3c99850859901ca74370f55f1d4e2279a)
Remove extraneous debugging output (#9071)

(cherry picked from commit c44da48c6d19b3d8cc0ba34328576683410f8ec2)
Fix demand analyser for unboxed types

This is a tricky case exposed by Trac #9254.  I'm surprised it hasn't
shown up before, because it's happens when you use unsafePerformIO in
the right way.

Anyway, fixed now.  See Note [Analysing with absent demand]
in Demand.lhs

(cherry picked from commit d6ee82b29598dcc1028773dd987b7a2fb17519b7)
In TcValidity.checkAmbiguity, skolemise kind vars that appear free in the kinds of type variables

This was shown up by Trac #9222.

(cherry picked from commit 2be99d2309471bc75ddb9cb47acda9ccbcb7ab63)
Test Trac #9222

(cherry picked from commit 127c45ea30eaee6b5244b3f30aaa701d0ad327ac)

Conflicts:
	testsuite/tests/polykinds/all.T
Check for integer overflow in allocate() (#9172)

Summary: Check for integer overflow in allocate() (#9172)

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, relrod, carter

Differential Revision: https://phabricator.haskell.org/D36

(cherry picked from commit db64180896b395283f443d66a308048c605b217d)

Conflicts:
	testsuite/.gitignore
Fix #9085.

Inaccessible equations in a closed type family now leads to a
warning, not an error. This echoes what happens at the term level.

(cherry picked from commit 6a1d7f9736098d47463a71323d28ece792a59e52)
Test #9085.

(cherry picked from commit f502617065c8716a062c83fc923c3b3a2395c4a8)
Mark T9208 as broken when debugging is on

this seems to be expected, as explained by SPJ in comment 7 of #9208.

(cherry picked from commit 518ada5cda08d3256826ed0383888111f8096de5)
Comment the expect_broken for Trac #9208

(cherry picked from commit 8a0aa198f78cac1ca8d0695bd711778e8ad086aa)
Lint should check that TyConAppCo doesn't have a synonym in the tycon position

That is why Lint didn't nail Trac #9102

(cherry picked from commit 4cfc1fae11ec9a5c4b34ac747f0ce50f52423eba)
Fix invariant in mkAppCoFlexible

mkAppCoFlexible was breaking the invariant that the head of a TyConAppCo cannot
be a type synonym.  This small patch fixes it.

(cherry picked from commit 21f17d06aa5c33e639f1b0d37b4bf888b494c441)