-
Notifications
You must be signed in to change notification settings - Fork 334
Closed
Closed
Copy link
Labels
Description
I've discovered this issue when debugging test failures on #12247 PR.
A simple repro can be following:
from Standard.Base import all
polyglot java import org.enso.base.text.TextFoldingStrategy
f x = case x of
j : TextFoldingStrategy ->
suffix = ", but is it really? "+(j.is_a TextFoldingStrategy).to_text
j.to_text+" is a Java value"+suffix
other -> other.to_text+" is not a Java value"
type My_Type
Value x
main =
IO.println (f 42)
IO.println (f "abc")
IO.println (f (My_Type.Value 1))
That code prints:
42 is not a Java value
abc is not a Java value
(My_Type.Value 1) is a Java value, but is it really? False
We can see that case of
treats My_Type
as if it was matching the TextFoldingStrategy
interface. However is_a
correctly responds that it has nothing to do with it.
I think that case of
matching any Enso type with any Java interface is wrong.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
🟢 Accepted