SAM constructors for type aliases.
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
// FILE: test.kt
|
||||
typealias RunnableT = java.lang.Runnable
|
||||
typealias ComparatorT<T> = java.util.Comparator<T>
|
||||
typealias ComparatorStrT = ComparatorT<String>
|
||||
|
||||
val test1 = RunnableT { }
|
||||
val test2 = ComparatorT<String> { s1, s2 -> s1.compareTo(s2) }
|
||||
val test3 = ComparatorStrT { s1, s2 -> s1.compareTo(s2) }
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package
|
||||
|
||||
public val test1: java.lang.Runnable
|
||||
public val test2: java.util.Comparator<kotlin.String>
|
||||
public val test3: ComparatorT<kotlin.String> /* = java.util.Comparator<kotlin.String> */
|
||||
public typealias ComparatorStrT = ComparatorT<kotlin.String>
|
||||
public typealias ComparatorT</*0*/ T> = java.util.Comparator<T>
|
||||
public typealias RunnableT = java.lang.Runnable
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// FILE: JHost.java
|
||||
public class JHost {
|
||||
public static interface Runnable {
|
||||
void run();
|
||||
}
|
||||
|
||||
public static interface Consumer<T> {
|
||||
void consume(T x);
|
||||
}
|
||||
|
||||
public static interface Consumer2<T1, T2> {
|
||||
void run(T1 x1, T2 x2);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
typealias R = JHost.Runnable
|
||||
typealias C<T> = JHost.Consumer<T>
|
||||
typealias CStr = JHost.Consumer<String>
|
||||
typealias CStrList = JHost.Consumer<List<String>>
|
||||
typealias C2<T> = JHost.Consumer2<T, T>
|
||||
|
||||
val test1 = R { }
|
||||
val test2 = C<String> { s -> println(s.length) }
|
||||
val test3 = CStr { s -> println(s.length) }
|
||||
val test4 = CStrList { ss -> for (s in ss) { println(s.length) } }
|
||||
val test5 = C2<Int> { a, b -> val x: Int = a + b; println(x)}
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
package
|
||||
|
||||
public val test1: JHost.Runnable
|
||||
public val test2: JHost.Consumer<kotlin.String>
|
||||
public val test3: JHost.Consumer<kotlin.String>
|
||||
public val test4: JHost.Consumer<kotlin.collections.List<kotlin.String>>
|
||||
public val test5: JHost.Consumer2<kotlin.Int, kotlin.Int>
|
||||
|
||||
public open class JHost {
|
||||
public constructor JHost()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public interface Consumer</*0*/ T : kotlin.Any!> {
|
||||
public abstract fun consume(/*0*/ x: T!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Consumer2</*0*/ T1 : kotlin.Any!, /*1*/ T2 : kotlin.Any!> {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract fun run(/*0*/ x1: T1!, /*1*/ x2: T2!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Runnable {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract fun run(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun </*0*/ T : kotlin.Any!> Consumer(/*0*/ function: (T!) -> kotlin.Unit): JHost.Consumer<T>
|
||||
public final /*synthesized*/ fun </*0*/ T1 : kotlin.Any!, /*1*/ T2 : kotlin.Any!> Consumer2(/*0*/ function: (T1!, T2!) -> kotlin.Unit): JHost.Consumer2<T1, T2>
|
||||
public final /*synthesized*/ fun Runnable(/*0*/ function: () -> kotlin.Unit): JHost.Runnable
|
||||
}
|
||||
public typealias C</*0*/ T> = JHost.Consumer<T>
|
||||
public typealias C2</*0*/ T> = JHost.Consumer2<T, T>
|
||||
public typealias CStr = JHost.Consumer<kotlin.String>
|
||||
public typealias CStrList = JHost.Consumer<kotlin.collections.List<kotlin.String>>
|
||||
public typealias R = JHost.Runnable
|
||||
Reference in New Issue
Block a user