@NotNull private String normalizeOutput(@NotNull Pair<String, ExitCode> output) { return AbstractCliTest.getNormalizedCompilerOutput( output.getFirst(), output.getSecond(), getTestDataDirectory().getPath(), JvmMetadataVersion.INSTANCE); }
private void processParameterListWithStructuralChanges( JetChangeInfo changeInfo, PsiElement element, JetParameterList parameterList, JetPsiFactory psiFactory) { int parametersCount = changeInfo.getNonReceiverParametersCount(); boolean isLambda = element instanceof JetFunctionLiteral; boolean canReplaceEntireList = false; JetParameterList newParameterList = null; if (isLambda) { if (parametersCount == 0 && ((JetFunctionLiteral) element).getTypeReference() == null) { if (parameterList != null) { parameterList.delete(); ASTNode arrowNode = ((JetFunctionLiteral) element).getArrowNode(); if (arrowNode != null) { arrowNode.getPsi().delete(); } parameterList = null; } } else { newParameterList = psiFactory.createFunctionLiteralParameterList( changeInfo.getNewParametersSignature( (JetFunctionDefinitionUsage<PsiElement>) this)); canReplaceEntireList = true; } } else { newParameterList = psiFactory.createParameterList( changeInfo.getNewParametersSignature((JetFunctionDefinitionUsage<PsiElement>) this)); } if (newParameterList == null) return; if (parameterList != null) { if (canReplaceEntireList) { newParameterList = (JetParameterList) parameterList.replace(newParameterList); } else { newParameterList = replaceParameterListAndKeepDelimiters(parameterList, newParameterList); } } else { if (element instanceof JetClass) { PsiElement anchor = ((JetClass) element).getTypeParameterList(); if (anchor == null) { anchor = ((JetClass) element).getNameIdentifier(); } if (anchor != null) { JetPrimaryConstructor constructor = (JetPrimaryConstructor) element.addAfter(psiFactory.createPrimaryConstructor(), anchor); JetParameterList oldParameterList = constructor.getValueParameterList(); assert oldParameterList != null : "primary constructor from factory has parameter list"; newParameterList = (JetParameterList) oldParameterList.replace(newParameterList); } } else if (isLambda) { //noinspection ConstantConditions JetFunctionLiteral functionLiteral = (JetFunctionLiteral) element; PsiElement anchor = functionLiteral.getLBrace(); newParameterList = (JetParameterList) element.addAfter(newParameterList, anchor); if (functionLiteral.getArrowNode() == null) { Pair<PsiElement, PsiElement> whitespaceAndArrow = psiFactory.createWhitespaceAndArrow(); element.addRangeAfter( whitespaceAndArrow.getFirst(), whitespaceAndArrow.getSecond(), newParameterList); } } } if (newParameterList != null) { ShortenPackage.addToShorteningWaitSet(newParameterList, Options.DEFAULT); } }