Sorbet: Abstract methods cause `This code is untyped` errors with `typed: strong`

Created on 12 May 2020  Â·  4Comments  Â·  Source: sorbet/sorbet

Input

→ View on sorbet.run

# typed: strong

module Foo
  extend T::Helpers
  extend T::Sig

  interface!

  sig { abstract.returns(String) }
  def bar; end
end

Observed output

editor.rb:10: This code is untyped https://srb.help/7018
    10 |  def bar; end
          ^^^^^^^^^^^^
Errors: 1

Expected behavior

This code should not create an error.


This was introduced in d53818d77599c62746d4cec4f89f993f92e13d63 by #2950.

Reported by @paracycle.

bug

All 4 comments

I've updated the language about # typed: strong on sorbet.org, but the summary is that we've considered it to be unstable for some time. It can be hard to avoid introducing intermediate T.untyped values in the rewrite phases, so for that reason I'd suggest using # typed: strict instead.

@elliottt Agreed, that makes total sense. However, I think we should also make # typed: strong not be a suggested strictness level by Sorbet tools, in that case. Otherwise, any changes in Sorbet ends up needing a strictness level change for files that used to be fine.

And I just saw the PR from you that does exactly that: https://github.com/sorbet/sorbet/pull/3020 Thanks!

I guess we can close this issue now, since there isn't anything actionable here.

Was this page helpful?
0 / 5 - 0 ratings