From 9b378bd9c8ea179ce0459fef9b362002f90dbc98 Mon Sep 17 00:00:00 2001
From: Matthijs Kooijman <m.kooijman@student.utwente.nl>
Date: Wed, 19 Aug 2009 16:38:35 +0200
Subject: [PATCH] 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...
---
 "c\316\273ash/CLasH/Utils/Core/CoreTools.hs" | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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
-- 
2.30.2