Open radeusgd opened 3 weeks ago
In my related PR #10229, I've added a workaround to be able to progress with the important changes. I did not want to block that PR as this error occurred only in the Charset
check which is not really that important - we can keep it as an unchecked ascription, as we know the returned type will be right anyway.
Ideally we should solve this bug, but it is not that high priority until it will start showing in practice, and I did not find any good way to find a more reliable repro or to debug this.
If anyone wants to debug it, you can revert my workaround by the following patch:
Subject: [PATCH] avoid problematic check as workaround for https://github.com/enso-org/enso/issues/10250
---
Index: distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Encoding.enso
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Encoding.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Encoding.enso
--- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Encoding.enso (revision 9cde5e7f7c3bdac7f15e0c30ee476666e0c5bbee)
+++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Encoding.enso (revision b55cdb29dfbc823e09447531f4de8ba68a6ea0e0)
@@ -89,8 +89,7 @@
Convert an Encoding to it's corresponding Java Charset, if applicable.
This method should be used in places not aware of special logic for the
Default encoding. In such places, usage of Default encoding will be forbidden.
- to_java_charset : Charset ! Illegal_Argument
- to_java_charset self =
+ to_java_charset self -> Charset ! Illegal_Argument =
self.to_java_charset_or_null.if_nothing <|
warning = Illegal_Argument.Error "The Default encoding has been used in an unexpected place (e.g. Write operation). It will be replaced with UTF-8. Please specify the desired encoding explicitly)"
Warning.attach warning (Encoding.utf_8.to_java_charset)
@@ -98,8 +97,7 @@
## PRIVATE
Convert an Encoding to it's corresponding Java Charset or null if it is the Default encoding.
This method should only be used in places where a null Charset is expected - i.e. places aware of the Default encoding.
- to_java_charset_or_null : Charset | Nothing ! Illegal_Argument
- to_java_charset_or_null self = case self of
+ to_java_charset_or_null self -> (Charset | Nothing) ! Illegal_Argument = case self of
Encoding.Value charset_name ->
Panic.catch UnsupportedCharsetException (Charset.forName charset_name) _->
Error.throw (Illegal_Argument.Error ("Unknown Character Set: " + charset_name))
Pushing the code with the above to CI should show the errors in CI tests.
We may also want to investigate it further if we find other similar instances of such problem.
I have been getting the following error on the CI: https://github.com/enso-org/enso/actions/runs/9464904329/job/26073226464?pr=10229#step:7:1085
This is a Type error that says that
sun.nio.cs.UTF_8
does not pass a-> Charset
typecheck (checking for Java classjava.nio.charset.Charset
). Surely,sun.nio.cs.UTF_8
is a subclass ofjava.nio.charset.Charset
. Moreover, in most cases (e.g. on my local computer) this typecheck does correctly pass without any errors. So I suspect the non-determinism may be caused by some specialization issue.Currently I couldn't find any other repro than this CI run.