Fix exprIsConApp_maybe

Authored by simonpj on Feb 21 2019, 6:03 AM.

Description

Fix exprIsConApp_maybe

In this commit

commit 7833cf407d1f608bebb1d38bb99d3035d8d735e6
Date:   Thu Jan 24 17:58:50 2019 +0100
   Look through newtype wrappers (Trac #16254)

we made exprIsConApp_maybe quite a bit cleverer. But I had not paid
enough attention to keeping exactly the correct substitution and
in-scope set, which led to Trac Trac #16348.

There were several buglets (like applying the substitution twice in
exprIsConApp_maybe, but the proximate source of the bug was that we were
calling addNewInScopeIds, which deleted things from the substitution as
well as adding them to the in-scope set. That's usually right, but not
here!

This was quite tricky to track down. But it is nicer now.

Details

Committed
mpickeringFeb 22 2019, 12:56 AM
Parents
rGHC0eb7cf03da37: Don't do binder-swap for GlobalIds
Branches
Unknown
Tags
Unknown