let/app invariant violated by code generated with mkCoreApp

Dr. ERDI Gergo gergo at erdi.hu
Sat Nov 8 14:02:42 UTC 2014


Hi,

I'm trying to attach (f Void#) as a compulsory unfolding to an Id. Here's 
what I tried originally:

     let unfolding = mkCoreApp (Var worker_id) (Var voidPrimId)
         wrapper_id' = setIdUnfolding wrapper_id $ mkCompulsoryUnfolding unfolding

However, when I try to use wrapper_id' in the desugarer, the Core linter 
looks at me strange. This is the original Core:

f :: Int
[LclIdX, Str=DmdType]
f = break<1>() GHC.Types.I# Main.$WPAT

and this is the error message ($WPAT is the wrapper_id', PAT is the 
worker_id in this example)

<no location info>: Warning:
     In the expression: I# (PAT void#)
     This argument does not satisfy the let/app invariant: PAT void#

Now, I thought I'd make sure mkCoreApp generated correct Core by writing 
it out by hand:

     let unfolding = Case (Var voidPrimId) voidArgId pat_ty [(DEFAULT,[],App (Var worker_id) (Var voidArgId))]

however, bizarrely, this *still* results in *the same* error message, as 
if something was transforming it back to a straight App.

Anyone have any hints what I'm doing wrong here?

Bye,
 	Gergo

-- 

   .--= ULLA! =-----------------.
    \     http://gergo.erdi.hu   \
     `---= gergo at erdi.hu =-------'
You are in a twisty maze of little install diskettes.


More information about the ghc-devs mailing list