should-not-typecheck icon indicating copy to clipboard operation
should-not-typecheck copied to clipboard

shouldNotTypecheck not catching some deferred type errors

Open rampion opened this issue 7 years ago • 0 comments

I've found some cases where shouldNotTypecheck fails to capture the deferred type errors. The full error is documented here, but in short, what seems to be happening is:

  • I've got an expression fromNatSingToZ (SuccSing ZeroSing) :: Z 'Zero that fails to typecheck due to a missing instance - shouldNotTypecheck does capture the deferred type error.

  • when I pass that expression to a function fromZToF (fromNatSingToZ (SuccSing ZeroSing)) where fromZToF :: Z 'Zero -> F, shouldNotTypecheck does not capture the deferred type error. It suggests I make sure the expression has a NFData instance, which F does.

There's some other weird behaviour going on:

  • if I rename fromNatSingToZ to toZ, shouldNotTypecheck does capture the deferred type error above, but doesn't capture the deferred type error thrown by fromNatSingToF (SuccSing ZeroSing)) where fromNatSingToF = fromZToF . fromNatSingToZ
  • if I rename the type F to X or G, all the above deferred type errors are captured
  • if I move the module that defines the test from Data/BugSpec.hs to BugSpec.hs, all the above deferred type errors are captured.

rampion avatar May 12 '17 16:05 rampion