Remove some usages of KotlinBuiltIns.getInstance()

Introduce DeclarationDescriptor.builtIns extension to get builtins where descriptors are available
Introduce various utilities in KotlinBuiltIns to check for primitive types and get fq names of builtins
This commit is contained in:
Pavel V. Talanov
2015-04-23 15:40:16 +03:00
parent 21d9c272c9
commit ac2cb9af74
71 changed files with 334 additions and 288 deletions
@@ -44,6 +44,7 @@ import org.jetbrains.kotlin.idea.util.FuzzyType
import org.jetbrains.kotlin.idea.util.makeNotNullable
import org.jetbrains.kotlin.idea.util.nullability
import org.jetbrains.kotlin.idea.util.TypeNullability
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
class ArtificialElementInsertHandler(
val textBeforeCaret: String, val textAfterCaret: String, val shortenRefs: Boolean) : InsertHandler<LookupElement>{
@@ -233,10 +234,11 @@ fun functionType(function: FunctionDescriptor): JetType? {
null
else
extensionReceiverType ?: memberReceiverType
return KotlinBuiltIns.getInstance().getFunctionType(function.getAnnotations(),
receiverType,
function.getValueParameters().map { it.getType() },
function.getReturnType() ?: return null)
return function.builtIns.getFunctionType(
function.getAnnotations(), receiverType,
function.getValueParameters().map { it.getType() },
function.getReturnType() ?: return null
)
}
fun LookupElementFactory.createLookupElement(