diff --git a/lib/Sema/TypeCheckEffects.cpp b/lib/Sema/TypeCheckEffects.cpp index 03278fceb32..1d76f6186b9 100644 --- a/lib/Sema/TypeCheckEffects.cpp +++ b/lib/Sema/TypeCheckEffects.cpp @@ -1838,6 +1838,8 @@ public: FunctionType *fnSubstType = nullptr; if (auto *fnGenericType = fnInterfaceType->getAs()) fnSubstType = fnGenericType->substGenericArgs(fnRef.getSubstitutions()); + else if (fnRef.getSubstitutions()) + fnSubstType = fnInterfaceType.subst(fnRef.getSubstitutions())->getAs(); else fnSubstType = fnInterfaceType->getAs(); diff --git a/test/stmt/errors.swift b/test/stmt/errors.swift index cf17c0700c6..aa6f943d80c 100644 --- a/test/stmt/errors.swift +++ b/test/stmt/errors.swift @@ -256,3 +256,17 @@ func takesClosure(_: (() -> ())) throws -> Int {} func passesClosure() { _ = try takesClosure { } // expected-error {{errors thrown from here are not handled}} } + +// Parameter packs checking +struct S { + static func packTest(_ values: repeat (each T).Type, shouldThrow: Bool) throws -> Bool { + if (shouldThrow) { + throw MSV.Foo + } + return true + } + + static func test() -> Bool { + return try packTest(String.self, String.self, shouldThrow: true) // expected-error{{errors thrown from here are not handled}} + } +}