File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1038,8 +1038,9 @@ bool TypeVarBindingProducer::computeNext() {
1038
1038
1039
1039
auto srcLocator = binding.getLocator ();
1040
1040
if (srcLocator &&
1041
- srcLocator->isLastElement <LocatorPathElt::ApplyArgToParam>() &&
1042
- !type->hasTypeVariable () && CS.isCollectionType (type)) {
1041
+ (srcLocator->isLastElement <LocatorPathElt::ApplyArgToParam>() ||
1042
+ srcLocator->isLastElement <LocatorPathElt::AutoclosureResult>()) &&
1043
+ !type->hasTypeVariable () && CS.isCollectionType (type)) {
1043
1044
// If the type binding comes from the argument conversion, let's
1044
1045
// instead of binding collection types directly, try to bind
1045
1046
// using temporary type variables substituted for element
Original file line number Diff line number Diff line change @@ -874,3 +874,19 @@ func generic_and_missing_label<T>(x: T) {}
874
874
875
875
generic_and_missing_label ( 42 )
876
876
// expected-error@-1 {{missing argument label 'x:' in call}} {{27-27=x: }}
877
+
878
+ // SR-13135: Type inference regression in Swift 5.3 - can't infer a type of @autoclosure result.
879
+ func sr13135( ) {
880
+ struct Foo {
881
+ var bar : [ Int ] = [ ]
882
+ }
883
+
884
+ let baz : Int ? = nil
885
+
886
+ func foo< T: Equatable > (
887
+ _ a: @autoclosure ( ) throws -> T ,
888
+ _ b: @autoclosure ( ) throws -> T
889
+ ) { }
890
+
891
+ foo ( Foo ( ) . bar, [ baz] )
892
+ }
You can’t perform that action at this time.
0 commit comments