Dropped KtTypedef

This commit is contained in:
Valentin Kipyatkov
2016-01-19 15:56:25 +03:00
parent 808c7453a4
commit 59fb90a5ee
11 changed files with 3 additions and 91 deletions
@@ -1,46 +0,0 @@
/*
* Copyright 2010-2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.KtNodeTypes;
import org.jetbrains.kotlin.name.FqName;
public class KtTypedef extends KtTypeParameterListOwnerNotStubbed {
public KtTypedef(@NotNull ASTNode node) {
super(node);
}
@Override
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
return visitor.visitTypedef(this, data);
}
@Nullable @IfNotParsed
public KtTypeReference getTypeReference() {
return (KtTypeReference) findChildByType(KtNodeTypes.TYPE_REFERENCE);
}
@Nullable
@Override
public FqName getFqName() {
//TODO: typedefs are unsupported
return null;
}
}
@@ -65,10 +65,6 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
return visitNamedDeclaration(multiDeclarationEntry, data);
}
public R visitTypedef(@NotNull KtTypedef typedef, D data) {
return visitNamedDeclaration(typedef, data);
}
public R visitKtFile(@NotNull KtFile file, D data) {
visitFile(file);
return null;
@@ -61,10 +61,6 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
super.visitDestructuringDeclarationEntry(multiDeclarationEntry, null);
}
public void visitTypedef(@NotNull KtTypedef typedef) {
super.visitTypedef(typedef, null);
}
public void visitKtFile(@NotNull KtFile file) {
super.visitKtFile(file, null);
}
@@ -494,12 +490,6 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
return null;
}
@Override
public final Void visitTypedef(@NotNull KtTypedef typedef, Void data) {
visitTypedef(typedef);
return null;
}
@Override
public final Void visitKtFile(@NotNull KtFile file, Void data) {
visitKtFile(file);
@@ -58,10 +58,6 @@ public class KtVisitorVoidWithParameter<P> extends KtVisitor<Void, P> {
super.visitDestructuringDeclarationEntry(multiDeclarationEntry, data);
}
public void visitTypedefVoid(@NotNull KtTypedef typedef, P data) {
super.visitTypedef(typedef, data);
}
public void visitJetFileVoid(@NotNull KtFile file, P data) {
super.visitKtFile(file, data);
}
@@ -467,12 +463,6 @@ public class KtVisitorVoidWithParameter<P> extends KtVisitor<Void, P> {
return null;
}
@Override
public final Void visitTypedef(@NotNull KtTypedef typedef, P data) {
visitTypedefVoid(typedef, data);
return null;
}
@Override
public final Void visitKtFile(@NotNull KtFile file, P data) {
visitJetFileVoid(file, data);
@@ -158,10 +158,6 @@ class LazyTopDownAnalyzer(
c.anonymousInitializers.put(initializer, containerDescriptor)
}
override fun visitTypedef(typedef: KtTypedef) {
trace.report(UNSUPPORTED.on(typedef, "Typedefs are not supported"))
}
override fun visitDestructuringDeclaration(destructuringDeclaration: KtDestructuringDeclaration) {
// Ignore: multi-declarations are only allowed locally
}
@@ -54,7 +54,7 @@ abstract class AbstractPsiBasedDeclarationProvider(storageManager: StorageManage
val scriptInfo = KtScriptInfo(declaration)
classesAndObjects.put(scriptInfo.script.nameAsName, scriptInfo)
}
else if (declaration is KtParameter || declaration is KtTypedef || declaration is KtDestructuringDeclaration) {
else if (declaration is KtParameter || declaration is KtDestructuringDeclaration) {
// Do nothing, just put it into allDeclarations is enough
}
else {
@@ -159,9 +159,8 @@ protected constructor(
result.addAll(classDescriptors(name))
}
}
else if (declaration is KtTypedef || declaration is KtDestructuringDeclaration) {
// Do nothing for typedefs as they are not supported.
// MultiDeclarations are not supported on global level too.
else if (declaration is KtDestructuringDeclaration) {
// MultiDeclarations are not supported on global level
}
else {
throw IllegalArgumentException("Unsupported declaration kind: " + declaration)
@@ -146,12 +146,6 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(klass, context), context);
}
@Override
public KotlinTypeInfo visitTypedef(@NotNull KtTypedef typedef, ExpressionTypingContext context) {
context.trace.report(UNSUPPORTED.on(typedef, "Typedefs are not supported"));
return super.visitTypedef(typedef, context);
}
@Override
public KotlinTypeInfo visitDeclaration(@NotNull KtDeclaration dcl, ExpressionTypingContext context) {
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(dcl, context), context);
@@ -174,7 +174,6 @@ usageType.nonLocal.property.type = Class/object property type
usageType.local.variable.type = Local variable type
usageType.function.return.type = Function return types
usageType.superType = Supertype
usageType.type.definition = Type definition
usageType.is = Target type of 'is' operation
usageType.as = Target type of 'as' operation
usageType.class.object = Nested class/object
@@ -87,9 +87,6 @@ object UsageTypeUtils {
|| refExpr.getParentOfTypeAndBranch<KtSuperTypeListEntry>(){ typeReference } != null ->
SUPER_TYPE
refExpr.getParentOfTypeAndBranch<KtTypedef>(){ typeReference } != null ->
TYPE_DEFINITION
refExpr.getParentOfTypeAndBranch<KtParameter>(){ typeReference } != null ->
VALUE_PARAMETER_TYPE
@@ -215,7 +212,6 @@ enum class UsageTypeEnum {
NON_LOCAL_PROPERTY_TYPE,
FUNCTION_RETURN_TYPE,
SUPER_TYPE,
TYPE_DEFINITION,
IS,
CLASS_OBJECT_ACCESS,
COMPANION_OBJECT_ACCESS,
@@ -41,7 +41,6 @@ object KotlinUsageTypeProvider : UsageTypeProviderEx {
NON_LOCAL_PROPERTY_TYPE -> KotlinUsageTypes.NON_LOCAL_PROPERTY_TYPE
FUNCTION_RETURN_TYPE -> KotlinUsageTypes.FUNCTION_RETURN_TYPE
SUPER_TYPE -> KotlinUsageTypes.SUPER_TYPE
TYPE_DEFINITION -> KotlinUsageTypes.TYPE_DEFINITION
IS -> KotlinUsageTypes.IS
CLASS_OBJECT_ACCESS -> KotlinUsageTypes.CLASS_OBJECT_ACCESS
COMPANION_OBJECT_ACCESS -> KotlinUsageTypes.COMPANION_OBJECT_ACCESS
@@ -85,7 +84,6 @@ object KotlinUsageTypes {
val NON_LOCAL_PROPERTY_TYPE = UsageType(KotlinBundle.message("usageType.nonLocal.property.type"))
val FUNCTION_RETURN_TYPE = UsageType(KotlinBundle.message("usageType.function.return.type"))
val SUPER_TYPE = UsageType(KotlinBundle.message("usageType.superType"))
val TYPE_DEFINITION = UsageType(KotlinBundle.message("usageType.type.definition"))
val IS = UsageType(KotlinBundle.message("usageType.is"))
val CLASS_OBJECT_ACCESS = UsageType(KotlinBundle.message("usageType.class.object"))
val COMPANION_OBJECT_ACCESS = UsageType(KotlinBundle.message("usageType.companion.object"))