From bbdb6286854dca442ab2b6aeebc734cfb7e0bd9a Mon Sep 17 00:00:00 2001
From: Sylvain Henry <sylvain@haskus.fr>
Date: Fri, 1 Mar 2024 14:03:05 +0100
Subject: [PATCH] JS linker: filter unboxed tuples

---
 compiler/GHC/StgToJS/Utils.hs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/compiler/GHC/StgToJS/Utils.hs b/compiler/GHC/StgToJS/Utils.hs
index 7635b3a7783b..027e70f5aadd 100644
--- a/compiler/GHC/StgToJS/Utils.hs
+++ b/compiler/GHC/StgToJS/Utils.hs
@@ -341,10 +341,16 @@ collectIds unfloated b =
   in  seqList xs `seq` xs
   where
     acceptId i = all ($ i) [not . isForbidden] -- fixme test this: [isExported[isGlobalId, not.isForbidden]
-    -- the GHC.Prim module has no js source file
     isForbidden i
-      | Just m <- nameModule_maybe (getName i) = m == gHC_PRIM
-      | otherwise = False
+      -- the GHC.Prim module has no js source file
+      | Just m <- nameModule_maybe (getName i)
+      , m == gHC_PRIM
+      = True
+      -- unboxed tuples have no definition
+      | isUnboxedTupleDataConLikeName (getName i)
+      = True
+      | otherwise
+      = False
 
 -----------------------------------------------------
 -- Live vars
-- 
GitLab