Smart completion: declarations of type Nothing filtered out
This commit is contained in:
@@ -14,6 +14,7 @@ import org.jetbrains.jet.plugin.completion.handlers.*
|
||||
import com.google.common.collect.SetMultimap
|
||||
import java.util.*
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.*
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns
|
||||
|
||||
trait SmartCompletionData{
|
||||
fun accepts(descriptor: DeclarationDescriptor): Boolean
|
||||
@@ -51,6 +52,9 @@ fun buildSmartCompletionData(expression: JetSimpleNameExpression, resolveSession
|
||||
fun typesOf(descriptor: DeclarationDescriptor): Iterable<JetType> {
|
||||
if (descriptor is CallableDescriptor) {
|
||||
var returnType = descriptor.getReturnType()
|
||||
if (returnType != null && KotlinBuiltIns.getInstance().isNothing(returnType!!)) { //TODO: maybe we should include them on the second press?
|
||||
return listOf()
|
||||
}
|
||||
if (descriptor is VariableDescriptor) {
|
||||
if (notNullVariables.contains(descriptor) && returnType != null) {
|
||||
returnType = TypeUtils.makeNotNullable(returnType!!)
|
||||
|
||||
@@ -111,6 +111,11 @@ public class JetSmartCompletionTestGenerated extends AbstractJvmSmartCompletionT
|
||||
doTest("idea/testData/completion/smart/NoConstructorWithQualifier.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoNothing.kt")
|
||||
public void testNoNothing() throws Exception {
|
||||
doTest("idea/testData/completion/smart/NoNothing.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoSillyAssignment.kt")
|
||||
public void testNoSillyAssignment() throws Exception {
|
||||
doTest("idea/testData/completion/smart/NoSillyAssignment.kt");
|
||||
|
||||
Reference in New Issue
Block a user