From bbb6ef4fbc99f79a9af7213d3e598aff98837c9c Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 19 Apr 2016 20:14:14 +0300 Subject: [PATCH] Check that "break" and "continue" do not produce false errors when using analyzeInContext --- .../assignFilter_breakAndContinue.kt | 24 +++++++++++++++++++ .../assignFilter_breakAndContinue.kt.after | 19 +++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 idea/testData/intentions/loopToCallChain/assignFilter_breakAndContinue.kt create mode 100644 idea/testData/intentions/loopToCallChain/assignFilter_breakAndContinue.kt.after diff --git a/idea/testData/intentions/loopToCallChain/assignFilter_breakAndContinue.kt b/idea/testData/intentions/loopToCallChain/assignFilter_breakAndContinue.kt new file mode 100644 index 00000000000..f38419eae34 --- /dev/null +++ b/idea/testData/intentions/loopToCallChain/assignFilter_breakAndContinue.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME +import java.util.ArrayList + +fun foo(): List { + while (true) { + val result = ArrayList() + for (s in list()) { + if (s.length > 0) { + result.add(s) + } + } + + if (bar1()) continue + if (bar2()) break + + return result + } + + return emptyList() +} + +fun list() = listOf("a") +fun bar1() = true +fun bar2() = true \ No newline at end of file diff --git a/idea/testData/intentions/loopToCallChain/assignFilter_breakAndContinue.kt.after b/idea/testData/intentions/loopToCallChain/assignFilter_breakAndContinue.kt.after new file mode 100644 index 00000000000..632d876548f --- /dev/null +++ b/idea/testData/intentions/loopToCallChain/assignFilter_breakAndContinue.kt.after @@ -0,0 +1,19 @@ +// WITH_RUNTIME +import java.util.ArrayList + +fun foo(): List { + while (true) { + val result = list().filter { it.length > 0 } + + if (bar1()) continue + if (bar2()) break + + return result + } + + return emptyList() +} + +fun list() = listOf("a") +fun bar1() = true +fun bar2() = true \ No newline at end of file