-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Remove warning for 'async in non-concurrency context' #73628
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
rintaro
merged 4 commits into
swiftlang:main
from
rintaro:completion-async-not-async-rdar126737530
May 20, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9a6770e
[CodeCompletion] Remove warning for 'async in non-concurrency context'
rintaro 39d633f
[CodeCompletion] Remove unused 'isAsync' flag from CodeCompletionResult
rintaro 79a7410
[CodeCompletion] Remove CrossActorReference diagnostics too
rintaro 61eb531
[CodeCompletion] Increment on-disc code completion cache version
rintaro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ CodeCompletionCache::~CodeCompletionCache() {} | |
/// This should be incremented any time we commit a change to the format of the | ||
/// cached results. This isn't expected to change very often. | ||
static constexpr uint32_t onDiskCompletionCacheVersion = | ||
11; // Added macro roles | ||
12; // Removed 'IsAsync'. | ||
|
||
/// Deserializes CodeCompletionResults from \p in and stores them in \p V. | ||
/// \see writeCacheModule. | ||
|
@@ -236,7 +236,6 @@ static bool readCachedModule(llvm::MemoryBuffer *in, | |
auto diagSeverity = | ||
static_cast<CodeCompletionDiagnosticSeverity>(*cursor++); | ||
auto isSystem = static_cast<bool>(*cursor++); | ||
auto isAsync = static_cast<bool>(*cursor++); | ||
auto hasAsyncAlternative = static_cast<bool>(*cursor++); | ||
auto chunkIndex = read32le(cursor); | ||
auto moduleIndex = read32le(cursor); | ||
|
@@ -267,8 +266,8 @@ static bool readCachedModule(llvm::MemoryBuffer *in, | |
|
||
ContextFreeCodeCompletionResult *result = | ||
new (*V.Allocator) ContextFreeCodeCompletionResult( | ||
kind, associatedKind, opKind, roles, isSystem, isAsync, | ||
hasAsyncAlternative, string, moduleName, briefDocComment, | ||
kind, associatedKind, opKind, roles, isSystem, | ||
hasAsyncAlternative, string, moduleName, briefDocComment, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect formatting? |
||
llvm::ArrayRef(assocUSRs).copy(*V.Allocator), | ||
CodeCompletionResultType(resultTypes), notRecommended, diagSeverity, | ||
diagMessage, filterName, nameForDiagnostics); | ||
|
@@ -428,7 +427,6 @@ static void writeCachedModule(llvm::raw_ostream &out, | |
LE.write(static_cast<uint8_t>(R->getNotRecommendedReason())); | ||
LE.write(static_cast<uint8_t>(R->getDiagnosticSeverity())); | ||
LE.write(static_cast<uint8_t>(R->isSystem())); | ||
LE.write(static_cast<uint8_t>(R->isAsync())); | ||
LE.write(static_cast<uint8_t>(R->hasAsyncAlternative())); | ||
LE.write( | ||
static_cast<uint32_t>(addCompletionString(R->getCompletionString()))); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,8 +121,7 @@ ContextFreeCodeCompletionResult * | |
ContextFreeCodeCompletionResult::createPatternOrBuiltInOperatorResult( | ||
CodeCompletionResultSink &Sink, CodeCompletionResultKind Kind, | ||
CodeCompletionString *CompletionString, | ||
CodeCompletionOperatorKind KnownOperatorKind, bool IsAsync, | ||
NullTerminatedStringRef BriefDocComment, | ||
CodeCompletionOperatorKind KnownOperatorKind, NullTerminatedStringRef BriefDocComment, | ||
CodeCompletionResultType ResultType, | ||
ContextFreeNotRecommendedReason NotRecommended, | ||
CodeCompletionDiagnosticSeverity DiagnosticSeverity, | ||
|
@@ -138,7 +137,7 @@ ContextFreeCodeCompletionResult::createPatternOrBuiltInOperatorResult( | |
} | ||
return new (Sink.getAllocator()) ContextFreeCodeCompletionResult( | ||
Kind, /*AssociatedKind=*/0, KnownOperatorKind, /*MacroRoles=*/{}, | ||
/*IsSystem=*/false, IsAsync, /*HasAsyncAlternative=*/false, | ||
/*IsSystem=*/false, /*HasAsyncAlternative=*/false, | ||
CompletionString, | ||
/*ModuleName=*/"", BriefDocComment, | ||
/*AssociatedUSRs=*/{}, ResultType, NotRecommended, DiagnosticSeverity, | ||
|
@@ -159,8 +158,7 @@ ContextFreeCodeCompletionResult::createKeywordResult( | |
return new (Sink.getAllocator()) ContextFreeCodeCompletionResult( | ||
CodeCompletionResultKind::Keyword, static_cast<uint8_t>(Kind), | ||
CodeCompletionOperatorKind::None, /*MacroRoles=*/{}, | ||
/*IsSystem=*/false, /*IsAsync=*/false, | ||
/*HasAsyncAlternative=*/false, CompletionString, | ||
/*IsSystem=*/false, /*HasAsyncAlternative=*/false, CompletionString, | ||
/*ModuleName=*/"", BriefDocComment, | ||
/*AssociatedUSRs=*/{}, ResultType, ContextFreeNotRecommendedReason::None, | ||
CodeCompletionDiagnosticSeverity::None, /*DiagnosticMessage=*/"", | ||
|
@@ -179,7 +177,7 @@ ContextFreeCodeCompletionResult::createLiteralResult( | |
return new (Sink.getAllocator()) ContextFreeCodeCompletionResult( | ||
CodeCompletionResultKind::Literal, static_cast<uint8_t>(LiteralKind), | ||
CodeCompletionOperatorKind::None, /*MacroRoles=*/{}, | ||
/*IsSystem=*/false, /*IsAsync=*/false, /*HasAsyncAlternative=*/false, | ||
/*IsSystem=*/false, /*HasAsyncAlternative=*/false, | ||
CompletionString, | ||
/*ModuleName=*/"", | ||
/*BriefDocComment=*/"", | ||
|
@@ -207,7 +205,7 @@ getDeclNameForDiagnostics(const Decl *D, CodeCompletionResultSink &Sink) { | |
ContextFreeCodeCompletionResult * | ||
ContextFreeCodeCompletionResult::createDeclResult( | ||
CodeCompletionResultSink &Sink, CodeCompletionString *CompletionString, | ||
const Decl *AssociatedDecl, bool IsAsync, bool HasAsyncAlternative, | ||
const Decl *AssociatedDecl, bool HasAsyncAlternative, | ||
NullTerminatedStringRef ModuleName, NullTerminatedStringRef BriefDocComment, | ||
ArrayRef<NullTerminatedStringRef> AssociatedUSRs, | ||
CodeCompletionResultType ResultType, | ||
|
@@ -222,7 +220,7 @@ ContextFreeCodeCompletionResult::createDeclResult( | |
CodeCompletionResultKind::Declaration, | ||
static_cast<uint8_t>(getCodeCompletionDeclKind(AssociatedDecl)), | ||
CodeCompletionOperatorKind::None, getCompletionMacroRoles(AssociatedDecl), | ||
getDeclIsSystem(AssociatedDecl), IsAsync, HasAsyncAlternative, | ||
getDeclIsSystem(AssociatedDecl), HasAsyncAlternative, | ||
CompletionString, ModuleName, BriefDocComment, AssociatedUSRs, ResultType, | ||
NotRecommended, DiagnosticSeverity, DiagnosticMessage, | ||
getCodeCompletionResultFilterName(CompletionString, Sink.getAllocator()), | ||
|
@@ -399,9 +397,6 @@ ContextFreeCodeCompletionResult::calculateContextualNotRecommendedReason( | |
if (explicitReason != ContextualNotRecommendedReason::None) { | ||
return explicitReason; | ||
} | ||
if (IsAsync && !canCurrDeclContextHandleAsync) { | ||
return ContextualNotRecommendedReason::InvalidAsyncContext; | ||
} | ||
Comment on lines
-402
to
-404
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless I’m missing something, we can remove |
||
if (HasAsyncAlternative && canCurrDeclContextHandleAsync) { | ||
return ContextualNotRecommendedReason:: | ||
NonAsyncAlternativeUsedInAsyncContext; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you increment the completion cache version number?