Opened 3 years ago

Last modified 3 years ago

#13821 new bug

bindings for unlifted types are allowed in .hs-boot files and .hsig files

Reported by: duog Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.2.1-rc2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC accepts invalid program Test Case: typecheck/should_fail/T13821
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The following module compiles without error.

{-# LANGUAGE MagicHash -#}
module A where
import GHC.Prim
x :: Int#
ghc -c A.hs-boot

I would expect to get a "Top-level unlifted bindings are not allowed." error, as I would with a .hs module.


{-# LANGUAGE MagicHash #-}
unit U where
  signature A where
    import GHC.Prim

    x :: Int#
ghc --backpack -fno-code -fwrite-interface A.hsig

succeeds, where I would expect the same error.

This error is thrown during desugaring, and .hs-boot and .hsig files are not desugared.

Change History (2)

comment:1 Changed 3 years ago by bgamari

Test Case: typecheck/should_fail/T13821

Desugaring does seem like a strange time to perform this check.

comment:2 Changed 3 years ago by Ben Gamari <ben@…>

In 271e0f0/ghc:

Add test cases for #13821

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13821

Differential Revision:
Note: See TracTickets for help on using tickets.