K1/K2: add test for streams situation from intellij
This commit is contained in:
committed by
Space Team
parent
6e1b6427ab
commit
993509c057
+22
-6
@@ -42435,12 +42435,6 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("streams.kt")
|
|
||||||
public void testStreams() {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/streams.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@@ -47057,6 +47051,28 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/streams")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Streams {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInStreams() {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/streams"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("basic.kt")
|
||||||
|
public void testBasic() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/basic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("wrongNullability.kt")
|
||||||
|
public void testWrongNullability() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/wrongNullability.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+22
-6
@@ -42435,12 +42435,6 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("streams.kt")
|
|
||||||
public void testStreams() {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/streams.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@@ -47057,6 +47051,28 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/streams")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Streams {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInStreams() {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/streams"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("basic.kt")
|
||||||
|
public void testBasic() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/basic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("wrongNullability.kt")
|
||||||
|
public void testWrongNullability() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/wrongNullability.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+22
-6
@@ -40007,12 +40007,6 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("streams.kt")
|
|
||||||
public void testStreams() {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/streams.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@@ -44687,6 +44681,28 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/streams")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Streams {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInStreams() {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/streams"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("basic.kt")
|
||||||
|
public void testBasic() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/basic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("wrongNullability.kt")
|
||||||
|
public void testWrongNullability() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/wrongNullability.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
+22
-6
@@ -40145,12 +40145,6 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("streams.kt")
|
|
||||||
public void testStreams() {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/streams.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@@ -44825,6 +44819,28 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/streams")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Streams {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInStreams() {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/streams"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("basic.kt")
|
||||||
|
public void testBasic() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/basic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("wrongNullability.kt")
|
||||||
|
public void testWrongNullability() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/wrongNullability.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
package
|
|
||||||
|
|
||||||
public fun testStreams(/*0*/ list: java.util.ArrayList<kotlin.String>): kotlin.Unit
|
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
// FULL_JDK
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
|
import java.util.function.IntPredicate
|
||||||
|
import java.util.stream.Stream
|
||||||
|
import kotlin.streams.toList
|
||||||
|
|
||||||
|
class IntLongPair(val i: Int, val l: Long)
|
||||||
|
|
||||||
|
interface Process {
|
||||||
|
fun pid(): Int
|
||||||
|
|
||||||
|
fun totalCpuDuration(): Long?
|
||||||
|
}
|
||||||
|
|
||||||
|
fun run(filter: IntPredicate, allProcesses: Stream<Process>): List<IntLongPair> {
|
||||||
|
return allProcesses.filter {
|
||||||
|
filter.test(it.pid())
|
||||||
|
}.map<IntLongPair?> {
|
||||||
|
val duration = it.totalCpuDuration()
|
||||||
|
if (duration != null) IntLongPair(it.pid(), duration)
|
||||||
|
else null
|
||||||
|
}.toList()
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// FULL_JDK
|
||||||
|
// JVM_TARGET: 1.8
|
||||||
|
|
||||||
|
import java.util.function.IntPredicate
|
||||||
|
import java.util.stream.Stream
|
||||||
|
import kotlin.streams.toList
|
||||||
|
|
||||||
|
class IntLongPair(val i: Int, val l: Long)
|
||||||
|
|
||||||
|
interface Process {
|
||||||
|
fun pid(): Int
|
||||||
|
|
||||||
|
fun totalCpuDuration(): Long?
|
||||||
|
}
|
||||||
|
|
||||||
|
fun run(filter: IntPredicate, allProcesses: Stream<Process>): List<IntLongPair> {
|
||||||
|
return allProcesses.filter {
|
||||||
|
filter.test(it.pid())
|
||||||
|
}.map<IntLongPair?> {
|
||||||
|
val duration = it.totalCpuDuration()
|
||||||
|
if (duration != null) IntLongPair(it.pid(), <!DEBUG_INFO_SMARTCAST!>duration<!>)
|
||||||
|
else null
|
||||||
|
}.toList()
|
||||||
|
}
|
||||||
Generated
+22
-6
@@ -42435,12 +42435,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
runTest("compiler/testData/diagnostics/testsWithStdLib/shadowingInDestructuring.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@TestMetadata("streams.kt")
|
|
||||||
public void testStreams() {
|
|
||||||
runTest("compiler/testData/diagnostics/testsWithStdLib/streams.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/annotations")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@@ -47115,6 +47109,28 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/streams")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class Streams {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInStreams() {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/streams"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("basic.kt")
|
||||||
|
public void testBasic() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/basic.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("wrongNullability.kt")
|
||||||
|
public void testWrongNullability() {
|
||||||
|
runTest("compiler/testData/diagnostics/testsWithStdLib/streams/wrongNullability.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/targetedBuiltIns")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
|||||||
Reference in New Issue
Block a user