Skip to content

Commit 21214be

Browse files
committed
Sema: Fix spurious diagnostic about move-only tuples
1 parent 1731b09 commit 21214be

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5992,7 +5992,7 @@ NeverNullType TypeResolver::resolveTupleType(TupleTypeRepr *repr,
59925992
!isa<TupleTypeRepr>(tyR)) {
59935993
auto contextTy = GenericEnvironment::mapTypeIntoContext(
59945994
resolution.getGenericSignature().getGenericEnvironment(), ty);
5995-
if (contextTy->isNoncopyable())
5995+
if (!contextTy->hasError() && contextTy->isNoncopyable())
59965996
moveOnlyElementIndex = i;
59975997
}
59985998

test/Constraints/moveonly_tuples.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ func inferredTuples<T>(x: Int, y: borrowing Butt, z: T) {
2323
_ = b
2424
_ = c
2525
}
26+
27+
// Avoid spurious diagnostic with the tuple here
28+
func bogus<T>(_: T, _: (T, T)) where T == DoesNotExist {}
29+
// expected-error@-1 {{cannot find type 'DoesNotExist' in scope}}

0 commit comments

Comments
 (0)