Skip to content

Commit d31ca9a

Browse files
authored
Merge pull request #2622 from ksss/undocumented
Remove undocumented override methods
2 parents dd4985c + b871e6d commit d31ca9a

File tree

10 files changed

+73
-112
lines changed

10 files changed

+73
-112
lines changed

core/complex.rbs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ class Complex < Numeric
377377
#
378378
# Complex.rect(1, 2).conj # => (1-2i)
379379
#
380-
def conj: () -> Complex
380+
def conj: () -> self
381381

382382
# <!--
383383
# rdoc-file=complex.c
@@ -387,7 +387,7 @@ class Complex < Numeric
387387
#
388388
# Complex.rect(1, 2).conj # => (1-2i)
389389
#
390-
def conjugate: () -> Complex
390+
def conjugate: () -> self
391391

392392
# <!--
393393
# rdoc-file=complex.c
@@ -522,8 +522,6 @@ class Complex < Numeric
522522
#
523523
def inspect: () -> String
524524

525-
def integer?: () -> bool
526-
527525
# <!-- rdoc-file=complex.c -->
528526
# Returns the absolute value (magnitude) for `self`; see [polar
529527
# coordinates](rdoc-ref:Complex@Polar+Coordinates):
@@ -745,8 +743,6 @@ class Complex < Numeric
745743
#
746744
def to_i: () -> Integer
747745

748-
alias to_int to_i
749-
750746
# <!--
751747
# rdoc-file=complex.c
752748
# - to_r -> rational
@@ -779,8 +775,6 @@ class Complex < Numeric
779775
def to_s: () -> String
780776

781777
def truncate: (?Integer) -> bot
782-
783-
def zero?: () -> bool
784778
end
785779

786780
# <!-- rdoc-file=complex.c -->

core/float.rbs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,10 @@ class Float < Numeric
324324
#
325325
def abs: () -> Float
326326

327-
def abs2: () -> Float
328-
329327
# <!-- rdoc-file=complex.c -->
330328
# Returns 0 if `self` is positive, Math::PI otherwise.
331329
#
332-
def angle: () -> (Integer | Float)
330+
def angle: ...
333331

334332
# <!--
335333
# rdoc-file=complex.c
@@ -417,10 +415,6 @@ class Float < Numeric
417415
#
418416
def coerce: (Numeric) -> [ Float, Float ]
419417

420-
def conj: () -> Float
421-
422-
def conjugate: () -> Float
423-
424418
# <!--
425419
# rdoc-file=rational.c
426420
# - flo.denominator -> integer
@@ -431,8 +425,6 @@ class Float < Numeric
431425
#
432426
def denominator: () -> Integer
433427

434-
def div: (Numeric) -> Integer
435-
436428
# <!--
437429
# rdoc-file=numeric.c
438430
# - divmod(other) -> array
@@ -626,8 +618,6 @@ class Float < Numeric
626618
#
627619
alias inspect to_s
628620

629-
def integer?: () -> bool
630-
631621
# <!--
632622
# rdoc-file=numeric.rb
633623
# - magnitude()
@@ -823,14 +813,8 @@ class Float < Numeric
823813
#
824814
def rationalize: (?Numeric eps) -> Rational
825815

826-
def real: () -> Float
827-
828-
def real?: () -> true
829-
830816
def rect: () -> [ Float, Numeric ]
831817

832-
alias rectangular rect
833-
834818
def remainder: (Numeric) -> Float
835819

836820
# <!--
@@ -893,8 +877,6 @@ class Float < Numeric
893877
| (?by: Numeric, ?to: Numeric) { (Float) -> void } -> self
894878
| (?by: Numeric, ?to: Numeric) -> Enumerator[Float, self]
895879

896-
def to_c: () -> Complex
897-
898880
# <!--
899881
# rdoc-file=numeric.rb
900882
# - to_f -> self

core/integer.rbs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,6 @@ class Integer < Numeric
513513
#
514514
def abs: () -> Integer
515515

516-
def abs2: () -> Integer
517-
518516
# <!--
519517
# rdoc-file=numeric.c
520518
# - allbits?(mask) -> true or false
@@ -538,8 +536,6 @@ class Integer < Numeric
538536
#
539537
def allbits?: (int mask) -> bool
540538

