diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProvider.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProvider.kt index dab4ea65596..d02227eaadb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProvider.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProvider.kt @@ -53,6 +53,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.getDispatchReceiverWithSmartCast import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.hasThisOrNoDispatchReceiver import org.jetbrains.kotlin.resolve.calls.util.FakeCallableDescriptorForObject +import org.jetbrains.kotlin.resolve.calls.util.isSingleUnderscore import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils.* import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils @@ -572,7 +573,7 @@ class ControlFlowInformationProvider private constructor( val element = instruction.variableDeclarationElement as? KtNamedDeclaration ?: return@traverse element.nameIdentifier ?: return@traverse if (!VariableUseState.isUsed(variableUseState)) { - if (KtPsiUtil.isRemovableVariableDeclaration(element)) { + if (!element.isSingleUnderscore && KtPsiUtil.isRemovableVariableDeclaration(element)) { report(Errors.UNUSED_VARIABLE.on(element, variableDescriptor), ctxt) } else if (element is KtParameter) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index 178dd2f1249..dfa954cbd48 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -46,6 +46,7 @@ import org.jetbrains.kotlin.psi.*; import org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfoFactory; +import org.jetbrains.kotlin.resolve.calls.util.UnderscoreUtilKt; import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil; import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyTypeAliasDescriptor; import org.jetbrains.kotlin.resolve.scopes.*; @@ -304,14 +305,23 @@ public class DescriptorResolver { destructuringVariables = null; } + Name parameterName; + + if (destructuringDeclaration == null) { + parameterName = UnderscoreUtilKt.isSingleUnderscore(valueParameter) + ? Name.special("") + : KtPsiUtil.safeName(valueParameter.getName()); + } + else { + parameterName = Name.special(""); + } + ValueParameterDescriptorImpl valueParameterDescriptor = ValueParameterDescriptorImpl.createWithDestructuringDeclarations( owner, null, index, valueParameterAnnotations, - destructuringVariables == null - ? KtPsiUtil.safeName(valueParameter.getName()) - : Name.special(""), + parameterName, variableType, valueParameter.hasDefaultValue(), valueParameter.hasModifier(CROSSINLINE_KEYWORD), diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LocalVariableResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LocalVariableResolver.kt index 6184c76d6b5..2e5896e80c5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LocalVariableResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LocalVariableResolver.kt @@ -23,12 +23,14 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor import org.jetbrains.kotlin.descriptors.impl.PropertyDescriptorImpl import org.jetbrains.kotlin.diagnostics.Errors.* +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.psi.KtPsiUtil import org.jetbrains.kotlin.psi.KtVariableDeclaration import org.jetbrains.kotlin.resolve.calls.context.ContextDependency import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory +import org.jetbrains.kotlin.resolve.calls.util.isSingleUnderscore import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil import org.jetbrains.kotlin.resolve.scopes.LexicalScope import org.jetbrains.kotlin.resolve.source.toSourceElement @@ -186,11 +188,16 @@ class LocalVariableResolver( type: KotlinType?, trace: BindingTrace ): LocalVariableDescriptor { - val hasDelegate = variable is KtProperty && variable.hasDelegate(); + val hasDelegate = variable is KtProperty && variable.hasDelegate() val variableDescriptor = LocalVariableDescriptor( scope.ownerDescriptor, annotationResolver.resolveAnnotationsWithArguments(scope, variable.modifierList, trace), - KtPsiUtil.safeName(variable.name), + // Note, that the same code works both for common local vars and for destructuring declarations, + // but since the first case is illegal error must be reported somewhere else + if (variable.isSingleUnderscore) + Name.special("") + else + KtPsiUtil.safeName(variable.name), type, variable.isVar, hasDelegate, @@ -199,4 +206,4 @@ class LocalVariableResolver( trace.record(BindingContext.VARIABLE, variable, variableDescriptor) return variableDescriptor } -} \ No newline at end of file +} diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.java index e658f20938e..74ce75971cb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.java @@ -206,7 +206,7 @@ public class ModifiersChecker { for (KtDestructuringDeclarationEntry multiEntry: multiDeclaration.getEntries()) { annotationChecker.check(multiEntry, trace, null); ModifierCheckerCore.INSTANCE.check(multiEntry, trace, null, languageVersionSettings); - UnderscoreChecker.INSTANCE.checkNamed(multiEntry, trace); + UnderscoreChecker.INSTANCE.checkNamed(multiEntry, trace, /* allowSingleUnderscore = */ true); } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/underscoreUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/underscoreUtil.kt new file mode 100644 index 00000000000..33e5545b996 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/underscoreUtil.kt @@ -0,0 +1,33 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.resolve.calls.util + +import com.intellij.psi.StubBasedPsiElement +import org.jetbrains.kotlin.psi.KtNamedDeclaration + +/** + * val lambda = fun(x: Int, _: String, `_`: Double) = 1 + * + * This property is true only for second value parameter in the example above + */ +val KtNamedDeclaration.isSingleUnderscore: Boolean + get() { + // We don't want to call 'getNameIdentifier' on stubs to prevent text building + // But it's fine because one-underscore names are prohibited for non-local declarations (only lambda parameters, local vars are allowed) + if (this is StubBasedPsiElement<*> && this.stub != null) return false + return nameIdentifier?.text == "_" + } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/UnderscoreChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/UnderscoreChecker.kt index cae74eedaf2..5e946b16e40 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/UnderscoreChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/UnderscoreChecker.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve.checkers import com.intellij.psi.PsiElement import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.VariableDescriptor +import org.jetbrains.kotlin.descriptors.impl.FunctionExpressionDescriptor import org.jetbrains.kotlin.diagnostics.DiagnosticSink import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.psi.* @@ -26,15 +27,17 @@ import org.jetbrains.kotlin.resolve.BindingContext object UnderscoreChecker : SimpleDeclarationChecker { - fun checkIdentifier(identifier: PsiElement?, diagnosticHolder: DiagnosticSink) { + @JvmOverloads + fun checkIdentifier(identifier: PsiElement?, diagnosticHolder: DiagnosticSink, allowSingleUnderscore: Boolean = false) { if (identifier == null || identifier.text.isEmpty()) return - if (identifier.text.all { it == '_' }) { + if (identifier.text.all { it == '_' } && (!allowSingleUnderscore || identifier.text.length != 1)) { diagnosticHolder.report(Errors.UNDERSCORE_IS_RESERVED.on(identifier)) } } - fun checkNamed(declaration: KtNamedDeclaration, diagnosticHolder: DiagnosticSink) { - checkIdentifier(declaration.nameIdentifier, diagnosticHolder) + @JvmOverloads + fun checkNamed(declaration: KtNamedDeclaration, diagnosticHolder: DiagnosticSink, allowSingleUnderscore: Boolean = false) { + checkIdentifier(declaration.nameIdentifier, diagnosticHolder, allowSingleUnderscore) } override fun check( @@ -46,7 +49,7 @@ object UnderscoreChecker : SimpleDeclarationChecker { if (declaration is KtProperty && descriptor !is VariableDescriptor) return if (declaration is KtCallableDeclaration) { for (parameter in declaration.valueParameters) { - checkNamed(parameter, diagnosticHolder) + checkNamed(parameter, diagnosticHolder, allowSingleUnderscore = descriptor is FunctionExpressionDescriptor) } } if (declaration is KtTypeParameterListOwner) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt index 843df03f361..3b2ed6cab79 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt @@ -146,7 +146,7 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre val functionDescriptor = createFunctionLiteralDescriptor(expression, context) expression.valueParameters.forEach { components.identifierChecker.checkDeclaration(it, context.trace) - UnderscoreChecker.checkNamed(it, context.trace) + UnderscoreChecker.checkNamed(it, context.trace, allowSingleUnderscore = true) } val safeReturnType = computeReturnType(expression, context, functionDescriptor, functionTypeExpected) functionDescriptor.setReturnType(safeReturnType) diff --git a/compiler/testData/diagnostics/tests/Underscore.kt b/compiler/testData/diagnostics/tests/Underscore.kt index d2e98d02a5b..8754d33fc06 100644 --- a/compiler/testData/diagnostics/tests/Underscore.kt +++ b/compiler/testData/diagnostics/tests/Underscore.kt @@ -8,13 +8,24 @@ class _<________> val ______ = _() fun __(___: Int, y: _?): Int { + val (_, z) = Pair(___ - 1, 42) val (x, __________) = Pair(___ - 1, 42) val ____ = x // in backquotes: allowed val `_` = __________ + + val q = fun(_: Int, __: Int) {} + q(1, 2) + + val _ = 56 + __@ return if (y != null) __(____, y) else __(`_`, ______) } +// one underscore parameters for named function are still prohibited +fun oneUnderscore(_: Int) {} + fun doIt(f: (Any?) -> Any?) = f(null) -val something = doIt { __ -> __ } \ No newline at end of file +val something = doIt { __ -> __ } +val something2 = doIt { _ -> 1 } diff --git a/compiler/testData/diagnostics/tests/Underscore.txt b/compiler/testData/diagnostics/tests/Underscore.txt index 7731308c25c..93899cfef8b 100644 --- a/compiler/testData/diagnostics/tests/Underscore.txt +++ b/compiler/testData/diagnostics/tests/Underscore.txt @@ -2,8 +2,10 @@ package public val ______: _ public val something: kotlin.Any? +public val something2: kotlin.Any? public fun __(/*0*/ ___: kotlin.Int, /*1*/ y: _?): kotlin.Int public fun doIt(/*0*/ f: (kotlin.Any?) -> kotlin.Any?): kotlin.Any? +public fun oneUnderscore(/*0*/ : kotlin.Int): kotlin.Unit @kotlin.Deprecated(message = "") public final data class Pair { public constructor Pair(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int) diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopMissingLoopParameter.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopMissingLoopParameter.kt index b754f602776..dc5a01b2367 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopMissingLoopParameter.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/ForLoopMissingLoopParameter.kt @@ -6,9 +6,9 @@ fun useDeclaredVariables() { } fun checkersShouldRun() { - for ((@A a, _)) { + for ((@A a, _)) { } } -annotation class A \ No newline at end of file +annotation class A diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationAssignedUnresolved.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationAssignedUnresolved.kt index e1300ee1105..bfb92ebf8c1 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationAssignedUnresolved.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationAssignedUnresolved.kt @@ -5,7 +5,7 @@ fun useDeclaredVariables() { } fun checkersShouldRun() { - val (@A a, _) = unresolved + val (@A a, _) = unresolved } -annotation class A \ No newline at end of file +annotation class A diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationMissingInitializer.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationMissingInitializer.kt index 314cd299ee8..93b2c5ec179 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationMissingInitializer.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/destructuringDeclarationMissingInitializer.kt @@ -5,7 +5,7 @@ fun useDeclaredVariables() { } fun checkersShouldRun() { - val (@A a, _) + val (@A a, _) } -annotation class A \ No newline at end of file +annotation class A diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt new file mode 100644 index 00000000000..0649ed01f58 --- /dev/null +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt @@ -0,0 +1,48 @@ + +class A { + operator fun component1() = 1 + operator fun component2() = "" +} + +class C { + operator fun iterator(): Iterator = null!! +} + +fun test() { + for ((x, _) in C()) { + foo(x, _) + } + + for ((_, y) in C()) { + foo(_, y) + } + + for ((_, _) in C()) { + foo(_, _) + } + + for ((_ : Int, _ : String) in C()) { + foo(_, _) + } + + for ((_ : String, _ : Int) in C()) { + foo(_, _) + } + + val (x, _) = A() + val (_, y) = A() + + foo(x, y) + foo(x, _) + foo(_, y) + + val (`_`, z) = A() + + foo(_, z) + + val (_, `_`) = A() + + foo(_, y) +} + +fun foo(x: Int, y: String) {} diff --git a/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.txt b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.txt new file mode 100644 index 00000000000..502dce9420f --- /dev/null +++ b/compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.txt @@ -0,0 +1,21 @@ +package + +public fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.String): kotlin.Unit +public fun test(): kotlin.Unit + +public final class A { + public constructor A() + public final operator fun component1(): kotlin.Int + public final operator fun component2(): kotlin.String + 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 C { + public constructor C() + 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 final operator fun iterator(): kotlin.collections.Iterator + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt new file mode 100644 index 00000000000..c1d8eea2b53 --- /dev/null +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt @@ -0,0 +1,62 @@ +// !CHECK_TYPE +// !DIAGNOSTICS: -UNUSED_PARAMETER +data class A(val x: Int, val y: String) +data class B(val u: Double, val w: Short) + +fun foo(block: (A) -> Unit) { } + +fun bar() { + foo { (_, b) -> + _.hashCode() + b checkType { _() } + } + + foo { (a, _) -> + a checkType { _() } + _.hashCode() + } + + foo { (_, _) -> + _.hashCode() + } + + foo { (_: Int, b: String) -> + _.hashCode() + b checkType { _() } + } + + foo { (a: Int, _: String) -> + a checkType { _() } + _.hashCode() + } + + foo { (_: Int, _: String) -> + _.hashCode() + } + + foo { (_, _): A -> + _.hashCode() + } + + foo { (`_`, _) -> + _ checkType { _() } + } + + foo { (_, `_`) -> + _ checkType { _() } + } + + foo { (`_`, `_`) -> + _ checkType { _() } + } + + foo { (_: String, b) -> + _.hashCode() + b checkType { _() } + } + + foo { (_, b): B -> + _.hashCode() + b checkType { _() } + } +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.txt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.txt new file mode 100644 index 00000000000..37e315d1578 --- /dev/null +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.txt @@ -0,0 +1,28 @@ +package + +public fun bar(): kotlin.Unit +public fun foo(/*0*/ block: (A) -> kotlin.Unit): kotlin.Unit + +public final data class A { + public constructor A(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.String) + public final val x: kotlin.Int + public final val y: kotlin.String + public final operator /*synthesized*/ fun component1(): kotlin.Int + public final operator /*synthesized*/ fun component2(): kotlin.String + public final /*synthesized*/ fun copy(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.String = ...): A + 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 +} + +public final data class B { + public constructor B(/*0*/ u: kotlin.Double, /*1*/ w: kotlin.Short) + public final val u: kotlin.Double + public final val w: kotlin.Short + public final operator /*synthesized*/ fun component1(): kotlin.Double + public final operator /*synthesized*/ fun component2(): kotlin.Short + public final /*synthesized*/ fun copy(/*0*/ u: kotlin.Double = ..., /*1*/ w: kotlin.Short = ...): B + 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 +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.kt b/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.kt new file mode 100644 index 00000000000..3cc0479a83a --- /dev/null +++ b/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.kt @@ -0,0 +1,49 @@ +// !CHECK_TYPE +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun foo(block: (Int, String) -> Unit) { } +fun foobar(block: (Double) -> Unit) { } + +fun bar() { + foo { _, b -> + _.hashCode() + b checkType { _() } + } + + foo { a, _ -> + a checkType { _() } + _.hashCode() + } + + foo { _, _ -> + _.hashCode() + } + + foo { _: Int, b: String -> + _.hashCode() + b checkType { _() } + } + + foo { a: Int, _: String -> + a checkType { _() } + _.hashCode() + } + + foo { _: Int, _: String -> + _.hashCode() + } + + foo { `_`, _ -> + _ checkType { _() } + } + + foo { _, `_` -> + _ checkType { _() } + } + + foo { `_`, `_` -> + _ checkType { _() } + } + + foo(fun(x: Int, _: String) {}) +} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.txt b/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.txt new file mode 100644 index 00000000000..8b04566d18b --- /dev/null +++ b/compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.txt @@ -0,0 +1,5 @@ +package + +public fun bar(): kotlin.Unit +public fun foo(/*0*/ block: (kotlin.Int, kotlin.String) -> kotlin.Unit): kotlin.Unit +public fun foobar(/*0*/ block: (kotlin.Double) -> kotlin.Unit): kotlin.Unit diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 43f0452ee6b..666afac2aa4 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -5308,6 +5308,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/SingleDeclForLoop.kt"); doTest(fileName); } + + @TestMetadata("underscore.kt") + public void testUnderscore() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/declarationChecks/destructuringDeclarations/underscore.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/diagnostics/tests/declarationChecks/finiteBoundRestriction") @@ -7662,6 +7668,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("underscopeParameters.kt") + public void testUnderscopeParameters() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/functionLiterals/underscopeParameters.kt"); + doTest(fileName); + } + @TestMetadata("unusedLiteral.kt") public void testUnusedLiteral() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/functionLiterals/unusedLiteral.kt"); @@ -7724,6 +7736,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("underscore.kt") + public void testUnderscore() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/underscore.kt"); + doTest(fileName); + } + @TestMetadata("unsupportedFeature.kt") public void testUnsupportedFeature() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/unsupportedFeature.kt");