Support trailing comma
^KT-34743 Fixed
This commit is contained in:
@@ -32,11 +32,12 @@ private val DEFAULT_DECLARATION_CHECKERS = listOf(
|
||||
ReservedMembersAndConstructsForInlineClass(),
|
||||
ResultClassInReturnTypeChecker(),
|
||||
LocalVariableTypeParametersChecker(),
|
||||
TailrecFunctionChecker
|
||||
TailrecFunctionChecker,
|
||||
TrailingCommaDeclarationChecker
|
||||
)
|
||||
|
||||
private val DEFAULT_CALL_CHECKERS = listOf(
|
||||
CapturingInClosureChecker(), InlineCheckerWrapper(), SafeCallChecker(),
|
||||
CapturingInClosureChecker(), InlineCheckerWrapper(), SafeCallChecker(), TrailingCommaCallChecker,
|
||||
DeprecatedCallChecker, CallReturnsArrayOfNothingChecker(), InfixCallChecker(), OperatorCallChecker(),
|
||||
ConstructorHeaderCallChecker, ProtectedConstructorCallChecker, ApiVersionCallChecker,
|
||||
CoroutineSuspendCallChecker, BuilderFunctionsCallChecker, DslScopeViolationCallChecker, MissingDependencyClassChecker,
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.jetbrains.kotlin.resolve.PossiblyBareType.type
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.checkCoroutinesFeature
|
||||
import org.jetbrains.kotlin.resolve.calls.tasks.DynamicCallableDescriptors
|
||||
import org.jetbrains.kotlin.resolve.checkers.TrailingCommaChecker
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.findImplicitOuterClassArguments
|
||||
import org.jetbrains.kotlin.resolve.scopes.LazyScopeAdapter
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
@@ -289,6 +290,8 @@ class TypeResolver(
|
||||
val returnType = if (returnTypeRef != null) resolveType(c.noBareTypes(), returnTypeRef)
|
||||
else moduleDescriptor.builtIns.unitType
|
||||
|
||||
TrailingCommaChecker.check(type.parameterList?.trailingComma, c.trace, languageVersionSettings)
|
||||
|
||||
result = type(
|
||||
createFunctionType(
|
||||
moduleDescriptor.builtIns, annotations, receiverType,
|
||||
@@ -449,6 +452,10 @@ class TypeResolver(
|
||||
): PossiblyBareType {
|
||||
val qualifierParts = qualifierResolutionResult.qualifierParts
|
||||
|
||||
if (element is KtUserType) {
|
||||
TrailingCommaChecker.check(element.typeArgumentList?.trailingComma, c.trace, languageVersionSettings)
|
||||
}
|
||||
|
||||
return when (descriptor) {
|
||||
is TypeParameterDescriptor -> {
|
||||
assert(qualifierParts.size == 1) {
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.checkers
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.AdditionalTypeChecker
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallCheckerContext
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
// TODO: remove these checkers before 1.4 is released
|
||||
|
||||
object TrailingCommaChecker {
|
||||
fun check(trailingComma: PsiElement?, trace: BindingTrace, languageVersionSettings: LanguageVersionSettings) {
|
||||
if (!languageVersionSettings.supportsFeature(LanguageFeature.TrailingCommas) && trailingComma != null) {
|
||||
trace.report(Errors.UNSUPPORTED_FEATURE.on(trailingComma, LanguageFeature.TrailingCommas to languageVersionSettings))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object TrailingCommaDeclarationChecker : DeclarationChecker {
|
||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
||||
when (declaration) {
|
||||
is KtClass -> {
|
||||
TrailingCommaChecker.check(declaration.typeParameterList?.trailingComma, context.trace, context.languageVersionSettings)
|
||||
}
|
||||
is KtCallableDeclaration -> { // also it's executed for anonymous function declarations
|
||||
TrailingCommaChecker.check(declaration.valueParameterList?.trailingComma, context.trace, context.languageVersionSettings)
|
||||
TrailingCommaChecker.check(declaration.typeParameterList?.trailingComma, context.trace, context.languageVersionSettings)
|
||||
if (declaration is KtProperty && declaration.setter != null) {
|
||||
TrailingCommaChecker.check(
|
||||
declaration.setter?.parameterList?.trailingComma,
|
||||
context.trace,
|
||||
context.languageVersionSettings
|
||||
)
|
||||
}
|
||||
}
|
||||
is KtDestructuringDeclaration -> {
|
||||
TrailingCommaChecker.check(declaration.trailingComma, context.trace, context.languageVersionSettings)
|
||||
}
|
||||
is KtTypeAlias -> {
|
||||
TrailingCommaChecker.check(declaration.typeParameterList?.trailingComma, context.trace, context.languageVersionSettings)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object TrailingCommaCallChecker : CallChecker {
|
||||
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
|
||||
when (val callElement = resolvedCall.call.callElement) {
|
||||
is KtArrayAccessExpression -> TrailingCommaChecker.check(
|
||||
callElement.trailingComma,
|
||||
context.trace,
|
||||
context.languageVersionSettings
|
||||
)
|
||||
is KtCollectionLiteralExpression -> TrailingCommaChecker.check(
|
||||
callElement.trailingComma,
|
||||
context.trace,
|
||||
context.languageVersionSettings
|
||||
)
|
||||
is KtWhenExpression -> {
|
||||
if (callElement.subjectExpression != null) {
|
||||
callElement.entries.forEach { whenEntry ->
|
||||
TrailingCommaChecker.check(whenEntry.trailingComma, context.trace, context.languageVersionSettings)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
resolvedCall.call.run {
|
||||
TrailingCommaChecker.check(valueArgumentList?.trailingComma, context.trace, context.languageVersionSettings)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue;
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.KotlinResolutionCallbacksImpl;
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.LambdaContextInfo;
|
||||
import org.jetbrains.kotlin.resolve.checkers.TrailingCommaChecker;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope;
|
||||
@@ -490,6 +491,13 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
|
||||
|
||||
@Override
|
||||
public KotlinTypeInfo visitTryExpression(@NotNull KtTryExpression expression, ExpressionTypingContext typingContext) {
|
||||
expression.getCatchClauses().forEach((catchClause) -> {
|
||||
KtParameterList parameters = catchClause.getParameterList();
|
||||
if (parameters != null) {
|
||||
TrailingCommaChecker.INSTANCE.check(parameters.getTrailingComma(), typingContext.trace, typingContext.languageVersionSettings);
|
||||
}
|
||||
});
|
||||
|
||||
if (typingContext.languageVersionSettings.supportsFeature(LanguageFeature.NewInference)) {
|
||||
return resolveTryExpressionWithNewInference(expression, typingContext);
|
||||
}
|
||||
|
||||
+3
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver
|
||||
import org.jetbrains.kotlin.resolve.LocalVariableResolver
|
||||
import org.jetbrains.kotlin.resolve.TypeResolver
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
|
||||
import org.jetbrains.kotlin.resolve.checkers.TrailingCommaChecker
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
@@ -56,6 +57,8 @@ class DestructuringDeclarationResolver(
|
||||
result.add(variableDescriptor)
|
||||
}
|
||||
|
||||
TrailingCommaChecker.check(destructuringDeclaration.trailingComma, context.trace, context.languageVersionSettings)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.BindingContext.EXPECTED_RETURN_TYPE
|
||||
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableTypeConstructor
|
||||
import org.jetbrains.kotlin.resolve.checkers.TrailingCommaChecker
|
||||
import org.jetbrains.kotlin.resolve.checkers.TrailingCommaDeclarationChecker
|
||||
import org.jetbrains.kotlin.resolve.checkers.UnderscoreChecker
|
||||
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil
|
||||
import org.jetbrains.kotlin.resolve.scopes.LexicalWritableScope
|
||||
@@ -141,6 +143,11 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre
|
||||
components.identifierChecker.checkDeclaration(it, context.trace)
|
||||
UnderscoreChecker.checkNamed(it, context.trace, components.languageVersionSettings, allowSingleUnderscore = true)
|
||||
}
|
||||
TrailingCommaChecker.check(
|
||||
expression.functionLiteral.valueParameterList?.trailingComma,
|
||||
context.trace,
|
||||
context.languageVersionSettings
|
||||
)
|
||||
val safeReturnType = computeReturnType(expression, context, functionDescriptor, functionTypeExpected)
|
||||
functionDescriptor.setReturnType(safeReturnType)
|
||||
|
||||
|
||||
@@ -933,6 +933,9 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
parseWhenCondition();
|
||||
if (!at(COMMA)) break;
|
||||
advance(); // COMMA
|
||||
if (at(ARROW)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
expect(ARROW, "Expecting '->'", WHEN_CONDITION_RECOVERY_SET);
|
||||
@@ -1032,22 +1035,13 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
}
|
||||
|
||||
private void parseInnerExpressions(String missingElementErrorMessage) {
|
||||
boolean firstElement = true;
|
||||
while (true) {
|
||||
if (at(COMMA)) errorAndAdvance(missingElementErrorMessage);
|
||||
if (at(RBRACKET)) {
|
||||
if (firstElement) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
error(missingElementErrorMessage);
|
||||
}
|
||||
break;
|
||||
}
|
||||
parseExpression();
|
||||
|
||||
firstElement = false;
|
||||
|
||||
if (!at(COMMA)) break;
|
||||
advance(); // COMMA
|
||||
}
|
||||
@@ -1202,6 +1196,9 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
PsiBuilder.Marker parameterList = mark();
|
||||
|
||||
while (!eof()) {
|
||||
if (at(ARROW)) {
|
||||
break;
|
||||
}
|
||||
PsiBuilder.Marker parameter = mark();
|
||||
|
||||
if (at(COLON)) {
|
||||
@@ -1521,6 +1518,9 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
expect(LPAR, "Expecting '('", recoverySet);
|
||||
if (!atSet(recoverySet)) {
|
||||
myKotlinParsing.parseValueParameter(/*typeRequired = */ true);
|
||||
if (at(COMMA)) {
|
||||
advance(); // trailing comma
|
||||
}
|
||||
expect(RPAR, "Expecting ')'", recoverySet);
|
||||
}
|
||||
else {
|
||||
@@ -1813,7 +1813,6 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
}
|
||||
advance(); // COMMA
|
||||
if (at(RPAR)) {
|
||||
error("Expecting an argument");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1466,7 +1466,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
if (at(COMMA)) {
|
||||
errorAndAdvance("Expecting a name");
|
||||
}
|
||||
else if (at(RPAR)) {
|
||||
else if (at(RPAR)) { // For declaration similar to `val () = somethingCall()`
|
||||
error("Expecting a name");
|
||||
break;
|
||||
}
|
||||
@@ -1484,6 +1484,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
|
||||
if (!at(COMMA)) break;
|
||||
advance(); // COMMA
|
||||
if (at(RPAR)) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1549,10 +1550,13 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
expect(IDENTIFIER, "Expecting parameter name", TokenSet.create(RPAR, COLON, LBRACE, EQ));
|
||||
|
||||
if (at(COLON)) {
|
||||
advance(); // COLON
|
||||
advance(); // COLON
|
||||
parseTypeRef();
|
||||
}
|
||||
setterParameter.done(VALUE_PARAMETER);
|
||||
if (at(COMMA)) {
|
||||
advance(); // COMMA
|
||||
}
|
||||
parameterList.done(VALUE_PARAMETER_LIST);
|
||||
}
|
||||
if (!at(RPAR)) {
|
||||
@@ -1896,6 +1900,9 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
|
||||
if (!at(COMMA)) break;
|
||||
advance(); // COMMA
|
||||
if (at(GT)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
expect(GT, "Missing '>'", recoverySet);
|
||||
@@ -2263,6 +2270,9 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
projection.done(TYPE_PROJECTION);
|
||||
if (!at(COMMA)) break;
|
||||
advance(); // COMMA
|
||||
if (at(GT)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boolean atGT = at(GT);
|
||||
@@ -2325,7 +2335,6 @@ public class KotlinParsing extends AbstractKotlinParsing {
|
||||
errorAndAdvance("Expecting a parameter declaration");
|
||||
}
|
||||
else if (at(RPAR)) {
|
||||
error("Expecting a parameter declaration");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.KtNodeTypes;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -75,4 +76,8 @@ public class KtArrayAccessExpression extends KtExpressionImpl implements KtRefer
|
||||
public PsiElement getRightBracket() {
|
||||
return getIndicesNode().findChildByType(KtTokens.RBRACKET);
|
||||
}
|
||||
|
||||
public PsiElement getTrailingComma() {
|
||||
return KtPsiUtilKt.getTrailingCommaByClosingElement(getRightBracket());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getTrailingCommaByClosingElement
|
||||
|
||||
class KtCollectionLiteralExpression(node: ASTNode) : KtExpressionImpl(node), KtReferenceExpression {
|
||||
override fun <R, D> accept(visitor: KtVisitor<R, D>, data: D): R {
|
||||
@@ -32,6 +33,9 @@ class KtCollectionLiteralExpression(node: ASTNode) : KtExpressionImpl(node), KtR
|
||||
val rightBracket: PsiElement?
|
||||
get() = findChildByType(KtTokens.RBRACKET)
|
||||
|
||||
val trailingComma: PsiElement?
|
||||
get() = getTrailingCommaByClosingElement(rightBracket)
|
||||
|
||||
fun getInnerExpressions(): List<KtExpression> {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, KtExpression::class.java)
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.KtNodeTypes;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -78,4 +79,9 @@ public class KtDestructuringDeclaration extends KtDeclarationImpl implements KtV
|
||||
public PsiElement getLPar() {
|
||||
return findChildByType(KtTokens.LPAR);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getTrailingComma() {
|
||||
return KtPsiUtilKt.getTrailingCommaByClosingElement(getRPar());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||
|
||||
@@ -94,4 +95,14 @@ public class KtParameterList extends KtElementImplStub<KotlinPlaceHolderStub<KtP
|
||||
public PsiElement getFirstComma() {
|
||||
return findChildByType(KtTokens.COMMA);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getTrailingComma() {
|
||||
PsiElement parentElement = getParent();
|
||||
if (parentElement instanceof KtFunctionLiteral || parentElement instanceof KtPropertyAccessor) {
|
||||
return KtPsiUtilKt.getTrailingCommaByElementsList(this);
|
||||
} else {
|
||||
return KtPsiUtilKt.getTrailingCommaByClosingElement(getRightParenthesis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
package org.jetbrains.kotlin.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||
|
||||
@@ -47,4 +50,9 @@ public class KtTypeArgumentList extends KtElementImplStub<KotlinPlaceHolderStub<
|
||||
public KtTypeProjection addArgument(@NotNull KtTypeProjection typeArgument) {
|
||||
return EditCommaSeparatedListHelper.INSTANCE.addItem(this, getArguments(), typeArgument, KtTokens.LT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getTrailingComma() {
|
||||
return KtPsiUtilKt.getTrailingCommaByClosingElement(findChildByType(KtTokens.GT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
package org.jetbrains.kotlin.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||
|
||||
@@ -47,4 +50,9 @@ public class KtTypeParameterList extends KtElementImplStub<KotlinPlaceHolderStub
|
||||
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitTypeParameterList(this, data);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getTrailingComma() {
|
||||
return KtPsiUtilKt.getTrailingCommaByClosingElement(findChildByType(KtTokens.GT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub;
|
||||
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes;
|
||||
|
||||
@@ -78,4 +79,8 @@ public class KtValueArgumentList extends KtElementImplStub<KotlinPlaceHolderStub
|
||||
public void removeArgument(int index) {
|
||||
removeArgument(getArguments().get(index));
|
||||
}
|
||||
|
||||
public PsiElement getTrailingComma() {
|
||||
return KtPsiUtilKt.getTrailingCommaByClosingElement(getRightParenthesis());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.psi.psiUtil.KtPsiUtilKt;
|
||||
|
||||
public class KtWhenEntry extends KtElementImpl {
|
||||
public KtWhenEntry(@NotNull ASTNode node) {
|
||||
@@ -50,4 +51,8 @@ public class KtWhenEntry extends KtElementImpl {
|
||||
public KtWhenCondition[] getConditions() {
|
||||
return findChildrenByClass(KtWhenCondition.class);
|
||||
}
|
||||
|
||||
public PsiElement getTrailingComma() {
|
||||
return KtPsiUtilKt.getTrailingCommaByClosingElement(findChildByType(KtTokens.ARROW));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -672,3 +672,14 @@ fun KtExpression.topParenthesizedParentOrMe(): KtExpression {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
fun getTrailingCommaByClosingElement(closingElement: PsiElement?): PsiElement? {
|
||||
val elementBeforeClosingElement =
|
||||
closingElement?.getPrevSiblingIgnoringWhitespaceAndComments() ?: return null
|
||||
|
||||
return elementBeforeClosingElement.run { if (node.elementType == KtTokens.COMMA) this else null }
|
||||
}
|
||||
|
||||
fun getTrailingCommaByElementsList(elementList: PsiElement?): PsiElement? {
|
||||
return elementList?.lastChild?.run { if (node.elementType == KtTokens.COMMA) this else null }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +TrailingCommas
|
||||
|
||||
fun foo(vararg x: Int) = false
|
||||
fun foo(x: Int) = true
|
||||
|
||||
fun box(): String {
|
||||
val x = foo(1)
|
||||
val y = foo(1,)
|
||||
return if (x && y) "OK" else "ERROR"
|
||||
}
|
||||
@@ -7,5 +7,5 @@ fun <T> foo(a : T, b : Collection<T>, c : Int) {
|
||||
|
||||
fun <T> arrayListOf(vararg values: T): ArrayList<T> = throw Exception("$values")
|
||||
|
||||
val bar = foo("", arrayListOf(),<!SYNTAX!><!> )
|
||||
val bar2 = foo<String>("", arrayListOf(),<!SYNTAX!><!> )
|
||||
val bar = foo("", arrayListOf()<!UNSUPPORTED_FEATURE!>,<!> <!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
val bar2 = foo<String>("", arrayListOf()<!UNSUPPORTED_FEATURE!>,<!> <!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
@@ -39,7 +39,7 @@ interface Test<in I, out O, P> {
|
||||
fun neOk11(i: Inv<in <!TYPE_VARIANCE_CONFLICT("I", "in", "out", "Inv<in I>")!>I<!>>)
|
||||
fun neOk12(i: Inv<out <!TYPE_VARIANCE_CONFLICT("O", "out", "in", "Inv<out O>")!>O<!>>)
|
||||
|
||||
fun neOk30(i: Pair<<!TYPE_VARIANCE_CONFLICT("O", "out", "in", "Pair<O, [ERROR : No type element]>")!>O<!>, <!SYNTAX!><!>>)
|
||||
fun neOk30(i: Pair<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><O<!UNSUPPORTED_FEATURE!>,<!> ><!>)
|
||||
fun neOk31(i: Pair<<!TYPE_VARIANCE_CONFLICT("O", "out", "in", "Pair<O, [ERROR : Inv]>")!>O<!>, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>)
|
||||
fun neOk32(i: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>)
|
||||
fun neOk33(i: Inv<<!SYNTAX!><!>>)
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface Test</*0*/ in I, /*1*/ out O, /*2*/ P> {
|
||||
public abstract fun neOk12(/*0*/ i: Inv<out O>): kotlin.Unit
|
||||
public abstract fun neOk2(/*0*/ i: In<I>): kotlin.Unit
|
||||
public abstract fun neOk3(/*0*/ i: In<In<O>>): kotlin.Unit
|
||||
public abstract fun neOk30(/*0*/ i: Pair<O, [ERROR : No type element]>): kotlin.Unit
|
||||
public abstract fun neOk30(/*0*/ i: [ERROR : Pair]<O>): kotlin.Unit
|
||||
public abstract fun neOk31(/*0*/ i: Pair<O, [ERROR : Inv]>): kotlin.Unit
|
||||
public abstract fun neOk32(/*0*/ i: [ERROR : Inv]): kotlin.Unit
|
||||
public abstract fun neOk33(/*0*/ i: Inv<[ERROR : No type element]>): kotlin.Unit
|
||||
|
||||
@@ -36,7 +36,7 @@ interface Test<in I, out O, P> {
|
||||
var neOk22: Inv<out <!TYPE_VARIANCE_CONFLICT("O", "out", "invariant", "Inv<out O>")!>O<!>>
|
||||
var neOk23: Inv<out <!TYPE_VARIANCE_CONFLICT("I", "in", "invariant", "Inv<out I>")!>I<!>>
|
||||
|
||||
var neOk30: Pair<<!TYPE_VARIANCE_CONFLICT("I", "in", "invariant", "Pair<I, [ERROR : No type element]>")!>I<!>, <!SYNTAX!><!>>
|
||||
var neOk30: Pair<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><I<!UNSUPPORTED_FEATURE!>,<!> ><!>
|
||||
var neOk31: Pair<<!TYPE_VARIANCE_CONFLICT("I", "in", "invariant", "Pair<I, [ERROR : Inv]>")!>I<!>, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>
|
||||
var neOk32: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>
|
||||
var neOk33: Inv<<!SYNTAX!><!>>
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface Test</*0*/ in I, /*1*/ out O, /*2*/ P> {
|
||||
public abstract var neOk22: Inv<out O>
|
||||
public abstract var neOk23: Inv<out I>
|
||||
public abstract var neOk3: In<In<O>>
|
||||
public abstract var neOk30: Pair<I, [ERROR : No type element]>
|
||||
public abstract var neOk30: [ERROR : Pair]<I>
|
||||
public abstract var neOk31: Pair<I, [ERROR : Inv]>
|
||||
public abstract var neOk32: [ERROR : Inv]
|
||||
public abstract var neOk33: Inv<[ERROR : No type element]>
|
||||
|
||||
@@ -31,7 +31,7 @@ interface Test<in I, out O, P> {
|
||||
fun neOk10(): Inv<in <!TYPE_VARIANCE_CONFLICT("O", "out", "in", "Inv<in O>")!>O<!>>
|
||||
fun neOk11(): Inv<out <!TYPE_VARIANCE_CONFLICT("I", "in", "out", "Inv<out I>")!>I<!>>
|
||||
|
||||
fun neOk30(): Pair<<!TYPE_VARIANCE_CONFLICT("I", "in", "out", "Pair<I, [ERROR : No type element]>")!>I<!>, <!SYNTAX!><!>>
|
||||
fun neOk30(): Pair<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><I<!UNSUPPORTED_FEATURE!>,<!> ><!>
|
||||
fun neOk31(): Pair<<!TYPE_VARIANCE_CONFLICT("I", "in", "out", "Pair<I, [ERROR : Inv]>")!>I<!>, <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>>
|
||||
fun neOk32(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inv<!>
|
||||
fun neOk33(): Inv<<!SYNTAX!><!>>
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface Test</*0*/ in I, /*1*/ out O, /*2*/ P> {
|
||||
public abstract fun neOk11(): Inv<out I>
|
||||
public abstract fun neOk2(): In<O>
|
||||
public abstract fun neOk3(): In<In<I>>
|
||||
public abstract fun neOk30(): Pair<I, [ERROR : No type element]>
|
||||
public abstract fun neOk30(): [ERROR : Pair]<I>
|
||||
public abstract fun neOk31(): Pair<I, [ERROR : Inv]>
|
||||
public abstract fun neOk32(): [ERROR : Inv]
|
||||
public abstract fun neOk33(): Inv<[ERROR : No type element]>
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_DESTRUCTURED_PARAMETER_ENTRY, -UNUSED_ANONYMOUS_PARAMETER
|
||||
|
||||
data class Foo1(val x: String, val y: String, val z: String = "")
|
||||
|
||||
fun main() {
|
||||
val (x1,y1<!UNSUPPORTED_FEATURE!>,<!>) = Pair(1,2)
|
||||
val (x2, y2: Number<!UNSUPPORTED_FEATURE!>,<!>) = Pair(1,2)
|
||||
val (x3,y3,z3<!UNSUPPORTED_FEATURE!>,<!>) = Foo1("", ""<!UNSUPPORTED_FEATURE!>,<!> )
|
||||
val (x4,y4: CharSequence<!UNSUPPORTED_FEATURE!>,<!>) = Foo1("", "", ""<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
val (x41,y41: CharSequence<!UNSUPPORTED_FEATURE!>,<!>/**/) = Foo1("", "", ""<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
|
||||
val x5: (Pair<Int, Int>, Int) -> Unit = { (x,y<!UNSUPPORTED_FEATURE!>,<!>),z<!UNSUPPORTED_FEATURE!>,<!> -> }
|
||||
val x6: (Foo1, Int) -> Any = { (x,y,z: CharSequence<!UNSUPPORTED_FEATURE!>,<!>), z1: Number<!UNSUPPORTED_FEATURE!>,<!> -> 1 }
|
||||
val x61: (Foo1, Int) -> Any = { (x,y,z: CharSequence<!UNSUPPORTED_FEATURE!>,<!>/**/), z1: Number<!UNSUPPORTED_FEATURE!>,<!>/**/ -> 1 }
|
||||
|
||||
for ((i, j<!UNSUPPORTED_FEATURE!>,<!>) in listOf(Pair(1,2))) {}
|
||||
for ((i: Any<!UNSUPPORTED_FEATURE!>,<!>) in listOf(Pair(1,2))) {}
|
||||
for ((i: Any<!UNSUPPORTED_FEATURE!>,<!>/**/) in listOf(Pair(1,2))) {}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public final data class Foo1 {
|
||||
public constructor Foo1(/*0*/ x: kotlin.String, /*1*/ y: kotlin.String, /*2*/ z: kotlin.String = ...)
|
||||
public final val x: kotlin.String
|
||||
public final val y: kotlin.String
|
||||
public final val z: kotlin.String
|
||||
public final operator /*synthesized*/ fun component1(): kotlin.String
|
||||
public final operator /*synthesized*/ fun component2(): kotlin.String
|
||||
public final operator /*synthesized*/ fun component3(): kotlin.String
|
||||
public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ..., /*1*/ y: kotlin.String = ..., /*2*/ z: kotlin.String = ...): Foo1
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_DESTRUCTURED_PARAMETER_ENTRY, -UNUSED_ANONYMOUS_PARAMETER
|
||||
// !LANGUAGE: +TrailingCommas
|
||||
|
||||
data class Foo1(val x: String, val y: String, val z: String = "")
|
||||
|
||||
fun main() {
|
||||
val (x1,y1,) = Pair(1, 2)
|
||||
val (x2, y2: Number,) = Pair(1,2)
|
||||
val (x3,y3,z3,) = Foo1("", "",)
|
||||
val (x4,y4: CharSequence,) = Foo1("", "", "",)
|
||||
val (x41,y41: CharSequence,/**/) = Foo1("", "", "",)
|
||||
|
||||
val x5: (Pair<Int, Int>, Int) -> Unit = { (x,y,),z, -> }
|
||||
val x6: (Foo1, Int) -> Any = { (x,y,z: CharSequence,), z2: Number, -> 1 }
|
||||
val x61: (Foo1, Int) -> Any = { (x,y,z: CharSequence,/**/), z2: Number,/**/ -> 1 }
|
||||
|
||||
for ((i, j) in listOf(Pair(1,2))) {}
|
||||
for ((i: Any,) in listOf(Pair(1,2))) {}
|
||||
for ((i: Any,/**/) in listOf(Pair(1,2))) {}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public final data class Foo1 {
|
||||
public constructor Foo1(/*0*/ x: kotlin.String, /*1*/ y: kotlin.String, /*2*/ z: kotlin.String = ...)
|
||||
public final val x: kotlin.String
|
||||
public final val y: kotlin.String
|
||||
public final val z: kotlin.String
|
||||
public final operator /*synthesized*/ fun component1(): kotlin.String
|
||||
public final operator /*synthesized*/ fun component2(): kotlin.String
|
||||
public final operator /*synthesized*/ fun component3(): kotlin.String
|
||||
public final /*synthesized*/ fun copy(/*0*/ x: kotlin.String = ..., /*1*/ y: kotlin.String = ..., /*2*/ z: kotlin.String = ...): Foo1
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
||||
// !LANGUAGE: +TrailingCommas
|
||||
|
||||
fun foo(vararg x: Int) = false
|
||||
fun foo() = true
|
||||
|
||||
fun main() {
|
||||
val x = foo()
|
||||
val y = foo(<!SYNTAX!>,<!><!SYNTAX!><!>)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
public fun foo(): kotlin.Boolean
|
||||
public fun foo(/*0*/ vararg x: kotlin.Int /*kotlin.IntArray*/): kotlin.Boolean
|
||||
public fun main(): kotlin.Unit
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_TYPEALIAS_PARAMETER, -CAST_NEVER_SUCCEEDS
|
||||
|
||||
class Foo1<T1> {}
|
||||
|
||||
interface Foo2<T1<!UNSUPPORTED_FEATURE!>,<!>>
|
||||
|
||||
fun <T1, T2, T3>foo3() {}
|
||||
|
||||
typealias Foo4<T1,T2,T3,T4> = Int
|
||||
|
||||
class Foo5<T, K: T<!UNSUPPORTED_FEATURE!>,<!>>: Foo2<K<!UNSUPPORTED_FEATURE!>,<!>>
|
||||
|
||||
fun <T> foo() {
|
||||
val x1 = Foo1<Int,>()
|
||||
val x2: Foo2<Int<!UNSUPPORTED_FEATURE!>,<!>>? = null
|
||||
val x21: Foo2<Int<!UNSUPPORTED_FEATURE!>,<!>/**/>? = null
|
||||
val x3 = foo3<
|
||||
Int,
|
||||
String,
|
||||
Float,
|
||||
>()
|
||||
val x4: Foo4<Comparable<Int<!UNSUPPORTED_FEATURE!>,<!>>, Iterable<Comparable<Float<!UNSUPPORTED_FEATURE!>,<!>><!UNSUPPORTED_FEATURE!>,<!>>, Double, T<!UNSUPPORTED_FEATURE!>,<!>
|
||||
>? = null as Foo4<Comparable<Int<!UNSUPPORTED_FEATURE!>,<!>>, Iterable<Comparable<Float<!UNSUPPORTED_FEATURE!>,<!>><!UNSUPPORTED_FEATURE!>,<!>>, Double, T<!UNSUPPORTED_FEATURE!>,<!>>
|
||||
val x5: (Float<!UNSUPPORTED_FEATURE!>,<!>) -> Unit = {}
|
||||
val x6: Pair<(Float, Comparable<T<!UNSUPPORTED_FEATURE!>,<!>><!UNSUPPORTED_FEATURE!>,<!>) -> Unit, (Float<!UNSUPPORTED_FEATURE!>,<!>) -> Unit<!UNSUPPORTED_FEATURE!>,<!>>? = null
|
||||
val x61: Pair<(Float, Comparable<T<!UNSUPPORTED_FEATURE!>,<!>/**/><!UNSUPPORTED_FEATURE!>,<!>/**/) -> Unit, (Float<!UNSUPPORTED_FEATURE!>,<!>/**/) -> Unit<!UNSUPPORTED_FEATURE!>,<!>/**/>? = null
|
||||
}
|
||||
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> foo(): kotlin.Unit
|
||||
public fun </*0*/ T1, /*1*/ T2, /*2*/ T3> foo3(): kotlin.Unit
|
||||
|
||||
public final class Foo1</*0*/ T1> {
|
||||
public constructor Foo1</*0*/ T1>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Foo2</*0*/ T1> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo5</*0*/ T, /*1*/ K : T> : Foo2<K> {
|
||||
public constructor Foo5</*0*/ T, /*1*/ K : T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
public typealias Foo4</*0*/ T1, /*1*/ T2, /*2*/ T3, /*3*/ T4> = kotlin.Int
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_TYPEALIAS_PARAMETER, -CAST_NEVER_SUCCEEDS
|
||||
// !LANGUAGE: +TrailingCommas
|
||||
|
||||
class Foo1<T1> {}
|
||||
|
||||
interface Foo2<T1,>
|
||||
|
||||
fun <T1, T2, T3>foo3() {}
|
||||
|
||||
typealias Foo4<T1,T2,T3,T4> = Int
|
||||
|
||||
class Foo5<T, K: T,>: Foo2<K,>
|
||||
|
||||
fun <T>foo () {
|
||||
val x1 = Foo1<Int,>()
|
||||
val x2: Foo2<Int,>? = null
|
||||
val x21: Foo2<Int,/**/>? = null
|
||||
val x3 = foo3<
|
||||
Int,
|
||||
String,
|
||||
Float,
|
||||
>()
|
||||
val x4: Foo4<Comparable<Int,>, Iterable<Comparable<Float,>,>, Double, T,
|
||||
>? = null as Foo4<Comparable<Int,>, Iterable<Comparable<Float,>,>, Double, T,>
|
||||
val x5: (Float,) -> Unit = {}
|
||||
val x6: Pair<(Float, Comparable<T,>,) -> Unit, (Float,) -> Unit,>? = null
|
||||
val x61: Pair<(Float, Comparable<T,/**/>,/**/) -> Unit, (Float,/**/) -> Unit,/**/>? = null
|
||||
}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> foo(): kotlin.Unit
|
||||
public fun </*0*/ T1, /*1*/ T2, /*2*/ T3> foo3(): kotlin.Unit
|
||||
|
||||
public final class Foo1</*0*/ T1> {
|
||||
public constructor Foo1</*0*/ T1>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Foo2</*0*/ T1> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo5</*0*/ T, /*1*/ K : T> : Foo2<K> {
|
||||
public constructor Foo5</*0*/ T, /*1*/ K : T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
public typealias Foo4</*0*/ T1, /*1*/ T2, /*2*/ T3, /*3*/ T4> = kotlin.Int
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_TYPEALIAS_PARAMETER
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Anno
|
||||
|
||||
class Foo1<T1<!UNSUPPORTED_FEATURE!>,<!>>
|
||||
|
||||
class Foo2<
|
||||
T1,
|
||||
T2: T1<!UNSUPPORTED_FEATURE!>,<!>
|
||||
> {
|
||||
fun <T1,
|
||||
T2<!UNSUPPORTED_FEATURE!>,<!> > foo2() {}
|
||||
|
||||
internal inner class B<T,T2<!UNSUPPORTED_FEATURE!>,<!>>
|
||||
}
|
||||
|
||||
interface A<T<!UNSUPPORTED_FEATURE!>,<!>>
|
||||
|
||||
interface A1<T<!UNSUPPORTED_FEATURE!>,<!>/**/>
|
||||
|
||||
fun <T<!UNSUPPORTED_FEATURE!>,<!>> foo1() {}
|
||||
|
||||
fun <T<!UNSUPPORTED_FEATURE!>,<!>/**/> foo11() {}
|
||||
|
||||
fun <T1,
|
||||
T2<!UNSUPPORTED_FEATURE!>,<!>
|
||||
> T2?.foo2() {}
|
||||
|
||||
val <T<!UNSUPPORTED_FEATURE!>,<!>> T.bar1 get() = null
|
||||
|
||||
var <
|
||||
T4<!UNSUPPORTED_FEATURE!>,<!>
|
||||
> T4?.bar2
|
||||
get() = null
|
||||
set(value) {
|
||||
|
||||
}
|
||||
|
||||
typealias Foo3<T1, @Anno T2<!UNSUPPORTED_FEATURE!>,<!>> = List<T2>
|
||||
|
||||
typealias Foo4<T1, @Anno T2<!UNSUPPORTED_FEATURE!>,<!>/**/> = List<T2>
|
||||
|
||||
fun main() {
|
||||
fun <T<!UNSUPPORTED_FEATURE!>,<!>> foo10() {
|
||||
fun <T1,T2,T3<!UNSUPPORTED_FEATURE!>,<!>> foo10() {}
|
||||
}
|
||||
}
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
package
|
||||
|
||||
public val </*0*/ T> T.bar1: kotlin.Nothing?
|
||||
public var </*0*/ T4> T4?.bar2: kotlin.Nothing?
|
||||
public fun </*0*/ T> foo1(): kotlin.Unit
|
||||
public fun </*0*/ T> foo11(): kotlin.Unit
|
||||
public fun main(): kotlin.Unit
|
||||
public fun </*0*/ T1, /*1*/ T2> T2?.foo2(): kotlin.Unit
|
||||
|
||||
public interface A</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface A1</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Anno : kotlin.Annotation {
|
||||
public constructor Anno()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo1</*0*/ T1> {
|
||||
public constructor Foo1</*0*/ T1>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo2</*0*/ T1, /*1*/ T2 : T1> {
|
||||
public constructor Foo2</*0*/ T1, /*1*/ T2 : T1>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun </*0*/ T1, /*1*/ T2> foo2(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal final inner class B</*0*/ T, /*1*/ T2> /*captured type parameters: /*2*/ T1, /*3*/ T2 : T1*/ {
|
||||
public constructor B</*0*/ T, /*1*/ T2>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
public typealias Foo3</*0*/ T1, /*1*/ @Anno T2> = kotlin.collections.List<T2>
|
||||
public typealias Foo4</*0*/ T1, /*1*/ @Anno T2> = kotlin.collections.List<T2>
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_TYPEALIAS_PARAMETER
|
||||
// !LANGUAGE: +TrailingCommas
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Anno
|
||||
|
||||
class Foo1<T1,>
|
||||
|
||||
class Foo2<
|
||||
T1,
|
||||
T2: T1,
|
||||
> {
|
||||
fun <T1,
|
||||
T2, > foo2() {}
|
||||
|
||||
internal inner class B<T,T2,>
|
||||
}
|
||||
|
||||
interface A<T,>
|
||||
|
||||
interface A1<T,/**/>
|
||||
|
||||
fun <T,> foo1() {}
|
||||
|
||||
fun <T,/**/> foo11() {}
|
||||
|
||||
inline fun <reified T1, T2, reified T3,> foo2() {}
|
||||
|
||||
fun <T1,
|
||||
T2,
|
||||
> T2?.foo3() {}
|
||||
|
||||
val <T,> T.bar1 get() = null
|
||||
|
||||
var <
|
||||
T4,
|
||||
> T4?.bar2
|
||||
get() = null
|
||||
set(value) {
|
||||
|
||||
}
|
||||
|
||||
typealias Foo3<T1, @Anno T2,> = List<T2>
|
||||
|
||||
typealias Foo4<T1, @Anno T2,/**/> = List<T2>
|
||||
|
||||
fun main() {
|
||||
fun <T,> foo10() {
|
||||
fun <T1,T2,T3,> foo10() {}
|
||||
}
|
||||
}
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
package
|
||||
|
||||
public val </*0*/ T> T.bar1: kotlin.Nothing?
|
||||
public var </*0*/ T4> T4?.bar2: kotlin.Nothing?
|
||||
public fun </*0*/ T> foo1(): kotlin.Unit
|
||||
public fun </*0*/ T> foo11(): kotlin.Unit
|
||||
public inline fun </*0*/ reified T1, /*1*/ T2, /*2*/ reified T3> foo2(): kotlin.Unit
|
||||
public fun main(): kotlin.Unit
|
||||
public fun </*0*/ T1, /*1*/ T2> T2?.foo3(): kotlin.Unit
|
||||
|
||||
public interface A</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface A1</*0*/ T> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Anno : kotlin.Annotation {
|
||||
public constructor Anno()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo1</*0*/ T1> {
|
||||
public constructor Foo1</*0*/ T1>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo2</*0*/ T1, /*1*/ T2 : T1> {
|
||||
public constructor Foo2</*0*/ T1, /*1*/ T2 : T1>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun </*0*/ T1, /*1*/ T2> foo2(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal final inner class B</*0*/ T, /*1*/ T2> /*captured type parameters: /*2*/ T1, /*3*/ T2 : T1*/ {
|
||||
public constructor B</*0*/ T, /*1*/ T2>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
public typealias Foo3</*0*/ T1, /*1*/ @Anno T2> = kotlin.collections.List<T2>
|
||||
public typealias Foo4</*0*/ T1, /*1*/ @Anno T2> = kotlin.collections.List<T2>
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Anno1(val x: IntArray)
|
||||
|
||||
@Target(AnnotationTarget.TYPEALIAS)
|
||||
annotation class Anno2(val x: DoubleArray)
|
||||
|
||||
fun foo1(vararg x: Any) {}
|
||||
fun foo2(x: (Any, Any) -> Unit) {}
|
||||
fun foo3(x: Any, y: () -> Unit) {}
|
||||
|
||||
open class A1(vararg x: Any) {
|
||||
operator fun get(x: Any, y: Any) = 10
|
||||
}
|
||||
|
||||
open class A2(x: Int, y: () -> Unit) {}
|
||||
|
||||
class B(): A1({}<!UNSUPPORTED_FEATURE!>,<!>) {
|
||||
|
||||
}
|
||||
|
||||
@Anno2(
|
||||
[
|
||||
0.4,
|
||||
.1<!UNSUPPORTED_FEATURE!>,<!>
|
||||
]
|
||||
)
|
||||
typealias A3 = B
|
||||
|
||||
fun main1() {
|
||||
foo1(1, 2, 3<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
foo1({}<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
foo3(10<!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
foo3(10<!UNSUPPORTED_FEATURE!>,<!>/**/) {}
|
||||
|
||||
val x1 = A1(1, 2, 3<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
val y1 = A1({}<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
val z1 = A2(10<!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
|
||||
foo2({ x, y -> kotlin.Unit }<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
foo2({ x, y -> kotlin.Unit }<!UNSUPPORTED_FEATURE!>,<!>/**/)
|
||||
|
||||
val foo = listOf(
|
||||
println(1),
|
||||
"foo bar something"<!UNSUPPORTED_FEATURE!>,<!>
|
||||
)
|
||||
|
||||
val x2 = x1[
|
||||
1,
|
||||
2<!UNSUPPORTED_FEATURE!>,<!>
|
||||
]
|
||||
|
||||
val x3 = x1[{},{}<!UNSUPPORTED_FEATURE!>,<!>]
|
||||
val x31 = x1[{},{}<!UNSUPPORTED_FEATURE!>,<!>/**/]
|
||||
|
||||
val x4: @Anno1([
|
||||
1, 2<!UNSUPPORTED_FEATURE!>,<!>
|
||||
]) Float = 0f
|
||||
|
||||
foo1(object {}<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
foo1(object {}<!UNSUPPORTED_FEATURE!>,<!>/**/)
|
||||
foo1(fun () {}<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
foo1(if (true) 1 else 2<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
|
||||
<!UNREACHABLE_CODE!>foo1(<!>return<!UNSUPPORTED_FEATURE!>,<!><!UNREACHABLE_CODE!>)<!>
|
||||
}
|
||||
|
||||
fun main2(x: A1) {
|
||||
<!UNREACHABLE_CODE!>val x1 =<!> x[object {}, return<!UNSUPPORTED_FEATURE!>,<!> ]
|
||||
<!UNREACHABLE_CODE!>val x2 = x[fun () {}, throw Exception()<!UNSUPPORTED_FEATURE!>,<!> ]<!>
|
||||
<!UNREACHABLE_CODE!>val x3 = x[fun () {}, throw Exception()<!UNSUPPORTED_FEATURE!>,<!>/**/ ]<!>
|
||||
}
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
package
|
||||
|
||||
public fun foo1(/*0*/ vararg x: kotlin.Any /*kotlin.Array<out kotlin.Any>*/): kotlin.Unit
|
||||
public fun foo2(/*0*/ x: (kotlin.Any, kotlin.Any) -> kotlin.Unit): kotlin.Unit
|
||||
public fun foo3(/*0*/ x: kotlin.Any, /*1*/ y: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun main1(): kotlin.Unit
|
||||
public fun main2(/*0*/ x: A1): kotlin.Unit
|
||||
|
||||
public open class A1 {
|
||||
public constructor A1(/*0*/ vararg x: kotlin.Any /*kotlin.Array<out kotlin.Any>*/)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun get(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class A2 {
|
||||
public constructor A2(/*0*/ x: kotlin.Int, /*1*/ y: () -> kotlin.Unit)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Anno1 : kotlin.Annotation {
|
||||
public constructor Anno1(/*0*/ x: kotlin.IntArray)
|
||||
public final val x: kotlin.IntArray
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPEALIAS}) public final annotation class Anno2 : kotlin.Annotation {
|
||||
public constructor Anno2(/*0*/ x: kotlin.DoubleArray)
|
||||
public final val x: kotlin.DoubleArray
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B : A1 {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*1*/ /*fake_override*/ fun get(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@Anno2(x = {0.4.toDouble(), 0.1.toDouble()}) public typealias A3 = B
|
||||
Vendored
+69
@@ -0,0 +1,69 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -UNUSED_ANONYMOUS_PARAMETER
|
||||
// !LANGUAGE: +TrailingCommas
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Anno1(val x: IntArray)
|
||||
|
||||
@Target(AnnotationTarget.TYPEALIAS)
|
||||
annotation class Anno2(val x: DoubleArray)
|
||||
|
||||
fun foo1(vararg x: Any) {}
|
||||
fun foo2(x: (Any, Any) -> Unit) {}
|
||||
fun foo3(x: Any, y: () -> Unit) {}
|
||||
|
||||
open class A1(vararg x: Any) {
|
||||
operator fun get(x: Any, y: Any) = 10
|
||||
}
|
||||
|
||||
open class A2(x: Any, y: () -> Unit)
|
||||
|
||||
class B(): A1({},) {
|
||||
|
||||
}
|
||||
|
||||
@Anno2(
|
||||
[
|
||||
0.4,
|
||||
.1,
|
||||
]
|
||||
)
|
||||
typealias A3 = B
|
||||
|
||||
fun main1() {
|
||||
foo1(1, 2, 3,/**/)
|
||||
foo1({},)
|
||||
foo3(10,/**/) {}
|
||||
|
||||
val x1 = A1(1, 2, 3,)
|
||||
val y1 = A1({},)
|
||||
val z1 = A2(10,) {}
|
||||
|
||||
foo2({ x, y -> kotlin.Unit },/**/)
|
||||
|
||||
val foo = listOf(
|
||||
println(1),
|
||||
"foo bar something",
|
||||
)
|
||||
|
||||
val x2 = x1[
|
||||
1,
|
||||
2,
|
||||
]
|
||||
|
||||
val x3 = x1[{},{},/**/]
|
||||
|
||||
val x4: @Anno1([
|
||||
1, 2,/**/
|
||||
]) Float = 0f
|
||||
|
||||
foo1(object {},)
|
||||
foo1(fun () {},)
|
||||
foo1(if (true) 1 else 2,/**/)
|
||||
|
||||
<!UNREACHABLE_CODE!>foo1(<!>return,<!UNREACHABLE_CODE!>)<!>
|
||||
}
|
||||
|
||||
fun main2(x: A1) {
|
||||
<!UNREACHABLE_CODE!>val x1 =<!> x[object {}, return, ]
|
||||
<!UNREACHABLE_CODE!>val x2 = x[fun () {}, throw Exception(), /**/]<!>
|
||||
}
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
package
|
||||
|
||||
public fun foo1(/*0*/ vararg x: kotlin.Any /*kotlin.Array<out kotlin.Any>*/): kotlin.Unit
|
||||
public fun foo2(/*0*/ x: (kotlin.Any, kotlin.Any) -> kotlin.Unit): kotlin.Unit
|
||||
public fun foo3(/*0*/ x: kotlin.Any, /*1*/ y: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun main1(): kotlin.Unit
|
||||
public fun main2(/*0*/ x: A1): kotlin.Unit
|
||||
|
||||
public open class A1 {
|
||||
public constructor A1(/*0*/ vararg x: kotlin.Any /*kotlin.Array<out kotlin.Any>*/)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final operator fun get(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class A2 {
|
||||
public constructor A2(/*0*/ x: kotlin.Any, /*1*/ y: () -> kotlin.Unit)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Anno1 : kotlin.Annotation {
|
||||
public constructor Anno1(/*0*/ x: kotlin.IntArray)
|
||||
public final val x: kotlin.IntArray
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPEALIAS}) public final annotation class Anno2 : kotlin.Annotation {
|
||||
public constructor Anno2(/*0*/ x: kotlin.DoubleArray)
|
||||
public final val x: kotlin.DoubleArray
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class B : A1 {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final override /*1*/ /*fake_override*/ fun get(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@Anno2(x = {0.4.toDouble(), 0.1.toDouble()}) public typealias A3 = B
|
||||
Vendored
+120
@@ -0,0 +1,120 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
open class Foo1(x: Int = 10, y: Float = 0f<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
|
||||
class Foo2(
|
||||
val x: Int = 10,
|
||||
var y: Float<!UNSUPPORTED_FEATURE!>,<!>
|
||||
): Foo1(x, y<!UNSUPPORTED_FEATURE!>,<!>) {
|
||||
constructor(
|
||||
x: Float,
|
||||
y: Int = 10<!UNSUPPORTED_FEATURE!>,<!>
|
||||
): this(1, 1f<!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
|
||||
var x1: Int
|
||||
get() = 10
|
||||
set(value<!UNSUPPORTED_FEATURE!>,<!>) {
|
||||
|
||||
}
|
||||
|
||||
var x2: Int
|
||||
get() = 10
|
||||
set(
|
||||
x2<!UNSUPPORTED_FEATURE!>,<!>
|
||||
) {}
|
||||
|
||||
var x3: (Int) -> Unit
|
||||
get() = {}
|
||||
set(x2: (Int) -> Unit<!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
|
||||
var x4: (Int) -> Unit
|
||||
get() = {}
|
||||
set(x2: (Int) -> Unit<!UNSUPPORTED_FEATURE!>,<!>/**/) {}
|
||||
}
|
||||
|
||||
enum class Foo3(x: Int<!UNSUPPORTED_FEATURE!>,<!> )
|
||||
|
||||
fun foo4(x: Int, y: Comparable<Float><!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
|
||||
fun foo5(x: Int = 10<!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
|
||||
fun foo6(vararg x: Int<!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
|
||||
fun foo7(y: Float, vararg x: Int<!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
|
||||
val foo8: (Int, Int<!UNSUPPORTED_FEATURE!>,<!>) -> Int = fun(
|
||||
x,
|
||||
y<!UNSUPPORTED_FEATURE!>,<!>
|
||||
): Int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
val foo9: (Int, Int, Int<!UNSUPPORTED_FEATURE!>,<!>) -> Int =
|
||||
fun (x, y: Int, z<!UNSUPPORTED_FEATURE!>,<!>): Int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
open class Foo10(x: Int = 10, y: Float = 0f)
|
||||
|
||||
class Foo11: Foo10 {
|
||||
constructor(
|
||||
x: Float
|
||||
): super(1, 1f<!UNSUPPORTED_FEATURE!>,<!>)
|
||||
}
|
||||
|
||||
class Foo12: Foo10 {
|
||||
constructor(
|
||||
x: Float
|
||||
): super(1, 1f<!UNSUPPORTED_FEATURE!>,<!>/**/)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x1 = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>><!UNSUPPORTED_FEATURE!>,<!>
|
||||
->
|
||||
println("1")
|
||||
}
|
||||
val x2 = { x: Comparable<Comparable<Number>><!UNSUPPORTED_FEATURE!>,<!>
|
||||
-> println("1")
|
||||
}
|
||||
val x3: ((Int<!UNSUPPORTED_FEATURE!>,<!>) -> Int) -> Unit = { x: (Int<!UNSUPPORTED_FEATURE!>,<!>) -> Int<!UNSUPPORTED_FEATURE!>,<!> -> println("1") }
|
||||
val x4: ((Int<!UNSUPPORTED_FEATURE!>,<!>) -> Int) -> Unit = { x<!UNSUPPORTED_FEATURE!>,<!> -> println("1") }
|
||||
|
||||
fun foo10(x:Int,y:Int<!UNSUPPORTED_FEATURE!>,<!>) {
|
||||
fun foo10(x:Int,y:Int<!UNSUPPORTED_FEATURE!>,<!>) {}
|
||||
}
|
||||
fun foo101(x:Int,y:Int<!UNSUPPORTED_FEATURE!>,<!>/**/) {
|
||||
fun foo10(x:Int,y:Int<!UNSUPPORTED_FEATURE!>,<!>/**/) {}
|
||||
}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception<!UNSUPPORTED_FEATURE!>,<!>) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception<!UNSUPPORTED_FEATURE!>,<!>) {
|
||||
|
||||
} catch (e: Exception<!UNSUPPORTED_FEATURE!>,<!>) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception<!UNSUPPORTED_FEATURE!>,<!>) {
|
||||
|
||||
} finally {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception<!UNSUPPORTED_FEATURE!>,<!>/**/) {
|
||||
|
||||
} finally {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+68
@@ -0,0 +1,68 @@
|
||||
package
|
||||
|
||||
public val foo8: (kotlin.Int, kotlin.Int) -> kotlin.Int
|
||||
public val foo9: (kotlin.Int, kotlin.Int, kotlin.Int) -> kotlin.Int
|
||||
public fun foo4(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Comparable<kotlin.Float>): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Int = ...): kotlin.Unit
|
||||
public fun foo6(/*0*/ vararg x: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
|
||||
public fun foo7(/*0*/ y: kotlin.Float, /*1*/ vararg x: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public open class Foo1 {
|
||||
public constructor Foo1(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Float = ...)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class Foo10 {
|
||||
public constructor Foo10(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Float = ...)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo11 : Foo10 {
|
||||
public constructor Foo11(/*0*/ x: kotlin.Float)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo12 : Foo10 {
|
||||
public constructor Foo12(/*0*/ x: kotlin.Float)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo2 : Foo1 {
|
||||
public constructor Foo2(/*0*/ x: kotlin.Float, /*1*/ y: kotlin.Int = ...)
|
||||
public constructor Foo2(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Float)
|
||||
public final val x: kotlin.Int
|
||||
public final var x1: kotlin.Int
|
||||
public final var x2: kotlin.Int
|
||||
public final var x3: (kotlin.Int) -> kotlin.Unit
|
||||
public final var x4: (kotlin.Int) -> kotlin.Unit
|
||||
public final var y: kotlin.Float
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final enum class Foo3 : kotlin.Enum<Foo3> {
|
||||
private constructor Foo3(/*0*/ x: kotlin.Int)
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: Foo3): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<Foo3!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): Foo3
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<Foo3>
|
||||
}
|
||||
Vendored
+104
@@ -0,0 +1,104 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_ANONYMOUS_PARAMETER, -UNUSED_VARIABLE
|
||||
// !LANGUAGE: +TrailingCommas
|
||||
|
||||
open class Foo1(x: Int = 10, y: Float = 0f,)
|
||||
|
||||
class Foo2(
|
||||
val x: Int = 10,
|
||||
var y: Float,
|
||||
): Foo1(x, y) {
|
||||
constructor(
|
||||
x: Float,
|
||||
y: Int = 10,
|
||||
): this(1, 1f,) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
enum class Foo3(x: Int, )
|
||||
|
||||
fun foo4(x: Int, y: Comparable<Float>,) {}
|
||||
|
||||
fun foo5(x: Int = 10,) {}
|
||||
|
||||
fun foo6(vararg x: Int,) {}
|
||||
|
||||
fun foo61(vararg x: Int,/**/) {}
|
||||
|
||||
fun foo7(y: Float, vararg x: Int,) {}
|
||||
|
||||
val foo8: (Int, Int,) -> Int = fun(
|
||||
x,
|
||||
y,
|
||||
): Int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
val foo9: (Int, Int, Int,) -> Int =
|
||||
fun (x, y: Int, z,): Int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
open class Foo10(x: Int = 10, y: Float = 0f)
|
||||
|
||||
class Foo11: Foo10 {
|
||||
constructor(
|
||||
x: Float
|
||||
): super(1, 1f,)
|
||||
}
|
||||
|
||||
class Foo12: Foo10 {
|
||||
constructor(
|
||||
x: Float
|
||||
): super(1, 1f,/**/)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x1 = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>,
|
||||
->
|
||||
println("1")
|
||||
}
|
||||
val x11 = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>,/**/
|
||||
->
|
||||
println("1")
|
||||
}
|
||||
val x2 = { x: Comparable<Comparable<Number>>,
|
||||
-> println("1")
|
||||
}
|
||||
val x3: ((Int,) -> Int) -> Unit = { x: (Int,) -> Int, -> println("1") }
|
||||
val x4: ((Int,) -> Int) -> Unit = { x, -> println("1") }
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception,) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception,) {
|
||||
|
||||
} catch (e: Exception,) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception,) {
|
||||
|
||||
} finally {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception,/**/) {
|
||||
|
||||
} finally {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
package
|
||||
|
||||
public val foo8: (kotlin.Int, kotlin.Int) -> kotlin.Int
|
||||
public val foo9: (kotlin.Int, kotlin.Int, kotlin.Int) -> kotlin.Int
|
||||
public fun foo4(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Comparable<kotlin.Float>): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Int = ...): kotlin.Unit
|
||||
public fun foo6(/*0*/ vararg x: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
|
||||
public fun foo61(/*0*/ vararg x: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
|
||||
public fun foo7(/*0*/ y: kotlin.Float, /*1*/ vararg x: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public open class Foo1 {
|
||||
public constructor Foo1(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Float = ...)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class Foo10 {
|
||||
public constructor Foo10(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Float = ...)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo11 : Foo10 {
|
||||
public constructor Foo11(/*0*/ x: kotlin.Float)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo12 : Foo10 {
|
||||
public constructor Foo12(/*0*/ x: kotlin.Float)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Foo2 : Foo1 {
|
||||
public constructor Foo2(/*0*/ x: kotlin.Float, /*1*/ y: kotlin.Int = ...)
|
||||
public constructor Foo2(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Float)
|
||||
public final val x: kotlin.Int
|
||||
public final var y: kotlin.Float
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final enum class Foo3 : kotlin.Enum<Foo3> {
|
||||
private constructor Foo3(/*0*/ x: kotlin.Int)
|
||||
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: Foo3): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<Foo3!>!
|
||||
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): Foo3
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<Foo3>
|
||||
}
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_EXPRESSION -NAME_SHADOWING
|
||||
|
||||
fun foo1(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class<!UNSUPPORTED_FEATURE!>,<!>
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo2(x: Any) {
|
||||
val z = when (val y: Int = x as Int) {
|
||||
1<!UNSUPPORTED_FEATURE!>,<!> -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo3(x: (Any) -> Any) {
|
||||
val z = when (val y: (Any) -> Any = x) {
|
||||
{x: Any<!UNSUPPORTED_FEATURE!>,<!> -> x}, {y: Any<!UNSUPPORTED_FEATURE!>,<!> -> y}<!UNSUPPORTED_FEATURE!>,<!> -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo4(x: Any) {
|
||||
val z = when (x) {
|
||||
is Int, is Double<!UNSUPPORTED_FEATURE!>,<!> -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo5(x: Int, y: IntArray, z: IntArray) {
|
||||
val u = when (x) {
|
||||
in y,
|
||||
in z<!UNSUPPORTED_FEATURE!>,<!>
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo6(x: Boolean?) = when (x) {
|
||||
true, false<!UNSUPPORTED_FEATURE!>,<!> -> println(1)
|
||||
null<!UNSUPPORTED_FEATURE!>,<!> -> println(1)
|
||||
}
|
||||
|
||||
fun foo7(x: Boolean?) = when (x) {
|
||||
true, false<!UNSUPPORTED_FEATURE!>,<!>/**/ -> println(1)
|
||||
null<!UNSUPPORTED_FEATURE!>,<!>/**/ -> println(1)
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
package
|
||||
|
||||
public fun foo1(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public fun foo2(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public fun foo3(/*0*/ x: (kotlin.Any) -> kotlin.Any): kotlin.Unit
|
||||
public fun foo4(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.IntArray, /*2*/ z: kotlin.IntArray): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Boolean?): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.Boolean?): kotlin.Unit
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -NAME_SHADOWING
|
||||
// !LANGUAGE: +TrailingCommas
|
||||
|
||||
fun foo1(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class,
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo2(x: Any) {
|
||||
val z = when (val y: Int = x as Int) {
|
||||
1, -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo3(x: (Any) -> Any) {
|
||||
val z = when (val y: (Any) -> Any = x) {
|
||||
{x: Any, -> x}, {y: Any, -> y}, -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo4(x: Any) {
|
||||
val z = when (x) {
|
||||
is Int, is Double, -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo5(x: Int, y: IntArray, z: IntArray) {
|
||||
val u = when (x) {
|
||||
in y,
|
||||
in z,
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
}
|
||||
|
||||
fun foo6(x: Boolean?) = when (x) {
|
||||
true, false, -> println(1)
|
||||
null, -> println(1)
|
||||
}
|
||||
|
||||
fun foo7(x: Boolean?) = when (x) {
|
||||
true, false,/**/ -> println(1)
|
||||
null,/**/ -> println(1)
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
package
|
||||
|
||||
public fun foo1(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public fun foo2(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public fun foo3(/*0*/ x: (kotlin.Any) -> kotlin.Any): kotlin.Unit
|
||||
public fun foo4(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public fun foo5(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.IntArray, /*2*/ z: kotlin.IntArray): kotlin.Unit
|
||||
public fun foo6(/*0*/ x: kotlin.Boolean?): kotlin.Unit
|
||||
public fun foo7(/*0*/ x: kotlin.Boolean?): kotlin.Unit
|
||||
@@ -25,8 +25,6 @@ KtFile: CollectionLiterals_ERR.kt
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting an element
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n ')
|
||||
|
||||
+1
-5
@@ -533,8 +533,6 @@ KtFile: ForWithMultiDecl.kt
|
||||
DESTRUCTURING_DECLARATION_ENTRY
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -593,8 +591,6 @@ KtFile: ForWithMultiDecl.kt
|
||||
PsiErrorElement:Type expected
|
||||
<empty list>
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -687,4 +683,4 @@ KtFile: ForWithMultiDecl.kt
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
+3
-11
@@ -80,8 +80,6 @@ KtFile: FunctionLiterals_ERR.kt
|
||||
DESTRUCTURING_DECLARATION_ENTRY
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -245,10 +243,7 @@ KtFile: FunctionLiterals_ERR.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER
|
||||
PsiErrorElement:Expecting parameter name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
@@ -306,10 +301,7 @@ KtFile: FunctionLiterals_ERR.kt
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER
|
||||
PsiErrorElement:Expecting parameter name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
@@ -827,4 +819,4 @@ KtFile: FunctionLiterals_ERR.kt
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
+2
@@ -20,3 +20,5 @@ typealias f = T<A, B>.T<x>.() -> Unit
|
||||
typealias f = @[a] T.() -> Unit
|
||||
typealias f = @[a] T.T.() -> Unit
|
||||
typealias f = @[a] T<A, B>.T<x>.() -> Unit
|
||||
|
||||
typealias f = (a, ) -> b
|
||||
|
||||
+28
-1
@@ -680,4 +680,31 @@ KtFile: FunctionTypes.kt
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiElement(IDENTIFIER)('Unit')
|
||||
PsiWhiteSpace('\n\n')
|
||||
TYPEALIAS
|
||||
PsiElement(typealias)('typealias')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
-1
@@ -1 +0,0 @@
|
||||
typealias f = (a, ) -> b
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
KtFile: FunctionTypes_ERR.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
IMPORT_LIST
|
||||
<empty list>
|
||||
TYPEALIAS
|
||||
PsiElement(typealias)('typealias')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a parameter declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
+1
-5
@@ -298,8 +298,6 @@ KtFile: MultiVariableDeclarations.kt
|
||||
DESTRUCTURING_DECLARATION_ENTRY
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -350,8 +348,6 @@ KtFile: MultiVariableDeclarations.kt
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('Int')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a name
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
@@ -616,4 +612,4 @@ KtFile: MultiVariableDeclarations.kt
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
-2
@@ -139,8 +139,6 @@ KtFile: TypeAlias_ERR.kt
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Type parameter declaration expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
@@ -95,11 +95,9 @@ KtFile: MapEntry.kt
|
||||
PsiErrorElement:Unexpected token
|
||||
PsiElement(EXCL)('!')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiErrorElement:Expecting a parameter declaration
|
||||
<empty list>
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiElement(RBRACE)('}')
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
class A(
|
||||
val x: String,
|
||||
val y: String,
|
||||
) {
|
||||
constructor(
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>> ,
|
||||
) {}
|
||||
|
||||
var x: Int
|
||||
get() = 10
|
||||
set(value,) {
|
||||
|
||||
}
|
||||
|
||||
var x: Int
|
||||
get() = 10
|
||||
set(value,/*...*/) {
|
||||
|
||||
}
|
||||
|
||||
var x: Int
|
||||
get() = 10
|
||||
set(value/*...*/,) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(
|
||||
x: Int,
|
||||
y: Number
|
||||
,
|
||||
) {}
|
||||
|
||||
val foo: (Int, Int) -> Int = fun(x,
|
||||
y, ): Int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
val foo: (Int, Int, Int) -> Int =
|
||||
fun (x,
|
||||
y: Int, z,
|
||||
): Int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
fun foo() = listOf(
|
||||
foo.bar.something(),
|
||||
"foo bar something"
|
||||
,
|
||||
)
|
||||
|
||||
fun foo() {
|
||||
val x = x[
|
||||
1,
|
||||
3
|
||||
, ]
|
||||
val y = x[
|
||||
1,
|
||||
3
|
||||
,
|
||||
]
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>
|
||||
,->
|
||||
println("1")
|
||||
}
|
||||
val y = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>,
|
||||
-> println("1")
|
||||
}
|
||||
val z = {
|
||||
x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>
|
||||
,
|
||||
->
|
||||
println("1")
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class,
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class,->
|
||||
println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class
|
||||
,
|
||||
->
|
||||
println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
@Anno([1, 2, 3, 4
|
||||
,]
|
||||
)
|
||||
fun foo() {}
|
||||
|
||||
fun main() {
|
||||
val (
|
||||
y,
|
||||
z,
|
||||
) = Pair(1, 2)
|
||||
val (
|
||||
y,
|
||||
z
|
||||
, ) = Pair(1, 2)
|
||||
}
|
||||
|
||||
class A<
|
||||
T1: Number,
|
||||
T2: Iterable<Iterable<Iterable<Number>>>,
|
||||
T3: Comparable<Comparable<Comparable<Number>>>,
|
||||
> { }
|
||||
|
||||
fun <
|
||||
T1: Comparable<Comparable<Number>>,
|
||||
T2: Iterable<Iterable<Number>>
|
||||
,
|
||||
> foo() {}
|
||||
|
||||
fun main() {
|
||||
foo<Comparable<Comparable<Number>>, Iterable<Iterable<Number>>,>()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x: (
|
||||
y: Comparable<Comparable<Number>>,
|
||||
z: Iterable<Iterable<Number>>,
|
||||
) -> Int = { 10 }
|
||||
|
||||
val y = foo(1,) {}
|
||||
|
||||
try {
|
||||
println(1)
|
||||
} catch (e: Exception,) {
|
||||
|
||||
}
|
||||
}
|
||||
+1537
File diff suppressed because it is too large
Load Diff
+109
@@ -0,0 +1,109 @@
|
||||
class A: A1, A2, { }
|
||||
|
||||
class A<T1, T2> where
|
||||
T1: Comparable<Comparable<Number>>,
|
||||
T2: Iterable<Iterable<Number>>, { }
|
||||
|
||||
class A(
|
||||
val x: String,
|
||||
val y: String,,
|
||||
) {
|
||||
constructor(,) {}
|
||||
}
|
||||
|
||||
fun foo(
|
||||
x: Int,
|
||||
y: Number
|
||||
,
|
||||
,
|
||||
) {}
|
||||
|
||||
fun foo() = listOf(
|
||||
foo.bar.something(),
|
||||
"foo bar something",
|
||||
,
|
||||
)
|
||||
|
||||
fun foo() = listOf(
|
||||
foo.bar.something(),
|
||||
,"foo bar something")
|
||||
|
||||
fun foo() = listOf(
|
||||
foo.bar.something(),
|
||||
,"foo bar something",
|
||||
)
|
||||
|
||||
fun foo() {
|
||||
val x = x[
|
||||
1,
|
||||
3,
|
||||
,]
|
||||
val y = x[,]
|
||||
val z1 = x[,1]
|
||||
val z2 = x[,,1]
|
||||
val z3 = x[,1,]
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val x = { x: Comparable<Comparable<Number>>,
|
||||
y: Iterable<Iterable<Number>>,
|
||||
, ->
|
||||
println("1")
|
||||
}
|
||||
val y = { , ->
|
||||
println("1")
|
||||
}
|
||||
val () = Pair(1,2)
|
||||
val (,) = Pair(1,2)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
Comparable::class,
|
||||
Iterable::class,
|
||||
String::class,
|
||||
,
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
,Comparable::class,
|
||||
-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
,Comparable::class -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
, -> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
true -> println(1)
|
||||
else, -> println(3)
|
||||
}
|
||||
|
||||
fun foo(x: Any) = when (x) {
|
||||
true, ,-> println(1)
|
||||
else -> println(3)
|
||||
}
|
||||
|
||||
fun foo() = foo(,) {}
|
||||
|
||||
fun foo() = foo {},
|
||||
|
||||
fun foo() = foo(1) {},
|
||||
|
||||
fun <T, : Number> foo10() {
|
||||
fun <T1,T2,T3,:Comparable<Int>> foo10() {}
|
||||
}
|
||||
|
||||
fun foo() = when (x) {
|
||||
1,, -> null
|
||||
}
|
||||
|
||||
fun <T1,T2,,>foo() {}
|
||||
+1289
File diff suppressed because it is too large
Load Diff
+78
@@ -3392,6 +3392,84 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/trailingComma")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TrailingComma extends AbstractDiagnosticsTestWithStdLib {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTrailingComma() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/trailingComma"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("multiVariableDeclarationWithDisabledFeature.kt")
|
||||
public void testMultiVariableDeclarationWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/multiVariableDeclarationWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiVariableDeclarationWithEnabledFeature.kt")
|
||||
public void testMultiVariableDeclarationWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/multiVariableDeclarationWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noDisambiguation.kt")
|
||||
public void testNoDisambiguation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/noDisambiguation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeArgumentsWithDisabledFeature.kt")
|
||||
public void testTypeArgumentsWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/typeArgumentsWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeArgumentsWithEnabledFeature.kt")
|
||||
public void testTypeArgumentsWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/typeArgumentsWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParametersWithDisabledFeature.kt")
|
||||
public void testTypeParametersWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/typeParametersWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParametersWithEnabledFeature.kt")
|
||||
public void testTypeParametersWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/typeParametersWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgumentsWithDisabledFeature.kt")
|
||||
public void testValueArgumentsWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/valueArgumentsWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgumentsWithEnabledFeature.kt")
|
||||
public void testValueArgumentsWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/valueArgumentsWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParametersWithDisabledFeature.kt")
|
||||
public void testValueParametersWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/valueParametersWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParametersWithEnabledFeature.kt")
|
||||
public void testValueParametersWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/valueParametersWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntryWithDisabledFeature.kt")
|
||||
public void testWhenEntryWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/whenEntryWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntryWithEnabledFeature.kt")
|
||||
public void testWhenEntryWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/whenEntryWithEnabledFeature.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/tryCatch")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java
Generated
+78
@@ -3392,6 +3392,84 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/trailingComma")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TrailingComma extends AbstractDiagnosticsTestWithStdLibUsingJavac {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTrailingComma() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/trailingComma"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("multiVariableDeclarationWithDisabledFeature.kt")
|
||||
public void testMultiVariableDeclarationWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/multiVariableDeclarationWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multiVariableDeclarationWithEnabledFeature.kt")
|
||||
public void testMultiVariableDeclarationWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/multiVariableDeclarationWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noDisambiguation.kt")
|
||||
public void testNoDisambiguation() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/noDisambiguation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeArgumentsWithDisabledFeature.kt")
|
||||
public void testTypeArgumentsWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/typeArgumentsWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeArgumentsWithEnabledFeature.kt")
|
||||
public void testTypeArgumentsWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/typeArgumentsWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParametersWithDisabledFeature.kt")
|
||||
public void testTypeParametersWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/typeParametersWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParametersWithEnabledFeature.kt")
|
||||
public void testTypeParametersWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/typeParametersWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgumentsWithDisabledFeature.kt")
|
||||
public void testValueArgumentsWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/valueArgumentsWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueArgumentsWithEnabledFeature.kt")
|
||||
public void testValueArgumentsWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/valueArgumentsWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParametersWithDisabledFeature.kt")
|
||||
public void testValueParametersWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/valueParametersWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("valueParametersWithEnabledFeature.kt")
|
||||
public void testValueParametersWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/valueParametersWithEnabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntryWithDisabledFeature.kt")
|
||||
public void testWhenEntryWithDisabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/whenEntryWithDisabledFeature.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntryWithEnabledFeature.kt")
|
||||
public void testWhenEntryWithEnabledFeature() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/trailingComma/whenEntryWithEnabledFeature.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/tryCatch")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+18
@@ -26580,6 +26580,24 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/trailingComma")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TrailingComma extends AbstractBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTrailingComma() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/trailingComma"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noDisambiguation.kt")
|
||||
public void testNoDisambiguation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/trailingComma/noDisambiguation.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/traits")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+18
@@ -25397,6 +25397,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/trailingComma")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TrailingComma extends AbstractLightAnalysisModeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTrailingComma() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/trailingComma"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noDisambiguation.kt")
|
||||
public void testNoDisambiguation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/trailingComma/noDisambiguation.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/traits")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+18
@@ -25414,6 +25414,24 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/trailingComma")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TrailingComma extends AbstractIrBlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTrailingComma() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/trailingComma"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noDisambiguation.kt")
|
||||
public void testNoDisambiguation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/trailingComma/noDisambiguation.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/traits")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -380,11 +380,6 @@ public class ParsingTestGenerated extends AbstractParsingTest {
|
||||
runTest("compiler/testData/psi/FunctionTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionTypes_ERR.kt")
|
||||
public void testFunctionTypes_ERR() throws Exception {
|
||||
runTest("compiler/testData/psi/FunctionTypes_ERR.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Functions.kt")
|
||||
public void testFunctions() throws Exception {
|
||||
runTest("compiler/testData/psi/Functions.kt");
|
||||
@@ -645,6 +640,16 @@ public class ParsingTestGenerated extends AbstractParsingTest {
|
||||
runTest("compiler/testData/psi/Super.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("trailingCommaAllowed.kt")
|
||||
public void testTrailingCommaAllowed() throws Exception {
|
||||
runTest("compiler/testData/psi/trailingCommaAllowed.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("trailingCommaForbidden.kt")
|
||||
public void testTrailingCommaForbidden() throws Exception {
|
||||
runTest("compiler/testData/psi/trailingCommaForbidden.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TraitConstructor.kt")
|
||||
public void testTraitConstructor() throws Exception {
|
||||
runTest("compiler/testData/psi/TraitConstructor.kt");
|
||||
|
||||
@@ -111,6 +111,7 @@ enum class LanguageFeature(
|
||||
ProhibitTailrecOnVirtualMember(KOTLIN_1_4, kind = BUG_FIX),
|
||||
ProperComputationOrderOfTailrecDefaultParameters(KOTLIN_1_4),
|
||||
AllowNullableArrayArgsInMain(KOTLIN_1_4),
|
||||
TrailingCommas(KOTLIN_1_4),
|
||||
|
||||
ProperVisibilityForCompanionObjectInstanceField(sinceVersion = null, kind = BUG_FIX),
|
||||
// Temporarily disabled, see KT-27084/KT-22379
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
fun testParam(a : String, b : Int,
|
||||
<caret>) {
|
||||
<caret>) {
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun test() {
|
||||
testVeryLong(12,
|
||||
<caret>)
|
||||
<caret>)
|
||||
}
|
||||
|
||||
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun test() {
|
||||
testVeryLong(12,
|
||||
<caret>)
|
||||
<caret>)
|
||||
}
|
||||
|
||||
// SET_TRUE: ALIGN_MULTILINE_PARAMETERS_IN_CALLS
|
||||
@@ -1,5 +1,6 @@
|
||||
// FILE: first.before.kt
|
||||
// "Import" "false"
|
||||
// ERROR: The feature "trailing commas" is only available since language version 1.4
|
||||
// ERROR: Type mismatch: inferred type is Int but String was expected
|
||||
// ACTION: Add 'toString()' call
|
||||
// ACTION: Change parameter 'p' type of function 'foo' to 'Int'
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: The feature "trailing commas" is only available since language version 1.4
|
||||
// ERROR: No value passed for parameter 'foo'
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: The feature "trailing commas" is only available since language version 1.4
|
||||
// ERROR: No value passed for parameter 'foo'
|
||||
|
||||
class A<T>(val n: T, val foo: A<Int>)
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: The feature "trailing commas" is only available since language version 1.4
|
||||
// ERROR: No value passed for parameter 'foo'
|
||||
|
||||
class A<T>(val n: T)
|
||||
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
// "Create property 'foo' as constructor parameter" "true"
|
||||
// ERROR: The feature "trailing commas" is only available since language version 1.4
|
||||
// ERROR: No value passed for parameter 'foo'
|
||||
|
||||
class A<T>(val n: T, var foo: String)
|
||||
|
||||
@@ -782,7 +782,7 @@ class TypedHandlerTest : LightCodeInsightTestCase() {
|
||||
"""
|
||||
|class A(
|
||||
| a: Int,
|
||||
| <caret>
|
||||
|<caret>
|
||||
|)
|
||||
""",
|
||||
enableSmartEnterWithTabs()
|
||||
@@ -800,7 +800,7 @@ class TypedHandlerTest : LightCodeInsightTestCase() {
|
||||
"""
|
||||
|fun method(
|
||||
| arg1: String,
|
||||
| <caret>
|
||||
|<caret>
|
||||
|) {}
|
||||
""",
|
||||
enableSmartEnterWithTabs()
|
||||
|
||||
Generated
+18
@@ -20590,6 +20590,24 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/trailingComma")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TrailingComma extends AbstractIrJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTrailingComma() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/trailingComma"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noDisambiguation.kt")
|
||||
public void testNoDisambiguation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/trailingComma/noDisambiguation.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/traits")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+18
@@ -21700,6 +21700,24 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/trailingComma")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class TrailingComma extends AbstractJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInTrailingComma() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/trailingComma"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("noDisambiguation.kt")
|
||||
public void testNoDisambiguation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/trailingComma/noDisambiguation.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/traits")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user