JS: restore warning for foreign javascript imports
In head (and probably 9.6), we don't check that foreign javascript imports are supported by the platform.
Test:
module Lib where
foreign import javascript foo :: IO ()
Before:
❯ ghc-9.4 Lib.hs
[1 of 1] Compiling Lib ( Lib.hs, Lib.o )
Lib.hs:3:1: error:
• The `javascript' calling convention is unsupported on this platform
• When checking declaration:
foreign import javascript safe foo :: IO ()
|
3 | foreign import javascript foo :: IO ()
|
After:
❯ ghc-master Lib.hs -fforce-recomp -ddump-simpl -dno-typeable-binds
[1 of 1] Compiling Lib ( Lib.hs, Lib.o )
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 9, types: 15, coercions: 3, joins: 0/0}
-- RHS size: {terms: 8, types: 13, coercions: 3, joins: 0/0}
foo :: IO ()
[GblId, Arity=1, Unf=OtherCon []]
foo
= (\ (ds_dCN :: GHC.Prim.State# GHC.Prim.RealWorld) ->
case {__ffi_static_ccall_safe main:foo :: State# RealWorld
-> (# State# RealWorld #)}_dCO
ds_dCN
of
{ (# ds1_dCM #) ->
(# ds1_dCM, GHC.Tuple.Prim.() #)
})
`cast` (Sym (GHC.Types.N:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())
We've probably removed the check by mistake when we've introduced the JS backend.