vrchat-community / UdonSharp

A compiler for compiling C# to Udon assembly
https://udonsharp.docs.vrchat.com
MIT License
461 stars 50 forks source link

Switch range operators dont work even though they throw no compile errors #163

Open Happyrobot33 opened 2 months ago

Happyrobot33 commented 2 months ago

Using code like this

for (int i = 0; i < 100; i++)
{
    switch (i)
    {
        case int n when n < 50:
            Debug.Log("1");
            break;
        case int n when n < 100:
            Debug.Log("2");
            break;
    }
}

I would expect it to print 1 until it gets to 50, and then start printing 2. However, this always prints 1 no matter what, and also does not throw any compiler errors that range switch statements are unsupported