Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anton Yalyshev
2019-01-18 11:14:17 +03:00
137 changed files with 3528 additions and 1321 deletions
+1
View File
@@ -4,6 +4,7 @@
<w>cidr</w>
<w>foldable</w>
<w>instrumentator</w>
<w>protobuf</w>
<w>redirector</w>
</words>
</dictionary>
+4 -1
View File
@@ -149,7 +149,7 @@ rootProject.apply {
IdeVersionConfigurator.setCurrentIde(this)
extra["versions.protobuf-java"] = "2.6.1"
extra["versions.protobuf"] = "2.6.1"
extra["versions.javax.inject"] = "1"
extra["versions.jsr305"] = "1.3.9"
extra["versions.jansi"] = "1.16"
@@ -317,6 +317,7 @@ allprojects {
mirrorRepo?.let(::maven)
bootstrapKotlinRepo?.let(::maven)
jcenter()
maven(protobufRepo)
}
configureJvmProject(javaHome!!, jvmTarget!!)
@@ -324,6 +325,7 @@ allprojects {
val commonCompilerArgs = listOfNotNull(
"-Xallow-kotlin-package",
"-Xread-deserialized-contracts",
"-Xjvm-default=compatibility",
"-Xprogressive".takeIf { hasProperty("test.progressive.mode") } // TODO: change to "-progressive" after bootstrap
)
@@ -750,6 +752,7 @@ fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
tasks.withType<KotlinCompile> {
kotlinOptions.jdkHome = javaHome
kotlinOptions.jvmTarget = javaVersion
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
tasks.withType<Test> {
+14 -5
View File
@@ -55,18 +55,27 @@ fun Copy.applyCidrVersionRestrictions(
pluginVersion: String
) {
val dotsCount = productVersion.count { it == '.' }
check(dotsCount >= 1 && dotsCount <= 2) {
check(dotsCount in 1..2) {
"Wrong CIDR product version format: $productVersion"
}
val sinceBuild = if (dotsCount == 1)
// private product versions don't have two dots
val privateProductVersion = dotsCount == 1
val applyStrictProductVersionLimitation = if (privateProductVersion && strictProductVersionLimitation) {
// it does not make sense for private versions to apply strict version limitation
logger.warn("Non-public CIDR product version [$productVersion] has been specified. The corresponding `versions.<product>.strict` property will be ignored.")
false
} else strictProductVersionLimitation
val sinceBuild = if (privateProductVersion)
productVersion
else
productVersion.substringBeforeLast('.')
val untilBuild = if (strictProductVersionLimitation)
// if strict then restrict plugin to the same single version of CLion or AppCode
sinceBuild + ".*"
val untilBuild = if (applyStrictProductVersionLimitation)
// if `strict` then restrict plugin to the same single version of CLion or AppCode
"$sinceBuild.*"
else
productVersion.substringBefore('.') + ".*"
+6 -7
View File
@@ -64,14 +64,13 @@ fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = proje
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
fun DependencyHandler.projectClasses(name: String): ProjectDependency = project(name, configuration = "classes-dirs")
val protobufLiteProject = ":custom-dependencies:protobuf-lite"
val protobufRelocatedProject = ":custom-dependencies:protobuf-relocated"
fun DependencyHandler.protobufLite(): ProjectDependency =
project(protobufLiteProject, configuration = "default").apply { isTransitive = false }
val protobufLiteTask = "$protobufLiteProject:prepare"
val Project.protobufVersion: String get() = findProperty("versions.protobuf") as String
fun DependencyHandler.protobufFull(): ProjectDependency =
project(protobufRelocatedProject, configuration = "default").apply { isTransitive = false }
val Project.protobufRepo: String get() =
"https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_Protobuf),status:SUCCESS,pinned:true,tag:$protobufVersion/artifacts/content/internal/repo/"
fun Project.protobufLite(): String = "org.jetbrains.kotlin:protobuf-lite:$protobufVersion"
fun Project.protobufFull(): String = "org.jetbrains.kotlin:protobuf-relocated:$protobufVersion"
fun File.matchMaybeVersionedArtifact(baseName: String) = name.matches(baseName.toMaybeVersionedJarRegex())
@@ -22,10 +22,7 @@ import org.jetbrains.kotlin.codegen.binding.CodegenBinding
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.constants.ConstantValue
import org.jetbrains.kotlin.resolve.constants.IntegerValueConstant
import org.jetbrains.kotlin.resolve.constants.NullValue
import org.jetbrains.kotlin.resolve.constants.StringValue
import org.jetbrains.kotlin.resolve.constants.*
import org.jetbrains.org.objectweb.asm.Type
import java.util.ArrayList
@@ -102,7 +99,7 @@ private constructor(
private fun isIntegralConstantsSwitch(expression: KtWhenExpression, subjectType: Type): Boolean =
AsmUtil.isIntPrimitive(subjectType) &&
checkAllItemsAreConstantsSatisfying(expression) { it is IntegerValueConstant<*> }
checkAllItemsAreConstantsSatisfying(expression) { it is IntegerValueConstant<*> || it is UnsignedValueConstant<*> }
private fun isStringConstantsSwitch(expression: KtWhenExpression, subjectType: Type): Boolean =
subjectType.className == String::class.java.name &&
@@ -0,0 +1,105 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common
import org.jetbrains.kotlin.backend.common.descriptors.*
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.util.DescriptorsRemapper
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
import org.jetbrains.kotlin.ir.visitors.acceptVoid
/*
TODO: Does not preserve getter/setter descriptors as implementations of PropertyAccessorDescriptor.
This causes problems for KotlinTypeMapper.mapFunctionName (maybe other places as well)
*/
inline fun <reified T : IrElement> T.deepCopyWithWrappedDescriptors(initialParent: IrDeclarationParent? = null): T =
deepCopyWithSymbols(initialParent, DescriptorsToIrRemapper).also {
it.acceptVoid(WrappedDescriptorPatcher)
}
object DescriptorsToIrRemapper : DescriptorsRemapper {
override fun remapDeclaredClass(descriptor: ClassDescriptor) =
WrappedClassDescriptor(descriptor.annotations, descriptor.source)
override fun remapDeclaredConstructor(descriptor: ClassConstructorDescriptor) =
WrappedClassConstructorDescriptor(descriptor.annotations, descriptor.source)
override fun remapDeclaredEnumEntry(descriptor: ClassDescriptor) =
WrappedClassDescriptor(descriptor.annotations, descriptor.source)
override fun remapDeclaredField(descriptor: PropertyDescriptor) =
WrappedFieldDescriptor(descriptor.annotations, descriptor.source)
override fun remapDeclaredSimpleFunction(descriptor: FunctionDescriptor) =
WrappedSimpleFunctionDescriptor(descriptor.annotations, descriptor.source)
override fun remapDeclaredTypeParameter(descriptor: TypeParameterDescriptor) =
WrappedTypeParameterDescriptor(descriptor.annotations, descriptor.source)
override fun remapDeclaredVariable(descriptor: VariableDescriptor) =
WrappedVariableDescriptor(descriptor.annotations, descriptor.source)
override fun remapDeclaredValueParameter(descriptor: ParameterDescriptor): ParameterDescriptor =
if (descriptor is ReceiverParameterDescriptor)
WrappedReceiverParameterDescriptor(descriptor.annotations, descriptor.source)
else
WrappedValueParameterDescriptor(descriptor.annotations, descriptor.source)
}
object WrappedDescriptorPatcher : IrElementVisitorVoid {
override fun visitElement(element: IrElement) {
element.acceptChildrenVoid(this)
}
override fun visitClass(declaration: IrClass) {
(declaration.descriptor as WrappedClassDescriptor).bind(declaration)
declaration.acceptChildrenVoid(this)
}
override fun visitConstructor(declaration: IrConstructor) {
(declaration.descriptor as WrappedClassConstructorDescriptor).bind(declaration)
declaration.acceptChildrenVoid(this)
}
override fun visitEnumEntry(declaration: IrEnumEntry) {
(declaration.descriptor as WrappedClassDescriptor).bind(
declaration.correspondingClass ?: declaration.parentAsClass
)
declaration.acceptChildrenVoid(this)
}
override fun visitField(declaration: IrField) {
(declaration.descriptor as WrappedFieldDescriptor).bind(declaration)
declaration.acceptChildrenVoid(this)
}
override fun visitFunction(declaration: IrFunction) {
(declaration.descriptor as WrappedSimpleFunctionDescriptor).bind(declaration as IrSimpleFunction)
declaration.acceptChildrenVoid(this)
}
override fun visitValueParameter(declaration: IrValueParameter) {
(declaration.descriptor as? WrappedValueParameterDescriptor)?.bind(declaration)
(declaration.descriptor as? WrappedReceiverParameterDescriptor)?.bind(declaration)
declaration.acceptChildrenVoid(this)
}
override fun visitTypeParameter(declaration: IrTypeParameter) {
(declaration.descriptor as WrappedTypeParameterDescriptor).bind(declaration)
declaration.acceptChildrenVoid(this)
}
override fun visitVariable(declaration: IrVariable) {
(declaration.descriptor as WrappedVariableDescriptor).bind(declaration)
declaration.acceptChildrenVoid(this)
}
}
@@ -16,9 +16,11 @@
package org.jetbrains.kotlin.backend.common.ir
import org.jetbrains.kotlin.backend.common.BackendContext
import org.jetbrains.kotlin.backend.common.DumpIrTreeWithDescriptorsVisitor
import org.jetbrains.kotlin.backend.common.deepCopyWithVariables
import org.jetbrains.kotlin.backend.common.descriptors.WrappedClassConstructorDescriptor
import org.jetbrains.kotlin.backend.common.descriptors.WrappedReceiverParameterDescriptor
import org.jetbrains.kotlin.backend.common.descriptors.WrappedTypeParameterDescriptor
import org.jetbrains.kotlin.backend.common.descriptors.WrappedValueParameterDescriptor
import org.jetbrains.kotlin.backend.common.descriptors.WrappedVariableDescriptor
@@ -41,10 +43,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl
import org.jetbrains.kotlin.ir.symbols.impl.IrConstructorSymbolImpl
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.IrTypeProjection
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.ir.util.DumpIrTreeVisitor
@@ -354,7 +353,7 @@ fun Scope.createTemporaryVariableWithWrappedDescriptor(
nameHint: String? = null,
isMutable: Boolean = false,
origin: IrDeclarationOrigin = IrDeclarationOrigin.IR_TEMPORARY_VARIABLE): IrVariable {
val descriptor = WrappedVariableDescriptor()
return createTemporaryVariableWithGivenDescriptor(
irExpression, nameHint, isMutable, origin, descriptor
@@ -362,3 +361,24 @@ fun Scope.createTemporaryVariableWithWrappedDescriptor(
}
val IrFunction.isOverridable: Boolean get() = this is IrSimpleFunction && this.isOverridable
fun IrClass.createImplicitParameterDeclarationWithWrappedDescriptor() {
val thisReceiverDescriptor = WrappedReceiverParameterDescriptor()
thisReceiver = IrValueParameterImpl(
startOffset, endOffset,
IrDeclarationOrigin.INSTANCE_RECEIVER,
IrValueParameterSymbolImpl(thisReceiverDescriptor),
Name.identifier("<this>"),
index = -1,
type = this.symbol.typeWith(this.typeParameters.map { it.defaultType }),
varargElementType = null,
isCrossinline = false,
isNoinline = false
).also { valueParameter ->
thisReceiverDescriptor.bind(valueParameter)
valueParameter.parent = this
}
assert(typeParameters.isEmpty())
assert(descriptor.declaredTypeParameters.isEmpty())
}
@@ -7,14 +7,13 @@ package org.jetbrains.kotlin.backend.common.lower
import org.jetbrains.kotlin.backend.common.ClassLoweringPass
import org.jetbrains.kotlin.backend.common.CommonBackendContext
import org.jetbrains.kotlin.backend.common.CompilerPhase
import org.jetbrains.kotlin.backend.common.deepCopyWithWrappedDescriptors
import org.jetbrains.kotlin.backend.common.descriptors.*
import org.jetbrains.kotlin.backend.common.ir.SetDeclarationsParentVisitor
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.declarations.*
@@ -27,6 +26,9 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.util.DescriptorsRemapper
import org.jetbrains.kotlin.ir.util.SymbolRenamer
import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
@@ -143,7 +145,7 @@ class InitializersLowering(
companion object {
val clinitName = Name.special("<clinit>")
fun IrStatement.copy(containingDeclaration: IrDeclarationParent) = deepCopyWithSymbols(containingDeclaration)
fun IrExpression.copy(containingDeclaration: IrDeclarationParent) = deepCopyWithSymbols(containingDeclaration)
fun IrStatement.copy(containingDeclaration: IrDeclarationParent) = deepCopyWithWrappedDescriptors(containingDeclaration)
fun IrExpression.copy(containingDeclaration: IrDeclarationParent) = deepCopyWithWrappedDescriptors(containingDeclaration)
}
}
}
@@ -31,17 +31,13 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.util.patchDeclarationParents
import org.jetbrains.kotlin.ir.util.transformDeclarationsFlat
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
import org.jetbrains.kotlin.ir.visitors.*
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.NameUtils
import java.util.*
interface LocalNameProvider {
fun localName(descriptor: DeclarationDescriptor): String =
descriptor.name.asString()
fun localName(declaration: IrDeclarationWithName): String =
declaration.name.asString()
companion object {
val DEFAULT = object : LocalNameProvider {}
@@ -465,13 +461,13 @@ class LocalDeclarationsLowering(
}
}
private fun suggestLocalName(declaration: IrDeclaration): String {
private fun suggestLocalName(declaration: IrDeclarationWithName): String {
localFunctions[declaration]?.let {
if (it.index >= 0)
return "lambda-${it.index}"
}
return localNameProvider.localName(declaration.descriptor)
return localNameProvider.localName(declaration)
}
private fun generateNameForLiftedDeclaration(
@@ -481,7 +477,7 @@ class LocalDeclarationsLowering(
Name.identifier(
declaration.parentsWithSelf
.takeWhile { it != newOwner }
.toList().reversed().joinToString(separator = "$") { suggestLocalName(it as IrDeclaration) }
.toList().reversed().joinToString(separator = "$") { suggestLocalName(it as IrDeclarationWithName) }
)
private fun createLiftedDeclaration(localFunctionContext: LocalFunctionContext) {
@@ -769,8 +765,13 @@ class LocalDeclarationsLowering(
val localClassContext = LocalClassContext(declaration)
localClasses[declaration] = localClassContext
}
override fun visitLocalDelegatedProperty(declaration: IrLocalDelegatedProperty) {
// Getter and setter of local delegated properties are special generated functions and don't have closure.
declaration.delegate.initializer?.acceptVoid(this)
}
})
}
}
}
}
@@ -89,7 +89,7 @@ class SharedVariablesLowering(val context: BackendContext) : FunctionLoweringPas
}
private fun rewriteSharedVariables() {
val transformedDescriptors = HashMap<IrValueSymbol, IrVariableSymbol>()
val transformedSymbols = HashMap<IrValueSymbol, IrVariableSymbol>()
irFunction.transformChildrenVoid(object : IrElementTransformerVoid() {
override fun visitVariable(declaration: IrVariable): IrStatement {
@@ -99,7 +99,7 @@ class SharedVariablesLowering(val context: BackendContext) : FunctionLoweringPas
val newDeclaration = context.sharedVariablesManager.declareSharedVariable(declaration)
newDeclaration.parent = irFunction
transformedDescriptors[declaration.symbol] = newDeclaration.symbol
transformedSymbols[declaration.symbol] = newDeclaration.symbol
return context.sharedVariablesManager.defineSharedValue(declaration, newDeclaration)
}
@@ -123,7 +123,7 @@ class SharedVariablesLowering(val context: BackendContext) : FunctionLoweringPas
}
private fun getTransformedSymbol(oldSymbol: IrValueSymbol): IrVariableSymbol? =
transformedDescriptors.getOrElse(oldSymbol) {
transformedSymbols.getOrElse(oldSymbol) {
assert(oldSymbol.owner !in sharedVariables) {
"Shared variable is not transformed: ${oldSymbol.owner.dump()}"
}
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.utils.DFS
val kotlinPackageFqn = FqName.fromSegments(listOf("kotlin"))
val kotlinReflectionPackageFqn = kotlinPackageFqn.child(Name.identifier("reflection"))
val kotlinReflectionPackageFqn = kotlinPackageFqn.child(Name.identifier("reflect"))
val kotlinCoroutinesPackageFqn = kotlinPackageFqn.child(Name.identifier("coroutines"))
@@ -25,7 +25,8 @@ interface JvmLoweredDeclarationOrigin : IrDeclarationOrigin {
object CLASS_STATIC_INITIALIZER : IrDeclarationOriginImpl("CLASS_STATIC_INITIALIZER")
object DEFAULT_IMPLS : IrDeclarationOriginImpl("DEFAULT_IMPL")
object FIELD_FOR_OUTER_THIS : IrDeclarationOriginImpl("FIELD_FOR_OUTER_THIS")
object SYNTHETIC_ACCESSOR : IrDeclarationOriginImpl("SYNTHETIC_ACCESSOR")
object FUNCTION_REFERENCE_IMPL : IrDeclarationOriginImpl("FUNCTION_REFERENCE_IMPL")
object SYNTHETIC_ACCESSOR : IrDeclarationOriginImpl("SYNTHETIC_ACCESSOR", isSynthetic = true)
object TO_ARRAY : IrDeclarationOriginImpl("TO_ARRAY")
object JVM_STATIC_WRAPPER : IrDeclarationOriginImpl("JVM_STATIC_WRAPPER")
object JVM_OVERLOADS_WRAPPER : IrDeclarationOriginImpl("JVM_OVERLOADS_WRAPPER")
@@ -76,6 +76,10 @@ class JvmBackendContext(
return find(state.module.getPackage(fqName.parent()).memberScope, fqName.shortName())
}
fun getIrClass(fqName: FqName): IrClassSymbol {
return ir.symbols.externalSymbolTable.referenceClass(getClass(fqName))
}
override fun getInternalFunctions(name: String): List<FunctionDescriptor> {
return when (name) {
"ThrowUninitializedPropertyAccessException" ->
@@ -151,6 +155,8 @@ class JvmBackendContext(
)
val lambdaClass = calc { symbolTable.referenceClass(context.getInternalClass("Lambda")) }
fun getKFunction(parameterCount: Int) = symbolTable.referenceClass(reflectionTypes.getKFunction(parameterCount))
}
@@ -11,8 +11,8 @@ import org.jetbrains.kotlin.backend.common.lower.*
import org.jetbrains.kotlin.backend.common.makePhase
import org.jetbrains.kotlin.backend.common.runOnFilePostfix
import org.jetbrains.kotlin.backend.jvm.lower.*
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.ir.declarations.IrDeclarationWithName
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.name.NameUtils
@@ -108,8 +108,8 @@ private val SharedVariablesPhase = makeJvmPhase(
private val LocalDeclarationsPhase = makeJvmPhase(
{ context, data ->
LocalDeclarationsLowering(context, object : LocalNameProvider {
override fun localName(descriptor: DeclarationDescriptor): String =
NameUtils.sanitizeAsJavaIdentifier(super.localName(descriptor))
override fun localName(declaration: IrDeclarationWithName): String =
NameUtils.sanitizeAsJavaIdentifier(super.localName(declaration))
}, Visibilities.PUBLIC, true).lower(data)
},
name = "JvmLocalDeclarations",
@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.backend.jvm.codegen
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.backend.jvm.descriptors.JvmDescriptorWithExtraFlags
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
import org.jetbrains.kotlin.codegen.*
@@ -78,7 +77,7 @@ open class FunctionCodegen(private val irFunction: IrFunction, private val class
else -> if (classCodegen.irClass.isJvmInterface && irFunction.body == null) Opcodes.ACC_ABSTRACT else 0 //TODO transform interface modality on lowering to DefaultImpls
}
val nativeFlag = if (irFunction.isExternal) Opcodes.ACC_NATIVE else 0
val syntheticFlag = if (irFunction.origin == JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR) Opcodes.ACC_SYNTHETIC else 0
val syntheticFlag = if (irFunction.origin.isSynthetic) Opcodes.ACC_SYNTHETIC else 0
return visibility or
modalityFlag or
staticFlag or
@@ -148,4 +147,4 @@ private fun createFrameMapWithReceivers(
}
return frameMap
}
}
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.backend.jvm.lower
import org.jetbrains.kotlin.backend.common.FileLoweringPass
import org.jetbrains.kotlin.backend.common.descriptors.WrappedClassDescriptor
import org.jetbrains.kotlin.backend.common.makePhase
import org.jetbrains.kotlin.backend.common.ir.createImplicitParameterDeclarationWithWrappedDescriptor
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
@@ -79,6 +79,7 @@ class FileClassLowering(val context: JvmBackendContext) : FileLoweringPass {
superTypes.add(context.irBuiltIns.anyType)
parent = irFile
declarations.addAll(fileClassMembers)
createImplicitParameterDeclarationWithWrappedDescriptor()
// TODO: figure out why reparenting leads to failing tests.
// fileClassMembers.forEach { it.parent = this }
}
@@ -10,8 +10,8 @@ import org.jetbrains.kotlin.backend.common.descriptors.WrappedSimpleFunctionDesc
import org.jetbrains.kotlin.backend.common.descriptors.WrappedValueParameterDescriptor
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
import org.jetbrains.kotlin.backend.common.lower.irIfThen
import org.jetbrains.kotlin.backend.common.makePhase
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
@@ -52,7 +52,7 @@ class FunctionNVarargInvokeLowering(var context: JvmBackendContext) : ClassLower
val descriptor = WrappedSimpleFunctionDescriptor()
return IrFunctionImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
origin = CallableReferenceLowering.DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
origin = JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
symbol = IrSimpleFunctionSymbolImpl(descriptor),
name = Name.identifier("invoke"),
visibility = Visibilities.PUBLIC,
@@ -68,7 +68,7 @@ class FunctionNVarargInvokeLowering(var context: JvmBackendContext) : ClassLower
val varargParameterDescriptor = WrappedValueParameterDescriptor()
val varargParam = IrValueParameterImpl(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
origin = CallableReferenceLowering.DECLARATION_ORIGIN_FUNCTION_REFERENCE_IMPL,
origin = JvmLoweredDeclarationOrigin.FUNCTION_REFERENCE_IMPL,
symbol = IrValueParameterSymbolImpl(varargParameterDescriptor),
name = Name.identifier("args"),
index = 0,
@@ -24,10 +24,12 @@ import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
interface IrClass : IrSymbolDeclaration<IrClassSymbol>, IrDeclarationWithVisibility, IrDeclarationContainer, IrTypeParametersContainer {
interface IrClass :
IrSymbolDeclaration<IrClassSymbol>, IrDeclarationWithName, IrDeclarationWithVisibility,
IrDeclarationContainer, IrTypeParametersContainer {
override val descriptor: ClassDescriptor
val name: Name
val kind: ClassKind
val modality: Modality
val isCompanion: Boolean
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.name.Name
interface IrSymbolOwner : IrElement {
val symbol: IrSymbol
@@ -49,3 +50,7 @@ interface IrDeclarationWithVisibility : IrDeclaration {
val visibility: Visibility
}
interface IrDeclarationWithName : IrDeclaration {
val name: Name
}
@@ -28,7 +28,8 @@ interface IrDeclarationOrigin {
object DELEGATED_PROPERTY_ACCESSOR : IrDeclarationOriginImpl("DELEGATED_PROPERTY_ACCESSOR")
object DELEGATED_MEMBER : IrDeclarationOriginImpl("DELEGATED_MEMBER")
object ENUM_CLASS_SPECIAL_MEMBER : IrDeclarationOriginImpl("ENUM_CLASS_SPECIAL_MEMBER")
object FUNCTION_FOR_DEFAULT_PARAMETER : IrDeclarationOriginImpl("FUNCTION_FOR_DEFAULT_PARAMETER")
object FUNCTION_FOR_DEFAULT_PARAMETER : IrDeclarationOriginImpl("FUNCTION_FOR_DEFAULT_PARAMETER", isSynthetic = true)
object FILE_CLASS : IrDeclarationOriginImpl("FILE_CLASS")
object GENERATED_DATA_CLASS_MEMBER : IrDeclarationOriginImpl("GENERATED_DATA_CLASS_MEMBER")
object GENERATED_INLINE_CLASS_MEMBER : IrDeclarationOriginImpl("GENERATED_INLINE_CLASS_MEMBER")
object LOCAL_FUNCTION_FOR_LAMBDA : IrDeclarationOriginImpl("LOCAL_FUNCTION_FOR_LAMBDA")
@@ -44,8 +45,13 @@ interface IrDeclarationOrigin {
object FIELD_FOR_ENUM_ENTRY : IrDeclarationOriginImpl("FIELD_FOR_ENUM_ENTRY")
object FIELD_FOR_ENUM_VALUES : IrDeclarationOriginImpl("FIELD_FOR_ENUM_VALUES")
object FIELD_FOR_OBJECT_INSTANCE : IrDeclarationOriginImpl("FIELD_FOR_OBJECT_INSTANCE")
val isSynthetic: Boolean get() = false
}
abstract class IrDeclarationOriginImpl(val name: String) : IrDeclarationOrigin {
abstract class IrDeclarationOriginImpl(
val name: String,
override val isSynthetic: Boolean = false
) : IrDeclarationOrigin {
override fun toString(): String = name
}
}
@@ -19,13 +19,10 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
import org.jetbrains.kotlin.name.Name
interface IrEnumEntry : IrSymbolDeclaration<IrEnumEntrySymbol> {
interface IrEnumEntry : IrSymbolDeclaration<IrEnumEntrySymbol>, IrDeclarationWithName {
override val descriptor: ClassDescriptor
val name: Name
var correspondingClass: IrClass?
var initializerExpression: IrExpression?
}
@@ -9,12 +9,11 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
interface IrField : IrSymbolDeclaration<IrFieldSymbol>, IrOverridableDeclaration<IrFieldSymbol>, IrDeclarationWithVisibility, IrDeclarationParent {
interface IrField : IrSymbolDeclaration<IrFieldSymbol>, IrOverridableDeclaration<IrFieldSymbol>,
IrDeclarationWithName, IrDeclarationWithVisibility, IrDeclarationParent {
override val descriptor: PropertyDescriptor
val name: Name
val type: IrType
val isFinal: Boolean
val isExternal: Boolean
@@ -22,13 +22,13 @@ import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
interface IrFunction : IrDeclarationWithVisibility, IrTypeParametersContainer, IrSymbolOwner, IrDeclarationParent, IrReturnTarget {
interface IrFunction :
IrDeclarationWithName, IrDeclarationWithVisibility, IrTypeParametersContainer, IrSymbolOwner, IrDeclarationParent, IrReturnTarget {
override val descriptor: FunctionDescriptor
override val symbol: IrFunctionSymbol
val name: Name
val isInline: Boolean // NB: there's an inline constructor for Array and each primitive array class
val isExternal: Boolean
var returnType: IrType
@@ -18,12 +18,10 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
interface IrLocalDelegatedProperty : IrDeclaration {
interface IrLocalDelegatedProperty : IrDeclarationWithName {
override val descriptor: VariableDescriptorWithAccessors
val name: Name
val type: IrType
val isVar: Boolean
@@ -18,13 +18,10 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.name.Name
interface IrProperty : IrDeclarationWithVisibility {
interface IrProperty : IrDeclarationWithName, IrDeclarationWithVisibility {
override val descriptor: PropertyDescriptor
val name: Name
val modality: Modality
val isVar: Boolean
val isConst: Boolean
@@ -20,13 +20,11 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
interface IrTypeParameter : IrSymbolDeclaration<IrTypeParameterSymbol> {
interface IrTypeParameter : IrSymbolDeclaration<IrTypeParameterSymbol>, IrDeclarationWithName {
override val descriptor: TypeParameterDescriptor
val name: Name
val variance: Variance
val index: Int
val isReified: Boolean
@@ -8,13 +8,10 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ValueDescriptor
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
interface IrValueDeclaration : IrDeclaration, IrSymbolOwner {
interface IrValueDeclaration : IrDeclarationWithName, IrSymbolOwner {
override val descriptor: ValueDescriptor
override val symbol: IrValueSymbol
val name: Name
val type: IrType
}
@@ -33,8 +33,11 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import java.util.*
inline fun <reified T : IrElement> T.deepCopyWithSymbols(initialParent: IrDeclarationParent? = null): T {
val symbolRemapper = DeepCopySymbolRemapper()
inline fun <reified T : IrElement> T.deepCopyWithSymbols(
initialParent: IrDeclarationParent? = null,
descriptorRemapper: DescriptorsRemapper = DescriptorsRemapper.DEFAULT
): T {
val symbolRemapper = DeepCopySymbolRemapper(descriptorRemapper)
acceptVoid(symbolRemapper)
val typeRemapper = DeepCopyTypeRemapper(symbolRemapper)
return transform(DeepCopyIrTreeWithSymbols(symbolRemapper, typeRemapper), null).patchDeclarationParents(initialParent) as T
@@ -259,6 +259,9 @@ val IrClassSymbol.constructors: Sequence<IrConstructorSymbol>
val IrClass.constructors: Sequence<IrConstructor>
get() = this.declarations.asSequence().filterIsInstance<IrConstructor>()
val IrDeclarationContainer.properties: Sequence<IrProperty>
get() = declarations.asSequence().filterIsInstance<IrProperty>()
val IrFunction.explicitParameters: List<IrValueParameter>
get() = (listOfNotNull(dispatchReceiverParameter, extensionReceiverParameter) + valueParameters)
@@ -852,7 +852,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
PsiBuilder.Marker atWhenStart = mark();
myKotlinParsing.parseAnnotationsList(DEFAULT, TokenSet.create(EQ, RPAR));
if (at(VAL_KEYWORD) || at(VAR_KEYWORD)) {
IElementType declType = myKotlinParsing.parseProperty(KotlinParsing.PropertyParsingMode.LOCAL);
IElementType declType = myKotlinParsing.parseProperty(KotlinParsing.DeclarationParsingMode.LOCAL);
atWhenStart.done(declType);
atWhenStart.setCustomEdgeTokenBinders(PrecedingDocCommentsBinder.INSTANCE, TrailingCommentsBinder.INSTANCE);
@@ -1068,7 +1068,7 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
KotlinParsing.ModifierDetector detector = new KotlinParsing.ModifierDetector();
myKotlinParsing.parseModifierList(detector, DEFAULT, TokenSet.EMPTY);
IElementType declType = parseLocalDeclarationRest(detector.isEnumDetected(), rollbackIfDefinitelyNotExpression, isScriptTopLevel);
IElementType declType = parseLocalDeclarationRest(detector, rollbackIfDefinitelyNotExpression, isScriptTopLevel);
if (declType != null) {
// we do not attach preceding comments (non-doc) to local variables because they are likely commenting a few statements below
@@ -1348,29 +1348,19 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
* ;
*/
@Nullable
private IElementType parseLocalDeclarationRest(boolean isEnum, boolean failIfDefinitelyNotExpression, boolean isScriptTopLevel) {
private IElementType parseLocalDeclarationRest(
@NotNull KotlinParsing.ModifierDetector modifierDetector,
boolean failIfDefinitelyNotExpression,
boolean isScriptTopLevel
) {
IElementType keywordToken = tt();
IElementType declType = null;
if (failIfDefinitelyNotExpression) {
if (keywordToken != FUN_KEYWORD) return null;
return myKotlinParsing.parseFunction(/* failIfIdentifierExists = */ true);
}
if (keywordToken == CLASS_KEYWORD || keywordToken == INTERFACE_KEYWORD) {
declType = myKotlinParsing.parseClass(isEnum);
}
else if (keywordToken == FUN_KEYWORD) {
declType = myKotlinParsing.parseFunction();
}
else if (keywordToken == VAL_KEYWORD || keywordToken == VAR_KEYWORD) {
declType = myKotlinParsing.parseLocalProperty(isScriptTopLevel);
}
else if (keywordToken == TYPE_ALIAS_KEYWORD) {
declType = myKotlinParsing.parseTypeAlias();
}
else if (keywordToken == OBJECT_KEYWORD) {
if (keywordToken == OBJECT_KEYWORD) {
// Object expression may appear at the statement position: should parse it
// as expression instead of object declaration
// sample:
@@ -1382,11 +1372,12 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
if (lookahead == COLON || lookahead == LBRACE) {
return null;
}
myKotlinParsing.parseObject(NameParsingMode.REQUIRED, true);
declType = OBJECT_DECLARATION;
}
return declType;
return myKotlinParsing.parseCommonDeclaration(
modifierDetector, NameParsingMode.REQUIRED,
isScriptTopLevel ? KotlinParsing.DeclarationParsingMode.SCRIPT_TOPLEVEL : KotlinParsing.DeclarationParsingMode.LOCAL
);
}
/*
@@ -1825,7 +1816,15 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
if (at(COLON) && lookahead(1) == IDENTIFIER) {
errorAndAdvance("Unexpected type specification", 2);
}
if (!at(COMMA)) break;
if (!at(COMMA)) {
if (atSet(EXPRESSION_FIRST)) {
error("Expecting ','");
continue;
}
else {
break;
}
}
advance(); // COMMA
if (at(RPAR)) {
error("Expecting an argument");
@@ -416,32 +416,20 @@ public class KotlinParsing extends AbstractKotlinParsing {
ModifierDetector detector = new ModifierDetector();
parseModifierList(detector, DEFAULT, TokenSet.EMPTY);
IElementType keywordToken = tt();
IElementType declType = null;
IElementType declType = parseCommonDeclaration(detector, NameParsingMode.REQUIRED, DeclarationParsingMode.MEMBER_OR_TOPLEVEL);
if (keywordToken == CLASS_KEYWORD || keywordToken == INTERFACE_KEYWORD) {
declType = parseClass(detector.isEnumDetected());
}
else if (keywordToken == FUN_KEYWORD) {
declType = parseFunction();
}
else if (keywordToken == VAL_KEYWORD || keywordToken == VAR_KEYWORD) {
declType = parseProperty();
}
else if (keywordToken == TYPE_ALIAS_KEYWORD) {
declType = parseTypeAlias();
}
else if (keywordToken == OBJECT_KEYWORD) {
parseObject(NameParsingMode.REQUIRED, true);
declType = OBJECT_DECLARATION;
}
else if (at(LBRACE)) {
if (declType == null && at(LBRACE)) {
error("Expecting a top level declaration");
parseBlock();
declType = FUN;
}
if (declType == null) {
if (declType == null && at(IMPORT_KEYWORD)) {
error("imports are only allowed in the beginning of file");
parseImportDirectives();
decl.drop();
}
else if (declType == null) {
errorAndAdvance("Expecting a top level declaration");
decl.drop();
}
@@ -450,6 +438,35 @@ public class KotlinParsing extends AbstractKotlinParsing {
}
}
public IElementType parseCommonDeclaration(
@NotNull ModifierDetector detector,
@NotNull NameParsingMode nameParsingModeForObject,
@NotNull DeclarationParsingMode declarationParsingMode
) {
IElementType keywordToken = tt();
if (keywordToken == CLASS_KEYWORD || keywordToken == INTERFACE_KEYWORD) {
return parseClass(detector.isEnumDetected(), true);
}
else if (keywordToken == FUN_KEYWORD) {
return parseFunction();
}
else if (keywordToken == VAL_KEYWORD || keywordToken == VAR_KEYWORD) {
return parseProperty(declarationParsingMode);
}
else if (keywordToken == TYPE_ALIAS_KEYWORD) {
return parseTypeAlias();
}
else if (keywordToken == OBJECT_KEYWORD) {
parseObject(nameParsingModeForObject, true);
return OBJECT_DECLARATION;
} else if (keywordToken == IDENTIFIER && detector.isEnumDetected() && declarationParsingMode.canBeEnumUsedAsSoftKeyword) {
return parseClass(true, false);
}
return null;
}
/*
* (modifier | annotation)*
*/
@@ -793,12 +810,6 @@ public class KotlinParsing extends AbstractKotlinParsing {
PROHIBITED
}
public enum DeclarationParsingMode {
TOP_LEVEL,
CLASS_MEMBER,
LOCAL
}
/*
* class
* : modifiers ("class" | "interface") SimpleName
@@ -821,15 +832,22 @@ public class KotlinParsing extends AbstractKotlinParsing {
boolean object,
NameParsingMode nameParsingMode,
boolean optionalBody,
boolean enumClass
boolean enumClass,
boolean expectKindKeyword
) {
if (object) {
assert _at(OBJECT_KEYWORD);
if (expectKindKeyword) {
if (object) {
assert _at(OBJECT_KEYWORD);
}
else {
assert _atSet(CLASS_KEYWORD, INTERFACE_KEYWORD);
}
advance(); // CLASS_KEYWORD, INTERFACE_KEYWORD or OBJECT_KEYWORD
}
else {
assert _atSet(CLASS_KEYWORD, INTERFACE_KEYWORD);
assert enumClass : "Currently classifiers without class/interface/object are only allowed for enums";
error("'class' keyword is expected after 'enum'");
}
advance(); // CLASS_KEYWORD, INTERFACE_KEYWORD or OBJECT_KEYWORD
if (nameParsingMode == NameParsingMode.REQUIRED) {
expect(IDENTIFIER, "Name expected", CLASS_NAME_RECOVERY_SET);
@@ -914,12 +932,12 @@ public class KotlinParsing extends AbstractKotlinParsing {
return object ? OBJECT_DECLARATION : CLASS;
}
IElementType parseClass(boolean enumClass) {
return parseClassOrObject(false, NameParsingMode.REQUIRED, true, enumClass);
private IElementType parseClass(boolean enumClass, boolean expectKindKeyword) {
return parseClassOrObject(false, NameParsingMode.REQUIRED, true, enumClass, expectKindKeyword);
}
void parseObject(NameParsingMode nameParsingMode, boolean optionalBody) {
parseClassOrObject(true, nameParsingMode, optionalBody, false);
parseClassOrObject(true, nameParsingMode, optionalBody, false, true);
}
/*
@@ -1097,7 +1115,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
ModifierDetector detector = new ModifierDetector();
parseModifierList(detector, DEFAULT, TokenSet.EMPTY);
IElementType declType = parseMemberDeclarationRest(detector.isEnumDetected(), detector.isDefaultDetected());
IElementType declType = parseMemberDeclarationRest(detector);
if (declType == null) {
errorWithRecovery("Expecting member declaration", TokenSet.EMPTY);
@@ -1108,26 +1126,16 @@ public class KotlinParsing extends AbstractKotlinParsing {
}
}
private IElementType parseMemberDeclarationRest(boolean isEnum, boolean isDefault) {
IElementType keywordToken = tt();
IElementType declType = null;
if (keywordToken == CLASS_KEYWORD || keywordToken == INTERFACE_KEYWORD) {
declType = parseClass(isEnum);
}
else if (keywordToken == FUN_KEYWORD) {
declType = parseFunction();
}
else if (keywordToken == VAL_KEYWORD || keywordToken == VAR_KEYWORD) {
declType = parseProperty();
}
else if (keywordToken == TYPE_ALIAS_KEYWORD) {
declType = parseTypeAlias();
}
else if (keywordToken == OBJECT_KEYWORD) {
parseObject(isDefault ? NameParsingMode.ALLOWED : NameParsingMode.REQUIRED, true);
declType = OBJECT_DECLARATION;
}
else if (at(INIT_KEYWORD)) {
private IElementType parseMemberDeclarationRest(@NotNull ModifierDetector modifierDetector) {
IElementType declType = parseCommonDeclaration(
modifierDetector,
modifierDetector.isCompanionDetected() ? NameParsingMode.ALLOWED : NameParsingMode.REQUIRED,
DeclarationParsingMode.MEMBER_OR_TOPLEVEL
);
if (declType != null) return declType;
if (at(INIT_KEYWORD)) {
advance(); // init
if (at(LBRACE)) {
parseBlock();
@@ -1225,7 +1233,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
* : modifiers "typealias" SimpleName typeParameters? "=" type
* ;
*/
IElementType parseTypeAlias() {
private IElementType parseTypeAlias() {
assert _at(TYPE_ALIAS_KEYWORD);
advance(); // TYPE_ALIAS_KEYWORD
@@ -1249,6 +1257,22 @@ public class KotlinParsing extends AbstractKotlinParsing {
return TYPEALIAS;
}
enum DeclarationParsingMode {
MEMBER_OR_TOPLEVEL(false, true, true),
LOCAL(true, false, false),
SCRIPT_TOPLEVEL(true, true, false);
public final boolean destructuringAllowed;
public final boolean accessorsAllowed;
public final boolean canBeEnumUsedAsSoftKeyword;
DeclarationParsingMode(boolean destructuringAllowed, boolean accessorsAllowed, boolean canBeEnumUsedAsSoftKeyword) {
this.destructuringAllowed = destructuringAllowed;
this.accessorsAllowed = accessorsAllowed;
this.canBeEnumUsedAsSoftKeyword = canBeEnumUsedAsSoftKeyword;
}
}
/*
* variableDeclarationEntry
* : SimpleName (":" type)?
@@ -1264,29 +1288,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
* (getter? setter? | setter? getter?) SEMI?
* ;
*/
private IElementType parseProperty() {
return parseProperty(PropertyParsingMode.MEMBER_OR_TOPLEVEL);
}
public IElementType parseLocalProperty(boolean isScriptTopLevel) {
return parseProperty(isScriptTopLevel ? PropertyParsingMode.SCRIPT_TOPLEVEL : PropertyParsingMode.LOCAL);
}
enum PropertyParsingMode {
MEMBER_OR_TOPLEVEL(false, true),
LOCAL(true, false),
SCRIPT_TOPLEVEL(true, true);
public final boolean destructuringAllowed;
public final boolean accessorsAllowed;
PropertyParsingMode(boolean destructuringAllowed, boolean accessorsAllowed) {
this.destructuringAllowed = destructuringAllowed;
this.accessorsAllowed = accessorsAllowed;
}
}
public IElementType parseProperty(PropertyParsingMode mode) {
public IElementType parseProperty(DeclarationParsingMode mode) {
assert (at(VAL_KEYWORD) || at(VAR_KEYWORD));
advance();
@@ -2255,6 +2257,12 @@ public class KotlinParsing extends AbstractKotlinParsing {
if (at(COMMA)) {
advance(); // COMMA
}
else if (at(COLON)) {
// recovery for the case "fun bar(x: Array<Int> : Int)" when we've just parsed "x: Array<Int>"
// error should be reported in the `parseValueParameter` call
//noinspection UnnecessaryContinue
continue;
}
else {
if (!at(RPAR)) error("Expecting comma or ')'");
if (!atSet(isFunctionTypeContents ? LAMBDA_VALUE_PARAMETER_FIRST : VALUE_PARAMETER_FIRST)) break;
@@ -2325,6 +2333,14 @@ public class KotlinParsing extends AbstractKotlinParsing {
if (at(COLON)) {
advance(); // COLON
if (at(IDENTIFIER) && lookahead(1) == COLON) {
// recovery for the case "fun foo(x: y: Int)" when we're at "y: " it's likely that this is a name of the next parameter,
// not a type reference of the current one
error("Type reference expected");
return false;
}
parseTypeRef();
}
else if (typeRequired) {
@@ -2348,7 +2364,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
/*package*/ static class ModifierDetector implements Consumer<IElementType> {
private boolean enumDetected = false;
private boolean defaultDetected = false;
private boolean companionDetected = false;
@Override
public void consume(IElementType item) {
@@ -2356,7 +2372,7 @@ public class KotlinParsing extends AbstractKotlinParsing {
enumDetected = true;
}
else if (item == KtTokens.COMPANION_KEYWORD) {
defaultDetected = true;
companionDetected = true;
}
}
@@ -2364,8 +2380,8 @@ public class KotlinParsing extends AbstractKotlinParsing {
return enumDetected;
}
public boolean isDefaultDetected() {
return defaultDetected;
public boolean isCompanionDetected() {
return companionDetected;
}
}
@@ -22,6 +22,7 @@ import com.intellij.openapi.fileTypes.FileType
import com.intellij.psi.*
import com.intellij.psi.stubs.StubElement
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.util.ArrayFactory
import com.intellij.util.FileContentUtilCore
import com.intellij.util.IncorrectOperationException
import org.jetbrains.kotlin.KtNodeTypes
@@ -54,13 +55,16 @@ open class KtFile(viewProvider: FileViewProvider, val isCompiled: Boolean) :
private var pathCached: String? = null
val importList: KtImportList?
get() = findChildByTypeOrClass(KtStubElementTypes.IMPORT_LIST, KtImportList::class.java)
get() = importLists.firstOrNull()
private val importLists: Array<out KtImportList>
get() = findChildrenByTypeOrClass(KtStubElementTypes.IMPORT_LIST, KtImportList::class.java)
val fileAnnotationList: KtFileAnnotationList?
get() = findChildByTypeOrClass(KtStubElementTypes.FILE_ANNOTATION_LIST, KtFileAnnotationList::class.java)
open val importDirectives: List<KtImportDirective>
get() = importList?.imports ?: emptyList()
get() = importLists.flatMap { it.imports }
// scripts have no package directive, all other files must have package directives
val packageDirective: KtPackageDirective?
@@ -154,6 +158,19 @@ open class KtFile(viewProvider: FileViewProvider, val isCompiled: Boolean) :
return findChildByClass(elementClass)
}
fun <T : KtElementImplStub<out StubElement<*>>> findChildrenByTypeOrClass(
elementType: KtPlaceHolderStubElementType<T>,
elementClass: Class<T>
): Array<out T> {
val stub = stub
if (stub != null) {
val arrayFactory: ArrayFactory<T> = elementType.arrayFactory
return stub.getChildrenByType(elementType, arrayFactory)
}
return findChildrenByClass(elementClass)
}
fun findImportByAlias(name: String): KtImportDirective? =
importDirectives.firstOrNull { name == it.aliasName }
@@ -29,22 +29,17 @@ class IsFunctor(val type: KotlinType, val isNegated: Boolean) : AbstractReducing
fun invokeWithArguments(arg: Computation): List<ESEffect> {
return if (arg is ESValue)
invokeWithValue(arg, null)
invokeWithValue(arg)
else
arg.effects.flatMap {
if (it !is ConditionalEffect || it.simpleEffect !is ESReturns || it.simpleEffect.value == ESConstant.WILDCARD)
listOf(it)
else
invokeWithValue(it.simpleEffect.value, it.condition)
}
emptyList()
}
private fun invokeWithValue(value: ESValue, additionalCondition: ESExpression?): List<ConditionalEffect> {
private fun invokeWithValue(value: ESValue): List<ConditionalEffect> {
val trueIs = ESIs(value, this)
val falseIs = ESIs(value, IsFunctor(type, isNegated.not()))
val trueResult = ConditionalEffect(trueIs.and(additionalCondition), ESReturns(true.lift()))
val falseResult = ConditionalEffect(falseIs.and(additionalCondition), ESReturns(false.lift()))
val trueResult = ConditionalEffect(trueIs, ESReturns(true.lift()))
val falseResult = ConditionalEffect(falseIs, ESReturns(false.lift()))
return listOf(trueResult, falseResult)
}
}
@@ -1,5 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
fun sort(list: MutableList<String>, comparator: (String, String) -> Int) {
@@ -0,0 +1,21 @@
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
interface Wrapper { fun runBlock() }
inline fun crossInlineBuildWrapper(crossinline block: () -> Unit) = object : Wrapper {
override fun runBlock() {
block()
}
}
class Container {
val wrapper = crossInlineBuildWrapper {
object { }
}
}
fun box(): String {
Container().wrapper.runBlock()
return "OK"
}
@@ -1,6 +1,5 @@
// WITH_REFLECT
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
import java.util.Arrays
@@ -1,6 +1,5 @@
// !LANGUAGE: -ReleaseCoroutines
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS
+2
View File
@@ -1,3 +1,5 @@
// IGNORE_BACKEND: JVM_IR
interface Callback {
fun invoke(): String
}
@@ -1,5 +1,4 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM_IR
// WITH_REFLECT
import kotlin.test.assertEquals
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
@@ -1,5 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
fun box(): String {
@@ -1,5 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND: JS_IR
// WITH_RUNTIME
fun box(): String {
@@ -0,0 +1,35 @@
// WITH_RUNTIME
// IGNORE_BACKEND: JS, JVM_IR
const val M1: UInt = 2147483648u
const val M2: ULong = 9223372036854775808UL
fun testUInt(x: UInt) =
when (x) {
0u -> "none"
1u -> "one"
2u -> "two"
3u -> "three"
M1 -> "M1"
else -> "many"
}
fun testULong(x: ULong) =
when (x) {
0UL -> "none"
1UL -> "one"
2UL -> "two"
3UL -> "three"
M2 -> "M2"
else -> "many"
}
fun box(): String {
val t1 = listOf(0u, 1u, 2u, 3u, 4u, M1).map { testUInt(it) }
if (t1 != listOf("none", "one", "two", "three", "many", "M1")) throw AssertionError("UInt: $t1")
val t2 = listOf(0UL, 1UL, 2UL, 3UL, 4UL, M2).map { testULong(it) }
if (t2 != listOf("none", "one", "two", "three", "many", "M2")) throw AssertionError("ULong: $t2")
return "OK"
}
@@ -1,6 +1,5 @@
// WITH_REFLECT
// IGNORE_BACKEND: JVM_IR
// TARGET_BACKEND: JVM
// FILE: JavaAnn.java
@@ -1,6 +1,5 @@
// !LANGUAGE: +MultiPlatformProjects
// WITH_REFLECT
// IGNORE_BACKEND: JVM_IR
// FILE: main.kt
// See compiler/testData/diagnostics/tests/multiplatform/defaultArguments/annotationsViaActualTypeAlias2.kt
@@ -0,0 +1,28 @@
// WITH_RUNTIME
// IGNORE_BACKEND: JVM_IR
const val M1: UInt = 2147483648u
fun testUInt1(x: UInt) =
when (x) {
0u -> "none"
1u -> "one"
2u -> "two"
3u -> "three"
else -> "many"
}
fun testUInt2(x: UInt) =
when (x) {
0u -> "none"
1u -> "one"
2u -> "two"
3u -> "three"
M1 -> "M1"
else -> "many"
}
// 2 SWITCH
// ^ This captures both TABLESWITCH and LOOKUPSWITCH; we don't care about nuances of *SWITCH instruction generation here.
// 0 IF_ICMP
+4 -4
View File
@@ -4,10 +4,10 @@ fun test(<!UNUSED_PARAMETER!>c<!> : Char) {
test(<!TOO_MANY_CHARACTERS_IN_CHARACTER_LITERAL!>'aa'<!>)
test(<!INCORRECT_CHARACTER_LITERAL!>'a)<!>
<!UNRESOLVED_REFERENCE!>test<!>(<!INCORRECT_CHARACTER_LITERAL!>'<!>
<!UNRESOLVED_REFERENCE!>test<!>(0<!SYNTAX!><!SYNTAX!><!>'<!>
test('\n')
test('\\')
test(<!EMPTY_CHARACTER_LITERAL!>''<!><!SYNTAX!>''<!><!SYNTAX!>)<!>
<!UNRESOLVED_REFERENCE!>test<!>(0<!INCORRECT_CHARACTER_LITERAL!><!SYNTAX!><!>'<!>
<!UNRESOLVED_REFERENCE!>test<!>('\n')
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>test<!>('\\')
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>test<!>(<!EMPTY_CHARACTER_LITERAL!>''<!><!EMPTY_CHARACTER_LITERAL, TOO_MANY_ARGUMENTS!><!SYNTAX!><!>''<!>)
test('\'')
test('\"')
}
@@ -0,0 +1,105 @@
// !WITH_NEW_INFERENCE
// FILE:a.kt
package a
<!OI;SYNTAX!><<!><!OI;SYNTAX!><<!><!OI;SYNTAX!><<!> <!OI;SYNTAX!>FOOO<!><!OI;SYNTAX!><!>
import b.B //class
import b.foo //function
import b.ext //extension function
import b.value //property
import b.C.Companion.bar //function from companion object
import b.C.Companion.cValue //property from companion object
import b.<!UNRESOLVED_REFERENCE!>constant<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>fff<!> //function from val
import b.<!UNRESOLVED_REFERENCE!>constant<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>dValue<!> //property from val
import <!UNRESOLVED_REFERENCE!>smth<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>illegal<!>
import b.C.<!UNRESOLVED_REFERENCE!>smth<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>illegal<!>
<!OI;SYNTAX!><<!><!OI;SYNTAX!><<!><!OI;SYNTAX!><<!><!OI;SYNTAX!>HEAD<!><!OI;SYNTAX!><!>
import b.<!UNRESOLVED_REFERENCE!>bar<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>smth<!>
import b.<!UNRESOLVED_REFERENCE!>bar<!>.*
import b.<!UNRESOLVED_REFERENCE!>unr<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>unr<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>unr<!>
import <!UNRESOLVED_REFERENCE!>unr<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>unr<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>unr<!>
import b.constant
import b.E.Companion.f //val from companion object
fun test(arg: B) {
foo(value)
arg.ext()
bar()
foo(cValue)
<!UNRESOLVED_REFERENCE!>fff<!>(<!UNRESOLVED_REFERENCE!>dValue<!>)
constant.fff(constant.dValue)
f.f()
}
// FILE:b.kt
package b
class B() {}
fun foo(i: Int) = i
fun B.ext() {}
val value = 0
class C() {
companion object {
fun bar() {}
val cValue = 1
}
}
class D() {
fun fff(s: String) = s
val dValue = "w"
}
val constant = D()
class E() {
companion object {
val f = F()
}
}
class F() {
fun f() {}
}
fun bar() {}
//FILE:c.kt
package c
import c.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>C<!>.*
object C {
fun f() {
}
val i = 348
}
fun foo() {
if (<!UNRESOLVED_REFERENCE!>i<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>==<!> 3) <!UNRESOLVED_REFERENCE!>f<!>()
}
//FILE:d.kt
package d
import d.A.Companion.B
import d.A.Companion.C
val b : B = B()
val c : B = C
class A() {
companion object {
open class B() {}
object C : B() {}
}
}
@@ -0,0 +1,114 @@
package
package a {
public fun test(/*0*/ arg: b.B): kotlin.Unit
}
package b {
public val constant: b.D
public val value: kotlin.Int = 0
public fun bar(): kotlin.Unit
public fun foo(/*0*/ i: kotlin.Int): kotlin.Int
public fun b.B.ext(): kotlin.Unit
public final class B {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class C {
public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public companion object Companion {
private constructor Companion()
public final val cValue: kotlin.Int = 1
public final fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public final class D {
public constructor D()
public final val dValue: kotlin.String = "w"
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun fff(/*0*/ s: kotlin.String): kotlin.String
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class E {
public constructor E()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public companion object Companion {
private constructor Companion()
public final val f: b.F
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public final class F {
public constructor F()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun f(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
package c {
public fun foo(): kotlin.Unit
public object C {
private constructor C()
public final val i: kotlin.Int = 348
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun f(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
package d {
public val b: d.A.Companion.B
public val c: d.A.Companion.B
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public companion object Companion {
private constructor Companion()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public open class B {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public object C : d.A.Companion.B {
private constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
}
}
@@ -119,7 +119,7 @@ class IllegalModifiers7() {
// Secondary constructors
class IllegalModifiers8 {
<!WRONG_MODIFIER_TARGET!>abstract<!>
<!WRONG_MODIFIER_TARGET!>enum<!>
enum
<!REDUNDANT_MODIFIER, WRONG_MODIFIER_TARGET!>open<!>
<!WRONG_MODIFIER_TARGET!>inner<!>
<!WRONG_MODIFIER_TARGET!>annotation<!>
@@ -129,7 +129,7 @@ class IllegalModifiers8 {
<!INCOMPATIBLE_MODIFIERS!>final<!>
<!WRONG_MODIFIER_TARGET!>vararg<!>
<!WRONG_MODIFIER_TARGET!>reified<!>
<!INCOMPATIBLE_MODIFIERS!>const<!>
<!INCOMPATIBLE_MODIFIERS!>const<!><!SYNTAX!><!>
constructor() {}
constructor(<!WRONG_MODIFIER_TARGET!>private<!> <!WRONG_MODIFIER_TARGET!>enum<!> <!INCOMPATIBLE_MODIFIERS!>abstract<!> <!UNUSED_PARAMETER!>x<!>: Int) {}
@@ -108,11 +108,27 @@ package illegal_modifiers {
}
public final class IllegalModifiers8 {
public constructor IllegalModifiers8()
public constructor IllegalModifiers8(/*0*/ x: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public abstract enum class constructor : kotlin.Enum<illegal_modifiers.IllegalModifiers8.constructor> {
private constructor constructor()
public final override /*1*/ /*fake_override*/ val name: kotlin.String
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: illegal_modifiers.IllegalModifiers8.constructor): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<illegal_modifiers.IllegalModifiers8.constructor!>!
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): illegal_modifiers.IllegalModifiers8.constructor
public final /*synthesized*/ fun values(): kotlin.Array<illegal_modifiers.IllegalModifiers8.constructor>
}
}
public final class IllegalModifiers9 {
@@ -0,0 +1,11 @@
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
import kotlin.contracts.*
fun f3(value: String?) {
if (<!USELESS_IS_CHECK!>!value.isNullOrEmpty() is Boolean<!>) {
value<!UNSAFE_CALL!>.<!>length
}
}
@@ -0,0 +1,3 @@
package
public fun f3(/*0*/ value: kotlin.String?): kotlin.Unit
+12 -13
View File
@@ -23,21 +23,20 @@ KtFile: EnumWithAnnotationKeyword.kt
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
MODIFIER_LIST
PsiElement(enum)('enum')
PsiWhiteSpace(' ')
PsiElement(annotation)('annotation')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting a top level declaration
PsiElement(IDENTIFIER)('E1')
PsiWhiteSpace(' ')
FUN
PsiErrorElement:Expecting a top level declaration
CLASS
MODIFIER_LIST
PsiElement(enum)('enum')
PsiWhiteSpace(' ')
PsiElement(annotation)('annotation')
PsiErrorElement:'class' keyword is expected after 'enum'
<empty list>
BLOCK
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('E1')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
REFERENCE_EXPRESSION
ENUM_ENTRY
PsiElement(IDENTIFIER)('D')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiElement(RBRACE)('}')
+8 -5
View File
@@ -14,9 +14,12 @@ KtFile: FileStart_ERR.kt
PsiElement(DOT)('.')
PsiErrorElement:Expecting a top level declaration
PsiElement(IDENTIFIER)('bar')
PsiErrorElement:imports are only allowed in the beginning of file
<empty list>
PsiWhiteSpace('\n')
PsiErrorElement:Expecting a top level declaration
PsiElement(IDENTIFIER)('import')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting a top level declaration
PsiElement(IDENTIFIER)('foo')
IMPORT_LIST
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('foo')
+46 -43
View File
@@ -575,61 +575,64 @@ KtFile: FunctionExpressions_ERR.kt
PsiElement(RPAR)(')')
PsiWhiteSpace('\n\n\n ')
CALL_EXPRESSION
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('public')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting ')'
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('public')
PsiErrorElement:Expecting ','
<empty list>
PsiWhiteSpace(' ')
VALUE_ARGUMENT
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(RPAR)(')')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('open')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting ')'
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('open')
PsiErrorElement:Expecting ','
<empty list>
PsiWhiteSpace(' ')
VALUE_ARGUMENT
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(RPAR)(')')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('final')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting ')'
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('final')
PsiErrorElement:Expecting ','
<empty list>
PsiWhiteSpace(' ')
VALUE_ARGUMENT
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiElement(RPAR)(')')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(RPAR)(')')
PsiWhiteSpace('\n\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
@@ -659,4 +662,4 @@ KtFile: FunctionExpressions_ERR.kt
PsiElement(IDENTIFIER)('V')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiElement(RBRACE)('}')
+22
View File
@@ -0,0 +1,22 @@
fun foo() {
bar1(
A()
A()
)
bar2(A() A())
bar3(x y)
bar4(x
y
)
bar5("" "")
bar6(""
""
)
bar7({} {})
bar8({}
{}
)
}
+182
View File
@@ -0,0 +1,182 @@
KtFile: noCommaBetweenArguments.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar1')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiWhiteSpace('\n ')
VALUE_ARGUMENT
BINARY_EXPRESSION
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
OPERATION_REFERENCE
PsiElement(IDENTIFIER)('A')
PARENTHESIZED
PsiElement(LPAR)('(')
PsiErrorElement:Expecting an expression
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar2')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
BINARY_EXPRESSION
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(IDENTIFIER)('A')
PARENTHESIZED
PsiElement(LPAR)('(')
PsiErrorElement:Expecting an expression
<empty list>
PsiElement(RPAR)(')')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar3')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(IDENTIFIER)('y')
PsiErrorElement:Expecting an element
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar4')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('x')
PsiWhiteSpace('\n ')
OPERATION_REFERENCE
PsiElement(IDENTIFIER)('y')
PsiErrorElement:Expecting an element
<empty list>
PsiWhiteSpace('\n ')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar5')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
STRING_TEMPLATE
PsiElement(OPEN_QUOTE)('"')
PsiElement(CLOSING_QUOTE)('"')
PsiErrorElement:Expecting ','
<empty list>
PsiWhiteSpace(' ')
VALUE_ARGUMENT
STRING_TEMPLATE
PsiElement(OPEN_QUOTE)('"')
PsiElement(CLOSING_QUOTE)('"')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar6')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
STRING_TEMPLATE
PsiElement(OPEN_QUOTE)('"')
PsiElement(CLOSING_QUOTE)('"')
PsiErrorElement:Expecting ','
<empty list>
PsiWhiteSpace('\n ')
VALUE_ARGUMENT
STRING_TEMPLATE
PsiElement(OPEN_QUOTE)('"')
PsiElement(CLOSING_QUOTE)('"')
PsiWhiteSpace('\n ')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar7')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
CALL_EXPRESSION
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace(' ')
LAMBDA_ARGUMENT
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('bar8')
VALUE_ARGUMENT_LIST
PsiElement(LPAR)('(')
VALUE_ARGUMENT
CALL_EXPRESSION
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
LAMBDA_ARGUMENT
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n ')
PsiElement(RPAR)(')')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
+9
View File
@@ -0,0 +1,9 @@
fun foo1(x: List<A<, s: String): A {}
fun foo2(x: List<A< s: String): A {}
fun foo3(x: List<A<,): A {}
fun foo4(x: List<A<): A {}
fun foo5(x: List<A<,) {}
fun foo6(x: List<A<) {}
fun foo7(x: List<A<,) = 1
fun main() {}
+314
View File
@@ -0,0 +1,314 @@
KtFile: NoGTInTypeArguments.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo1')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('List')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('s')
PsiErrorElement:Expecting a '>'
<empty list>
VALUE_PARAMETER
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('String')
PsiElement(RPAR)(')')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo2')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('List')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
PsiWhiteSpace(' ')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('s')
PsiErrorElement:Expecting a '>'
<empty list>
VALUE_PARAMETER
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('String')
PsiElement(RPAR)(')')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo3')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('List')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(COMMA)(',')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(RPAR)(')')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo4')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('List')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(RPAR)(')')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo5')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('List')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(COMMA)(',')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo6')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('List')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo7')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('List')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('A')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(COMMA)(',')
TYPE_PROJECTION
TYPE_REFERENCE
PsiErrorElement:Type expected
<empty list>
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
PsiElement(EQ)('=')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('main')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
+4
View File
@@ -0,0 +1,4 @@
fun Any.
fun goodFunction() {
}
+28
View File
@@ -0,0 +1,28 @@
KtFile: UnfinishedExtension.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Any')
PsiElement(DOT)('.')
PsiErrorElement:Expecting function name
<empty list>
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('goodFunction')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
+18
View File
@@ -0,0 +1,18 @@
enum A { X, Y }
private enum B {
X, Y
}
internal Q {
X, Y
}
fun foo() {
// No recovery here
enum A { X, Y }
private enum B {
X, Y
}
}
+137
View File
@@ -0,0 +1,137 @@
KtFile: enumWthoutClass.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
CLASS
MODIFIER_LIST
PsiElement(enum)('enum')
PsiErrorElement:'class' keyword is expected after 'enum'
<empty list>
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('A')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
ENUM_ENTRY
PsiElement(IDENTIFIER)('X')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
ENUM_ENTRY
PsiElement(IDENTIFIER)('Y')
PsiWhiteSpace(' ')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
CLASS
MODIFIER_LIST
PsiElement(private)('private')
PsiWhiteSpace(' ')
PsiElement(enum)('enum')
PsiErrorElement:'class' keyword is expected after 'enum'
<empty list>
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('B')
PsiWhiteSpace(' ')
CLASS_BODY
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
ENUM_ENTRY
PsiElement(IDENTIFIER)('X')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
ENUM_ENTRY
PsiElement(IDENTIFIER)('Y')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
MODIFIER_LIST
PsiElement(internal)('internal')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting a top level declaration
PsiElement(IDENTIFIER)('Q')
PsiWhiteSpace(' ')
FUN
PsiErrorElement:Expecting a top level declaration
<empty list>
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('X')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('Y')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
PsiComment(EOL_COMMENT)('// No recovery here')
PsiWhiteSpace('\n ')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('enum')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(IDENTIFIER)('A')
PsiWhiteSpace(' ')
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace(' ')
VALUE_PARAMETER_LIST
VALUE_PARAMETER
PsiElement(IDENTIFIER)('X')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('Y')
PsiErrorElement:Expecting '->' or ','
<empty list>
PsiWhiteSpace(' ')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n ')
BINARY_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('private')
PsiWhiteSpace(' ')
OPERATION_REFERENCE
PsiElement(IDENTIFIER)('enum')
PsiWhiteSpace(' ')
CALL_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('B')
PsiWhiteSpace(' ')
LAMBDA_ARGUMENT
LAMBDA_EXPRESSION
FUNCTION_LITERAL
PsiElement(LBRACE)('{')
PsiWhiteSpace('\n ')
VALUE_PARAMETER_LIST
VALUE_PARAMETER
PsiElement(IDENTIFIER)('X')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('Y')
PsiErrorElement:Expecting '->' or ','
<empty list>
PsiWhiteSpace('\n ')
BLOCK
<empty list>
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
PsiElement(RBRACE)('}')
+14
View File
@@ -0,0 +1,14 @@
package a
import a1
<<<HEAD
import a2
import a3
>>> BAR
fun bar() {}
import a2
import a4.df
fun foo() {}
+90
View File
@@ -0,0 +1,90 @@
KtFile: importsWithConflict.kt
PACKAGE_DIRECTIVE
PsiElement(package)('package')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a')
PsiWhiteSpace('\n\n')
IMPORT_LIST
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a1')
PsiWhiteSpace('\n')
PsiErrorElement:Expecting a top level declaration
PsiElement(LT)('<')
PsiErrorElement:Expecting a top level declaration
PsiElement(LT)('<')
PsiErrorElement:Expecting a top level declaration
PsiElement(LT)('<')
PsiErrorElement:Expecting a top level declaration
PsiElement(IDENTIFIER)('HEAD')
PsiErrorElement:imports are only allowed in the beginning of file
<empty list>
PsiWhiteSpace('\n')
IMPORT_LIST
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a2')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a3')
PsiWhiteSpace('\n')
PsiErrorElement:Expecting a top level declaration
PsiElement(GT)('>')
PsiErrorElement:Expecting a top level declaration
PsiElement(GT)('>')
PsiErrorElement:Expecting a top level declaration
PsiElement(GT)('>')
PsiWhiteSpace(' ')
PsiErrorElement:Expecting a top level declaration
PsiElement(IDENTIFIER)('BAR')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('bar')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiErrorElement:imports are only allowed in the beginning of file
<empty list>
PsiWhiteSpace('\n\n')
IMPORT_LIST
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a2')
PsiWhiteSpace('\n')
IMPORT_DIRECTIVE
PsiElement(import)('import')
PsiWhiteSpace(' ')
DOT_QUALIFIED_EXPRESSION
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('a4')
PsiElement(DOT)('.')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('df')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
@@ -0,0 +1,5 @@
fun foo(x: Int, y: z: Int) {}
fun bar(x: y: Int, z: Int) {}
fun baz(x: y: z: Int) {}
@@ -0,0 +1,108 @@
KtFile: valueParameterRecovery.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('y')
PsiElement(COLON)(':')
PsiErrorElement:Type reference expected
<empty list>
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('z')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('bar')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiErrorElement:Type reference expected
<empty list>
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('y')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('z')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('baz')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiErrorElement:Type reference expected
<empty list>
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('y')
PsiElement(COLON)(':')
PsiErrorElement:Type reference expected
<empty list>
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('z')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
@@ -0,0 +1,2 @@
fun foo(x: Array<Int>, : Int, w: Int) {}
fun bar(x: Array<Int> : Int, w: Int) {}
@@ -0,0 +1,101 @@
KtFile: valueParameterRecoveryWithTypes.kt
PACKAGE_DIRECTIVE
<empty list>
IMPORT_LIST
<empty list>
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('foo')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Array')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(GT)('>')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiErrorElement:Parameter name expected
<empty list>
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('w')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
PsiWhiteSpace('\n')
FUN
PsiElement(fun)('fun')
PsiWhiteSpace(' ')
PsiElement(IDENTIFIER)('bar')
VALUE_PARAMETER_LIST
PsiElement(LPAR)('(')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('x')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Array')
TYPE_ARGUMENT_LIST
PsiElement(LT)('<')
TYPE_PROJECTION
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(GT)('>')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiErrorElement:Parameter name expected
<empty list>
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
VALUE_PARAMETER
PsiElement(IDENTIFIER)('w')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(RPAR)(')')
PsiWhiteSpace(' ')
BLOCK
PsiElement(LBRACE)('{')
PsiElement(RBRACE)('}')
@@ -7,7 +7,6 @@
* SECTIONS: contracts, analysis, smartcasts
* NUMBER: 15
* DESCRIPTION: Check smartcasts working if type checking for contract function is used
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-27241
*/
@@ -40,20 +39,20 @@ import contracts.*
// TESTCASE NUMBER: 1
fun case_1(value: Any) {
if (contracts.case_1_2(contracts.case_1_1(value is Char))) {
println(<!DEBUG_INFO_SMARTCAST!>value<!>.category)
println(value.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>category<!>)
}
}
// TESTCASE NUMBER: 2
fun case_2(value: Any) {
if (contracts.case_2(value is Char) is Boolean) {
println(<!DEBUG_INFO_SMARTCAST!>value<!>.category)
println(value.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>category<!>)
}
}
// TESTCASE NUMBER: 3
fun case_3(value: String?) {
if (<!USELESS_IS_CHECK!>!value.isNullOrEmpty() is Boolean<!>) {
<!DEBUG_INFO_SMARTCAST!>value<!>.length
value<!UNSAFE_CALL!>.<!>length
}
}
@@ -9071,6 +9071,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/imports/TopLevelClassVsPackage.kt");
}
@TestMetadata("twoImportLists.kt")
public void testTwoImportLists() throws Exception {
runTest("compiler/testData/diagnostics/tests/imports/twoImportLists.kt");
}
@TestMetadata("WrongImport.kt")
public void testWrongImport() throws Exception {
runTest("compiler/testData/diagnostics/tests/imports/WrongImport.kt");
@@ -1341,6 +1341,11 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/unreachableBranches.kt");
}
@TestMetadata("valueOfContractedFunctionIngored.kt")
public void testValueOfContractedFunctionIngored() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/valueOfContractedFunctionIngored.kt");
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -1341,6 +1341,11 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/unreachableBranches.kt");
}
@TestMetadata("valueOfContractedFunctionIngored.kt")
public void testValueOfContractedFunctionIngored() throws Exception {
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/valueOfContractedFunctionIngored.kt");
}
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/contracts/smartcasts/multieffect")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -9071,6 +9071,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/imports/TopLevelClassVsPackage.kt");
}
@TestMetadata("twoImportLists.kt")
public void testTwoImportLists() throws Exception {
runTest("compiler/testData/diagnostics/tests/imports/twoImportLists.kt");
}
@TestMetadata("WrongImport.kt")
public void testWrongImport() throws Exception {
runTest("compiler/testData/diagnostics/tests/imports/WrongImport.kt");
@@ -49,7 +49,8 @@ class CodeConformanceTest : TestCase() {
"libraries/tools/kotlinp/src",
"compiler/testData/psi/kdoc",
"compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt",
"compiler/util/src/org/jetbrains/kotlin/config/MavenComparableVersion.java"
"compiler/util/src/org/jetbrains/kotlin/config/MavenComparableVersion.java",
"custom-dependencies/protobuf/protobuf-relocated/build"
).map(::File)
private val COPYRIGHT_EXCLUDED_FILES_AND_DIRS = listOf(
@@ -57,6 +58,7 @@ class CodeConformanceTest : TestCase() {
"out",
"dist",
"custom-dependencies/android-sdk/build",
"custom-dependencies/protobuf/protobuf-relocated/build",
"compiler/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt",
"idea/idea-jvm/src/org/jetbrains/kotlin/idea/copyright",
"js/js.tests/.gradle",
@@ -3686,6 +3686,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/closures/closureWithParameterAndBoxing.kt");
}
@TestMetadata("crossinlineLocalDeclaration.kt")
public void testCrossinlineLocalDeclaration() throws Exception {
runTest("compiler/testData/codegen/box/closures/crossinlineLocalDeclaration.kt");
}
@TestMetadata("doubleEnclosedLocalVariable.kt")
public void testDoubleEnclosedLocalVariable() throws Exception {
runTest("compiler/testData/codegen/box/closures/doubleEnclosedLocalVariable.kt");
@@ -24357,6 +24362,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
public void testVarargsOfUnsignedTypes() throws Exception {
runTest("compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt");
}
@TestMetadata("whenByUnsigned.kt")
public void testWhenByUnsigned() throws Exception {
runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/vararg")
@@ -3182,6 +3182,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
public void testUnsignedLongRemainder_jvm18() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongRemainder_jvm18.kt");
}
@TestMetadata("whenByUnsigned.kt")
public void testWhenByUnsigned() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/unsignedTypes/whenByUnsigned.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/varargs")
@@ -3182,6 +3182,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
public void testUnsignedLongRemainder_jvm18() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/unsignedTypes/unsignedLongRemainder_jvm18.kt");
}
@TestMetadata("whenByUnsigned.kt")
public void testWhenByUnsigned() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/unsignedTypes/whenByUnsigned.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/varargs")
@@ -3686,6 +3686,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/closures/closureWithParameterAndBoxing.kt");
}
@TestMetadata("crossinlineLocalDeclaration.kt")
public void testCrossinlineLocalDeclaration() throws Exception {
runTest("compiler/testData/codegen/box/closures/crossinlineLocalDeclaration.kt");
}
@TestMetadata("doubleEnclosedLocalVariable.kt")
public void testDoubleEnclosedLocalVariable() throws Exception {
runTest("compiler/testData/codegen/box/closures/doubleEnclosedLocalVariable.kt");
@@ -24357,6 +24362,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
public void testVarargsOfUnsignedTypes() throws Exception {
runTest("compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt");
}
@TestMetadata("whenByUnsigned.kt")
public void testWhenByUnsigned() throws Exception {
runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/vararg")
@@ -3686,6 +3686,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/closures/closureWithParameterAndBoxing.kt");
}
@TestMetadata("crossinlineLocalDeclaration.kt")
public void testCrossinlineLocalDeclaration() throws Exception {
runTest("compiler/testData/codegen/box/closures/crossinlineLocalDeclaration.kt");
}
@TestMetadata("doubleEnclosedLocalVariable.kt")
public void testDoubleEnclosedLocalVariable() throws Exception {
runTest("compiler/testData/codegen/box/closures/doubleEnclosedLocalVariable.kt");
@@ -24362,6 +24367,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
public void testVarargsOfUnsignedTypes() throws Exception {
runTest("compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt");
}
@TestMetadata("whenByUnsigned.kt")
public void testWhenByUnsigned() throws Exception {
runTest("compiler/testData/codegen/box/unsignedTypes/whenByUnsigned.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/vararg")
@@ -521,6 +521,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
runTest("compiler/testData/psi/NewlinesInParentheses.kt");
}
@TestMetadata("noCommaBetweenArguments.kt")
public void testNoCommaBetweenArguments() throws Exception {
runTest("compiler/testData/psi/noCommaBetweenArguments.kt");
}
@TestMetadata("NonTypeBeforeDotInBaseClass.kt")
public void testNonTypeBeforeDotInBaseClass() throws Exception {
runTest("compiler/testData/psi/NonTypeBeforeDotInBaseClass.kt");
@@ -1933,6 +1938,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
runTest("compiler/testData/psi/recovery/DoWhileWithoutLPar.kt");
}
@TestMetadata("enumWthoutClass.kt")
public void testEnumWthoutClass() throws Exception {
runTest("compiler/testData/psi/recovery/enumWthoutClass.kt");
}
@TestMetadata("ForEmptyParentheses.kt")
public void testForEmptyParentheses() throws Exception {
runTest("compiler/testData/psi/recovery/ForEmptyParentheses.kt");
@@ -2008,6 +2018,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
runTest("compiler/testData/psi/recovery/ImportRecovery.kt");
}
@TestMetadata("importsWithConflict.kt")
public void testImportsWithConflict() throws Exception {
runTest("compiler/testData/psi/recovery/importsWithConflict.kt");
}
@TestMetadata("IncompleteAccessor1.kt")
public void testIncompleteAccessor1() throws Exception {
runTest("compiler/testData/psi/recovery/IncompleteAccessor1.kt");
@@ -2143,6 +2158,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
runTest("compiler/testData/psi/recovery/NoArrowInWhen.kt");
}
@TestMetadata("NoGTInTypeArguments.kt")
public void testNoGTInTypeArguments() throws Exception {
runTest("compiler/testData/psi/recovery/NoGTInTypeArguments.kt");
}
@TestMetadata("PackageNewLineRecovery.kt")
public void testPackageNewLineRecovery() throws Exception {
runTest("compiler/testData/psi/recovery/PackageNewLineRecovery.kt");
@@ -2158,6 +2178,11 @@ public class ParsingTestGenerated extends AbstractParsingTest {
runTest("compiler/testData/psi/recovery/SameLineStatementRecovery.kt");
}
@TestMetadata("UnfinishedExtension.kt")
public void testUnfinishedExtension() throws Exception {
runTest("compiler/testData/psi/recovery/UnfinishedExtension.kt");
}
@TestMetadata("ValNoName.kt")
public void testValNoName() throws Exception {
runTest("compiler/testData/psi/recovery/ValNoName.kt");
@@ -2178,6 +2203,16 @@ public class ParsingTestGenerated extends AbstractParsingTest {
runTest("compiler/testData/psi/recovery/ValueParameterNoTypeRecovery.kt");
}
@TestMetadata("valueParameterRecovery.kt")
public void testValueParameterRecovery() throws Exception {
runTest("compiler/testData/psi/recovery/valueParameterRecovery.kt");
}
@TestMetadata("valueParameterRecoveryWithTypes.kt")
public void testValueParameterRecoveryWithTypes() throws Exception {
runTest("compiler/testData/psi/recovery/valueParameterRecoveryWithTypes.kt");
}
@TestMetadata("WhenWithoutBraces.kt")
public void testWhenWithoutBraces() throws Exception {
runTest("compiler/testData/psi/recovery/WhenWithoutBraces.kt");
-5
View File
@@ -20,11 +20,6 @@ sourceSets {
}
tasks.withType<JavaCompile> {
dependsOn(protobufLiteTask)
sourceCompatibility = "1.6"
targetCompatibility = "1.6"
}
tasks.withType<KotlinCompile> {
dependsOn(protobufLiteTask)
}

Some files were not shown because too many files have changed in this diff Show More