Solve constraints from top-level groups sooner
This fixes #16980 (closed) by solving constraints sooner. Commit message:
Solve constraints from top-level groups sooner
Previously, all constraints from all top-level groups (as
separated by top-level splices) were lumped together and solved
at the end. This could leak metavariables to TH, though, and
that's bad. This patch solves each group's constraints before
running the next group's splice.
Fixes #16980
Test cases: th/T16980{,a}
An interesting fact is that we previously accepted this:
module T16980a where
default (Integer) -- just to be really explicit
x = 5 -- this should be an Integer
$(return [])
y :: Int
y = x -- this should be a type error; types cannot communicate across splices
Not any more! But that does mean that this is technically user-facing, as someone might have relied on the old behavior.