Warning about `hasher.combine(self)`

Can we have a warning here?

    func hash(into hasher: inout Hasher) {
        hasher.combine(self)
        // wanted warning: Function call causes an infinite recursion
    }
2 Likes

why not generate the warning for all transparent (or even inlinable) functions?

Do you recon it's easier?

Sure, we have many places where a warning would help. Examples:

    func foo() {
        { foo() }()
    }

or:

    func foo() { bar() }
    func bar() { foo() }

Diagnostics improvements (“quality of implementation”) are considered outside the scope of Swift Evolution and can be simply filed as a bug (if it hasn’t been already, which I’d imagine it has been in this case).

1 Like

How does one differentiate between "diagnostic improvement / quality of implementation" warning and other warnings? We've had a few threads here, most recent about "Retroactive Conformances of External Types".

Retroactive conformances are a supported feature; changing the language to warn about it requires a proposal. Adding a warning that something doesn’t work isn’t a language change.

what category should @tera have posted this under instead? it is not really about "Using Swift", and it's never really been clear to me if the Development category is appropriate for feature requests; most of the discussion there is about the day to day maintenance of the compiler and implementation of already-accepted proposals.

1 Like

You'd file an issue with the bug tracker on GitHub.

1 Like

i don't browse the bug tracker too often, in my view one of the benefits of posting on forums is it brings more visibility to an issue.

7 Likes