steep icon indicating copy to clipboard operation
steep copied to clipboard

`FallbackAny` with local variable in ensure block

Open vpellan opened this issue 1 month ago • 1 comments

This code is valid Ruby:

class LocalVarInEnsure
  def test(check)
    a = 10
    return a if check

    0
  ensure
    puts a
  end
end

But running latest steep with configure_code_diagnostics(Steep::Diagnostic::Ruby.strict) or FallbackAny set to :error will result in this:

lib/playground/local_var_in_ensure.rb:8:9: [warning] Cannot detect the type of the expression
│ Diagnostic ID: Ruby::FallbackAny
│
└     puts a
           ~

vpellan avatar Dec 12 '25 10:12 vpellan

It looks similar to https://github.com/soutaro/steep/issues/919

vpellan avatar Dec 12 '25 12:12 vpellan