PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: passsy/kt.dart (dart)

Issue:
shuffled()
Add https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/shuffled.html

```kotlin
// Returns a new list with the elements of this list randomly shuffled.
fun <T> Iterable<T>.shuffled(): List<T>
```

Pull request:
Closes #145 by adding shuffled() method to `KtIterable`

Patch:
diff --git a/lib/src/collection/kt_iterable.dart b/lib/src/collection/kt_iterable.dart
index 196af23..c6dae32 100644
--- a/lib/src/collection/kt_iterable.dart
+++ b/lib/src/collection/kt_iterable.dart
@@ -1110,6 +1110,11 @@ extension KtIterableExtensions<T> on KtIterable<T> {
     return list;
   }
 
+  /// Returns a new list with the elements of this list randomly shuffled.
+  KtList<T> shuffled([math.Random? random]) {
+    return toMutableList()..shuffle(random);
+  }
+
   /// Returns the single element matching the given [predicate], or throws an exception if the list is empty or has more than one element.
   T single([bool Function(T)? predicate]) {
     if (predicate == null) {


Test patch:
diff --git a/test/collection/iterable_extensions_test.dart b/test/collection/iterable_extensions_test.dart
index a8048cc..f394e1c 100644
--- a/test/collection/iterable_extensions_test.dart
+++ b/test/collection/iterable_extensions_test.dart
@@ -1,3 +1,5 @@
+import 'dart:math' as math;
+
 import "package:kt_dart/collection.dart";
 import "package:kt_dart/src/collection/impl/iterable.dart";
 import "package:test/test.dart";
@@ -1653,6 +1655,27 @@ void testIterable(KtIterable<T> Function<T>() emptyIterable,
     });
   });
 
+  group("shuffled", () {
+    test(
+        "shuffled returns a new list with shuffled items in the list with provided Random object",
+        () {
+      final list = iterableOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
+      final firstList = list.shuffled(math.Random(1));
+      expect(firstList, listOf(6, 4, 10, 9, 3, 2, 7, 8, 1, 5));
+
+      final secondList = list.shuffled(math.Random(2));
+      expect(secondList, listOf(8, 6, 3, 10, 9, 1, 2, 5, 7, 4));
+    });
+
+    test("empty", () {
+      expect(emptyIterable<int>().shuffled(), emptyList<int>());
+    });
+
+    test("one", () {
+      expect(listOf(1).shuffled(), listOf(1));
+    });
+  });
+
   group("single", () {
     test("single", () {
       expect(iterableOf([1]).single(), 1);
Repository: joernio/joern (scala)

Issue:
`cpg.local.dump` outputs empty strings
Currently, `cpg.local.dump` returns empty strings, at least for the C frontends, while `cpg.local.method.dump` works fine. My guess is that locations for locals are not returned correctly or that line number information is missing.

Pull request:
Fixes https://github.com/joernio/joern/issues/847

Patch:
diff --git a/joern-cli/frontends/c2cpg/src/main/scala/io/joern/c2cpg/astcreation/AstForTypesCreator.scala b/joern-cli/frontends/c2cpg/src/main/scala/io/joern/c2cpg/astcreation/AstForTypesCreator.scala
index 1bd819109e9e..5d4c1cf21168 100644
--- a/joern-cli/frontends/c2cpg/src/main/scala/io/joern/c2cpg/astcreation/AstForTypesCreator.scala
+++ b/joern-cli/frontends/c2cpg/src/main/scala/io/joern/c2cpg/astcreation/AstForTypesCreator.scala
@@ -117,6 +117,7 @@ trait AstForTypesCreator {
           .name(name)
           .typeFullName(registerType(tpe))
           .order(order)
+          .lineNumber(line(declarator))
         scope.addToScope(name, (l, tpe))
         Ast(l)
       case _ =>
@@ -125,6 +126,7 @@ trait AstForTypesCreator {
           .name(name)
           .typeFullName(registerType(tpe))
           .order(order)
+          .lineNumber(line(declarator))
         scope.addToScope(name, (l, tpe))
         Ast(l)
     }


Test patch:
diff --git a/joern-cli/frontends/c2cpg/src/test/scala/io/joern/c2cpg/querying/LocationTests.scala b/joern-cli/frontends/c2cpg/src/test/scala/io/joern/c2cpg/querying/LocationTests.scala
index cf59cb20ce05..eeaa058c4cfd 100644
--- a/joern-cli/frontends/c2cpg/src/test/scala/io/joern/c2cpg/querying/LocationTests.scala
+++ b/joern-cli/frontends/c2cpg/src/test/scala/io/joern/c2cpg/querying/LocationTests.scala
@@ -83,7 +83,19 @@ class LocationTests extends CCodeToCpgSuite {
     loc.lineNumber shouldBe Some(3)
     loc.filename should endWith(".c")
     loc.nodeLabel shouldBe "IDENTIFIER"
+  }
+
+  "should return location for local" in {
+    val locations = cpg.local.name("x").location.l
+    locations.size shouldBe 1
 
+    val loc = locations.head
+    loc.methodFullName shouldBe "my_func"
+    loc.methodShortName shouldBe "my_func"
+    loc.symbol shouldBe "x"
+    loc.lineNumber shouldBe Some(3)
+    loc.filename should endWith(".c")
+    loc.nodeLabel shouldBe "LOCAL"
   }
 
 }