Skip to content

matching on enum abstract around another enum gives Incompatible pattern error. #11213

Closed
@ousado

Description

enum Ordering {
  EQ;
  LT;
  GT;
}

@:publicFields
enum abstract TriState(Ordering) from Ordering {
	var True = GT;
	var False = LT;
	var Both = EQ;

	function icon():Int {
		return switch (this : TriState) {
			case True:1;                  // Error: Incompatible pattern
			case False:2;
			case Both:3;
		}
	}
}

class Test {
	static function main() {
	}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions