Destructure intention applied (compiler)
This commit is contained in:
@@ -217,16 +217,16 @@ class CollectionStubMethodGenerator(
|
||||
|
||||
val allSuperClasses = TypeUtils.getAllSupertypes(descriptor.defaultType).classes().toHashSet()
|
||||
|
||||
val ourSuperCollectionClasses = collectionClasses.filter { pair ->
|
||||
pair.readOnlyClass in allSuperClasses && pair.mutableClass !in allSuperClasses
|
||||
val ourSuperCollectionClasses = collectionClasses.filter { (readOnlyClass, mutableClass) ->
|
||||
readOnlyClass in allSuperClasses && mutableClass !in allSuperClasses
|
||||
}
|
||||
if (ourSuperCollectionClasses.isEmpty()) return listOf()
|
||||
|
||||
// Filter out built-in classes which are overridden by other built-in classes in the list, to avoid duplicating methods.
|
||||
val redundantClasses = ourSuperCollectionClasses.flatMapTo(HashSet<ClassDescriptor>()) { pair ->
|
||||
pair.readOnlyClass.typeConstructor.supertypes.classes()
|
||||
val redundantClasses = ourSuperCollectionClasses.flatMapTo(HashSet<ClassDescriptor>()) { (readOnlyClass) ->
|
||||
readOnlyClass.typeConstructor.supertypes.classes()
|
||||
}
|
||||
return ourSuperCollectionClasses.filter { klass -> klass.readOnlyClass !in redundantClasses }
|
||||
return ourSuperCollectionClasses.filter { (readOnlyClass) -> readOnlyClass !in redundantClasses }
|
||||
}
|
||||
|
||||
private fun Collection<KotlinType>.classes(): Collection<ClassDescriptor> =
|
||||
|
||||
@@ -57,9 +57,9 @@ class SMAPBuilder(
|
||||
private fun generateDebugStrata(realMappings: List<FileMapping>): String {
|
||||
val combinedMapping = FileMapping(source, path)
|
||||
realMappings.forEach { fileMapping ->
|
||||
fileMapping.lineMappings.filter { it.callSiteMarker != null }.forEach { rangeMapping ->
|
||||
fileMapping.lineMappings.filter { it.callSiteMarker != null }.forEach { (source, dest, range, callSiteMarker) ->
|
||||
combinedMapping.addRangeMapping(RangeMapping(
|
||||
rangeMapping.callSiteMarker!!.lineNumber, rangeMapping.dest, rangeMapping.range
|
||||
callSiteMarker!!.lineNumber, dest, range
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,8 +176,8 @@ class ComponentStorage(val myId: String, parent: ComponentStorage?) : ValueResol
|
||||
private fun injectProperties(instance: Any, context: ValueResolveContext) {
|
||||
val classInfo = instance.javaClass.getInfo()
|
||||
|
||||
classInfo.setterInfos.forEach { setterInfo ->
|
||||
val methodBinding = setterInfo.method.bindToMethod(context)
|
||||
classInfo.setterInfos.forEach { (method) ->
|
||||
val methodBinding = method.bindToMethod(context)
|
||||
methodBinding.invoke(instance)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -78,8 +78,8 @@ class IncrementalPackageFragmentProvider(
|
||||
ChainedMemberScope.create(
|
||||
"Member scope for incremental compilation: union of multifile class parts data for $multifileClassFqName",
|
||||
partsInternalNames.mapNotNull { internalName ->
|
||||
incrementalCache.getPackagePartData(internalName)?.let { proto ->
|
||||
val (nameResolver, packageProto) = JvmProtoBufUtil.readPackageDataFrom(proto.data, proto.strings)
|
||||
incrementalCache.getPackagePartData(internalName)?.let { (data, strings) ->
|
||||
val (nameResolver, packageProto) = JvmProtoBufUtil.readPackageDataFrom(data, strings)
|
||||
DeserializedPackageMemberScope(
|
||||
this, packageProto, nameResolver,
|
||||
JvmPackagePartSource(
|
||||
|
||||
@@ -38,8 +38,8 @@ class OverloadResolver(
|
||||
fun checkOverloads(c: BodiesResolveContext) {
|
||||
val inClasses = findConstructorsInNestedClassesAndTypeAliases(c)
|
||||
|
||||
for (entry in c.declaredClasses.entries) {
|
||||
checkOverloadsInClass(entry.value, inClasses.get(entry.value))
|
||||
for ((key, value) in c.declaredClasses) {
|
||||
checkOverloadsInClass(value, inClasses.get(value))
|
||||
}
|
||||
checkOverloadsInPackages(c)
|
||||
}
|
||||
|
||||
@@ -575,8 +575,8 @@ class QualifiedExpressionResolver {
|
||||
trace: BindingTrace,
|
||||
position: QualifierPosition
|
||||
) {
|
||||
path.foldRight(packageView) { qualifierPart, currentView ->
|
||||
storeResult(trace, qualifierPart.expression, currentView, shouldBeVisibleFrom = null, position = position)
|
||||
path.foldRight(packageView) { (name, expression), currentView ->
|
||||
storeResult(trace, expression, currentView, shouldBeVisibleFrom = null, position = position)
|
||||
currentView.containingDeclaration
|
||||
?: error("Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " +
|
||||
"path: ${path.joinToString()}, packageView fqName: ${packageView.fqName}")
|
||||
|
||||
@@ -623,9 +623,9 @@ class TypeResolver(
|
||||
Math.min(classifierChainLastIndex + 1, reversedQualifierParts.size),
|
||||
reversedQualifierParts.size)
|
||||
|
||||
for (qualifierPart in nonClassQualifierParts) {
|
||||
if (qualifierPart.typeArguments != null) {
|
||||
c.trace.report(TYPE_ARGUMENTS_NOT_ALLOWED.on(qualifierPart.typeArguments, "here"))
|
||||
for ((name, expression, typeArguments) in nonClassQualifierParts) {
|
||||
if (typeArguments != null) {
|
||||
c.trace.report(TYPE_ARGUMENTS_NOT_ALLOWED.on(typeArguments, "here"))
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -160,14 +160,14 @@ internal class ConstraintSystemImpl(
|
||||
fun KotlinType.substitute(): KotlinType? = substitutor.substitute(this, Variance.INVARIANT)
|
||||
|
||||
return initialConstraints.all {
|
||||
constraint ->
|
||||
val resultSubType = constraint.subtype.substitute()?.let {
|
||||
(kind, subtype, superType, position) ->
|
||||
val resultSubType = subtype.substitute()?.let {
|
||||
// the call might be done via safe access, so we check for notNullable receiver type;
|
||||
// 'unsafe call' error is reported otherwise later
|
||||
if (constraint.position.kind != ConstraintPositionKind.RECEIVER_POSITION) it else it.makeNotNullable()
|
||||
if (position.kind != ConstraintPositionKind.RECEIVER_POSITION) it else it.makeNotNullable()
|
||||
} ?: return false
|
||||
val resultSuperType = constraint.superType.substitute() ?: return false
|
||||
when (constraint.kind) {
|
||||
val resultSuperType = superType.substitute() ?: return false
|
||||
when (kind) {
|
||||
SUB_TYPE -> KotlinTypeChecker.DEFAULT.isSubtypeOf(resultSubType, resultSuperType)
|
||||
EQUAL -> KotlinTypeChecker.DEFAULT.equalTypes(resultSubType, resultSuperType)
|
||||
}
|
||||
|
||||
+2
-2
@@ -48,9 +48,9 @@ class LazyScriptClassMemberScope(
|
||||
}
|
||||
|
||||
private fun createScriptParameters(constructor: ClassConstructorDescriptorImpl): List<ValueParameterDescriptor> {
|
||||
return scriptDescriptor.scriptDefinition.getScriptParameters(scriptDescriptor).mapIndexed { index, scriptParameter ->
|
||||
return scriptDescriptor.scriptDefinition.getScriptParameters(scriptDescriptor).mapIndexed { index, (name, type) ->
|
||||
ValueParameterDescriptorImpl(
|
||||
constructor, null, index, Annotations.EMPTY, scriptParameter.name, scriptParameter.type,
|
||||
constructor, null, index, Annotations.EMPTY, name, type,
|
||||
/* declaresDefaultValue = */ false,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
|
||||
Reference in New Issue
Block a user