From d8d993f1d86a7a0cb5286b2a22d485d7d338db89 Mon Sep 17 00:00:00 2001 From: Sebastian Graf <sebastian.graf@kit.edu> Date: Wed, 17 May 2023 11:09:54 +0200 Subject: [PATCH] Disable tests RepPolyWrappedVar2 and RepPolyUnsafeCoerce1 in JS backend ... because those coerce between incompatible/unknown PrimReps. --- compiler/GHC/StgToJS/Utils.hs | 9 +++++++-- testsuite/tests/rep-poly/all.T | 11 +++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/compiler/GHC/StgToJS/Utils.hs b/compiler/GHC/StgToJS/Utils.hs index 92c6ae432765..bde3ea194673 100644 --- a/compiler/GHC/StgToJS/Utils.hs +++ b/compiler/GHC/StgToJS/Utils.hs @@ -91,8 +91,13 @@ assignToTypedExprs tes es = assignTypedExprs :: [TypedExpr] -> [TypedExpr] -> JStat assignTypedExprs tes es = - -- TODO: check primRep (typex_typ) here? - assignToTypedExprs tes (concatMap typex_expr es) + let prim_tes = concatMap typex_expr tes + prim_es = concatMap typex_expr es + -- extract the JExprs, effectively unarising a RuntimeRep thing to + -- multiple VarType-repped things (e.g., AddrRep takes two VarType-regs) + in assertPpr (equalLength prim_tes prim_es) + (ppr (map typex_typ tes) $$ ppr (map typex_typ es)) + (assignAllEqual prim_tes prim_es) assignToExprCtx :: ExprCtx -> [JExpr] -> JStat assignToExprCtx ctx es = assignToTypedExprs (ctxTarget ctx) es diff --git a/testsuite/tests/rep-poly/all.T b/testsuite/tests/rep-poly/all.T index ecc4b9d163d0..4515cf2bc742 100644 --- a/testsuite/tests/rep-poly/all.T +++ b/testsuite/tests/rep-poly/all.T @@ -91,10 +91,17 @@ test('RepPolyUnliftedDatatype', normal, compile, ['']) test('RepPolyUnliftedDatatype2', normal, compile, ['-O']) test('RepPolyUnliftedNewtype', normal, compile, ['-fno-warn-partial-type-signatures -fno-warn-deprecated-flags']) -test('RepPolyUnsafeCoerce1', normal, compile, ['']) +# js_skip: RepPolyUnsafeCoerce1 coerces from UnliftedRep to an unknown rep r +# for which the JS backend can't compute a PrimRep. +# Came up in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10088#note_499218 +# (or, rather when submitting to CI) +test('RepPolyUnsafeCoerce1', [js_skip], compile, ['']) test('RepPolyWildcardPattern', normal, compile_fail, ['']) test('RepPolyWrappedVar', normal, compile_fail, ['']) -test('RepPolyWrappedVar2', normal, compile, ['']) +# js_skip: RepPolyWrappedVar2 coerces from AddrRep to IntRep, which have +# different PrimReps in JS. +# Came up in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10088#note_499218 +test('RepPolyWrappedVar2', [js_skip], compile, ['']) test('UnliftedNewtypesCoerceFail', normal, compile_fail, ['']) test('UnliftedNewtypesLevityBinder', normal, compile_fail, ['']) -- GitLab