Skip to content

Commit be9bf90

Browse files
committed
[CSDiagnostics] Update test cases.
1 parent 84642a6 commit be9bf90

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8211,10 +8211,6 @@ bool UnableToInferGenericPackElementType::diagnoseAsError() {
82118211
// specify contextual type for nil fix.
82128212
emitDiagnostic(diag::unresolved_nil_literal);
82138213
} else {
8214-
if (llvm::any_of(getSolution().Fixes, [&locator](const ConstraintFix *fix) {
8215-
return fix->getLocator() == locator;
8216-
}))
8217-
return false;
82188214
// unable to infer the type of an element of generic pack params
82198215
emitDiagnostic(diag::could_not_infer_pack_element,
82208216
packElementElt->getIndex());

test/Constraints/pack_expansion_types.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,10 @@ func patternInstantiationConcreteValid() {
243243
func patternInstantiationConcreteInvalid() {
244244
let _: Set<Int> = patternInstantiationTupleTest1()
245245
// expected-error@-1 {{cannot convert value of type '(repeat Array<_>)' to specified type 'Set<Int>'}}
246+
// expected-error@-2 {{could not infer pack element #0 from context}}
246247

247248
let _: (Array<Int>, Set<String>) = patternInstantiationTupleTest1() // expected-error {{'(repeat Array<Int, _>)' is not convertible to '(Array<Int>, Set<String>)', tuples have a different number of elements}}
249+
// expected-error@-1 {{could not infer pack element #1 from context}}
248250
}
249251

250252
func patternInstantiationGenericValid<each T, each U>(t: repeat each T, u: repeat each U)
@@ -275,6 +277,7 @@ func patternInstantiationGenericInvalid<each T: Hashable>(t: repeat each T) {
275277
// expected-error@-1 {{generic parameter 'each T' could not be inferred}}
276278

277279
let _: (repeat Array<each T>, Set<String>) = patternInstantiationTupleTest1() // expected-error {{'(repeat Array<repeat each T, _>)' is not convertible to '(repeat Array<each T>, Set<String>)', tuples have a different number of elements}}
280+
// expected-error@-1 {{could not infer pack element #1 from context}}
278281
}
279282

280283
// rdar://107996926 - Vanishing metatype of tuple not supported

0 commit comments

Comments
 (0)