rbs
rbs copied to clipboard
calling #each on obj typed with record yields |bot, bot| types
# RBS
# type rec = {foo: String, bar: Integer }
# and having variable a typed as rec
a.each do |x, y|
# x and y appear as bot
I'm also assuming narrowing on key won't also work (but that's more of a feature request perhaps):
a.each do |x, y|
if x == :foo
# then y is a string
Looks like it works with Steep 1.7.1. Can you give me some more detail to reproduce?
module A
type context = {
?msg: Hash[interned, untyped],
# identifiers
?identifiers: Hash[interned, untyped],
# ....
}
def self?.hash_flat_merge: (context, context) -> context
}
Then "#each" declares them as bot in steep.
using latest rbs and steep.
💡 Optional keys are not supported and simply ignored in Steep. The implementation in RBS was finished, but the Steep side slipped my mind. 🙇
@sampersand You may be interested in working for this.