Skip to content

Adjust error message for trailing whitespace in as-pattern.

Jade requested to merge wip/T22524 into master

This patch changes the error-message for the error in patterns of the form foo x@ pattern = ... from

Foo.hs:4:6: error: [GHC-33856]
    Suffix occurrence of @. For an as-pattern, remove the leading whitespace.
  |
4 | foo x@ pattern = ()
  |      ^ 

to

/home/jade/Foo.hs:4:7: error: [GHC-33856]
    The symbol '@' occurs as a suffix.
    For an as-pattern, there must not be any whitespace surrounding '@'.
  |
4 | foo x@ pattern = ()
  |       ^

That is, a more informative (and more correct) message, as well as highlighting the actual problem, namely the whitespace which is in question. This also works for more whitespace than one character:

  |
4 | foo x@     pattern = ()
  |       ^^^^^

as well as tabs.

Fixes #22524 (closed)

Edited by Jade

Merge request reports