diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java index 5ae026ab64e..3dd1f069583 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/JetFlowInformationProvider.java @@ -641,18 +641,22 @@ public class JetFlowInformationProvider { report(Errors.UNUSED_VARIABLE.on((JetNamedDeclaration) element, variableDescriptor), ctxt); } else if (element instanceof JetParameter) { - PsiElement psiElement = element.getParent().getParent(); - if (psiElement instanceof JetFunction) { + PsiElement owner = element.getParent().getParent(); + if (owner instanceof JetFunction) { MainFunctionDetector mainFunctionDetector = new MainFunctionDetector(trace.getBindingContext()); - boolean isMain = (psiElement instanceof JetNamedFunction) && mainFunctionDetector.isMain((JetNamedFunction) psiElement); - if (psiElement instanceof JetFunctionLiteral) return; - DeclarationDescriptor descriptor = trace.get(BindingContext.DECLARATION_TO_DESCRIPTOR, psiElement); - assert descriptor instanceof FunctionDescriptor : psiElement.getText(); + boolean isMain = (owner instanceof JetNamedFunction) && mainFunctionDetector.isMain((JetNamedFunction) owner); + if (owner instanceof JetFunctionLiteral) return; + DeclarationDescriptor descriptor = trace.get(BindingContext.DECLARATION_TO_DESCRIPTOR, owner); + assert descriptor instanceof FunctionDescriptor : owner.getText(); FunctionDescriptor functionDescriptor = (FunctionDescriptor) descriptor; if (!isMain && !functionDescriptor.getModality().isOverridable() && functionDescriptor.getOverriddenDescriptors().isEmpty()) { report(Errors.UNUSED_PARAMETER.on((JetParameter) element, variableDescriptor), ctxt); } + } else if (owner instanceof JetClass) { + if (!((JetParameter) element).hasValOrVarNode() && !((JetClass) owner).isAnnotation()) { + report(Errors.UNUSED_PARAMETER.on((JetParameter) element, variableDescriptor), ctxt); + } } } } diff --git a/compiler/testData/diagnostics/tests/Abstract.kt b/compiler/testData/diagnostics/tests/Abstract.kt index 57d1c773dec..e6fe05bc245 100644 --- a/compiler/testData/diagnostics/tests/Abstract.kt +++ b/compiler/testData/diagnostics/tests/Abstract.kt @@ -52,7 +52,7 @@ abstract class B1( class B2() : B1(1, "r") {} -abstract class B3(i: Int) { +abstract class B3(i: Int) { } fun foo(c: B3) { diff --git a/compiler/testData/diagnostics/tests/Constructors.kt b/compiler/testData/diagnostics/tests/Constructors.kt index a3691edae82..fbcfcdaa2c6 100644 --- a/compiler/testData/diagnostics/tests/Constructors.kt +++ b/compiler/testData/diagnostics/tests/Constructors.kt @@ -10,7 +10,7 @@ class WithC2() : WithC1 class WithPC0() { } -class WithPC1(a : Int) { +class WithPC1(a : Int) { } @@ -18,7 +18,7 @@ class Foo() : WithPC0, x : Int) { var x : Int } diff --git a/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt b/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt index dd8ae91e637..a6be46b2654 100644 --- a/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt +++ b/compiler/testData/diagnostics/tests/DefaultValuesTypechecking.kt @@ -6,7 +6,7 @@ fun bar(x : Int = "", y : Int = x, z // KT-371 Resolve default parameters for constructors -class A(x : Int = y, y : Int = x) { // None of the references is resolved, no types checked +class A(x : Int = y, y : Int = x) { // None of the references is resolved, no types checked fun foo(bool: Boolean, a: Int = b, b: String = a) {} } diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.kt b/compiler/testData/diagnostics/tests/UnusedParameters.kt new file mode 100644 index 00000000000..8bf64c0516f --- /dev/null +++ b/compiler/testData/diagnostics/tests/UnusedParameters.kt @@ -0,0 +1,15 @@ +class C(a: Int, b: Int, c: Int, d: Int, e: Int = d, val f: String) { + { + a + a + } + + val g = b + + { + c + c + } +} + +fun f(a: Int, b: Int, c: Int = b) { + a + a +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.txt b/compiler/testData/diagnostics/tests/UnusedParameters.txt new file mode 100644 index 00000000000..95d079117ea --- /dev/null +++ b/compiler/testData/diagnostics/tests/UnusedParameters.txt @@ -0,0 +1,12 @@ +package + +internal fun f(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int, /*2*/ c: kotlin.Int = ...): kotlin.Unit + +internal final class C { + public constructor C(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int, /*2*/ c: kotlin.Int, /*3*/ d: kotlin.Int, /*4*/ e: kotlin.Int = ..., /*5*/ f: kotlin.String) + internal final val f: kotlin.String + internal final val g: kotlin.Int + 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 +} diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt index 620011f493a..3fec7de034b 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-negative.kt @@ -5,5 +5,5 @@ var bar : Int = 1 val x : (Int) -> Int = {([varargs] x : Int) -> x} -class Hello(varargs args: Any) { +class Hello(varargs args: Any) { } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt b/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt index afa0b2ca0a7..9093eae485c 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1860-positive.kt @@ -7,5 +7,5 @@ var bar : Int = 1 val x : (Int) -> Int = {([test] x : Int) -> x} -class Hello(test args: Any) { +class Hello(test args: Any) { } diff --git a/compiler/testData/diagnostics/tests/classObjects/classObjectHeader.kt b/compiler/testData/diagnostics/tests/classObjects/classObjectHeader.kt index 373561d74eb..0919a7339ac 100644 --- a/compiler/testData/diagnostics/tests/classObjects/classObjectHeader.kt +++ b/compiler/testData/diagnostics/tests/classObjects/classObjectHeader.kt @@ -1,6 +1,6 @@ package test -open class ToResolve(f : (Int) -> Int) +open class ToResolve(f : (Int) -> Int) fun testFun(a : Int) = 12 class TestSome

{ diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt index 8f5fd8a4271..ab8ca49ff50 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt @@ -192,7 +192,7 @@ fun reassignFunParams(a: Int) { a = 1 } -open class Open(a: Int, w: Int) {} +open class Open(a: Int, w: Int) {} class LocalValsVsProperties(val a: Int, w: Int) : Open(a, w) { val x : Int diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt657.kt b/compiler/testData/diagnostics/tests/controlStructures/kt657.kt index 82ba5ac1a81..64693408667 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt657.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt657.kt @@ -1,7 +1,7 @@ //KT-657 Semantic checks for when without condition package kt657 -class Pair(a: A, b: B) +class Pair(a: A, b: B) fun foo() = when { diff --git a/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt b/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt index 5836f49dd90..9b72afbba66 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/when.kt234.kt973.kt @@ -3,7 +3,7 @@ package kt234_kt973 -class Pair(a: A, b: B) +class Pair(a: A, b: B) fun test(t : Pair) : Int { when (t) { diff --git a/compiler/testData/diagnostics/tests/dataClasses/bothParamsAreNotProperties.kt b/compiler/testData/diagnostics/tests/dataClasses/bothParamsAreNotProperties.kt index 67293d1f847..1b5ffc296ab 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/bothParamsAreNotProperties.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/bothParamsAreNotProperties.kt @@ -1,4 +1,4 @@ -data class A(x: Int, y: String) +data class A(x: Int, y: String) fun foo(a: A) { a.component1() diff --git a/compiler/testData/diagnostics/tests/dataClasses/firstParamIsVal.kt b/compiler/testData/diagnostics/tests/dataClasses/firstParamIsVal.kt index 1d1e1f213ce..0d5c4c0ad3f 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/firstParamIsVal.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/firstParamIsVal.kt @@ -1,4 +1,4 @@ -data class A(val x: Int, y: String) +data class A(val x: Int, y: String) fun foo(a: A) { a.component1() : Int diff --git a/compiler/testData/diagnostics/tests/dataClasses/firstParamIsVar.kt b/compiler/testData/diagnostics/tests/dataClasses/firstParamIsVar.kt index f7c23fa80e2..b64f6384ad9 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/firstParamIsVar.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/firstParamIsVar.kt @@ -1,4 +1,4 @@ -data class A(var x: Int, y: String) +data class A(var x: Int, y: String) fun foo(a: A) { a.component1() : Int diff --git a/compiler/testData/diagnostics/tests/dataClasses/secondParamIsVal.kt b/compiler/testData/diagnostics/tests/dataClasses/secondParamIsVal.kt index a56bea06d21..cef2651808b 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/secondParamIsVal.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/secondParamIsVal.kt @@ -1,4 +1,4 @@ -data class A(x: Int, val y: String) +data class A(x: Int, val y: String) fun foo(a: A) { a.component1() : String diff --git a/compiler/testData/diagnostics/tests/dataClasses/secondParamIsVar.kt b/compiler/testData/diagnostics/tests/dataClasses/secondParamIsVar.kt index d3a951fdf8c..974d16a53f3 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/secondParamIsVar.kt +++ b/compiler/testData/diagnostics/tests/dataClasses/secondParamIsVar.kt @@ -1,4 +1,4 @@ -data class A(x: Int, var y: String) +data class A(x: Int, var y: String) fun foo(a: A) { a.component1() : String diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassBase.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassBase.kt index 738dd5fca72..566e118a22c 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassBase.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassBase.kt @@ -1,4 +1,4 @@ -open class Base(x: String, y: Int) +open class Base(x: String, y: Int) fun test(x: Any, y: Int?) { if (x !is String) return diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDefaultParameters.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDefaultParameters.kt index 81e0a5614fe..a4fdfcf6e8c 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDefaultParameters.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDefaultParameters.kt @@ -1,7 +1,7 @@ fun test(x: Any) { if (x !is String) return - class Local(s: String = x) { + class Local(s: String = x) { fun foo(s: String = x): String = s } } diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInitializer.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInitializer.kt index 74290b5a048..609dfa2ef13 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInitializer.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassInitializer.kt @@ -13,4 +13,4 @@ fun f(a: Any?) { trait B { fun foo() {} } -open class X(b: B) \ No newline at end of file +open class X(b: B) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt index fa1dfa048b4..7af5e48315b 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalObject.kt @@ -6,4 +6,4 @@ fun foo(x: Any?) { } } -open class Base(s: String) +open class Base(s: String) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt index 187ca3eb68a..70d71499100 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt @@ -1,6 +1,6 @@ val a: Int by A(1) -class A(i: T) { +class A(i: T) { fun get(t: Any?, p: PropertyMetadata): T { t.equals(p) // to avoid UNUSED_PARAMETER warning throw Exception() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt index 2f95a3a9bf7..a6701806a31 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt @@ -5,7 +5,7 @@ val b by Delegate(b) val c by d val d by c -class Delegate(i: Int) { +class Delegate(i: Int) { fun get(t: Any?, p: PropertyMetadata): Int { t.equals(p) // to avoid UNUSED_PARAMETER warning return 1 diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt b/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt index 9486d767a16..4c8e7b57060 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt @@ -4,7 +4,7 @@ class A { val Int.a by Delegate(this) } -class Delegate(i: Int) { +class Delegate(i: Int) { fun get(t: Any?, p: PropertyMetadata): Int { t.equals(p) // to avoid UNUSED_PARAMETER warning return 1 diff --git a/compiler/testData/diagnostics/tests/delegation/DelegationAndOverriding.kt b/compiler/testData/diagnostics/tests/delegation/DelegationAndOverriding.kt index 3ef6662da6f..9777d79cb0e 100644 --- a/compiler/testData/diagnostics/tests/delegation/DelegationAndOverriding.kt +++ b/compiler/testData/diagnostics/tests/delegation/DelegationAndOverriding.kt @@ -5,7 +5,7 @@ trait T { val v : Int } -open class Br(t : T) : T { +open class Br(t : T) : T { } diff --git a/compiler/testData/diagnostics/tests/extensions/kt3563.kt b/compiler/testData/diagnostics/tests/extensions/kt3563.kt index 03eb70fd746..06a5197a46c 100644 --- a/compiler/testData/diagnostics/tests/extensions/kt3563.kt +++ b/compiler/testData/diagnostics/tests/extensions/kt3563.kt @@ -4,7 +4,7 @@ package bar import java.io.File -class Customer(name: String) +class Customer(name: String) fun foo(f: File, c: Customer) { f.name diff --git a/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt b/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt index b8ad6688ae5..aa90703e00a 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/kt6320.kt @@ -3,7 +3,7 @@ class A -class B(foo: A) { +class B(foo: A) { fun test1(a: A) { B(a) val b: B = B(a) @@ -13,7 +13,7 @@ class B(foo: A) { class C -class D(foo: C) { +class D(foo: C) { fun test(a: C) { val d: D = D(a) } diff --git a/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt b/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt index 85b3a964a63..c215f6c0f09 100644 --- a/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt +++ b/compiler/testData/diagnostics/tests/inference/dependantOnVariance.kt @@ -1,6 +1,6 @@ package a -class MyList(t: T) {} +class MyList(t: T) {} fun getMyList(t: T) : MyList< T> = MyList(t) fun getMyListToWriteTo(t: T) : MyList< in T> = MyList(t) diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt index 0734871e4ec..2d823db0118 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsIfUnknownParameters.kt @@ -3,7 +3,7 @@ package Hello open class Base class StringBase : Base() -class Client>(x: X) +class Client>(x: X) fun test() { val c = Client(StringBase()) // Type inference fails here for T. diff --git a/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt b/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt index f157ae0c1c5..8e5ac880ee1 100644 --- a/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt +++ b/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt @@ -44,9 +44,9 @@ abstract class Test() { } -open class Super(i : Int) +open class Super(i : Int) -class TestPCParameters(w : Int, x : Int, val y : Int, var z : Int) : Super(w) { +class TestPCParameters(w : Int, x : Int, val y : Int, var z : Int) : Super(w) { val xx = w diff --git a/compiler/testData/diagnostics/tests/inline/constructor.kt b/compiler/testData/diagnostics/tests/inline/constructor.kt index 5a6b2b35290..4223421e64b 100644 --- a/compiler/testData/diagnostics/tests/inline/constructor.kt +++ b/compiler/testData/diagnostics/tests/inline/constructor.kt @@ -1,4 +1,4 @@ -class Z(s: (Int) -> Int) { +class Z(s: (Int) -> Int) { } diff --git a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt index 9c0beb257a6..3835fb23bbc 100644 --- a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt +++ b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt @@ -27,20 +27,20 @@ class FinalClass() { annotation class annotated(val text: String = "not given") //Check legal modifiers in constructor -class LegalModifier(val a: Int, annotated private var b: String, annotated vararg v: Int) +class LegalModifier(val a: Int, annotated private var b: String, annotated vararg v: Int) //Check illegal modifier in constructor parameters -class IllegalModifiers1(private a: Int) +class IllegalModifiers1(private a: Int) //Check multiple illegal modifiers in constructor -class IllegalModifiers2(private abstract a: Int) +class IllegalModifiers2(private abstract a: Int) //Check annotations with illegal modifiers in constructor -class IllegalModifiers3(annotated public abstract b: String) +class IllegalModifiers3(annotated public abstract b: String) //Check annotations and vararg with illegal modifiers in constructor -class IllegalModifiers4(val a: Int, annotated("a text") protected vararg v: Int) +class IllegalModifiers4(val a: Int, annotated("a text") protected vararg v: Int) //Check illegal modifiers for functions and catch block abstract class IllegalModifiers5() { diff --git a/compiler/testData/diagnostics/tests/objects/Objects.kt b/compiler/testData/diagnostics/tests/objects/Objects.kt index 4d78d578240..4bd390a6273 100644 --- a/compiler/testData/diagnostics/tests/objects/Objects.kt +++ b/compiler/testData/diagnostics/tests/objects/Objects.kt @@ -1,6 +1,6 @@ package toplevelObjectDeclarations - open class Foo(y : Int) { + open class Foo(y : Int) { open fun foo() : Int = 1 } diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.kt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.kt index 084ea2b60ca..171a9d6308d 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBounds.kt @@ -6,8 +6,8 @@ trait ResolverForModule trait ResolverForProject class ResolverForProjectImpl( - descriptorByModule: Map, - delegateResolver: ResolverForProject + descriptorByModule: Map, + delegateResolver: ResolverForProject ) : ResolverForProject fun foo(delegateResolver: ResolverForProject): ResolverForProject { diff --git a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt index 2ad7f1cb09b..400f0c159e5 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/methodCall/multipleExactBoundsNullable.kt @@ -5,8 +5,8 @@ trait ResolverForProject { } class ResolverForProjectImpl( - descriptorByModule: Map, - delegateResolver: ResolverForProject + descriptorByModule: Map, + delegateResolver: ResolverForProject ) : ResolverForProject trait WithFoo { diff --git a/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt index 7e846d55861..c2ae5a1a716 100644 --- a/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt +++ b/compiler/testData/diagnostics/tests/resolve/incompleteConstructorInvocation.kt @@ -1,6 +1,6 @@ package p -class X(provider: () -> V, trackValue: Boolean) { +class X(provider: () -> V, trackValue: Boolean) { } class B { diff --git a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt index c9cdb9b8b2c..1cfbadc003e 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt250.617.10.kt @@ -5,15 +5,15 @@ import java.util.HashMap //KT-250 Incorrect variable resolve in constructor arguments of superclass open class A(val x: Int) -class B(y: Int) : A(x) //x is resolved as a property in a, so no error is generated +class B(y: Int) : A(x) //x is resolved as a property in a, so no error is generated //KT-617 Prohibit dollars in call to superclass constructors -open class M(p: Int) +open class M(p: Int) class N(val p: Int) : A($p) //KT-10 Don't allow to use properties in supertype initializers open class Element() -class TextElement(name: String) : Element() +class TextElement(name: String) : Element() abstract class Tag(val name : String) { val children = ArrayList() @@ -36,7 +36,7 @@ class Body1() : BodyTag(this.p: Int, r: Int) { val s = "s" } diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt index e658888a30b..c74a86ca4af 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt @@ -1,6 +1,6 @@ //KT-2746 Do.smartcasts in inference -class C(t :T) +class C(t :T) fun test1(a: Any) { if (a is String) { diff --git a/compiler/testData/diagnostics/tests/substitutions/kt4887.kt b/compiler/testData/diagnostics/tests/substitutions/kt4887.kt index 4638beaf167..79888182a0f 100644 --- a/compiler/testData/diagnostics/tests/substitutions/kt4887.kt +++ b/compiler/testData/diagnostics/tests/substitutions/kt4887.kt @@ -1,6 +1,6 @@ package h -public class MyClass(param: MyClass) { +public class MyClass(param: MyClass) { fun test() { val result: MyClass? = null MyClass(result as MyClass) diff --git a/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt b/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt index 681769e5c52..3d080e591f7 100644 --- a/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt +++ b/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt @@ -1,6 +1,6 @@ fun foo(vararg ts: T): T? = null -class Pair(a: A) +class Pair(a: A) fun test() { val v = foo(Pair(1)) diff --git a/compiler/testData/diagnostics/tests/variance/PrimaryConstructor.kt b/compiler/testData/diagnostics/tests/variance/PrimaryConstructor.kt index 9b5b945121b..32192a50558 100644 --- a/compiler/testData/diagnostics/tests/variance/PrimaryConstructor.kt +++ b/compiler/testData/diagnostics/tests/variance/PrimaryConstructor.kt @@ -17,9 +17,9 @@ class Test( var type9: In<)!>I>, var type0: In<)!>O>, - type11: I, - type12: O, - type13: P, - type14: In, - type15: In + type11: I, + type12: O, + type13: P, + type14: In, + type15: In ) \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 2c0c3384fdf..ee0a137c7e9 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -526,6 +526,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("UnusedParameters.kt") + public void testUnusedParameters() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/UnusedParameters.kt"); + doTest(fileName); + } + @TestMetadata("UnusedVariables.kt") public void testUnusedVariables() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/UnusedVariables.kt"); diff --git a/idea/testData/checker/Abstract.kt b/idea/testData/checker/Abstract.kt index 637ac6fa125..7112dd9a1b2 100644 --- a/idea/testData/checker/Abstract.kt +++ b/idea/testData/checker/Abstract.kt @@ -164,7 +164,7 @@ abstract class B1( class B2() : B1(1, "r") {} -abstract class B3(i: Int) { +abstract class B3(i: Int) { } fun foo(a: B3) { diff --git a/idea/testData/checker/Constructors.kt b/idea/testData/checker/Constructors.kt index 016a4c74ffe..a242960bc7a 100644 --- a/idea/testData/checker/Constructors.kt +++ b/idea/testData/checker/Constructors.kt @@ -14,7 +14,7 @@ class NoPC { class WithPC0() { } -class WithPC1(a : Int) { +class WithPC1(a : Int) { } @@ -22,7 +22,7 @@ class Foo() : WithPC0(), this() { } -class WithCPI_Dup(x : Int) { +class WithCPI_Dup(x : Int) { var x : Int } diff --git a/idea/testData/checker/Objects.kt b/idea/testData/checker/Objects.kt index 6ebfe2be0e6..0a00cd792bb 100644 --- a/idea/testData/checker/Objects.kt +++ b/idea/testData/checker/Objects.kt @@ -1,5 +1,5 @@ package toplevelObjectDeclarations - open class Foo(y : Int) { + open class Foo(y : Int) { open fun foo() : Int = 1 } diff --git a/idea/testData/checker/Unresolved.kt b/idea/testData/checker/Unresolved.kt index 855add548c3..7d384ad75e1 100644 --- a/idea/testData/checker/Unresolved.kt +++ b/idea/testData/checker/Unresolved.kt @@ -1,6 +1,6 @@ package unresolved -class Pair(a: A, b: B) +class Pair(a: A, b: B) fun testGenericArgumentsCount() { val p1: Pair = Pair(2, 2) diff --git a/idea/testData/checker/infos/PropertiesWithBackingFields.kt b/idea/testData/checker/infos/PropertiesWithBackingFields.kt index c37abc5ef15..8c7b8357237 100644 --- a/idea/testData/checker/infos/PropertiesWithBackingFields.kt +++ b/idea/testData/checker/infos/PropertiesWithBackingFields.kt @@ -40,9 +40,9 @@ } -open class Super(i : Int) +open class Super(i : Int) -class TestPCParameters(w : Int, x : Int, val y : Int, var z : Int) : Super(w) { +class TestPCParameters(w : Int, x : Int, val y : Int, var z : Int) : Super(w) { val xx = w diff --git a/idea/testData/highlighter/deprecated/Class.kt b/idea/testData/highlighter/deprecated/Class.kt index 0e5dbfce6dd..dbdd41a3d2a 100644 --- a/idea/testData/highlighter/deprecated/Class.kt +++ b/idea/testData/highlighter/deprecated/Class.kt @@ -14,7 +14,7 @@ fun test() { class Test(): MyClass() {} -class Test2(param: MyClass) {} +class Test2(param: MyClass) {} // NO_CHECK_INFOS // NO_CHECK_WEAK_WARNINGS diff --git a/idea/testData/highlighter/deprecated/Trait.kt b/idea/testData/highlighter/deprecated/Trait.kt index da60f47869e..3cbacff9623 100644 --- a/idea/testData/highlighter/deprecated/Trait.kt +++ b/idea/testData/highlighter/deprecated/Trait.kt @@ -8,7 +8,7 @@ fun test() { class Test(): MyTrait { } -class Test2(param: MyTrait) {} +class Test2(param: MyTrait) {} // NO_CHECK_INFOS // NO_CHECK_WEAK_WARNINGS \ No newline at end of file