summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/handlers/sml.vim23
-rw-r--r--test/handler/test_sml_handler.vader32
2 files changed, 48 insertions, 7 deletions
diff --git a/autoload/ale/handlers/sml.vim b/autoload/ale/handlers/sml.vim
index f5365dd6..403b25fa 100644
--- a/autoload/ale/handlers/sml.vim
+++ b/autoload/ale/handlers/sml.vim
@@ -63,26 +63,35 @@ function! ale#handlers#sml#Handle(buffer, lines) abort
let l:match2 = matchlist(l:line, l:pattern2)
if len(l:match2) != 0
- call add(l:out, {
- \ 'filename': l:match2[1],
+ if l:match2[1] =~# 'stdIn$'
+ let l:loc = {'bufnr': a:buffer}
+ else
+ let l:loc = {'filename': l:match2[1]}
+ endif
+
+ call add(l:out, extend(l:loc, {
\ 'lnum': l:match2[2] + 0,
\ 'col' : l:match2[3] - 1,
\ 'text': l:match2[4],
\ 'type': l:match2[4] =~# '^Warning' ? 'W' : 'E',
- \})
-
+ \}))
continue
endif
let l:match = matchlist(l:line, l:pattern)
if len(l:match) != 0
- call add(l:out, {
- \ 'filename': l:match[1],
+ if l:match[1] =~# 'stdIn$'
+ let l:loc = {'bufnr': a:buffer}
+ else
+ let l:loc = {'filename': l:match[1]}
+ endif
+
+ call add(l:out, extend(l:loc, {
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[3] . ': ' . l:match[4],
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
- \})
+ \}))
continue
endif
endfor
diff --git a/test/handler/test_sml_handler.vader b/test/handler/test_sml_handler.vader
index 4e16e244..ef93cc47 100644
--- a/test/handler/test_sml_handler.vader
+++ b/test/handler/test_sml_handler.vader
@@ -85,3 +85,35 @@ Execute (Testing a warning):
\ "val f = fn : int -> int",
\ "-",
\])
+
+Execute (Testing stdIn):
+ AssertEqual [
+ \ {
+ \ 'bufnr': 42,
+ \ 'lnum': 1,
+ \ 'col': 5,
+ \ 'type': 'E',
+ \ 'text': "Error: operator and operand don't agree [overload conflict]",
+ \ },
+ \ {
+ \ 'bufnr': 42,
+ \ 'lnum': 2,
+ \ 'col': 4,
+ \ 'type': 'E',
+ \ 'text': "Error: operator and operand don't agree [overload conflict]",
+ \ },
+ \],
+ \ ale#handlers#sml#Handle(42, [
+ \ "Standard ML of New Jersey v110.79 [built: Sat Oct 26 12:27:04 2019]",
+ \ "- = stdIn:1.6-1.21 Error: operator and operand don't agree [overload conflict]",
+ \ " operator domain: [+ ty] * [+ ty]",
+ \ " operand: string * [int ty]",
+ \ " in expression:",
+ \ ' "abc" + 123',
+ \ "stdIn:2.5-2.20 Error: operator and operand don't agree [overload conflict]",
+ \ " operator domain: [+ ty] * [+ ty]",
+ \ " operand: [+ ty] * string",
+ \ " in expression:",
+ \ ' 890 + "xyz"',
+ \ "-",
+ \])