Dmitry Petrashko
Dmitry Petrashko
something like: ```ksy seg: - id: tag type: u1 - id: etc if: enum_known.contains(tag) enums: enum_known: 1: utf8 ```
### Problem Prohibit useless method generics such as https://github.com/sorbet/sorbet/blob/c48e11715a8ceefc92de12c7b22ed0bd4f899a86/rbi/core/array.rbi#L1384-L1390 ### Proposed solution Find if type variable is used once. If the only use is in result type: report error as...
@dug-stripe wanted to experiment with what it would feel like to collapse `BasicObject` and `Object`. I suggested he patch pay-server and in trying certain things I segfaulted Sorbet: ``` $...
First of all, I would like to thank you for such a great project! I've got idea for small improvement: currently html produced by templates contains all whitespaces that where...
#### Input [→ View on sorbet.run](https://sorbet.run/#%23%20typed%3A%20true%0A%0Axs%20%3D%20T%3A%3AArray%5BInteger%5D.new%0A%0Aif%20xs%5B0%5D%0A%20%20puts%20xs%5B0%5D.even%3F%0Aend) ```ruby # typed: true xs = T::Array[Integer].new if xs[0] puts xs[0].even? end ``` #### Observed output ``` editor.rb:6: Method even? does not exist on...
``` std::__1::__throw_out_of_range(char const*) (in sorbet) (stdexcept:0) sorbet::core::Loc::source(sorbet::core::GlobalState const&) const (in sorbet) (string:1784) sorbet::core::Symbol::argumentName(sorbet::core::GlobalState const&) const (in sorbet) (Symbols.cc:0) sorbet::realmain::lsp::methodDetail(sorbet::core::GlobalState const&, sorbet::core::SymbolRef, sorbet::core::TypePtr, sorbet::core::TypePtr, std::__1::shared_ptr) (in sorbet) (string:1427) sorbet::realmain::lsp::symbolRef2DocumentSymbol(sorbet::core::GlobalState const&, sorbet::core::SymbolRef,...
#### Input [→ View on sorbet.run](https://sorbet.run/#%23%20typed%3A%20true%0A%0Aopts%20%3D%20T%3A%3AHash%5BSymbol%2C%20String%5D.new%20do%20%7Chash%2C%20key%7C%0A%20%20T.reveal_type%28hash%29%0A%20%20T.reveal_type%28key%29%0A%20%20key.to_s.upcase%0Aend%0A%0Aval%20%3D%20opts%5B%3Anew_key%5D%0AT.reveal_type%28val%29%20%23%20%3D%3E%20returns%20a%20String%20always%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20%20%20%20%28because%20there%20is%20a%20default%20proc%29%0A%0Aopts%20%3D%20T%3A%3AHash%5BSymbol%2C%20String%5D.new%28'default%20value'%29%0Aval%20%3D%20opts%5B%3Anew_key%5D%0AT.reveal_type%28val%29%20%23%20%3D%3E%20returns%20a%20String%20always%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20%20%20%20%28because%20there%20is%20a%20default%20value%29) ```ruby # typed: true opts = T::Hash[Symbol, String].new do |hash, key| T.reveal_type(hash) T.reveal_type(key) key.to_s.upcase end val = opts[:new_key] T.reveal_type(val) # => returns a String...
Calls to methods like Model.load should never discard returned value. Originally reported by @dmitry-stripe at https://jira.corp.stripe.com/browse/RUBYPLAT-1299
[https://sorbet.run/#module%20Foo%0A%20%20module_function%20def%20foo%0A%20%20%20%20bar%0A%20%20end%0A%20%20%0A%20%20def%20bar%0A%20%20%20%20Kernel.puts%20'hi'%0A%20%20end%0Aend%0A%0Aclass%20Baz%0A%20%20def%20self.baz%0A%20%20%20%20Foo.foo%0A%20%20end%0Aend%0A%0ABaz.baz] ``` module Foo module_function def foo bar end def bar Kernel.puts 'hi' end end class Baz def self.baz Foo.foo end end Baz.baz ``` This code type checks, although the...