Refactoring. Convert KotlinType to kotlin.
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -147,8 +147,8 @@ class OperatorToFunctionIntention : SelfTargetingIntention<KtExpression>(KtExpre
|
||||
KtTokens.MULTEQ -> if (functionName == "multAssign") "$0.multAssign($1)" else "$0 = $0.mult($1)"
|
||||
KtTokens.DIVEQ -> if (functionName == "divAssign") "$0.divAssign($1)" else "$0 = $0.div($1)"
|
||||
KtTokens.PERCEQ -> if (functionName == "modAssign") "$0.modAssign($1)" else "$0 = $0.mod($1)"
|
||||
KtTokens.EQEQ -> if (elemType?.isMarkedNullable() ?: true) "$0?.equals($1) ?: ($1 == null)" else "$0.equals($1)"
|
||||
KtTokens.EXCLEQ -> if (elemType?.isMarkedNullable() ?: true) "!($0?.equals($1) ?: ($1 == null))" else "!$0.equals($1)"
|
||||
KtTokens.EQEQ -> if (elemType?.isMarkedNullable ?: true) "$0?.equals($1) ?: ($1 == null)" else "$0.equals($1)"
|
||||
KtTokens.EXCLEQ -> if (elemType?.isMarkedNullable ?: true) "!($0?.equals($1) ?: ($1 == null))" else "!$0.equals($1)"
|
||||
KtTokens.GT -> "$0.compareTo($1) > 0"
|
||||
KtTokens.LT -> "$0.compareTo($1) < 0"
|
||||
KtTokens.GTEQ -> "$0.compareTo($1) >= 0"
|
||||
|
||||
+8
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,14 +18,14 @@ package org.jetbrains.kotlin.idea.structureView
|
||||
|
||||
import com.intellij.ide.util.InheritedMembersNodeProvider
|
||||
import com.intellij.ide.util.treeView.smartTree.TreeElement
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import java.util.ArrayList
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import com.intellij.psi.NavigatablePsiElement
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import java.util.*
|
||||
|
||||
class KotlinInheritedMembersNodeProvider: InheritedMembersNodeProvider<TreeElement>() {
|
||||
override fun provideNodes(node: TreeElement): Collection<TreeElement> {
|
||||
@@ -44,7 +44,7 @@ class KotlinInheritedMembersNodeProvider: InheritedMembersNodeProvider<TreeEleme
|
||||
val children = ArrayList<TreeElement>()
|
||||
|
||||
val defaultType = descriptor.getDefaultType()
|
||||
for (memberDescriptor in defaultType.getMemberScope().getContributedDescriptors()) {
|
||||
for (memberDescriptor in defaultType.memberScope.getContributedDescriptors()) {
|
||||
if (memberDescriptor !is CallableMemberDescriptor) continue
|
||||
|
||||
when (memberDescriptor.getKind()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,8 +26,11 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyze
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.core.ShortenReferences
|
||||
import org.jetbrains.kotlin.idea.util.*
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
||||
import org.jetbrains.kotlin.idea.util.approximateWithResolvableType
|
||||
import org.jetbrains.kotlin.idea.util.getResolutionScope
|
||||
import org.jetbrains.kotlin.idea.util.isResolvableInScope
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
@@ -103,7 +106,7 @@ class SpecifyTypeExplicitlyIntention : SelfTargetingIntention<KtCallableDeclarat
|
||||
|
||||
object: DelegatingType() {
|
||||
override fun getDelegate() = it
|
||||
override fun getArguments() = newArguments
|
||||
override val arguments = newArguments
|
||||
}
|
||||
}
|
||||
.ifEmpty { return null }
|
||||
|
||||
@@ -21,10 +21,10 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.kotlin.idea.core.ShortenReferences
|
||||
import org.jetbrains.kotlin.idea.core.overrideImplement.ImplementMembersHandler
|
||||
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.containsStarProjections
|
||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||
import org.jetbrains.kotlin.idea.core.ShortenReferences
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
@@ -61,7 +61,7 @@ class LetImplementInterfaceFix(
|
||||
validExpectedType = with (expectedType) {
|
||||
isInterface() &&
|
||||
!containsStarProjections() &&
|
||||
constructor !in TypeUtils.getAllSupertypes(expressionType).map(KotlinType::getConstructor)
|
||||
constructor !in TypeUtils.getAllSupertypes(expressionType).map(KotlinType::constructor)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -65,8 +65,9 @@ private fun KotlinType.render(typeParameterNameMap: Map<TypeParameterDescriptor,
|
||||
override fun getTypeConstructor() = wrappingTypeConstructor
|
||||
}
|
||||
|
||||
val wrappingType = object : KotlinType by typeParameter.defaultType {
|
||||
override fun getConstructor() = wrappingTypeConstructor
|
||||
val wrappingType = object : DelegatingType() {
|
||||
override fun getDelegate(): KotlinType? = typeParameter.defaultType
|
||||
override val constructor = wrappingTypeConstructor
|
||||
}
|
||||
|
||||
TypeProjectionImpl(wrappingType)
|
||||
|
||||
Reference in New Issue
Block a user