We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
case of
Repro showing the issue:
from Standard.Base import all import Standard.Base.Errors.Illegal_Argument.Illegal_Argument get_required_field key js_object = case js_object of _ : JS_Object -> js_object.get key if_missing=(Error.throw (Illegal_Argument.Error "Missing required field `"+key+"` in "+js_object.to_display_text+".")) _ -> Error.throw (Illegal_Argument.Error "Expected a JSON object, but got "+js_object.to_display_text+".") foo json = x = get_required_field "type" json IO.println (x == "aws_auth") IO.println ("aws_auth" == x) v1 = case x of "aws_auth" -> "OK" other -> "not ok: "+other.to_display_text v2 = case ""+x+"" of "aws_auth" -> "OK" other -> "not ok: "+other.to_display_text [v1, v2] main = j = """ { "type": "aws_auth" } IO.println <| foo j.parse_json
True True [not ok: aws_auth, OK]
While == works we can see that case of fails to match the constant.
==
However, when we concatenate "", the JS string gets converted into Enso Text and then the match successfully works.
""
Text
The script above should yield:
True True [OK, OK]
The text was updated successfully, but these errors were encountered:
I've already got a fix for this, so I'll put up a PR in a moment.
Sorry, something went wrong.
Fix matching JS strings (#9203)
386132c
- Fixes #9202
radeusgd
Successfully merging a pull request may close this issue.
Repro showing the issue:
Actual behaviour
While
==
works we can see thatcase of
fails to match the constant.However, when we concatenate
""
, the JS string gets converted into EnsoText
and then the match successfully works.Expected behaviour
The script above should yield:
The text was updated successfully, but these errors were encountered: