7. 1. 型シグネチャフォーマット
•Rubyコードの型情報を示すもの
class Array[A]
include Enumerable
def []: (Integer) -> A
def []=: (Integer,A) -> A
def each:
{ (A) -> void } -> self
...
end
interface
generics
union type
option type
any type
Proposal:
ruby-signature
7
11. Ruby 3の静的解析の図
Library code
type signature
Sorbet
Steep
RDL
Type error
warnings
Application code
mmc
Type Profiler
Type error
warnings
type signature
11
27. RubyKaigi からの進捗 (2)
•Flow sensitiveな解析
•右の例で警告が出ない
•分岐で単純フォークすると
誤警告が出てしまう
def foo(x)
if x.is_a?(Integer)
x + 42
else
x + "str"
end
end
foo(42)
foo("str")
27