private void setFunctionTypedParameterType(ParameterElementImpl element, TypeName returnType,
FormalParameterList parameterList) {
ParameterElement[] parameters = getElements(parameterList);
FunctionTypeAliasElementImpl aliasElement = new FunctionTypeAliasElementImpl(null);
aliasElement.setSynthetic(true);
aliasElement.shareParameters(parameters);
aliasElement.setReturnType(computeReturnType(returnType));
// FunctionTypeAliasElementImpl assumes the enclosing element is a
// CompilationUnitElement (because non-synthetic function types can only be declared
// at top level), so to avoid breaking things, go find the compilation unit element.
aliasElement.setEnclosingElement(element.getAncestor(CompilationUnitElement.class));