Skip to content
New issue

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

Enum abstracts are not constant when used to define other enum abstracts #7922

Closed
Geokureli opened this issue Mar 5, 2019 · 0 comments
Closed
Assignees

Comments

@Geokureli
Copy link

Geokureli commented Mar 5, 2019

The following fails exhaustiveness checks

class Test
{
	static function main()
	{
		var a:A = LAME;
		var b:B = HOT;
		
		switch (a)
		{
			case LAME | COOL:
		}
    	
		switch (b)//Unmatched patterns: B.HOT | B.NOT
		{
			case NOT | HOT:
		}
	}
}

@:enum abstract A(Int) to Int
{
	var LAME =  0;
	var COOL =  1;
}

@:enum abstract B(Int)
{
	var NOT = LAME;
	var HOT = COOL;
}

As far as I know, these abstract values are constants and var HOT = COOL; should behave the same as var HOT = 1; which is not the case.

@Geokureli Geokureli changed the title Can't define enum abstracts from other abstracts Enum abstracts are not constant when used to define other enum abstracts Mar 5, 2019
@Simn Simn self-assigned this May 22, 2019
@Simn Simn added this to the Bugs milestone May 22, 2019
@Simn Simn closed this as completed in c1d0c06 Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants