Opened 6 years ago

Closed 3 years ago

#5401 closed bug (duplicate)

LANGUAGE pragma parser nit

Reported by: nwf Owned by:
Priority: normal Milestone:
Component: Compiler (Parser) Version: 7.0.3
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: GHC rejects valid program Test Case:
Blocked By: Blocking:
Related Tickets: #3645 Differential Rev(s):
Wiki Page:

Description (last modified by thomie)

Language pragmas like

{-# LANGUAGE 
    TypeOperators,
    FlexibleContexts #-}

or

{-# LANGUAGE 
    TypeOperators,
    FlexibleContexts
  #-}

parse just fine but

{-# LANGUAGE 
    TypeOperators,
    FlexibleContexts
#-}

doesn't (note the missing spaces before the closing #-}), saying:

    Cannot parse LANGUAGE pragma
    Expecting comma-separated list of language options,
    each starting with a capital letter

An OPTIONS_GHC pragma, on the other hand, accepts either format without complaint.

Change History (8)

comment:1 Changed 6 years ago by daniel.is.fischer

The user's guide says

The layout rule applies in pragmas, so the closing #-} should start in a column to the right of the opening {-#.

The language report doesn't mention any such restrictions though, so perhaps it should be listed in Bugs and infelicities (supposing the parse can't easily be changed to accept the #-} anywhere).

comment:2 Changed 6 years ago by igloo

Milestone: 7.6.1
Owner: set to igloo

comment:3 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

comment:4 Changed 5 years ago by igloo

Description: modified (diff)
difficulty: Unknown

comment:5 Changed 4 years ago by igloo

Owner: igloo deleted

comment:6 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:7 Changed 3 years ago by thomie

Description: modified (diff)

comment:8 Changed 3 years ago by thomie

Milestone: 7.10.1
Resolution: duplicate
Status: newclosed

This is a duplicate of #3645. That ticket has more discussion already.

Note: See TracTickets for help on using tickets.