mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
swift-module-digester: diagnose removing default associated type as API breakage.
This commit is contained in:
@@ -62,6 +62,8 @@ ERROR(conformance_removed,none,"%0 has removed %select{conformance to|inherited
|
||||
|
||||
ERROR(conformance_added,none,"%0 has added inherited protocol %1", (StringRef, StringRef))
|
||||
|
||||
ERROR(default_associated_type_removed,none,"%0 has removed default type %1", (StringRef, StringRef))
|
||||
|
||||
#ifndef DIAG_NO_UNDEF
|
||||
# if defined(DIAG)
|
||||
# undef DIAG
|
||||
|
||||
@@ -69,3 +69,8 @@ public class C7 {
|
||||
public protocol P3: P2, P1 {}
|
||||
|
||||
extension fixedLayoutStruct: P1 {}
|
||||
|
||||
public protocol AssociatedTypePro {
|
||||
associatedtype T1 = Int
|
||||
associatedtype T2
|
||||
}
|
||||
|
||||
@@ -76,3 +76,8 @@ public protocol P3: P1, P4 {}
|
||||
public protocol P4 {}
|
||||
|
||||
extension fixedLayoutStruct: P2 {}
|
||||
|
||||
public protocol AssociatedTypePro {
|
||||
associatedtype T1
|
||||
associatedtype T2
|
||||
}
|
||||
|
||||
@@ -47,3 +47,6 @@ cake2: Var fixedLayoutStruct.lazy_d.storage is added to a non-resilient type
|
||||
cake1: Protocol P3 has added inherited protocol P4
|
||||
cake1: Protocol P3 has removed inherited protocol P2
|
||||
cake1: Struct fixedLayoutStruct has removed conformance to P1
|
||||
|
||||
/* Protocol Requirement Change */
|
||||
cake1: AssociatedType AssociatedTypePro.T1 has removed default type Int
|
||||
|
||||
@@ -33,3 +33,6 @@ cake1: Var C1.CIIns2 changes from strong to weak
|
||||
cake1: Protocol P3 has added inherited protocol P4
|
||||
cake1: Protocol P3 has removed inherited protocol P2
|
||||
cake1: Struct fixedLayoutStruct has removed conformance to P1
|
||||
|
||||
/* Protocol Requirement Change */
|
||||
cake1: AssociatedType AssociatedTypePro.T1 has removed default type Int
|
||||
|
||||
@@ -54,6 +54,8 @@ static StringRef getCategoryName(uint32_t ID) {
|
||||
case LocalDiagID::conformance_added:
|
||||
case LocalDiagID::conformance_removed:
|
||||
return "/* Protocol Conformance Change */";
|
||||
case LocalDiagID::default_associated_type_removed:
|
||||
return "/* Protocol Requirement Change */";
|
||||
default:
|
||||
return StringRef();
|
||||
}
|
||||
|
||||
@@ -817,6 +817,13 @@ public:
|
||||
case NodeMatchReason::Removed:
|
||||
assert(!Right);
|
||||
Left->annotate(NodeAnnotation::Removed);
|
||||
if (auto *LT = dyn_cast<SDKNodeType>(Left)) {
|
||||
if (auto *AT = dyn_cast<SDKNodeDeclAssociatedType>(LT->getParent())) {
|
||||
Ctx.getDiags().diagnose(SourceLoc(),
|
||||
diag::default_associated_type_removed,
|
||||
AT->getScreenInfo(), LT->getPrintedName());
|
||||
}
|
||||
}
|
||||
return;
|
||||
case NodeMatchReason::FuncToProperty:
|
||||
case NodeMatchReason::ModernizeEnum:
|
||||
|
||||
Reference in New Issue
Block a user