Sema: Fix spurious diagnostic about move-only tuples

This commit is contained in:
Slava Pestov
2025-10-03 14:02:48 -04:00
parent 1731b09a88
commit 21214bea3c
2 changed files with 5 additions and 1 deletions

View File

@@ -5992,7 +5992,7 @@ NeverNullType TypeResolver::resolveTupleType(TupleTypeRepr *repr,
!isa<TupleTypeRepr>(tyR)) {
auto contextTy = GenericEnvironment::mapTypeIntoContext(
resolution.getGenericSignature().getGenericEnvironment(), ty);
if (contextTy->isNoncopyable())
if (!contextTy->hasError() && contextTy->isNoncopyable())
moveOnlyElementIndex = i;
}

View File

@@ -23,3 +23,7 @@ func inferredTuples<T>(x: Int, y: borrowing Butt, z: T) {
_ = b
_ = c
}
// Avoid spurious diagnostic with the tuple here
func bogus<T>(_: T, _: (T, T)) where T == DoesNotExist {}
// expected-error@-1 {{cannot find type 'DoesNotExist' in scope}}