Skip to content

Fix a shadowing issue in StgUnarise.

Andreas Klebinger requested to merge wip/andreask/fix_unarise into master
Fix a shadowing issue in StgUnarise.

For I assume performance reasons we don't record no-op replacements
during unarise. This lead to problems with code like this:

    f = \(Eta_B0 :: VoidType) x1 x2 ->
       ... let foo = \(Eta_B0 :: LiftedType) -> g x y Eta_B0
           in ...

Here we would record the outer Eta_B0 as void rep, but would not
shadow Eta_B0 inside `foo` because this arg is single-rep and so
doesn't need to replaced. But this means when looking at occurence
sites we would check the env and assume it's void rep based on the
entry we made for the (no longer in scope) outer `Eta_B0`.

Fixes #21396 and the ticket has a few more details.

I've also added a lint check for runtime rep missmatches between
functions and their applied arguments in StgLint to catch such errors
easier in the future hopefully.

Merge request reports