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

SR-5753: Don't warn about constraints made redundant by inferred constraints #12007

Closed
wants to merge 0 commits into from

Conversation

DougGregor
Copy link
Member

By default, don't warn about generic constraints that have been made
redundant by inferred constraints, e.g.,

func f<T: Hashable>(set: Set<T>) { }

T: Hashable is inferred by the Set parameter, but enough users are
annoyed or confused by this behavior that we'll turn it off by
default. The new command-line parameter
-warn-redundant-inferred-constraints enables these warnings.

Resolves SR-5753.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@jrose-apple I bet you're not gonna like this one :)

@jrose-apple
Copy link
Contributor

I like the change in default, dislike that there's a warning flag. Who's turning the flag on?

@NachoSoto
Copy link
Contributor

Love it.

@DougGregor
Copy link
Member Author

The standard library and some test cases are currently turning the flag on.

@jrose-apple
Copy link
Contributor

I guess I meant we shouldn't bother using it in the stdlib either. It's convenient when we remove hack constraints, but the original motivation seems to apply just as much to the stdlib: sometimes code is clearer when you can state a constraint explicitly that isn't obvious from the types that use the generic parameter.

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.

None yet

3 participants