diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 457844a9272..41bc67628e0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -249,6 +249,8 @@ public interface Errors { DiagnosticFactory0 VARIANCE_ON_TYPE_PARAMETER_OF_FUNCTION_OR_PROPERTY = DiagnosticFactory0.create(ERROR, VARIANCE_MODIFIER); + DiagnosticFactory0 DEPRECATED_TYPE_PARAMETER_SYNTAX = DiagnosticFactory0.create(WARNING); + DiagnosticFactory0 REIFIED_TYPE_PARAMETER_NO_INLINE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 TYPE_PARAMETERS_NOT_ALLOWED diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 66d75bc8a49..6b7fa3b149e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -483,6 +483,9 @@ public class DefaultErrorMessages { MAP.put(MISSING_CONSTRUCTOR_KEYWORD, "Use 'constructor' keyword after modifiers of primary constructor"); MAP.put(VARIANCE_ON_TYPE_PARAMETER_OF_FUNCTION_OR_PROPERTY, "Variance annotations are only allowed for type parameters of classes and interfaces"); + + MAP.put(DEPRECATED_TYPE_PARAMETER_SYNTAX, "Placing function type parameters after the function name is deprecated"); + MAP.put(TYPE_VARIANCE_CONFLICT, "Type parameter {0} is declared as ''{1}'' but occurs in ''{2}'' position in type {3}", new MultiRenderer() { @NotNull diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java index 6918b529a43..cb27593a33a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java @@ -489,6 +489,13 @@ public class DeclarationsChecker { } protected void checkFunction(JetNamedFunction function, SimpleFunctionDescriptor functionDescriptor) { + JetTypeParameterList typeParameterList = function.getTypeParameterList(); + PsiElement nameIdentifier = function.getNameIdentifier(); + if (typeParameterList != null && nameIdentifier != null && + typeParameterList.getTextRange().getStartOffset() > nameIdentifier.getTextRange().getStartOffset()) { + trace.report(DEPRECATED_TYPE_PARAMETER_SYNTAX.on(typeParameterList)); + } + DeclarationDescriptor containingDescriptor = functionDescriptor.getContainingDeclaration(); boolean hasAbstractModifier = function.hasModifier(JetTokens.ABSTRACT_KEYWORD); if (containingDescriptor instanceof ClassDescriptor) { diff --git a/compiler/testData/asJava/lightClassStructure/PlatformStaticMethodsGenerics.kt b/compiler/testData/asJava/lightClassStructure/PlatformStaticMethodsGenerics.kt index a732e86255a..02bf9c86db7 100644 --- a/compiler/testData/asJava/lightClassStructure/PlatformStaticMethodsGenerics.kt +++ b/compiler/testData/asJava/lightClassStructure/PlatformStaticMethodsGenerics.kt @@ -5,9 +5,9 @@ import kotlin.platform.platformStatic class PlatformStaticClass { companion object { @platformStatic - fun inClassObject() {} + fun inClassObject() {} } - fun inClass() {} + fun inClass() {} } diff --git a/compiler/testData/cfg/basic/Basic.instructions b/compiler/testData/cfg/basic/Basic.instructions index 2a2c1dc3ae6..5ccdd7ab36d 100644 --- a/compiler/testData/cfg/basic/Basic.instructions +++ b/compiler/testData/cfg/basic/Basic.instructions @@ -108,7 +108,7 @@ sink: PREV:[, ] ===================== == genfun == -fun genfun() : Unit {} +fun genfun() : Unit {} --------------------- L0: 1 diff --git a/compiler/testData/cfg/basic/Basic.kt b/compiler/testData/cfg/basic/Basic.kt index 67095a05dca..de0e6a1a361 100644 --- a/compiler/testData/cfg/basic/Basic.kt +++ b/compiler/testData/cfg/basic/Basic.kt @@ -18,6 +18,6 @@ fun f(a : Boolean) : Unit { fun foo(a : Boolean, b : Int) : Unit {} -fun genfun() : Unit {} +fun genfun() : Unit {} fun flfun(f : () -> Any) : Unit {} \ No newline at end of file diff --git a/compiler/testData/cfg/basic/Basic.values b/compiler/testData/cfg/basic/Basic.values index 72c6c290f7b..5205fcdc93b 100644 --- a/compiler/testData/cfg/basic/Basic.values +++ b/compiler/testData/cfg/basic/Basic.values @@ -60,7 +60,7 @@ fun foo(a : Boolean, b : Int) : Unit {} : Int NEW: magic[FAKE_INITIALIZER](b : Int) -> ===================== == genfun == -fun genfun() : Unit {} +fun genfun() : Unit {} --------------------- ===================== == flfun == diff --git a/compiler/testData/codegen/box/casts/asForConstants.kt b/compiler/testData/codegen/box/casts/asForConstants.kt index 83d400c01b4..cf10556463a 100644 --- a/compiler/testData/codegen/box/casts/asForConstants.kt +++ b/compiler/testData/codegen/box/casts/asForConstants.kt @@ -26,7 +26,7 @@ fun box(): String { return "OK" } -fun check(param: T, f: (T) -> Unit): String { +fun check(param: T, f: (T) -> Unit): String { try { f(param) } diff --git a/compiler/testData/codegen/box/casts/castGenericNull.kt b/compiler/testData/codegen/box/casts/castGenericNull.kt index f7de6887b83..42628250375 100644 --- a/compiler/testData/codegen/box/casts/castGenericNull.kt +++ b/compiler/testData/codegen/box/casts/castGenericNull.kt @@ -1,4 +1,4 @@ -fun castToString(t: T) { +fun castToString(t: T) { t as String } diff --git a/compiler/testData/codegen/box/closures/kt3905.kt b/compiler/testData/codegen/box/closures/kt3905.kt index 64958eb43c6..fafd87700d3 100644 --- a/compiler/testData/codegen/box/closures/kt3905.kt +++ b/compiler/testData/codegen/box/closures/kt3905.kt @@ -1,5 +1,5 @@ fun box() : String { - fun foo(t:() -> T) : T = t() + fun foo(t:() -> T) : T = t() return foo {"OK"} } \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/localReturn.kt b/compiler/testData/codegen/box/closures/localReturn.kt index c3edefe3626..cf6e749f41f 100644 --- a/compiler/testData/codegen/box/closures/localReturn.kt +++ b/compiler/testData/codegen/box/closures/localReturn.kt @@ -16,4 +16,4 @@ fun box(): String { return "OK" } -fun run1(f: () -> T): T { return f() } \ No newline at end of file +fun run1(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/codegen/box/closures/localReturnWithAutolabel.kt b/compiler/testData/codegen/box/closures/localReturnWithAutolabel.kt index 0b5bbf9a48c..577f2100352 100644 --- a/compiler/testData/codegen/box/closures/localReturnWithAutolabel.kt +++ b/compiler/testData/codegen/box/closures/localReturnWithAutolabel.kt @@ -16,4 +16,4 @@ fun box(): String { return "OK" } -fun run1(f: () -> T): T { return f() } \ No newline at end of file +fun run1(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/noneApplicable.kt b/compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/noneApplicable.kt index be58e350a95..d9d872f3692 100644 --- a/compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/noneApplicable.kt +++ b/compiler/testData/codegen/box/delegatedProperty/propertyDelegatedMethod/noneApplicable.kt @@ -7,7 +7,7 @@ class Delegate { fun propertyDelegated(a: Int) { inner = "fail" } fun propertyDelegated(a: String) { inner = "fail" } fun propertyDelegated(p: PropertyMetadata, a: Int) { inner = "fail" } - fun propertyDelegated(p: PropertyMetadata, s: String = "") { inner = "fail" } + fun propertyDelegated(p: PropertyMetadata, s: String = "") { inner = "fail" } } val prop by Delegate() diff --git a/compiler/testData/codegen/box/exclExcl/genericNull.kt b/compiler/testData/codegen/box/exclExcl/genericNull.kt index d0d23968b9b..0d4f831dfb7 100644 --- a/compiler/testData/codegen/box/exclExcl/genericNull.kt +++ b/compiler/testData/codegen/box/exclExcl/genericNull.kt @@ -1,4 +1,4 @@ -fun foo(t: T) { +fun foo(t: T) { t!! } diff --git a/compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt b/compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt index ec2a051bc9d..5ee7f510702 100644 --- a/compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt +++ b/compiler/testData/codegen/box/functions/functionExpression/functionLiteralExpression.kt @@ -6,9 +6,9 @@ fun Int.foo2() : (i : Int) -> Int { return { x -> x + this } } -fun fooT1(t : T) = { t.toString() } +fun fooT1(t : T) = { t.toString() } -fun fooT2(t: T) = { x:T -> t.toString() + x.toString() } +fun fooT2(t: T) = { x:T -> t.toString() + x.toString() } object t diff --git a/compiler/testData/codegen/box/functions/kt2739.kt b/compiler/testData/codegen/box/functions/kt2739.kt index b17e6f2e210..296dd3bc8c3 100644 --- a/compiler/testData/codegen/box/functions/kt2739.kt +++ b/compiler/testData/codegen/box/functions/kt2739.kt @@ -1,6 +1,6 @@ // KT-2739 Error type inferred for hashSet(Pair, Pair, Pair) -fun foo(vararg ts: T): T? = null +fun foo(vararg ts: T): T? = null class Pair(a: A) diff --git a/compiler/testData/codegen/box/functions/kt3313.kt b/compiler/testData/codegen/box/functions/kt3313.kt index e82df388a51..5e2e887c2a8 100644 --- a/compiler/testData/codegen/box/functions/kt3313.kt +++ b/compiler/testData/codegen/box/functions/kt3313.kt @@ -1,4 +1,4 @@ -fun foo(t: T) { +fun foo(t: T) { } fun box(): String { diff --git a/compiler/testData/codegen/box/functions/localFunctions/kt3308.kt b/compiler/testData/codegen/box/functions/localFunctions/kt3308.kt index 3c8d56f0486..b97dfa7fb79 100644 --- a/compiler/testData/codegen/box/functions/localFunctions/kt3308.kt +++ b/compiler/testData/codegen/box/functions/localFunctions/kt3308.kt @@ -1,5 +1,5 @@ fun box(): String { - fun foo(t: T) = t + fun foo(t: T) = t return foo("OK") } \ No newline at end of file diff --git a/compiler/testData/codegen/box/objectIntrinsics/objects.kt b/compiler/testData/codegen/box/objectIntrinsics/objects.kt index 043ece4a254..5aabffd0935 100644 --- a/compiler/testData/codegen/box/objectIntrinsics/objects.kt +++ b/compiler/testData/codegen/box/objectIntrinsics/objects.kt @@ -102,7 +102,7 @@ var Int.Companion.TopField : Int fun Int.Companion.TopFun() : String = "TopFun" -fun myAssertEquals(a: T, b: T) { +fun myAssertEquals(a: T, b: T) { if (a != b) throw Exception("$a != $b") } diff --git a/compiler/testData/codegen/box/objects/kt535.kt b/compiler/testData/codegen/box/objects/kt535.kt index b36b61f88ec..7835106ad16 100644 --- a/compiler/testData/codegen/box/objects/kt535.kt +++ b/compiler/testData/codegen/box/objects/kt535.kt @@ -4,7 +4,7 @@ class Identifier(t : T?, myHasDollar : Boolean) { public fun getName() : T? { return myT } companion object { - open public fun init(name : T?) : Identifier { + open public fun init(name : T?) : Identifier { val __ = Identifier(name, false) return __ } diff --git a/compiler/testData/codegen/box/objects/kt640.kt b/compiler/testData/codegen/box/objects/kt640.kt index 5387916f161..a3d9c3373fa 100644 --- a/compiler/testData/codegen/box/objects/kt640.kt +++ b/compiler/testData/codegen/box/objects/kt640.kt @@ -15,7 +15,7 @@ public open class Identifier(myName : T?, myHasDollar : Boolean) { } companion object { - open public fun init(name : T?) : Identifier { + open public fun init(name : T?) : Identifier { val __ = Identifier(name, false) return __ } diff --git a/compiler/testData/codegen/box/primitiveTypes/comparisonWithNullCallsFun.kt b/compiler/testData/codegen/box/primitiveTypes/comparisonWithNullCallsFun.kt index 5f83a03b067..0948f0eb0b9 100644 --- a/compiler/testData/codegen/box/primitiveTypes/comparisonWithNullCallsFun.kt +++ b/compiler/testData/codegen/box/primitiveTypes/comparisonWithNullCallsFun.kt @@ -1,6 +1,6 @@ var entered = 0 -fun foo(t: T): T { +fun foo(t: T): T { entered++ return t } diff --git a/compiler/testData/codegen/box/primitiveTypes/kt2768.kt b/compiler/testData/codegen/box/primitiveTypes/kt2768.kt index 63aa44ded32..b2b0ec976ef 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt2768.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt2768.kt @@ -1,4 +1,4 @@ -fun assertEquals(a: T, b: T) { +fun assertEquals(a: T, b: T) { if (a != b) throw AssertionError("$a != $b") } diff --git a/compiler/testData/codegen/box/regressions/kt3903.kt b/compiler/testData/codegen/box/regressions/kt3903.kt index ddb4e3e6766..1d08051cded 100644 --- a/compiler/testData/codegen/box/regressions/kt3903.kt +++ b/compiler/testData/codegen/box/regressions/kt3903.kt @@ -1,6 +1,6 @@ class Foo { fun bar(): String { - fun foo(t:() -> T) : T = t() + fun foo(t:() -> T) : T = t() foo { } return "OK" } diff --git a/compiler/testData/codegen/boxInline/complex/with.2.kt b/compiler/testData/codegen/boxInline/complex/with.2.kt index f43c92b5685..3f8034c0fa8 100644 --- a/compiler/testData/codegen/boxInline/complex/with.2.kt +++ b/compiler/testData/codegen/boxInline/complex/with.2.kt @@ -28,4 +28,4 @@ public fun Input.copyTo(output: Output, size: Int): Long { } -public inline fun with2(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}() +public inline fun with2(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}() diff --git a/compiler/testData/codegen/boxWithStdlib/casts/asWithGeneric.kt b/compiler/testData/codegen/boxWithStdlib/casts/asWithGeneric.kt index aed0bdf83d2..62b916baf9f 100644 --- a/compiler/testData/codegen/boxWithStdlib/casts/asWithGeneric.kt +++ b/compiler/testData/codegen/boxWithStdlib/casts/asWithGeneric.kt @@ -1,5 +1,5 @@ -fun test1() = null as T -fun test2(): T { +fun test1() = null as T +fun test2(): T { val a : Any? = null return a as T } diff --git a/compiler/testData/codegen/boxWithStdlib/inline/kt6895.kt b/compiler/testData/codegen/boxWithStdlib/inline/kt6895.kt index 659aef9ac38..d7bbb1d62e1 100644 --- a/compiler/testData/codegen/boxWithStdlib/inline/kt6895.kt +++ b/compiler/testData/codegen/boxWithStdlib/inline/kt6895.kt @@ -5,7 +5,7 @@ class UpdateableThing { private val lock = ReentrantReadWriteLock() private var updateCount = 0 - fun performUpdates(block: () -> T): T { + fun performUpdates(block: () -> T): T { lock.write { ++updateCount val result = block() diff --git a/compiler/testData/codegen/bytecodeText/redundantGotoRemoving.kt b/compiler/testData/codegen/bytecodeText/redundantGotoRemoving.kt index afd0599ad0e..296c5bb9e17 100644 --- a/compiler/testData/codegen/bytecodeText/redundantGotoRemoving.kt +++ b/compiler/testData/codegen/bytecodeText/redundantGotoRemoving.kt @@ -1,6 +1,6 @@ inline fun calc(value : T, fn: (T)->R) : R = fn(value) -inline fun identity(value : T) : T = calc(value) { +inline fun identity(value : T) : T = calc(value) { if (1 == 1) return it it } diff --git a/compiler/testData/codegen/notNullAssertions/noAssertionForNullableGenericMethod.kt b/compiler/testData/codegen/notNullAssertions/noAssertionForNullableGenericMethod.kt index c7851178881..0298eb1c1cb 100644 --- a/compiler/testData/codegen/notNullAssertions/noAssertionForNullableGenericMethod.kt +++ b/compiler/testData/codegen/notNullAssertions/noAssertionForNullableGenericMethod.kt @@ -1,3 +1,3 @@ -fun foo(a: List) { +fun foo(a: List) { val t: T = a.get(0) } diff --git a/compiler/testData/diagnostics/tests/Bounds.kt b/compiler/testData/diagnostics/tests/Bounds.kt index 4f7f205fb64..f3a6e80bdb8 100644 --- a/compiler/testData/diagnostics/tests/Bounds.kt +++ b/compiler/testData/diagnostics/tests/Bounds.kt @@ -37,6 +37,6 @@ fun test() { 1.buzz<Double>() } -fun foo() {} -fun bar() {} +fun foo() {} +fun bar() {} fun Int> Int.buzz() : Unit {} diff --git a/compiler/testData/diagnostics/tests/Builders.kt b/compiler/testData/diagnostics/tests/Builders.kt index d62bc829d81..943688bfb49 100644 --- a/compiler/testData/diagnostics/tests/Builders.kt +++ b/compiler/testData/diagnostics/tests/Builders.kt @@ -69,7 +69,7 @@ abstract class Tag(val name : String) : Element { val children = ArrayList() val attributes = HashMap() - protected fun initTag(tag : T, init : T.() -> Unit) : T { + protected fun initTag(tag : T, init : T.() -> Unit) : T { tag.init() children.add(tag) return tag diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt index a107ef7196e..d7fc57566d6 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt @@ -14,11 +14,11 @@ fun foo2() : (i : () -> Unit) -> Unit { return {} } -fun fooT1(t : T) : () -> T { +fun fooT1(t : T) : () -> T { return {t} } -fun fooT2() : (t : T) -> T { +fun fooT2() : (t : T) -> T { return {it} } diff --git a/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.kt b/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.kt index bc7ea2d0b1b..d0487f06f96 100644 --- a/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.kt +++ b/compiler/testData/diagnostics/tests/GenericFunctionIsLessSpecific.kt @@ -1,7 +1,7 @@ // !CHECK_TYPE // A generic funciton is always less specific than a non-generic one -fun foo(t : T) : Unit {} +fun foo(t : T) : Unit {} fun foo(i : Int) : Int = 1 fun test() { diff --git a/compiler/testData/diagnostics/tests/PackageQualified.kt b/compiler/testData/diagnostics/tests/PackageQualified.kt index 319f55574f7..4ff3dc30f9f 100644 --- a/compiler/testData/diagnostics/tests/PackageQualified.kt +++ b/compiler/testData/diagnostics/tests/PackageQualified.kt @@ -32,7 +32,7 @@ val y1 = foobar.a.b ///////////////////////////////////////////////////////////////////////// -fun done(result : O) : Iteratee = StrangeIterateeImpl(result) +fun done(result : O) : Iteratee = StrangeIterateeImpl(result) abstract class Iteratee { abstract fun process(item : I) : Iteratee @@ -58,7 +58,7 @@ abstract class Sum() : Iteratee() { } abstract class Collection : Iterable { - fun iterate(iteratee : Iteratee) : O { + fun iterate(iteratee : Iteratee) : O { var current = iteratee for (x in this) { val it = current.process(x) diff --git a/compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt b/compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt index 00f8dc6ee13..525d57ad2e8 100644 --- a/compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt +++ b/compiler/testData/diagnostics/tests/StarsInFunctionCalls.kt @@ -1,6 +1,6 @@ -fun getT() {} -fun getTT() {} -fun getTTT(x : Any) {} +fun getT() {} +fun getTT() {} +fun getTTT(x : Any) {} fun foo(a : Any?) {} public fun main() { diff --git a/compiler/testData/diagnostics/tests/TypeInference.kt b/compiler/testData/diagnostics/tests/TypeInference.kt index 4bdee5e7ccc..cc74038bbc8 100644 --- a/compiler/testData/diagnostics/tests/TypeInference.kt +++ b/compiler/testData/diagnostics/tests/TypeInference.kt @@ -3,7 +3,7 @@ class C() { } fun foo(c: C) {} -fun bar() : C {} +fun bar() : C {} fun main(args : Array) { val a : C = C(); diff --git a/compiler/testData/diagnostics/tests/cast/IsErasedAllowSameParameterParameter.kt b/compiler/testData/diagnostics/tests/cast/IsErasedAllowSameParameterParameter.kt index 3d4a4878b4b..d835e23aed3 100644 --- a/compiler/testData/diagnostics/tests/cast/IsErasedAllowSameParameterParameter.kt +++ b/compiler/testData/diagnostics/tests/cast/IsErasedAllowSameParameterParameter.kt @@ -1,3 +1,3 @@ -fun ff(l: MutableCollection) = l is MutableList +fun ff(l: MutableCollection) = l is MutableList diff --git a/compiler/testData/diagnostics/tests/cast/isErasedTAndStarred.kt b/compiler/testData/diagnostics/tests/cast/isErasedTAndStarred.kt index a2462759ba3..437cb1b0ef8 100644 --- a/compiler/testData/diagnostics/tests/cast/isErasedTAndStarred.kt +++ b/compiler/testData/diagnostics/tests/cast/isErasedTAndStarred.kt @@ -1,3 +1,3 @@ class G -fun f(q: Q) = q is G<*> \ No newline at end of file +fun f(q: Q) = q is G<*> \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/classLiteral/genericArrays.kt b/compiler/testData/diagnostics/tests/classLiteral/genericArrays.kt index a424d01030f..a50af8aebbc 100644 --- a/compiler/testData/diagnostics/tests/classLiteral/genericArrays.kt +++ b/compiler/testData/diagnostics/tests/classLiteral/genericArrays.kt @@ -1,8 +1,8 @@ import kotlin.reflect.KClass -fun f1(): KClass> = Array::class -fun f2(): KClass>> = Array>::class -inline fun f3() = Array::class -inline fun f4() = Array>::class +fun f1(): KClass> = Array::class +fun f2(): KClass>> = Array>::class +inline fun f3() = Array::class +inline fun f4() = Array>::class fun f5(): KClass> = Array<*>::class fun f6(): KClass> = Array::class \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt b/compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt index 4d9cc30c43d..62100c2fe04 100644 --- a/compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt +++ b/compiler/testData/diagnostics/tests/classLiteral/nonClassesOnLHS.kt @@ -8,7 +8,7 @@ val a2 = A??::class val l1 = List?::class val l2 = List?::class -fun foo() { +fun foo() { val t1 = T::class val t2 = T?::class } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt b/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt index fb0c7b38abc..435705c309b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt @@ -9,7 +9,7 @@ class D { val cTopLevel: Int by IncorrectThis() class IncorrectThis { - fun get(t: Any?, p: PropertyMetadata): Int { + fun get(t: Any?, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt index cc7f90e6fc0..fdc281eea1b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt @@ -13,9 +13,9 @@ class A(outer: Outer) { var f: String by foo(getMyProperty()) - 1 } -fun foo(a: Any?) = MyProperty() +fun foo(a: Any?) = MyProperty() -fun getMyProperty() = MyProperty() +fun getMyProperty() = MyProperty() fun getMyConcreteProperty() = MyProperty() @@ -35,7 +35,7 @@ operator fun MyProperty.plus() = MyProperty() operator fun MyProperty.minus(i: Int) = MyProperty() object O { - fun getMyProperty() = MyProperty() + fun getMyProperty() = MyProperty() } interface MyPropertyContainer { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt index cf475f7f555..0903f4262eb 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt @@ -5,7 +5,7 @@ class A { var b5: String by getMyProperty1() } -fun getMyProperty1() = MyProperty1() +fun getMyProperty1() = MyProperty1() class MyProperty1 { @@ -25,7 +25,7 @@ class B { var b5: String by getMyProperty2() } -fun getMyProperty2() = MyProperty2() +fun getMyProperty2() = MyProperty2() class MyProperty2 { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt index 1d937178eb1..133edc32f94 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt @@ -8,7 +8,7 @@ class A1 { var c1: String by getMyProperty1() var d1: String by MyProperty1() -fun getMyProperty1() = MyProperty1() +fun getMyProperty1() = MyProperty1() class MyProperty1 { @@ -32,7 +32,7 @@ class A2 { var c2: String by getMyProperty2() var d2: String by MyProperty2() -fun getMyProperty2() = MyProperty2() +fun getMyProperty2() = MyProperty2() class MyProperty2 { @@ -56,7 +56,7 @@ class A3 { var c3: String by getMyProperty3() var d3: String by MyProperty3() -fun getMyProperty3() = MyProperty3() +fun getMyProperty3() = MyProperty3() class MyProperty3 { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt index 5de3690d5d7..ec727cdaa92 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt @@ -8,7 +8,7 @@ class A1 { val c1: String by getMyProperty1() val d1: String by MyProperty1() -fun getMyProperty1() = MyProperty1() +fun getMyProperty1() = MyProperty1() class MyProperty1 { @@ -28,7 +28,7 @@ class A2 { val c2: String by getMyProperty2() val d2: String by MyProperty2() -fun getMyProperty2() = MyProperty2() +fun getMyProperty2() = MyProperty2() class MyProperty2 { @@ -48,7 +48,7 @@ class A3 { val c3: String by getMyProperty3() val d3: String by MyProperty3() -fun getMyProperty3() = MyProperty3() +fun getMyProperty3() = MyProperty3() class MyProperty3 { diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt index 0b8c29f0314..6b6fedef080 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt @@ -7,5 +7,5 @@ class Delegate { return 1 } - fun propertyDelegated(p: PropertyMetadata) {} + fun propertyDelegated(p: PropertyMetadata) {} } diff --git a/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt b/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt index d85690113c2..74e16785b4d 100644 --- a/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/typeUsage.kt @@ -33,7 +33,7 @@ fun funcParamReceiver(param: Obsolete.()->U fun funcParamParam(param: (Obsolete)->Unit) { param(Obsolete()) } fun funcParamRetVal(param: ()->Obsolete) { param() } -fun constraintObsolete>() {} +fun Obsolete> constraint() {} fun Obsolete.receiver() {} diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/InferenceParametersTypes.kt b/compiler/testData/diagnostics/tests/functionAsExpression/InferenceParametersTypes.kt index 092a6cd0a81..f45656b32ab 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/InferenceParametersTypes.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/InferenceParametersTypes.kt @@ -1,6 +1,6 @@ // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -fun listOf(): List = null!! +fun listOf(): List = null!! fun test(a: (Int) -> Int) { test(fun (x) = 4) diff --git a/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt b/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt index ef9f257117a..c8c478764ea 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/LabeledFunctionLiterals.kt @@ -5,8 +5,8 @@ interface A interface B interface C: A, B -fun foo(a: A, f: () -> T): T = f() -fun foo(b: B, f: () -> T): T = f() +fun foo(a: A, f: () -> T): T = f() +fun foo(b: B, f: () -> T): T = f() fun test(c: C) { foo(c) f@ { diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt6869.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt6869.kt index 160bb4dd0eb..82d0d6a4641 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt6869.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt6869.kt @@ -8,4 +8,4 @@ fun main(args : Array) { fun T.let(f: (T) -> R): R = f(this) operator fun Iterable.plus(element: T): List = null!! -fun listOf(vararg values: T): List = null!! \ No newline at end of file +fun listOf(vararg values: T): List = null!! \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/ForbiddenNonLocalReturnNoType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/ForbiddenNonLocalReturnNoType.kt index d5f4a205f66..0abb7428ca6 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/ForbiddenNonLocalReturnNoType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/ForbiddenNonLocalReturnNoType.kt @@ -15,4 +15,4 @@ fun test3() { } } -fun run(f: () -> T): T { return f() } +fun run(f: () -> T): T { return f() } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalAndNonLocalReturnInLambda.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalAndNonLocalReturnInLambda.kt index efe549ecc8b..a1534478ae8 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalAndNonLocalReturnInLambda.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalAndNonLocalReturnInLambda.kt @@ -8,4 +8,4 @@ fun test2(a: Int) { checkSubtype(x) } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelNoParens.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelNoParens.kt index 8ec0f192f28..ba262988562 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelNoParens.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelNoParens.kt @@ -5,4 +5,4 @@ fun test2() { checkSubtype(x) } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelParens.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelParens.kt index a2f5e58160e..2e6f63245cc 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelParens.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnExplicitLabelParens.kt @@ -11,4 +11,4 @@ fun test1() { checkSubtype(x) } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnHasTypeNothing.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnHasTypeNothing.kt index b4bd539624f..4b5d65c6897 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnHasTypeNothing.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnHasTypeNothing.kt @@ -6,4 +6,4 @@ fun test() { } } -fun run1(f: () -> T): T { return f() } \ No newline at end of file +fun run1(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedFunction.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedFunction.kt index ba5b786706d..417489961e0 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedFunction.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedFunction.kt @@ -11,4 +11,4 @@ fun test() { checkSubtype(x) } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedLambda.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedLambda.kt index 1d2c596ee31..408754306c2 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedLambda.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnInNestedLambda.kt @@ -10,4 +10,4 @@ fun test() { checkSubtype(x) } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnNoCoercionToUnit.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnNoCoercionToUnit.kt index a78c1afdf9c..1897bd88617 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnNoCoercionToUnit.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnNoCoercionToUnit.kt @@ -5,4 +5,4 @@ fun test(a: Int) { } } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnit.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnit.kt index 00770c745ac..1fa8186eb97 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnit.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnit.kt @@ -8,4 +8,4 @@ fun test(a: Int) { checkSubtype(x) } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnitAndDontCareType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnitAndDontCareType.kt index 8785f484a42..28639836310 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnitAndDontCareType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnUnitAndDontCareType.kt @@ -1,5 +1,5 @@ val flag = true -fun run(f: () -> T): T { return f() } +fun run(f: () -> T): T { return f() } // type of a was checked by txt val a = run { // () -> Unit diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.kt index d5139c44133..9d84af7b318 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnWithExpectedType.kt @@ -1,5 +1,5 @@ -fun listOf(): List = null!! -fun listOf(vararg values: T): List = null!! +fun listOf(): List = null!! +fun listOf(vararg values: T): List = null!! val flag = true diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt index ef2724576dd..c1008c00047 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/LocalReturnsWithExplicitReturnType.kt @@ -8,4 +8,4 @@ fun test(a: Int) { run{ 1 } } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/MixedReturnsFromLambda.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/MixedReturnsFromLambda.kt index 5d524cf4236..c54cb94e695 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/MixedReturnsFromLambda.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/MixedReturnsFromLambda.kt @@ -13,4 +13,4 @@ fun test(a: C, b: B) { checkSubtype(x) } -fun run(f: () -> T): T { return f() } \ No newline at end of file +fun run(f: () -> T): T { return f() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt b/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt index f211330eef1..c5f1c089d53 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/return/NoCommonSystem.kt @@ -1,6 +1,6 @@ fun Iterable.map(transform: (T) -> R): List = null!! -fun listOf(): List = null!! -fun listOf(vararg values: T): List = null!! +fun listOf(): List = null!! +fun listOf(vararg values: T): List = null!! fun commonSystemFailed(a: List) { a.map { diff --git a/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt b/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt index ad407c6bc68..d4609ff4ed4 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/checkNothingIsSubtype.kt @@ -3,7 +3,7 @@ package d interface A -fun infer(a: A) : T {} +fun infer(a: A) : T {} fun test(nothing: Nothing?) { val i = infer(nothing) diff --git a/compiler/testData/diagnostics/tests/incompleteCode/incompleteAssignment.kt b/compiler/testData/diagnostics/tests/incompleteCode/incompleteAssignment.kt index ee8aa3b74ae..9ccdb43915b 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/incompleteAssignment.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/incompleteAssignment.kt @@ -20,7 +20,7 @@ fun test(expectedSum : Int, vararg data : Int) { assertEquals(actualSum, expectedSum, "\ndata = ${Arrays.toString(data)}\n" + "sum(data) = ${actualSum}, but must be $expectedSum ") } -fun assertEquals(actual : T?, expected : T?, message : Any? = null) { +fun assertEquals(actual : T?, expected : T?, message : Any? = null) { if (actual != expected) { if (message == null) throw AssertionError() diff --git a/compiler/testData/diagnostics/tests/incompleteCode/unresolvedArguments.kt b/compiler/testData/diagnostics/tests/incompleteCode/unresolvedArguments.kt index a27667e5d69..d0ce762d0c9 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/unresolvedArguments.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/unresolvedArguments.kt @@ -1,7 +1,7 @@ //!DIAGNOSTICS: -UNUSED_PARAMETER -fun foo(i: Int, t: T) {} -fun foo(s: String, t: T) {} +fun foo(i: Int, t: T) {} +fun foo(s: String, t: T) {} fun bar(i: Int) {} fun bar(s: String) {} diff --git a/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt b/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt index 0b954db9d16..194a175514e 100644 --- a/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt +++ b/compiler/testData/diagnostics/tests/inference/NoInferenceFromDeclaredBounds.kt @@ -1,4 +1,4 @@ -fun fooT22() : T? { +fun fooT22() : T? { return null } diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt index 926e7f7d6e8..ed4983a3b70 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveAmbiguity.kt @@ -1,8 +1,8 @@ package f -fun g(i: Int, a: Any): List {throw Exception()} -fun g(a: Any, i: Int): Collection {throw Exception()} +fun g(i: Int, a: Any): List {throw Exception()} +fun g(a: Any, i: Int): Collection {throw Exception()} -fun test() { +fun test() { val c: List = g(1, 1) } diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt index a8c504424cd..56579573f90 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveFunctionLiteralsNoUse.kt @@ -1,6 +1,6 @@ package f -fun h(i: Int, a: Any, r: R, f: (Boolean) -> Int) = 1 -fun h(a: Any, i: Int, r: R, f: (Boolean) -> Int) = 1 +fun h(i: Int, a: Any, r: R, f: (Boolean) -> Int) = 1 +fun h(a: Any, i: Int, r: R, f: (Boolean) -> Int) = 1 fun test() = h(1, 1, 1, { b -> 42 }) diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt index 1cacf692c67..2f94a9d5969 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoInfoForParameter.kt @@ -1,10 +1,10 @@ package f -fun f(i: Int, c: Collection): List {throw Exception()} -fun f(a: Any, l: List): Collection {throw Exception()} +fun f(i: Int, c: Collection): List {throw Exception()} +fun f(a: Any, l: List): Collection {throw Exception()} -fun test(l: List) { +fun test(l: List) { f(1, emptyList()) } -fun emptyList(): List {throw Exception()} +fun emptyList(): List {throw Exception()} diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.kt index c90ab3fd4a4..f9ea211bb5d 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveNoneApplicable.kt @@ -1,7 +1,7 @@ package f -fun f(i: Int, t: T, c: MutableCollection) {} -fun f(a: Any, t: T, l: MutableList) {} +fun f(i: Int, t: T, c: MutableCollection) {} +fun f(a: Any, t: T, l: MutableList) {} fun test(l: List) { f(1, "", l) diff --git a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt index 39cab1937b1..c5fe2c995c3 100644 --- a/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/inference/cannotCompleteResolveWithFunctionLiterals.kt @@ -1,8 +1,8 @@ // !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS package f -fun h(f: (Boolean) -> R) = 1 -fun h(f: (String) -> R) = 2 +fun h(f: (Boolean) -> R) = 1 +fun h(f: (String) -> R) = 2 fun test() = h{ i -> getAnswer() } diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.kt index 72673750ba9..36a1fcdc553 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.kt @@ -4,7 +4,7 @@ class GenericClass public fun GenericClass>.foo() {} -public fun bar(t: T, ext: GenericClass.() -> Unit) {} +public fun bar(t: T, ext: GenericClass.() -> Unit) {} fun test() { bar(mapOf(2 to 3)) { foo() } diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt index 3acf44efad9..dc882ec4d8d 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/genericCandidateInGenericClass.kt @@ -1,7 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER class GenericClass(val value: T) { - public fun foo

(extension: T.() -> P) {} + public fun

foo(extension: T.() -> P) {} } public fun GenericClass>.bar() { diff --git a/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt b/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt index 8f916b354c6..f2cfd6463b1 100644 --- a/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt +++ b/compiler/testData/diagnostics/tests/inference/conflictingSubstitutions.kt @@ -12,7 +12,7 @@ fun test() { val u = 11.elemAndListWithReceiver(4, list("7")) } -fun list(value: T) : ArrayList { +fun list(value: T) : ArrayList { val list = ArrayList() list.add(value) return list diff --git a/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.kt b/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.kt index 59ddbc81b7a..a08c09e8bde 100644 --- a/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.kt +++ b/compiler/testData/diagnostics/tests/inference/dependOnExpectedType.kt @@ -12,7 +12,7 @@ fun elem(t: List): R = t.get(0) fun elemAndList(r: R, t: List): R = t.get(0) -fun both(t1: T, t2: T) : T = t1 +fun both(t1: T, t2: T) : T = t1 fun test1() { val a = elem(list(2)) @@ -42,12 +42,12 @@ fun test1() { checkSubtype(j) } -fun list(value: T) : ArrayList { +fun list(value: T) : ArrayList { val list = ArrayList() list.add(value) return list } -fun newList() : ArrayList { +fun newList() : ArrayList { return ArrayList() } diff --git a/compiler/testData/diagnostics/tests/inference/functionPlaceholderError.kt b/compiler/testData/diagnostics/tests/inference/functionPlaceholderError.kt index d2298231f37..4ce54872d69 100644 --- a/compiler/testData/diagnostics/tests/inference/functionPlaceholderError.kt +++ b/compiler/testData/diagnostics/tests/inference/functionPlaceholderError.kt @@ -4,7 +4,7 @@ package a fun emptyList(): List = throw Exception() -fun foo(f: T.() -> Unit, l: List): T = throw Exception("$f$l") +fun foo(f: T.() -> Unit, l: List): T = throw Exception("$f$l") fun test() { val q = foo(fun Int.() {}, emptyList()) //type inference no information for parameter error diff --git a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt index facb21165a5..3ef2b299319 100644 --- a/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/hasErrorInConstrainingTypes.kt @@ -1,6 +1,6 @@ package n -fun foo(t: T, t1: T) {} +fun foo(t: T, t1: T) {} fun test() { //no type inference error diff --git a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.kt b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.kt index a677ec097c3..4c0bdb16b4b 100644 --- a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.kt +++ b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiterals.kt @@ -3,7 +3,7 @@ package n //+JDK import java.util.* -fun expected(t: T, f: () -> T) : T = t +fun expected(t: T, f: () -> T) : T = t fun test(arrayList: ArrayList, list: List) { val t = expected(arrayList, { list.reverse() }) diff --git a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.kt b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.kt index 6b41c1bc9d8..c878846bb58 100644 --- a/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.kt +++ b/compiler/testData/diagnostics/tests/inference/inferInFunctionLiteralsWithReturn.kt @@ -3,7 +3,7 @@ package n //+JDK import java.util.* -fun expected(t: T, f: () -> T) : T = t +fun expected(t: T, f: () -> T) : T = t fun test(arrayList: ArrayList, list: List) { val t = expected(arrayList, l@ {return@l list.reverse() }) diff --git a/compiler/testData/diagnostics/tests/inference/listConstructor.kt b/compiler/testData/diagnostics/tests/inference/listConstructor.kt index 29ab0f0a477..c4012f35f62 100644 --- a/compiler/testData/diagnostics/tests/inference/listConstructor.kt +++ b/compiler/testData/diagnostics/tests/inference/listConstructor.kt @@ -22,7 +22,7 @@ fun test() { // --------------------- // copy from kotlin util -fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size())) +fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size())) fun > Array.toCollection(result: C) : C { for (element in this) result.add(element) diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt index 1a4a770b8d2..5f7c70b2979 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedCallsForArraySetExpression.kt @@ -1,4 +1,4 @@ -fun foo(t: T) = t +fun foo(t: T) = t fun test(map: MutableMap, t: Int) { map [t] = foo(t) // t was marked with black square diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.kt index b75c1ed2d02..c2fc119a18e 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/completeNestedForVariableAsFunctionCall.kt @@ -9,7 +9,7 @@ class B { operator fun invoke(f: (T) -> T): MyFunc = throw Exception() } -fun id(r: R) = r +fun id(r: R) = r fun foo(a: A) { val r : MyFunc = id (a.b { x -> x + 14 }) diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.kt index f9d04233648..0e643003412 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.kt @@ -4,7 +4,7 @@ package aaa fun T.foo(t: T) = t -fun id(t: T) = t +fun id(t: T) = t fun a() { val i = id(2 foo 3) diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt index 0174840583b..10c73e6f469 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt @@ -3,7 +3,7 @@ package b import java.util.ArrayList -public fun query(t: T, args: Map): List { +public fun query(t: T, args: Map): List { return ArrayList() } @@ -17,7 +17,7 @@ fun test(pair: Pair) { //from standard library -fun mapOf(vararg values: Pair): Map { throw Exception() } +fun mapOf(vararg values: Pair): Map { throw Exception() } fun A.to(that: B): Pair { throw Exception() } @@ -26,7 +26,7 @@ fun println(message : Any?) { throw Exception() } class Pair () {} //short example -fun foo(t: T) = t +fun foo(t: T) = t fun test(t: String) { diff --git a/compiler/testData/diagnostics/tests/inference/noInformationForParameter.kt b/compiler/testData/diagnostics/tests/inference/noInformationForParameter.kt index af53ae4ba5e..44e6a4aa14f 100644 --- a/compiler/testData/diagnostics/tests/inference/noInformationForParameter.kt +++ b/compiler/testData/diagnostics/tests/inference/noInformationForParameter.kt @@ -9,6 +9,6 @@ fun test() { val n1 : List = newList() } -fun newList() : ArrayList { +fun newList() : ArrayList { return ArrayList() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt b/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt index db9176965ae..ac21d9d1e63 100644 --- a/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt +++ b/compiler/testData/diagnostics/tests/inference/possibleCycleOnConstraints.kt @@ -2,7 +2,7 @@ package a import java.util.* -fun g (f: () -> List) : T {} +fun g (f: () -> List) : T {} fun test() { //here possibly can be a cycle on constraints diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt index d1ff42da91e..c43277d871f 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1718.kt @@ -13,5 +13,5 @@ fun test() { } //from library -fun arrayList(vararg values: T) : ArrayList {} +fun arrayList(vararg values: T) : ArrayList {} operator fun Iterable.plus(elements: Iterable): List {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2057.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2057.kt index 9f6cf54e955..af5c66dda64 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2057.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2057.kt @@ -5,7 +5,7 @@ import java.util.ArrayList fun foo(a : T, b : Collection, c : Int) { } -fun arrayListOf(vararg values: T): ArrayList = throw Exception("$values") +fun arrayListOf(vararg values: T): ArrayList = throw Exception("$values") val bar = foo("", arrayListOf(), ) val bar2 = foo("", arrayListOf(), ) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2179.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2179.kt index 29b043835a1..94308ae2ab7 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2179.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2179.kt @@ -25,7 +25,7 @@ fun test() { //------------ -fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size())) +fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size())) fun Collection.map(transform : (T) -> R) : List { return mapTo(java.util.ArrayList(this.size), transform) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2294.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2294.kt index 53822ed8ddc..14f3e3dc8f7 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2294.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2294.kt @@ -3,7 +3,7 @@ //KT-2294 Type inference infers DONT_CARE instead of correct type package a -public fun foo(array: Array): Array = array +public fun foo(array: Array): Array = array public fun test() { diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2324.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2324.kt index b49d9066c1a..a59130b0b3c 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2324.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2324.kt @@ -27,7 +27,7 @@ fun testSomeFunction() { fun assertEquals(expected: Any?, actual: Any?, message: String = "") { } -fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size())) +fun arrayList(vararg values: T) : ArrayList = values.toCollection(ArrayList(values.size())) fun > Array.toCollection(result: C) : C { for (element in this) result.add(element) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt index 806ddde19ae..d1794639129 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2407.kt @@ -11,7 +11,7 @@ fun test() { } //from library -fun arrayList(vararg values: T) : ArrayList {} +fun arrayList(vararg values: T) : ArrayList {} fun Collection.map(transform : (T) -> R) : List {} diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2445.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2445.kt index 2f9e0da3fab..119668b1f45 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2445.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2445.kt @@ -8,4 +8,4 @@ fun main(args: Array) { } } -fun test(callback: (R) -> Unit):Unit = callback(null!!) \ No newline at end of file +fun test(callback: (R) -> Unit):Unit = callback(null!!) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2459.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2459.kt index a61b5b804c9..888bcd51ccb 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2459.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2459.kt @@ -7,4 +7,4 @@ class B(val x: List) fun f(x: T): B = B(arrayList(x)) // from standard library -fun arrayList(vararg values: T) : ArrayList {} \ No newline at end of file +fun arrayList(vararg values: T) : ArrayList {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2505.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2505.kt index 1cf5f033ff8..510d55c6d3b 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2505.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2505.kt @@ -8,7 +8,7 @@ interface MyType {} class MyClass : MyType {} public open class HttpResponse() { - public open fun parseAs(dataClass : MyClass) : T { + public open fun parseAs(dataClass : MyClass) : T { throw Exception() } public open fun parseAs(dataType : MyType) : Any? { @@ -16,7 +16,7 @@ public open class HttpResponse() { } } -fun test (httpResponse: HttpResponse, rtype: MyClass) { +fun test (httpResponse: HttpResponse, rtype: MyClass) { val res = httpResponse.parseAs( rtype ) checkSubtype(res) //type mismatch: required R, found T } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2588.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2588.kt index 504f5f7909f..bfe802621b4 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2588.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2588.kt @@ -10,7 +10,7 @@ interface D class B : A, D class C : A, D -fun hashSetOf(vararg values: T): HashSet = throw Exception("$values") +fun hashSetOf(vararg values: T): HashSet = throw Exception("$values") fun foo(b: MyClass, c: MyClass) { val set1 : Set> = hashSetOf(b, c) //type inference expected type mismatch diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2741.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2741.kt index c1539c9b4c4..c44e0e4a283 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2741.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2741.kt @@ -2,7 +2,7 @@ package a fun > Iterable._sortBy(f: (T) -> R): List = throw Exception() -fun _arrayList(vararg values: T) : List = throw Exception() +fun _arrayList(vararg values: T) : List = throw Exception() class _Pair(val a: A) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt index 23ff0757a4b..88f60df8089 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt2838.kt @@ -2,8 +2,8 @@ //KT-2838 Type inference failed on passing null as a nullable argument package a -fun foo(a: T, b: Map?) = b?.get(a) -fun bar(a: T, b: Map) = b.get(a) +fun foo(a: T, b: Map?) = b?.get(a) +fun bar(a: T, b: Map) = b.get(a) fun test(a: Int) { foo(a, null) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3038.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3038.kt index 91b04c12d41..67bf21c316b 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3038.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3038.kt @@ -6,7 +6,7 @@ enum class TestEnum { SECOND } -fun inferenceTest(a: T) : T = a +fun inferenceTest(a: T) : T = a fun hello() { var enumElemFirst = inferenceTest(TestEnum.FIRST) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3301.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3301.kt index 7352d758547..c02bc58f9ff 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3301.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3301.kt @@ -17,4 +17,4 @@ fun test122() { } //from library -fun array(vararg t: T): Array {} \ No newline at end of file +fun array(vararg t: T): Array {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt index 34f96780858..c5ce05c1686 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt702.kt @@ -2,11 +2,11 @@ package a //+JDK -fun getJavaClass() : java.lang.Class { } +fun getJavaClass() : java.lang.Class { } public class Throwables() { companion object { - public fun propagateIfInstanceOf(throwable : Throwable?, declaredType : Class?>?) : Unit { + public fun propagateIfInstanceOf(throwable : Throwable?, declaredType : Class?>?) : Unit { if (((throwable != null) && declaredType?.isInstance(throwable)!!)) { throw declaredType?.cast(throwable)!! diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt832.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt832.kt index ee684dd9d3b..ed3b8d7f7f1 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt832.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt832.kt @@ -1,7 +1,7 @@ //KT-832 Provide better diagnostics when type inference fails for an expression that returns a function package a -fun fooT2() : (t : T) -> T { +fun fooT2() : (t : T) -> T { return {it} } diff --git a/compiler/testData/diagnostics/tests/inference/reportingImprovements/subtypeForInvariantWithErrorGenerics.kt b/compiler/testData/diagnostics/tests/inference/reportingImprovements/subtypeForInvariantWithErrorGenerics.kt index 8d0f5807659..2328f54367d 100644 --- a/compiler/testData/diagnostics/tests/inference/reportingImprovements/subtypeForInvariantWithErrorGenerics.kt +++ b/compiler/testData/diagnostics/tests/inference/reportingImprovements/subtypeForInvariantWithErrorGenerics.kt @@ -1,7 +1,7 @@ package a -fun foo (f: ()->R, r: MutableList) = r.add(f()) -fun bar (r: MutableList, f: ()->R) = r.add(f()) +fun foo (f: ()->R, r: MutableList) = r.add(f()) +fun bar (r: MutableList, f: ()->R) = r.add(f()) fun test() { val a = foo({1}, arrayListOf("")) //no type inference error on 'arrayListOf' @@ -9,4 +9,4 @@ fun test() { } // from standard library -fun arrayListOf(vararg values: T) : MutableList {} \ No newline at end of file +fun arrayListOf(vararg values: T) : MutableList {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/substitutions/kt6081SubstituteIntoClassCorrectly.kt b/compiler/testData/diagnostics/tests/inference/substitutions/kt6081SubstituteIntoClassCorrectly.kt index 43265e01c94..e8976cb2bbd 100644 --- a/compiler/testData/diagnostics/tests/inference/substitutions/kt6081SubstituteIntoClassCorrectly.kt +++ b/compiler/testData/diagnostics/tests/inference/substitutions/kt6081SubstituteIntoClassCorrectly.kt @@ -3,7 +3,7 @@ class Bar -fun bar(): Bar = null!! +fun bar(): Bar = null!! class Foo { fun add(bar: Bar): Foo {return this} diff --git a/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt b/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt index d6962f5007d..05b98feb704 100644 --- a/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/inference/typeInferenceExpectedTypeMismatch.kt @@ -7,7 +7,7 @@ fun test() { use(s) } -fun newList() : ArrayList { +fun newList() : ArrayList { return ArrayList() } diff --git a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt index f678821172a..efc30c8a7ac 100644 --- a/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt +++ b/compiler/testData/diagnostics/tests/inference/upperBounds/useBoundsToInferTypeParamsSimple.kt @@ -1,7 +1,7 @@ package a -fun foo(v: V, u: U) = u -fun bar(v: V, u: U) = u +fun foo(v: V, u: U) = u +fun bar(v: V, u: U) = u fun test(a: Any, s: String) { val b = foo(a, s) @@ -10,13 +10,13 @@ fun test(a: Any, s: String) { checkItIsExactlyAny(a, arrayListOf(c)) } -fun checkItIsExactlyAny(t: T, l: MutableList) {} +fun checkItIsExactlyAny(t: T, l: MutableList) {} -fun baz(v: V, u: MutableSet) = u +fun baz(v: V, u: MutableSet) = u fun test(a: Any, s: MutableSet) { baz(a, s) } //from standard library -fun arrayListOf(vararg t: T): MutableList {} \ No newline at end of file +fun arrayListOf(vararg t: T): MutableList {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2195.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2195.kt index 7dd8ba00326..db461dacb7d 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2195.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt2195.kt @@ -1,7 +1,7 @@ //KT-2195 error "Only safe calls are allowed ..." but it is function param (val) package foo -private fun sendCommand(errorCallback: (()->Unit)? = null) { +private fun sendCommand(errorCallback: (()->Unit)? = null) { if (errorCallback != null) { errorCallback() } diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/senslessComparisonWithNullOnTypeParameters.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/senslessComparisonWithNullOnTypeParameters.kt index f4c6fb9ec8a..73ea154b9ef 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/senslessComparisonWithNullOnTypeParameters.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/senslessComparisonWithNullOnTypeParameters.kt @@ -1,13 +1,13 @@ // The type checker used to think that T is not null no matter what the upper bound -fun nullableUpperBound(t: T, ind: INDIRECT) { +fun nullableUpperBound(t: T, ind: INDIRECT) { if (t == null) {} // was a warning if (t != null) {} // was a warning if (ind == null) {} // was a warning if (ind != null) {} // was a warning } -fun notNullUpperBound(t: T, ind: INDIRECT) { +fun notNullUpperBound(t: T, ind: INDIRECT) { if (t == null) {} // still a warning if (t != null) {} // still a warning if (ind == null) {} // still a warning diff --git a/compiler/testData/diagnostics/tests/nullableTypes/baseWithNullableUpperBound.kt b/compiler/testData/diagnostics/tests/nullableTypes/baseWithNullableUpperBound.kt index 3772081bec2..829d88a7ad1 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/baseWithNullableUpperBound.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/baseWithNullableUpperBound.kt @@ -1,24 +1,24 @@ -fun nonMisleadingNullable( +fun nonMisleadingNullable( nn: NN?, nnn: NNN? ) {} -fun twoBounds( +fun twoBounds( tb: TWO_BOUNDS? ) where TWO_BOUNDS : NN {} -fun misleadingNullableSimple( +fun misleadingNullableSimple( t: T?, t2: T?, n: N?, ind: INDIRECT? ) {} -fun misleadingNullableMultiBound( +fun misleadingNullableMultiBound( fb: FIRST_BOUND?, sb: SECOND_BOUND? ) where FIRST_BOUND: Any, SECOND_BOUND: Any? { } -fun interactionWithRedundant(t: T??) {} \ No newline at end of file +fun interactionWithRedundant(t: T??) {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/nullableTypes/redundantNullableInSupertype.kt b/compiler/testData/diagnostics/tests/nullableTypes/redundantNullableInSupertype.kt index 5c0780f4e90..62de851c105 100644 --- a/compiler/testData/diagnostics/tests/nullableTypes/redundantNullableInSupertype.kt +++ b/compiler/testData/diagnostics/tests/nullableTypes/redundantNullableInSupertype.kt @@ -3,7 +3,7 @@ interface X: A?? { } -fun interaction(t: T) { +fun interaction(t: T) { if (t == null) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/objects/kt2240.kt b/compiler/testData/diagnostics/tests/objects/kt2240.kt index 7a22ea58078..25ee044736b 100644 --- a/compiler/testData/diagnostics/tests/objects/kt2240.kt +++ b/compiler/testData/diagnostics/tests/objects/kt2240.kt @@ -4,10 +4,10 @@ package a class A {} -fun A.foo(f : T) {} +fun A.foo(f : T) {} val o = object { - fun foo(f: T) { + fun foo(f: T) { A().foo(f) // Ambiguity here! } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/collectionOrNull.kt b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/collectionOrNull.kt index 82966d7f8c0..73340ce072f 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/collectionOrNull.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/collectionOrNull.kt @@ -12,7 +12,7 @@ import p.* fun T.foo() {} -fun test(b: Boolean) { +fun test(b: Boolean) { val c = if (b) Utils.c() else null c?.foo() diff --git a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/inferenceWithBound.kt b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/inferenceWithBound.kt index 5c428db0487..4a4d125e162 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/inferenceWithBound.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/inferenceWithBound.kt @@ -38,4 +38,4 @@ fun test() { } fun Collection.foo(): T = null!! -fun listOf(t: T): List = null!! \ No newline at end of file +fun listOf(t: T): List = null!! \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/stringOrNull.kt b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/stringOrNull.kt index d7ec612e5a2..79e2df864bc 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/stringOrNull.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/commonSupertype/stringOrNull.kt @@ -12,7 +12,7 @@ import p.* fun T.foo() {} -fun test(b: Boolean) { +fun test(b: Boolean) { val str = if (b) Utils.str() else null str?.foo() diff --git a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt index 6367d8dad3f..5cf858c70fc 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/rawTypes/arrays.kt @@ -21,7 +21,7 @@ class Test { // FILE: main.kt -fun arrayOf(): Array = null!! +fun arrayOf(): Array = null!! fun main() { val raw = Test.rawAField diff --git a/compiler/testData/diagnostics/tests/redeclarations/RedeclaredTypeParameters.kt b/compiler/testData/diagnostics/tests/redeclarations/RedeclaredTypeParameters.kt index ea788f28693..d4340deb6ef 100644 --- a/compiler/testData/diagnostics/tests/redeclarations/RedeclaredTypeParameters.kt +++ b/compiler/testData/diagnostics/tests/redeclarations/RedeclaredTypeParameters.kt @@ -1,4 +1,4 @@ -fun Pair<T, T>() {} +fun <T, T> Pair() {} class P<T, T> {} diff --git a/compiler/testData/diagnostics/tests/regressions/OutProjections.kt b/compiler/testData/diagnostics/tests/regressions/OutProjections.kt index 33bc6c020b5..26bbe985f82 100644 --- a/compiler/testData/diagnostics/tests/regressions/OutProjections.kt +++ b/compiler/testData/diagnostics/tests/regressions/OutProjections.kt @@ -3,7 +3,7 @@ class Point() { class G() {} -fun f(expression : T) : G = G() +fun f(expression : T) : G = G() fun foo() : G { @@ -13,7 +13,7 @@ fun foo() : G { class Out() {} -fun fout(expression : T) : Out<out T> = Out() +fun fout(expression : T) : Out<out T> = Out() fun fooout() : Out { val p = Point(); diff --git a/compiler/testData/diagnostics/tests/regressions/kt1489_1728.kt b/compiler/testData/diagnostics/tests/regressions/kt1489_1728.kt index 633fe0e5cd0..87309b1c892 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt1489_1728.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt1489_1728.kt @@ -12,7 +12,7 @@ class C { } } - fun foo(x : X, body : (X) -> Unit) { + fun foo(x : X, body : (X) -> Unit) { } fun p() : Resource? = null diff --git a/compiler/testData/diagnostics/tests/regressions/kt2768.kt b/compiler/testData/diagnostics/tests/regressions/kt2768.kt index dee6f36065e..58dc51dedcc 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt2768.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt2768.kt @@ -1,4 +1,4 @@ -fun assertEquals(a: T, b: T) { +fun assertEquals(a: T, b: T) { if (a != b) throw AssertionError("$a != $b") } diff --git a/compiler/testData/diagnostics/tests/regressions/kt385.109.441.kt b/compiler/testData/diagnostics/tests/regressions/kt385.109.441.kt index 4a0edf60ae1..7045ffb6802 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt385.109.441.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt385.109.441.kt @@ -26,7 +26,7 @@ fun generic_invoker(gen : () -> T) : T { fun println(message : Int) { System.out.println(message) } fun println(message : Long) { System.out.println(message) } -inline fun run(body : () -> T) : T = body() +inline fun run(body : () -> T) : T = body() fun main(args : Array) { diff --git a/compiler/testData/diagnostics/tests/regressions/kt439.kt b/compiler/testData/diagnostics/tests/regressions/kt439.kt index 3ad9171de2a..dd34d7faa68 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt439.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt439.kt @@ -1,6 +1,6 @@ // KT-439 Support labeled function literals in call arguments -inline fun run1(body : () -> T) : T = body() +inline fun run1(body : () -> T) : T = body() fun main1(args : Array) { run1 l@{ 1 } // should not be an error diff --git a/compiler/testData/diagnostics/tests/regressions/kt5326.kt b/compiler/testData/diagnostics/tests/regressions/kt5326.kt index ddb458e3265..06afa18874e 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt5326.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt5326.kt @@ -4,7 +4,7 @@ class A { class Foo(i: Int) -public fun Foo(c: A) { +public fun Foo(c: A) { val a = Foo(c.size()) // Check no overload resolution ambiguity val b: Foo = Foo(c.size()) // OK val c: Foo = Foo(c.size()) // OK diff --git a/compiler/testData/diagnostics/tests/regressions/kt549.kt b/compiler/testData/diagnostics/tests/regressions/kt549.kt index e50b6e39dea..7de6508c75b 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt549.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt549.kt @@ -2,7 +2,7 @@ package demo - fun filter(list : Array, filter : (T) -> Boolean) : List { + fun filter(list : Array, filter : (T) -> Boolean) : List { val answer = java.util.ArrayList(); for (l in list) { if (filter(l)) answer.add(l) diff --git a/compiler/testData/diagnostics/tests/regressions/kt58.kt b/compiler/testData/diagnostics/tests/regressions/kt58.kt index 9ed3897e281..6b490507883 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt58.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt58.kt @@ -4,7 +4,7 @@ package kt58 import java.util.concurrent.locks.Lock -fun lock(lock : Lock, body : () -> T) : T { +fun lock(lock : Lock, body : () -> T) : T { lock.lock() try { return body() diff --git a/compiler/testData/diagnostics/tests/regressions/kt688.kt b/compiler/testData/diagnostics/tests/regressions/kt688.kt index cf68a865f4e..b29056972ba 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt688.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt688.kt @@ -6,7 +6,7 @@ open class B() : A() { class C() { - fun a(x: (T)->T, y: T): T { + fun a(x: (T)->T, y: T): T { return x(x(y)) } diff --git a/compiler/testData/diagnostics/tests/regressions/kt701.kt b/compiler/testData/diagnostics/tests/regressions/kt701.kt index 3316f214bb7..2f262b11241 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt701.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt701.kt @@ -1,9 +1,9 @@ // KT-702 Type inference failed -fun getJavaClass() : java.lang.Class { return "" as Class } +fun getJavaClass() : java.lang.Class { return "" as Class } public class Throwables() { companion object { - public fun propagateIfInstanceOf(throwable : Throwable?, declaredType : Class?>?) { + public fun propagateIfInstanceOf(throwable : Throwable?, declaredType : Class?>?) { if (((throwable != null) && declaredType?.isInstance(throwable)!!)) { throw declaredType?.cast(throwable)!! diff --git a/compiler/testData/diagnostics/tests/regressions/kt716.kt b/compiler/testData/diagnostics/tests/regressions/kt716.kt index 6080f624ce2..b1582f70182 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt716.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt716.kt @@ -9,7 +9,7 @@ fun TypeInfo.getJavaClass() : java.lang.Class { return t.getClass() as java.lang.Class // inferred type is Object but Serializable was expected } -fun getJavaClass() = typeinfo().getJavaClass() +fun getJavaClass() = typeinfo().getJavaClass() fun main(args : Array) { System.out.println(getJavaClass()) diff --git a/compiler/testData/diagnostics/tests/regressions/kt743.kt b/compiler/testData/diagnostics/tests/regressions/kt743.kt index 4d29b36c57d..aec66570b8a 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt743.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt743.kt @@ -4,4 +4,4 @@ class List(val head: T, val tail: List? = null) fun T?.sure() : T = this!! fun List.map(f: (T)-> Q): List? = tail.sure>().map(f) -fun foo(t : T) : T = foo(t) +fun foo(t : T) : T = foo(t) diff --git a/compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt b/compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt index 6c2ba39d404..c342c179705 100644 --- a/compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt +++ b/compiler/testData/diagnostics/tests/resolve/inferenceInLinkedLambdasDependentOnExpectedType.kt @@ -2,6 +2,6 @@ fun foo(f: () -> Collection, p: (T) -> Boolean): Collection = throw Exception() -fun emptyList(): List = throw Exception() +fun emptyList(): List = throw Exception() fun test(): Collection = foo({ emptyList() }, { x -> x > 0 }) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.kt b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.kt index 4a569a2702a..6fc9e121638 100644 --- a/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.kt +++ b/compiler/testData/diagnostics/tests/resolve/nestedCalls/completeTypeInferenceForNestedInNoneApplicable.kt @@ -7,4 +7,4 @@ fun test() { foo(emptyList()) } -fun emptyList(): List {throw Exception()} \ No newline at end of file +fun emptyList(): List {throw Exception()} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt index 202c66c8f39..93a230cabef 100644 --- a/compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt +++ b/compiler/testData/diagnostics/tests/resolve/resolveWithFunctionLiteralWithId.kt @@ -15,7 +15,7 @@ fun foo(s: String, f: (String, String)->Int) = f(s, s) //appropriate function fun foo(i: Int, f: (Int)->Int) = f(i) -fun id(t: T) = t +fun id(t: T) = t fun test() { foo(1, id { x1 -> diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt index c29964cb005..8477b65463f 100644 --- a/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt +++ b/compiler/testData/diagnostics/tests/resolve/resolveWithGenerics.kt @@ -6,12 +6,12 @@ class A { } //inappropriate but participating in resolve functions -fun foo(a: T, b: T, i: Int) = a +fun foo(a: T, b: T, i: Int) = a fun foo(a: Any) = a -fun foo(a: T, b: String) = a -fun foo(a: T, b: T, s: String) = a +fun foo(a: T, b: String) = a +fun foo(a: T, b: T, s: String) = a //appropriate function -fun foo(a: T, b: T) = a +fun foo(a: T, b: T) = a fun test(a: A) { //the problem occurs if there are nested function invocations to resolve (resolve for them is repeated now) diff --git a/compiler/testData/diagnostics/tests/resolve/resolveWithSpecifiedFunctionLiteralWithId.kt b/compiler/testData/diagnostics/tests/resolve/resolveWithSpecifiedFunctionLiteralWithId.kt index ad2dc2764be..faed3c66d29 100644 --- a/compiler/testData/diagnostics/tests/resolve/resolveWithSpecifiedFunctionLiteralWithId.kt +++ b/compiler/testData/diagnostics/tests/resolve/resolveWithSpecifiedFunctionLiteralWithId.kt @@ -18,7 +18,7 @@ fun foo(a: Any, f: (Any) -> Int) = f(a) //appropriate function fun foo(i: Int, f: (Int) -> Int) = f(i) -fun id(t: T) = t +fun id(t: T) = t fun test() { foo(1, id(fun(x1: Int) = diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.kt index d8ee70a052b..4868d1058f5 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/intersectionTypes.kt @@ -55,6 +55,6 @@ fun rr(s: String?) { } //from library -fun arrayListOf(vararg values: T): MutableList = throw Exception() +fun arrayListOf(vararg values: T): MutableList = throw Exception() fun use(vararg a: Any) = a \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt index 930f44a6ffc..68c1624d0bf 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt @@ -35,6 +35,6 @@ public data class Tag(public var tagName: String) { //from library operator fun MutableMap.set(key : K, value : V) = this.put(key, value) -fun arrayListOf(vararg values: T): MutableList = throw Exception() +fun arrayListOf(vararg values: T): MutableList = throw Exception() diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt index c74a86ca4af..33c75b8cc71 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt @@ -9,7 +9,7 @@ fun test1(a: Any) { } -fun f(t :T): C = C(t) +fun f(t :T): C = C(t) fun test2(a: Any) { if (a is String) { diff --git a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt index 72fdca57d20..95905d6af36 100644 --- a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithAmbiguity.kt @@ -1,14 +1,14 @@ // FILE: foo.kt package foo -fun f(l: List) {} +fun f(l: List) {} // FILE: main.kt import foo.* -fun f(l: List) {} +fun f(l: List) {} -fun test(l: List) { +fun test(l: List) { f(l) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithErrorTypes.kt b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithErrorTypes.kt index 1db8a1a232e..c11f367f9d7 100644 --- a/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithErrorTypes.kt +++ b/compiler/testData/diagnostics/tests/substitutions/upperBoundsSubstitutionForOverloadResolutionWithErrorTypes.kt @@ -1,8 +1,8 @@ // !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS -UNUSED_PARAMETER -fun f1(l: List1): T {throw Exception()} // ERROR type here -fun f1(l: List2): T {throw Exception()} // ERROR type here -fun f1(c: Collection): T{throw Exception()} +fun f1(l: List1): T {throw Exception()} // ERROR type here +fun f1(l: List2): T {throw Exception()} // ERROR type here +fun f1(c: Collection): T{throw Exception()} -fun test(l: List) { +fun test(l: List) { f1(l) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/subtyping/localClasses.kt b/compiler/testData/diagnostics/tests/subtyping/localClasses.kt index cba517113e2..4683bd66ceb 100644 --- a/compiler/testData/diagnostics/tests/subtyping/localClasses.kt +++ b/compiler/testData/diagnostics/tests/subtyping/localClasses.kt @@ -2,7 +2,7 @@ package p -fun run(f: () -> T): T { +fun run(f: () -> T): T { return f() } diff --git a/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt b/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt index 29a83e8f77d..4154728c38f 100644 --- a/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt +++ b/compiler/testData/diagnostics/tests/subtyping/nestedIntoLocalClasses.kt @@ -2,7 +2,7 @@ package p -fun run(f: () -> T): T { +fun run(f: () -> T): T { return f() } diff --git a/compiler/testData/diagnostics/tests/subtyping/nestedLocalClasses.kt b/compiler/testData/diagnostics/tests/subtyping/nestedLocalClasses.kt index 61f73e2d348..35c5df482d8 100644 --- a/compiler/testData/diagnostics/tests/subtyping/nestedLocalClasses.kt +++ b/compiler/testData/diagnostics/tests/subtyping/nestedLocalClasses.kt @@ -2,7 +2,7 @@ package p -fun run(f: () -> T): T { +fun run(f: () -> T): T { return f() } diff --git a/compiler/testData/diagnostics/tests/typeParameters/deprecatedSyntax.kt b/compiler/testData/diagnostics/tests/typeParameters/deprecatedSyntax.kt new file mode 100644 index 00000000000..fc02f6c51d8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/deprecatedSyntax.kt @@ -0,0 +1,2 @@ +fun foo() { +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/typeParameters/deprecatedSyntax.txt b/compiler/testData/diagnostics/tests/typeParameters/deprecatedSyntax.txt new file mode 100644 index 00000000000..a866f4ba05b --- /dev/null +++ b/compiler/testData/diagnostics/tests/typeParameters/deprecatedSyntax.txt @@ -0,0 +1,3 @@ +package + +public fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/varargs/kt422.kt b/compiler/testData/diagnostics/tests/varargs/kt422.kt index c363fcd1839..fa5791cae47 100644 --- a/compiler/testData/diagnostics/tests/varargs/kt422.kt +++ b/compiler/testData/diagnostics/tests/varargs/kt422.kt @@ -1,6 +1,6 @@ // KT-422 Tune literal typing rules so that varargs overloaded by primitive types work -fun foo(vararg t : T) = t +fun foo(vararg t : T) = t fun foo(vararg a: Int) = a fun foo(vararg a: Long) = a diff --git a/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt b/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt index 6126b2c7ba8..51583b0e413 100644 --- a/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt +++ b/compiler/testData/diagnostics/tests/varargs/varargsAndPair.kt @@ -1,6 +1,6 @@ // !CHECK_TYPE -fun foo(vararg ts: T): T? = null +fun foo(vararg ts: T): T? = null class Pair(a: A) diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/block.kt b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/block.kt index 616b2f42fa0..b596dadb1bd 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/block.kt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/block.kt @@ -7,7 +7,7 @@ fun test() { } } -fun dynamic(body: dynamic.() -> T): T { +fun dynamic(body: dynamic.() -> T): T { val topLevel = null return topLevel.body() } \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/ea63992.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/ea63992.kt index 0e41e5068ba..6fdd50da1ad 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/ea63992.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/ea63992.kt @@ -1,7 +1,7 @@ fun add(a: Int, b: Int) = a + b interface A { - fun shuffle(x: List): List - fun foo(f : (List) -> List, x : List) + fun shuffle(x: List): List + fun foo(f : (List) -> List, x : List) fun f() : (Int, Int) -> Int = ::add } \ No newline at end of file diff --git a/compiler/testData/type-checker-test.kt b/compiler/testData/type-checker-test.kt index 969e628f26f..aca9c5de82b 100644 --- a/compiler/testData/type-checker-test.kt +++ b/compiler/testData/type-checker-test.kt @@ -21,7 +21,7 @@ class Functions() { fun f(a : Int) : Int {} fun f(a : T) : Any {} fun f(a : Pair) : T {} - fun f(a : E) : T {} + fun f(a : E) : T {} } class WithPredicate() { fun isValid() : Boolean @@ -36,7 +36,7 @@ open class ArrayList() : Any, AbstractList, InvList fun f() : Unit {} fun f(a : Int) : Int {a} fun f(a : Float, b : Int) : Float {a} -fun f(a : Float) : T {a} +fun f(a : Float) : T {a} interface Parent interface A: Parent diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index d60d2dcf794..21de1c6441e 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -15405,6 +15405,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/typeParameters"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("deprecatedSyntax.kt") + public void testDeprecatedSyntax() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typeParameters/deprecatedSyntax.kt"); + doTest(fileName); + } + @TestMetadata("upperBoundCannotBeArray.kt") public void testUpperBoundCannotBeArray() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typeParameters/upperBoundCannotBeArray.kt"); diff --git a/idea/testData/checker/Bounds2.kt b/idea/testData/checker/Bounds2.kt index c53d78acb4b..664abc071d2 100644 --- a/idea/testData/checker/Bounds2.kt +++ b/idea/testData/checker/Bounds2.kt @@ -8,6 +8,6 @@ fun test() { 1.buzz<Double>() } -fun foo() {} -fun bar() {} +fun foo() {} +fun bar() {} fun Int> Int.buzz() : Unit {} diff --git a/idea/testData/checker/Builders.kt b/idea/testData/checker/Builders.kt index bc228db3304..92e46536007 100644 --- a/idea/testData/checker/Builders.kt +++ b/idea/testData/checker/Builders.kt @@ -14,7 +14,7 @@ import java.util.* val children = ArrayList() val attributes = HashMap() - protected fun initTag(init : T.() -> Unit) : T + protected fun initTag(init : T.() -> Unit) : T { val tag = T.create() tag.init() diff --git a/idea/testData/checker/PackageQualified.kt b/idea/testData/checker/PackageQualified.kt index e0f8f27b80c..45e1dcc1524 100644 --- a/idea/testData/checker/PackageQualified.kt +++ b/idea/testData/checker/PackageQualified.kt @@ -5,7 +5,7 @@ package a ///////////////////////////////////////////////////////////////////////// -fun done(result : O) : Iteratee = StrangeIterateeImpl(result) +fun done(result : O) : Iteratee = StrangeIterateeImpl(result) abstract class Iteratee { abstract fun process(item : I) : Iteratee @@ -31,7 +31,7 @@ abstract class Sum() : Iteratee() { } abstract class Collection : Iterable { - fun iterate(iteratee : Iteratee) : O { + fun iterate(iteratee : Iteratee) : O { var current = iteratee for (x in this) { val it = current.process(x) diff --git a/idea/testData/checker/Redeclaration.kt b/idea/testData/checker/Redeclaration.kt index 4a26b5d71e0..26b2c75e6ab 100644 --- a/idea/testData/checker/Redeclaration.kt +++ b/idea/testData/checker/Redeclaration.kt @@ -23,7 +23,7 @@ object B { class C } -fun PairParam<T, T>() {} +fun <T, T> PairParam() {} class PParam<T, T> {} val <T, T> T.fooParam : Int get() = 1 diff --git a/idea/testData/checker/regression/createInnerInstance.kt b/idea/testData/checker/regression/createInnerInstance.kt index 87e54895934..fc1249427a2 100644 --- a/idea/testData/checker/regression/createInnerInstance.kt +++ b/idea/testData/checker/regression/createInnerInstance.kt @@ -4,7 +4,7 @@ object A { object Bar{} } -fun test(a: T) { +fun test(a: T) { val c = (a as A) c.B() } \ No newline at end of file