Skip to content

Commit dd0c59d

Browse files
andrykonchineregon
authored andcommitted
[GR-45621] Remove deprecated methods
PullRequest: truffleruby/4157
2 parents 76a2c4c + cd857f0 commit dd0c59d

File tree

15 files changed

+40
-28
lines changed

15 files changed

+40
-28
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Compatibility:
5252
* Change `UnboundMethod#{==,inspect}` to use the owner module rather than the origin (#3039, @rwstauner, @manefz, @patricklinpl)
5353
* Support `lambda` keyword argument in `Proc#parameters` (#3039, @thomasmarshall, @goyox86).
5454
* Limit maximum encoding set size by 256 (#3039, @thomasmarshall, @goyox86).
55+
* Remove deprecated methods `Dir.exists?`, `File.exists?`, and `Kernel#=~` (#3039, @patricklinpl, @nirvdrum).
56+
* Remove deprecated `FileTest.exists?` method (#3039, @andrykonchin).
5557

5658
Performance:
5759

lib/truffle/pathname.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,10 +1088,6 @@ def unlink()
10881088
alias delete unlink
10891089
end
10901090

1091-
class Pathname
1092-
undef =~
1093-
end
1094-
10951091
module Kernel
10961092
# create a pathname object.
10971093
#

spec/ruby/core/filetest/exist_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@
44
describe "FileTest.exist?" do
55
it_behaves_like :file_exist, :exist?, FileTest
66
end
7+
8+
ruby_version_is "3.2" do
9+
describe "FileTest.exists?" do
10+
it "has been removed" do
11+
FileTest.should_not.respond_to?(:exists?)
12+
end
13+
end
14+
end

spec/ruby/core/kernel/not_match_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ def !~(obj)
1414
(obj !~ :foo).should == false
1515
end
1616

17+
ruby_version_is ""..."3.2" do
18+
it "returns true if self does not respond to #=~" do
19+
suppress_warning do
20+
(Object.new !~ :foo).should == true
21+
end
22+
end
23+
end
24+
25+
ruby_version_is "3.2" do
26+
it "raises NoMethodError if self does not respond to #=~" do
27+
-> { Object.new !~ :foo }.should raise_error(NoMethodError)
28+
end
29+
end
30+
1731
it 'can be overridden in subclasses' do
1832
obj = KernelSpecs::NotMatch.new
1933
(obj !~ :bar).should == :foo

spec/tags/core/dir/exist_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

spec/tags/core/file/exist_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

spec/tags/core/kernel/match_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main/ruby/truffleruby/core/dir.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ def empty?(path)
206206
def exist?(path)
207207
PrivateFile.directory?(path)
208208
end
209-
alias_method :exists?, :exist?
210209

211210
def home(user = nil)
212211
user = StringValue(user) unless Primitive.nil?(user)

src/main/ruby/truffleruby/core/file.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,6 @@ def self.sticky?(path)
11741174
class << self
11751175
alias_method :delete, :unlink
11761176
alias_method :empty?, :zero?
1177-
alias_method :exists?, :exist?
11781177
alias_method :fnmatch?, :fnmatch
11791178
end
11801179

src/main/ruby/truffleruby/core/file_test.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def executable_real?(path)
5050
def exist?(path)
5151
File.exist? path
5252
end
53-
alias_method :exists?, :exist?
5453

5554
def file?(path)
5655
File.file? path
@@ -126,7 +125,6 @@ def zero?(path)
126125
:executable?,
127126
:executable_real?,
128127
:exist?,
129-
:exists?,
130128
:file?,
131129
:grpowned?,
132130
:identical?,

0 commit comments

Comments
 (0)