Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make enum fail with a NYI error
The enum handling tries to rebless the value to the enum.  Clearly,
one cannot rebless a type object into something else.  Now, whether
it should be possible to have a type object as the value of an enum
I'm letting open for now by making it a NYI error.

Skarsnik++ for spotting
  • Loading branch information
lizmat committed Feb 16, 2016
1 parent 907e8ff commit ba22b31
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -4302,6 +4302,11 @@ class Perl6::Actions is HLL::Actions does STDActions {
unless nqp::istype($cur_key, $*W.find_symbol(['Str'])) {
$cur_key := $cur_key.Str;
}
unless nqp::defined($cur_value) {
$*W.throw($/, 'X::Comp::NYI',
feature => "Using a type object as a value for an enum",
);
}

# Create and install value.
my $val_obj := $*W.create_enum_value($type_obj, $cur_key, $cur_value);
Expand Down

0 comments on commit ba22b31

Please sign in to comment.