From 0d680aa4ee5a11ce636ed87e6785f8f6e32f471a Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Wed, 17 Feb 2021 10:38:29 -0800 Subject: [PATCH] [TypeChecker] NFC: Add a counter-test example for SR-12033 --- test/Constraints/closures.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/Constraints/closures.swift b/test/Constraints/closures.swift index 642086f06b4c7..78756eb966419 100644 --- a/test/Constraints/closures.swift +++ b/test/Constraints/closures.swift @@ -1117,3 +1117,14 @@ struct SR12033_S { Self.unwrap(o, { _ in .zero }) // expected-error {{contextual closure type '() -> U' expects 0 arguments, but 1 was used in closure body}} } } + +// rdar://problem/74435602 - failure to infer a type for @autoclosure parameter. +func rdar_74435602(error: Error?) { + func accepts_autoclosure(_ expression: @autoclosure () throws -> T) {} + + accepts_autoclosure({ + if let failure = error { + throw failure + } + }) +}