nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: kythe/kythe
Pull request #5789 (2023-08-17 15:58:52)

fix: ensure lookup kinds are correct for resolved MarkedSource


Patch:
diff --git a/kythe/go/util/markedsource/resolve.go b/kythe/go/util/markedsource/resolve.go
index c7a9b60a8..34184a064 100644
--- a/kythe/go/util/markedsource/resolve.go
+++ b/kythe/go/util/markedsource/resolve.go
@@ -102,6 +102,21 @@ func (r *Resolver) ResolveTicket(ticket string) *cpb.MarkedSource {
 	return r.resolve(ticket, r.nodes[ticket])
 }
 
+func ensureKind(ms *cpb.MarkedSource, k cpb.MarkedSource_Kind) *cpb.MarkedSource {
+	if ms.GetKind() == k {
+		return ms
+	}
+	if ms.GetKind() == cpb.MarkedSource_BOX {
+		ret := proto.Clone(ms).(*cpb.MarkedSource)
+		ret.Kind = k
+		return ret
+	}
+	return &cpb.MarkedSource{
+		Kind:  k,
+		Child: []*cpb.MarkedSource{ms},
+	}
+}
+
 func (r *Resolver) resolve(ticket string, ms *cpb.MarkedSource) *cpb.MarkedSource {
 	if ms == nil {
 		return ms
@@ -111,15 +126,15 @@ func (r *Resolver) resolve(ticket string, ms *cpb.MarkedSource) *cpb.MarkedSourc
 		// TODO: determine what to do when a lookup isn't found
 		params := r.params[ticket]
 		if p := params[ms.GetLookupIndex()]; p != "" {
-			return r.ResolveTicket(p)
+			return ensureKind(r.ResolveTicket(p), cpb.MarkedSource_PARAMETER)
 		}
 	case cpb.MarkedSource_LOOKUP_BY_TPARAM:
 		tparams := r.tparams[ticket]
 		if p := tparams[ms.GetLookupIndex()]; p != "" {
-			return r.ResolveTicket(p)
+			return ensureKind(r.ResolveTicket(p), cpb.MarkedSource_PARAMETER)
 		}
 	case cpb.MarkedSource_LOOKUP_BY_TYPED:
-		return r.ResolveTicket(r.typed[ticket])
+		return ensureKind(r.ResolveTicket(r.typed[ticket]), cpb.MarkedSource_TYPE)
 	case cpb.MarkedSource_PARAMETER_LOOKUP_BY_PARAM_WITH_DEFAULTS, cpb.MarkedSource_PARAMETER_LOOKUP_BY_PARAM:
 		// TODO: handle param/default
 		params := r.params[ticket][ms.GetLookupIndex():]


Test patch:
diff --git a/kythe/go/util/markedsource/resolve_test.go b/kythe/go/util/markedsource/resolve_test.go
index c2033aa98..687fb0a35 100644
--- a/kythe/go/util/markedsource/resolve_test.go
+++ b/kythe/go/util/markedsource/resolve_test.go
@@ -51,7 +51,7 @@ func TestResolve(t *testing.T) {
 				code(t, "kythe:#param", `kind: IDENTIFIER pre_text: "param"`),
 			},
 			"kythe:#test",
-			`kind: BOX child: { kind: IDENTIFIER pre_text: "param" }`,
+			`kind: BOX child: { kind: PARAMETER child: { kind: IDENTIFIER pre_text: "param" } }`,
 		},
 		{
 			[]*spb.Entry{
@@ -62,7 +62,7 @@ func TestResolve(t *testing.T) {
 				code(t, "kythe:#paramLevel1", `kind: IDENTIFIER pre_text: "deep"`),
 			},
 			"kythe:#test",
-			`kind: BOX child: { kind: IDENTIFIER pre_text: "deep" }`,
+			`kind: BOX child: { kind: PARAMETER child: { kind: IDENTIFIER pre_text: "deep" } }`,
 		},
 		{
 			[]*spb.Entry{
Repository: kythe/kythe
Pull request #5836 (2023-09-11 18:16:20)

feat(go_indexer): add type args to return types


Patch:
diff --git a/kythe/go/indexer/markedsource.go b/kythe/go/indexer/markedsource.go
index c1b16f811..f5774fee6 100644
--- a/kythe/go/indexer/markedsource.go
+++ b/kythe/go/indexer/markedsource.go
@@ -211,7 +211,7 @@ func objectName(obj types.Object) string {
 func typeName(typ types.Type) string {
 	switch t := typ.(type) {
 	case *types.Named:
-		return t.Obj().Name()
+		return t.Obj().Name() + typeArgs(typ)
 	case *types.Basic:
 		return t.Name()
 	case *types.Struct:


Test patch:
diff --git a/kythe/go/indexer/testdata/code/rendered.go b/kythe/go/indexer/testdata/code/rendered.go
index 48b2213e5..4a9c587c8 100644
--- a/kythe/go/indexer/testdata/code/rendered.go
+++ b/kythe/go/indexer/testdata/code/rendered.go
@@ -41,8 +41,12 @@ func N() (_ []*rand.Rand, err error) {
 	return nil, nil
 }
 
+// - @Set defines/binding Set
+// - Set.code/rendered/signature "Set"
+type Set[T comparable] struct{}
+
 // - @G defines/binding G
 // - G.code/rendered/qualified_name "rendered.G"
 // - G.code/rendered/callsite_signature "G[T](t)"
-// - G.code/rendered/signature "func G[T comparable](t T)"
-func G[T comparable](t T) {}
+// - G.code/rendered/signature "func G[T comparable](t T) *Set[T]"
+func G[T comparable](t T) *Set[T] { return nil }
Repository: kythe/kythe
Pull request #5844 (2023-09-15 13:59:14)

fix(go_indexer): use simple type name for constraints


Patch:
diff --git a/kythe/go/indexer/markedsource.go b/kythe/go/indexer/markedsource.go
index f5774fee6..0a6fe3bf1 100644
--- a/kythe/go/indexer/markedsource.go
+++ b/kythe/go/indexer/markedsource.go
@@ -120,7 +120,7 @@ func (pi *PackageInfo) MarkedSource(obj types.Object) *cpb.MarkedSource {
 						PreText: tp.String(),
 					}, {
 						Kind:    cpb.MarkedSource_TYPE,
-						PreText: tp.Constraint().String(),
+						PreText: typeName(tp.Constraint()),
 					}},
 				})
 			}
@@ -217,6 +217,9 @@ func typeName(typ types.Type) string {
 	case *types.Struct:
 		return "struct {...}"
 	case *types.Interface:
+		if t.String() == "any" {
+			return t.String()
+		}
 		return "interface {...}"
 	case *types.Pointer:
 		return "*" + typeName(t.Elem())


Test patch:
diff --git a/kythe/go/indexer/testdata/code/rendered.go b/kythe/go/indexer/testdata/code/rendered.go
index 4a9c587c8..acb60994b 100644
--- a/kythe/go/indexer/testdata/code/rendered.go
+++ b/kythe/go/indexer/testdata/code/rendered.go
@@ -1,6 +1,9 @@
 package rendered
 
-import "math/rand"
+import (
+	"fmt"
+	"math/rand"
+)
 
 // - @F defines/binding F
 // - F.code/rendered/qualified_name "rendered.F"
@@ -50,3 +53,9 @@ type Set[T comparable] struct{}
 // - G.code/rendered/callsite_signature "G[T](t)"
 // - G.code/rendered/signature "func G[T comparable](t T) *Set[T]"
 func G[T comparable](t T) *Set[T] { return nil }
+
+// - @#0Str defines/binding StrF
+// - StrF.code/rendered/qualified_name "rendered.Str"
+// - StrF.code/rendered/callsite_signature "Str[T](t)"
+// - StrF.code/rendered/signature "func Str[T Stringer](t T) string"
+func Str[T fmt.Stringer](t T) string { return t.String() }
Repository: kythe/kythe
Pull request #5897 (2023-10-13 19:56:26)

fix(java_indexer): add basic MarkedSource for wildcards


Patch:
diff --git a/kythe/java/com/google/devtools/kythe/analyzers/java/JavaEntrySets.java b/kythe/java/com/google/devtools/kythe/analyzers/java/JavaEntrySets.java
index 74186e7d3..91c3553e3 100644
--- a/kythe/java/com/google/devtools/kythe/analyzers/java/JavaEntrySets.java
+++ b/kythe/java/com/google/devtools/kythe/analyzers/java/JavaEntrySets.java
@@ -291,7 +291,13 @@ public class JavaEntrySets extends KytheEntrySets {
     return emitAndReturn(
         newNode(NodeKind.TVAR)
             .addSignatureSalt(sourcePath + counter)
-            .setCorpusPath(defaultCorpusPath()));
+            .setCorpusPath(defaultCorpusPath())
+            .setProperty(
+                "code",
+                MarkedSource.newBuilder()
+                    .setKind(MarkedSource.Kind.IDENTIFIER)
+                    .setPreText("?")
+                    .build()));
   }
 
   /** Returns and emits a Java anchor for the given offset span. */


Test patch:
diff --git a/kythe/javatests/com/google/devtools/kythe/analyzers/java/testdata/pkg/RenderedCode.java b/kythe/javatests/com/google/devtools/kythe/analyzers/java/testdata/pkg/RenderedCode.java
index 926191404..77ab9b885 100644
--- a/kythe/javatests/com/google/devtools/kythe/analyzers/java/testdata/pkg/RenderedCode.java
+++ b/kythe/javatests/com/google/devtools/kythe/analyzers/java/testdata/pkg/RenderedCode.java
@@ -2,6 +2,8 @@
 // - Package.code/rendered/signature "package pkg"
 package pkg;
 
+import java.util.List;
+
 // - @RenderedCode defines/binding RenderedCode
 // - RenderedCode.code/rendered/signature "public final class RenderedCode"
 // - RenderedCode.code/rendered/qualified_name "pkg.RenderedCode"
@@ -33,12 +35,35 @@ public final class RenderedCode {
     public static <A, B> Inner<A, B> create() {
       return null;
     }
+
+    // - @genericList defines/binding GenericList
+    // - GenericList.code/rendered/signature "List<T> genericList"
+    List<T> genericList;
   }
 
   // - @CONSTANT defines/binding Constant
   // - Constant.code/rendered/signature "public static final String CONSTANT"
   public static final String CONSTANT = "blah";
 
+  // - @arry defines/binding Arry
+  // - Arry.code/rendered/signature "private int[] arry"
+  private int[] arry;
+
+  // - @wildcardList defines/binding WildcardList
+  // - WildcardList.code/rendered/signature "List<?> wildcardList"
+  // - WildcardList typed WildcardListType
+  // - WildcardListType param.1 Wildcard
+  // - Wildcard.code/rendered/signature "?"
+  List<?> wildcardList;
+
+  // - @extendsBoundedList defines/binding ExtendsBoundedList
+  // - ExtendsBoundedList.code/rendered/signature "List<? extends RenderedCode> extendsBoundedList"
+  List<? extends RenderedCode> extendsBoundedList;
+
+  // - @superBoundedList defines/binding SuperBoundedList
+  // - SuperBoundedList.code/rendered/signature "List<? super Inner<?, ?>> superBoundedList"
+  List<? super Inner<?, ?>> superBoundedList;
+
   // - @E defines/binding E
   // - E.code/rendered/signature "protected enum E"
   protected enum E {
Repository: kythe/kythe
Pull request #5910 (2023-10-24 22:05:28)

chore(cxx_common): clean up some clang-tidy warnings


Patch:
diff --git a/kythe/cxx/common/BUILD b/kythe/cxx/common/BUILD
index 986558022..75bb1cca0 100644
--- a/kythe/cxx/common/BUILD
+++ b/kythe/cxx/common/BUILD
@@ -104,6 +104,7 @@ cc_test(
     srcs = ["path_utils_test.cc"],
     deps = [
         ":path_utils",
+        ":regex",
         "//third_party:gtest",
         "//third_party:gtest_main",
         "@com_google_absl//absl/log:check",
diff --git a/kythe/cxx/common/path_utils.cc b/kythe/cxx/common/path_utils.cc
index 02f11c430..cce4400fb 100644
--- a/kythe/cxx/common/path_utils.cc
+++ b/kythe/cxx/common/path_utils.cc
@@ -26,6 +26,7 @@
 #include <optional>
 #include <string>
 #include <utility>
+#include <variant>
 #include <vector>
 
 #include "absl/algorithm/container.h"
diff --git a/kythe/cxx/common/path_utils.h b/kythe/cxx/common/path_utils.h
index 533be40ef..8e98d107e 100644
--- a/kythe/cxx/common/path_utils.h
+++ b/kythe/cxx/common/path_utils.h
@@ -177,7 +177,7 @@ bool AbslParseFlag(absl::string_view text,
 /// \brief Returns the flag string representation of
 /// PathCanonicalizer::PathEntry.
 std::string AbslUnparseFlag(
-    const std::vector<PathCanonicalizer::PathEntry>& entry);
+    const std::vector<PathCanonicalizer::PathEntry>& entries);
 
 /// \brief Append path `b` to path `a`, cleaning and returning the result.
 std::string JoinPath(absl::string_view a, absl::string_view b);


Test patch:
diff --git a/kythe/cxx/common/path_utils_test.cc b/kythe/cxx/common/path_utils_test.cc
index 4d98bd675..fad9ac9a7 100644
--- a/kythe/cxx/common/path_utils_test.cc
+++ b/kythe/cxx/common/path_utils_test.cc
@@ -31,6 +31,7 @@
 #include "absl/status/statusor.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+#include "kythe/cxx/common/regex.h"
 
 namespace kythe {
 namespace {
Repository: kythe/kythe
Pull request #5991 (2024-01-16 20:30:55)

tools: markedsource defaults to rendering all when --rewrite is on


Patch:
diff --git a/kythe/go/util/tools/markedsource/markedsource.go b/kythe/go/util/tools/markedsource/markedsource.go
index 376b96f3a..b32f774e8 100644
--- a/kythe/go/util/tools/markedsource/markedsource.go
+++ b/kythe/go/util/tools/markedsource/markedsource.go
@@ -44,10 +44,10 @@ import (
 var (
 	rewrite = flag.Bool("rewrite", false, "Rewrite all code facts to be fully resolved")
 
-	renderSignature         = flag.Bool("render_signatures", false, "Whether to emit /kythe/code/rendered/signature facts (requires --rewrite)")
-	renderCallsiteSignature = flag.Bool("render_callsite_signatures", false, "Whether to emit /kythe/code/rendered/callsite_signature facts (requires --rewrite)")
-	renderQualifiedName     = flag.Bool("render_qualified_names", false, "Whether to emit /kythe/code/rendered/qualified_name facts (requires --rewrite)")
-	renderSimpleName        = flag.Bool("render_simple_names", false, "Whether to emit /kythe/code/rendered/simple_name facts (requires --rewrite)")
+	renderSignature         = flag.Bool("render_signatures", true, "Whether to emit /kythe/code/rendered/signature facts (requires --rewrite)")
+	renderCallsiteSignature = flag.Bool("render_callsite_signatures", true, "Whether to emit /kythe/code/rendered/callsite_signature facts (requires --rewrite)")
+	renderQualifiedName     = flag.Bool("render_qualified_names", true, "Whether to emit /kythe/code/rendered/qualified_name facts (requires --rewrite)")
+	renderSimpleName        = flag.Bool("render_simple_names", true, "Whether to emit /kythe/code/rendered/simple_name facts (requires --rewrite)")
 )
 
 const renderFactPrefix = facts.Code + "/rendered/"


Test patch:
diff --git a/tools/build_rules/verifier_test/verifier_test.sh.in b/tools/build_rules/verifier_test/verifier_test.sh.in
index 9f6b77fe7..847a02691 100644
--- a/tools/build_rules/verifier_test/verifier_test.sh.in
+++ b/tools/build_rules/verifier_test/verifier_test.sh.in
@@ -27,7 +27,7 @@ ENTRIES_GZ=(@ENTRIES_GZ@)
   if (( ${#ENTRIES_GZ[@]} )); then gunzip -c "${ENTRIES_GZ[@]}"; fi
 ) | (
   if [[ -z "@REWRITE@" ]]; then
-    @MARKEDSOURCE@ --rewrite --render_callsite_signatures --render_qualified_names --render_signatures
+    @MARKEDSOURCE@ --rewrite
   else
     cat
   fi