From 8d940e3032055faa7271fc517c8f66ea34084542 Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Fri, 24 Dec 2021 22:54:45 +0900 Subject: [PATCH] Bundle RBS 2.0.0 (#5330) * Bundle RBS 2.0.0 * Update NEWS.md --- NEWS.md | 31 ++++++++++++++++++++++++++++++- gems/bundled_gems | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 223b40ecab..f33f9267b5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -368,7 +368,7 @@ Note: We're only listing outstanding class updates. * rake 13.0.6 * test-unit 3.5.3 * rexml 3.2.5 - * rbs 1.8.1 + * rbs 2.0.0 * typeprof 0.21.1 * The following default gems are now bundled gems. * net-ftp 0.1.3 @@ -469,8 +469,37 @@ See [this blog post](https://shopify.engineering/yjit-just-in-time-compiler-crub ### RBS +* Generics type parameters can be bounded ([PR](https://github.com/ruby/rbs/pull/844)). + + ```rbs + # `T` must be compatible with the `_Output` interface. + # `PrettyPrint[String]` is ok, but `PrettyPrint[Integer]` is a type error. + class PrettyPrint[T < _Output] + interface _Output + def <<: (String) -> void + end + + attr_reader output: T + + def initialize: (T output) -> void + end + ``` + +* Type aliases can be generic. ([PR](https://github.com/ruby/rbs/pull/823)) + + ```rbs + # Defines a generic type `list`. + type list[T] = [ T, list[T] ] + | nil + + type str_list = list[String] + type int_list = list[Integer] + ``` + * [rbs collection](https://github.com/ruby/rbs/blob/master/docs/collection.md) has been introduced to manage gems’ RBSs. + * Many signatures for built-in and standard libraries have been added/updated. + * It includes many bug fixes and performance improvements too. See the [CHANGELOG.md](https://github.com/ruby/rbs/blob/master/CHANGELOG.md) for more information. diff --git a/gems/bundled_gems b/gems/bundled_gems index e11b665d43..0d5cddae80 100644 --- a/gems/bundled_gems +++ b/gems/bundled_gems @@ -11,6 +11,6 @@ net-pop 0.1.1 https://github.com/ruby/net-pop net-smtp 0.3.1 https://github.com/ruby/net-smtp matrix 0.4.2 https://github.com/ruby/matrix prime 0.1.2 https://github.com/ruby/prime -rbs 1.8.1 https://github.com/ruby/rbs +rbs 2.0.0 https://github.com/ruby/rbs typeprof 0.21.1 https://github.com/ruby/typeprof debug 1.4.0 https://github.com/ruby/debug