#15520 closed bug (invalid)

Invalid warning Defined but not used

Reported by: rik Owned by:
Priority: normal Milestone: 8.6.1
Component: Compiler Version: 8.4.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

This code gives warning:

Defined but not used: data constructor ‘:+++’

data U = Text :+++ Text

x :: U
x = "ss" :+++ "ss"

Also In prefix notation .

Change History (7)

comment:1 Changed 13 months ago by RyanGlScott

Status: newinfoneeded

I'm unable to reproduce the warning you're seeing, but that's only because you've posted an incomplete program (which doesn't compile). What is the export list you're using here?

comment:2 Changed 13 months ago by rik

I do not export the data constructor. The export list only contains other identifiers.

comment:3 Changed 13 months ago by RyanGlScott

Do you export x? I can get the warning you claim with this program, which does not export x, for instance:

{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS -Wunused-top-binds #-}
module Foo (U) where

import Data.Text (Text)

data U = Text :+++ Text

x :: U
x = "ss" :+++ "ss"

However, this is correct behavior, since x is not used anywhere (and therefore :+++ is transitively not used), so I'm still not sure what the bug is.

comment:4 Changed 13 months ago by rik

Sorry for the delay.

Complete program:

{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Test(exported) where

import Protolude

data U = Text :+++ Text

x :: U
x = "ss" :+++ "ss"


exported :: Bool
exported = True

Gives warnings:

Test.hs:7:10: warning: [-Wunused-top-binds]
    Defined but not used: data constructor ‘:+++’
  |
7 | data U = Text :+++ Text
  |          ^^^^^^^^^^^^^^

Test.hs:10:1: warning: [-Wunused-top-binds]
    Defined but not used: ‘x’
   |
10 | x = "ss" :+++ "ss"
   | ^
Ok, one module loaded.

I understand from x but not from :+++

Last edited 13 months ago by rik (previous) (diff)

comment:5 Changed 13 months ago by rik

Last edited 13 months ago by rik (previous) (diff)

comment:6 Changed 13 months ago by rik

Okay, sorry, this issue can be closed.

Sorry for wasting your time.

comment:7 Changed 13 months ago by RyanGlScott

Resolution: invalid
Status: infoneededclosed
Note: See TracTickets for help on using tickets.