diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.fir.kt index fd64b983d42..0f64f61cc1b 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/ambiguityInGroup.fir.kt @@ -19,9 +19,9 @@ fun supertypeContextual() {} context(C1, C2) fun test() { - supertypeMember() - member() - supertypeExtension() - supertypeExtensionGeneric() - supertypeContextual() -} \ No newline at end of file + supertypeMember() + member() + supertypeExtension() + supertypeExtensionGeneric() + supertypeContextual() +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextualFunctionalTypeConversion.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextualFunctionalTypeConversion.fir.kt index 5bc2e643c86..137fd6d4aa1 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextualFunctionalTypeConversion.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/contextualFunctionalTypeConversion.fir.kt @@ -4,10 +4,10 @@ class A class B fun expectAB(f: context(A, B) () -> Unit) { - f(A(), B()) + f(A(), B()) } fun test() { val l: context(B, A) () -> Unit = { } - expectAB(l) -} \ No newline at end of file + expectAB(l) +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt deleted file mode 100644 index e05ceacec80..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt +++ /dev/null @@ -1,34 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -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 - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt index 41151bf40e7..82e746dbbdf 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class File(name: String) diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.fir.kt deleted file mode 100644 index 73578e68610..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.fir.kt +++ /dev/null @@ -1,18 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -data class Pair(val first: A, val second: B) - -context(Comparator) -infix operator fun T.compareTo(other: T) = compare(this, other) - -context(Comparator) -val Pair.max get() = if (first > second) first else second - -fun test() { - val comparator = Comparator { a, b -> - if (a == null || b == null) 0 else a.length.compareTo(b.length) - } - with(comparator) { - Pair("OK", "fail").max - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.kt index 2100f1b35f1..35c21899199 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/compareTo.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers data class Pair(val first: A, val second: B) diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.fir.kt deleted file mode 100644 index de5176ce586..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.fir.kt +++ /dev/null @@ -1,22 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -class View - -context(View) val Int.dp get() = 42 * this - -fun View.f() { - 123.dp - with(123) { - dp - } -} - -fun Int.g(v: View) { - with(v) { - dp - } -} - -fun h() { - 123.dp -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.kt index 5b67b8b4769..cac9f7cceb1 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/dp.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class View @@ -19,4 +20,4 @@ fun Int.g(v: View) { fun h() { 123.dp -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.fir.kt index 52ee444fc67..218ed960cf5 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/functionalType.fir.kt @@ -15,7 +15,7 @@ fun Receiver.baz(p: Param) {} fun main() { var g: context(Context) Receiver.(Param) -> Unit - g = ::foo // OK - g = ::bar // OK - g = Receiver::baz // OK -} \ No newline at end of file + g = ::foo // OK + g = ::bar // OK + g = Receiver::baz // OK +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/iterableClass.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/iterableClass.fir.kt index e64f77dc887..cd5a9c1af5f 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/iterableClass.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/iterableClass.fir.kt @@ -3,7 +3,7 @@ typealias IterableClass = (C) -> Iterator context(IterableClass) -fun C.iterator(any: Any?): Iterator = this@IterableClass.invoke(this) +fun C.iterator(any: Any?): Iterator = this@IterableClass.invoke(this) fun listOf(vararg items: T): List = null!! @@ -11,8 +11,8 @@ fun test() { val f: IterableClass, Int> = { it.listIterator() } - with(f) { + with(f) { listOf(1, 2, 3).iterator(null) } - listOf(1, 2, 3).iterator(null) -} \ No newline at end of file + listOf(1, 2, 3).iterator(null) +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.fir.kt deleted file mode 100644 index 34687792205..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -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" - } - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.kt index fd7a91ccfe0..546adfd4747 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/json.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class JSONObject { diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.fir.kt deleted file mode 100644 index 577fb8d1052..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.fir.kt +++ /dev/null @@ -1,14 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -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") -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.kt index 985e3677f5f..646984ea087 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/loggingContext.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers interface Params diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/monoidSum.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/monoidSum.fir.kt index 179176e19ba..18ae34d9070 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/monoidSum.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/monoidSum.fir.kt @@ -19,7 +19,7 @@ object StringMonoid : Monoid { public inline fun Iterable.fold(initial: R, operation: (acc: R, T) -> R): R = TODO() context(Monoid) -fun List.sum(): T = fold(unit) { acc, e -> acc.combine(e) } +fun List.sum(): T = fold(unit) { acc, e -> acc.combine(e) } fun listOf(vararg items: T): List = null!! @@ -28,7 +28,7 @@ fun test() { listOf(1, 2, 3).sum() } with(StringMonoid) { - listOf(1, 2, 3).sum() + listOf(1, 2, 3).sum() listOf("1", "2", "3").sum() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.fir.kt deleted file mode 100644 index a7f271d1271..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -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) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.kt index 19af7d62403..4dc7724510e 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/transaction.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class Session(var lastAccess: Any?) diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.fir.kt deleted file mode 100644 index 17cf4d280e8..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -class Storage { - inner class Info - - fun info(name: String) = Info() -} -class User -class Logger { - fun info(message: String) {} -} - -context(Logger, Storage) -fun userInfo(name: String): Storage.Info? { - this@Logger.info("Retrieving info about $name") - return this@Storage.info(name) -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.kt index 99c66ed8ad2..526cfda3b49 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/userStorage.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class Storage { diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/functionalType.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/functionalType.fir.kt index 5708bd4e615..673a2c54278 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/functionalType.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/functionalType.fir.kt @@ -10,38 +10,38 @@ class R { context(C) fun R.f1(g: context(C) R.(Param) -> Unit) { - g(this@C, this@R, Param()) + g(this@C, this@R, Param()) } context(C) fun f2(g: context(C) (Param) -> Unit) { - g(this@C, Param()) + g(this@C, Param()) } context(C) fun R.f3(g: context(C) R.() -> Unit) { - g(this@C, this@R) + g(this@C, this@R) } context(C) fun f4(g: context(C) () -> Unit) { - g(this@C) + g(this@C) } fun test() { val lf1: context(C) R.(Param) -> Unit = { _ -> r - c + c } val lf2: context(C) (Param) -> Unit = { _ -> - c + c } val lf3: context(C) R.() -> Unit = { r - c + c } val lf4: context(C) () -> Unit = { - c + c } with(C()) { @@ -69,4 +69,4 @@ fun test() { } } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/genericOuterClass.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/genericOuterClass.kt index 08c2ef0a6ef..612671fac5b 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/genericOuterClass.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/genericOuterClass.kt @@ -6,10 +6,10 @@ context(Collection

) class B

fun Int.foo() { A() - A() + A() } fun Collection.bar() { B() - B() -} \ No newline at end of file + B() +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.fir.kt deleted file mode 100644 index 63517d7de7d..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.fir.kt +++ /dev/null @@ -1,20 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -class A { - fun h1() {} -} - -class B { - fun h2() {} -} - -fun B.foo() { - h1() - h2() -} - -context(A) -fun B.bar() { - h1() - h2() -} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt index 0c812dfa399..1a1365b7c48 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class A { diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/labelsFromClassNameForbidden.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/labelsFromClassNameForbidden.fir.kt index cbedd3274ee..be6d6a56eac 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/labelsFromClassNameForbidden.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/labelsFromClassNameForbidden.fir.kt @@ -4,9 +4,9 @@ fun List.f() { context(String) fun Int.f() { - this@String.length + this@String.length this@Int.toDouble() } context(String) -val p: String get() = this@String \ No newline at end of file +val p: String get() = this@String diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.fir.kt index 3b3b3800f02..57be36ed83f 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/lazy.fir.kt @@ -15,36 +15,36 @@ fun f(lazy1: Lazy, lazy2: Lazy, lazyT: Lazy, lazyLazyT with(lazy1) { with(lazy2) { test1() - test2() - test3() + test2() + test3() } } with(lazy2) { with(lazy1) { test1() - test2() - test3() + test2() + test3() } } with(lazyT) { with(lazy1) { - test1() - test2() - test3() + test1() + test2() + test3() } } with(lazyLazyT) { with(lazy1) { - test1() - test2() - test3() + test1() + test2() + test3() } } with(lazy1) { with(lazyLazyT) { - test1() - test2() - test3() + test1() + test2() + test3() } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/manyReceivers.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/manyReceivers.fir.kt deleted file mode 100644 index 6721c8d7a05..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/manyReceivers.fir.kt +++ /dev/null @@ -1,37 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -class A { - val a = 1 -} - -class B { - val b = 2 -} - -class C { - val c = 3 -} - -context(A, B) fun C.f() {} - -fun main(a: A, b: B, c: C) { - with(a) { - with(b) { - with(c) { - f() - } - } - } - with(b) { - with(c) { - with(a) { - f() - } - } - } - with(a) { - with(c) { - f() - } - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/manyReceivers.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/manyReceivers.kt index 2a674f33d4e..b53ece5a6a1 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/manyReceivers.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/manyReceivers.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class A { @@ -31,7 +32,7 @@ fun main(a: A, b: B, c: C) { } with(a) { with(c) { - f() + f() } } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/noBackingField.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/noBackingField.fir.kt index d91e6f55f02..4be7bda1df3 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/noBackingField.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/noBackingField.fir.kt @@ -14,4 +14,4 @@ context(A, B) var b = 2 context(A, B) -val c get() = a() + b() \ No newline at end of file +val c get() = a() + b() diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/outerClass.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/outerClass.fir.kt index 200a7626c35..355ea33434f 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/outerClass.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/outerClass.fir.kt @@ -7,7 +7,7 @@ class Outer { context(Outer) class Inner(arg: Any) { - fun bar() = x + fun bar() = x } fun f(outer: Outer) { @@ -15,4 +15,4 @@ fun f(outer: Outer) { with(outer) { Inner(3) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/outerClass.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/outerClass.kt index a5b4a4baafd..4ab38d4d86e 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/outerClass.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/outerClass.kt @@ -11,8 +11,8 @@ class Inner(arg: Any) { } fun f(outer: Outer) { - Inner(1) + Inner(1) with(outer) { Inner(3) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/overloading.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/overloading.fir.kt index d982b1d1ada..ffc46fdf3c5 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/overloading.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/overloading.fir.kt @@ -2,16 +2,16 @@ context(Int, String) fun foo(): Int { - return this@Int + 42 + return this@Int + 42 } context(Int) fun foo(): Int { - return this@Int + 42 + return this@Int + 42 } fun test() { with(42) { foo() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisIdentifierInfo.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisIdentifierInfo.fir.kt index e57b44c2246..62b9b29a1b5 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisIdentifierInfo.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisIdentifierInfo.fir.kt @@ -3,6 +3,6 @@ class A(val a: String?) context(A) fun f() { - if (this@A.a == null) return - this@A.a.length -} \ No newline at end of file + if (this@A.a == null) return + this@A.a.length +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithCustomLabel.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithCustomLabel.fir.kt index 68e773638ef..d4fc4295aeb 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithCustomLabel.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithCustomLabel.fir.kt @@ -5,20 +5,20 @@ class B(val b: Any) class C(val c: Any) context(labelAInt@A, A, labelB@B) fun f() { - this@labelAInt.a.toFloat() - this@A.a.length - this@labelB.b + this@labelAInt.a.toFloat() + this@A.a.length + this@labelB.b this@B } context(labelAInt@A, A, labelB@B) val C.p: Int get() { - this@labelAInt.a.toFloat() - this@A.a.length + this@labelAInt.a.toFloat() + this@A.a.length this@B - this@labelB.b + this@labelB.b this@C.c this@p.c this.c return 1 - } \ No newline at end of file + } diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsClasses.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsClasses.fir.kt deleted file mode 100644 index 8a135fa747d..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsClasses.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -class A { - val x = 1 -} - -context(A) class B { - val prop = x + this@A.x - - fun f() = x + this@A.x -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsClasses.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsClasses.kt index 8cbf90106a2..5525f2da36b 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsClasses.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsClasses.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class A { diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsFunctions.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsFunctions.fir.kt index 2310245ddf0..1d019f9c5a8 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsFunctions.fir.kt @@ -5,25 +5,25 @@ class B(val b: Any) class C(val c: Any) context(A) fun A.f() { - this@A.a.length + this@A.a.length } context(A, B) fun f() { - this@A.a.length - this@B.b + this@A.a.length + this@B.b this } context(A, A, B) fun f() { - this@A.a.length - this@B.b + this@A.a.length + this@B.b this } context(A, A, B) fun C.f() { - this@A.a.length - this@B.b + this@A.a.length + this@B.b this@C.c this@f.c this.c -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsProperties.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsProperties.fir.kt index e07422625ab..1b683584a00 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsProperties.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsProperties.fir.kt @@ -6,39 +6,39 @@ class C(val c: Any) context(A, B) var p: Int get() { - this@A.a.length - this@B.b + this@A.a.length + this@B.b this return 1 } set(value) { - this@A.a.length - this@B.b + this@A.a.length + this@B.b this field = value } context(A, A, B) var p: Int get() { - this@A.a.toDouble() - this@A.a.length - this@B.b + this@A.a.toDouble() + this@A.a.length + this@B.b this return 1 } set(value) { - this@A.a.length - this@B.b + this@A.a.length + this@B.b this field = value } context(A, A, B) val C.p: Int get() { - this@A.a.length - this@B.b + this@A.a.length + this@B.b this@C.c this@p.c this.c return 1 - } \ No newline at end of file + } diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/typeParameterizedList.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/typeParameterizedList.fir.kt index e45a458bac6..fd4ef3c5689 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/typeParameterizedList.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/typeParameterizedList.fir.kt @@ -13,6 +13,6 @@ fun main() { A().f() } with(listOf("1", "2", "3")) { - A().f() + A().f() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/withExplicitReceiver.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/withExplicitReceiver.fir.kt index 487ff5fd018..39e27c18cb6 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/withExplicitReceiver.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/withExplicitReceiver.fir.kt @@ -10,11 +10,11 @@ fun B.f() {} fun main() { val b = B() - b.f() + b.f() with(A()) { b.f() } with(C()) { b.f() } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/withExplicitReceiverError.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/withExplicitReceiverError.fir.kt index 94124cdd290..d28da3252be 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/withExplicitReceiverError.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/withExplicitReceiverError.fir.kt @@ -10,11 +10,11 @@ fun B.f() {} fun main() { val b = B() - b.f() + b.f() with(A()) { b.f() } with(C()) { - b.f() + b.f() } -} \ No newline at end of file +}