This commit is contained in:
Gregory Travis 2023-11-14 14:46:18 -05:00
parent b0e811aff2
commit c30d171457
3 changed files with 10 additions and 4 deletions

View File

@ -592,7 +592,13 @@ type Vector a
case result.is_error of
False ->
if Warning.has_warnings result . not then result else
Warning.map_attached_warnings (w-> Maybe.Some (Map_Error.Error i w)) result
##
IO.println 'AAA'
IO.println (Warning.get_all result)
IO.println (Warning.get_all result . map (w-> Maybe.Some (Map_Error.Error i w)))
r = Warning.map_attached_warnings (w-> Maybe.Some (Map_Error.Error i w)) result
rws = Warning.get_all r
#IO.println rws
True ->
case on_problems of
Problem_Behavior.Ignore ->

View File

@ -47,7 +47,7 @@ public final class Warning implements EnsoObject {
return value;
}
@Builtin.Method(name = "origin", description = "Gets the payload of the warning.")
@Builtin.Method(name = "origin", description = "Gets the origin (stack trace) of the warning.")
public Object getOrigin() {
return origin;
}

View File

@ -284,9 +284,9 @@ spec = Test.group "Dataflow Warnings" <|
res = [1,2,3,4].map even
res . should_equal [1, 0, 1, 0]
Warning.get_all res . map .value . should_equal [4, 3, 2, 1]
Warning.get_all res . map .value . should_equal [(Map_Error.Error 3 4), 4, (Map_Error.Error 2 3), 3, (Map_Error.Error 1 2), 2, (Map_Error.Error 0 1), 1]
res.at 0 . should_equal 1
Warning.get_all (res.at 0) . map .value . should_equal [4, 3, 2, 1]
Warning.get_all (res.at 0) . map .value . should_equal [(Map_Error.Error 3 4), 4, (Map_Error.Error 2 3), 3, (Map_Error.Error 1 2), 2, (Map_Error.Error 0 1), 1]
slice = res.slice 1 4
Warning.get_all slice . map .value . should_equal [4, 3, 2, 1]