PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 116
Good morning! Here's your coding interview problem for today.

This problem was asked by Jane Street.

Generate a finite, but an arbitrarily large binary tree quickly in O(1).

That is, `generate()` should return a tree whose size is unbounded but finite.

Pull request:
Day116
Resolves #242.

Patch:
diff --git a/README.md b/README.md
index af7c2fc..44e5348 100644
--- a/README.md
+++ b/README.md
@@ -124,3 +124,4 @@ problems from
 * [Day 112](https://github.com/vaskoz/dailycodingproblem-go/issues/235)
 * [Day 113](https://github.com/vaskoz/dailycodingproblem-go/issues/236)
 * [Day 114](https://github.com/vaskoz/dailycodingproblem-go/issues/237)
+* [Day 116](https://github.com/vaskoz/dailycodingproblem-go/issues/242)
diff --git a/day116/problem.go b/day116/problem.go
new file mode 100644
index 0000000..53c274b
--- /dev/null
+++ b/day116/problem.go
@@ -0,0 +1,42 @@
+package day116
+
+// UnboundBinaryTree is a tree that lazily grows.
+type UnboundBinaryTree interface {
+	Value() interface{}
+	Left() UnboundBinaryTree
+	Right() UnboundBinaryTree
+}
+
+type ubtTree struct {
+	value       interface{}
+	left, right *ubtTree
+}
+
+// Left returns the left child of this node.
+// Returns nil if the variable is set to nil.
+func (ubt *ubtTree) Left() UnboundBinaryTree {
+	if ubt.left == nil {
+		ubt.left = &ubtTree{}
+	}
+	return ubt.left
+}
+
+// Right returns the left child of this node.
+// Returns nil if the variable is set to nil.
+func (ubt *ubtTree) Right() UnboundBinaryTree {
+	if ubt.right == nil {
+		ubt.right = &ubtTree{}
+	}
+	return ubt.right
+}
+
+// Value returns the value stored at this node.
+// Returns nil if the variable is set to nil.
+func (ubt *ubtTree) Value() interface{} {
+	return ubt.value
+}
+
+// GenerateUnboundBinaryTree runs in O(1) time.
+func GenerateUnboundBinaryTree() UnboundBinaryTree {
+	return &ubtTree{}
+}


Test patch:
diff --git a/day116/problem_test.go b/day116/problem_test.go
new file mode 100644
index 0000000..db44cf1
--- /dev/null
+++ b/day116/problem_test.go
@@ -0,0 +1,29 @@
+package day116
+
+import "testing"
+
+func TestGenerateUnboundBinaryTree(t *testing.T) {
+	t.Parallel()
+	tree := GenerateUnboundBinaryTree()
+	for i := 0; i < 1000; i++ {
+		tree = tree.Left()
+		tree = tree.Right()
+	}
+	if tree.Value() != UnboundBinaryTree(nil) {
+		t.Errorf("The values are always nil of the interface type")
+	}
+	if tree.Left() == nil {
+		t.Errorf("The tree should be infinite. Left is nil")
+	}
+	if tree.Right() == nil {
+		t.Errorf("The tree should be infinite. Right is nil")
+	}
+}
+
+func BenchmarkGenerateUnboundBinaryTree(b *testing.B) {
+	tree := GenerateUnboundBinaryTree()
+	for i := 0; i < b.N; i++ {
+		tree = tree.Left()
+		tree = tree.Right()
+	}
+}
Repository: canjs/can-zone (js)

Issue:
Can-zone tasks.js should reject the promise instead of rethrowing the error.
This is to keep the caught promises errors from showing up in the console.  This code is currently rethrowing the error, when it could pass on a rejected promise: https://github.com/canjs/can-zone/blob/master/lib/tasks.js#L109

https://github.com/donejs/bitcentive/issues/112

Pull request:
Don't rethrow in a Promise rejection
Instead of rethrowing in a promise rejection, which forces the rejection
into an Error object, simply return a new Promise.reject(val).

Closes #92

Patch:
diff --git a/lib/tasks.js b/lib/tasks.js
index 3c58892..38fabd9 100644
--- a/lib/tasks.js
+++ b/lib/tasks.js
@@ -106,8 +106,7 @@ exports.then = function(then){
 			if(fn) {
 				return fn.apply(this, arguments);
 			} else if(rejected) {
-				val = typeof val === "string" ? new Error(val) : val;
-				throw val;
+				return Promise.reject(val);
 			}
 			return val;
 		}, false);


Test patch:
diff --git a/test/test.js b/test/test.js
index 2e1baea..db4dfd3 100644
--- a/test/test.js
+++ b/test/test.js
@@ -597,7 +597,7 @@ describe("Promises", function(){
 		new Zone().run(function(){
 
 			Promise.reject("uh oh").then().then(null, function(err){
-				Zone.current.data.reason = err.message;
+				Zone.current.data.reason = err;
 			});
 
 		}).then(function(data){