Skip to content

[CodeCompletion] Only show type annotations for macros that return non-void #65637

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 5, 2023

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 4, 2023

Showing the type annotation only makes sense if they are not Void. That’s consistent with functions where we also don’t show a Void return type. Most importantly, we shouldn’t be showing a Void type annotation for attached macros.

rdar://108870970

@ahoppen ahoppen requested review from bnbarham and rintaro as code owners May 4, 2023 01:53
@ahoppen
Copy link
Member Author

ahoppen commented May 4, 2023

@swift-ci Please smoke test

@@ -65,12 +65,12 @@ import MacroDefinitions
@#^STRUCT_ATTR?check=NOMINAL_ATTR^# struct S{}
// NOMINAL_ATTR-NOT: freestanding
// NOMINAL_ATTR-NOT: AttachedAccessorMacro
// NOMINAL_ATTR-DAG: Decl[Macro]/{{.*}}/TypeRelation[Convertible]: AttachedMemberMacro[#Void#]; name=AttachedMemberMacro
Copy link
Contributor

Choose a reason for hiding this comment

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

The TypeRelation is for scoring above other types in @ position, so should still be there. Is that not the case?

…n-void

Showing the type annotation only makes sense if they are not `Void`. That’s consistent with functions where we also don’t show a `Void` return type. Most importantly, we shouldn’t be showing a `Void` type annotation for attached macros.

rdar://108870970
@ahoppen ahoppen force-pushed the ahoppen/macro-type-annotation branch from 6f1c942 to c140fe4 Compare May 5, 2023 01:02
@ahoppen
Copy link
Member Author

ahoppen commented May 5, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit f20a33d into swiftlang:main May 5, 2023
@ahoppen ahoppen deleted the ahoppen/macro-type-annotation branch May 5, 2023 17:21
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.

2 participants