#11329 closed bug (fixed)

Visible type applications: failing tests with WAY=hpc

Reported by: thomie Owned by: goldfire
Priority: high Milestone: 8.0.1
Component: Compiler Version: 7.11
Keywords: TypeApplications Cc: goldfire
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: parser/should_compile/VtaParse typecheck/should_compile/Vta1 typecheck/should_compile/Vta2 ghci/scripts/T11456
Blocked By: Blocking:
Related Tickets: #11456 Differential Rev(s): Phab:D1824
Wiki Page:

Description

$ ghc-head --info | grep Project
 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("Project version","8.1.20151231")
 ,("Project Git commit id","8afeaad919dc67643b4eff14efafb48b59039b2b")
$ make slowtest TEST='VtaParse Vta1 Vta2' VERBOSE=2 TEST_HC=ghc-head
...

=====> VtaParse(normal) 1 of 3 [0, 0, 0] 
=====> VtaParse(hpc) 1 of 3 [0, 0, 0] 
Compile failed (status 256) errors were:
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20151231 for x86_64-unknown-linux):
	dsExpr:HsTypeOut

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug


*** unexpected failure for VtaParse(hpc)
=====> VtaParse(optasm) 1 of 3 [0, 1, 0] 
=====> Vta1(normal) 2 of 3 [0, 1, 0] 
=====> Vta1(hpc) 2 of 3 [0, 1, 0] 
Compile failed (status 256) errors were:
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20151231 for x86_64-unknown-linux):
	dsExpr:HsTypeOut

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug


*** unexpected failure for Vta1(hpc)
=====> Vta1(optasm) 2 of 3 [0, 2, 0] 
=====> Vta2(normal) 3 of 3 [0, 2, 0] 
=====> Vta2(hpc) 3 of 3 [0, 2, 0] 
Compile failed (status 256) errors were:
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20151231 for x86_64-unknown-linux):
	dsExpr:HsTypeOut

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug


*** unexpected failure for Vta2(hpc)
=====> Vta2(optasm) 3 of 3 [0, 3, 0] 

Unexpected results from:
TEST="Vta1 Vta2 VtaParse"

Tests added in commit 2db18b8135335da2da9918b722699df684097be9.

Change History (13)

comment:1 Changed 23 months ago by thomie

Priority: normalhigh
Test Case: parser/should_compile/VtaParse typecheck/should_compile/Vta1 typecheck/should_compile/Vta2

Panic's are bad, raising priority.

comment:2 Changed 22 months ago by simonpj

Keywords: TypeApplications added

comment:3 Changed 22 months ago by bgamari

Priority: highhighest

Indeed, we really shouldn't release with hpc being broken, even if it is just with type applications.

comment:4 Changed 22 months ago by rwbarton

So in an expression like print @Double 3 the type argument is getting a tick, so that the ticked expression looks like tick print (tick @Double) (tick 3). Then dsExpr's HsApp case no longer recognizes the construction tick print (tick @Double) as a type application, due to the second tick, and later tries and fails to desugar the argument @Double.

One solution would be to look through ticks in isLHsTypeExpr, so that dsExpr's HsApp case would still recognize a type application even if there are ticks in it. That would be simple and the type argument is then thrown away at that point anyways. But maybe it's better not to introduce a tick around a type argument in the first place, since that makes no sense.

Coverage.addTickHsExpr has a case

addTickHsExpr e@(HsTypeOut _) = return e

but it doesn't work as intended because addTickHsExpr only controls what ticks are added to the body of an expression. Whether to add a tick around the whole expression is controlled by addTickLHsExpr and a number of similar functions.

I'm building a fix that recognizes type applications in addTickHsExpr and will post it on Phab when ready.

comment:5 Changed 22 months ago by rwbarton

Differential Rev(s): Phab:D1824

comment:6 Changed 22 months ago by Reid Barton <rwbarton@…>

In ec877886/ghc:

Don't add ticks around type applications (#11329)

Test Plan: validate --slow

Reviewers: austin, bgamari, goldfire

Reviewed By: goldfire

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1824

comment:7 Changed 22 months ago by simonpj

Owner: set to goldfire

comment:8 Changed 22 months ago by rwbarton

The status here is currently:

  • Visible type applications with -fhpc are fixed by the above patch for HEAD
  • Richard is looking into redesigning the representation of visible type applications in HsExpr, I believe. Not absolutely critical for 8.0, but for the sake of GHC API users, better to change HsExpr once, than now and again in 8.2.

comment:9 Changed 21 months ago by simonpj

Priority: highesthigh

Not a release blocker

comment:10 Changed 21 months ago by goldfire

comment:11 Changed 20 months ago by Richard Eisenberg <eir@…>

In 972730c/ghc:

Refactor visible type application.

This replaces the old HsType and HsTypeOut constructors
with HsAppType and HsAppTypeOut, leading to some simplification.
(This refactoring addresses #11329.)

This also fixes #11456, which stumbled over HsType (which is
not an expression).

test case: ghci/scripts/T11456

[skip ci]

comment:12 Changed 20 months ago by goldfire

Status: newmerge
Test Case: parser/should_compile/VtaParse typecheck/should_compile/Vta1 typecheck/should_compile/Vta2parser/should_compile/VtaParse typecheck/should_compile/Vta1 typecheck/should_compile/Vta2 ghci/scripts/T11456

comment:13 Changed 20 months ago by bgamari

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.