Skip to content

Fix typo and add instance variable test coverage for flow sensitive typing - #20

Merged
apiology merged 2 commits into
union_type_enforcement_ivarsfrom
copilot/sub-pr-19
Nov 22, 2025
Merged

apiology merged 2 commits into
union_type_enforcement_ivarsfrom
copilot/sub-pr-19

Conversation

Copilot AI commented Nov 20, 2025 •

Copy link
Copy Markdown

Code review of the ivar support implementation identified a typo and missing test coverage for the core feature.

Changes

  • Fixed typo in comment (line 63 of flow_sensitive_typing.rb): "so't provide" → "so provide"
  • Added test for instance variable type refinement: Validates .is_a?() correctly narrows instance variable types in conditionals

Example

The new test validates this behavior:

class Example
  # @param value [ReproBase]
  def initialize(value)
    @value = value
  end

  def check
    if @value.is_a?(Repro)
      @value  # Now typed as Repro
    else
      @value  # Now typed as ReproBase (narrowed from union)
    end
  end
end

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: apiology <3681194+apiology@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ivar support to flow sensitive typing Fix typo and add instance variable test coverage for flow sensitive typing Nov 20, 2025
Copilot AI requested a review from apiology November 20, 2025 14:11
@apiology
apiology marked this pull request as ready for review November 22, 2025 17:25
@apiology
apiology merged commit a976d8b into union_type_enforcement_ivars Nov 22, 2025
11 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