How to pattern match on non-ascii literals?

found this in the docs about using the familiar js template string tick marks for handling unicode: Primitive Types | ReScript Language Manual

I also see this post from September about v9 saying it would be fixed in next release: Unicode support in pattern matching

I’m using v10.1.0, does rescript not support pattern matching using switch on non-ascii literals?

see example test below

open Jest
open Expect

describe("switch works on non-ascii literals?", () => {
  let description = token =>
    switch token {
    | "A" => "the letter A"
    | `👍` => "a thumbs up"
    | "👎" => "a thumbs down"
    | _ => "i don't know"

  test("emoji literal equals emoji literal", () => {

  test("matches ascii literal", () => {
    expect("A"->description)->toEqual("the letter A")

  test("matches unicode literal using tick marks", () => {
    expect(`👍`->description)->toEqual("a thumbs up")

  test("matches unicode literal using double quotes", () => {
    expect("👎"->description)->toEqual("a thumbs down")

  test("non matching ascii literal", () => {
    expect("B"->description)->toEqual("i don't know")

Hi @specialblend happy new year.
The bug that got fixed is the pattern matching on unicode char, it seems this is another bug in unicode string, I will have a look after holidays

1 Like

Hi wondering if this has been fixed? Should I open a github issue? thanks