Skip to content

Commit 8b0ce29

Browse files
committed
update existing tests after banning move-only types in generics
A number of our existing tests put move-only types in optionals and used them as arguments to generic type parameters. It turns out that many of these appearances in the tests were not crucial for the test's functionality itself. The little coverage for force-unwrapping an Optional<moveOnly> that was lost will be regained once we make these types sound. I also tried to tidy up some of the tests with consistent naming for operations on values, i.e., `consumeVal` and `borrowVal` functions.
1 parent aa26d3b commit 8b0ce29

10 files changed

+1865
-1935
lines changed

test/SILGen/moveonly_var.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@
55
// Declarations //
66
//////////////////
77

8+
class OrdinaryClass {}
9+
10+
@_moveOnly
11+
public enum MaybeKlass {
12+
case just(Klass)
13+
case none
14+
}
15+
816
@_moveOnly
917
public class Klass {
1018
var intField: Int
11-
var klsField: Klass?
19+
var klsField: OrdinaryClass // FIXME(104504239): this is suppose to be MaybeKlass, or better yet, Optional<Klass>
1220

1321
init() {
14-
klsField = Klass()
22+
klsField = OrdinaryClass()
1523
intField = 5
1624
}
1725
}

test/SILOptimizer/move_only_checker_addressonly_fail.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -enable-experimental-move-only -verify %s -parse-stdlib -emit-sil
1+
// RUN: %target-swift-frontend -enable-experimental-move-only -verify %s -emit-sil
22

33
func useValue<T>(_ x: T) {}
44
func consumeValue<T>(_ x: __owned T) {}

test/SILOptimizer/moveonly_addresschecker.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class CopyableKlass {}
99
@_moveOnly
1010
public class Klass {
1111
var intField: Int
12-
var k: Klass?
12+
var k: Klass
1313
init()
1414
}
1515

test/SILOptimizer/moveonly_addresschecker_diagnostics.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class CopyableKlass {}
2020
@_moveOnly
2121
public class Klass {
2222
var intField: Int
23-
var k: Klass?
23+
var k: Klass
2424
init()
2525
}
2626

0 commit comments

Comments
 (0)