Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace every Symbol | string & equiv. with the new interned #1499

Merged
merged 6 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/basic_object.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class BasicObject
# k = Klass.new
# k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
#
def __send__: (String | Symbol arg0, *untyped args) -> untyped
def __send__: (interned arg0, *untyped args) -> untyped

# <!-- rdoc-file=object.c -->
# Equality --- At the Object level, #== returns `true` only if `obj` and `other`
Expand Down
1 change: 1 addition & 0 deletions core/builtin.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ type real = Integer | Float | Rational
#
# A lot of builtin functions accept either a Symbol, a String, or something which has `.to_str`
# defined.
#
type interned = Symbol | string

# `boolish` is a type for documentation.
Expand Down
6 changes: 3 additions & 3 deletions core/fiber.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class Fiber < Object
# Explicitly using `storage: true` is currently experimental and may change in
# the future.
#
def initialize: (?blocking: boolish, ?storage: true | Hash[Symbol | String, untyped] | nil) { (*untyped) -> void } -> void
def initialize: (?blocking: boolish, ?storage: true | Hash[interned, untyped] | nil) { (*untyped) -> void } -> void

# <!--
# rdoc-file=cont.c
Expand Down Expand Up @@ -414,7 +414,7 @@ class Fiber < Object
# Returns a copy of the storage hash for the fiber. The method can only be
# called on the Fiber.current.
#
def storage: () -> Hash[Symbol | String, untyped]
def storage: () -> Hash[interned, untyped]

# <!--
# rdoc-file=cont.c
Expand All @@ -438,7 +438,7 @@ class Fiber < Object
# handle_request(request)
# end
#
def storage=: (Hash[Symbol | String, untyped]) -> Hash[Symbol | String, untyped]
def storage=: (Hash[interned, untyped]) -> Hash[interned, untyped]

# <!--
# rdoc-file=cont.c
Expand Down
4 changes: 2 additions & 2 deletions core/kernel.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ module Kernel : BasicObject
# If *const* is defined as autoload, the file name to be loaded is replaced with
# *filename*. If *const* is defined but not as autoload, does nothing.
#
def self?.autoload: (String | Symbol _module, String filename) -> NilClass
def self?.autoload: (interned _module, String filename) -> NilClass

# <!--
# rdoc-file=load.c
Expand All @@ -756,7 +756,7 @@ module Kernel : BasicObject
# autoload(:B, "b")
# autoload?(:B) #=> "b"
#
def self?.autoload?: (Symbol | String name) -> String?
def self?.autoload?: (interned name) -> String?

# <!--
# rdoc-file=proc.c
Expand Down
16 changes: 8 additions & 8 deletions core/match_data.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MatchData
def []: (Integer idx) -> String?
| (Integer start, Integer length) -> ::Array[String?]
| (::Range[Integer] range) -> ::Array[String?]
| (String | Symbol name) -> String?
| (interned name) -> String?

# <!--
# rdoc-file=re.c
Expand Down Expand Up @@ -121,7 +121,7 @@ class MatchData
#
# Related: MatchData#end, MatchData#offset, MatchData#byteoffset.
#
def begin: (Integer | String | Symbol n_or_name) -> Integer?
def begin: (Integer | interned n_or_name) -> Integer?

# <!--
# rdoc-file=re.c
Expand All @@ -139,7 +139,7 @@ class MatchData
# p m.byteoffset(:foo) #=> [0, 1]
# p m.byteoffset(:bar) #=> [2, 3]
#
def byteoffset: (Integer | Symbol | String n_or_name) -> ([ Integer, Integer ] | [ nil, nil ])
def byteoffset: (Integer | interned n_or_name) -> ([ Integer, Integer ] | [ nil, nil ])

# <!--
# rdoc-file=re.c
Expand Down Expand Up @@ -221,7 +221,7 @@ class MatchData
#
# Related: MatchData#begin, MatchData#offset, MatchData#byteoffset.
#
def end: (Integer | String | Symbol n_or_name) -> Integer?
def end: (Integer | interned n_or_name) -> Integer?

# <!--
# rdoc-file=re.c
Expand Down Expand Up @@ -348,7 +348,7 @@ class MatchData
# m.match('foo') # => "h"
# m.match(:bar) # => "ge"
#
def match: (int | String | Symbol) -> String?
def match: (int | interned) -> String?

# <!--
# rdoc-file=re.c
Expand All @@ -375,7 +375,7 @@ class MatchData
# m.match_length('foo') # => 1
# m.match_length(:bar) # => 2
#
def match_length: (int | String | Symbol) -> Integer?
def match_length: (int | interned) -> Integer?

# <!--
# rdoc-file=re.c
Expand Down Expand Up @@ -414,7 +414,7 @@ class MatchData
#
# Related: MatchData#byteoffset, MatchData#begin, MatchData#end.
#
def offset: (Integer | Symbol | String n_or_name) -> ([ Integer, Integer ] | [ nil, nil ])
def offset: (Integer | interned n_or_name) -> ([ Integer, Integer ] | [ nil, nil ])

# <!--
# rdoc-file=re.c
Expand Down Expand Up @@ -544,7 +544,7 @@ class MatchData
# m.values_at(0, 1..2, :a, :b, :op)
# # => ["1 + 2", "1", "+", "1", "2", "+"]
#
def values_at: (*Integer | Symbol | String n_or_name) -> ::Array[String?]
def values_at: (*Integer | interned n_or_name) -> ::Array[String?]

private

Expand Down
Loading