-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Avoid suggesting duplicated module names #31892
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 1 commit into
swiftlang:master
from
rintaro:ide-completion-duplicatedmodule-rdar63370253
May 20, 2020
Merged
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions
2
test/IDE/Inputs/mock-sdk/OverlayTest.framework/Headers/OverlayTest.h
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include <OverlayTest/Overlayed.h> | ||
|
13 changes: 13 additions & 0 deletions
13
test/IDE/Inputs/mock-sdk/OverlayTest.framework/Headers/Overlayed.h
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
#ifndef OVERLAYED_H | ||
#define OVERLAYED_H | ||
|
||
struct __attribute__((swift_name("Overlayed"))) OVOverlayed { | ||
double x, y, z; | ||
}; | ||
|
||
double OVOverlayedInOriginalFunc(struct OVOverlayed s) __attribute__((swift_name("Overlayed.inOriginalFunc(self:)"))); | ||
|
||
struct OVOverlayed createOverlayed(); | ||
|
||
#endif |
7 changes: 7 additions & 0 deletions
7
test/IDE/Inputs/mock-sdk/OverlayTest.framework/Modules/module.modulemap
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
framework module OverlayTest { | ||
umbrella header "OverlayTest.h" | ||
|
||
export * | ||
module * { export * } | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// swift-interface-format-version: 1.0 | ||
// swift-module-flags: -module-name OverlayTest | ||
|
||
@_exported import OverlayTest | ||
|
||
public extension Overlayed { | ||
public func inOverlayFunc() {} | ||
} | ||
|
||
public func createOverlayedInOverlay() -> Overlayed |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %S/Inputs/mock-sdk -F %S/Inputs/mock-sdk -code-completion-token=TYPE_GLOBAL | %FileCheck %s --check-prefix=TYPE_GLOBAL | ||
// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %S/Inputs/mock-sdk -F %S/Inputs/mock-sdk -code-completion-token=EXPR_GLOBAL | %FileCheck %s --check-prefix=EXPR_GLOBAL | ||
// RUN: %target-swift-ide-test -code-completion -source-filename %s -I %S/Inputs/mock-sdk -F %S/Inputs/mock-sdk -code-completion-token=EXPR_MEMBER | %FileCheck %s --check-prefix=EXPR_MEMBER | ||
|
||
import OverlayTest | ||
|
||
func testGlobalType() { | ||
let _: #^TYPE_GLOBAL^# | ||
// TYPE_GLOBAL: Begin completions | ||
// TYPE_GLOBAL-NOT: OverlayTest[#Module#] | ||
// TYPE_GLOBAL-DAG: Decl[Module]/None: OverlayTest[#Module#]; | ||
// TYPE_GLOBAL-NOT: OverlayTest[#Module#] | ||
// TYPE_GLOBAL-DAG: Decl[Struct]/OtherModule[OverlayTest.Overlayed]: Overlayed[#Overlayed#]; | ||
// TYPE_GLOBAL: End completions | ||
} | ||
func testGlobalExpr() { | ||
let _ = #^EXPR_GLOBAL^# | ||
// EPXR_GLOBAL: Begin completions | ||
// EXPR_GLOBAL-NOT: OverlayTest[#Module#] | ||
// EXPR_GLOBAL-DAG: Decl[Module]/None: OverlayTest[#Module#]; | ||
// EXPR_GLOBAL-NOT: OverlayTest[#Module#] | ||
// EXPR_GLOBAL-DAG: Decl[Struct]/OtherModule[OverlayTest.Overlayed]: Overlayed[#Overlayed#]; | ||
// EXPR_GLOBAL-DAG: Decl[FreeFunction]/OtherModule[OverlayTest]: createOverlayedInOverlay()[#Overlayed#]; | ||
// EXPR_GLOBAL-DAG: Decl[FreeFunction]/OtherModule[OverlayTest.Overlayed]: createOverlayed()[#Overlayed#]; | ||
// EPXR_GLOBAL: End completions | ||
} | ||
func testGlobalExpr(value: Overlayed) { | ||
value.#^EXPR_MEMBER^# | ||
// EXPR_MEMBER: Begin completions, 6 items | ||
// EXPR_MEMBER-DAG: Keyword[self]/CurrNominal: self[#Overlayed#]; name=self | ||
// EXPR_MEMBER-DAG: Decl[InstanceVar]/CurrNominal: x[#Double#]; name=x | ||
// EXPR_MEMBER-DAG: Decl[InstanceVar]/CurrNominal: y[#Double#]; name=y | ||
// EXPR_MEMBER-DAG: Decl[InstanceVar]/CurrNominal: z[#Double#]; name=z | ||
// EXPR_MEMBER-DAG: Decl[InstanceMethod]/CurrNominal: inOverlayFunc()[#Void#]; name=inOverlayFunc() | ||
// EXPR_MEMBER-DAG: Decl[InstanceMethod]/CurrNominal: inOriginalFunc()[#Double#]; name=inOriginalFunc() | ||
// EXPR_MEMBER: End completions | ||
} |
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.
I think the -NOT above and below means this -DAG can't be reordered past them, but its not a problem if swift-ide-test is sorting the results and this is already the right order.
Uh oh!
There was an error while loading. Please reload this page.
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.
Yeah, I think you are right. Also,
swift-idea-test
doesn't sort the results (but is stable). Do you know a better way to check this? Is possible, I want to avoid 2FileCheck
invocations for these checks.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.
Outputting to a file and running file check for the negative and positive checks separately is all I can think of, sorry 🙁