Skip to content

swift-api-digester: specify raw types when detecting the reversion of NS_TYPED_EXTENSIBLE_ENUM. #16821

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 1 commit into from
May 24, 2018
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
24 changes: 12 additions & 12 deletions test/api-digester/Outputs/apinotes-migrator-gen-revert.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"NodeAnnotation": "RevertSimpleStringRepresentableUpdate",
"ChildIndex": "1",
"LeftUsr": "c:objc(cs)AnimalStatusDescriptor(cm)animalStatusSingleAttribute:",
"LeftComment": "",
"LeftComment": "AnimalAttributeName",
"RightUsr": "",
"RightComment": "",
"RightComment": "String",
"ModuleName": "APINotesTest"
},
{
Expand All @@ -27,9 +27,9 @@
"NodeAnnotation": "RevertSimpleOptionalStringRepresentableUpdate",
"ChildIndex": "1",
"LeftUsr": "c:objc(cs)AnimalStatusDescriptor(cm)animalStatusSingleOptionalAttribute:",
"LeftComment": "",
"LeftComment": "AnimalAttributeName",
"RightUsr": "",
"RightComment": "",
"RightComment": "String",
"ModuleName": "APINotesTest"
},
{
Expand All @@ -49,9 +49,9 @@
"NodeAnnotation": "RevertDictionaryKeyUpdate",
"ChildIndex": "1",
"LeftUsr": "c:objc(cs)AnimalStatusDescriptor(im)animalStatusDescriptorByAddingAttributes:",
"LeftComment": "",
"LeftComment": "AnimalAttributeName",
"RightUsr": "",
"RightComment": "",
"RightComment": "String",
"ModuleName": "APINotesTest"
},
{
Expand All @@ -71,9 +71,9 @@
"NodeAnnotation": "RevertArrayMemberUpdate",
"ChildIndex": "1",
"LeftUsr": "c:objc(cs)AnimalStatusDescriptor(im)animalStatusDescriptorByAddingAttributesArray:",
"LeftComment": "",
"LeftComment": "AnimalAttributeName",
"RightUsr": "",
"RightComment": "",
"RightComment": "String",
"ModuleName": "APINotesTest"
},
{
Expand All @@ -93,9 +93,9 @@
"NodeAnnotation": "RevertOptionalDictionaryKeyUpdate",
"ChildIndex": "1",
"LeftUsr": "c:objc(cs)AnimalStatusDescriptor(im)animalStatusDescriptorByAddingOptionalAttributes:",
"LeftComment": "",
"LeftComment": "AnimalAttributeName",
"RightUsr": "",
"RightComment": "",
"RightComment": "String",
"ModuleName": "APINotesTest"
},
{
Expand All @@ -115,9 +115,9 @@
"NodeAnnotation": "RevertOptionalArrayMemberUpdate",
"ChildIndex": "1",
"LeftUsr": "c:objc(cs)AnimalStatusDescriptor(im)animalStatusDescriptorByAddingOptionalAttributesArray:",
"LeftComment": "",
"LeftComment": "AnimalAttributeName",
"RightUsr": "",
"RightComment": "",
"RightComment": "String",
"ModuleName": "APINotesTest"
},
{
Expand Down
21 changes: 20 additions & 1 deletion tools/swift-api-digester/swift-api-digester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2704,7 +2704,8 @@ class InterfaceTypeChangeDetector {

bool detectTypeRewritten(SDKNodeType *Node, SDKNodeType *Counter) {
if (IsVisitingLeft &&
(Node->getName() != Counter->getName()||
Node->getPrintedName() != Counter->getPrintedName() &&
(Node->getName() != Counter->getName() ||
Node->getChildrenCount() != Counter->getChildrenCount())) {
Node->annotate(NodeAnnotation::TypeRewritten);
Node->annotate(NodeAnnotation::TypeRewrittenLeft, Node->getPrintedName());
Expand Down Expand Up @@ -2794,6 +2795,8 @@ class InterfaceTypeChangeDetector {
R->annotate(HasOptional ?
NodeAnnotation::RevertOptionalDictionaryKeyUpdate :
NodeAnnotation::RevertDictionaryKeyUpdate);
R->annotate(NodeAnnotation::RawTypeLeft, KeyChangedTo);
R->annotate(NodeAnnotation::RawTypeRight, Raw);
}
return true;
}
Expand Down Expand Up @@ -2843,6 +2846,8 @@ class InterfaceTypeChangeDetector {
R->annotate(HasOptional ?
NodeAnnotation::RevertOptionalArrayMemberUpdate :
NodeAnnotation::RevertArrayMemberUpdate);
R->annotate(NodeAnnotation::RawTypeLeft, KeyChangedTo);
R->annotate(NodeAnnotation::RawTypeRight, Raw);
}
return true;
}
Expand Down Expand Up @@ -2874,6 +2879,8 @@ class InterfaceTypeChangeDetector {
NodeAnnotation::SimpleOptionalStringRepresentableUpdate:
NodeAnnotation::SimpleStringRepresentableUpdate);
} else {
R->annotate(NodeAnnotation::RawTypeLeft, KeyChangedTo);
R->annotate(NodeAnnotation::RawTypeRight, Raw);
R->annotate(HasOptional ?
NodeAnnotation::RevertSimpleOptionalStringRepresentableUpdate:
NodeAnnotation::RevertSimpleStringRepresentableUpdate);
Expand Down Expand Up @@ -3051,6 +3058,12 @@ class DiffItemEmitter : public SDKNodeVisitor {
case NodeAnnotation::OptionalDictionaryKeyUpdate:
case NodeAnnotation::SimpleStringRepresentableUpdate:
case NodeAnnotation::SimpleOptionalStringRepresentableUpdate:
case NodeAnnotation::RevertArrayMemberUpdate:
case NodeAnnotation::RevertOptionalArrayMemberUpdate:
case NodeAnnotation::RevertDictionaryKeyUpdate:
case NodeAnnotation::RevertOptionalDictionaryKeyUpdate:
case NodeAnnotation::RevertSimpleStringRepresentableUpdate:
case NodeAnnotation::RevertSimpleOptionalStringRepresentableUpdate:
return Node->getAnnotateComment(NodeAnnotation::RawTypeLeft);
case NodeAnnotation::TypeRewritten:
return Node->getAnnotateComment(NodeAnnotation::TypeRewrittenLeft);
Expand All @@ -3069,6 +3082,12 @@ class DiffItemEmitter : public SDKNodeVisitor {
case NodeAnnotation::OptionalDictionaryKeyUpdate:
case NodeAnnotation::SimpleStringRepresentableUpdate:
case NodeAnnotation::SimpleOptionalStringRepresentableUpdate:
case NodeAnnotation::RevertArrayMemberUpdate:
case NodeAnnotation::RevertOptionalArrayMemberUpdate:
case NodeAnnotation::RevertDictionaryKeyUpdate:
case NodeAnnotation::RevertOptionalDictionaryKeyUpdate:
case NodeAnnotation::RevertSimpleStringRepresentableUpdate:
case NodeAnnotation::RevertSimpleOptionalStringRepresentableUpdate:
return Node->getAnnotateComment(NodeAnnotation::RawTypeRight);
case NodeAnnotation::TypeRewritten:
return Node->getAnnotateComment(NodeAnnotation::TypeRewrittenRight);
Expand Down