Merge commits from both masters and update to 1.5.0-dev-805 compiler
Kotlin/Native base commit: 44514776e438151b3cc33d2e891c12764dbb3319
This commit is contained in:
+2
-1
@@ -15,6 +15,7 @@
|
||||
<option value=":compiler:tests-against-klib:generateTests" />
|
||||
<option value=":js:js.tests:generateTests" />
|
||||
<option value=":core:descriptors.runtime:generateTests" />
|
||||
<option value=":compiler:tests-common-new:generateTests" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
@@ -22,4 +23,4 @@
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.incremental
|
||||
import com.intellij.util.io.EnumeratorStringDescriptor
|
||||
import org.jetbrains.kotlin.incremental.storage.*
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
|
||||
import org.jetbrains.kotlin.metadata.deserialization.supertypes
|
||||
@@ -34,12 +35,15 @@ interface IncrementalCacheCommon {
|
||||
val thisWithDependentCaches: Iterable<AbstractIncrementalCache<*>>
|
||||
fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName>
|
||||
fun getSubtypesOf(className: FqName): Sequence<FqName>
|
||||
fun getSupertypesOf(className: FqName): Sequence<FqName>
|
||||
fun getSourceFileIfClass(fqName: FqName): File?
|
||||
fun markDirty(removedAndCompiledSources: Collection<File>)
|
||||
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
|
||||
fun getComplementaryFilesRecursive(dirtyFiles: Collection<File>): Collection<File>
|
||||
fun updateComplementaryFiles(dirtyFiles: Collection<File>, expectActualTracker: ExpectActualTrackerImpl)
|
||||
fun dump(): String
|
||||
|
||||
fun isSealed(className: FqName): Boolean?
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +54,7 @@ abstract class AbstractIncrementalCache<ClassName>(
|
||||
protected val pathConverter: FileToPathConverter
|
||||
) : BasicMapsOwner(workingDir), IncrementalCacheCommon {
|
||||
companion object {
|
||||
private val CLASS_ATTRIBUTES = "class-attributes"
|
||||
private val SUBTYPES = "subtypes"
|
||||
private val SUPERTYPES = "supertypes"
|
||||
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
|
||||
@@ -71,6 +76,7 @@ abstract class AbstractIncrementalCache<ClassName>(
|
||||
result
|
||||
}
|
||||
|
||||
internal val classAttributesMap = registerMap(ClassAttributesMap(CLASS_ATTRIBUTES.storageFile))
|
||||
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
|
||||
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
|
||||
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile, pathConverter))
|
||||
@@ -90,6 +96,14 @@ abstract class AbstractIncrementalCache<ClassName>(
|
||||
override fun getSubtypesOf(className: FqName): Sequence<FqName> =
|
||||
subtypesMap[className].asSequence()
|
||||
|
||||
override fun getSupertypesOf(className: FqName): Sequence<FqName> {
|
||||
return supertypesMap[className].asSequence()
|
||||
}
|
||||
|
||||
override fun isSealed(className: FqName): Boolean? {
|
||||
return classAttributesMap[className]?.isSealed
|
||||
}
|
||||
|
||||
override fun getSourceFileIfClass(fqName: FqName): File? =
|
||||
classFqNameToSourceMap[fqName]
|
||||
|
||||
@@ -118,6 +132,7 @@ abstract class AbstractIncrementalCache<ClassName>(
|
||||
|
||||
supertypesMap[child] = parents
|
||||
classFqNameToSourceMap[child] = srcFile
|
||||
classAttributesMap[child] = ICClassesAttributes(ProtoBuf.Modality.SEALED == Flags.MODALITY.get(proto.flags))
|
||||
}
|
||||
|
||||
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
|
||||
@@ -152,14 +167,17 @@ abstract class AbstractIncrementalCache<ClassName>(
|
||||
}
|
||||
}
|
||||
|
||||
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
|
||||
removedFqNames.forEach {
|
||||
classFqNameToSourceMap.remove(it)
|
||||
classAttributesMap.remove(it)
|
||||
}
|
||||
}
|
||||
|
||||
protected class ClassFqNameToSourceMap(
|
||||
storageFile: File,
|
||||
private val pathConverter: FileToPathConverter
|
||||
) :
|
||||
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
|
||||
) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
|
||||
|
||||
operator fun set(fqName: FqName, sourceFile: File) {
|
||||
storage[fqName.asString()] = pathConverter.toPath(sourceFile)
|
||||
}
|
||||
|
||||
@@ -19,12 +19,14 @@ package org.jetbrains.kotlin.incremental
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||
import org.jetbrains.kotlin.metadata.deserialization.supertypes
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.protobuf.MessageLite
|
||||
import org.jetbrains.kotlin.serialization.deserialization.getClassId
|
||||
|
||||
class ChangesCollector {
|
||||
private val removedMembers = hashMapOf<FqName, MutableSet<String>>()
|
||||
private val changedParents = hashMapOf<FqName, MutableSet<FqName>>()
|
||||
private val changedMembers = hashMapOf<FqName, MutableSet<String>>()
|
||||
private val areSubclassesAffected = hashMapOf<FqName, Boolean>()
|
||||
|
||||
@@ -47,6 +49,10 @@ class ChangesCollector {
|
||||
changes.add(ChangeInfo.SignatureChanged(fqName, areSubclassesAffected))
|
||||
}
|
||||
|
||||
for ((fqName, changedParents) in changedParents) {
|
||||
changes.add(ChangeInfo.ParentsChanged(fqName, changedParents))
|
||||
}
|
||||
|
||||
return changes
|
||||
}
|
||||
|
||||
@@ -79,12 +85,12 @@ class ChangesCollector {
|
||||
}
|
||||
|
||||
if (oldData == null) {
|
||||
newData!!.collectAll(isRemoved = false, collectAllMembersForNewClass = collectAllMembersForNewClass)
|
||||
newData!!.collectAll(isRemoved = false, isAdded = true, collectAllMembersForNewClass = collectAllMembersForNewClass)
|
||||
return
|
||||
}
|
||||
|
||||
if (newData == null) {
|
||||
oldData.collectAll(isRemoved = true)
|
||||
oldData.collectAll(isRemoved = true, isAdded = false)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,6 +104,7 @@ class ChangesCollector {
|
||||
collectSignature(oldData, diff.areSubclassesAffected)
|
||||
}
|
||||
collectChangedMembers(fqName, diff.changedMembersNames)
|
||||
addChangedParents(fqName, diff.changedSupertypes)
|
||||
}
|
||||
is PackagePartProtoData -> {
|
||||
collectSignature(oldData, areSubclassesAffected = true)
|
||||
@@ -121,10 +128,11 @@ class ChangesCollector {
|
||||
private fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
|
||||
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
|
||||
|
||||
private fun ProtoData.collectAll(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) =
|
||||
//TODO remember all sealed parent classes
|
||||
private fun ProtoData.collectAll(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) =
|
||||
when (this) {
|
||||
is PackagePartProtoData -> collectAllFromPackage(isRemoved)
|
||||
is ClassProtoData -> collectAllFromClass(isRemoved, collectAllMembersForNewClass)
|
||||
is ClassProtoData -> collectAllFromClass(isRemoved, isAdded, collectAllMembersForNewClass)
|
||||
}
|
||||
|
||||
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
|
||||
@@ -143,7 +151,7 @@ class ChangesCollector {
|
||||
}
|
||||
}
|
||||
|
||||
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) {
|
||||
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) {
|
||||
val classFqName = nameResolver.getClassId(proto.fqName).asSingleFqName()
|
||||
val kind = Flags.CLASS_KIND.get(proto.flags)
|
||||
|
||||
@@ -162,6 +170,23 @@ class ChangesCollector {
|
||||
|
||||
collectSignature(classFqName, areSubclassesAffected = true)
|
||||
}
|
||||
|
||||
if (isRemoved || isAdded) {
|
||||
collectChangedParents(classFqName, proto.supertypeList)
|
||||
}
|
||||
}
|
||||
|
||||
private fun addChangedParents(fqName: FqName, parents: Collection<FqName>) {
|
||||
if (parents.isNotEmpty()) {
|
||||
changedParents.getOrPut(fqName) { HashSet() }.addAll(parents)
|
||||
}
|
||||
}
|
||||
|
||||
private fun ClassProtoData.collectChangedParents(fqName: FqName, parents: Collection<ProtoBuf.Type>) {
|
||||
val changedParentsFqNames = parents.map { type ->
|
||||
nameResolver.getClassId(type.className).asSingleFqName()
|
||||
}
|
||||
addChangedParents(fqName, changedParentsFqNames)
|
||||
}
|
||||
|
||||
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {
|
||||
|
||||
@@ -145,6 +145,7 @@ open class IncrementalJvmCache(
|
||||
}
|
||||
protoMap.remove(className, changesCollector)
|
||||
classFqNameToSourceMap.remove(className.fqNameForClassNameWithoutDollars)
|
||||
classAttributesMap.remove(className.fqNameForClassNameWithoutDollars)
|
||||
internalNameToSource.remove(className.internalName)
|
||||
|
||||
// TODO NO_CHANGES? (delegates only)
|
||||
@@ -271,6 +272,7 @@ open class IncrementalJvmCache(
|
||||
|
||||
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
|
||||
|
||||
@Synchronized
|
||||
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
|
||||
return put(kotlinClass, changesCollector)
|
||||
}
|
||||
@@ -282,10 +284,12 @@ open class IncrementalJvmCache(
|
||||
// from files compiled during last round.
|
||||
// However there is no need to compare old and new data in this case
|
||||
// (also that would fail with exception).
|
||||
@Synchronized
|
||||
fun storeModuleMapping(className: JvmClassName, bytes: ByteArray) {
|
||||
storage[className.internalName] = ProtoMapValue(isPackageFacade = false, bytes = bytes, strings = emptyArray())
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun put(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
|
||||
val header = kotlinClass.classHeader
|
||||
|
||||
@@ -308,6 +312,7 @@ open class IncrementalJvmCache(
|
||||
operator fun get(className: JvmClassName): ProtoMapValue? =
|
||||
storage[className.internalName]
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
|
||||
val key = className.internalName
|
||||
val oldValue = storage[key] ?: return
|
||||
@@ -324,6 +329,8 @@ open class IncrementalJvmCache(
|
||||
|
||||
private inner class JavaSourcesProtoMap(storageFile: File) :
|
||||
BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
|
||||
|
||||
@Synchronized
|
||||
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
|
||||
val key = jvmClassName.internalName
|
||||
val oldData = storage[key]
|
||||
@@ -335,6 +342,7 @@ open class IncrementalJvmCache(
|
||||
)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
|
||||
val key = className.internalName
|
||||
val oldValue = storage[key] ?: return
|
||||
@@ -374,6 +382,7 @@ open class IncrementalJvmCache(
|
||||
operator fun contains(className: JvmClassName): Boolean =
|
||||
className.internalName in storage
|
||||
|
||||
@Synchronized
|
||||
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
|
||||
val key = kotlinClass.className.internalName
|
||||
val oldMap = storage[key] ?: emptyMap()
|
||||
@@ -390,6 +399,7 @@ open class IncrementalJvmCache(
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
@@ -522,6 +532,7 @@ open class IncrementalJvmCache(
|
||||
return result
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
|
||||
val key = kotlinClass.className.internalName
|
||||
val oldMap = storage[key] ?: emptyMap()
|
||||
@@ -547,6 +558,7 @@ open class IncrementalJvmCache(
|
||||
private fun functionNameBySignature(signature: String): String =
|
||||
signature.substringBefore("(")
|
||||
|
||||
@Synchronized
|
||||
fun remove(className: JvmClassName) {
|
||||
storage.remove(className.internalName)
|
||||
}
|
||||
@@ -568,6 +580,7 @@ sealed class ChangeInfo(val fqName: FqName) {
|
||||
|
||||
class SignatureChanged(fqName: FqName, val areSubclassesAffected: Boolean) : ChangeInfo(fqName)
|
||||
|
||||
class ParentsChanged(fqName: FqName, val parentsChanged: Collection<FqName>) : ChangeInfo(fqName)
|
||||
|
||||
protected open fun toStringProperties(): String = "fqName = $fqName"
|
||||
|
||||
|
||||
@@ -136,7 +136,8 @@ fun LookupStorage.update(
|
||||
|
||||
data class DirtyData(
|
||||
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
|
||||
val dirtyClassesFqNames: Collection<FqName> = emptyList()
|
||||
val dirtyClassesFqNames: Collection<FqName> = emptyList(),
|
||||
val dirtyClassesFqNamesForceRecompile: Collection<FqName> = emptyList()
|
||||
)
|
||||
|
||||
fun ChangesCollector.getDirtyData(
|
||||
@@ -146,6 +147,9 @@ fun ChangesCollector.getDirtyData(
|
||||
val dirtyLookupSymbols = HashSet<LookupSymbol>()
|
||||
val dirtyClassesFqNames = HashSet<FqName>()
|
||||
|
||||
val sealedParents = HashMap<FqName, MutableSet<FqName>>()
|
||||
val notSealedParents = HashSet<FqName>()
|
||||
|
||||
for (change in changes()) {
|
||||
reporter.reportVerbose { "Process $change" }
|
||||
|
||||
@@ -170,10 +174,35 @@ fun ChangesCollector.getDirtyData(
|
||||
}
|
||||
|
||||
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(SAM_LOOKUP_NAME.asString(), it.asString()) }
|
||||
} else if (change is ChangeInfo.ParentsChanged) {
|
||||
fun FqName.isSealed(): Boolean {
|
||||
if (notSealedParents.contains(this)) return false
|
||||
if (sealedParents.containsKey(this)) return true
|
||||
return isSealed(this, caches).also { sealed ->
|
||||
if (sealed) {
|
||||
sealedParents[this] = HashSet()
|
||||
} else {
|
||||
notSealedParents.add(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
change.parentsChanged.forEach { parent ->
|
||||
if (parent.isSealed()) {
|
||||
sealedParents.getOrPut(parent) { HashSet() }.add(change.fqName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames)
|
||||
val forceRecompile = HashSet<FqName>().apply {
|
||||
addAll(sealedParents.keys)
|
||||
//we should recompile all inheritors with parent sealed class: add known subtypes
|
||||
addAll(sealedParents.keys.flatMap { withSubtypes(it, caches) })
|
||||
//we should recompile all inheritors with parent sealed class: add new subtypes
|
||||
addAll(sealedParents.values.flatten())
|
||||
}
|
||||
|
||||
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames, forceRecompile)
|
||||
}
|
||||
|
||||
fun mapLookupSymbolsToFiles(
|
||||
@@ -217,6 +246,11 @@ fun mapClassesFqNamesToFiles(
|
||||
return fqNameToAffectedFiles.values.flattenTo(HashSet())
|
||||
}
|
||||
|
||||
fun isSealed(
|
||||
fqName: FqName,
|
||||
caches: Iterable<IncrementalCacheCommon>
|
||||
): Boolean = caches.any { it.isSealed(fqName) ?: false }
|
||||
|
||||
fun withSubtypes(
|
||||
typeFqName: FqName,
|
||||
caches: Iterable<IncrementalCacheCommon>
|
||||
|
||||
@@ -28,12 +28,14 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.protobuf.MessageLite
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
|
||||
import org.jetbrains.kotlin.serialization.deserialization.getClassId
|
||||
import java.util.*
|
||||
|
||||
data class Difference(
|
||||
val isClassAffected: Boolean = false,
|
||||
val areSubclassesAffected: Boolean = false,
|
||||
val changedMembersNames: Set<String> = emptySet()
|
||||
val changedMembersNames: Set<String> = emptySet(),
|
||||
val changedSupertypes: Set<FqName> = emptySet()
|
||||
)
|
||||
|
||||
sealed class ProtoData
|
||||
@@ -187,6 +189,7 @@ class DifferenceCalculatorForClass(
|
||||
|
||||
var isClassAffected = false
|
||||
var areSubclassesAffected = false
|
||||
val changedSupertypes = HashSet<FqName>()
|
||||
val names = hashSetOf<String>()
|
||||
val classIsSealed = newProto.isSealed && oldProto.isSealed
|
||||
|
||||
@@ -247,12 +250,21 @@ class DifferenceCalculatorForClass(
|
||||
ProtoBufClassKind.FLAGS,
|
||||
ProtoBufClassKind.FQ_NAME,
|
||||
ProtoBufClassKind.TYPE_PARAMETER_LIST,
|
||||
ProtoBufClassKind.SUPERTYPE_LIST,
|
||||
ProtoBufClassKind.SUPERTYPE_ID_LIST,
|
||||
ProtoBufClassKind.JS_EXT_CLASS_ANNOTATION_LIST -> {
|
||||
isClassAffected = true
|
||||
areSubclassesAffected = true
|
||||
}
|
||||
|
||||
ProtoBufClassKind.SUPERTYPE_LIST,
|
||||
ProtoBufClassKind.SUPERTYPE_ID_LIST -> {
|
||||
isClassAffected = true
|
||||
areSubclassesAffected = true
|
||||
|
||||
val oldSupertypes = oldProto.supertypeList.map { oldNameResolver.getClassId(it.className).asSingleFqName() }
|
||||
val newSupertypes = newProto.supertypeList.map { newNameResolver.getClassId(it.className).asSingleFqName() }
|
||||
val changed = (oldSupertypes union newSupertypes) subtract (oldSupertypes intersect newSupertypes)
|
||||
changedSupertypes.addAll(changed)
|
||||
}
|
||||
ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME,
|
||||
ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID -> {
|
||||
// TODO
|
||||
@@ -281,7 +293,7 @@ class DifferenceCalculatorForClass(
|
||||
}
|
||||
}
|
||||
|
||||
return Difference(isClassAffected, areSubclassesAffected, names)
|
||||
return Difference(isClassAffected, areSubclassesAffected, names, changedSupertypes)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ open class BasicMapsOwner(val cachesDir: File) {
|
||||
protected val String.storageFile: File
|
||||
get() = File(cachesDir, this + "." + CACHE_EXTENSION)
|
||||
|
||||
@Synchronized
|
||||
protected fun <K, V, M : BasicMap<K, V>> registerMap(map: M): M {
|
||||
maps.add(map)
|
||||
return map
|
||||
@@ -47,6 +48,7 @@ open class BasicMapsOwner(val cachesDir: File) {
|
||||
forEachMapSafe("flush") { it.flush(memoryCachesOnly) }
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun forEachMapSafe(actionName: String, action: (BasicMap<*, *>) -> Unit) {
|
||||
val actionExceptions = LinkedHashMap<String, Exception>()
|
||||
maps.forEach {
|
||||
@@ -66,5 +68,6 @@ open class BasicMapsOwner(val cachesDir: File) {
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@Synchronized
|
||||
fun dump(): String = maps.joinToString("\n\n") { it.dump() }
|
||||
}
|
||||
@@ -17,9 +17,11 @@
|
||||
package org.jetbrains.kotlin.incremental.storage
|
||||
|
||||
import com.intellij.util.io.DataExternalizer
|
||||
import com.intellij.util.io.IOUtil
|
||||
import com.intellij.util.io.KeyDescriptor
|
||||
import com.intellij.util.io.PersistentHashMap
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
||||
|
||||
/**
|
||||
@@ -30,7 +32,6 @@ class CachingLazyStorage<K, V>(
|
||||
private val keyDescriptor: KeyDescriptor<K>,
|
||||
private val valueExternalizer: DataExternalizer<V>
|
||||
) : LazyStorage<K, V> {
|
||||
@Volatile
|
||||
private var storage: PersistentHashMap<K, V>? = null
|
||||
|
||||
@Synchronized
|
||||
@@ -80,8 +81,10 @@ class CachingLazyStorage<K, V>(
|
||||
try {
|
||||
storage?.close()
|
||||
} finally {
|
||||
PersistentHashMap.deleteFilesStartingWith(storageFile)
|
||||
storage = null
|
||||
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
|
||||
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.incremental.storage
|
||||
|
||||
import com.intellij.util.io.DataExternalizer
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import java.io.DataInput
|
||||
import java.io.DataOutput
|
||||
import java.io.File
|
||||
|
||||
internal data class ICClassesAttributes(val isSealed: Boolean)
|
||||
|
||||
internal object ICClassesAttributesExternalizer : DataExternalizer<ICClassesAttributes> {
|
||||
override fun read(input: DataInput): ICClassesAttributes {
|
||||
return ICClassesAttributes(input.readBoolean())
|
||||
}
|
||||
|
||||
override fun save(output: DataOutput, value: ICClassesAttributes) {
|
||||
output.writeBoolean(value.isSealed)
|
||||
}
|
||||
}
|
||||
|
||||
internal open class ClassAttributesMap(
|
||||
storageFile: File
|
||||
) : BasicStringMap<ICClassesAttributes>(storageFile, ICClassesAttributesExternalizer) {
|
||||
override fun dumpValue(value: ICClassesAttributes): String = value.toString()
|
||||
|
||||
operator fun set(key: FqName, value: ICClassesAttributes) {
|
||||
storage[key.asString()] = value
|
||||
}
|
||||
|
||||
operator fun get(key: FqName): ICClassesAttributes? = storage[key.asString()]
|
||||
|
||||
fun remove(key: FqName) {
|
||||
storage.remove(key.asString())
|
||||
}
|
||||
}
|
||||
@@ -20,18 +20,18 @@ import org.jetbrains.kotlin.incremental.dumpCollection
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import java.io.File
|
||||
|
||||
internal open class ClassOneToManyMap(
|
||||
storageFile: File
|
||||
) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
|
||||
internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
|
||||
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
|
||||
|
||||
@Synchronized
|
||||
fun add(key: FqName, value: FqName) {
|
||||
storage.append(key.asString(), listOf(value.asString()))
|
||||
}
|
||||
|
||||
operator fun get(key: FqName): Collection<FqName> =
|
||||
storage[key.asString()]?.map(::FqName) ?: setOf()
|
||||
storage[key.asString()]?.map(::FqName) ?: setOf()
|
||||
|
||||
@Synchronized
|
||||
operator fun set(key: FqName, values: Collection<FqName>) {
|
||||
if (values.isEmpty()) {
|
||||
remove(key)
|
||||
@@ -41,10 +41,14 @@ internal open class ClassOneToManyMap(
|
||||
storage[key.asString()] = values.map(FqName::asString)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun remove(key: FqName) {
|
||||
storage.remove(key.asString())
|
||||
}
|
||||
|
||||
// Access to caches could be done from multiple threads (e.g. JPS worker and RMI). The underlying collection is already synchronized,
|
||||
// thus we need synchronization of this method and all modification methods.
|
||||
@Synchronized
|
||||
fun removeValues(key: FqName, removed: Set<FqName>) {
|
||||
val notRemoved = this[key].filter { it !in removed }
|
||||
this[key] = notRemoved
|
||||
|
||||
@@ -25,8 +25,7 @@ internal class DirtyClassesJvmNameMap(storageFile: File) : AbstractDirtyClassesM
|
||||
internal class DirtyClassesFqNameMap(storageFile: File) : AbstractDirtyClassesMap<FqName>(FqNameTransformer, storageFile)
|
||||
|
||||
internal abstract class AbstractDirtyClassesMap<Name>(
|
||||
private val nameTransformer: NameTransformer<Name>,
|
||||
storageFile: File
|
||||
private val nameTransformer: NameTransformer<Name>, storageFile: File
|
||||
) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
|
||||
fun markDirty(className: Name) {
|
||||
storage[nameTransformer.asString(className)] = true
|
||||
@@ -37,10 +36,10 @@ internal abstract class AbstractDirtyClassesMap<Name>(
|
||||
}
|
||||
|
||||
fun getDirtyOutputClasses(): Collection<Name> =
|
||||
storage.keys.map { nameTransformer.asName(it) }
|
||||
storage.keys.map { nameTransformer.asName(it) }
|
||||
|
||||
fun isDirty(className: Name): Boolean =
|
||||
storage.contains(nameTransformer.asString(className))
|
||||
storage.contains(nameTransformer.asString(className))
|
||||
|
||||
override fun dumpValue(value: Boolean) = ""
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
package org.jetbrains.kotlin.incremental.storage
|
||||
|
||||
import com.intellij.util.io.DataExternalizer
|
||||
import com.intellij.util.io.IOUtil
|
||||
import com.intellij.util.io.KeyDescriptor
|
||||
import com.intellij.util.io.PersistentHashMap
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
||||
|
||||
class NonCachingLazyStorage<K, V>(
|
||||
@@ -27,7 +29,6 @@ class NonCachingLazyStorage<K, V>(
|
||||
private val keyDescriptor: KeyDescriptor<K>,
|
||||
private val valueExternalizer: DataExternalizer<V>
|
||||
) : LazyStorage<K, V> {
|
||||
@Volatile
|
||||
private var storage: PersistentHashMap<K, V>? = null
|
||||
|
||||
@Synchronized
|
||||
@@ -76,11 +77,12 @@ class NonCachingLazyStorage<K, V>(
|
||||
override fun clean() {
|
||||
try {
|
||||
storage?.close()
|
||||
} catch (ignored: Throwable) {
|
||||
} finally {
|
||||
storage = null
|
||||
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
|
||||
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
|
||||
}
|
||||
}
|
||||
|
||||
PersistentHashMap.deleteFilesStartingWith(storageFile)
|
||||
storage = null
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
||||
+3
-1
@@ -569,7 +569,7 @@ val dist = tasks.register("dist") {
|
||||
}
|
||||
|
||||
val syncMutedTests = tasks.register("syncMutedTests") {
|
||||
dependsOn(":compiler:tests-mutes:run")
|
||||
dependsOn(":compiler:tests-mutes:tc-integration:run")
|
||||
}
|
||||
|
||||
val copyCompilerToIdeaPlugin by task<Copy> {
|
||||
@@ -630,6 +630,7 @@ tasks {
|
||||
dependsOn("dist")
|
||||
dependsOn(
|
||||
":compiler:test",
|
||||
":compiler:tests-common-new:test",
|
||||
":compiler:container:test",
|
||||
":compiler:tests-java8:test",
|
||||
":compiler:tests-spec:test",
|
||||
@@ -870,6 +871,7 @@ tasks {
|
||||
":idea:idea-gradle:test",
|
||||
":idea:test",
|
||||
":compiler:test",
|
||||
":compiler:container:test",
|
||||
":js:js.tests:test"
|
||||
)
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ fun Project.projectTest(
|
||||
taskName: String = "test",
|
||||
parallel: Boolean = false,
|
||||
shortenTempRootName: Boolean = false,
|
||||
jUnit5Enabled: Boolean = false,
|
||||
body: Test.() -> Unit = {}
|
||||
): TaskProvider<Test> = getOrCreateTask(taskName) {
|
||||
doFirst {
|
||||
@@ -109,12 +110,29 @@ fun Project.projectTest(
|
||||
}
|
||||
}
|
||||
|
||||
include {
|
||||
val path = it.path
|
||||
if (it.isDirectory) {
|
||||
val parentNames = if (jUnit5Enabled) {
|
||||
/*
|
||||
* If we run test from inner test class with junit 5 we need
|
||||
* to include all containing classes of our class
|
||||
*/
|
||||
val nestedNames = classFileNameWithoutExtension.split("$")
|
||||
mutableListOf(nestedNames.first()).also {
|
||||
for (s in nestedNames.subList(1, nestedNames.size)) {
|
||||
it += "${it.last()}\$$s"
|
||||
}
|
||||
}
|
||||
} else emptyList()
|
||||
|
||||
include { treeElement ->
|
||||
val path = treeElement.path
|
||||
if (treeElement.isDirectory) {
|
||||
classFileNameWithoutExtension.startsWith(path)
|
||||
} else {
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
if (jUnit5Enabled) {
|
||||
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
|
||||
} else {
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.android.tests
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
@@ -23,6 +22,7 @@ import org.jetbrains.kotlin.config.JvmTarget
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.*
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
@@ -303,7 +303,9 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
if (kind.withReflection) JVM8REFLECT else JVM8
|
||||
} else if (kind.withReflection) REFLECT else COMMON
|
||||
val filesHolder = holders.getOrPut(key) {
|
||||
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind, KotlinTestUtils.getAnnotationsJar()).apply {
|
||||
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind,
|
||||
KtTestUtil.getAnnotationsJar()
|
||||
).apply {
|
||||
println("Creating new configuration by $key")
|
||||
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
|
||||
})
|
||||
@@ -341,7 +343,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
|
||||
@Throws(IOException::class)
|
||||
internal fun writeAndroidSkdToLocalProperties(pathManager: PathManager) {
|
||||
val sdkRoot = KotlinTestUtils.getAndroidSdkSystemIndependentPath()
|
||||
val sdkRoot = KtTestUtil.getAndroidSdkSystemIndependentPath()
|
||||
println("Writing android sdk to local.properties: $sdkRoot")
|
||||
val file = File(pathManager.tmpFolder + "/local.properties")
|
||||
FileWriter(file).use { fw -> fw.write("sdk.dir=$sdkRoot") }
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.android.tests;
|
||||
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class PathManager {
|
||||
}
|
||||
|
||||
public String getAndroidSdkRoot() {
|
||||
return KotlinTestUtils.getAndroidSdkSystemIndependentPath();
|
||||
return KtTestUtil.getAndroidSdkSystemIndependentPath();
|
||||
}
|
||||
|
||||
public String getAndroidModuleRoot() {
|
||||
|
||||
@@ -458,6 +458,20 @@ class KotlinCoreEnvironment private constructor(
|
||||
return KotlinCoreEnvironment(projectEnv, configuration, extensionConfigs)
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@JvmStatic
|
||||
fun createForTests(
|
||||
projectEnvironment: ProjectEnvironment, initialConfiguration: CompilerConfiguration, extensionConfigs: EnvironmentConfigFiles
|
||||
): KotlinCoreEnvironment {
|
||||
return KotlinCoreEnvironment(projectEnvironment, initialConfiguration, extensionConfigs)
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
fun createProjectEnvironmentForTests(parentDisposable: Disposable, configuration: CompilerConfiguration): ProjectEnvironment {
|
||||
val appEnv = createApplicationEnvironment(parentDisposable, configuration, unitTestMode = true)
|
||||
return ProjectEnvironment(parentDisposable, appEnv)
|
||||
}
|
||||
|
||||
// used in the daemon for jar cache cleanup
|
||||
val applicationEnvironment: KotlinCoreApplicationEnvironment? get() = ourApplicationEnvironment
|
||||
|
||||
|
||||
@@ -456,6 +456,20 @@ class KotlinCoreEnvironment private constructor(
|
||||
return KotlinCoreEnvironment(projectEnv, configuration, extensionConfigs)
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@JvmStatic
|
||||
fun createForTests(
|
||||
projectEnvironment: ProjectEnvironment, initialConfiguration: CompilerConfiguration, extensionConfigs: EnvironmentConfigFiles
|
||||
): KotlinCoreEnvironment {
|
||||
return KotlinCoreEnvironment(projectEnvironment, initialConfiguration, extensionConfigs)
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
fun createProjectEnvironmentForTests(parentDisposable: Disposable, configuration: CompilerConfiguration): ProjectEnvironment {
|
||||
val appEnv = createApplicationEnvironment(parentDisposable, configuration, unitTestMode = true)
|
||||
return ProjectEnvironment(parentDisposable, appEnv)
|
||||
}
|
||||
|
||||
// used in the daemon for jar cache cleanup
|
||||
val applicationEnvironment: KotlinCoreApplicationEnvironment? get() = ourApplicationEnvironment
|
||||
|
||||
|
||||
+15
-4
@@ -90,11 +90,12 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
packagePartProvider: (GlobalSearchScope) -> PackagePartProvider,
|
||||
declarationProviderFactory: (StorageManager, Collection<KtFile>) -> DeclarationProviderFactory = ::FileBasedDeclarationProviderFactory,
|
||||
sourceModuleSearchScope: GlobalSearchScope = newModuleSearchScope(project, files),
|
||||
klibList: List<KotlinLibrary> = emptyList()
|
||||
klibList: List<KotlinLibrary> = emptyList(),
|
||||
explicitModuleDependencyList: List<ModuleDescriptorImpl> = emptyList()
|
||||
): AnalysisResult {
|
||||
val container = createContainer(
|
||||
project, files, trace, configuration, packagePartProvider, declarationProviderFactory, CompilerEnvironment,
|
||||
sourceModuleSearchScope, klibList
|
||||
sourceModuleSearchScope, klibList, explicitModuleDependencyList = explicitModuleDependencyList
|
||||
)
|
||||
|
||||
val module = container.get<ModuleDescriptor>()
|
||||
@@ -127,6 +128,7 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
return AnalysisResult.success(trace.bindingContext, module)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun createContainer(
|
||||
project: Project,
|
||||
files: Collection<KtFile>,
|
||||
@@ -137,7 +139,8 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
targetEnvironment: TargetEnvironment = CompilerEnvironment,
|
||||
sourceModuleSearchScope: GlobalSearchScope = newModuleSearchScope(project, files),
|
||||
klibList: List<KotlinLibrary> = emptyList(),
|
||||
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter? = null
|
||||
implicitsResolutionFilter: ImplicitsExtensionsResolutionFilter? = null,
|
||||
explicitModuleDependencyList: List<ModuleDescriptorImpl> = emptyList()
|
||||
): ComponentProvider {
|
||||
val jvmTarget = configuration.get(JVMConfigurationKeys.JVM_TARGET, JvmTarget.DEFAULT)
|
||||
val languageVersionSettings = configuration.languageVersionSettings
|
||||
@@ -252,8 +255,16 @@ object TopDownAnalyzerFacadeForJVM {
|
||||
val klibModules = getKlibModules(klibList, dependencyModule)
|
||||
|
||||
// TODO: remove dependencyModule from friends
|
||||
val dependencies = buildList {
|
||||
add(module)
|
||||
dependencyModule?.let { add(it) }
|
||||
add(fallbackBuiltIns)
|
||||
addAll(klibModules)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
addAll(explicitModuleDependencyList)
|
||||
}
|
||||
module.setDependencies(
|
||||
listOfNotNull(module, dependencyModule, fallbackBuiltIns) + klibModules,
|
||||
dependencies,
|
||||
if (dependencyModule != null) setOf(dependencyModule) else emptySet()
|
||||
)
|
||||
module.initialize(
|
||||
|
||||
@@ -18,7 +18,7 @@ abstract class JvmPlatform : SimplePlatform("JVM") {
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
object JvmPlatforms {
|
||||
private val UNSPECIFIED_SIMPLE_JVM_PLATFORM = JdkPlatform(JvmTarget.JVM_1_6)
|
||||
private val UNSPECIFIED_SIMPLE_JVM_PLATFORM = JdkPlatform(JvmTarget.DEFAULT)
|
||||
private val jvmTargetToJdkPlatform: Map<JvmTarget, TargetPlatform> =
|
||||
JvmTarget.values().map { it to JdkPlatform(it).toTargetPlatform() }.toMap()
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.jetbrains.kotlin.daemon
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
@@ -30,13 +30,16 @@ import org.jetbrains.kotlin.daemon.common.*
|
||||
import org.jetbrains.kotlin.integration.KotlinIntegrationTestBase
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.testFramework.resetApplicationToNull
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.junit.Assert
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.io.PrintStream
|
||||
import java.net.URLClassLoader
|
||||
import java.nio.file.Path
|
||||
import kotlin.io.path.*
|
||||
import kotlin.io.path.ExperimentalPathApi
|
||||
import kotlin.io.path.createTempFile
|
||||
import kotlin.io.path.deleteIfExists
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
@@ -83,8 +86,8 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
return code to outputs
|
||||
}
|
||||
|
||||
private fun getHelloAppBaseDir(): String = KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/helloApp"
|
||||
private fun getSimpleScriptBaseDir(): String = KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/simpleScript"
|
||||
private fun getHelloAppBaseDir(): String = KtTestUtil.getTestDataPathBase() + "/integration/smoke/helloApp"
|
||||
private fun getSimpleScriptBaseDir(): String = KtTestUtil.getTestDataPathBase() + "/integration/smoke/simpleScript"
|
||||
|
||||
private fun run(baseDir: String, logName: String, vararg args: String): Int = runJava(baseDir, logName, *args)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.daemon.client.*
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
import org.jetbrains.kotlin.integration.KotlinIntegrationTestBase
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.jetbrains.kotlin.utils.KotlinPaths
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
@@ -95,8 +95,8 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
assertEquals("build results differ", AbstractCliTest.removePerfOutput(res1.out), AbstractCliTest.removePerfOutput(res2.out))
|
||||
}
|
||||
|
||||
private fun getTestBaseDir(): String = KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/" + getTestName(true)
|
||||
private fun getHelloAppBaseDir(): String = KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/helloApp"
|
||||
private fun getTestBaseDir(): String = KtTestUtil.getTestDataPathBase() + "/integration/smoke/" + getTestName(true)
|
||||
private fun getHelloAppBaseDir(): String = KtTestUtil.getTestDataPathBase() + "/integration/smoke/helloApp"
|
||||
|
||||
private fun run(logName: String, vararg args: String): Int = runJava(getTestBaseDir(), logName, *args)
|
||||
|
||||
|
||||
+6
-4
@@ -8,8 +8,8 @@ package org.jetbrains.kotlin.daemon.experimental.integration
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.integration.KotlinIntegrationTestBase
|
||||
import org.jetbrains.kotlin.test.IgnoreAll
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.testFramework.resetApplicationToNull
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.junit.Assert
|
||||
import org.junit.runner.RunWith
|
||||
import java.io.File
|
||||
@@ -31,7 +32,8 @@ import java.net.URLClassLoader
|
||||
import java.nio.file.Path
|
||||
import java.util.logging.LogManager
|
||||
import java.util.logging.Logger
|
||||
import kotlin.io.path.*
|
||||
import kotlin.io.path.ExperimentalPathApi
|
||||
import kotlin.io.path.createTempFile
|
||||
|
||||
private val logFiles = arrayListOf<String>()
|
||||
|
||||
@@ -150,8 +152,8 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
code to outputs
|
||||
}
|
||||
|
||||
private fun getHelloAppBaseDir(): String = KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/helloApp"
|
||||
private fun getSimpleScriptBaseDir(): String = KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/simpleScript"
|
||||
private fun getHelloAppBaseDir(): String = KtTestUtil.getTestDataPathBase() + "/integration/smoke/helloApp"
|
||||
private fun getSimpleScriptBaseDir(): String = KtTestUtil.getTestDataPathBase() + "/integration/smoke/simpleScript"
|
||||
|
||||
private fun run(baseDir: String, logName: String, vararg args: String): Int = runJava(baseDir, logName, *args)
|
||||
|
||||
|
||||
+3
-3
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.daemon.common.experimental.findCallbackServerSocket
|
||||
import org.jetbrains.kotlin.integration.KotlinIntegrationTestBase
|
||||
import org.jetbrains.kotlin.progress.experimental.CompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.test.IgnoreAll
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.jetbrains.kotlin.utils.KotlinPaths
|
||||
import org.junit.runner.RunWith
|
||||
import java.io.ByteArrayOutputStream
|
||||
@@ -157,8 +157,8 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTestBaseDir(): String = KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/" + getTestName(true)
|
||||
private fun getHelloAppBaseDir(): String = KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/helloApp"
|
||||
private fun getTestBaseDir(): String = KtTestUtil.getTestDataPathBase() + "/integration/smoke/" + getTestName(true)
|
||||
private fun getHelloAppBaseDir(): String = KtTestUtil.getTestDataPathBase() + "/integration/smoke/helloApp"
|
||||
|
||||
private fun run(logName: String, vararg args: String): Int = runJava(getTestBaseDir(), logName, *args)
|
||||
|
||||
|
||||
+5
-3
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.daemon.experimental.CompileServiceServerSideImpl
|
||||
import org.jetbrains.kotlin.daemon.loggerCompatiblePath
|
||||
import org.jetbrains.kotlin.integration.KotlinIntegrationTestBase
|
||||
import org.jetbrains.kotlin.test.IgnoreAll
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.junit.runner.RunWith
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
@@ -36,7 +36,9 @@ import java.util.*
|
||||
import java.util.logging.LogManager
|
||||
import java.util.logging.Logger
|
||||
import kotlin.concurrent.schedule
|
||||
import kotlin.io.path.*
|
||||
import kotlin.io.path.ExperimentalPathApi
|
||||
import kotlin.io.path.createTempFile
|
||||
import kotlin.io.path.deleteIfExists
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
@RunWith(IgnoreAll::class)
|
||||
@@ -364,7 +366,7 @@ class ConnectionsTest : KotlinIntegrationTestBase() {
|
||||
CompileService.NO_SESSION,
|
||||
arrayOf(
|
||||
"-include-runtime",
|
||||
File(KotlinTestUtils.getTestDataPathBase() + "/integration/smoke/helloApp", "hello.kt").absolutePath,
|
||||
File(KtTestUtil.getTestDataPathBase() + "/integration/smoke/helloApp", "hello.kt").absolutePath,
|
||||
"-d",
|
||||
jar
|
||||
),
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ FILE: RedundantReturnUnitTypeChecker.kt
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
^foo this@R|/B|.R|/B.run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| {
|
||||
^foo this@R|/B|.R|/B.run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| {
|
||||
this@R|/B|.R|/B.bar|()
|
||||
}
|
||||
)
|
||||
@@ -88,7 +88,7 @@ FILE: RedundantReturnUnitTypeChecker.kt
|
||||
}
|
||||
|
||||
public final fun goo(): R|kotlin/Unit| {
|
||||
^goo (this@R|/B|, Int(1)).R|/B.let|<R|kotlin/Int|, R|kotlin/Int|>(<L> = let@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Int| {
|
||||
^goo (this@R|/B|, Int(1)).R|/B.let|<R|kotlin/Int|, R|kotlin/Unit|>(<L> = let@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
this@R|/B|.R|/B.bar|()
|
||||
}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo(): Int {
|
||||
val x = fun() = 4
|
||||
val y = fun() = 2
|
||||
return 10 * x() + y()
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
FILE: invoke.kt
|
||||
public final fun foo(): R|kotlin/Int| {
|
||||
lval x: R|() -> kotlin/Int| = fun <anonymous>(): R|kotlin/Int| {
|
||||
^ Int(4)
|
||||
}
|
||||
|
||||
lval y: R|() -> kotlin/Int| = fun <anonymous>(): R|kotlin/Int| {
|
||||
^ Int(2)
|
||||
}
|
||||
|
||||
^foo Int(10).R|kotlin/Int.times|(R|<local>/x|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Int|>|()).R|kotlin/Int.plus|(R|<local>/y|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/Int|>|())
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
open class A
|
||||
|
||||
|
||||
class B : A()
|
||||
class B : A()
|
||||
|
||||
@@ -6,4 +6,4 @@ typealias TA = A
|
||||
|
||||
class B : TA() {
|
||||
class NestedInB : Nested()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ abstract class My {
|
||||
|
||||
class Your : My() {
|
||||
class NestedThree : NestedOne()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@ package p
|
||||
|
||||
open class A
|
||||
|
||||
class B : A()
|
||||
class B : A()
|
||||
|
||||
+1
-1
@@ -15,5 +15,5 @@ class B : A() {
|
||||
}
|
||||
|
||||
fun test(b: B) {
|
||||
b.<!HIDDEN!>foo<!>("")
|
||||
b.<!HIDDEN{LT}!><!HIDDEN{PSI}!>foo<!>("")<!>
|
||||
}
|
||||
|
||||
@@ -8,19 +8,19 @@ fun test() {
|
||||
foo(1, 2.0, true)
|
||||
foo(1, third = true)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>()
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(0, 0.0, false, "")
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>()<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(0, 0.0, false, "")<!>
|
||||
|
||||
bar(1, third = true)
|
||||
bar(1, 2.0, true)
|
||||
bar(1, 2.0, true, "my")
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(1, true)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>bar<!>(1, true)<!>
|
||||
|
||||
baz(1)
|
||||
baz(1, "my", "yours")
|
||||
baz(1, z = true)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!>(0, "", false)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>baz<!>(0, "", false)<!>
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@ fun foo(a: A) {
|
||||
a.foo()
|
||||
a.foo(1)
|
||||
|
||||
a.<!INAPPLICABLE_CANDIDATE!>bar<!>()
|
||||
a.<!INAPPLICABLE_CANDIDATE!>bar<!>("")
|
||||
a.<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>bar<!>()<!>
|
||||
a.<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>bar<!>("")<!>
|
||||
a.bar(y = 1)
|
||||
a.bar("", 2)
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ fun test(
|
||||
val f: String.() -> Int = { length }
|
||||
): Int {
|
||||
return "".f()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ fun test() {
|
||||
foo {
|
||||
this + it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -17,9 +17,9 @@ fun test_1() {
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
<!INAPPLICABLE_CANDIDATE!>takeInt<!>(10000000000)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeInt<!>(10000000000)<!>
|
||||
takeLong(10000000000)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1000)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1000)<!>
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
@@ -35,8 +35,8 @@ fun test_4() {
|
||||
}
|
||||
|
||||
fun test_5() {
|
||||
<!INAPPLICABLE_CANDIDATE!>takeString<!>(1)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeString<!>(run { 1 })
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeString<!>(1)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeString<!>(run { 1 })<!>
|
||||
}
|
||||
|
||||
annotation class Ann(val x: Byte)
|
||||
|
||||
@@ -6,4 +6,4 @@ class My(var x: Int) {
|
||||
fun copy() = My(x)
|
||||
}
|
||||
|
||||
fun testInvoke(): Int = My(13)()
|
||||
fun testInvoke(): Int = My(13)()
|
||||
|
||||
+2
-2
@@ -13,6 +13,6 @@ fun takeOutA(array: Array<out A>) {}
|
||||
|
||||
fun test(array: Array<B>) {
|
||||
A.take(array)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeA<!>(array)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeA<!>(array)<!>
|
||||
takeOutA(array)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ fun test() {
|
||||
foo({})
|
||||
|
||||
// Bad
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(1) {}
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(f = {}) {}
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(1) {}<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(f = {}) {}<!>
|
||||
|
||||
// OK
|
||||
bar(1) {}
|
||||
@@ -20,15 +20,15 @@ fun test() {
|
||||
bar(x = 1, f = {})
|
||||
|
||||
// Bad
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {}
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>({})
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>bar<!> {}<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>bar<!>({})<!>
|
||||
|
||||
// OK
|
||||
baz(other = false, f = {})
|
||||
baz({}, false)
|
||||
|
||||
// Bad
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!> {}
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!>() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!>(other = false) {}
|
||||
}
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>baz<!> {}<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>baz<!>() {}<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>baz<!>(other = false) {}<!>
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@ fun test(ordinal: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ fun test() {
|
||||
val processor = AdapterProcessor<PsiMethod, PsiClass>(
|
||||
Function { method: PsiMethod? -> method?.containingClass }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
fun <R> materialize(): R = null!!
|
||||
|
||||
fun test_1() {
|
||||
<!UNRESOLVED_REFERENCE!>myRun<!> {
|
||||
<!UNRESOLVED_REFERENCE{LT}!><!UNRESOLVED_REFERENCE{PSI}!>myRun<!> {
|
||||
val x = 1
|
||||
x * 2
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
<!UNRESOLVED_REFERENCE!>myRun<!> {
|
||||
<!UNRESOLVED_REFERENCE{LT}!><!UNRESOLVED_REFERENCE{PSI}!>myRun<!> {
|
||||
materialize()
|
||||
}
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
|
||||
+19
-19
@@ -31,33 +31,33 @@ fun test_3() {
|
||||
fun takeByte(b: Byte) {}
|
||||
|
||||
fun test_4() {
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1 + 1)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1 + 127)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1 - 1)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(-100 - 100)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(10 * 10)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(100 * 100)
|
||||
<!UNRESOLVED_REFERENCE!>taleByte<!>(10 / 10)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(100 % 10)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1000 % 10)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1000 and 100)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(128 and 511)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(100 or 100)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1000 or 0)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(511 xor 511)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(512 xor 511)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1 + 1)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1 + 127)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1 - 1)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(-100 - 100)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(10 * 10)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(100 * 100)<!>
|
||||
<!UNRESOLVED_REFERENCE{LT}!><!UNRESOLVED_REFERENCE{PSI}!>taleByte<!>(10 / 10)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(100 % 10)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1000 % 10)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1000 and 100)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(128 and 511)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(100 or 100)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1000 or 0)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(511 xor 511)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(512 xor 511)<!>
|
||||
}
|
||||
|
||||
fun test_5() {
|
||||
takeByte(-1)
|
||||
takeByte(+1)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1.inv())
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1.inv())<!>
|
||||
}
|
||||
|
||||
fun test_6() {
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(run { 127 + 1 })
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1 + run { 1 })
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(run { 1 + 1 })
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(run { 127 + 1 })<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(1 + run { 1 })<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>takeByte<!>(run { 1 + 1 })<!>
|
||||
1 + 1
|
||||
run { 1 }
|
||||
1 + run { 1 }
|
||||
|
||||
+1
-1
@@ -14,4 +14,4 @@ fun takeInt(x: Int) {}
|
||||
fun test(d: D) {
|
||||
val x = d.foo()
|
||||
takeInt(x)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@ interface A {
|
||||
|
||||
fun test(a: A) {
|
||||
a.foo { true }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ fun test() {
|
||||
foo(1, second = 3.14, third = false, fourth = "!?")
|
||||
foo(third = false, second = 2.71, fourth = "?!", first = 0)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>()
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(0.0, false, 0, "")
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>()<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(0.0, false, 0, "")<!>
|
||||
foo(1, 2.0, third = true, "")
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(second = 0.0, first = 0, fourth = "")
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(first = 0.0, second = 0, third = "", fourth = false)
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(first = 0, second = 0.0, third = false, fourth = "", first = 1)
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(0, 0.0, false, foth = "")
|
||||
}
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(second = 0.0, first = 0, fourth = "")<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(first = 0.0, second = 0, third = "", fourth = false)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(first = 0, second = 0.0, third = false, fourth = "", first = 1)<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(0, 0.0, false, foth = "")<!>
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ fun foo(s: String) {}
|
||||
|
||||
fun test(a: A) {
|
||||
foo("$a")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ fun test() {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ fun test() {
|
||||
foo(1, "my", "yours")
|
||||
foo(1, *arrayOf("my", "yours"))
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>("")
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(1, 2)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>("")<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>(1, 2)<!>
|
||||
|
||||
bar(1, z = true, y = *arrayOf("my", "yours"))
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(0, z = false, y = "", y = "other")
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(0, "", true)
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>bar<!>(0, z = false, y = "", y = "other")<!>
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>bar<!>(0, "", true)<!>
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ fun foo(vararg arg: Base) {}
|
||||
fun bar(base: Array<Base>, sub: Array<Sub>) {
|
||||
foo(*base)
|
||||
foo(*sub)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +28,4 @@ fun test_2(a: A<C>) {
|
||||
|
||||
fun test_3(a: A<D>) {
|
||||
a[0] = D() // set
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,4 +33,4 @@ fun test_3(a: A<D>) {
|
||||
|
||||
fun test_4(b: B) {
|
||||
<!UNRESOLVED_REFERENCE!><!UNRESOLVED_REFERENCE!>b[0]<!> += B()<!> // unresolved
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ class A {
|
||||
import foo.A as B
|
||||
|
||||
fun test_1() {
|
||||
val a = <!UNRESOLVED_REFERENCE!>A<!>()
|
||||
val a = <!UNRESOLVED_REFERENCE{LT}!><!UNRESOLVED_REFERENCE{PSI}!>A<!>()<!>
|
||||
val b = B() // should be OK
|
||||
val c: B = <!UNRESOLVED_REFERENCE!>A<!>()
|
||||
val c: B = <!UNRESOLVED_REFERENCE{LT}!><!UNRESOLVED_REFERENCE{PSI}!>A<!>()<!>
|
||||
}
|
||||
|
||||
fun test_2(b: B) {
|
||||
b.foo()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ abstract class MyStringList : List<String>
|
||||
abstract class MyMutableStringList : MutableList<String>
|
||||
|
||||
fun List<String>.convert(): MyStringList = this as MyStringList
|
||||
fun ret(l: MutableList<String>): MyMutableStringList = l as MyMutableStringList
|
||||
fun ret(l: MutableList<String>): MyMutableStringList = l as MyMutableStringList
|
||||
|
||||
+4
-4
@@ -9,11 +9,11 @@ fun bar(x: B) {}
|
||||
|
||||
fun test(c: C) {
|
||||
// Argument mapping error
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>("")
|
||||
<!INAPPLICABLE_CANDIDATE{LT}!><!INAPPLICABLE_CANDIDATE{PSI}!>foo<!>("")<!>
|
||||
|
||||
// Ambiguity
|
||||
<!AMBIGUITY!>bar<!>(c)
|
||||
<!AMBIGUITY{LT}!><!AMBIGUITY{PSI}!>bar<!>(c)<!>
|
||||
|
||||
// Unresolved reference
|
||||
<!UNRESOLVED_REFERENCE!>baz<!>()
|
||||
}
|
||||
<!UNRESOLVED_REFERENCE{LT}!><!UNRESOLVED_REFERENCE{PSI}!>baz<!>()<!>
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user