Beef icon indicating copy to clipboard operation
Beef copied to clipboard

static payload enum variable behaves different in switch than local one

Open EinScott opened this issue 2 years ago • 1 comments

enum A
{
	case A(int a);
	case B;
}

static A a;

static void Main()
{
	//let a = a;
	switch (a)
	{
	case .A(let intThing):
	case .B:
	// default:
	}
}

Without the commented-out local variable it demands a default case, and even if you give it that, compiling compiling crashes in code-gen.

With the local variable there, it accepts the switch without default and is fine compiling it.

EinScott avatar Jan 01 '23 13:01 EinScott

This issue may be closed as it was fixed with pull-request by @Fusioon and additional fix by @bfiete https://github.com/beefytech/Beef/commit/11ccb876a3685f66d2c5e945045b156bd59530a2 Ready-for-testing project: bug.1780.zip

kallisto56 avatar Jun 07 '25 01:06 kallisto56