-
Notifications
You must be signed in to change notification settings - Fork 847
Closed
Description
Hi All,
Warning output is squelched when referring to external locations. Warning output is produced on the console when -Werror is present. The following pair of projects demonstrates the problem on the latest version of stack (1.1.2).
This pair of projects was produced and tested with the following sequence of actions.
Check your stack version.
$ stack --version
Version 1.1.2 x86_64 hpack-0.14.0
Create two new projects.
stack new stacktest
stack new stackdep
Edit the stack.yaml file in stacktest to match the following.
resolver: lts-6.14
packages:
- '.'
- location: ../stackdep
extra-deps: []
flags: {}
extra-package-dbs: []Edit src/Lib.hs in stacktest to match the following.
module Lib
( someFunc
) where
thisShouldGenerateAWarning = undefined
someFunc :: IO ()
someFunc = putStrLn "someFunc"Edit stacktest.cabal to resemble the following. Of note is the ghc-options line.
$ cat stacktest/stacktest.cabal
name: stacktest
version: 0.1.0.0
synopsis: Initial project template from stack
description: Please see README.md
homepage: https://github.com/sw17ch/stacktest#readme
license: BSD3
license-file: LICENSE
author: John Van Enk
maintainer: [email protected]
copyright: 2016 John Van Enk
category: Web
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
library
hs-source-dirs: src
exposed-modules: Lib
build-depends: base >= 4.7 && < 5
default-language: Haskell2010
ghc-options: -WallEXPECTED: two warnings in the build output of src/Lib.hs when building stacktest.
/Users/johnvanenk/STACK_TEST/stacktest/src/Lib.hs:5:1: Warning:
Defined but not used: ‘thisShouldGenerateAWarning’
/Users/johnvanenk/STACK_TEST/stacktest/src/Lib.hs:5:1: Warning:
Top-level binding with no type signature:
thisShouldGenerateAWarning :: forall t. t
ACTUAL: no warning output is emitted.
$ stack build
stackdep-0.1.0.0: unregistering (local file changes: src/StackDep.hs stackdep.cabal)
stacktest-0.1.0.0: configure
stacktest-0.1.0.0: build
stackdep-0.1.0.0: configure
stacktest-0.1.0.0: copy/register
stackdep-0.1.0.0: build
stackdep-0.1.0.0: copy/register
Completed 2 action(s).
Further notes.
The warnings are still present in the log files, but no indications that warnings exist in the build are present on the console.
$ grep -Irn Warning .
./.stack-work/logs/stacktest-0.1.0.0.log:5:src/Lib.hs:5:1: Warning:
./.stack-work/logs/stacktest-0.1.0.0.log:6: Defined but not used: ‘thisShouldGenerateAWarning’
./.stack-work/logs/stacktest-0.1.0.0.log:8:src/Lib.hs:5:1: Warning:
./.stack-work/logs/stacktest-0.1.0.0.log:10: thisShouldGenerateAWarning :: forall t. t
Furthermore, turning on -Werror produces the warning output as expected, but is sometimes awkward when doing large refactors.
This behavior does not appear to exist when using extra-deps without a package in some other location as specified by a location directive.
Blaisorblade and reiddraper