diff --git a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala index 55cd1500183b..c7f9947c8138 100644 --- a/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala +++ b/engine/runtime-with-instruments/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala @@ -4552,10 +4552,19 @@ class RuntimeServerTest ) ) context.receiveNIgnoreStdLib(4) should contain theSameElementsAs Seq( - Api.Response(Api.BackgroundJobsStartedNotification()), Api.Response(requestId, Api.PushContextResponse(contextId)), - TestMessages.update(contextId, idMain, ConstantsGen.VECTOR), - context.executionComplete(contextId) + TestMessages.update( + contextId, + idMain, + ConstantsGen.VECTOR, + payload = Api.ExpressionUpdate.Payload.Value( + Some( + Api.ExpressionUpdate.Payload.Value.Warnings(1, Some("'y'"), false) + ) + ) + ), + context.executionComplete(contextId), + Api.Response(Api.BackgroundJobsStartedNotification()) ) } diff --git a/engine/runtime-with-polyglot/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala b/engine/runtime-with-polyglot/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala index a4b554577b98..891806ec775a 100644 --- a/engine/runtime-with-polyglot/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala +++ b/engine/runtime-with-polyglot/src/test/scala/org/enso/interpreter/test/instrument/RuntimeVisualizationsTest.scala @@ -2967,10 +2967,19 @@ class RuntimeVisualizationsTest context.receiveNIgnorePendingExpressionUpdates( 4 ) should contain theSameElementsAs Seq( - Api.Response(Api.BackgroundJobsStartedNotification()), Api.Response(requestId, Api.PushContextResponse(contextId)), - TestMessages.update(contextId, idMain, ConstantsGen.VECTOR), - context.executionComplete(contextId) + TestMessages.update( + contextId, + idMain, + ConstantsGen.VECTOR, + payload = Api.ExpressionUpdate.Payload.Value( + Some( + Api.ExpressionUpdate.Payload.Value.Warnings(1, Some("'y'"), false) + ) + ) + ), + context.executionComplete(contextId), + Api.Response(Api.BackgroundJobsStartedNotification()) ) // attach visualisation diff --git a/engine/runtime/src/main/scala/org/enso/interpreter/instrument/job/ProgramExecutionSupport.scala b/engine/runtime/src/main/scala/org/enso/interpreter/instrument/job/ProgramExecutionSupport.scala index 0499ca397e22..b3f47e6edf99 100644 --- a/engine/runtime/src/main/scala/org/enso/interpreter/instrument/job/ProgramExecutionSupport.scala +++ b/engine/runtime/src/main/scala/org/enso/interpreter/instrument/job/ProgramExecutionSupport.scala @@ -20,7 +20,7 @@ import org.enso.interpreter.runtime.control.ThreadInterruptedException import org.enso.interpreter.runtime.error.{ DataflowError, PanicSentinel, - WithWarnings + WarningsLibrary } import org.enso.interpreter.service.error._ import org.enso.polyglot.LanguageInfo @@ -351,27 +351,32 @@ object ProgramExecutionSupport { VisualizationResult.findExceptionMessage(panic), ErrorResolver.getStackTrace(panic).flatMap(_.expressionId) ) - case withWarnings: WithWarnings => - val warningsCount = withWarnings.getWarningsCount - val warning = - if (warningsCount == 1) { - val warnings = withWarnings.getWarningsArray(null) - Option(ctx.executionService.toDisplayString(warnings(0).getValue)) - } else { - None - } - Api.ExpressionUpdate.Payload.Value( - Some( - Api.ExpressionUpdate.Payload.Value - .Warnings( - warningsCount, - warning, - withWarnings.isLimitReached() + case _ => + if (WarningsLibrary.getUncached.hasWarnings(value.getValue)) { + val warnings = + WarningsLibrary.getUncached.getWarnings(value.getValue, null) + val warningsCount = warnings.length + val warning = + if (warningsCount == 1) { + Option( + ctx.executionService.toDisplayString(warnings(0).getValue) ) + } else { + None + } + Api.ExpressionUpdate.Payload.Value( + Some( + Api.ExpressionUpdate.Payload.Value + .Warnings( + warningsCount, + warning, + WarningsLibrary.getUncached.isLimitReached(value.getValue) + ) + ) ) - ) - case _ => - Api.ExpressionUpdate.Payload.Value() + } else { + Api.ExpressionUpdate.Payload.Value() + } } ctx.endpoint.sendToClient( Api.Response(