Skip to content

Commit 63b3054

Browse files
committed
[NoncopyableGenerics] fix parallel assignments
1 parent d432b8e commit 63b3054

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/AST/Type.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ bool TypeBase::isNoncopyable(const DeclContext *dc) {
205205

206206
/// \returns true iff this type lacks conformance to Copyable.
207207
bool TypeBase::isNoncopyable() {
208-
auto canType = getCanonicalType();
208+
// Strip @lvalue and canonicalize.
209+
auto canType = getRValueType()->getCanonicalType();
209210
auto &ctx = canType->getASTContext();
210211

211212
// for legacy-mode queries that are not dependent on conformances to Copyable

test/ModuleInterface/Inputs/NoncopyableGenerics.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@ public struct Vector<T: ~Copyable> {
88
fatalError("todo")
99
}
1010
}
11+
12+
13+
14+
15+
// These are purely to add test coverage of different constructs
16+
public struct Toys {
17+
static func test_parallelAssignment() {
18+
var y: Int
19+
var x: Int
20+
(x, y) = (10, 11)
21+
}
22+
23+
}

0 commit comments

Comments
 (0)