From 3fb035467675c440c83c2750ef1485934fd3e882 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 16 Oct 2017 20:00:47 +0300 Subject: [PATCH] Minor: add / fix comments (related to KT-20752) --- .../kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt | 2 ++ .../diagnostics/tests/smartCasts/castchecks/impossible.kt | 4 ++-- .../testData/diagnostics/tests/smartCasts/elvis/impossible.kt | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt index fbf5353e79d..4e9cdb27a69 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt @@ -97,6 +97,8 @@ internal class DelegatingDataFlowInfo private constructor( languageVersionSettings: LanguageVersionSettings, typeInfo: SetMultimap? = null, affectReceiver: Boolean = true, + // TODO: remove me in version 1.3! I'm very dirty hack! + // In normal circumstances this should be always true recordUnstable: Boolean = true ): Boolean { if (value.isStable || recordUnstable) { diff --git a/compiler/testData/diagnostics/tests/smartCasts/castchecks/impossible.kt b/compiler/testData/diagnostics/tests/smartCasts/castchecks/impossible.kt index 8948fe267e8..7a7c420bb30 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/castchecks/impossible.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/castchecks/impossible.kt @@ -14,12 +14,12 @@ fun StringList.remove(s: String?) = s ?: "" fun foo(list: StringList, arg: Unstable) { list.remove(arg.first) if (arg.first as? String != null) { - // Ideally should have smart cast impossible here + // Should be still resolved to extension, without smart cast or smart cast impossible list.remove(arg.first) } val s = arg.first as? String if (s != null) { - // Ideally should have smart cast impossible here + // Should be still resolved to extension, without smart cast or smart cast impossible list.remove(arg.first) } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt b/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt index 738d3604e0e..bc513943e93 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/elvis/impossible.kt @@ -16,7 +16,7 @@ fun String.isEmpty() = this == "" fun foo(list: StringList, arg: Unstable) { list.remove(arg.first) if (arg.first?.isEmpty() ?: false) { - // Ideally should have smart cast impossible here + // Should be still resolved to extension, without smart cast or smart cast impossible list.remove(arg.first) } } @@ -34,7 +34,7 @@ fun BooleanList.remove(b: Boolean?) = b ?: false fun bar(list: BooleanList, arg: UnstableBoolean) { list.remove(arg.first) if (arg.first ?: false) { - // Ideally should have smart cast impossible here + // Should be still resolved to extension, without smart cast or smart cast impossible list.remove(arg.first) } }