[Git][ghc/ghc][wip/andreask/stgLintFix] Apply 4 suggestion(s) to 1 file(s)

Andreas Klebinger (@AndreasK) gitlab at gitlab.haskell.org
Wed Sep 21 18:47:53 UTC 2022



Andreas Klebinger pushed to branch wip/andreask/stgLintFix at Glasgow Haskell Compiler / GHC


Commits:
43dfbafb by sheaf at 2022-09-21T18:47:51+00:00
Apply 4 suggestion(s) to 1 file(s)
- - - - -


1 changed file:

- compiler/GHC/Stg/Lint.hs


Changes:

=====================================
compiler/GHC/Stg/Lint.hs
=====================================
@@ -56,7 +56,7 @@ After unarisation, a single type might correspond to multiple arguments, e.g.
 
 will result in two arguments: [Int# :: TYPE 'IntRep, Bool :: TYPE LiftedRep]
 This means post unarise we potentially have to match up multiple arguments with
-the reps of a signle argument in the types definitions. Because the type of the function
+the reps of a single argument in the type's definition, because the type of the function
 is *not* in unarised form.
 
 Wrinkle: it can sometimes happen that an argument type in the type of
@@ -366,18 +366,17 @@ lintStgAppReps fun args = do
 
         -- Some reps are compatible *even* if they are not the same. E.g. IntRep and WordRep.
         -- We check for that here with primRepCompatible
-        | length actual_rep == length expected_rep
-        -- We can use zipWith since functions are allowed to be over/under saturated.
-        , and $ zipWith (primRepCompatible platform) actual_rep expected_rep
+        | primRepsCompatible platform actual_rep expected_rep
         = match_args actual_reps_left expected_reps_left
 
         -- Post unarise we might distribute args from within one unboxed sum over multiple single rep args.
         -- This means we might need to match up things like:
         -- [Just [WordRep, LiftedRep]] with [Just [WordRep],Just [LiftedRep]] which we do here.
+        -- See Note [Linting StgApp].
         | lf_unarised lf
         , Just (actual,actuals) <- getOneRep actual_rep actual_reps_left
         , Just (expected,expecteds) <- getOneRep expected_rep expected_reps_left
-        , (primRepCompatible platform) actual expected
+        , primRepCompatible platform actual expected
         = match_args actuals expecteds
 
         | otherwise = addErrL $ hang (text "Function type reps and function argument reps mismatched") 2 $



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/43dfbafb1453cc051595773339c5862666650856

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/43dfbafb1453cc051595773339c5862666650856
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220921/2471d5b1/attachment-0001.html>


More information about the ghc-commits mailing list