541-
def angle: () -> (Integer | Float)
542-
543539
# <!--
544540
# rdoc-file=numeric.c
545541
# - anybits?(mask) -> true or false
@@ -704,10 +700,6 @@ class Integer < Numeric
704700
#
705701
def coerce: (Numeric) -> [ Numeric, Numeric ]
706702

707-
def conj: () -> Integer
708-
709-
def conjugate: () -> Integer
710-
711703
# <!--
712704
# rdoc-file=numeric.rb
713705
# - denominator -> 1
@@ -823,8 +815,6 @@ class Integer < Numeric
823815
#
824816
def fdiv: (Numeric) -> Float
825817

826-
def finite?: () -> bool
827-
828818
# <!--
829819
# rdoc-file=numeric.c
830820
# - floor(ndigits = 0) -> integer
@@ -895,8 +885,6 @@ class Integer < Numeric
895885
#
896886
def gcdlcm: (Integer) -> [ Integer, Integer ]
897887

898-
def infinite?: () -> Integer?
899-
900888
# <!-- rdoc-file=numeric.c -->
901889
# Returns a string containing the place-value representation of `self` in radix
902890
# `base` (in 2..36).
@@ -1027,8 +1015,6 @@ class Integer < Numeric
10271015
#
10281016
def ord: () -> Integer
10291017

1030-
alias phase angle
1031-
10321018
def polar: () -> [ Integer, Integer | Float ]
10331019

10341020
def positive?: () -> bool
@@ -1077,14 +1063,8 @@ class Integer < Numeric
10771063
#
10781064
def rationalize: (?Numeric eps) -> Rational
10791065

1080-
def real: () -> self
1081-
1082-
def real?: () -> true
1083-
10841066
def rect: () -> [ Integer, Numeric ]
10851067

1086-
alias rectangular rect
1087-
10881068
# <!--
10891069
# rdoc-file=numeric.c
10901070
# - remainder(other) -> real_number
@@ -1215,8 +1195,6 @@ class Integer < Numeric
12151195
def times: () { (Integer) -> void } -> self
12161196
| () -> ::Enumerator[Integer, self]
12171197

1218-
def to_c: () -> Complex
1219-
12201198
# <!--
12211199
# rdoc-file=numeric.c
12221200
# - to_f -> float

core/numeric.rbs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,12 @@ class Numeric
244244
# -->
245245
# Returns the square of `self`.
246246
#
247-
def abs2: () -> Numeric
247+
def abs2: () -> self
248248

249249
# <!-- rdoc-file=complex.c -->
250250
# Returns zero if `self` is positive, Math::PI otherwise.
251251
#
252-
def angle: () -> Numeric
252+
def angle: () -> (0 | Float)
253253

254254
# <!--
255255
# rdoc-file=complex.c
@@ -310,18 +310,18 @@ class Numeric
310310

311311
# <!--
312312
# rdoc-file=numeric.rb
313-
# - conj()
313+
# - conj -> self
314314
# -->
315+
# Returns `self`.
315316
#
316-
def conj: () -> Numeric
317+
def conjugate: () -> self
317318

318319
# <!--
319320
# rdoc-file=numeric.rb
320-
# - conj -> self
321+
# - conj()
321322
# -->
322-
# Returns `self`.
323323
#
324-
def conjugate: () -> Numeric
324+
alias conj conjugate
325325

326326
# <!--
327327
# rdoc-file=rational.c
@@ -590,15 +590,15 @@ class Numeric
590590
# -->
591591
# Returns `self`.
592592
#
593-
def real: () -> Numeric
593+
def real: () -> self
594594

595595
# <!--
596596
# rdoc-file=numeric.rb
597597
# - real? -> true or false
598598
# -->
599599
# Returns `true` if `self` is a real number (i.e. not Complex).
600600
#
601-
def real?: () -> bool
601+
def real?: () -> true
602602

603603
# <!-- rdoc-file=complex.c -->
604604
# Returns array `[self, 0]`.

core/rational.rbs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,6 @@ class Rational < Numeric
186186
#
187187
def abs: () -> Rational
188188

189-
def abs2: () -> Rational
190-
191-
def angle: () -> (Integer | Float)
192-
193-
alias arg angle
194-
195189
# <!--
196190
# rdoc-file=rational.c
197191
# - rat.ceil([ndigits]) -> integer or rational
@@ -220,10 +214,6 @@ class Rational < Numeric
220214

221215
def coerce: (Numeric) -> [ Numeric, Numeric ]
222216

223-
def conj: () -> Rational
224-
225-
def conjugate: () -> Rational
226-
227217
# <!--
228218
# rdoc-file=rational.c
229219
# - rat.denominator -> integer
@@ -237,8 +227,6 @@ class Rational < Numeric
237227
#
238228
def denominator: () -> Integer
239229

240-
def div: (Numeric) -> Integer
241-
242230
def divmod: (Integer | Float | Rational) -> [ Integer, Rational ]
243231
| (Numeric) -> [ Numeric, Numeric ]
244232

@@ -254,8 +242,6 @@ class Rational < Numeric
254242
#
255243
def fdiv: (Numeric) -> Float
256244

257-
def finite?: () -> bool
258-
259245
# <!--
260246
# rdoc-file=rational.c
261247
# - rat.floor([ndigits]) -> integer or rational
@@ -289,8 +275,6 @@ class Rational < Numeric
289275
#
290276
def hash: () -> Integer
291277

292-
def infinite?: () -> Integer?
293-
294278
# <!--
295279
# rdoc-file=rational.c
296280
# - rat.inspect -> string
@@ -303,8 +287,6 @@ class Rational < Numeric
303287
#
304288
def inspect: () -> String
305289

306-
def integer?: () -> bool
307-
308290
# <!-- rdoc-file=rational.c -->
309291
# Returns the absolute value of `rat`.
310292
#
@@ -337,8 +319,6 @@ class Rational < Numeric
337319
#
338320
def numerator: () -> Integer
339321

340-
alias phase angle
341-
342322
def polar: () -> [ Rational, Integer | Float ]
343323

344324
# <!--
@@ -377,14 +357,8 @@ class Rational < Numeric
377357
#
378358
def rationalize: (?Numeric eps) -> Rational
379359

380-
def real: () -> Rational
381-
382-
def real?: () -> true
383-
384360
def rect: () -> [ Rational, Numeric ]
385361

386-
alias rectangular rect
387-
388362
def remainder: (Float) -> Float
389363
| (Numeric) -> Rational
390364

@@ -431,8 +405,6 @@ class Rational < Numeric
431405
| (?by: Numeric, ?to: Numeric) { (Rational) -> void } -> self
432406
| (?by: Numeric, ?to: Numeric) -> Enumerator[Rational, self]
433407

434-
def to_c: () -> Complex
435-
436408
# <!--
437409
# rdoc-file=rational.c
438410
# - rat.to_f -> float
@@ -462,8 +434,6 @@ class Rational < Numeric
462434
#
463435
def to_i: () -> Integer
464436

465-
alias to_int to_i
466-
467437
# <!--
468438
# rdoc-file=rational.c
469439
# - rat.to_r -> self
@@ -512,6 +482,4 @@ class Rational < Numeric
512482
#
513483
def truncate: () -> Integer
514484
| (Integer ndigits) -> (Integer | Rational)
515-
516-
def zero?: () -> bool
517485
end

test/stdlib/Complex_test.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,22 @@ def test_rationalize
130130
a.rationalize(3.11)
131131
end
132132
end
133+
134+
class ComplexInstanceTest < Test::Unit::TestCase
135+
include TestHelper
136+
137+
testing 'Complex'
138+
139+
def test_real
140+
assert_send_type '() -> Integer', Complex(1, 2), :real
141+
end
142+
143+
def test_real?
144+
assert_send_type '() -> false', Complex(1, 2), :real?
145+
end
146+
147+
def test_abs2
148+
assert_send_type '() -> Integer', Complex(1, 2), :abs2
149+
assert_send_type '() -> Float', Complex.polar(2, 2), :abs2
150+
end
151+
end

test/stdlib/Float_test.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,6 @@ def test_coerce
7979
2.5.coerce(1.1)
8080
end
8181

82-
def test_conj
83-
a = 31.4
84-
85-
a.conj
86-
a.conjugate
87-
end
88-
8982
def test_denominator
9083
a = 13.3
9184

0 commit comments

Comments
 (0)