Immediate extension members are correctly detected for platform types
This commit is contained in:
@@ -37,6 +37,7 @@ import com.intellij.codeInsight.lookup.LookupElementPresentation
|
||||
import org.jetbrains.jet.lang.types.JetType
|
||||
import org.jetbrains.jet.plugin.caches.resolve.ResolutionFacade
|
||||
import java.awt.Color
|
||||
import org.jetbrains.jet.lang.types.TypeUtils
|
||||
|
||||
public open class LookupElementFactory protected() {
|
||||
public open fun createLookupElement(resolutionFacade: ResolutionFacade, descriptor: DeclarationDescriptor): LookupElement {
|
||||
@@ -171,7 +172,7 @@ public class BoldImmediateLookupElementFactory(private val receiverTypes: Collec
|
||||
val receiverParamType = receiverParameter.getType()
|
||||
if (isReceiverNullable && !receiverParamType.isNullable())
|
||||
Style.GRAYED
|
||||
else if (receiverTypes.any { it == receiverParamType })
|
||||
else if (receiverTypes.any { TypeUtils.equalTypes(it, receiverParamType) })
|
||||
Style.BOLD
|
||||
else
|
||||
Style.NORMAL
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
fun String.extFunForString(){}
|
||||
fun Any.extFunForAny(){}
|
||||
fun String?.extFunForStringNullable(){}
|
||||
|
||||
class C {
|
||||
fun foo() {
|
||||
System.getProperty("a").<caret>
|
||||
}
|
||||
}
|
||||
|
||||
// EXIST: { itemText: "extFunForString", attributes: "bold" }
|
||||
// EXIST: { itemText: "extFunForAny", attributes: "" }
|
||||
// EXIST: { itemText: "extFunForStringNullable", attributes: "bold" }
|
||||
// EXIST: { itemText: "charAt", attributes: "bold" }
|
||||
@@ -1033,6 +1033,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ImmediateMembersForPlatformType.kt")
|
||||
public void testImmediateMembersForPlatformType() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/java/ImmediateMembersForPlatformType.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InPackage.kt")
|
||||
public void testInPackage() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/java/InPackage.kt");
|
||||
|
||||
Reference in New Issue
Block a user