diff --git a/app/gui/controller/engine-protocol/src/language_server/tests.rs b/app/gui/controller/engine-protocol/src/language_server/tests.rs index 336dfca8348a..b4ddc7a7d199 100644 --- a/app/gui/controller/engine-protocol/src/language_server/tests.rs +++ b/app/gui/controller/engine-protocol/src/language_server/tests.rs @@ -348,7 +348,7 @@ fn test_computed_value_update() { let update = &expression_updates.updates.first().unwrap(); assert_eq!(update.expression_id, id); assert_eq!(update.typename.as_deref(), Some(typename)); - assert!(update.method_pointer.is_none()); + assert!(update.method_call.is_none()); assert!(update.from_cache); assert!(matches!(update.payload, ExpressionUpdatePayload::Value { warnings: None })) } diff --git a/app/gui/controller/engine-protocol/src/language_server/types.rs b/app/gui/controller/engine-protocol/src/language_server/types.rs index eaec9b5772a5..ed6c3ccb6d59 100644 --- a/app/gui/controller/engine-protocol/src/language_server/types.rs +++ b/app/gui/controller/engine-protocol/src/language_server/types.rs @@ -216,7 +216,7 @@ pub struct ExpressionUpdate { pub expression_id: ExpressionId, #[serde(rename = "type")] // To avoid collision with the `type` keyword. pub typename: Option, - pub method_pointer: Option, + pub method_call: Option, pub profiling_info: Vec, pub from_cache: bool, pub payload: ExpressionUpdatePayload, @@ -740,6 +740,16 @@ pub struct MethodPointer { pub name: String, } +/// A representation of a method call. +#[derive(Hash, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct MethodCall { + /// The method pointer of a call. + pub method_pointer: MethodPointer, + /// Indexes of arguments that have not been applied to this method. + pub not_applied_arguments: Vec, +} + /// Used for entering a method. The first item on the execution context stack should always be /// an `ExplicitCall`. #[derive(Hash, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] @@ -1226,7 +1236,7 @@ pub mod test { ExpressionUpdate { expression_id: id, typename: Some(typename.into()), - method_pointer: None, + method_call: None, profiling_info: default(), from_cache: false, payload: ExpressionUpdatePayload::Value { warnings: None }, @@ -1242,7 +1252,7 @@ pub mod test { ExpressionUpdate { expression_id: id, typename: None, - method_pointer: Some(method_pointer), + method_call: Some(MethodCall { method_pointer, not_applied_arguments: vec![] }), profiling_info: default(), from_cache: false, payload: ExpressionUpdatePayload::Value { warnings: None }, @@ -1256,7 +1266,7 @@ pub mod test { ExpressionUpdate { expression_id: id, typename: None, - method_pointer: None, + method_call: None, profiling_info: default(), from_cache: false, payload: ExpressionUpdatePayload::DataflowError { trace }, @@ -1274,7 +1284,7 @@ pub mod test { ExpressionUpdate { expression_id: id, typename: None, - method_pointer: None, + method_call: None, profiling_info: default(), from_cache: false, payload: ExpressionUpdatePayload::Panic { trace, message }, diff --git a/app/gui/src/model/execution_context.rs b/app/gui/src/model/execution_context.rs index 8316c13f7cac..bb106931fc62 100644 --- a/app/gui/src/model/execution_context.rs +++ b/app/gui/src/model/execution_context.rs @@ -64,7 +64,7 @@ impl From for ComputedValueInfo { fn from(update: ExpressionUpdate) -> Self { ComputedValueInfo { typename: update.typename.map(ImString::new), - method_call: update.method_pointer, + method_call: update.method_call.map(|mc| mc.method_pointer), payload: update.payload, } } diff --git a/app/gui/src/model/project/synchronized.rs b/app/gui/src/model/project/synchronized.rs index d6e950dde8a5..2607674abc91 100644 --- a/app/gui/src/model/project/synchronized.rs +++ b/app/gui/src/model/project/synchronized.rs @@ -950,7 +950,10 @@ mod test { // Context now has the information about type. let value_info = value_registry.get(&expression_id).unwrap(); assert_eq!(value_info.typename, value_update.typename.clone().map(ImString::new)); - assert_eq!(value_info.method_call, value_update.method_pointer); + assert_eq!( + value_info.method_call, + value_update.method_call.clone().map(|mc| mc.method_pointer) + ); } diff --git a/docs/language-server/protocol-language-server.md b/docs/language-server/protocol-language-server.md index bb31c4083814..e12c9124cbd6 100644 --- a/docs/language-server/protocol-language-server.md +++ b/docs/language-server/protocol-language-server.md @@ -22,6 +22,7 @@ transport formats, please look [here](./protocol-architecture). - [`ExpressionId`](#expressionid) - [`ContextId`](#contextid) - [`StackItem`](#stackitem) + - [`MethodCall`](#methodcall) - [`MethodPointer`](#methodpointer) - [`ProfilingInfo`](#profilinginfo) - [`ExpressionUpdate`](#expressionupdate) @@ -271,6 +272,20 @@ interface LocalCall { } ``` +### `MethodCall` + +A representation of a method call. + +```typescript +interface MethodCall { + /** The method pointer of a call. */ + methodPointer: MethodPointer; + + /** Indexes of arguments that have not been applied to this method. */ + notAppliedArguments: number[]; +} +``` + ### `MethodPointer` Points to a method definition. @@ -331,9 +346,9 @@ interface ExpressionUpdate { type?: String; /** - * The updated pointer to the method call. + * The updated method call info. */ - methodPointer?: MethodPointer; + methodCall?: MethodCall; /** * Profiling information about the expression. diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextEventsListener.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextEventsListener.scala index b5e58a04dc82..a386707b2e16 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextEventsListener.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextEventsListener.scala @@ -186,7 +186,7 @@ final class ContextEventsListener( ContextRegistryProtocol.ExpressionUpdate( update.expressionId, update.expressionType, - update.methodCall.map(toProtocolMethodPointer), + update.methodCall.map(toProtocolMethodCall), update.profilingInfo.map(toProtocolProfilingInfo), update.fromCache, toProtocolPayload(update.payload) @@ -248,8 +248,20 @@ final class ContextEventsListener( ProfilingInfo.ExecutionTime(t) } + /** Convert the runtime method call to the context registry protocol + * representation. + * + * @param methodCall the method call + * @return the registry protocol representation of the method call + */ + private def toProtocolMethodCall(methodCall: Api.MethodCall): MethodCall = + MethodCall( + toProtocolMethodPointer(methodCall.methodPointer), + methodCall.notAppliedArguments + ) + /** Convert the runtime method pointer to the context registry protocol - * representation + * representation. * * @param methodPointer the method pointer * @return the registry protocol representation of the method pointer diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistryProtocol.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistryProtocol.scala index 6ee85baf4438..b79d86dc1a4c 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistryProtocol.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistryProtocol.scala @@ -176,7 +176,7 @@ object ContextRegistryProtocol { * * @param expressionId the id of updated expression * @param `type` the updated type of expression - * @param methodPointer the updated method pointer + * @param methodCall the updated method call * @param profilingInfo profiling information about the expression * @param fromCache whether or not the expression's value came from the cache * @param payload an extra information about the computed value @@ -184,7 +184,7 @@ object ContextRegistryProtocol { case class ExpressionUpdate( expressionId: UUID, `type`: Option[String], - methodPointer: Option[MethodPointer], + methodCall: Option[MethodCall], profilingInfo: Vector[ProfilingInfo], fromCache: Boolean, payload: ExpressionUpdate.Payload diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/MethodCall.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/MethodCall.scala new file mode 100644 index 000000000000..2191d2411c65 --- /dev/null +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/MethodCall.scala @@ -0,0 +1,32 @@ +package org.enso.languageserver.runtime + +import org.enso.polyglot.runtime.Runtime.Api + +/** A representation of a method call. + * + * @param methodPointer the method pointer of a call + * @param notAppliedArguments indexes of arguments that have not been applied + * to this method + */ +case class MethodCall( + methodPointer: MethodPointer, + notAppliedArguments: Vector[Int] +) { + + /** Convert this method call to the corresponding [[Api]] message. */ + def toApi: Api.MethodCall = + Api.MethodCall(methodPointer.toApi, notAppliedArguments) +} + +/** An object pointing to a method definition. + * + * @param module the module of the method file + * @param definedOnType method type + * @param name method name + */ +case class MethodPointer(module: String, definedOnType: String, name: String) { + + /** Convert this method pointer to the corresponding [[Api]] message. */ + def toApi: Api.MethodPointer = + Api.MethodPointer(module, definedOnType, name) +} diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/MethodPointer.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/MethodPointer.scala deleted file mode 100644 index 1a47c411125b..000000000000 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/MethodPointer.scala +++ /dev/null @@ -1,16 +0,0 @@ -package org.enso.languageserver.runtime - -import org.enso.polyglot.runtime.Runtime.Api - -/** An object pointing to a method definition. - * - * @param module the module of the method file - * @param definedOnType method type - * @param name method name - */ -case class MethodPointer(module: String, definedOnType: String, name: String) { - - /** Convert to corresponding [[Api]] message. */ - def toApi: Api.MethodPointer = - Api.MethodPointer(module, definedOnType, name) -} diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala index 4b53c84d8b2c..98659a6ac00f 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala @@ -55,13 +55,14 @@ class ContextEventsListenerSpec Suggestions.method.selfType, Suggestions.method.name ) + val methodCall = Api.MethodCall(methodPointer) listener ! Api.ExpressionUpdates( contextId, Set( Api.ExpressionUpdate( Suggestions.method.externalId.get, Some(Suggestions.method.returnType), - Some(methodPointer), + Some(methodCall), Vector(), false, true, @@ -79,7 +80,7 @@ class ContextEventsListenerSpec ContextRegistryProtocol.ExpressionUpdate( Suggestions.method.externalId.get, Some(Suggestions.method.returnType), - Some(toProtocolMethodPointer(methodPointer)), + Some(toProtocolMethodCall(methodCall)), Vector(), false, ContextRegistryProtocol.ExpressionUpdate.Payload.Value(None) @@ -477,6 +478,12 @@ class ContextEventsListenerSpec } } + def toProtocolMethodCall(methodCall: Api.MethodCall): MethodCall = + MethodCall( + toProtocolMethodPointer(methodCall.methodPointer), + methodCall.notAppliedArguments + ) + def toProtocolMethodPointer(methodPointer: Api.MethodPointer): MethodPointer = MethodPointer( methodPointer.module, diff --git a/engine/polyglot-api/src/main/scala/org/enso/polyglot/runtime/Runtime.scala b/engine/polyglot-api/src/main/scala/org/enso/polyglot/runtime/Runtime.scala index 0936d61dcfbb..c68a7396902c 100644 --- a/engine/polyglot-api/src/main/scala/org/enso/polyglot/runtime/Runtime.scala +++ b/engine/polyglot-api/src/main/scala/org/enso/polyglot/runtime/Runtime.scala @@ -307,14 +307,34 @@ object Runtime { */ sealed trait Error extends ApiResponse - /** A representation of a pointer to a method definition. - */ + /** A representation of a pointer to a method definition. */ case class MethodPointer( module: String, definedOnType: String, name: String ) + /** A representation of a method call. + * + * @param methodPointer the method pointer of a call + * @param notAppliedArguments indexes of arguments that have not been applied + * to this method + */ + case class MethodCall( + methodPointer: MethodPointer, + notAppliedArguments: Vector[Int] + ) + object MethodCall { + + /** Create a method call with all the arguments applied. + * + * @param methodPointer the method pointer of a call + * @return a new [[MethodCall]]. + */ + def apply(methodPointer: MethodPointer): MethodCall = + MethodCall(methodPointer, Vector()) + } + /** A representation of an executable position in code. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @@ -362,7 +382,7 @@ object Runtime { * * @param expressionId the expression id * @param expressionType the type of expression - * @param methodCall the pointer to a method definition + * @param methodCall the underlying method call of this expression * @param profilingInfo profiling information about the execution of this * expression * @param fromCache whether or not the value for this expression came @@ -374,7 +394,7 @@ object Runtime { case class ExpressionUpdate( expressionId: ExpressionId, expressionType: Option[String], - methodCall: Option[MethodPointer], + methodCall: Option[MethodCall], profilingInfo: Vector[ProfilingInfo], fromCache: Boolean, typeChanged: Boolean, diff --git a/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/IdExecutionInstrument.java b/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/IdExecutionInstrument.java index 0b14a5f0c21d..6635661346f7 100644 --- a/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/IdExecutionInstrument.java +++ b/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/IdExecutionInstrument.java @@ -308,8 +308,7 @@ private FunctionCallInfo functionCallInfoById(UUID nodeId) { @CompilerDirectives.TruffleBoundary private void onFunctionReturn(UUID nodeId, FunctionCallInstrumentationNode.FunctionCall result, EventContext context) throws ThreadDeath { - calls.put( - nodeId, new FunctionCallInfo(result)); + calls.put(nodeId, new FunctionCallInfo(result)); functionCallCallback.accept(new ExpressionCall(nodeId, result)); // Return cached value after capturing the enterable function call in `functionCallCallback` Object cachedResult = cache.get(nodeId); diff --git a/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/NodeCountingTestInstrument.java b/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/NodeCountingTestInstrument.java index cd33a79446d3..1f786b1c07af 100644 --- a/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/NodeCountingTestInstrument.java +++ b/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/NodeCountingTestInstrument.java @@ -28,10 +28,10 @@ services = NodeCountingTestInstrument.class) public class NodeCountingTestInstrument extends TruffleInstrument { public static final String INSTRUMENT_ID = "node-count-test"; - private Map all = new ConcurrentHashMap<>(); + private final Map all = new ConcurrentHashMap<>(); private Map> counter = new ConcurrentHashMap<>(); - private Map calls = new ConcurrentHashMap<>(); + private final Map calls = new ConcurrentHashMap<>(); private Env env; @Override @@ -107,7 +107,7 @@ public ExecutionEventNode create(EventContext context) { } } - private class NodeWrapper extends ExecutionEventNode { + private static class NodeWrapper extends ExecutionEventNode { private final EventContext context; @@ -134,7 +134,7 @@ private void onFunctionReturn(FunctionCallInstrumentationNode node, FunctionCall } - public class FunctionCallInfo { + public static class FunctionCallInfo { private final QualifiedName moduleName; private final QualifiedName typeName; diff --git a/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/IncrementalUpdatesTest.java b/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/IncrementalUpdatesTest.java index e921a994fd34..0a3eeabd52cf 100644 --- a/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/IncrementalUpdatesTest.java +++ b/engine/runtime-with-instruments/src/test/java/org/enso/interpreter/test/instrument/IncrementalUpdatesTest.java @@ -19,6 +19,7 @@ import org.enso.polyglot.runtime.Runtime$Api$ExecutionFailed; import org.enso.polyglot.runtime.Runtime$Api$ExpressionUpdates; import org.enso.polyglot.runtime.Runtime$Api$InitializedNotification; +import org.enso.polyglot.runtime.Runtime$Api$MethodCall; import org.enso.polyglot.runtime.Runtime$Api$MethodPointer; import org.enso.polyglot.runtime.Runtime$Api$PushContextRequest; import org.enso.polyglot.runtime.Runtime$Api$PushContextResponse; @@ -39,6 +40,7 @@ import scala.collection.immutable.Seq; import scala.collection.immutable.Set; import scala.collection.immutable.Set$; +import scala.collection.immutable.Vector$; import scala.collection.immutable.Vector1; public class IncrementalUpdatesTest { @@ -217,14 +219,14 @@ private static String extractPositions(String code, String chars, Map { + moduleName = methodNode.getModuleScope().getModule().getName(); + typeName = methodNode.getType().getQualifiedName(); + functionName = methodNode.getMethodName(); + } + case QualifiedAccessorNode qualifiedAccessor -> { + AtomConstructor atomConstructor = qualifiedAccessor.getAtomConstructor(); + moduleName = atomConstructor.getDefinitionScope().getModule().getName(); + typeName = atomConstructor.getType().getQualifiedName(); + functionName = atomConstructor.getDisplayName(); + } + case EnsoRootNode ensoRootNode -> { + moduleName = ensoRootNode.getModuleScope().getModule().getName(); + typeName = null; + functionName = rootNode.getName(); + } + case default -> { + moduleName = null; + typeName = null; + functionName = rootNode.getName(); + } } + + notAppliedArguments = collectNotAppliedArguments(call); } @Override @@ -268,5 +281,27 @@ public QualifiedName getTypeName() { public String getFunctionName() { return functionName; } + + /** @return the arguments of this function that have not yet been applied. */ + public int[] getNotAppliedArguments() { + return notAppliedArguments; + } + + private static int[] collectNotAppliedArguments(FunctionCallInstrumentationNode.FunctionCall call) { + Object[] arguments = call.getArguments(); + int[] notAppliedArgs = new int[arguments.length]; + int notAppliedArgsSize = 0; + boolean isStatic = arguments[0] instanceof Type; + int selfTypePosition = isStatic ? -1 : 0; + + for (int i = 0; i < arguments.length; i++) { + if (arguments[i] == null) { + notAppliedArgs[notAppliedArgsSize] = i + selfTypePosition; + notAppliedArgsSize += 1; + } + } + + return Arrays.copyOf(notAppliedArgs, notAppliedArgsSize); + } } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/service/ExecutionService.java b/engine/runtime/src/main/java/org/enso/interpreter/service/ExecutionService.java index 8f092e447f4e..f6866ddd2ae9 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/service/ExecutionService.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/service/ExecutionService.java @@ -377,16 +377,18 @@ public void modifyModuleSources( throw new SourceNotFoundException(module.getName(), e); } - JavaEditorAdapter.applyEdits(module.getLiteralSource(), edits) - .fold( - failure -> { - throw new FailedToApplyEditsException( - module.getName(), edits, failure, module.getLiteralSource()); - }, - rope -> { - module.setLiteralSource(rope, simpleUpdate); - return new Object(); - }); + if (edits.nonEmpty() || simpleUpdate != null) { + JavaEditorAdapter.applyEdits(module.getLiteralSource(), edits) + .fold( + failure -> { + throw new FailedToApplyEditsException( + module.getName(), edits, failure, module.getLiteralSource()); + }, + rope -> { + module.setLiteralSource(rope, simpleUpdate); + return new Object(); + }); + } } /** diff --git a/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala b/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala index e60f21659e45..07e842286503 100644 --- a/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala +++ b/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala @@ -961,7 +961,7 @@ class IrToTruffle( * @param block the block to generate code for * @return the truffle nodes corresponding to `block` */ - def processBlock(block: IR.Expression.Block): RuntimeExpression = { + private def processBlock(block: IR.Expression.Block): RuntimeExpression = { if (block.suspended) { val scopeInfo = block .unsafeGetMetadata( @@ -1383,7 +1383,9 @@ class IrToTruffle( * @param binding the binding to generate code for * @return the truffle nodes corresponding to `binding` */ - def processBinding(binding: IR.Expression.Binding): RuntimeExpression = { + private def processBinding( + binding: IR.Expression.Binding + ): RuntimeExpression = { val occInfo = binding .unsafeGetMetadata( AliasAnalysis, 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 d6a8cf24e82c..9627d95a03b9 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 @@ -326,7 +326,7 @@ object ProgramExecutionSupport { value: ExpressionValue )(implicit ctx: RuntimeContext): Unit = { val expressionId = value.getExpressionId - val methodPointer = toMethodPointer(value) + val methodPointer = toMethodCall(value) if ( !syncState.isExpressionSync(expressionId) || ( @@ -391,7 +391,7 @@ object ProgramExecutionSupport { Api.ProfilingInfo.ExecutionTime(e.getNanoTimeElapsed) }.toVector, value.wasCached(), - value.isTypeChanged() || value.isFunctionCallChanged(), + value.isTypeChanged || value.isFunctionCallChanged, payload ) ) @@ -535,23 +535,26 @@ object ProgramExecutionSupport { ) } - /** Extract method pointer information from the expression value. + /** Extract the method call information from the provided expression value. * * @param value the expression value. - * @return the method pointer info + * @return the method call info */ - private def toMethodPointer( - value: ExpressionValue - ): Option[Api.MethodPointer] = + private def toMethodCall(value: ExpressionValue): Option[Api.MethodCall] = for { call <- Option(value.getCallInfo).orElse(Option(value.getCachedCallInfo)) moduleName <- Option(call.getModuleName) typeName <- Option(call.getTypeName) - } yield Api.MethodPointer( - moduleName.toString, - typeName.toString, - call.getFunctionName - ) + } yield { + Api.MethodCall( + methodPointer = Api.MethodPointer( + moduleName.toString, + typeName.toString.stripSuffix(TypeSuffix), + call.getFunctionName + ), + notAppliedArguments = call.getNotAppliedArguments.toVector + ) + } /** Find source file path by the module name. * @@ -590,4 +593,6 @@ object ProgramExecutionSupport { cache: RuntimeCache, syncState: UpdatesSynchronizationState ) + + private val TypeSuffix = ".type" } diff --git a/engine/runtime/src/test/scala/org/enso/interpreter/test/instrument/TestMessages.scala b/engine/runtime/src/test/scala/org/enso/interpreter/test/instrument/TestMessages.scala index f72cdf2589a9..6e8fd9fbb653 100644 --- a/engine/runtime/src/test/scala/org/enso/interpreter/test/instrument/TestMessages.scala +++ b/engine/runtime/src/test/scala/org/enso/interpreter/test/instrument/TestMessages.scala @@ -71,7 +71,7 @@ object TestMessages { * @param expressionType a type of the expression * @param fromCache whether or not the value for this expression came from cache * @param typeChanged a flag indicating whether the the type of expression has changed - * @param methodPointer method pointer + * @param methodCall the method call * @param payload the update payload * @return the expression update response */ @@ -79,10 +79,10 @@ object TestMessages { contextId: UUID, expressionId: UUID, expressionType: String, - fromCache: Boolean = false, - typeChanged: Boolean = true, - methodPointer: Option[Api.MethodPointer] = None, - payload: Api.ExpressionUpdate.Payload = Api.ExpressionUpdate.Payload.Value() + fromCache: Boolean = false, + typeChanged: Boolean = true, + methodCall: Option[Api.MethodCall] = None, + payload: Api.ExpressionUpdate.Payload = Api.ExpressionUpdate.Payload.Value() ): Api.Response = Api.Response( Api.ExpressionUpdates( @@ -91,7 +91,7 @@ object TestMessages { Api.ExpressionUpdate( expressionId, Some(expressionType), - methodPointer, + methodCall, Vector(Api.ProfilingInfo.ExecutionTime(0)), fromCache, typeChanged, @@ -106,23 +106,23 @@ object TestMessages { * @param contextId an identifier of the context * @param expressionId an identifier of the expression * @param expressionType a type of the expression - * @param methodPointer a pointer to the method definition + * @param methodCall a pointer to the method definition * @return the expression update response */ def update( contextId: UUID, expressionId: UUID, expressionType: String, - methodPointer: Api.MethodPointer + methodCall: Api.MethodCall ): Api.Response = - update(contextId, expressionId, expressionType, methodPointer, false, true) + update(contextId, expressionId, expressionType, methodCall, false, true) /** Create an update response. * * @param contextId an identifier of the context * @param expressionId an identifier of the expression * @param expressionType a type of the expression - * @param methodPointer a pointer to the method definition + * @param methodCall a pointer to the method definition * @param fromCache whether or not the value for this expression came * from the cache * @param typeChanged a flag indicating whether the the type of expression has changed @@ -132,7 +132,7 @@ object TestMessages { contextId: UUID, expressionId: UUID, expressionType: String, - methodPointer: Api.MethodPointer, + methodCall: Api.MethodCall, fromCache: Boolean, typeChanged: Boolean ): Api.Response = @@ -143,7 +143,7 @@ object TestMessages { Api.ExpressionUpdate( expressionId, Some(expressionType), - Some(methodPointer), + Some(methodCall), Vector(Api.ProfilingInfo.ExecutionTime(0)), fromCache, typeChanged, @@ -178,20 +178,20 @@ object TestMessages { * * @param contextId an identifier of the context * @param expressionId an identifier of the expression - * @param methodPointer a pointer to the method definition + * @param methodCall a pointer to the method definition * @param payload the error payload * @return the expression update response */ def error( contextId: UUID, expressionId: UUID, - methodPointer: Api.MethodPointer, + methodCall: Api.MethodCall, payload: Api.ExpressionUpdate.Payload ): Api.Response = error( contextId, expressionId, - methodPointer, + methodCall, false, true, payload @@ -201,7 +201,7 @@ object TestMessages { * * @param contextId an identifier of the context * @param expressionId an identifier of the expression - * @param methodPointer a pointer to the method definition + * @param methodCall a pointer to the method definition * @param fromCache whether or not the value for this expression came * from the cache * @param typeChanged a flag indicating whether the the type of expression has changed @@ -211,7 +211,7 @@ object TestMessages { def error( contextId: UUID, expressionId: UUID, - methodPointer: Api.MethodPointer, + methodCall: Api.MethodCall, fromCache: Boolean, typeChanged: Boolean, payload: Api.ExpressionUpdate.Payload @@ -219,7 +219,7 @@ object TestMessages { errorBuilder( contextId, expressionId, - Some(methodPointer), + Some(methodCall), fromCache, typeChanged, payload @@ -229,7 +229,7 @@ object TestMessages { * * @param contextId an identifier of the context * @param expressionId an identifier of the expression - * @param methodPointerOpt a pointer to the method definition + * @param methodCallOpt a pointer to the method definition * @param fromCache whether or not the value for this expression came * from the cache * @param typeChanged a flag indicating whether the the type of expression has changed @@ -239,7 +239,7 @@ object TestMessages { private def errorBuilder( contextId: UUID, expressionId: UUID, - methodPointerOpt: Option[Api.MethodPointer], + methodCallOpt: Option[Api.MethodCall], fromCache: Boolean, typeChanged: Boolean, payload: Api.ExpressionUpdate.Payload @@ -251,7 +251,7 @@ object TestMessages { Api.ExpressionUpdate( expressionId, Some(ConstantsGen.ERROR), - methodPointerOpt, + methodCallOpt, Vector(Api.ProfilingInfo.ExecutionTime(0)), fromCache, typeChanged, @@ -304,7 +304,7 @@ object TestMessages { * * @param contextId an identifier of the context * @param expressionId an identifier of the expression - * @param methodPointer a pointer to the method definition + * @param methodCall a pointer to the method definition * @param payload the error payload * @param builtin a flag indicating what is the type of Panic (a builtin Panic type or stdlib Panic) * @return the expression update response @@ -312,14 +312,14 @@ object TestMessages { def panic( contextId: UUID, expressionId: UUID, - methodPointer: Api.MethodPointer, + methodCall: Api.MethodCall, payload: Api.ExpressionUpdate.Payload, builtin: Boolean ): Api.Response = panicBuilder( contextId, expressionId, - Some(methodPointer), + Some(methodCall), payload, builtin, true @@ -329,7 +329,7 @@ object TestMessages { * * @param contextId an identifier of the context * @param expressionId an identifier of the expression - * @param methodPointer a pointer to the method definition + * @param methodCall a pointer to the method definition * @param payload the error payload * @param builtin the type to use * @return the expression update response @@ -337,14 +337,14 @@ object TestMessages { def panic( contextId: UUID, expressionId: UUID, - methodPointer: Api.MethodPointer, + methodCall: Api.MethodCall, payload: Api.ExpressionUpdate.Payload, builtin: Option[String] ): Api.Response = panicBuilder( contextId, expressionId, - Some(methodPointer), + Some(methodCall), payload, builtin, true @@ -353,7 +353,7 @@ object TestMessages { def panic( contextId: UUID, expressionId: UUID, - methodPointer: Api.MethodPointer, + methodCall: Api.MethodCall, payload: Api.ExpressionUpdate.Payload, builtin: Option[String], typeChanged: Boolean @@ -361,7 +361,7 @@ object TestMessages { panicBuilder( contextId, expressionId, - Some(methodPointer), + Some(methodCall), payload, builtin, typeChanged @@ -371,7 +371,7 @@ object TestMessages { * * @param contextId an identifier of the context * @param expressionId an identifier of the expression - * @param methodPointer a pointer to the method definition + * @param methodCall a pointer to the method definition * @param payload the error payload * @param builtin a flag indicating what is the type of Panic (a builtin Panic type or stdlib Panic) * @param typeChanged a flag indicating whether the the type of expression has changed @@ -380,14 +380,14 @@ object TestMessages { private def panicBuilder( contextId: UUID, expressionId: UUID, - methodPointer: Option[Api.MethodPointer], + methodCall: Option[Api.MethodCall], payload: Api.ExpressionUpdate.Payload, builtin: Boolean, typeChanged: Boolean ): Api.Response = panicBuilder( contextId, expressionId, - methodPointer, + methodCall, payload, Some( if (builtin) ConstantsGen.PANIC_BUILTIN else ConstantsGen.PANIC @@ -398,7 +398,7 @@ object TestMessages { private def panicBuilder( contextId: UUID, expressionId: UUID, - methodPointer: Option[Api.MethodPointer], + methodCall: Option[Api.MethodCall], payload: Api.ExpressionUpdate.Payload, builtin: Option[String], typeChanged: Boolean @@ -410,7 +410,7 @@ object TestMessages { Api.ExpressionUpdate( expressionId, builtin, - methodPointer, + methodCall, Vector(Api.ProfilingInfo.ExecutionTime(0)), false, typeChanged,