nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: goplus/gop
Pull request #2363 (2025-05-21 10:13:10)

fix(compile): ensure valid Rparen and NoParenEnd in CallExpr
fix: https://github.com/goplus/builder/issues/1696


Patch:
diff --git a/cl/expr.go b/cl/expr.go
index 15b3ed92..74eb31e6 100644
--- a/cl/expr.go
+++ b/cl/expr.go
@@ -664,6 +664,10 @@ func (p *fnType) initFuncs(base int, funcs []types.Object, typeAsParams bool) {
 }
 
 func compileCallExpr(ctx *blockCtx, v *ast.CallExpr, inFlags int) {
+	// If you need to confirm the callExpr format, you can turn on
+	// if !v.NoParenEnd.IsValid() && !v.Rparen.IsValid() {
+	// 	panic("unexpected invalid Rparen and NoParenEnd in CallExpr")
+	// }
 	var ifn *ast.Ident
 	switch fn := v.Fun.(type) {
 	case *ast.Ident:
@@ -1657,7 +1661,7 @@ func compileErrWrapExpr(ctx *blockCtx, v *ast.ErrWrapExpr, inFlags int) {
 	expr := v.X
 	switch expr.(type) {
 	case *ast.Ident, *ast.SelectorExpr:
-		expr = &ast.CallExpr{Fun: expr}
+		expr = &ast.CallExpr{Fun: expr, NoParenEnd: expr.End()}
 	}
 	compileExpr(ctx, expr, inFlags)
 	x := cb.InternalStack().Pop()
diff --git a/cl/internal/spx4/game.go b/cl/internal/spx4/game.go
index 2e18253b..07de0663 100644
--- a/cl/internal/spx4/game.go
+++ b/cl/internal/spx4/game.go
@@ -54,6 +54,10 @@ func (p *MyGame) Broadcast__1(msg string, wait bool) {
 func (p *MyGame) Broadcast__2(msg string, data any, wait bool) {
 }
 
+func (p *MyGame) BackdropName() string {
+	return ""
+}
+
 func (p *MyGame) Play(media string, wait ...bool) {
 }
 
diff --git a/cl/stmt.go b/cl/stmt.go
index 3f5f66e4..042e3068 100644
--- a/cl/stmt.go
+++ b/cl/stmt.go
@@ -902,8 +902,9 @@ func compileBranchStmt(ctx *blockCtx, v *ast.BranchStmt) {
 			return
 		}
 		compileCallExpr(ctx, &ast.CallExpr{
-			Fun:  &ast.Ident{NamePos: v.TokPos, Name: "goto", Obj: &ast.Object{Data: label}},
-			Args: []ast.Expr{label},
+			Fun:        &ast.Ident{NamePos: v.TokPos, Name: "goto", Obj: &ast.Object{Data: label}},
+			Args:       []ast.Expr{label},
+			NoParenEnd: label.End(),
 		}, clIdentGoto)
 	case token.BREAK:
 		ctx.cb.Break(getLabel(ctx, label))


Test patch:
diff --git a/cl/compile_spx_test.go b/cl/compile_spx_test.go
index 39aecf5d..50adb0f7 100644
--- a/cl/compile_spx_test.go
+++ b/cl/compile_spx_test.go
@@ -101,6 +101,12 @@ Greem.t4spx:1:1: cannot use  (type *Greem) as type github.com/goplus/gop/cl/inte
 )`,
 		"/foo/Greem.t4spx": ``,
 	})
+
+	gopSpxErrorTestMap(t, `Game.t4gmx:1:9: cannot use backdropName (type string) as type error in assignment`, map[string][]string{
+		"/foo": {"Game.t4gmx"},
+	}, map[string]string{
+		"/foo/Game.t4gmx": `println backdropName!`,
+	})
 }
 
 func TestSpxBasic(t *testing.T) {
Repository: google/certificate-transparency-go
Pull request #960 (2022-07-27 08:49:25)

Skip consistency check when root is size zero
Any head is consistent with empty root.

<!---
Describe your changes in detail here.
If this fixes an issue, please write "Fixes #123", substituting the issue number.
-->

### Checklist

<!---
Go over all the following points, and put an `x` in all the boxes that apply.
Feel free to not tick any boxes that don't apply to this PR (e.g. refactoring may not need a CHANGELOG update).
If you're unsure about any of these, don't hesitate to ask. We're here to help!
-->

- [x] I have updated the [CHANGELOG](CHANGELOG.md).
  - Adjust the draft version number according to [semantic versioning](https://semver.org/) rules.
- [ ] I have updated [documentation](docs/) accordingly.



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 866e2fa8..f8b19f69 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,10 @@
  * `ctfe.PEMCertPool` type has been moved to `x509util.PEMCertPool` to reduce
    dependencies (#903).
 
+### Migrillian
+
+* #960: Skip consistency check when root is size zero.
+
 ### Misc
 
  * updated golangci-lint to v1.46.1 (developers should update to this version)
diff --git a/trillian/migrillian/core/controller.go b/trillian/migrillian/core/controller.go
index 58aebb43..1cc90e7b 100644
--- a/trillian/migrillian/core/controller.go
+++ b/trillian/migrillian/core/controller.go
@@ -337,6 +337,10 @@ func (c *Controller) fetchTail(ctx context.Context, begin uint64) (uint64, error
 // verifyConsistency checks that the provided verified Trillian root is
 // consistent with the CT log's STH.
 func (c *Controller) verifyConsistency(ctx context.Context, treeSize uint64, rootHash []byte, sth *ct.SignedTreeHead) error {
+	if treeSize == 0 {
+		// Any head is consistent with empty root -- unnecessary to request empty proof.
+		return nil
+	}
 	if c.opts.NoConsistencyCheck {
 		glog.Warningf("%s: skipping consistency check", c.label)
 		return nil


Test patch:
diff --git a/trillian/migrillian/core/controller_test.go b/trillian/migrillian/core/controller_test.go
new file mode 100644
index 00000000..e60515fc
--- /dev/null
+++ b/trillian/migrillian/core/controller_test.go
@@ -0,0 +1,15 @@
+package core
+
+import (
+	"context"
+	"testing"
+
+	ct "github.com/google/certificate-transparency-go"
+)
+
+func TestVerifyConsistencyEmptyHead(t *testing.T) {
+	controller := new(Controller)
+	if controller.verifyConsistency(context.Background(), 0, []byte("abc"), &ct.SignedTreeHead{TreeSize: 100}) != nil {
+		t.Errorf("verifyConsistency should always succeed given empty root")
+	}
+}
Repository: seanmonstar/reqwest
Pull request #2503 (2024-12-23 16:18:52)

fix: propagate Body::size_hint when wrapping bodies


Patch:
diff --git a/src/async_impl/body.rs b/src/async_impl/body.rs
index c2f1257..454046d 100644
--- a/src/async_impl/body.rs
+++ b/src/async_impl/body.rs
@@ -148,10 +148,7 @@ impl Body {
     {
         use http_body_util::BodyExt;
 
-        let boxed = inner
-            .map_frame(|f| f.map_data(Into::into))
-            .map_err(Into::into)
-            .boxed();
+        let boxed = IntoBytesBody { inner }.map_err(Into::into).boxed();
 
         Body {
             inner: Inner::Streaming(boxed),
@@ -461,6 +458,47 @@ where
     }
 }
 
+// ===== impl IntoBytesBody =====
+
+pin_project! {
+    struct IntoBytesBody<B> {
+        #[pin]
+        inner: B,
+    }
+}
+
+// We can't use `map_frame()` because that loses the hint data (for good reason).
+// But we aren't transforming the data.
+impl<B> hyper::body::Body for IntoBytesBody<B>
+where
+    B: hyper::body::Body,
+    B::Data: Into<Bytes>,
+{
+    type Data = Bytes;
+    type Error = B::Error;
+
+    fn poll_frame(
+        self: Pin<&mut Self>,
+        cx: &mut Context,
+    ) -> Poll<Option<Result<hyper::body::Frame<Self::Data>, Self::Error>>> {
+        match futures_core::ready!(self.project().inner.poll_frame(cx)) {
+            Some(Ok(f)) => Poll::Ready(Some(Ok(f.map_data(Into::into)))),
+            Some(Err(e)) => Poll::Ready(Some(Err(e))),
+            None => Poll::Ready(None),
+        }
+    }
+
+    #[inline]
+    fn size_hint(&self) -> http_body::SizeHint {
+        self.inner.size_hint()
+    }
+
+    #[inline]
+    fn is_end_stream(&self) -> bool {
+        self.inner.is_end_stream()
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use http_body::Body as _;
@@ -484,8 +522,9 @@ mod tests {
         assert!(!bytes_body.is_end_stream());
         assert_eq!(bytes_body.size_hint().exact(), Some(3));
 
-        let stream_body = Body::wrap(bytes_body);
-        assert!(!stream_body.is_end_stream());
-        assert_eq!(stream_body.size_hint().exact(), None);
+        // can delegate even when wrapped
+        let stream_body = Body::wrap(empty_body);
+        assert!(stream_body.is_end_stream());
+        assert_eq!(stream_body.size_hint().exact(), Some(0));
     }
 }


Test patch:
diff --git a/tests/client.rs b/tests/client.rs
index 51fb9df..f994183 100644
--- a/tests/client.rs
+++ b/tests/client.rs
@@ -197,7 +197,7 @@ async fn body_pipe_response() {
             http::Response::new("pipe me".into())
         } else {
             assert_eq!(req.uri(), "/pipe");
-            assert_eq!(req.headers()["transfer-encoding"], "chunked");
+            assert_eq!(req.headers()["content-length"], "7");
 
             let full: Vec<u8> = req
                 .into_body()