Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6283,7 +6283,7 @@ void TypeChecker::checkConformancesInContext(IterableDeclContext *idc) {
}

if ((existingModule != dc->getParentModule() && conformanceInOrigModule) ||
isSendable) {
diag.Protocol->isMarkerProtocol()) {
// Warn about the conformance.
if (isSendable && SendableConformance &&
isa<InheritedProtocolConformance>(SendableConformance)) {
Expand Down
2 changes: 1 addition & 1 deletion test/Parse/inverses.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct Burrito<Filling: ~Copyable>: ~Copyable {}
extension Burrito: Alias {} // expected-error {{conformance to 'Copyable' must be declared in a separate extension}}
// expected-note@-1 {{'Burrito<Filling>' declares conformance to protocol 'Copyable' here}}

extension Burrito: Copyable & Edible & P {} // expected-error {{redundant conformance of 'Burrito<Filling>' to protocol 'Copyable'}}
extension Burrito: Copyable & Edible & P {} // expected-warning {{redundant conformance of 'Burrito<Filling>' to protocol 'Copyable'}}

struct Blah<T: ~Copyable>: ~Copyable {}
extension Blah: P, Q, Copyable, R {} // expected-error {{generic struct 'Blah' required to be 'Copyable' but is marked with '~Copyable'}}
Expand Down
7 changes: 7 additions & 0 deletions test/decl/protocol/conforms/redundant_conformance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,10 @@ class Class3 {
class SomeMockClass: Class3.ProviderThree { // okay
var someInt: Int = 5
}


class ImplicitCopyable {}

class InheritImplicitCopyable: ImplicitCopyable, Copyable {}
// expected-warning@-1 {{redundant conformance of 'InheritImplicitCopyable' to protocol 'Copyable'}}
// expected-note@-2 {{'InheritImplicitCopyable' inherits conformance to protocol 'Copyable' from superclass here}}