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() {
10381038
10391039 auto srcLocator = binding.getLocator ();
10401040 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)) {
10431044 // If the type binding comes from the argument conversion, let's
10441045 // instead of binding collection types directly, try to bind
10451046 // 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) {}
874874
875875generic_and_missing_label ( 42 )
876876// 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