Skip to content

Conversation

@nate-chandler
Copy link
Contributor

In addition to the existing language mechanism of @available(*, unavailable) on an extension.

Copy link
Member

Choose a reason for hiding this comment

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

Why do we care that MemoryLayout is not bitwise copyable? It has no cases anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was requested here: swiftlang/swift-evolution#2314 (comment) .

Comment on lines 82 to 90
Copy link
Member

Choose a reason for hiding this comment

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

This will introduce a second representation for the ~Protocol syntax in the AST: For the "invertible" protocols like Copyable, we represent them as a ProtocolCompositionType, which has its own list of inverses. I think that representation doesn't make sense for this use case, so it's okay to have two.

@nate-chandler nate-chandler force-pushed the bitwise-copyable/20240327/1 branch 12 times, most recently from 5943253 to adf0553 Compare April 3, 2024 00:49
@nate-chandler nate-chandler requested a review from DougGregor April 4, 2024 00:00
@nate-chandler nate-chandler force-pushed the bitwise-copyable/20240327/1 branch 7 times, most recently from 5e87c57 to 78f3e45 Compare April 9, 2024 23:22
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler marked this pull request as ready for review April 10, 2024 01:51
@nate-chandler nate-chandler requested review from a team, rintaro and tshortli as code owners April 10, 2024 01:51
Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

I think you want to look at the callers of getDirectlyInheritedNominalTypeDecls() in ConformanceLookupTable.cpp, and put the logic there. getDirectlyInheritedNominalTypeDecls() should be generalized to collect and return these new "repressible" protocols.

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a lot of new code for just the new ~BitwiseCopyable syntax. Can you instead find a way to generalize the existing logic for ~Copyable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think having a different representation for this case--the case of a protocol that isn't conformed to by all types by default (i.e. unlike Copyable) but is inferred automatically for some types--makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the wrong thing to turn into a request. checkInheritanceClause() only exists to emit diagnostics, and we don't want to emit the diagnostics in a secondary file. TypeCheckDeclPrimary.cpp shouldn't have logic for computing things, it's just diagnostics

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this requestification and moved SuppressesConformanceRequest into TypeCheckRequestFunctions.cpp.

@nate-chandler nate-chandler force-pushed the bitwise-copyable/20240327/1 branch from 78f3e45 to 0e78f7e Compare April 10, 2024 17:56
@nate-chandler
Copy link
Contributor Author

@swift-ci please build toolchain

This is the subset of suppressible protocols that are not invertible.
This commit doesn't add any such protocols.
Add the machinery to support suppression of inference of conformance to
protocols that would otherwise be derived automatically.

This commit does not enable any conformances to be suppressed.
In addition to the existing language mechanism of
`@available(*, unavailable)`.
@nate-chandler nate-chandler force-pushed the bitwise-copyable/20240327/1 branch from 0e78f7e to eb1f0ac Compare April 15, 2024 23:46
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

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