Skip to content

Commit 815a68b

Browse files
authored
Merge pull request #8877 from slavapestov/sr-4378-test
Add test for SR-4378
2 parents 53305f1 + 88e48c9 commit 815a68b

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

test/Compatibility/tuple_arguments.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,3 +1442,33 @@ func singleElementTupleArgument(completion: ((didAdjust: Bool)) -> Void) {
14421442
completion((didAdjust: true))
14431443
}
14441444

1445+
1446+
// SR-4378 -- FIXME -- this should type check, it used to work in Swift 3.0
1447+
1448+
final public class MutableProperty<Value> {
1449+
public init(_ initialValue: Value) {}
1450+
}
1451+
1452+
enum DataSourcePage<T> {
1453+
case notLoaded
1454+
}
1455+
1456+
let pages1: MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)> = MutableProperty((
1457+
// expected-error@-1 {{cannot convert value of type 'MutableProperty<(data: _, totalCount: Int)>' to specified type 'MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)>'}}
1458+
data: .notLoaded,
1459+
totalCount: 0
1460+
))
1461+
1462+
1463+
let pages2: MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)> = MutableProperty((
1464+
// expected-error@-1 {{cannot convert value of type 'MutableProperty<(data: DataSourcePage<_>, totalCount: Int)>' to specified type 'MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)>'}}
1465+
data: DataSourcePage.notLoaded,
1466+
totalCount: 0
1467+
))
1468+
1469+
1470+
let pages3: MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)> = MutableProperty((
1471+
// expected-error@-1 {{expression type 'MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)>' is ambiguous without more context}}
1472+
data: DataSourcePage<Int>.notLoaded,
1473+
totalCount: 0
1474+
))

test/Constraints/tuple_arguments.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,3 +1428,30 @@ func singleElementTupleArgument(completion: ((didAdjust: Bool)) -> Void) {
14281428
completion((didAdjust: true))
14291429
}
14301430

1431+
1432+
// SR-4378
1433+
1434+
final public class MutableProperty<Value> {
1435+
public init(_ initialValue: Value) {}
1436+
}
1437+
1438+
enum DataSourcePage<T> {
1439+
case notLoaded
1440+
}
1441+
1442+
let pages1: MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)> = MutableProperty((
1443+
data: .notLoaded,
1444+
totalCount: 0
1445+
))
1446+
1447+
1448+
let pages2: MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)> = MutableProperty((
1449+
data: DataSourcePage.notLoaded,
1450+
totalCount: 0
1451+
))
1452+
1453+
1454+
let pages3: MutableProperty<(data: DataSourcePage<Int>, totalCount: Int)> = MutableProperty((
1455+
data: DataSourcePage<Int>.notLoaded,
1456+
totalCount: 0
1457+
))

0 commit comments

Comments
 (0)