From b1e452b5684252b7e0a737f79f6f97c40c1f7fad Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Tue, 14 Oct 2014 08:27:21 +0400 Subject: [PATCH] `type` unescaped in *.kt files --- .../jet/codegen/PlatformStaticGenerator.kt | 2 +- .../jet/codegen/inline/TryBlockClustering.kt | 8 +++--- .../jetbrains/jet/lang/psi/JetPsiFactory.kt | 20 ++++++------- .../LazyJavaAnnotationDescriptor.kt | 4 +-- .../src/org/jetbrains/eval4j/interpreter.kt | 6 ++-- .../org/jetbrains/eval4j/interpreterLoop.kt | 2 +- .../src/org/jetbrains/eval4j/jdi/jdiEval.kt | 20 ++++++------- .../src/org/jetbrains/eval4j/jdi/jdiValues.kt | 2 +- .../jet/plugin/completion/ExpectedInfos.kt | 14 +++++----- .../completion/handlers/GenerateLambda.kt | 2 +- .../plugin/completion/smart/KeywordValues.kt | 4 +-- .../plugin/completion/smart/LambdaItems.kt | 4 +-- .../completion/smart/SmartCompletion.kt | 14 +++++----- .../plugin/completion/smart/StaticMembers.kt | 8 +++--- .../jet/plugin/completion/smart/ThisItems.kt | 4 +-- .../smart/TypeInstantiationItems.kt | 2 +- .../DelegatedPropertyFieldDescriptor.kt | 2 +- .../jetbrains/jet/plugin/intentions/Utils.kt | 6 ++-- .../handlers/BasicCompletionHandlerTest.kt | 4 +-- .../handlers/CompletionHandlerTestBase.kt | 2 +- .../jetbrains/jet/j2k/ConstructorConverter.kt | 10 +++---- j2k/src/org/jetbrains/jet/j2k/Converter.kt | 8 +++--- .../org/jetbrains/jet/j2k/TypeConverter.kt | 6 ++-- j2k/src/org/jetbrains/jet/j2k/Utils.kt | 2 +- .../ArrayWithoutInitializationExpression.kt | 18 ++++++------ .../org/jetbrains/jet/j2k/ast/EnumConstant.kt | 4 +-- .../org/jetbrains/jet/j2k/ast/Expressions.kt | 6 ++-- j2k/src/org/jetbrains/jet/j2k/ast/Field.kt | 4 +-- .../org/jetbrains/jet/j2k/ast/Parameter.kt | 6 ++-- .../org/jetbrains/jet/j2k/ast/TypeElement.kt | 4 +-- j2k/src/org/jetbrains/jet/j2k/ast/Types.kt | 4 +-- .../jet/j2k/visitors/ExpressionVisitor.kt | 14 +++++----- js/js.libraries/src/core/dom.kt | 2 +- js/js.libraries/src/core/domEvents.kt | 2 +- js/js.libraries/src/core/htmlDom.kt | 28 +++++++++---------- js/js.libraries/src/html5/files.kt | 2 +- .../doc/highlighter/HtmlKotlinVisitor.kt | 6 ++-- .../src/generators/GenerateJavaScriptStubs.kt | 4 +-- 38 files changed, 130 insertions(+), 130 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt b/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt index 847e1669a26..8fc8bb813f8 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt +++ b/compiler/backend/src/org/jetbrains/jet/codegen/PlatformStaticGenerator.kt @@ -48,7 +48,7 @@ class PlatformStaticGenerator( val iv = InstructionAdapter(methodVisitor) val classDescriptor = descriptor.getContainingDeclaration() as ClassDescriptor val singletonValue = StackValue.singleton(classDescriptor, typeMapper)!! - singletonValue.put(singletonValue.`type`, iv); + singletonValue.put(singletonValue.type, iv); var index = 0; for (paramType in asmMethod.getArgumentTypes()) { iv.load(index, paramType); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/inline/TryBlockClustering.kt b/compiler/backend/src/org/jetbrains/jet/codegen/inline/TryBlockClustering.kt index 2b7a9b9e279..5ed54135855 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/inline/TryBlockClustering.kt +++ b/compiler/backend/src/org/jetbrains/jet/codegen/inline/TryBlockClustering.kt @@ -33,7 +33,7 @@ trait IntervalWithHandler { val startLabel: LabelNode val endLabel: LabelNode val handler: LabelNode - val `type`: String? + val type: String? } class TryCatchBlockNodeInfo(val node: TryCatchBlockNode, val onlyCopyNotProcess: Boolean) : IntervalWithHandler { @@ -44,15 +44,15 @@ class TryCatchBlockNodeInfo(val node: TryCatchBlockNode, val onlyCopyNotProcess: get() = node.end override val handler: LabelNode get() = node.handler!! - override val `type`: String? - get() = node.`type` + override val type: String? + get() = node.type } class TryCatchBlockNodePosition(val nodeInfo: TryCatchBlockNodeInfo, var position: TryCatchPosition): IntervalWithHandler by nodeInfo class TryBlockCluster(val blocks: MutableList) { val defaultHandler: T? - get() = blocks.firstOrNull() { it.`type` == null } + get() = blocks.firstOrNull() { it.type == null } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.kt b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.kt index e1ce7321815..06257e326a9 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetPsiFactory.kt @@ -67,8 +67,8 @@ public class JetPsiFactory(private val project: Project) { return (property.getInitializer() as JetCallExpression).getTypeArgumentList()!! } - public fun createType(`type`: String): JetTypeReference { - return createProperty("val x : $`type`").getTypeReference()!! + public fun createType(type: String): JetTypeReference { + return createProperty("val x : $type").getTypeReference()!! } public fun createStar(): PsiElement { @@ -152,13 +152,13 @@ public class JetPsiFactory(private val project: Project) { return PsiFileFactory.getInstance(project).createFileFromText(fileName, JetFileType.INSTANCE, text, LocalTimeCounter.currentTime(), true) as JetFile } - public fun createProperty(name: String, `type`: String?, isVar: Boolean, initializer: String?): JetProperty { - val text = (if (isVar) "var " else "val ") + name + (if (`type` != null) ":" + `type` else "") + (if (initializer == null) "" else " = " + initializer) + public fun createProperty(name: String, type: String?, isVar: Boolean, initializer: String?): JetProperty { + val text = (if (isVar) "var " else "val ") + name + (if (type != null) ":" + type else "") + (if (initializer == null) "" else " = " + initializer) return createProperty(text) } - public fun createProperty(name: String, `type`: String?, isVar: Boolean): JetProperty { - return createProperty(name, `type`, isVar, null) + public fun createProperty(name: String, type: String?, isVar: Boolean): JetProperty { + return createProperty(name, type, isVar, null) } public fun createProperty(text: String): JetProperty { @@ -545,14 +545,14 @@ public class JetPsiFactory(private val project: Project) { return this } - public fun param(name: String, `type`: String): CallableBuilder { + public fun param(name: String, type: String): CallableBuilder { assert(target == Target.FUNCTION) assert(state == State.FIRST_PARAM || state == State.REST_PARAMS) if (state == State.REST_PARAMS) { sb.append(", ") } - sb.append(name).append(": ").append(`type`) + sb.append(name).append(": ").append(type) if (state == State.FIRST_PARAM) { state = State.REST_PARAMS } @@ -560,9 +560,9 @@ public class JetPsiFactory(private val project: Project) { return this } - public fun returnType(`type`: String): CallableBuilder { + public fun returnType(type: String): CallableBuilder { closeParams() - sb.append(": ").append(`type`) + sb.append(": ").append(type) return this } diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt index 636cb2695e0..703fde4c2ee 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt @@ -154,7 +154,7 @@ class LazyJavaAnnotationDescriptor( private fun resolveFromJavaClassObjectType(javaType: JavaType): CompileTimeConstant<*>? { // Class type is never nullable in 'Foo.class' in Java - val `type` = TypeUtils.makeNotNullable(c.typeResolver.transformJavaType( + val type = TypeUtils.makeNotNullable(c.typeResolver.transformJavaType( javaType, TypeUsage.MEMBER_SIGNATURE_INVARIANT.toAttributes(allowFlexible = false)) ) @@ -162,7 +162,7 @@ class LazyJavaAnnotationDescriptor( val jlClass = c.packageFragmentProvider.module.resolveTopLevelClass(FqName("java.lang.Class")) if (jlClass == null) return null - val arguments = listOf(TypeProjectionImpl(`type`)) + val arguments = listOf(TypeProjectionImpl(type)) val javaClassObjectType = object : LazyJavaType(c.storageManager) { override fun computeTypeConstructor() = jlClass.getTypeConstructor() diff --git a/eval4j/src/org/jetbrains/eval4j/interpreter.kt b/eval4j/src/org/jetbrains/eval4j/interpreter.kt index f25eca38c02..7a2da4a17a4 100644 --- a/eval4j/src/org/jetbrains/eval4j/interpreter.kt +++ b/eval4j/src/org/jetbrains/eval4j/interpreter.kt @@ -54,12 +54,12 @@ public trait Eval { } class SingleInstructionInterpreter(private val eval: Eval) : Interpreter(ASM5) { - override fun newValue(`type`: Type?): Value? { - if (`type` == null) { + override fun newValue(type: Type?): Value? { + if (type == null) { return NOT_A_VALUE } - return makeNotInitializedValue(`type`) + return makeNotInitializedValue(type) } override fun newOperation(insn: AbstractInsnNode): Value? { diff --git a/eval4j/src/org/jetbrains/eval4j/interpreterLoop.kt b/eval4j/src/org/jetbrains/eval4j/interpreterLoop.kt index 7ed86173e71..1d68944431f 100644 --- a/eval4j/src/org/jetbrains/eval4j/interpreterLoop.kt +++ b/eval4j/src/org/jetbrains/eval4j/interpreterLoop.kt @@ -103,7 +103,7 @@ public fun interpreterLoop( fun exceptionCaught(exceptionValue: Value, instanceOf: (Type) -> Boolean): Boolean { val catchBlocks = handlers[m.instructions.indexOf(currentInsn)] ?: listOf() for (catch in catchBlocks) { - val exceptionTypeInternalName = catch.`type` + val exceptionTypeInternalName = catch.type if (exceptionTypeInternalName != null) { val exceptionType = Type.getObjectType(exceptionTypeInternalName) if (instanceOf(exceptionType)) { diff --git a/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt b/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt index e6b8c1bde26..aa4fff0589d 100644 --- a/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt +++ b/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt @@ -35,14 +35,14 @@ public class JDIEval( ) : Eval { private val primitiveTypes = mapOf( - Type.BOOLEAN_TYPE.getClassName() to vm.mirrorOf(true).`type`(), - Type.BYTE_TYPE.getClassName() to vm.mirrorOf(1.toByte()).`type`(), - Type.SHORT_TYPE.getClassName() to vm.mirrorOf(1.toShort()).`type`(), - Type.INT_TYPE.getClassName() to vm.mirrorOf(1.toInt()).`type`(), - Type.CHAR_TYPE.getClassName() to vm.mirrorOf('1').`type`(), - Type.LONG_TYPE.getClassName() to vm.mirrorOf(1L).`type`(), - Type.FLOAT_TYPE.getClassName() to vm.mirrorOf(1.0f).`type`(), - Type.DOUBLE_TYPE.getClassName() to vm.mirrorOf(1.0).`type`() + Type.BOOLEAN_TYPE.getClassName() to vm.mirrorOf(true).type(), + Type.BYTE_TYPE.getClassName() to vm.mirrorOf(1.toByte()).type(), + Type.SHORT_TYPE.getClassName() to vm.mirrorOf(1.toShort()).type(), + Type.INT_TYPE.getClassName() to vm.mirrorOf(1.toInt()).type(), + Type.CHAR_TYPE.getClassName() to vm.mirrorOf('1').type(), + Type.LONG_TYPE.getClassName() to vm.mirrorOf(1L).type(), + Type.FLOAT_TYPE.getClassName() to vm.mirrorOf(1.0f).type(), + Type.DOUBLE_TYPE.getClassName() to vm.mirrorOf(1.0).type() ) override fun loadClass(classType: Type): Value { @@ -178,7 +178,7 @@ public class JDIEval( throwBrokenCodeException(NoSuchFieldError("Can't a field in a non-class: $field")) } - val jdiValue = newValue.asJdiValue(vm, field.`type`().asType()) + val jdiValue = newValue.asJdiValue(vm, field.type().asType()) mayThrow { _class.setValue(field, jdiValue) } } @@ -220,7 +220,7 @@ public class JDIEval( val field = findField(fieldDesc) val obj = instance.jdiObj.checkNull() - val jdiValue = newValue.asJdiValue(vm, field.`type`().asType()) + val jdiValue = newValue.asJdiValue(vm, field.type().asType()) mayThrow { obj.setValue(field, jdiValue) } } diff --git a/eval4j/src/org/jetbrains/eval4j/jdi/jdiValues.kt b/eval4j/src/org/jetbrains/eval4j/jdi/jdiValues.kt index c8e5010e8bf..46c5581dbd5 100644 --- a/eval4j/src/org/jetbrains/eval4j/jdi/jdiValues.kt +++ b/eval4j/src/org/jetbrains/eval4j/jdi/jdiValues.kt @@ -63,7 +63,7 @@ public fun jdi.Value?.asValue(): Value { is jdi.LongValue -> LongValue(longValue()) is jdi.FloatValue -> FloatValue(floatValue()) is jdi.DoubleValue -> DoubleValue(doubleValue()) - is jdi.ObjectReference -> ObjectValue(this, `type`().asType()) + is jdi.ObjectReference -> ObjectValue(this, type().asType()) else -> throw JDIFailureException("Unknown value: $this") } } diff --git a/idea/src/org/jetbrains/jet/plugin/completion/ExpectedInfos.kt b/idea/src/org/jetbrains/jet/plugin/completion/ExpectedInfos.kt index 141687e30e5..9c6be18c360 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/ExpectedInfos.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/ExpectedInfos.kt @@ -74,10 +74,10 @@ enum class Tail { ELSE } -open data class ExpectedInfo(val `type`: JetType, val name: String?, val tail: Tail?) +open data class ExpectedInfo(val type: JetType, val name: String?, val tail: Tail?) -class PositionalArgumentExpectedInfo(`type`: JetType, name: String?, tail: Tail?, val function: FunctionDescriptor, val argumentIndex: Int) - : ExpectedInfo(`type`, name, tail) { +class PositionalArgumentExpectedInfo(type: JetType, name: String?, tail: Tail?, val function: FunctionDescriptor, val argumentIndex: Int) + : ExpectedInfo(type, name, tail) { override fun equals(other: Any?) = other is PositionalArgumentExpectedInfo && super.equals(other) && function == other.function && argumentIndex == other.argumentIndex @@ -211,13 +211,13 @@ class ExpectedInfos(val bindingContext: BindingContext, val resolveSession: Reso return when (expressionWithType) { ifExpression.getCondition() -> listOf(ExpectedInfo(KotlinBuiltIns.getInstance().getBooleanType(), null, Tail.RPARENTH)) - ifExpression.getThen() -> calculate(ifExpression)?.map { ExpectedInfo(it.`type`, it.name, Tail.ELSE) } + ifExpression.getThen() -> calculate(ifExpression)?.map { ExpectedInfo(it.type, it.name, Tail.ELSE) } ifExpression.getElse() -> { val ifExpectedInfo = calculate(ifExpression) val thenType = bindingContext[BindingContext.EXPRESSION_TYPE, ifExpression.getThen()] if (thenType != null) - ifExpectedInfo?.filter { it.`type`.isSubtypeOf(thenType) } + ifExpectedInfo?.filter { it.type.isSubtypeOf(thenType) } else ifExpectedInfo } @@ -237,7 +237,7 @@ class ExpectedInfos(val bindingContext: BindingContext, val resolveSession: Reso val expectedInfos = calculate(binaryExpression) if (expectedInfos != null) { return if (leftTypeNotNullable != null) - expectedInfos.filter { leftTypeNotNullable.isSubtypeOf(it.`type`) } + expectedInfos.filter { leftTypeNotNullable.isSubtypeOf(it.type) } else expectedInfos } @@ -252,7 +252,7 @@ class ExpectedInfos(val bindingContext: BindingContext, val resolveSession: Reso private fun calculateForBlockExpression(expressionWithType: JetExpression): Collection? { val block = expressionWithType.getParent() as? JetBlockExpression ?: return null if (expressionWithType != block.getStatements().last()) return null - return calculate(block)?.map { ExpectedInfo(it.`type`, it.name, null) } + return calculate(block)?.map { ExpectedInfo(it.type, it.name, null) } } private fun calculateForWhenEntryValue(expressionWithType: JetExpression): Collection? { diff --git a/idea/src/org/jetbrains/jet/plugin/completion/handlers/GenerateLambda.kt b/idea/src/org/jetbrains/jet/plugin/completion/handlers/GenerateLambda.kt index b5917dd1971..991fc52b544 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/handlers/GenerateLambda.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/handlers/GenerateLambda.kt @@ -88,7 +88,7 @@ private fun needExplicitParameterTypes(context: InsertionContext, placeholderRan val resolveSession = file.getLazyResolveSession() val bindingContext = resolveSession.resolveToElement(expression) val expectedInfos = ExpectedInfos(bindingContext, resolveSession).calculate(expression) ?: return false - val functionTypes = expectedInfos.map { it.`type` }.filter { KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(it) }.toSet() + val functionTypes = expectedInfos.map { it.type }.filter { KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(it) }.toSet() if (functionTypes.size <= 1) return false val lambdaParameterCount = KotlinBuiltIns.getInstance().getParameterTypeProjectionsFromFunctionType(lambdaType).size diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/KeywordValues.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/KeywordValues.kt index bcac6a2341d..ee2b057a30a 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/KeywordValues.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/KeywordValues.kt @@ -48,14 +48,14 @@ object KeywordValues { if (!skipTrueFalse) { val booleanInfoClassifier = { (info: ExpectedInfo) -> - if (info.`type` == KotlinBuiltIns.getInstance().getBooleanType()) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES + if (info.type == KotlinBuiltIns.getInstance().getBooleanType()) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES } collection.addLookupElements(expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("true").bold() }) collection.addLookupElements(expectedInfos, booleanInfoClassifier, { LookupElementBuilder.create("false").bold() }) } collection.addLookupElements(expectedInfos, - { info -> if (info.`type`.isNullable()) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES }, + { info -> if (info.type.isNullable()) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES }, { LookupElementBuilder.create("null").bold() }) } } \ No newline at end of file diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/LambdaItems.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/LambdaItems.kt index a4f22b10d8e..e30e0cf7408 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/LambdaItems.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/LambdaItems.kt @@ -28,7 +28,7 @@ import org.jetbrains.jet.plugin.completion.suppressAutoInsertion object LambdaItems { public fun addToCollection(collection: MutableCollection, functionExpectedInfos: Collection) { - val distinctTypes = functionExpectedInfos.map { it.`type` }.toSet() + val distinctTypes = functionExpectedInfos.map { it.type }.toSet() val singleType = if (distinctTypes.size == 1) distinctTypes.single() else null val singleSignatureLength = singleType?.let { KotlinBuiltIns.getInstance().getParameterTypeProjectionsFromFunctionType(it).size } @@ -53,7 +53,7 @@ object LambdaItems { insertLambdaTemplate(context, TextRange(offset, offset + placeholder.length), functionType) }) .suppressAutoInsertion() - .addTailAndNameSimilarity(functionExpectedInfos.filter { it.`type` == functionType }) + .addTailAndNameSimilarity(functionExpectedInfos.filter { it.type == functionType }) lookupElement.putUserData(JetCompletionCharFilter.ACCEPT_OPENING_BRACE, true) collection.add(lookupElement) } diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/SmartCompletion.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/SmartCompletion.kt index 0a4415259a7..d8da238b2dc 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/SmartCompletion.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/SmartCompletion.kt @@ -89,12 +89,12 @@ class SmartCompletion(val expression: JetSimpleNameExpression, } val allExpectedInfos = calcExpectedInfos(expressionWithType) ?: return null - val filteredExpectedInfos = allExpectedInfos.filter { !it.`type`.isError() } + val filteredExpectedInfos = allExpectedInfos.filter { !it.type.isError() } if (filteredExpectedInfos.isEmpty()) return null // if we complete argument of == or !=, make types in expected info's nullable to allow nullable items too val expectedInfos = if ((expressionWithType.getParent() as? JetBinaryExpression)?.getOperationToken() in setOf(JetTokens.EQEQ, JetTokens.EXCLEQ)) - filteredExpectedInfos.map { ExpectedInfo(it.`type`.makeNullable(), it.name, it.tail) } + filteredExpectedInfos.map { ExpectedInfo(it.type.makeNullable(), it.name, it.tail) } else filteredExpectedInfos @@ -102,7 +102,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression, val itemsToSkip = calcItemsToSkip(expressionWithType) - val functionExpectedInfos = expectedInfos.filter { KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(it.`type`) } + val functionExpectedInfos = expectedInfos.filter { KotlinBuiltIns.getInstance().isExactFunctionOrExtensionFunctionType(it.type) } fun filterDeclaration(descriptor: DeclarationDescriptor): Collection { val result = ArrayList() @@ -111,8 +111,8 @@ class SmartCompletion(val expression: JetSimpleNameExpression, val nonNullTypes = types.map { it.makeNotNullable() } val classifier = { (expectedInfo: ExpectedInfo) -> when { - types.any { it.isSubtypeOf(expectedInfo.`type`) } -> ExpectedInfoClassification.MATCHES - nonNullTypes.any { it.isSubtypeOf(expectedInfo.`type`) } -> ExpectedInfoClassification.MAKE_NOT_NULLABLE + types.any { it.isSubtypeOf(expectedInfo.type) } -> ExpectedInfoClassification.MATCHES + nonNullTypes.any { it.isSubtypeOf(expectedInfo.type) } -> ExpectedInfoClassification.MAKE_NOT_NULLABLE else -> ExpectedInfoClassification.NOT_MATCHES } } @@ -234,7 +234,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression, val functionType = functionType(descriptor) if (functionType == null) return null - val matchedExpectedInfos = functionExpectedInfos.filter { functionType.isSubtypeOf(it.`type`) } + val matchedExpectedInfos = functionExpectedInfos.filter { functionType.isSubtypeOf(it.type) } if (matchedExpectedInfos.isEmpty()) return null var lookupElement = createLookupElement(descriptor, resolveSession) @@ -278,7 +278,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression, if (elementType != JetTokens.AS_KEYWORD && elementType != JetTokens.AS_SAFE) return null val expectedInfos = calcExpectedInfos(binaryExpression) ?: return null - val expectedInfosGrouped: Map> = expectedInfos.groupBy { it.`type`.makeNotNullable() } + val expectedInfosGrouped: Map> = expectedInfos.groupBy { it.type.makeNotNullable() } val items = ArrayList() for ((jetType, infos) in expectedInfosGrouped) { diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/StaticMembers.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/StaticMembers.kt index e185f7a3768..4767e6b9f35 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/StaticMembers.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/StaticMembers.kt @@ -44,7 +44,7 @@ class StaticMembers(val bindingContext: BindingContext, val resolveSession: Reso val scope = bindingContext[BindingContext.RESOLUTION_SCOPE, context] if (scope == null) return - val expectedInfosByClass = expectedInfos.groupBy { TypeUtils.getClassDescriptor(it.`type`) } + val expectedInfosByClass = expectedInfos.groupBy { TypeUtils.getClassDescriptor(it.type) } for ((classDescriptor, expectedInfosForClass) in expectedInfosByClass) { if (classDescriptor != null && !classDescriptor.getName().isSpecial()) { addToCollection(collection, classDescriptor, expectedInfosForClass, scope, enumEntriesToSkip) @@ -69,8 +69,8 @@ class StaticMembers(val bindingContext: BindingContext, val resolveSession: Reso classifier = { expectedInfo -> when { - returnType.isSubtypeOf(expectedInfo.`type`) -> ExpectedInfoClassification.MATCHES - returnType.isNullable() && returnType.makeNotNullable().isSubtypeOf(expectedInfo.`type`) -> ExpectedInfoClassification.MAKE_NOT_NULLABLE + returnType.isSubtypeOf(expectedInfo.type) -> ExpectedInfoClassification.MATCHES + returnType.isNullable() && returnType.makeNotNullable().isSubtypeOf(expectedInfo.type) -> ExpectedInfoClassification.MAKE_NOT_NULLABLE else -> ExpectedInfoClassification.NOT_MATCHES } } @@ -80,7 +80,7 @@ class StaticMembers(val bindingContext: BindingContext, val resolveSession: Reso } else if (descriptor is ClassDescriptor && DescriptorUtils.isObject(descriptor)) { classifier = { expectedInfo -> - if (descriptor.getDefaultType().isSubtypeOf(expectedInfo.`type`)) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES + if (descriptor.getDefaultType().isSubtypeOf(expectedInfo.type)) ExpectedInfoClassification.MATCHES else ExpectedInfoClassification.NOT_MATCHES } } else { diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/ThisItems.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/ThisItems.kt index d2942e71be9..a179207fd42 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/ThisItems.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/ThisItems.kt @@ -43,8 +43,8 @@ class ThisItems(val bindingContext: BindingContext) { val thisType = receiver.getType() val classifier = { (expectedInfo: ExpectedInfo) -> when { - thisType.isSubtypeOf(expectedInfo.`type`) -> ExpectedInfoClassification.MATCHES - thisType.isNullable() && thisType.makeNotNullable().isSubtypeOf(expectedInfo.`type`) -> ExpectedInfoClassification.MAKE_NOT_NULLABLE + thisType.isSubtypeOf(expectedInfo.type) -> ExpectedInfoClassification.MATCHES + thisType.isNullable() && thisType.makeNotNullable().isSubtypeOf(expectedInfo.type) -> ExpectedInfoClassification.MAKE_NOT_NULLABLE else -> ExpectedInfoClassification.NOT_MATCHES } } diff --git a/idea/src/org/jetbrains/jet/plugin/completion/smart/TypeInstantiationItems.kt b/idea/src/org/jetbrains/jet/plugin/completion/smart/TypeInstantiationItems.kt index fc4354d5235..be403a70f78 100644 --- a/idea/src/org/jetbrains/jet/plugin/completion/smart/TypeInstantiationItems.kt +++ b/idea/src/org/jetbrains/jet/plugin/completion/smart/TypeInstantiationItems.kt @@ -39,7 +39,7 @@ import org.jetbrains.jet.plugin.util.IdeDescriptorRenderers class TypeInstantiationItems(val resolveSession: ResolveSessionForBodies, val visibilityFilter: (DeclarationDescriptor) -> Boolean) { public fun addToCollection(collection: MutableCollection, expectedInfos: Collection) { - val expectedInfosGrouped: Map> = expectedInfos.groupBy { it.`type`.makeNotNullable() } + val expectedInfosGrouped: Map> = expectedInfos.groupBy { it.type.makeNotNullable() } for ((jetType, infos) in expectedInfosGrouped) { val tail = mergeTails(infos.map { it.tail }) addToCollection(collection, jetType, tail) diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/render/DelegatedPropertyFieldDescriptor.kt b/idea/src/org/jetbrains/jet/plugin/debugger/render/DelegatedPropertyFieldDescriptor.kt index b5facfcf360..37fa5e5753c 100644 --- a/idea/src/org/jetbrains/jet/plugin/debugger/render/DelegatedPropertyFieldDescriptor.kt +++ b/idea/src/org/jetbrains/jet/plugin/debugger/render/DelegatedPropertyFieldDescriptor.kt @@ -31,7 +31,7 @@ class DelegatedPropertyFieldDescriptor( append(getName()) if (classRenderer.SHOW_DECLARED_TYPE) { append(": ") - append(classRenderer.renderTypeName(getValue()?.`type`()?.name())) + append(classRenderer.renderTypeName(getValue()?.type()?.name())) } toString() } diff --git a/idea/src/org/jetbrains/jet/plugin/intentions/Utils.kt b/idea/src/org/jetbrains/jet/plugin/intentions/Utils.kt index c075b0e60e9..d4c03db63b3 100644 --- a/idea/src/org/jetbrains/jet/plugin/intentions/Utils.kt +++ b/idea/src/org/jetbrains/jet/plugin/intentions/Utils.kt @@ -30,9 +30,9 @@ fun specifyTypeExplicitly(declaration: JetNamedFunction, typeText: String) { specifyTypeExplicitly(declaration, JetPsiFactory(declaration).createType(typeText)) } -fun specifyTypeExplicitly(declaration: JetNamedFunction, `type`: JetType) { - if (`type`.isError()) return - val typeReference = JetPsiFactory(declaration).createType(IdeDescriptorRenderers.SOURCE_CODE.renderType(`type`)) +fun specifyTypeExplicitly(declaration: JetNamedFunction, type: JetType) { + if (type.isError()) return + val typeReference = JetPsiFactory(declaration).createType(IdeDescriptorRenderers.SOURCE_CODE.renderType(type)) specifyTypeExplicitly(declaration, typeReference) ShortenReferences.process(declaration.getTypeReference()!!) } diff --git a/idea/tests/org/jetbrains/jet/completion/handlers/BasicCompletionHandlerTest.kt b/idea/tests/org/jetbrains/jet/completion/handlers/BasicCompletionHandlerTest.kt index d9fa701a681..02fc6778f91 100644 --- a/idea/tests/org/jetbrains/jet/completion/handlers/BasicCompletionHandlerTest.kt +++ b/idea/tests/org/jetbrains/jet/completion/handlers/BasicCompletionHandlerTest.kt @@ -111,13 +111,13 @@ public class BasicCompletionHandlerTest : CompletionHandlerTestBase(){ fun testSingleBrackets() { fixture.configureByFile(fileName()) - fixture.`type`('(') + fixture.type('(') checkResult() } fun testInsertFunctionWithBothParentheses() { fixture.configureByFile(fileName()) - fixture.`type`("test()") + fixture.type("test()") checkResult() } diff --git a/idea/tests/org/jetbrains/jet/completion/handlers/CompletionHandlerTestBase.kt b/idea/tests/org/jetbrains/jet/completion/handlers/CompletionHandlerTestBase.kt index 448981d219a..d00a2fdf8fc 100644 --- a/idea/tests/org/jetbrains/jet/completion/handlers/CompletionHandlerTestBase.kt +++ b/idea/tests/org/jetbrains/jet/completion/handlers/CompletionHandlerTestBase.kt @@ -138,7 +138,7 @@ public abstract class CompletionHandlerTestBase() : JetLightCodeInsightFixtureTe }).execute().throwException() } else { - fixture.`type`(completionChar) + fixture.type(completionChar) } } } diff --git a/j2k/src/org/jetbrains/jet/j2k/ConstructorConverter.kt b/j2k/src/org/jetbrains/jet/j2k/ConstructorConverter.kt index 3f1e09eec7a..f6309743320 100644 --- a/j2k/src/org/jetbrains/jet/j2k/ConstructorConverter.kt +++ b/j2k/src/org/jetbrains/jet/j2k/ConstructorConverter.kt @@ -209,7 +209,7 @@ class ConstructorConverter(private val psiClass: PsiClass, private val converter val fieldType = correctedTypeConverter.convertVariableType(field) val parameterType = correctedTypeConverter.convertVariableType(parameter) // types can be different only in nullability - val `type` = if (fieldType == parameterType) { + val type = if (fieldType == parameterType) { fieldType } else if (fieldType.toNotNullType() == parameterType.toNotNullType()) { @@ -219,7 +219,7 @@ class ConstructorConverter(private val psiClass: PsiClass, private val converter continue } - parameterToField.put(parameter, field to `type`) + parameterToField.put(parameter, field to type) statementsToRemove.add(initializationStatement) membersToRemove.add(field) @@ -263,9 +263,9 @@ class ConstructorConverter(private val psiClass: PsiClass, private val converter correctedConverter.convertParameter(parameter, defaultValue = defaultValue) } else { - val (field, `type`) = parameterToField[parameter]!! + val (field, type) = parameterToField[parameter]!! Parameter(field.declarationIdentifier(), - `type`, + type, if (isVal(converter.referenceSearcher, field)) Parameter.VarValModifier.Val else Parameter.VarValModifier.Var, converter.convertAnnotations(parameter) + converter.convertAnnotations(field), converter.convertModifiers(field).filter { it in ACCESS_MODIFIERS }, @@ -332,7 +332,7 @@ class ConstructorConverter(private val psiClass: PsiClass, private val converter val parameters = fieldsToInitialize.map { field -> val varValModifier = if (field.isVal) Parameter.VarValModifier.Val else Parameter.VarValModifier.Var - Parameter(field.identifier, field.`type`, varValModifier, field.annotations, field.modifiers.filter { it in ACCESS_MODIFIERS }).assignPrototypesFrom(field) + Parameter(field.identifier, field.type, varValModifier, field.annotations, field.modifiers.filter { it in ACCESS_MODIFIERS }).assignPrototypesFrom(field) } val modifiers = Modifiers.Empty diff --git a/j2k/src/org/jetbrains/jet/j2k/Converter.kt b/j2k/src/org/jetbrains/jet/j2k/Converter.kt index 0bbc452254d..d416ceb4b7e 100644 --- a/j2k/src/org/jetbrains/jet/j2k/Converter.kt +++ b/j2k/src/org/jetbrains/jet/j2k/Converter.kt @@ -552,12 +552,12 @@ public class Converter private(val project: Project, varValModifier: Parameter.VarValModifier = Parameter.VarValModifier.None, modifiers: Modifiers = Modifiers.Empty, defaultValue: Expression? = null): Parameter { - var `type` = typeConverter.convertVariableType(parameter) + var type = typeConverter.convertVariableType(parameter) when (nullability) { - Nullability.NotNull -> `type` = `type`.toNotNullType() - Nullability.Nullable -> `type` = `type`.toNullableType() + Nullability.NotNull -> type = type.toNotNullType() + Nullability.Nullable -> type = type.toNullableType() } - return Parameter(parameter.declarationIdentifier(), `type`, varValModifier, + return Parameter(parameter.declarationIdentifier(), type, varValModifier, annotationConverter.convertAnnotations(parameter), modifiers, defaultValue).assignPrototype(parameter) } diff --git a/j2k/src/org/jetbrains/jet/j2k/TypeConverter.kt b/j2k/src/org/jetbrains/jet/j2k/TypeConverter.kt index 7314ccfdb54..d71d03644b1 100644 --- a/j2k/src/org/jetbrains/jet/j2k/TypeConverter.kt +++ b/j2k/src/org/jetbrains/jet/j2k/TypeConverter.kt @@ -37,10 +37,10 @@ import org.jetbrains.jet.j2k.ast.Identifier class TypeConverter(val converter: Converter) { private val nullabilityCache = HashMap() - public fun convertType(`type`: PsiType?, nullability: Nullability = Nullability.Default): Type { - if (`type` == null) return ErrorType().assignNoPrototype() + public fun convertType(type: PsiType?, nullability: Nullability = Nullability.Default): Type { + if (type == null) return ErrorType().assignNoPrototype() - val result = `type`.accept(TypeVisitor(converter))!!.assignNoPrototype() + val result = type.accept(TypeVisitor(converter))!!.assignNoPrototype() return when (nullability) { Nullability.NotNull -> result.toNotNullType() Nullability.Nullable -> result.toNullableType() diff --git a/j2k/src/org/jetbrains/jet/j2k/Utils.kt b/j2k/src/org/jetbrains/jet/j2k/Utils.kt index 634d17c2f92..a1c93facc19 100644 --- a/j2k/src/org/jetbrains/jet/j2k/Utils.kt +++ b/j2k/src/org/jetbrains/jet/j2k/Utils.kt @@ -31,7 +31,7 @@ fun PsiVariable.hasWriteAccesses(searcher: ReferenceSearcher, scope: PsiElement? = if (scope != null) searcher.findVariableUsages(this, scope).any { PsiUtil.isAccessedForWriting(it) } else false fun getDefaultInitializer(field: Field): Expression? { - val t = field.`type` + val t = field.type val result = if (t.isNullable) { LiteralExpression("null") } diff --git a/j2k/src/org/jetbrains/jet/j2k/ast/ArrayWithoutInitializationExpression.kt b/j2k/src/org/jetbrains/jet/j2k/ast/ArrayWithoutInitializationExpression.kt index c9f5f003f75..35d774ad985 100644 --- a/j2k/src/org/jetbrains/jet/j2k/ast/ArrayWithoutInitializationExpression.kt +++ b/j2k/src/org/jetbrains/jet/j2k/ast/ArrayWithoutInitializationExpression.kt @@ -19,24 +19,24 @@ package org.jetbrains.jet.j2k.ast import org.jetbrains.jet.j2k.CodeBuilder import org.jetbrains.jet.j2k.append -class ArrayWithoutInitializationExpression(val `type`: ArrayType, val expressions: List) : Expression() { +class ArrayWithoutInitializationExpression(val type: ArrayType, val expressions: List) : Expression() { override fun generateCode(builder: CodeBuilder) { - fun appendConstructorName(`type`: ArrayType, hasInit: Boolean): CodeBuilder = when (`type`.elementType) { - is PrimitiveType -> builder.append(`type`.toNotNullType()) + fun appendConstructorName(type: ArrayType, hasInit: Boolean): CodeBuilder = when (type.elementType) { + is PrimitiveType -> builder.append(type.toNotNullType()) is ArrayType -> if (hasInit) { - builder.append(`type`.toNotNullType()) + builder.append(type.toNotNullType()) } else { - builder.append("arrayOfNulls<").append(`type`.elementType).append(">") + builder.append("arrayOfNulls<").append(type.elementType).append(">") } - else -> builder.append("arrayOfNulls<").append(`type`.elementType).append(">") + else -> builder.append("arrayOfNulls<").append(type.elementType).append(">") } - fun oneDim(`type`: ArrayType, size: Expression, init: (() -> Unit)? = null): CodeBuilder { - appendConstructorName(`type`, init != null).append("(").append(size) + fun oneDim(type: ArrayType, size: Expression, init: (() -> Unit)? = null): CodeBuilder { + appendConstructorName(type, init != null).append("(").append(size) if (init != null) { builder.append(", ") init() @@ -61,6 +61,6 @@ class ArrayWithoutInitializationExpression(val `type`: ArrayType, val expression return appendConstructorName(hostType, expressions.isNotEmpty()) } - constructInnerType(`type`, expressions) + constructInnerType(type, expressions) } } diff --git a/j2k/src/org/jetbrains/jet/j2k/ast/EnumConstant.kt b/j2k/src/org/jetbrains/jet/j2k/ast/EnumConstant.kt index 21c869e2e81..3d7f17c2988 100644 --- a/j2k/src/org/jetbrains/jet/j2k/ast/EnumConstant.kt +++ b/j2k/src/org/jetbrains/jet/j2k/ast/EnumConstant.kt @@ -22,7 +22,7 @@ class EnumConstant( val identifier: Identifier, annotations: Annotations, modifiers: Modifiers, - val `type`: Type, + val type: Type, val params: Element ) : Member(annotations, modifiers) { @@ -32,7 +32,7 @@ class EnumConstant( return } - builder append annotations append identifier append " : " append `type` append "(" append params append ")" + builder append annotations append identifier append " : " append type append "(" append params append ")" } diff --git a/j2k/src/org/jetbrains/jet/j2k/ast/Expressions.kt b/j2k/src/org/jetbrains/jet/j2k/ast/Expressions.kt index b78d517da36..e51c29599c1 100644 --- a/j2k/src/org/jetbrains/jet/j2k/ast/Expressions.kt +++ b/j2k/src/org/jetbrains/jet/j2k/ast/Expressions.kt @@ -47,13 +47,13 @@ class BinaryExpression(val left: Expression, val right: Expression, val op: Stri class IsOperator(val expression: Expression, val typeElement: TypeElement) : Expression() { override fun generateCode(builder: CodeBuilder) { - builder.appendOperand(this, expression).append(" is ").append(typeElement.`type`.toNotNullType()) + builder.appendOperand(this, expression).append(" is ").append(typeElement.type.toNotNullType()) } } -class TypeCastExpression(val `type`: Type, val expression: Expression) : Expression() { +class TypeCastExpression(val type: Type, val expression: Expression) : Expression() { override fun generateCode(builder: CodeBuilder) { - builder.appendOperand(this, expression).append(" as ").append(`type`) + builder.appendOperand(this, expression).append(" as ").append(type) } } diff --git a/j2k/src/org/jetbrains/jet/j2k/ast/Field.kt b/j2k/src/org/jetbrains/jet/j2k/ast/Field.kt index 4cb8768bf52..901ae295fff 100644 --- a/j2k/src/org/jetbrains/jet/j2k/ast/Field.kt +++ b/j2k/src/org/jetbrains/jet/j2k/ast/Field.kt @@ -22,7 +22,7 @@ class Field( val identifier: Identifier, annotations: Annotations, modifiers: Modifiers, - val `type`: Type, + val type: Type, val initializer: Element, val isVal: Boolean, val explicitType: Boolean, @@ -36,7 +36,7 @@ class Field( .append(identifier) if (explicitType) { - builder append ":" append `type` + builder append ":" append type } var initializerToUse = initializer diff --git a/j2k/src/org/jetbrains/jet/j2k/ast/Parameter.kt b/j2k/src/org/jetbrains/jet/j2k/ast/Parameter.kt index 38653ecec7c..07a0fea3fd7 100644 --- a/j2k/src/org/jetbrains/jet/j2k/ast/Parameter.kt +++ b/j2k/src/org/jetbrains/jet/j2k/ast/Parameter.kt @@ -19,7 +19,7 @@ package org.jetbrains.jet.j2k.ast import org.jetbrains.jet.j2k.* class Parameter(val identifier: Identifier, - val `type`: Type, + val type: Type, val varVal: Parameter.VarValModifier, val annotations: Annotations, val modifiers: Modifiers, @@ -33,7 +33,7 @@ class Parameter(val identifier: Identifier, override fun generateCode(builder: CodeBuilder) { builder.append(annotations).appendWithSpaceAfter(modifiers) - if (`type` is VarArgType) { + if (type is VarArgType) { builder.append("vararg ") } @@ -42,7 +42,7 @@ class Parameter(val identifier: Identifier, VarValModifier.Val -> builder.append("val ") } - builder append identifier append ":" append `type` + builder append identifier append ":" append type if (defaultValue != null) { builder append " = " append defaultValue diff --git a/j2k/src/org/jetbrains/jet/j2k/ast/TypeElement.kt b/j2k/src/org/jetbrains/jet/j2k/ast/TypeElement.kt index b33e322a564..8f26ba1059c 100644 --- a/j2k/src/org/jetbrains/jet/j2k/ast/TypeElement.kt +++ b/j2k/src/org/jetbrains/jet/j2k/ast/TypeElement.kt @@ -18,8 +18,8 @@ package org.jetbrains.jet.j2k.ast import org.jetbrains.jet.j2k.* -class TypeElement(val `type`: Type) : Element() { +class TypeElement(val type: Type) : Element() { override fun generateCode(builder: CodeBuilder) { - builder.append(`type`) + builder.append(type) } } diff --git a/j2k/src/org/jetbrains/jet/j2k/ast/Types.kt b/j2k/src/org/jetbrains/jet/j2k/ast/Types.kt index cb58efc14be..34b85a7b580 100644 --- a/j2k/src/org/jetbrains/jet/j2k/ast/Types.kt +++ b/j2k/src/org/jetbrains/jet/j2k/ast/Types.kt @@ -129,8 +129,8 @@ class PrimitiveType(val name: Identifier) : NotNullType() { } } -class VarArgType(val `type`: Type) : NotNullType() { +class VarArgType(val type: Type) : NotNullType() { override fun generateCode(builder: CodeBuilder) { - builder.append(`type`) + builder.append(type) } } diff --git a/j2k/src/org/jetbrains/jet/j2k/visitors/ExpressionVisitor.kt b/j2k/src/org/jetbrains/jet/j2k/visitors/ExpressionVisitor.kt index 020b526a8f7..0bc515925fe 100644 --- a/j2k/src/org/jetbrains/jet/j2k/visitors/ExpressionVisitor.kt +++ b/j2k/src/org/jetbrains/jet/j2k/visitors/ExpressionVisitor.kt @@ -118,7 +118,7 @@ open class ExpressionVisitor(private val converter: Converter) : JavaElementVisi } else { val typeElement = converter.convertTypeElement(operand) - result = MethodCallExpression.buildNotNull(null, "javaClass", listOf(), listOf(typeElement.`type`.toNotNullType())) + result = MethodCallExpression.buildNotNull(null, "javaClass", listOf(), listOf(typeElement.type.toNotNullType())) return } @@ -134,9 +134,9 @@ open class ExpressionVisitor(private val converter: Converter) : JavaElementVisi override fun visitConditionalExpression(expression: PsiConditionalExpression) { val condition = expression.getCondition() - val `type` = condition.getType() - val expr = if (`type` != null) - converter.convertExpression(condition, `type`) + val type = condition.getType() + val expr = if (type != null) + converter.convertExpression(condition, type) else converter.convertExpression(condition) result = IfStatement(expr, @@ -154,9 +154,9 @@ open class ExpressionVisitor(private val converter: Converter) : JavaElementVisi override fun visitLiteralExpression(expression: PsiLiteralExpression) { val value = expression.getValue() var text = expression.getText()!! - val `type` = expression.getType() - if (`type` != null) { - val canonicalTypeStr = `type`.getCanonicalText() + val type = expression.getType() + if (type != null) { + val canonicalTypeStr = type.getCanonicalText() if (canonicalTypeStr == "double" || canonicalTypeStr == JAVA_LANG_DOUBLE) { text = text.replace("D", "").replace("d", "") if (!text.contains(".")) { diff --git a/js/js.libraries/src/core/dom.kt b/js/js.libraries/src/core/dom.kt index ae72f816ad2..52ba28981c2 100644 --- a/js/js.libraries/src/core/dom.kt +++ b/js/js.libraries/src/core/dom.kt @@ -86,7 +86,7 @@ native public trait DOMConfiguration { } native public trait DOMError { - public val `type`: String + public val type: String public val location: DOMLocator public val message: String public val relatedData: Any diff --git a/js/js.libraries/src/core/domEvents.kt b/js/js.libraries/src/core/domEvents.kt index 16d6d41988b..42b216011f8 100644 --- a/js/js.libraries/src/core/domEvents.kt +++ b/js/js.libraries/src/core/domEvents.kt @@ -18,7 +18,7 @@ native public trait DocumentEvent { } native public trait Event { - public val `type`: String + public val type: String public val bubbles: Boolean public val cancelable: Boolean public val currentTarget: EventTarget diff --git a/js/js.libraries/src/core/htmlDom.kt b/js/js.libraries/src/core/htmlDom.kt index c1ff84924be..baa3fdbca8c 100644 --- a/js/js.libraries/src/core/htmlDom.kt +++ b/js/js.libraries/src/core/htmlDom.kt @@ -72,7 +72,7 @@ public native trait Event { public native var width: Double public native var modifiers: Double public native var keyCode: Double - public native var `type`: String + public native var type: String public native var which: Any public native var altKey: Boolean public native var ctrlKey: Boolean @@ -258,7 +258,7 @@ public native trait HTMLLinkElement : HTMLElement { public native var rel: String public native var rev: String public native var target: String - public native var `type`: String + public native var type: String } public native trait HTMLTitleElement : HTMLElement { @@ -285,7 +285,7 @@ public native trait HTMLIsIndexElement : HTMLElement { public native trait HTMLStyleElement : HTMLElement { public native var disabled: Boolean public native var media: String - public native var `type`: String + public native var type: String } public native trait HTMLBodyElement : HTMLElement { @@ -313,7 +313,7 @@ public native trait HTMLFormElement { } public native trait HTMLSelectElement : HTMLElement { - public native val `type`: String + public native val type: String public native var selectedIndex: Double public native var value: String public native var length: Double @@ -362,7 +362,7 @@ public native trait HTMLInputElement : HTMLElement { public native var size: Double public native var src: String public native var tabIndex: Double - public native var `type`: String + public native var type: String public native var useMap: String public native var value: String public native fun blur(): Unit @@ -383,7 +383,7 @@ public native trait HTMLTextAreaElement : HTMLElement { public native var readOnly: Boolean public native var rows: Double public native var tabIndex: Double - public native var `type`: String + public native var type: String public native var value: String public native fun blur(): Unit public native fun focus(): Unit @@ -396,7 +396,7 @@ public native trait HTMLButtonElement : HTMLElement { public native var disabled: Boolean public native var name: String public native var tabIndex: Double - public native var `type`: String + public native var type: String public native var value: String } @@ -418,13 +418,13 @@ public native trait HTMLLegendElement : HTMLElement { public native trait HTMLUListElement : HTMLElement { public native var compact: Boolean - public native var `type`: String + public native var type: String } public native trait HTMLOListElement : HTMLElement { public native var compact: Boolean public native var start: Double - public native var `type`: String + public native var type: String } public native trait HTMLDListElement : HTMLElement { @@ -440,7 +440,7 @@ public native trait HTMLMenuElement : HTMLElement { } public native trait HTMLLIElement : HTMLElement { - public native var `type`: String + public native var type: String public native var value: Double } @@ -504,7 +504,7 @@ public native trait HTMLAnchorElement : HTMLElement { public native var shape: String public native var tabIndex: Double public native var target: String - public native var `type`: String + public native var type: String public native fun blur(): Unit public native fun focus(): Unit } @@ -539,7 +539,7 @@ public native trait HTMLObjectElement : HTMLElement { public native var name: String public native var standby: String public native var tabIndex: Double - public native var `type`: String + public native var type: String public native var useMap: String public native var vspace: Double public native var width: String @@ -548,7 +548,7 @@ public native trait HTMLObjectElement : HTMLElement { public native trait HTMLParamElement : HTMLElement { public native var name: String - public native var `type`: String + public native var type: String public native var value: String public native var valueType: String } @@ -590,7 +590,7 @@ public native trait HTMLScriptElement : HTMLElement { public native var charset: String public native var defer: Boolean public native var src: String - public native var `type`: String + public native var type: String } public native trait HTMLTableElement : HTMLElement { diff --git a/js/js.libraries/src/html5/files.kt b/js/js.libraries/src/html5/files.kt index bdc1a8efdcc..373cdf6f3d6 100644 --- a/js/js.libraries/src/html5/files.kt +++ b/js/js.libraries/src/html5/files.kt @@ -27,7 +27,7 @@ public class File() : Blob() { native public open class Blob() { public val size : Int = noImpl - public val `type` : String = noImpl + public val type : String = noImpl //Blob slice(optional long long start, //optional long long end, //optional DOMString contentType); diff --git a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter/HtmlKotlinVisitor.kt b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter/HtmlKotlinVisitor.kt index 6b1d3f5fbd0..50b2a789f54 100644 --- a/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter/HtmlKotlinVisitor.kt +++ b/libraries/tools/kdoc/src/main/kotlin/org/jetbrains/kotlin/doc/highlighter/HtmlKotlinVisitor.kt @@ -36,9 +36,9 @@ class HtmlKotlinVisitor: JetTreeVisitor() { return super.visitClassBody(classBody, data) } - override fun visitFunctionType(`type`: JetFunctionType, data: StringBuilder?): Void? { - println("======================= function Type $`type`") - return super.visitFunctionType(`type`, data) + override fun visitFunctionType(type: JetFunctionType, data: StringBuilder?): Void? { + println("======================= function Type $type") + return super.visitFunctionType(type, data) } protected fun accept(child: PsiElement?, data: StringBuilder?): Unit { diff --git a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateJavaScriptStubs.kt b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateJavaScriptStubs.kt index 412056b94e2..f12e8a31efe 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateJavaScriptStubs.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/generators/GenerateJavaScriptStubs.kt @@ -99,8 +99,8 @@ $imports val name = method.getName() ?: "" fun propertyName(): String { val answer = name.substring(3).decapitalize() - return if (answer == "type") { - "`type`" + return if (answer == "typealias") { + "typealias" } else answer } fun propertyType() = simpleTypeName(method.getReturnType())