ReduceToOptionalTerminalOperation (PsiExpression arg, PsiType resultType) { PsiType optionalElementType = OptionalUtil.getOptionalElementType(resultType); FunctionHelper fn = FunctionHelper.create(arg, 2); if(fn != null && optionalElementType != null) { return new ReduceToOptionalTerminalOperation(fn, optionalElementType); } return null; }