Skip to content

Fix resolution in blocks in type checker - #890

Merged
castwide merged 75 commits into
castwide:masterfrom
apiology:define_method
Sep 30, 2025
Merged

Fix resolution in blocks in type checker#890
castwide merged 75 commits into
castwide:masterfrom
apiology:define_method

Conversation

@apiology

@apiology apiology commented Apr 11, 2025

Copy link
Copy Markdown
Contributor

This bug affected blocks passed to define_method() - the type checker set their closure as the class of the method despite the correct annotations.

@apiology apiology changed the title Fix resolution from blocks in type checkerfills Fix resolution from blocks in type checker Apr 11, 2025
@apiology
apiology marked this pull request as draft April 12, 2025 10:47
end

# @deprecated Please use locate_closure_pin instead
alias locate_block_pin locate_closure_pin

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lekemula Heads up on this one - once this and #877 are out, maybe you can make a new release that uses locate_closure_pin so we can remove this alias.

chain = Solargraph::Parser.chain(const, filename)
block_pin = source_map.locate_block_pin(rng.start.line, rng.start.column)
closure_pin = source_map.locate_closure_pin(rng.start.line, rng.start.column)
closure_pin.rebind(api_map)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the real change

@in_block = begin
tree = cursor.source.tree_at(cursor.position.line, cursor.position.column)
Parser.is_ast_node?(tree[1]) && [:block, :ITER].include?(tree[1].type)
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused method

@apiology apiology changed the title Fix resolution from blocks in type checker Fix resolution in blocks in type checker Jul 2, 2025
@apiology
apiology marked this pull request as ready for review July 2, 2025 19:43
@apiology
apiology marked this pull request as draft August 21, 2025 14:55
@apiology
apiology marked this pull request as ready for review August 29, 2025 21:51
@castwide
castwide merged commit 37cbaaf into castwide:master Sep 30, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants