Advice for implementing Closures As Structs

In case of generic function, to obtain a contextual type we would need to reverse effect of openFunctionType(). And I'm still not sure about the form of the type. If we consider a complicated case of:

func f<T, U>(x: U, y: T) where T: Proto, T: BaseClass, T == DerivedClass<U> {}
f(x: 1, y: { $0 }) // should fail to type-check

What should be the contextual type of closure be in this case? Should it be GenericTypeParamType, OpaqueTypeArchetypeType or ProtocolCompositionType? None seem to fit well.