Fix tests: "Placing function type parameters after the function name" error

This commit is contained in:
Yan Zhulanow
2015-11-26 15:56:31 +03:00
parent 3001af56c9
commit a3ff3ffc45
435 changed files with 550 additions and 569 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
fun foo<T: Number?>(t: T) {
fun <T: Number?> foo(t: T) {
(t ?: 42).toInt()
}
+1 -1
View File
@@ -1,4 +1,4 @@
fun foo<T : Number?>(t: T) {
fun <T : Number?> foo(t: T) {
t?.toInt()
}
+1 -1
View File
@@ -1,6 +1,6 @@
fun isNull(x: Unit?) = x == null
fun isNullGeneric<T : Any>(x: T?) = x == null
fun <T : Any> isNullGeneric(x: T?) = x == null
fun deepIsNull0(x: Unit?) = isNull(x)
fun deepIsNull(x: Unit?) = deepIsNull0(x)
+2 -2
View File
@@ -23,7 +23,7 @@ abstract class Tag(val name: String) : Element() {
val children = ArrayList<Element>()
val attributes = HashMap<String, String>()
inline protected fun initTag<T : Element>(tag: T, init: T.() -> Unit): T {
inline protected fun <T : Element> initTag(tag: T, init: T.() -> Unit): T {
tag.init()
children.add(tag)
return tag
@@ -47,7 +47,7 @@ abstract class Tag(val name: String) : Element() {
}
abstract class TagWithText(name: String) : Tag(name) {
fun String.plus() {
operator fun String.unaryPlus() {
children.add(TextElement(this))
}
}
@@ -23,7 +23,7 @@ abstract class Tag(val name: String) : Element() {
val children = ArrayList<Element>()
val attributes = HashMap<String, String>()
inline protected fun initTag<T : Element>(tag: T, init: T.() -> Unit): T {
inline protected fun <T : Element> initTag(tag: T, init: T.() -> Unit): T {
tag.init()
children.add(tag)
return tag
@@ -47,7 +47,7 @@ abstract class Tag(val name: String) : Element() {
}
abstract class TagWithText(name: String) : Tag(name) {
fun String.plus() {
operator fun String.unaryPlus() {
children.add(TextElement(this))
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
package test
inline fun test<reified T>(x: Any): Boolean {
inline fun <reified T> test(x: Any): Boolean {
val x = object {
val y = x is T
}
+1 -1
View File
@@ -1,5 +1,5 @@
package test
inline fun f<reified T>(x : () -> Unit) {
inline fun <reified T> f(x : () -> Unit) {
object { init { arrayOf<T>() } }
}
@@ -4,7 +4,7 @@ fun <T> test2(): T {
return a as T
}
fun test3<T: Any>() = null as T
fun <T: Any> test3() = null as T
fun box(): String {
if (test1<Int?>() != null) return "fail: test1"
@@ -1,5 +1,5 @@
inline fun calc<T, R>(value : T, fn: (T)->R) : R = fn(value)
inline fun <T, R> calc(value : T, fn: (T) -> R) : R = fn(value)
inline fun <T> identity(value : T) : T = calc(value) {
if (1 == 1) return it
it
@@ -1 +1 @@
fun foo<T : Any>(t: T) = t
fun <T : Any> foo(t: T) = t
+1 -1
View File
@@ -1,4 +1,4 @@
fun foo<T, P, E>() = 42
fun <T, P, E> foo() = 42
interface A
interface B : A
@@ -8,7 +8,7 @@ class FC1: OC2(), T3
interface T4: <!INTERFACE_WITH_SUPERCLASS!>OC1<!>
interface T5: T2
fun test<TP1: OC1, TP2: T2, TP3: OC2>(
fun <TP1: OC1, TP2: T2, TP3: OC2> test(
t2: T2,
t4: T4,
fc1: FC1,
@@ -6,7 +6,7 @@ open class OClass2
class FClass1
class FClass2
fun test<TP1: OClass1, TP2: OClass2>(
fun <TP1: OClass1, TP2: OClass2> test(
t1: Trait1,
oc1: OClass1,
fc1: FClass1,
@@ -2,7 +2,7 @@ package test
class MembersReferenceOuterTP<P> {
inner class Inner {
fun f<Q : P>() {}
fun <Q : P> f() {}
fun g(p: P): P = null!!
val v: P = null!!
+1 -1
View File
@@ -1,4 +1,4 @@
inline fun with<T>(receiver : T, body : T.() -> Unit) = receiver.body()
inline fun <T> with(receiver : T, body : T.() -> Unit) = receiver.body()
fun example() {
+2 -1
View File
@@ -9,12 +9,13 @@ JetFile: With.kt
PsiWhiteSpace(' ')
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('with')
TYPE_PARAMETER_LIST
PsiElement(LT)('<')
TYPE_PARAMETER
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('with')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
+1 -1
View File
@@ -8,7 +8,7 @@ open class ICloseable {
abstract class JavaCloseableWrapper(closeable : java.io.Closeable) : ICloseable(closeable)
fun streamCopy<T>(from : IIterable<T>, to : IAdder<T>) {
fun <T> streamCopy(from : IIterable<T>, to : IAdder<T>) {
for (item in from) t.add(item)
}
+3 -2
View File
@@ -117,12 +117,13 @@ JetFile: IOSamples.kt
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('streamCopy')
TYPE_PARAMETER_LIST
PsiElement(LT)('<')
TYPE_PARAMETER
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('streamCopy')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
@@ -599,4 +600,4 @@ JetFile: IOSamples.kt
PsiWhiteSpace(' ')
PsiComment(EOL_COMMENT)('// throws IOException, you must catch or rethrow explicitly')
PsiWhiteSpace('\n\n')
PsiElement(RBRACE)('}')
PsiElement(RBRACE)('}')
+1 -1
View File
@@ -10,7 +10,7 @@ enum class ComparisonResult {
typealias MatchableComparison<in T> = (T, T) -> ComparisonResult
fun asMatchableComparison<T>(cmp : Comparison<T>) : MatchableComparison<T> = {a, b ->
fun <T> asMatchableComparison(cmp : Comparison<T>) : MatchableComparison<T> = {a, b ->
val res = cmp(a, b)
if (res == 0) return ComparisonResult.EQ
if (res < 0) return ComparisonResult.LS
+2 -1
View File
@@ -273,12 +273,13 @@ JetFile: Comparison.kt
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('asMatchableComparison')
TYPE_PARAMETER_LIST
PsiElement(LT)('<')
TYPE_PARAMETER
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('asMatchableComparison')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
@@ -7,5 +7,5 @@ fun ((T) -> G)?.foo()
fun ((T) -> G)??.foo()
//--------------
fun f<T>()
fun <T> f()
a.b class C
@@ -418,12 +418,13 @@ JetFile: FunctionsWithFunctionReceivers.kt
PsiWhiteSpace('\n')
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('f')
TYPE_PARAMETER_LIST
PsiElement(LT)('<')
TYPE_PARAMETER
PsiElement(IDENTIFIER)('T')
PsiElement(GT)('>')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('f')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -438,4 +439,4 @@ JetFile: FunctionsWithFunctionReceivers.kt
CLASS
PsiElement(class)('class')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('C')
PsiElement(IDENTIFIER)('C')
@@ -19,7 +19,7 @@ c<t>.
//-----------
class A<X> {
fun foo<Y>() {
fun <Y> foo() {
}
}
@@ -537,12 +537,13 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
TYPE_PARAMETER_LIST
PsiElement(LT)('<')
TYPE_PARAMETER
PsiElement(IDENTIFIER)('Y')
PsiElement(GT)('>')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
@@ -600,4 +601,4 @@ JetFile: FunctionsWithFunctionReceiversRecovery.kt
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiElement(RBRACE)('}')