Closed rchog closed 3 months ago
Thank you
I looked at the bug a little further, and managed to produce an even smaller minimal example:
case "" {
"" as a <> _ -> Nil
_ -> Nil
}
error (edited for brevity):
bug.erl:30:19: syntax error before: '='
% 30| <<""/utf8 = A, _/binary>> ->
% | ^
generated Erlang:
case <<""/utf8>> of
<<""/utf8 = A, _/binary>> ->
nil;
_ ->
nil
end,
it seems like pattern aliases and string prefixes do not play nicely together. should pattern aliases be available for string prefixes in the first place? their value is a known constant.
Since this got merged https://github.com/gleam-lang/gleam/pull/2782 I think we can close this issue. WDYT @lpil ?
Thank you!
I was delighted to learn that the pattern aliases described here are also supported for strings, however, I ran into this problem when trying to run my code with Erlang as the target. I pared it way down to this minimal example - it's nonsense, but it seems clear where the problem is:
..which produces the following when run with
gleam run
:It runs as expected with
gleam run -t js
. My Gleam version is 1.0.0, installed from here. I'll add the generated Erlang for good measure: