File tree Expand file tree Collapse file tree 6 files changed +31
-10
lines changed
Expand file tree Collapse file tree 6 files changed +31
-10
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ Rubycw/Rubycw:
1111 Enabled : true
1212 Exclude :
1313 - ' test/**/*_test.rb'
14+ - ' test/typecheck/**/*.rb'
1415
1516RBS :
1617 Enabled : true
Original file line number Diff line number Diff line change @@ -1319,7 +1319,7 @@ module Kernel : BasicObject
13191319 # See also Random.rand.
13201320 #
13211321 def self?.rand : (?0) -> Float
1322- | (int arg0) -> ( Integer | Float)
1322+ | (int arg0) -> Integer
13231323 | (::Range[Integer] arg0) -> Integer?
13241324 | (::Range[Float] arg0) -> Float?
13251325
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ class Random < RBS::Unnamed::Random_Base
9191 #
9292 # See also Random#rand.
9393 #
94- def self.rand : () -> Float
94+ def self.rand : (?0 ) -> Float
9595 | (Integer | ::Range[Integer] max) -> Integer
9696 | (Float | ::Range[Float] max) -> Float
9797 | [T < Numeric] (::Range[T]) -> T
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ module RBS
4747 # (`-`) and add (`+`)methods, or rand will raise an ArgumentError.
4848 #
4949 %a{annotate:rdoc:copy:Random#rand}
50- def rand : () -> Float
50+ def rand : (?0 ) -> Float
5151 | (Integer | ::Range[Integer] max) -> Integer
5252 | (Float | ::Range[Float] max) -> Float
5353
@@ -200,13 +200,13 @@ module RBS
200200 # Generates formatted random number from raw random bytes. See Random#rand.
201201 #
202202 %a{annotate:rdoc:copy:Random::Formatter#rand}
203- def rand : () -> Float
204- | (? Float? n) -> Float
205- | (? Integer? n) -> Integer
206- | (? Numeric? n) -> Numeric
207- | (? ::Range[Float]? n) -> Float
208- | (? ::Range[Integer]? n) -> Integer
209- | (? ::Range[Numeric]? n) -> Numeric
203+ def rand : (?0 ) -> Float
204+ | (Float? n) -> Float
205+ | (Integer n) -> Integer
206+ | (Numeric n) -> Numeric
207+ | (::Range[Float] n) -> Float
208+ | (::Range[Integer] n) -> Integer
209+ | (::Range[Numeric] n) -> Numeric
210210
211211 %a{annotate:rdoc:copy:Random::Formatter#random_byte}
212212 def random_bytes : (?Integer? n) -> String
Original file line number Diff line number Diff line change 1+ D = Steep ::Diagnostic
2+
3+ target :test do
4+ signature "."
5+ check "."
6+ configure_code_diagnostics ( D ::Ruby . all_error )
7+ end
Original file line number Diff line number Diff line change 1+ # @type var int: Integer
2+ # @type var float: Float
3+
4+ float = rand ( 0 )
5+ int = rand ( 1 )
6+
7+ i = 2
8+ int = rand ( i )
9+
10+ int = rand ( 1 ..10 ) || 0
11+ float = rand ( ( 1.0 ) ..( 2.2 ) ) || 0.1
12+
13+ int = rand ( 1.1 )
You can’t perform that action at this time.
0 commit comments