Skip to content

Fix `haskell-interactive-types-for-show-ambiguous' #845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2015
Merged

Fix `haskell-interactive-types-for-show-ambiguous' #845

merged 1 commit into from
Sep 4, 2015

Conversation

drvink
Copy link
Contributor

@drvink drvink commented Sep 3, 2015

The regex in haskell-interactive-mode-trigger-compile-error wouldn't match e.g. <interactive>:6:1-2:, preventing the rest of the function from running.

gracjan added a commit that referenced this pull request Sep 4, 2015
Fix `haskell-interactive-types-for-show-ambiguous'
@gracjan gracjan merged commit 2c4e4ae into haskell:master Sep 4, 2015
@gracjan
Copy link
Contributor

gracjan commented Sep 4, 2015

Thanks.

As far as I know the Warning: part may end up on next line. Do these regexps work correctly in this situation?

@drvink
Copy link
Contributor Author

drvink commented Sep 4, 2015

I couldn't find an immediate reference for the format of GHC's diagnostic messages, so I looked at what Flycheck had. Looks like ours should be OK, though I haven't tested it.

;; our warning intro regex
"^\n<interactive>:[-0-9]+:[-0-9]+:[\n ]+Warning:"
;; Flycheck's regex for a complete warning
(let ((re (cons "blah"
                '(line-start (file-name) ":" line ":" column ":"
                  (or " " "\n    ") "Warning:" (optional "\n")
                  (message
                   (one-or-more " ") (one-or-more not-newline)
                   (zero-or-more "\n"
                                 (one-or-more " ")
                                 (one-or-more not-newline)))
                  line-end))))
  (flycheck-rx-to-string `(and ,@(cdr re))))
"\\(?:^\\(?1:.+?\\):\\(?2:[[:digit:]]+\\):\\(?3:[[:digit:]]+\\):\\(?:\\(?:\\(?:\n   \\)? \\)\\)Warning:\n?\\(?4: +.+\\(?:\n +.+\\)*\\)$\\)"

;; our error intro regex
"^\n<interactive>:[-0-9]+:[-0-9]+:"
;; Flycheck's
(let ((re (cons "blah"
                '(line-start (file-name) ":" line ":" column ":"
                  (or (message (one-or-more not-newline))
                      (and "\n"
                           (message
                            (one-or-more " ") (one-or-more not-newline)
                            (zero-or-more "\n"
                                          (one-or-more " ")
                                          (one-or-more not-newline)))))
                  line-end))))
  (flycheck-rx-to-string `(and ,@(cdr re))))
"\\(?:^\\(?1:.+?\\):\\(?2:[[:digit:]]+\\):\\(?3:[[:digit:]]+\\):\\(?:\\(?4:.+\\)\\|\n\\(?4: +.+\\(?:\n +.+\\)*\\)\\)$\\)"

@gracjan
Copy link
Contributor

gracjan commented Sep 4, 2015 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants