Skip to content

Conversation

ckaznocha
Copy link
Owner

closes #48

@ckaznocha ckaznocha requested a review from Copilot March 20, 2025 22:01
@ckaznocha ckaznocha self-assigned this Mar 20, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that functions and methods are not automatically fixed by updating diagnostic checks when key values are computed via function or method calls. It also streamlines length and integer cast checks by consolidating repeated logic into helper functions.

  • Introduces a new check in checkForStmt that reports when a function or method call is used for the loop key.
  • Refactors checks in checkRangeStmt, findNExpr, and number literal evaluations to use isLen and isIntCast.
  • Adds helper functions: isFunctionOrMethodCall, isIntCast, and isLen.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
intrange.go Adds enhanced diagnostic reporting for function/method-based keys and refactors checks.
testdata/main.go Adds test case issue48 to illustrate the new behavior when a function/method is used.
Files not reviewed (1)
  • testdata/main.go.golden: Language not supported

@ckaznocha ckaznocha merged commit 08d3458 into main Mar 20, 2025
8 checks passed
@ckaznocha ckaznocha deleted the ckaznocha/issue49 branch March 20, 2025 22:03
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.

intrange ignores traditional for loop semantics
1 participant