[GHC] #15242: Typechecker sometimes doesn't preserve HsPar in original source.
#15242: Typechecker sometimes doesn't preserve HsPar in original source. -------------------------------------+------------------------------------- Reporter: wz1000 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The typechecker doesn't preserve parenthesis that occur at the head of applications. This results in some weird SrcSpans in the TypecheckedSource For example, given code {{{#!hs foo a b c = (bar a) b c }}} The typechecker will emit an HsApp with head spanning over `bar a) b` and tail spanning over `c`. Notice that the opening parenthesis is not included. On the other hand, the renamer will generate the expected SrcSpans that always include both parenthesis, or neither. This becomes an issue when you want to associate RenamedSource with its corresponding TypecheckedSource, as the SrcSpans no longer match and overlap partially. This occurs due to this line in TcExpr.hs {{{#!hs tcApp m_herald (L _ (HsPar _ fun)) args res_ty = tcApp m_herald fun args res_ty }}} I have a work in progress fix here: https://github.com/wz1000/ghc/commit/3b6db5a35dc8677a7187e349a85ffd51f452452... -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15242> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15242: Typechecker sometimes doesn't preserve HsPar in original source. -------------------------------------+------------------------------------- Reporter: wz1000 | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.5 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: T15242 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D4822 Wiki Page: | -------------------------------------+------------------------------------- Changes (by wz1000): * status: new => patch * testcase: => T15242 * differential: => D4822 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15242#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15242: Typechecker sometimes doesn't preserve HsPar in original source. -------------------------------------+------------------------------------- Reporter: wz1000 | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.5 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: T15242 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4822 Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * differential: D4822 => Phab:D4822 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15242#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15242: Typechecker sometimes doesn't preserve HsPar in original source. -------------------------------------+------------------------------------- Reporter: wz1000 | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.5 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: T15242 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4822 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"aab3c6d18416b3bc8e1378dfc4d485a9307ca5c7/ghc" aab3c6d/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="aab3c6d18416b3bc8e1378dfc4d485a9307ca5c7" Refactor TcExpr.tcSeq The function TcExpr.tcSeq seemed much longer that is really justifiable; and was set to get worse with the fix to Trac #15242. This patch refactors the special cases for function applications, so that the special case for 'seq' can use the regular tcFunApp, which makes the code both clearer and shorter. And smooths the way for #15242. The special case for 'tagToEnum#' is even more weird and ad-hoc, so I refrained from meddling iwth it for now. I also combined HsUtils.mkHsAppType and mkHsAppTypeOut, so that I could have a single 'wrapHsArgs' function, thereby fixing a ToDo from Alan Zimmerman. That means tha tmkHsAppType now has an equality predicate, but I guess that's fair enough. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15242#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15242: Typechecker sometimes doesn't preserve HsPar in original source. -------------------------------------+------------------------------------- Reporter: wz1000 | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler (Type | Version: 8.5 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: T15242 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4822 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"cd95c2ffdc5143acd3ae341ff6a19fc603b98db3/ghc" cd95c2ff/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="cd95c2ffdc5143acd3ae341ff6a19fc603b98db3" Preserve parenthesis in function application in typechecker Preserve HsPars while typechecking Test Plan: T15242 Reviewers: bgamari, alanz, simonpj Reviewed By: alanz, simonpj Subscribers: simonpj, AndreasK, rwbarton, thomie, carter GHC Trac Issues: #15242 Differential Revision: https://phabricator.haskell.org/D4822 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15242#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#15242: Typechecker sometimes doesn't preserve HsPar in original source. -------------------------------------+------------------------------------- Reporter: wz1000 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.5 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: T15242 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4822 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.6.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15242#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC