[Tests] Test samples from KEEP
This commit is contained in:
committed by
TeamCityServer
parent
b0a7be72e8
commit
d8faa9686d
+33
@@ -0,0 +1,33 @@
|
||||
// FIR_IDENTICAL
|
||||
class File(name: String)
|
||||
interface InputStream
|
||||
|
||||
interface AutoCloseScope {
|
||||
fun defer(closeBlock: () -> Unit)
|
||||
fun close()
|
||||
}
|
||||
class AutoCloseScopeImpl : AutoCloseScope {
|
||||
override fun defer(closeBlock: () -> Unit) = TODO()
|
||||
override fun close() = TODO()
|
||||
}
|
||||
|
||||
context(AutoCloseScope)
|
||||
fun File.open(): InputStream = TODO()
|
||||
|
||||
fun withAutoClose(block: context(AutoCloseScope) () -> Unit) {
|
||||
val scope = AutoCloseScopeImpl() // Not shown here
|
||||
try {
|
||||
with(scope) { block() }
|
||||
} finally {
|
||||
scope.close()
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
withAutoClose {
|
||||
val input = File("input.txt").open()
|
||||
val config = File("config.txt").open()
|
||||
// Work
|
||||
// All files are closed at the end
|
||||
}
|
||||
}
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
public fun withAutoClose(/*0*/ block: @kotlin.ContextFunctionTypeParams(count = 1) () -> kotlin.Unit): kotlin.Unit
|
||||
public fun File.open(): InputStream
|
||||
|
||||
public interface AutoCloseScope {
|
||||
public abstract fun close(): kotlin.Unit
|
||||
public abstract fun defer(/*0*/ closeBlock: () -> kotlin.Unit): 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 final class AutoCloseScopeImpl : AutoCloseScope {
|
||||
public constructor AutoCloseScopeImpl()
|
||||
public open override /*1*/ fun close(): kotlin.Nothing
|
||||
public open override /*1*/ fun defer(/*0*/ closeBlock: () -> kotlin.Unit): kotlin.Nothing
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class File {
|
||||
public constructor File(/*0*/ name: kotlin.String)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface InputStream {
|
||||
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
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
interface Canvas
|
||||
|
||||
interface Shape {
|
||||
context(Canvas)
|
||||
fun draw(): Unit
|
||||
}
|
||||
|
||||
class Circle : Shape {
|
||||
context(Canvas)
|
||||
override fun draw() {}
|
||||
}
|
||||
|
||||
object MyCanvas : Canvas
|
||||
|
||||
fun test() = with(MyCanvas) { Circle().draw() }
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
|
||||
public interface Canvas {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Circle : Shape {
|
||||
public constructor Circle()
|
||||
public open override /*1*/ fun draw(): 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 object MyCanvas : Canvas {
|
||||
private constructor MyCanvas()
|
||||
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 Shape {
|
||||
public abstract fun draw(): 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
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
data class Pair<A, B>(val first: A, val second: B)
|
||||
|
||||
context(Comparator<T>)
|
||||
infix <!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun <T> T.compareTo(other: T) = <!UNRESOLVED_REFERENCE!>compare<!>(this, other)
|
||||
|
||||
context(Comparator<T>)
|
||||
val <T> Pair<T, T>.max get() = if (first > second) first else second
|
||||
|
||||
fun test() {
|
||||
val comparator = Comparator<String> { a, b ->
|
||||
if (a == null || b == null) 0 else a.length.compareTo(b.length)
|
||||
}
|
||||
with(comparator) {
|
||||
Pair("OK", "fail").max
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
data class Pair<A, B>(val first: A, val second: B)
|
||||
|
||||
context(Comparator<T>)
|
||||
infix operator fun <T> T.compareTo(other: T) = compare(this, other)
|
||||
|
||||
context(Comparator<T>)
|
||||
val <T> Pair<T, T>.max get() = if (first > second) first else second
|
||||
|
||||
fun test() {
|
||||
val comparator = Comparator<String> { a, b ->
|
||||
if (a == null || b == null) 0 else a.length.compareTo(b.length)
|
||||
}
|
||||
with(comparator) {
|
||||
Pair("OK", "fail").max
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package
|
||||
|
||||
public val </*0*/ T> Pair<T, T>.max: T
|
||||
public fun test(): kotlin.Unit
|
||||
public infix operator fun </*0*/ T> T.compareTo(/*0*/ other: T): kotlin.Int
|
||||
|
||||
public final data class Pair</*0*/ A, /*1*/ B> {
|
||||
public constructor Pair</*0*/ A, /*1*/ B>(/*0*/ first: A, /*1*/ second: B)
|
||||
public final val first: A
|
||||
public final val second: B
|
||||
public final operator /*synthesized*/ fun component1(): A
|
||||
public final operator /*synthesized*/ fun component2(): B
|
||||
public final /*synthesized*/ fun copy(/*0*/ first: A = ..., /*1*/ second: B = ...): Pair<A, B>
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun List<Int>.decimateEveryEvenThird() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
|
||||
var counter = 1
|
||||
for (e in <!ITERATOR_AMBIGUITY!>this<!UNRESOLVED_LABEL!>@List<!><!>) {
|
||||
if (e <!NONE_APPLICABLE!>%<!> 2 == 0 && counter % 3 == 0) {
|
||||
yield(e)
|
||||
}
|
||||
counter += 1
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun List<Int>.decimateEveryEvenThird() = sequence {
|
||||
var counter = 1
|
||||
for (e in this@List) {
|
||||
if (e % 2 == 0 && counter % 3 == 0) {
|
||||
yield(e)
|
||||
}
|
||||
counter += 1
|
||||
}
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
public fun kotlin.collections.List<kotlin.Int>.decimateEveryEvenThird(): kotlin.sequences.Sequence<kotlin.Int>
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
typealias IterableClass<C, T> = (C) -> Iterator<T>
|
||||
|
||||
context(IterableClass<C, T>)
|
||||
fun <C, T> C.iterator(any: Any?): Iterator<T> = this<!UNRESOLVED_LABEL!>@IterableClass<!>.invoke(this)
|
||||
|
||||
fun <T> listOf(vararg items: T): List<T> = null!!
|
||||
|
||||
fun test() {
|
||||
val f: IterableClass<List<Int>, Int> = {
|
||||
it.listIterator()
|
||||
}
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>with<!>(f) {
|
||||
listOf(1, 2, 3).iterator(null)
|
||||
}
|
||||
listOf(1, 2, 3).<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>iterator<!>(null)
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
typealias IterableClass<C, T> = (C) -> Iterator<T>
|
||||
|
||||
context(IterableClass<C, T>)
|
||||
fun <C, T> C.iterator(any: Any?): Iterator<T> = this@IterableClass.invoke(this)
|
||||
|
||||
fun <T> listOf(vararg items: T): List<T> = null!!
|
||||
|
||||
fun test() {
|
||||
val f: IterableClass<List<Int>, Int> = {
|
||||
it.listIterator()
|
||||
}
|
||||
with(f) {
|
||||
listOf(1, 2, 3).iterator(null)
|
||||
}
|
||||
listOf(1, 2, 3).<!NO_CONTEXT_RECEIVER!><!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>iterator<!>(null)<!>
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> listOf(/*0*/ vararg items: T /*kotlin.Array<out T>*/): kotlin.collections.List<T>
|
||||
public fun test(): kotlin.Unit
|
||||
public fun </*0*/ C, /*1*/ T> C.iterator(/*0*/ any: kotlin.Any?): kotlin.collections.Iterator<T>
|
||||
public typealias IterableClass</*0*/ C, /*1*/ T> = (C) -> kotlin.collections.Iterator<T>
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
class JSONObject {
|
||||
fun build(): JSONObject = TODO()
|
||||
|
||||
fun put(key: String, any: Any): Unit = TODO()
|
||||
}
|
||||
|
||||
fun json(build: JSONObject.() -> Unit) = JSONObject().apply { build() }
|
||||
|
||||
context(JSONObject)
|
||||
infix fun String.by(build: JSONObject.() -> Unit) = <!UNRESOLVED_REFERENCE!>put<!>(this, JSONObject().build())
|
||||
|
||||
context(JSONObject)
|
||||
infix fun String.by(value: Any) = <!UNRESOLVED_REFERENCE!>put<!>(this, value)
|
||||
|
||||
fun test() {
|
||||
val json = json {
|
||||
"name" by "Kotlin"
|
||||
"age" by 10
|
||||
"creator" by {
|
||||
"name" by "JetBrains"
|
||||
"age" by "21"
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
class JSONObject {
|
||||
fun build(): JSONObject = TODO()
|
||||
|
||||
fun put(key: String, any: Any): Unit = TODO()
|
||||
}
|
||||
|
||||
fun json(build: JSONObject.() -> Unit) = JSONObject().apply { build() }
|
||||
|
||||
context(JSONObject)
|
||||
infix fun String.by(build: JSONObject.() -> Unit) = put(this, JSONObject().build())
|
||||
|
||||
context(JSONObject)
|
||||
infix fun String.by(value: Any) = put(this, value)
|
||||
|
||||
fun test() {
|
||||
val json = json {
|
||||
"name" by "Kotlin"
|
||||
"age" by 10
|
||||
"creator" by {
|
||||
"name" by "JetBrains"
|
||||
"age" by "21"
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
public fun json(/*0*/ build: JSONObject.() -> kotlin.Unit): JSONObject
|
||||
public fun test(): kotlin.Unit
|
||||
public infix fun kotlin.String.by(/*0*/ build: JSONObject.() -> kotlin.Unit): kotlin.Unit
|
||||
public infix fun kotlin.String.by(/*0*/ value: kotlin.Any): kotlin.Unit
|
||||
|
||||
public final class JSONObject {
|
||||
public constructor JSONObject()
|
||||
public final fun build(): JSONObject
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun put(/*0*/ key: kotlin.String, /*1*/ any: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
interface Params
|
||||
interface Logger {
|
||||
fun info(message: String)
|
||||
}
|
||||
interface LoggingContext {
|
||||
val log: Logger // this context provides reference to logger
|
||||
}
|
||||
|
||||
context(LoggingContext)
|
||||
fun performSomeBusinessOperation(withParams: Params) {
|
||||
<!UNRESOLVED_REFERENCE!>log<!>.info("Operation has started")
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
interface Params
|
||||
interface Logger {
|
||||
fun info(message: String)
|
||||
}
|
||||
interface LoggingContext {
|
||||
val log: Logger // this context provides reference to logger
|
||||
}
|
||||
|
||||
context(LoggingContext)
|
||||
fun performSomeBusinessOperation(withParams: Params) {
|
||||
log.info("Operation has started")
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
package
|
||||
|
||||
public fun performSomeBusinessOperation(/*0*/ withParams: Params): kotlin.Unit
|
||||
|
||||
public interface Logger {
|
||||
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 info(/*0*/ message: kotlin.String): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface LoggingContext {
|
||||
public abstract val log: Logger
|
||||
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 Params {
|
||||
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
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
interface Semigroup<T> {
|
||||
infix fun T.combine(other: T): T
|
||||
}
|
||||
|
||||
interface Monoid<T> : Semigroup<T> {
|
||||
val unit: T
|
||||
}
|
||||
object IntMonoid : Monoid<Int> {
|
||||
override fun Int.combine(other: Int): Int = this + other
|
||||
override val unit: Int = 0
|
||||
}
|
||||
object StringMonoid : Monoid<String> {
|
||||
override fun String.combine(other: String): String = this + other
|
||||
override val unit: String = ""
|
||||
}
|
||||
|
||||
public inline fun <T, R> Iterable<T>.fold(initial: R, operation: (acc: R, T) -> R): R = TODO()
|
||||
|
||||
context(Monoid<T>)
|
||||
fun <T> List<T>.sum(): T = fold(<!ARGUMENT_TYPE_MISMATCH, UNRESOLVED_REFERENCE!>unit<!>) { acc, e -> acc.<!UNRESOLVED_REFERENCE!>combine<!>(e) }
|
||||
|
||||
fun <T> listOf(vararg items: T): List<T> = null!!
|
||||
|
||||
fun test() {
|
||||
with(IntMonoid) {
|
||||
listOf(1, 2, 3).sum()
|
||||
}
|
||||
with(StringMonoid) {
|
||||
listOf(1, 2, 3).sum()
|
||||
listOf("1", "2", "3").sum()
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
interface Semigroup<T> {
|
||||
infix fun T.combine(other: T): T
|
||||
}
|
||||
|
||||
interface Monoid<T> : Semigroup<T> {
|
||||
val unit: T
|
||||
}
|
||||
object IntMonoid : Monoid<Int> {
|
||||
override fun Int.combine(other: Int): Int = this + other
|
||||
override val unit: Int = 0
|
||||
}
|
||||
object StringMonoid : Monoid<String> {
|
||||
override fun String.combine(other: String): String = this + other
|
||||
override val unit: String = ""
|
||||
}
|
||||
|
||||
public inline fun <T, R> Iterable<T>.fold(initial: R, operation: (acc: R, T) -> R): R = TODO()
|
||||
|
||||
context(Monoid<T>)
|
||||
fun <T> List<T>.sum(): T = fold(unit) { acc, e -> acc.combine(e) }
|
||||
|
||||
fun <T> listOf(vararg items: T): List<T> = null!!
|
||||
|
||||
fun test() {
|
||||
with(IntMonoid) {
|
||||
listOf(1, 2, 3).sum()
|
||||
}
|
||||
with(StringMonoid) {
|
||||
listOf(1, 2, 3).<!NO_CONTEXT_RECEIVER!>sum()<!>
|
||||
listOf("1", "2", "3").sum()
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ T> listOf(/*0*/ vararg items: T /*kotlin.Array<out T>*/): kotlin.collections.List<T>
|
||||
public fun test(): kotlin.Unit
|
||||
public inline fun </*0*/ T, /*1*/ R> kotlin.collections.Iterable<T>.fold(/*0*/ initial: R, /*1*/ operation: (acc: R, T) -> R): R
|
||||
public fun </*0*/ T> kotlin.collections.List<T>.sum(): T
|
||||
|
||||
public object IntMonoid : Monoid<kotlin.Int> {
|
||||
private constructor IntMonoid()
|
||||
public open override /*1*/ val unit: kotlin.Int = 0
|
||||
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 open override /*1*/ fun kotlin.Int.combine(/*0*/ other: kotlin.Int): kotlin.Int
|
||||
}
|
||||
|
||||
public interface Monoid</*0*/ T> : Semigroup<T> {
|
||||
public abstract val unit: T
|
||||
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 abstract override /*1*/ /*fake_override*/ fun T.combine(/*0*/ other: T): T
|
||||
}
|
||||
|
||||
public interface Semigroup</*0*/ T> {
|
||||
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 abstract infix fun T.combine(/*0*/ other: T): T
|
||||
}
|
||||
|
||||
public object StringMonoid : Monoid<kotlin.String> {
|
||||
private constructor StringMonoid()
|
||||
public open override /*1*/ val unit: kotlin.String = ""
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public open override /*1*/ fun kotlin.String.combine(/*0*/ other: kotlin.String): kotlin.String
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
class Session(var lastAccess: Any?)
|
||||
interface Transaction {
|
||||
fun loadSession(): Session
|
||||
fun storeSession(session: Session)
|
||||
}
|
||||
|
||||
fun now(): Any? = null
|
||||
|
||||
context(Transaction)
|
||||
fun updateUserSession() {
|
||||
val session = <!UNRESOLVED_REFERENCE!>loadSession<!>()
|
||||
session.<!UNRESOLVED_REFERENCE!>lastAccess<!> = now()
|
||||
<!UNRESOLVED_REFERENCE!>storeSession<!>(session)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
class Session(var lastAccess: Any?)
|
||||
interface Transaction {
|
||||
fun loadSession(): Session
|
||||
fun storeSession(session: Session)
|
||||
}
|
||||
|
||||
fun now(): Any? = null
|
||||
|
||||
context(Transaction)
|
||||
fun updateUserSession() {
|
||||
val session = loadSession()
|
||||
session.lastAccess = now()
|
||||
storeSession(session)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package
|
||||
|
||||
public fun now(): kotlin.Any?
|
||||
public fun updateUserSession(): kotlin.Unit
|
||||
|
||||
public final class Session {
|
||||
public constructor Session(/*0*/ lastAccess: kotlin.Any?)
|
||||
public final var lastAccess: 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 open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface Transaction {
|
||||
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 loadSession(): Session
|
||||
public abstract fun storeSession(/*0*/ session: Session): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
class Storage<T> {
|
||||
inner class Info
|
||||
|
||||
fun info(name: String) = Info()
|
||||
}
|
||||
class User
|
||||
class Logger {
|
||||
fun info(message: String) {}
|
||||
}
|
||||
|
||||
context(Logger, Storage<User>)
|
||||
fun userInfo(name: String): Storage<User>.Info? {
|
||||
this<!UNRESOLVED_LABEL!>@Logger<!>.info("Retrieving info about $name")
|
||||
return this<!UNRESOLVED_LABEL!>@Storage<!>.info(name)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class Storage<T> {
|
||||
inner class Info
|
||||
|
||||
fun info(name: String) = Info()
|
||||
}
|
||||
class User
|
||||
class Logger {
|
||||
fun info(message: String) {}
|
||||
}
|
||||
|
||||
context(Logger, Storage<User>)
|
||||
fun userInfo(name: String): Storage<User>.Info? {
|
||||
this@Logger.info("Retrieving info about $name")
|
||||
return this@Storage.info(name)
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package
|
||||
|
||||
public fun userInfo(/*0*/ name: kotlin.String): Storage<User>.Info?
|
||||
|
||||
public final class Logger {
|
||||
public constructor Logger()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun info(/*0*/ message: kotlin.String): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Storage</*0*/ T> {
|
||||
public constructor Storage</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun info(/*0*/ name: kotlin.String): Storage<T>.Info
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final inner class Info /*captured type parameters: /*0*/ T*/ {
|
||||
public constructor Info()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class User {
|
||||
public constructor User()
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user