Ticket #1 (closed bug report: fixed)

Opened 5 years ago

Last modified 5 years ago

Empty instance definitions don't parse

Reported by: NeilMitchell Owned by: nibro
Priority: major Milestone: Full code support
Component: parser Version:
Keywords: Cc:


Parse error on:

instance Traversable Tree where

x :: Int
x = 4

Originally reported as a HLint bug at http://code.google.com/p/ndmitchell/issues/detail?id=156

Change History

Changed 5 years ago by nibro

  • owner changed from somebody to nibro
  • milestone set to Full code support

Changed 5 years ago by nicolas.pouillard@…

Removing the 'where' keyword is an easy workaround, right?

Changed 5 years ago by nibro

Indeed, haskell-src-exts would handle an empty instance or class declaration that doesn't end in 'where'. But as adding the where is apparently allowed (and reportedly even means a slightly different thing semantically) then haskell-src-exts should naturally be able to parse it correctly.

It's a bit messy though, since it means a special case that the AST must record whether the where was given or not.

Changed 5 years ago by nibro

As an update, I've looked into this but I don't immediately realize what goes wrong. If the empty instance declaration is the last thing in the document, the parse succeeds. So this seems to be something of a layout problem, which will be a bit tricky to fix. I'll keep digging.

Changed 5 years ago by nibro

  • status changed from new to closed
  • resolution set to fixed

By far the trickiest bug so far. There was an error in the old haskell-src code that failed to insert a virtual close brace when the new layout context was not to the right of the parent context (meaning the new context had to be empty). But it's fixed now! Case closed.

Note: See TracTickets for help on using tickets.