Skip to content

Commit ffef95e

Browse files
committed
Test: fold together similar NCGenerics tests
(cherry picked from commit 341ff24)
1 parent 5bc7ea1 commit ffef95e

File tree

4 files changed

+69
-322
lines changed

4 files changed

+69
-322
lines changed

test/Constraints/moveonly_constraints.swift

Lines changed: 0 additions & 294 deletions
This file was deleted.

test/Generics/inverse_copyable_requirement.swift

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// RUN: %target-typecheck-verify-swift
12
// RUN: %target-typecheck-verify-swift -enable-experimental-feature NoncopyableGenerics
23

34
// a concrete move-only type
@@ -289,31 +290,3 @@ func doBadMetatypeStuff<T>(_ t: T) {
289290
func tryToDoBadMetatypeStuff() {
290291
doBadMetatypeStuff(MO.self)
291292
}
292-
293-
func totallyInvalid<T>(_ t: T) where MO: ~Copyable {}
294-
// expected-error@-1{{type 'MO' in conformance requirement does not refer to a generic parameter or associated type}}
295-
296-
func packingHeat<each T>(_ t: repeat each T) {} // expected-note {{generic parameter 'each T' has an implicit Copyable requirement}}
297-
func packIt() {
298-
packingHeat(MO()) // expected-error {{noncopyable type 'MO' cannot be substituted for copyable generic parameter 'each T' in 'packingHeat'}}
299-
packingHeat(10)
300-
}
301-
302-
func packingUniqueHeat_1<each T: ~Copyable>(_ t: repeat each T) {}
303-
// expected-error@-1{{cannot apply inverse '~Copyable' to type 'each T' in conformance requirement}}
304-
// expected-note@-2{{generic parameter 'each T' has an implicit Copyable requirement}}
305-
306-
func packingUniqueHeat_2<each T>(_ t: repeat each T)
307-
where repeat each T: ~Copyable {}
308-
// expected-error@-1{{cannot apply inverse '~Copyable' to type 'each T' in conformance requirement}}
309-
// expected-note@-3{{generic parameter 'each T' has an implicit Copyable requirement}}
310-
311-
func packItUniquely() {
312-
packingUniqueHeat_1(MO())
313-
// expected-error@-1{{noncopyable type 'MO' cannot be substituted for copyable generic parameter 'each T' in 'packingUniqueHeat_1'}}
314-
315-
packingUniqueHeat_2(MO())
316-
// expected-error@-1{{noncopyable type 'MO' cannot be substituted for copyable generic parameter 'each T' in 'packingUniqueHeat_2'}}
317-
318-
packingUniqueHeat_1(10)
319-
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
// a concrete move-only type
4+
struct MO: ~Copyable {
5+
var x: Int?
6+
}
7+
8+
func totallyInvalid<T>(_ t: T) where MO: ~Copyable {}
9+
// expected-error@-1{{cannot suppress conformances here}}
10+
11+
func packingHeat<each T>(_ t: repeat each T) {} // expected-note {{generic parameter 'each T' has an implicit Copyable requirement}}
12+
func packIt() {
13+
packingHeat(MO()) // expected-error {{noncopyable type 'MO' cannot be substituted for copyable generic parameter 'each T' in 'packingHeat'}}
14+
packingHeat(10)
15+
}
16+
17+
func packingUniqueHeat_1<each T: ~Copyable>(_ t: repeat each T) {}
18+
// expected-error@-1{{cannot suppress conformances here}}
19+
// expected-note@-2{{generic parameter 'each T' has an implicit Copyable requirement}}
20+
21+
func packingUniqueHeat_2<each T>(_ t: repeat each T)
22+
where repeat each T: ~Copyable {}
23+
// expected-error@-1{{cannot suppress conformances here}}
24+
// expected-note@-3{{generic parameter 'each T' has an implicit Copyable requirement}}
25+
26+
func packItUniquely() {
27+
packingUniqueHeat_1(MO())
28+
// expected-error@-1{{noncopyable type 'MO' cannot be substituted for copyable generic parameter 'each T' in 'packingUniqueHeat_1'}}
29+
30+
packingUniqueHeat_2(MO())
31+
// expected-error@-1{{noncopyable type 'MO' cannot be substituted for copyable generic parameter 'each T' in 'packingUniqueHeat_2'}}
32+
33+
packingUniqueHeat_1(10)
34+
}

0 commit comments

Comments
 (0)