Skip to content

[5.9🍒] Be more specific than "noncopyable type T can't be used with generics yet" #66946

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

Merged
merged 6 commits into from
Jun 27, 2023

Conversation

kavon
Copy link
Member

@kavon kavon commented Jun 27, 2023

• Description: Important polish work to be more helpful about the reason why a noncopyable can't be used, example:

- let x = [MO()]  // error: noncopyable type 'MO' cannot be used with generics yet
+ let x = [MO()] // error: noncopyable type 'MO' cannot be substituted for copyable generic parameter 'Element' in 'Array'

• Risk: Very Low. Only changes the diagnostics to be more useful. When encountering a case it doesn't know how to handle, we fall back on the old, vague message.
• Original PR: #66871
• Reviewed By: @slavapestov
• Testing: regression tests included
• Resolves: rdar://108914588

kavon added 6 commits June 26, 2023 19:49
…as used with.

This change causes explicit types written in the
source language that substitute a noncopyable type
for a type variable in a generic type to state
that's what's wrong. For example:

```
// NEW: noncopyable type 'MO' cannot be used with generic type 'Dictionary<Key, Value>' yet
// OLD: noncopyable type 'MO' cannot be used with generics yet
let _: [MO : T]
```
@kavon kavon requested a review from a team as a code owner June 27, 2023 02:51
@kavon
Copy link
Member Author

kavon commented Jun 27, 2023

@swift-ci please test

@kavon kavon merged commit 2a62070 into swiftlang:release/5.9 Jun 27, 2023
@kavon kavon deleted the 5.9-generics-error-noncopyable branch June 27, 2023 17:41
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.

3 participants