Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocorrect for implicit_return breaks when implicit returns are nested #5660

Closed
2 tasks done
mildm8nnered opened this issue Jul 8, 2024 · 0 comments · Fixed by #5661
Closed
2 tasks done

Autocorrect for implicit_return breaks when implicit returns are nested #5660

mildm8nnered opened this issue Jul 8, 2024 · 0 comments · Fixed by #5661
Labels
bug Unexpected and reproducible misbehavior.

Comments

@mildm8nnered
Copy link
Collaborator

New Issue Checklist

Describe the bug

autocorrect for implicit_return breaks when implicit returns are nested. Running --fix for implicit_return on the SwiftLint source (0.55.1 for example)

In YamlParser.swift

    static func constructExpandingEnvVars(env: [String: String]) -> (_ scalar: Node.Scalar) -> String? {
        return { (scalar: Node.Scalar) -> String? in
            return scalar.string.expandingEnvVars(env: env)
        }
    }

becomes

    static func constructExpandingEnvVars(env: [String: String]) -> (_ scalar: Node.Scalar) -> String? {
        { (scalar: Node.Scalar) -> String? in
            return string.expandingEnvVars(env: env)
        }
    }

which fails to compile with

/Users/martin.redington/Documents/Source/SwiftLint/Source/SwiftLintCore/Models/YamlParser.swift:44:20: error: cannot find 'string' in scope
            return string.expandingEnvVars(env: env)

Multiple other similar cases in the SwiftLint source.

@mildm8nnered mildm8nnered added the bug Unexpected and reproducible misbehavior. label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant