Set<ModuleName> importsThatProduceConflicts = new HashSet<ModuleName>();
boolean noConflicts = updateWithUnimportedModules(unimportedModules, importsThatProduceConflicts, moduleTypeInfo, typeExpr);
if (noConflicts) {
TypeSignature typeSignature = typeExpr.toSourceModel(null, namingPolicy);
FunctionTypeDeclaration typeDecl = FunctionTypeDeclaration.make(function.getName(), typeSignature);
SourcePosition insertionPosition = function.getSourceRangeExcludingCaldoc().getStartSourcePosition();
String insertionText = makeIndentedSourceElementText(typeDecl, insertionPosition, sourceText, false);
sourceModifier.addSourceModification(new SourceModification.InsertText(insertionText, insertionPosition));