From 32a102a99d3a81e5a885d359d8fed184917395f3 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Mon, 10 Jun 2019 17:49:21 +0300 Subject: [PATCH] Fix bug in ExpectedActualResolver 'getContributedDescriptors' isn't obliged to apply filters, inlcuding kindFilter, and may return declarations of different kind, so we have to call 'filterIsInstance' explicitly --- .../resolve/multiplatform/ExpectedActualResolver.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectedActualResolver.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectedActualResolver.kt index 7cbe25e0bab..1f6d8c53919 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectedActualResolver.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/multiplatform/ExpectedActualResolver.kt @@ -136,13 +136,15 @@ object ExpectedActualResolver { return when (this) { is FunctionDescriptor -> scopes.flatMap { - it.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS, { it == name }) - .filter { it.name == name } as Collection + it.getContributedDescriptors(DescriptorKindFilter.FUNCTIONS) { it == name } + .filter { it.name == name } + .filterIsInstance() } is PropertyDescriptor -> scopes.flatMap { - it.getContributedDescriptors(DescriptorKindFilter.VARIABLES, { it == name }) - .filter { it.name == name } as Collection + it.getContributedDescriptors(DescriptorKindFilter.VARIABLES) { it == name } + .filter { it.name == name } + .filterIsInstance() } else -> throw AssertionError("Unsupported declaration: $this")