π€ Filed by Claude, not the account owner β acting on their behalf via their GitHub credentials.
Any method that has an ensure clause β even an empty one β fails solargraph typecheck --level strong with return type could not be inferred, regardless of the declared @return tag or what the method body actually does. This is unrelated to generics, yield, or block parameters.
Minimal reproduction
class Repro
# @return [String]
def call
'hello'
ensure
nil
end
end
$ solargraph typecheck --level strong repro.rb
repro.rb:3: Repro#call return type could not be inferred
Removing the ensure clause (identical method otherwise) β 0 problems.
Isolation
- Declared return type doesn't matter β tried
String, Object, void; all fail identically with ensure present.
- Body content doesn't matter β a literal (
'hello'), a local variable, a method call, all fail identically.
- Content of the
ensure block doesn't matter β nil, an assignment, an empty block, all trigger it.
Environment
Reproduced on plain upstream solargraph 0.60.3 (installed via gem install solargraph, no project config, no Gemfile in scope β confirmed with BUNDLE_GEMFILE/GEM_HOME/GEM_PATH explicitly unset to rule out any local fork/patch contamination).
π€ Filed by Claude, not the account owner β acting on their behalf via their GitHub credentials.
Any method that has an
ensureclause β even an empty one β failssolargraph typecheck --level strongwithreturn type could not be inferred, regardless of the declared@returntag or what the method body actually does. This is unrelated to generics,yield, or block parameters.Minimal reproduction
Removing the
ensureclause (identical method otherwise) β 0 problems.Isolation
String,Object,void; all fail identically withensurepresent.'hello'), a local variable, a method call, all fail identically.ensureblock doesn't matter βnil, an assignment, an empty block, all trigger it.Environment
Reproduced on plain upstream
solargraph 0.60.3(installed viagem install solargraph, no project config, no Gemfile in scope β confirmed withBUNDLE_GEMFILE/GEM_HOME/GEM_PATHexplicitly unset to rule out any local fork/patch contamination).