Opened 6 years ago

Closed 4 years ago

Last modified 18 months ago

#8853 closed bug (duplicate)

Surprising mention of unboxed integers in pattern exhaustiveness warning

Reported by: MikolajKonarski Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.1-rc2
Keywords: PatternMatchWarnings Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by thomie)

The attached code produces this alarming warning:

~/waste$ ghc -Wall --make AlarmingPattern.hs -fforce-recomp
[1 of 1] Compiling Main             ( AlarmingPattern.hs, AlarmingPattern.o )

AlarmingPattern.hs:6:7: Warning:
    Pattern match(es) are non-exhaustive
    In an equation for ‘takeFromInv’:
        Patterns not matched:
            (GHC.Types.I# _) (GHC.Types.I# (#x)) with #x `notElem` [0#]
Linking AlarmingPattern ...

The error message is alarming because it refers to unboxed integers, but the source code does not.

Attachments (1)

AlarmingPattern.hs (172 bytes) - added by MikolajKonarski 6 years ago.

Download all attachments as: .zip

Change History (9)

Changed 6 years ago by MikolajKonarski

Attachment: AlarmingPattern.hs added

comment:1 Changed 6 years ago by nomeata

Is the bug about the compiler message, or the behaviour at run-time (which looks correct to me)?

comment:2 Changed 6 years ago by MikolajKonarski

Runtime is OK. Probably the message is OK, too (I gave up trying to understand it, though:), just alarming.

BTW, sorry for the bad formatting.

comment:3 Changed 6 years ago by ezyang

Description: modified (diff)

comment:4 Changed 6 years ago by ezyang

To be clear, the error message is alarming because it refers to unboxed integers, but the source code does not.

comment:5 Changed 6 years ago by nomeata

Summary: Alarming looking warning about non-exhaustive patternSurprising mention of unboxed integers in pattern exhaustiveness warning

To be clear, the error message is alarming because it refers to unboxed integers, but the source code does not.

Ok, that was my guess as well, adjusting ticket title (unfortunately, I can’t change the ticket body to remove the distracting runtime output).

I agree that the compiler would ideally not talk about unboxed integers if the code is not.

comment:6 Changed 5 years ago by thomie

Description: modified (diff)

Reproducable with version 7.9.20140802. This ticket is listed on Status/SLPJ-Tickets.

Also reported as #2204.

Version 1, edited 5 years ago by thomie (previous) (next) (diff)

comment:7 Changed 4 years ago by thomie

Resolution: duplicate
Status: newclosed

Because the existence of duplicate tickets makes doing a BugSweep of the bug tracker more cumbersome, I'm closing these tickets as duplicate. Don't worry, they're still listed on PatternMatchCheck, and will hopefully all be addressed by the work on #595 ("Overhaul GHC's overlapping/non-exhaustive pattern checking").

comment:8 Changed 18 months ago by simonpj

Keywords: PatternMatchWarnings added
Note: See TracTickets for help on using tickets.