Opened 10 years ago

Closed 18 months ago

#2260 closed bug (duplicate)

Non-ideal error message for misplaced LANGUAGE pragma

Reported by: TomMD Owned by:
Priority: lowest Milestone:
Component: Compiler (Parser) Version: 6.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: #12002 Differential Rev(s):
Wiki Page:

Description

Placing the LANGUAGE pragma anywhere besides the top results in it not being accepted - thus this should result in an error message.

Trivially:

import Data.Maybe

{-# LANGUAGE EmptyDataDecls #-}

data A

This would be minorly more annoying for TypeFamilies, who's error doesn't mention language extentions: "Data/Queue.hs:30:0: parse error (possibly incorrect indentation)"

Attachments (2)

T2260.hs (59 bytes) - added by morabbin 5 years ago.
T2260_2.hs (86 bytes) - added by shelarcy 5 years ago.
Use Haskell 98 to show problem

Download all attachments as: .zip

Change History (22)

comment:1 Changed 9 years ago by igloo

difficulty: Unknown
Milestone: 6.10 branch

That's a good idea, although sadly not quite as easy to implement right as you might imagine.

comment:2 Changed 9 years ago by simonmar

Architecture: MultipleUnknown/Multiple

comment:3 Changed 9 years ago by simonmar

Operating System: MultipleUnknown/Multiple

comment:4 Changed 9 years ago by igloo

Milestone: 6.10 branch6.12 branch

comment:5 Changed 8 years ago by igloo

Milestone: 6.12 branch6.12.3

comment:6 Changed 7 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:7 Changed 7 years ago by igloo

Milestone: 7.0.17.0.2

comment:8 Changed 7 years ago by igloo

Milestone: 7.0.27.2.1

comment:9 Changed 6 years ago by igloo

Milestone: 7.2.17.4.1

comment:10 Changed 6 years ago by igloo

Milestone: 7.4.17.6.1
Priority: lowlowest

comment:11 Changed 5 years ago by igloo

Milestone: 7.6.17.6.2

Changed 5 years ago by morabbin

Attachment: T2260.hs added

comment:12 Changed 5 years ago by morabbin

Type of failure: None/Unknown

Not a problem any more?

Orac:~/work/ghc $ ghci T2260.hs 
GHCi, version 7.6.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( T2260.hs, interpreted )
Ok, modules loaded: Main.
*Main> :q
Leaving GHCi.

Changed 5 years ago by shelarcy

Attachment: T2260_2.hs added

Use Haskell 98 to show problem

comment:13 Changed 5 years ago by shelarcy

GHC 7.x hide T2260.hs' problem. Because GHC 7.0.1 or higher uses Haskell 2010 in default, and Haskell 2010 supports EmptyDataDecls.

We should use Haskell98 to check this ticket's problem.

$ghci T2260.hs -XHaskell98
GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( T2260.hs, interpreted )

T2260.hs:5:1:
    `A' has no constructors (-XEmptyDataDecls permits this)
    In the data type declaration for `A'
Failed, modules loaded: none.
Prelude> :q
Leaving GHCi.
$ ghci T2260_2.hs
GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( T2260_2.hs, interpreted )

T2260_2.hs:6:1:
    `A' has no constructors (-XEmptyDataDecls permits this)
    In the data type declaration for `A'
Failed, modules loaded: none.
Prelude> :q
Leaving GHCi.

comment:14 Changed 3 years ago by thoughtpolice

Milestone: 7.6.27.10.1

Moving to 7.10.1.

comment:15 Changed 3 years ago by thomie

Type of failure: None/UnknownIncorrect warning at compile-time

comment:16 Changed 3 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:17 Changed 3 years ago by thoughtpolice

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:18 Changed 2 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:19 Changed 22 months ago by thomie

Milestone: 8.0.1

comment:20 Changed 18 months ago by thomie

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.