[FIR JS] KT-51740: Alter positioning of NO_VALUE_FOR_PARAMETER

This commit is contained in:
Nikolay Lunyak
2022-09-23 12:20:09 +03:00
parent 418c530820
commit fcd3e4f4c5
101 changed files with 340 additions and 248 deletions
@@ -19,7 +19,7 @@ class A
infix operator fun A.plus(a : Any) {
1.foo()
true.foo(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>
true.<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>foo()<!>
1
}
@@ -19,7 +19,7 @@ class A
infix operator fun A.plus(a : Any) {
1.foo()
true.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>
true.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!><!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>()<!>
1
}
@@ -16,7 +16,7 @@ class C : T {
super.foo() // OK
super.<!UNRESOLVED_REFERENCE!>bar<!>() // Error
super.buzz() // OK, resolved to a member
super.buzz1(<!NO_VALUE_FOR_PARAMETER!>)<!> // Resolved to an extension
super.<!NO_VALUE_FOR_PARAMETER!>buzz1()<!> // Resolved to an extension
super.buzz1(<!ARGUMENT_TYPE_MISMATCH!>""<!>) // Resolved to a member
}
}
@@ -0,0 +1,34 @@
// !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) { <!NO_VALUE_FOR_PARAMETER!>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
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !LANGUAGE: +ContextReceivers
class File(name: String)
@@ -19,7 +18,7 @@ fun File.open(): InputStream = TODO()
fun withAutoClose(block: context(AutoCloseScope) () -> Unit) {
val scope = AutoCloseScopeImpl() // Not shown here
try {
with(scope) { block(<!NO_VALUE_FOR_PARAMETER!>)<!> }
with(scope) { block<!NO_VALUE_FOR_PARAMETER!>()<!> }
} finally {
scope.close()
}
@@ -6,6 +6,6 @@ class A(foo: Int.() -> Unit) {
fun test(foo: Int.(String) -> Unit) {
4.foo("")
4.foo(p1 = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
4.foo(<!NO_VALUE_FOR_PARAMETER!>p1 = "")<!>
4.foo(<!NAMED_ARGUMENTS_NOT_ALLOWED!>p2<!> = "")
}
@@ -6,6 +6,6 @@ class A(foo: Int.() -> Unit) {
fun test(foo: Int.(String) -> Unit) {
4.foo("")
4.foo(<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>p1<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
4.foo(<!NO_VALUE_FOR_PARAMETER!><!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>p1<!> = "")<!>
4.foo(<!NAMED_ARGUMENTS_NOT_ALLOWED!>p2<!> = "")
}