Take into account refined applicability of dsl-marker in IDE
After the previous change, when being applied to a function type with receiver it's assumed to work just as it's applied to receiver type Thus, it's necessary to fix relevant IDE features relied on DSL markers #KT-23255 Fixed
This commit is contained in:
+1
-2
@@ -24,8 +24,7 @@ class DslMembersCompletion(
|
||||
private val callTypeAndReceiver: CallTypeAndReceiver<*, *>
|
||||
) {
|
||||
private val nearestReceiver = receiverTypes?.firstOrNull()
|
||||
private val nearestReceiverMarkers = nearestReceiver?.takeIf { it.implicit }
|
||||
?.let { DslMarkerUtils.extractDslMarkerFqNames(it.type) }.orEmpty()
|
||||
private val nearestReceiverMarkers = nearestReceiver?.takeIf { it.implicit }?.extractDslMarkers().orEmpty()
|
||||
|
||||
private val factory = object : AbstractLookupElementFactory {
|
||||
override fun createLookupElement(
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package bar
|
||||
|
||||
@DslMarker
|
||||
annotation class Dsl
|
||||
|
||||
|
||||
class R
|
||||
|
||||
fun r(body: @Dsl R.() -> Unit) {
|
||||
|
||||
}
|
||||
|
||||
fun foo1(i: Int) {
|
||||
|
||||
}
|
||||
|
||||
fun foo3() {
|
||||
|
||||
}
|
||||
|
||||
@Dsl
|
||||
fun R.foo2() {}
|
||||
|
||||
@Dsl
|
||||
fun R.foo4() {
|
||||
|
||||
}
|
||||
|
||||
@Dsl
|
||||
fun R.fooloooooong() {
|
||||
|
||||
}
|
||||
|
||||
val R.fooval
|
||||
get() = Unit
|
||||
|
||||
@Dsl
|
||||
fun R.SomethingSomethingFooSomething() {
|
||||
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// RUNTIME
|
||||
package test
|
||||
|
||||
import bar.r
|
||||
import bar.foo3
|
||||
|
||||
fun main() {
|
||||
val foo5 = 3
|
||||
r {
|
||||
foo<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// ORDER: foo2
|
||||
// ORDER: foo4
|
||||
// ORDER: fooloooooong
|
||||
// ORDER: foo3
|
||||
// ORDER: foo5
|
||||
// ORDER: fooval
|
||||
// ORDER: foo1
|
||||
+5
@@ -69,6 +69,11 @@ public class BasicCompletionWeigherTestGenerated extends AbstractBasicCompletion
|
||||
runTest("idea/idea-completion/testData/weighers/basic/DslCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DslCallsAnnotatedFunctionType.kt")
|
||||
public void testDslCallsAnnotatedFunctionType() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/DslCallsAnnotatedFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DslCallsWithMultipleReceivers.kt")
|
||||
public void testDslCallsWithMultipleReceivers() throws Exception {
|
||||
runTest("idea/idea-completion/testData/weighers/basic/DslCallsWithMultipleReceivers.kt");
|
||||
|
||||
Reference in New Issue
Block a user