From c30d171457105fe874a9eafce463069790b64d44 Mon Sep 17 00:00:00 2001 From: Gregory Travis Date: Tue, 14 Nov 2023 14:46:18 -0500 Subject: [PATCH] wip --- .../lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso | 8 +++++++- .../java/org/enso/interpreter/runtime/error/Warning.java | 2 +- test/Tests/src/Semantic/Warnings_Spec.enso | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso index 0d506fc7806..dd24b60058f 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Vector.enso @@ -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 -> diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/Warning.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/Warning.java index 8cbbe72a8d5..8788f65de4e 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/Warning.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/Warning.java @@ -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; } diff --git a/test/Tests/src/Semantic/Warnings_Spec.enso b/test/Tests/src/Semantic/Warnings_Spec.enso index c25f780e697..046b57f4f6a 100644 --- a/test/Tests/src/Semantic/Warnings_Spec.enso +++ b/test/Tests/src/Semantic/Warnings_Spec.enso @@ -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]