File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -2784,7 +2784,7 @@ class ConstraintSystem {
27842784 void
27852785 filterSolutions (SmallVectorImpl<Solution> &solutions,
27862786 bool minimize = false ) {
2787- if (solutions.size () < 2 )
2787+ if (solutions.size () < 2 || isForCodeCompletion () )
27882788 return ;
27892789
27902790 if (auto best = findBestSolution (solutions, minimize)) {
Original file line number Diff line number Diff line change 4646// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTICLOSURE_FUNCBUILDER_ERROR | %FileCheck %s --check-prefix=POINT_MEMBER
4747// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=MULTICLOSURE_FUNCBUILDER_FIXME | %FileCheck %s --check-prefix=NORESULTS
4848// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=REGULAR_MULTICLOSURE_APPLIED | %FileCheck %s --check-prefix=POINT_MEMBER
49+ // RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=BEST_SOLUTION_FILTER | %FileCheck %s --check-prefix=BEST_SOLUTION_FILTER
50+ // RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=BEST_SOLUTION_FILTER2 | %FileCheck %s --check-prefix=BEST_SOLUTION_FILTER
4951
5052
5153struct A {
@@ -438,3 +440,23 @@ takesClosureOfPoint { p in
438440 if p. #^REGULAR_MULTICLOSURE_APPLIED^# { }
439441 }
440442}
443+
444+ enum Enum123 {
445+ case enumElem
446+ }
447+ struct Struct123 : Equatable {
448+ var structMem = Enum123 . enumElem
449+ }
450+ func testNoBestSolutionFilter( ) {
451+ let a = Struct123 ( ) ;
452+ let b = [ Struct123] ( ) . first ( where: { $0 == a && 1 + 90 * 5 / 8 == 45 * - 10 } ) ? . structMem != . #^BEST_SOLUTION_FILTER^#
453+ let c = min ( 10.3 , 10 / 10.4 ) < 6 + 5 / ( 10 - 3 ) ? true : Optional ( a) ? . structMem != . #^BEST_SOLUTION_FILTER2 ^#
454+ }
455+
456+ // BEST_SOLUTION_FILTER: Begin completions
457+ // BEST_SOLUTION_FILTER-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Convertible]: enumElem[#Enum123#]{{; name=.+$}}
458+ // BEST_SOLUTION_FILTER-DAG: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: hash({#(self): Enum123#})[#(into: inout Hasher) -> Void#]{{; name=.+$}}
459+ // BEST_SOLUTION_FILTER-DAG: Keyword[nil]/None/Erase[1]/TypeRelation[Identical]: nil[#Enum123?#]{{; name=.+$}}
460+ // BEST_SOLUTION_FILTER-DAG: Decl[EnumElement]/CurrNominal/IsSystem/TypeRelation[Identical]: none[#Optional<Enum123>#]{{; name=.+$}}
461+ // BEST_SOLUTION_FILTER-DAG: Decl[EnumElement]/CurrNominal/IsSystem/TypeRelation[Identical]: some({#Enum123#})[#Optional<Enum123>#]{{; name=.+$}}
462+ // BEST_SOLUTION_FILTER: End completions
You can’t perform that action at this time.
0 commit comments