diff --git a/lib/Sema/CSBindings.cpp b/lib/Sema/CSBindings.cpp index a3e7ce416b79e..76febfc314d99 100644 --- a/lib/Sema/CSBindings.cpp +++ b/lib/Sema/CSBindings.cpp @@ -1034,7 +1034,8 @@ bool TypeVarBindingProducer::computeNext() { auto srcLocator = binding.getLocator(); if (srcLocator && - srcLocator->isLastElement() && + (srcLocator->isLastElement() || + srcLocator->isLastElement()) && !type->hasTypeVariable() && type->isKnownStdlibCollectionType()) { // If the type binding comes from the argument conversion, let's // instead of binding collection types directly, try to bind diff --git a/test/Constraints/argument_matching.swift b/test/Constraints/argument_matching.swift index 1a8a1984faf1a..0a9f9ecb50ef0 100644 --- a/test/Constraints/argument_matching.swift +++ b/test/Constraints/argument_matching.swift @@ -1607,3 +1607,19 @@ struct DiagnoseAllLabels { f(aax: 0, bbx: 1, dd: 3, ff: 5) // expected-error {{incorrect argument labels in call (have 'aax:bbx:dd:ff:', expected 'aa:bb:dd:ff:')}} {{7-10=aa}} {{15-18=bb}} {{none}} } } + +// SR-13135: Type inference regression in Swift 5.3 - can't infer a type of @autoclosure result. +func sr13135() { + struct Foo { + var bar: [Int] = [] + } + + let baz: Int? = nil + + func foo( + _ a: @autoclosure () throws -> T, + _ b: @autoclosure () throws -> T + ) {} + + foo(Foo().bar, [baz]) +}