File tree 4 files changed +24
-6
lines changed
validation-test/Sema/type_checker_perf/slow
4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -2596,7 +2596,8 @@ bool TypeVarBindingProducer::computeNext() {
2596
2596
// expression is non-optional), if we allow both the solver would
2597
2597
// find two solutions that differ only in location of optional
2598
2598
// injection.
2599
- if (!TypeVar->getImpl ().isClosureResultType () || objTy->isVoid ()) {
2599
+ if (!TypeVar->getImpl ().isClosureResultType () || objTy->isVoid () ||
2600
+ objTy->isTypeVariableOrMember ()) {
2600
2601
// If T is a type variable, only attempt this if both the
2601
2602
// type variable we are trying bindings for, and the type
2602
2603
// variable we will attempt to bind, both have the same
Original file line number Diff line number Diff line change @@ -1488,19 +1488,15 @@ func trailingclosure4(f: () -> Int) {}
1488
1488
trailingclosure4 { 5 }
1489
1489
1490
1490
func trailingClosure5< T> ( _ file: String = #file, line: UInt = #line, expression: ( ) -> T ? ) { }
1491
- // expected-note@-1 {{in call to function 'trailingClosure5(_:line:expression:)'}}
1492
1491
func trailingClosure6< T> ( value: Int , expression: ( ) -> T ? ) { }
1493
- // expected-note@-1 {{in call to function 'trailingClosure6(value:expression:)'}}
1494
1492
1495
1493
trailingClosure5 ( file: " hello " , line: 17 ) { // expected-error{{extraneous argument label 'file:' in call}}{{18-24=}}
1496
- // expected-error@-1 {{generic parameter 'T' could not be inferred}}
1497
1494
return Optional . Some ( 5 )
1498
1495
// expected-error@-1 {{enum type 'Optional<Wrapped>' has no case 'Some'; did you mean 'some'?}} {{19-23=some}}
1499
1496
// expected-error@-2 {{generic parameter 'Wrapped' could not be inferred}}
1500
1497
// expected-note@-3 {{explicitly specify the generic arguments to fix this issue}}
1501
1498
}
1502
1499
trailingClosure6 ( 5 ) { // expected-error{{missing argument label 'value:' in call}}{{18-18=value: }}
1503
- // expected-error@-1 {{generic parameter 'T' could not be inferred}}
1504
1500
return Optional . Some ( 5 )
1505
1501
// expected-error@-1 {{enum type 'Optional<Wrapped>' has no case 'Some'; did you mean 'some'?}} {{19-23=some}}
1506
1502
// expected-error@-2 {{generic parameter 'Wrapped' could not be inferred}}
Original file line number Diff line number Diff line change @@ -1305,3 +1305,24 @@ do {
1305
1305
} )
1306
1306
}
1307
1307
}
1308
+
1309
+ // rdar://143474313 - invalid error: member 'init(item:)' in 'Test.Item?' produces result of type 'Test.Item', but context expects 'Test.Item?'
1310
+ do {
1311
+ struct List {
1312
+ struct Item {
1313
+ }
1314
+
1315
+ var items : [ Item ] = [ ]
1316
+ }
1317
+
1318
+ struct Test {
1319
+ struct Item {
1320
+ init ( item: List . Item ) {
1321
+ }
1322
+ }
1323
+
1324
+ let list : List
1325
+
1326
+ var items : [ Test . Item ] { . init( list. items. compactMap { . init( item: $0) } ) } // Ok
1327
+ }
1328
+ }
Original file line number Diff line number Diff line change 1
1
// RUN: %target-typecheck-verify-swift -solver-expression-time-threshold=1
2
2
// REQUIRES: tools-release,no_asan
3
3
4
- let _ = ( 0 ... 1 ) . lazy. flatMap {
4
+ let _ = ( 0 ... 1 ) . lazy. flatMap { // expected-error {{reasonable time}}
5
5
a in ( 1 ... 2 ) . lazy. map { b in ( a, b) }
6
6
} . filter {
7
7
1 < $0 && $0 < $1 && $0 + $1 < 3
You can’t perform that action at this time.
0 commit comments