diff --git a/lib/SIL/Verifier/SILVerifier.cpp b/lib/SIL/Verifier/SILVerifier.cpp index 44be79d1d2339..5252eeac50585 100644 --- a/lib/SIL/Verifier/SILVerifier.cpp +++ b/lib/SIL/Verifier/SILVerifier.cpp @@ -3199,6 +3199,7 @@ class SILVerifier : public SILVerifierBase { } SILType getMethodSelfType(CanSILFunctionType ft) { + SILFunctionConventions fnConv(ft, F.getModule()); return fnConv.getSILType(ft->getParameters().back(), F.getTypeExpansionContext()); } diff --git a/test/SILGen/sil_verifier_method_self_type.swift b/test/SILGen/sil_verifier_method_self_type.swift new file mode 100644 index 0000000000000..173302307edb0 --- /dev/null +++ b/test/SILGen/sil_verifier_method_self_type.swift @@ -0,0 +1,11 @@ +// RUN: %target-swift-emit-silgen %s -requirement-machine=verify + +public class C { + public func method() -> Value { fatalError() } +} + +public func foo(_: () -> T) {} + +public func bar() { + foo { C().method() } +}