-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text.to_display_text returns Text
#5971
Comments
Proposed fix: diff --git engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/text/AnyToDisplayTextNode.java engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/text/AnyToDisplayTextNode.java
index e0bed6343..589f9f49a 100644
--- engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/text/AnyToDisplayTextNode.java
+++ engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/text/AnyToDisplayTextNode.java
@@ -31,6 +31,11 @@ public abstract class AnyToDisplayTextNode extends Node {
throw new IllegalStateException(e);
}
}
+
+ @Specialization
+ Text identity(Text self) {
+ return self;
+ } |
I think there was some story here. I remember If we do just identity here, stuff like error messages which want to display this text can get huge (for example if my Text is a contents of a whole book). So I suggest that maybe we should truncate the returned Text at some character limit? (though if we do so we need to be careful to not cut the text between two codepoints belonging to a single grapheme cluster - so some slight care will need to be taken to correctly find a Break between proper Characters ( |
Related pull requests, issues and discussions:
|
Agree with Radek's comment on truncating the text - maybe first 80 grapheme clusters. |
Especially when handling exceptions it is important to have proper implementation of
to_display_text
(which is invoked fromPanicException.getMessage()
. However Text! has some wrong implementation. Try:and it prints
Text
. That's wrong. I should printAhoj
.The text was updated successfully, but these errors were encountered: