[GHC] #12092: Wrong error message with TypeApplications

#12092: Wrong error message with TypeApplications -------------------------------------+------------------------------------- Reporter: kwf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When I write the following: {{{#!hs {-# language TypeApplications #-} module Bug where huh = spam @Int }}} I expect to get the error: {{{ • Variable not in scope: spam • Perhaps you meant ‘span’ (imported from Prelude) }}} But instead, I get the error: {{{ • Cannot apply expression of type ‘t0’ to a visible type argument ‘Int’ • In the expression: spam @Int In an equation for ‘huh’: huh = spam @Int }}} While it is //technically// true that I cannot apply an out-of-scope identifier to a visible type argument, this is probably the less useful error to receive. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12092 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12092: Wrong error message with TypeApplications -------------------------------------+------------------------------------- Reporter: kwf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): This is actually representative of a class of suboptimal errors that I've seen while working with GHC 8, in that an out-of-scope identifier can cause a cascade of obscure type errors. Perhaps we should prioritize out- of-scope identifiers above other type errors. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12092#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12092: Out-of-scope variable leads to type error, not scope error -------------------------------------+------------------------------------- Reporter: kwf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): Changing the description of the ticket so that it doesn't look like my fault. :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12092#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12092: Out-of-scope variable leads to type error, not scope error -------------------------------------+------------------------------------- Reporter: kwf | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Keywords: Resolution: fixed | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #13834 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * keywords: => TypeApplications * resolution: => fixed * related: => #13834 Comment: In GHC 8.4, you do in fact get a "Variable not in scope" error: {{{ Bug.hs:5:7: error: • Variable not in scope: spam • Perhaps you meant ‘span’ (imported from Prelude) | 5 | huh = spam @Int | ^^^^ Bug.hs:5:7: error: • Cannot apply expression of type ‘t1’ to a visible type argument ‘Int’ • In the expression: spam @Int In an equation for ‘huh’: huh = spam @Int | 5 | huh = spam @Int | ^^^^^^^^^ }}} Of course, there's still the issue that the second part of the error message still appears. But that is the subject of #13834, so I'll close this ticket in favor of that one. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12092#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12092: Out-of-scope variable leads to type error, not scope error -------------------------------------+------------------------------------- Reporter: kwf | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Keywords: Resolution: fixed | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #13834 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dbaynard): I'm seeing this on 8.6.3 (even with `-fno-defer-type-errors`). Note: my ghc install is managed by stack. == Without application {{{
cat type-app-err.hs {-# LANGUAGE TypeApplications #-}
module Bug where huh = spam
ghc -fno-defer-type-errors type-app-err 16:19:10 [1 of 1] Compiling Bug ( type-app-err.hs, type-app-err.o )
type-app-err.hs:5:7: error: • Variable not in scope: spam • Perhaps you meant ‘span’ (imported from Prelude) | 5 | huh = spam | ^^^^ }}} == Without application {{{
cat type-app-err.hs {-# LANGUAGE TypeApplications #-}
module Bug where huh = spam @Int
ghc -fno-defer-type-errors type-app-err 16:19:18 [1 of 1] Compiling Bug ( type-app-err.hs, type-app-err.o )
type-app-err.hs:5:7: error: • Cannot apply expression of type ‘t1’ to a visible type argument ‘Int’ • In the expression: spam @Int In an equation for ‘huh’: huh = spam @Int | 5 | huh = spam @Int | ^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12092#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12092: Out-of-scope variable leads to type error, not scope error -------------------------------------+------------------------------------- Reporter: kwf | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Keywords: Resolution: fixed | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #13834 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Oh dear, that is a good observation. It seems that this has regressed at some point between 8.4 and 8.6. Since #13834 is basically the same issue, let's move the discussion about this problem to there. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12092#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC