[GHC] #13847: record construction accepts local unqualified name instead of qualified imported name
#13847: record construction accepts local unqualified name instead of qualified imported name -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC accepts Unknown/Multiple | invalid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Given {{{ module A where data A = A { foo :: () } deriving Show }}} the following code is accepted {{{ module Main where import qualified A foo = "foo" main = print $ A.A { foo = () } }}} albeit with a warning {{{ B.hs:4:16: warning: [-Wmissing-fields] • Fields of ‘A.A’ not initialised: foo }}} Indeed the `foo = ()` is type-checked as if it were `A.foo = ()` but the `foo` field is actually not assigned. Evaluation gives {{{ *Main> main A {foo = *** Exception: B.hs:4:16-31: Missing field in record construction foo }}} The code should be rejected outright? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13847> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13847: record construction accepts local unqualified name instead of qualified imported name -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): This is rejected by 7.10.3, but not by 8.0.2. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13847#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13847: record construction accepts local unqualified name instead of qualified imported name -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: adamgundry (added) Comment: This regression was introduced in b1884b0e62f62e3c0859515c4137124ab0c9560e (`Implement DuplicateRecordFields`). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13847#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13847: record construction accepts local unqualified name instead of qualified imported name -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by adamgundry): Mea culpa. I'll try to take a look at this at some point, but my spare cycles are desperately limited at the moment, so if someone else wants to jump in first then feel free. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13847#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13847: record construction accepts local unqualified name instead of qualified imported name -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * keywords: => ORF -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13847#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13847: record construction accepts local unqualified name instead of qualified imported name -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC accepts | Test Case: invalid program | rename/should_fail/T13847 Blocked By: | Blocking: Related Tickets: #13644 | Differential Rev(s): Phab:D3988 Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * testcase: => rename/should_fail/T13847 * status: new => patch * differential: => Phab:D3988 * related: => #13644 * milestone: => 8.4.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13847#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13847: record construction accepts local unqualified name instead of qualified imported name -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: ORF Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC accepts | Test Case: invalid program | rename/should_fail/T13847 Blocked By: | Blocking: Related Tickets: #13644 | Differential Rev(s): Phab:D3988 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"72b00c34c73ff6c63ee4928006b0cc60034a7638/ghc" 72b00c34/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="72b00c34c73ff6c63ee4928006b0cc60034a7638" Identify fields by selector when type-checking (fixes #13644) Test Plan: new test for #13847, and the test for #13644 now passes Reviewers: mpickering, austin, bgamari, simonpj Reviewed By: mpickering, simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13644, #13847 Differential Revision: https://phabricator.haskell.org/D3988 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13847#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13847: record construction accepts local unqualified name instead of qualified imported name -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: ORF Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC accepts | Test Case: invalid program | rename/should_fail/T13847 Blocked By: | Blocking: Related Tickets: #13644 | Differential Rev(s): Phab:D3988 Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13847#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC