Opened 4 years ago

Closed 8 months 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 Revisions:

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 4 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 4 years ago by igloo

  • Milestone set to 7.6.1
  • Owner set to igloo

comment:3 Changed 3 years ago by igloo

  • Milestone changed from 7.6.1 to 7.6.2

comment:4 Changed 3 years ago by igloo

  • Description modified (diff)
  • difficulty set to Unknown

comment:5 Changed 2 years ago by igloo

  • Owner igloo deleted

comment:6 Changed 13 months ago by thoughtpolice

  • Milestone changed from 7.6.2 to 7.10.1

Moving to 7.10.1.

comment:7 Changed 12 months ago by thomie

  • Description modified (diff)

comment:8 Changed 8 months ago by thomie

  • Milestone 7.10.1 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

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

Note: See TracTickets for help on using tickets.