Permalink
Browse files

Merge branch 'master' of github.com:MagLev/maglev into tim/fix-253

  • Loading branch information...
timfel committed Feb 2, 2013
2 parents ae2ad9f + dd8cd1c commit bfc61a202265aff6023e6df4c2f8366c8f2306b2
Showing with 15 additions and 9 deletions.
  1. +3 −9 src/kernel/bootstrap/Array.rb
  2. +11 −0 src/test/github250.rb
  3. +1 −0 src/test/vmunit.conf
@@ -1553,7 +1553,7 @@ def rindex(element)
def shift(count=MaglevUndefined) # added in 1.8.7
if count._equal?(MaglevUndefined)
- return self.shift()
+ return self.__shift
end
cnt = Maglev::Type.coerce_to(count, Fixnum, :to_int)
if cnt < 0
@@ -1574,16 +1574,10 @@ def shift(count=MaglevUndefined) # added in 1.8.7
end
def shift
- sz = self.__size
- elem = nil
- unless sz._equal?(0)
- elem = self.__at(0)
- self.__remove_from_to_(1, 1) # one-based args
- end
- elem
+ self.__shift
end
- def __shift # used by Argf implementation
+ def __shift
sz = self.__size
elem = nil
unless sz._equal?(0)
View
@@ -0,0 +1,11 @@
+class Sexp < Array
+ def shift
+ raise if self.empty?
+ super
+ end
+end
+
+s = Sexp.new
+s << 42
+raises "Shift broken" unless s.shift == 42
+# Passes if it doesn't cause infinite recursion
View
@@ -450,6 +450,7 @@ github211.rb
github222.rb
github224.rb
github243.rb
+github250.rb
testMarshal.rb # after other coverage of Hash
#

0 comments on commit bfc61a2

Please sign in to comment.