Skip to content

Commit

Permalink
Correct smartmatching Array on RHS when LHS is non-array and we co-er…
Browse files Browse the repository at this point in the history
…ce it; turns out it should DWIM too. Resolves RT#61454.
  • Loading branch information
jnthn committed Feb 13, 2009
1 parent daa2eea commit f7b4b86
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/classes/List.pir
Expand Up @@ -35,9 +35,10 @@ Smart-matches against the list.
# What do we have?
$I0 = isa topic, 'List' # Catches Array too
if $I0 goto array
goto default
# XXX When we have a Set type, need to handle that here too.
topic = topic.'list'()

# Array. Need to DWIM on *s.
# Need to DWIM on *s.
array:
.local pmc whatever
whatever = get_hll_global 'Whatever'
Expand Down Expand Up @@ -98,13 +99,6 @@ Smart-matches against the list.
false:
$P0 = get_hll_global [ 'Bool' ], 'False'
.return ($P0)

# Something else. Just do a hyper ===, and check all the values are matches.
default:
topic = topic.'list'()
$P0 = '!HYPEROP'('infix:===', self, topic, 0, 0)
$P0 = 'all'($P0)
.tailcall 'prefix:?'($P0)
.end


Expand Down

0 comments on commit f7b4b86

Please sign in to comment.