Immediate extension members are correctly detected for platform types

This commit is contained in:
Valentin Kipyatkov
2014-11-28 18:45:37 +03:00
parent acfd308a7e
commit 6502c44928
3 changed files with 22 additions and 1 deletions
@@ -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");