mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IDE] New test cases that were failing at some point during solver-based migration
This commit is contained in:
@@ -41,6 +41,7 @@ SourceRange ASTNode::getSourceRange() const {
|
||||
if (const auto *I = this->dyn_cast<CaseLabelItem *>()) {
|
||||
return I->getSourceRange();
|
||||
}
|
||||
assert(!isNull() && "Null ASTNode doesn't have a source range");
|
||||
llvm_unreachable("unsupported AST node");
|
||||
}
|
||||
|
||||
|
||||
16
test/IDE/complete_after_pattern_in_closure.swift
Normal file
16
test/IDE/complete_after_pattern_in_closure.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t -enable-experimental-concurrency
|
||||
|
||||
func makeURL(withExtension ext: Int?) -> Int? {
|
||||
return nil
|
||||
}
|
||||
|
||||
func test() {
|
||||
let calculatorContext: Int? = {
|
||||
guard let url#^COMPLETE^# = makeURL(withExtension: 1),
|
||||
let script = url else {
|
||||
return nil
|
||||
}
|
||||
}()
|
||||
// COMPLETE-NOT: Begin completions
|
||||
}
|
||||
25
test/IDE/complete_dont_filter_overloads_with_cc_token.swift
Normal file
25
test/IDE/complete_dont_filter_overloads_with_cc_token.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t
|
||||
|
||||
func buildView<T>(@MyViewBuilder _ x: () -> T) {}
|
||||
|
||||
@resultBuilder struct MyViewBuilder {
|
||||
static func buildBlock(_ content: MyText) -> MyText { content }
|
||||
}
|
||||
|
||||
struct MyText : Equatable {
|
||||
init(verbatim content: String) {}
|
||||
init<S>(_ content: S) where S : StringProtocol {}
|
||||
}
|
||||
|
||||
func test(text: String) {
|
||||
buildView {
|
||||
MyText(#^COMPLETE^#text)
|
||||
}
|
||||
}
|
||||
|
||||
// COMPLETE: Begin completions
|
||||
// COMPLETE-DAG: Decl[Constructor]/CurrNominal/Flair[ArgLabels]/TypeRelation[Convertible]: ['(']{#verbatim: String#}[')'][#MyText#];
|
||||
// COMPLETE-DAG: Decl[Constructor]/CurrNominal/Flair[ArgLabels]/TypeRelation[Convertible]: ['(']{#(content): StringProtocol#}[')'][#MyText#];
|
||||
// COMPLETE-DAG: Decl[LocalVar]/Local/TypeRelation[Convertible]: text[#String#];
|
||||
// COMPLETE: End completions
|
||||
@@ -551,3 +551,15 @@ func testCompleteAfterClosureWithIfExprThatContainErrors() {
|
||||
// AFTER_CLOSURE_WITH_IF_EXPR_THAT_CONTAIN_ERRORS-DAG: Pattern/CurrModule/Flair[ArgLabels]: ()[#Void#]; name=()
|
||||
// AFTER_CLOSURE_WITH_IF_EXPR_THAT_CONTAIN_ERRORS: End completions
|
||||
}
|
||||
|
||||
func testVariableInClosureHasArchetype<K>(_ key: K) {
|
||||
func takeClosure(_ x: () -> Void) {}
|
||||
|
||||
takeClosure {
|
||||
var varWithArchetype = key
|
||||
#^VAR_WITH_ARCHETYPE^#
|
||||
// VAR_WITH_ARCHETYPE: Begin completions
|
||||
// VAR_WITH_ARCHETYPE: Decl[LocalVar]/Local: varWithArchetype[#K#];
|
||||
// VAR_WITH_ARCHETYPE: End completions
|
||||
}
|
||||
}
|
||||
|
||||
11
test/IDE/conforming-methods-after-var-in-closure.swift
Normal file
11
test/IDE/conforming-methods-after-var-in-closure.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
// Check that we don't crash
|
||||
// RUN: %target-swift-ide-test -conforming-methods -source-filename %s -code-completion-token=TOK
|
||||
|
||||
func takeClosure(_ x: () -> Void) {}
|
||||
|
||||
func test(name: String?) {
|
||||
takeClosure {
|
||||
guard let url#^TOK^# = name else {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user