Last active
June 25, 2020 01:11
-
-
Save ybiquitous/378421613c7003d74d08afc367149d0d to your computer and use it in GitHub Desktop.
Steep failure for Enumerable#filter_map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.7.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def run | |
(1...9).filter_map { |n| n * 2 if n.even? } | |
end | |
def run2 | |
(1...9).filter(&:even?).map { |n| n * 2 } | |
end | |
end | |
pp Foo.new.run | |
#=> [4, 8, 12, 16] | |
pp Foo.new.run2 | |
#=> [4, 8, 12, 16] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def run: () -> Array[Integer] | |
def run2: () -> Array[Integer] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "https://rubygems.org" | |
gem "steep", git: "https://github.com/soutaro/steep.git", ref: "24363d77095f9e6c5e4f14d3ddb549317ee1d43f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target :lib do | |
signature "sig" | |
check "lib" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/ruby/rbs/blob/503594a4901b37a9aabd30870d1824324f2de712/stdlib/builtin/enumerable.rbs#L377-L378