sig/members.rbs in rbs-1.1.1 vs sig/members.rbs in rbs-1.2.0
- old
+ new
@@ -13,39 +13,62 @@
end
class MethodDefinition < Base
type kind = :instance | :singleton | :singleton_instance
+ # def foo: () -> void
+ # ^^^ keyword
+ # ^^^ name
+ #
+ # def self.bar: () -> void | ...
+ # ^^^ keyword
+ # ^^^^^ kind
+ # ^^^ name
+ # ^^^ overload
+ #
+ type loc = Location::WithChildren[:keyword | :name, :kind | :overload]
+
attr_reader name: Symbol
attr_reader kind: kind
attr_reader types: Array[MethodType]
attr_reader annotations: Array[Annotation]
- attr_reader location: Location?
+ attr_reader location: loc?
attr_reader comment: Comment?
attr_reader overload: bool
- def initialize: (name: Symbol, kind: kind, types: Array[MethodType], annotations: Array[Annotation], location: Location?, comment: Comment?, overload: boolish) -> void
+ def initialize: (name: Symbol, kind: kind, types: Array[MethodType], annotations: Array[Annotation], location: loc?, comment: Comment?, overload: boolish) -> void
include _HashEqual
include _ToJson
def instance?: () -> bool
def singleton?: () -> bool
def overload?: () -> bool
- def update: (?name: Symbol, ?kind: kind, ?types: Array[MethodType], ?annotations: Array[Annotation], ?location: Location?, ?comment: Comment?, ?overload: boolish) -> MethodDefinition
+ def update: (?name: Symbol, ?kind: kind, ?types: Array[MethodType], ?annotations: Array[Annotation], ?location: loc?, ?comment: Comment?, ?overload: boolish) -> MethodDefinition
end
module Var
+ # @foo: String
+ # ^^^^ name
+ # ^ colon
+ #
+ # self.@all: Array[String]
+ # ^^^^^ kind
+ # ^^^^ name
+ # ^ colon
+ #
+ type loc = Location::WithChildren[:name | :colon, :kind]
+
attr_reader name: Symbol
attr_reader type: Types::t
- attr_reader location: Location?
+ attr_reader location: loc?
attr_reader comment: Comment?
- def initialize: (name: Symbol, type: Types::t, location: Location?, comment: Comment?) -> void
+ def initialize: (name: Symbol, type: Types::t, location: loc?, comment: Comment?) -> void
include _HashEqual
end
class InstanceVariable < Base
@@ -62,17 +85,29 @@
include Var
include _ToJson
end
module Mixin
+ # include Foo
+ # ^^^^^^^ keyword
+ # ^^^ name
+ #
+ # include Array[String]
+ # ^^^^^^^ keyword
+ # ^^^^^ name
+ # ^ arg_open
+ # ^ arg_close
+ #
+ type loc = Location::WithChildren[:name | :keyword, :args]
+
attr_reader name: TypeName
attr_reader args: Array[Types::t]
attr_reader annotations: Array[Annotation]
- attr_reader location: Location?
+ attr_reader location: loc?
attr_reader comment: Comment?
- def initialize: (name: TypeName, args: Array[Types::t], annotations: Array[Annotation], location: Location?, comment: Comment?) -> void
+ def initialize: (name: TypeName, args: Array[Types::t], annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
include _HashEqual
end
class Include < Base
@@ -91,23 +126,38 @@
end
module Attribute
type kind = :instance | :singleton
+ # attr_reader name: String
+ # ^^^^^^^^^^^ keyword
+ # ^^^^ name
+ # ^ colon
+ #
+ # attr_accessor self.name (@foo) : String
+ # ^^^^^^^^^^^^^ keyword
+ # ^^^^^ kind
+ # ^^^^ name
+ # ^^^^^^ ivar
+ # ^^^^ ivar_name
+ # ^ colon
+ #
+ type loc = Location::WithChildren[:keyword | :name | :colon, :kind | :ivar | :ivar_name]
+
attr_reader name: Symbol
attr_reader type: Types::t
attr_reader kind: kind
attr_reader ivar_name: Symbol | false | nil
attr_reader annotations: Array[Annotation]
- attr_reader location: Location?
+ attr_reader location: loc?
attr_reader comment: Comment?
- def initialize: (name: Symbol, type: Types::t, ivar_name: Symbol | false | nil, kind: kind, annotations: Array[Annotation], location: Location?, comment: Comment?) -> void
+ def initialize: (name: Symbol, type: Types::t, ivar_name: Symbol | false | nil, kind: kind, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
include _HashEqual
- def update: (?name: Symbol, ?type: Types::t, ?ivar_name: Symbol | false | nil, ?kind: kind, ?annotations: Array[Annotation], ?location: Location?, ?comment: Comment?) -> instance
+ def update: (?name: Symbol, ?type: Types::t, ?ivar_name: Symbol | false | nil, ?kind: kind, ?annotations: Array[Annotation], ?location: loc?, ?comment: Comment?) -> instance
end
class AttrReader < Base
include Attribute
include _ToJson
@@ -142,17 +192,31 @@
end
class Alias < Base
type kind = :instance | :singleton
+ # alias foo bar
+ # ^^^^^ keyword
+ # ^^^ new_name
+ # ^^^ old_name
+ #
+ # alias self.foo self.bar
+ # ^^^^^ keyword
+ # ^^^^^ new_kind
+ # ^^^ new_name
+ # ^^^^^ old_kind
+ # ^^^ old_name
+ #
+ type loc = Location::WithChildren[:keyword | :new_name | :old_name, :new_kind | :old_kind]
+
attr_reader new_name: Symbol
attr_reader old_name: Symbol
attr_reader kind: kind
attr_reader annotations: Array[Annotation]
- attr_reader location: Location?
+ attr_reader location: loc?
attr_reader comment: Comment?
- def initialize: (new_name: Symbol, old_name: Symbol, kind: kind, annotations: Array[Annotation], location: Location?, comment: Comment?) -> void
+ def initialize: (new_name: Symbol, old_name: Symbol, kind: kind, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
include _HashEqual
include _ToJson
def instance?: () -> bool