diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/EnsoFile.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/EnsoFile.java index 1efaed2b74f..ef757e3024a 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/EnsoFile.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/EnsoFile.java @@ -772,10 +772,17 @@ public final class EnsoFile extends EnsoObject { return fromString(context, System.getProperty("user.home")); } + @ExportMessage + @TruffleBoundary + @Override + public String toDisplayString(boolean allowSideEffects) { + return "(File " + truffleFile.getPath() + ")"; + } + @Override @TruffleBoundary public String toString() { - return "(File " + truffleFile.getPath() + ")"; + return toDisplayString(false); } @ExportMessage diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/ManagedResource.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/ManagedResource.java index 946cf7861f2..424eac477f3 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/ManagedResource.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/ManagedResource.java @@ -1,5 +1,6 @@ package org.enso.interpreter.runtime.data; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Bind; import com.oracle.truffle.api.interop.InteropLibrary; import com.oracle.truffle.api.library.ExportLibrary; @@ -93,4 +94,11 @@ public final class ManagedResource extends EnsoObject { Type getType(@Bind("$node") Node node) { return EnsoContext.get(node).getBuiltins().managedResource(); } + + @ExportMessage + @TruffleBoundary + @Override + public String toDisplayString(boolean allowSideEffects) { + return resource.toString(); + } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Ref.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Ref.java index 861945f900b..47ee953bd8c 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Ref.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Ref.java @@ -2,6 +2,7 @@ package org.enso.interpreter.runtime.data; import com.oracle.truffle.api.dsl.Bind; import com.oracle.truffle.api.interop.InteropLibrary; +import com.oracle.truffle.api.library.CachedLibrary; import com.oracle.truffle.api.library.ExportLibrary; import com.oracle.truffle.api.library.ExportMessage; import com.oracle.truffle.api.nodes.Node; @@ -68,4 +69,10 @@ public final class Ref extends EnsoObject { Type getType(@Bind("$node") Node node) { return EnsoContext.get(node).getBuiltins().ref(); } + + @ExportMessage + Object toDisplayString( + boolean allowSideEffects, @CachedLibrary(limit = "3") InteropLibrary interop) { + return interop.toDisplayString(value, allowSideEffects); + } }