diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-10-20 13:16:19 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2020-10-20 22:48:35 +0900 |
commit | a3ae90b8c552e4f98d81284815c50691be7e1a36 (patch) | |
tree | ed85b4a0a6f9f2909490626d30c98fbb06b2ee10 /NEWS.md | |
parent | 451836f5824fdf3c457ab8a5fd91d94cea91862e (diff) |
NEWS.md: mention TypeProf
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3674
Diffstat (limited to 'NEWS.md')
-rw-r--r-- | NEWS.md | 37 |
1 files changed, 35 insertions, 2 deletions
@@ -83,7 +83,9 @@ sufficient information, see the ChangeLog file or Redmine * Interpolated String literals are no longer frozen when `# frozen-string-literal: true` is used. [[Feature #17104]] -* RBS is introduced. It is a type definition language for Ruby programs. +* A static analysis foundation is introduced. See "Static analysis" section in detail. + * RBS is introduced. It is a type definition language for Ruby programs. + * TypeProf is experimentally bundled. It is a type analysis tool for Ruby programs. ## Command line options @@ -417,7 +419,9 @@ Excluding feature bug fixes. * Optimize C method call a little -## RBS +## Statis analysis + +### RBS * RBS is a new language for type definition of Ruby programs. It allows writing types of classes and modules with advanced @@ -428,6 +432,35 @@ Excluding feature bug fixes. * `rbs` gem is bundled to load and process RBS files. +### TypeProf + +* TypeProf is a type analysis tool for Ruby code based on abstract interpretation. + * It reads non-annotated Ruby code, tries inferring its type signature, and prints + the analysis result in RBS format. + * Though it supports only a subset of the Ruby language yet, we will continuously + improve the coverage of language features, the analysis performance, and usability. + +```ruby +# test.rb +def foo(x) + if x > 10 + x.to_s + else + nil + end +end + +foo(42) +``` + +``` +$ typeprof test.rb +# Classes +class Object + def foo : (Integer) -> String? +end +``` + ## Miscellaneous changes * Methods using `ruby2_keywords` will no longer keep empty keyword |