[GHC] #13568: Name is reported as ambiguous and not in scope
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{ module A where data T = A }}} {{{ module B where import A data S = A foo :: A -> () foo = undefined }}} Compiling this example, the usage of `A` in `foo` is reported as both ambiguous and out of scope. I haven't mentioned data kinds at all so `A` should certainly refer to a type constructor which isn't in scope. The problem is that `DataKinds` is checked too late in `lookup_demoted`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * owner: (none) => mpickering -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D3457 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mrkgnao): * differential: => D3457 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D3547 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mrkgnao): * differential: D3457 => D3547 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3547 Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * differential: D3547 => Phab:D3547 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3547 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"1381c142cd8d030f9997cdc206dcad006c028bbb/ghc" 1381c142/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1381c142cd8d030f9997cdc206dcad006c028bbb" Fix incorrect ambiguity error on identically-named data constructors Given multiple in-scope constructors with the same name, say `A`, and a function of type `A -> Int`, say, the compiler reports both a "type `A` is not in scope" and (incorrectly) an ambiguity error. The latter shouldn't be there if `DataKinds` isn't enabled. This issue was recommended to me by @mpickering as a suitable first task, and the fix was also outlined in the original Trac ticket. It involved a simple reordering of the steps taken in `lookup_demoted` in `RnEnv.hs`. The fix is to make the `DataKinds` check happen earlier, ensuring that the ambiguity check doesn't happen at all if we know the constructors couldn't have been promoted. Signed-off-by: Soham Chowdhury <chow.soham@gmail.com> Reviewers: mpickering, austin, bgamari Reviewed By: mpickering, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13568 Differential Revision: https://phabricator.haskell.org/D3547 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: bug | Status: merge Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3547 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => merge * milestone: => 8.2.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3547 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Fixed with 343cb32d0983f576d344a2d04a35c3fd6eecf2c5. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13568: Name is reported as ambiguous and not in scope -------------------------------------+------------------------------------- Reporter: mpickering | Owner: mpickering Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3547 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"ba46e63f3d6f7d0438a0262f6711f8a219c703bc/ghc" ba46e63f/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="ba46e63f3d6f7d0438a0262f6711f8a219c703bc" Fix #13948 by being pickier about when to suggest DataKinds Commit 343cb32d0983f576d344a2d04a35c3fd6eecf2c5 (#13568) made GHC a bit too cavalier in suggesting when data constructors are in scope (and suggesting the use of `DataKinds`). This tones down the suggestions so that `DataKinds` is only suggested if a data constructor of that name is actually in scope (previously, it would always suggest, even if it was out of scope). Fixes #13948. Test Plan: ./validate Reviewers: mpickering, austin, bgamari Reviewed By: mpickering Subscribers: rwbarton, thomie GHC Trac Issues: #13948 Differential Revision: https://phabricator.haskell.org/D3719 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13568#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC