From: Matthijs Kooijman Date: Wed, 19 Aug 2009 14:38:35 +0000 (+0200) Subject: Don't error on type abstraction when cloning binders. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fc%CE%BBash.git;a=commitdiff_plain;h=9b378bd9c8ea179ce0459fef9b362002f90dbc98 Don't error on type abstraction when cloning binders. Since we might encounter type abstractions before normalizations, the old behaviour broke on polymorphic functions (Though type arguments would have been propagated, there would still be type abstractions directly applied to the propagated types). Note that this not actually clones the type variables, it just leaves them untouched. Since we should never introduce new type variables, this should _probably_ work out... --- diff --git "a/c\316\273ash/CLasH/Utils/Core/CoreTools.hs" "b/c\316\273ash/CLasH/Utils/Core/CoreTools.hs" index cd85b4d..bfe3971 100644 --- "a/c\316\273ash/CLasH/Utils/Core/CoreTools.hs" +++ "b/c\316\273ash/CLasH/Utils/Core/CoreTools.hs" @@ -361,8 +361,8 @@ genUniques' subst (CoreSyn.App f arg) = do f' <- genUniques' subst f arg' <- genUniques' subst arg return (CoreSyn.App f' arg') -genUniques' subst (CoreSyn.Lam bndr res) | CoreSyn.isTyVar bndr = - error $ "Cloning type variables not supported!" +-- Don't change type abstractions +genUniques' subst expr@(CoreSyn.Lam bndr res) | CoreSyn.isTyVar bndr = return expr genUniques' subst (CoreSyn.Lam bndr res) = do -- Generate a new unique for the bound variable (subst', bndr') <- genUnique subst bndr