PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: 100phlecs/tailwind_formatter (elixir)

Issue:
Formatter inserts incorrect `}`
The first time I tried the formatter in one of our projects it worked. The second time I got an FunctionClauseError `no function clause matching in Phoenix.LiveView.HTMLFormatter.to_tree/4`.

It turns out that the first run of the tailwind formatter formats the following

```elixir
    <div class={"h-6 " <> if @active, do: "bg-white", else: "bg-red"}></div>
```

to

```elixir
    <div class={"h-6"} <> if @active, do: "bg-white", else: "bg-red"}></div>
```

And this is invalid code because of the inserted `}` :-) 


Pull request:
handle nested interpolated strings
Related to #18 

Patch:
diff --git a/lib/tailwind_formatter/defaults.ex b/lib/tailwind_formatter/defaults.ex
index 9cb68b4..6cb88fd 100644
--- a/lib/tailwind_formatter/defaults.ex
+++ b/lib/tailwind_formatter/defaults.ex
@@ -1,7 +1,7 @@
 defmodule TailwindFormatter.Defaults do
   @moduledoc false
-  @class_pattern ~r/(?:class\s*(?:=|:)\s*)(({)|('|"))(.|\s)*?(?(2)}|("|'))/i
-  @inline_func_pattern ~r/#\{([^}]+)\}*/i
+  @class_pattern ~r/(?:class\s*(?:=|:)\s*)((\{)|('|"))(.|\s)*?(?(2)\}|("|'))/i
+  @inline_func_pattern ~r/#\{((?:(?:(?!(#\{|\})).)|(?R))*)\}/i
   @dynamic_classes ~r/[[:alnum:]-]*#\{([^}]+)\}*/i
   @invalid_input ~r/[^_a-zA-Z0-9\$\s\-:\[\]\/\.\#]+/
 


Test patch:
diff --git a/test/tailwind_formatter_test.exs b/test/tailwind_formatter_test.exs
index 47c4519..f8edc63 100644
--- a/test/tailwind_formatter_test.exs
+++ b/test/tailwind_formatter_test.exs
@@ -300,6 +300,18 @@ defmodule TailwindFormatterTest do
     assert_formatter_output(input, expected)
   end
 
+  test "can handle multiple interpolated strings" do
+    input = ~S"""
+    <.img src={~p"/images/#{"card-#{@card.brand}.svg"}"} />
+    """
+
+    expected = ~S"""
+    <.img src={~p"/images/#{"card-#{@card.brand}.svg"}"} />
+    """
+
+    assert_formatter_output(input, expected)
+  end
+
   describe "aborts on bad input" do
     test "missing final quote" do
       input = ~S"""
@@ -340,6 +352,22 @@ defmodule TailwindFormatterTest do
         href="#"></a>
       """
 
+      output = ~S"""
+      <a class={"#{if false, do: "bg-white" text-sm potato sm:lowercase uppercase"
+        id="testing
+        href="#"></a>
+      """
+
+      assert_formatter_output(input, output)
+    end
+
+    test "invalid elixir fn" do
+      input = ~S"""
+      <a class={"#{if false, do: } text-sm potato sm:lowercase uppercase"
+        id="testing
+        href="#"></a>
+      """
+
       assert_formatter_raise(input)
     end
Repository: VeryGoodOpenSource/dart_frog (dart)

Issue:
feat: expose HttpConnectionInfo
**Description**

As a developer, I want to have easy access to the [`HttpConnectionInfo`](https://api.dart.dev/stable/2.17.6/dart-io/HttpConnectionInfo-class.html) so that I can access the remote address and/or port.

This can be surfaced via the `RequestContext`:

```dart
Response onRequest(RequestContext context) {
  final connectionInfo = context.connectionInfo;
}
```

Pull request:
<!--
  Thanks for contributing!

  Provide a description of your changes below and a general summary in the title

  Please look at the following checklist to ensure that your PR can be accepted quickly:
-->

## Status

**READY**

## Description

<!--- Describe your changes in detail -->
- feat(dart_frog): expose HttpConnectionInfo on Request (closes #203)

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [X] ✨ New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
- [ ] 🧹 Code refactor
- [ ] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore

Patch:
diff --git a/packages/dart_frog/lib/src/request.dart b/packages/dart_frog/lib/src/request.dart
index 7ab7bc27e..1eba046d0 100644
--- a/packages/dart_frog/lib/src/request.dart
+++ b/packages/dart_frog/lib/src/request.dart
@@ -95,6 +95,11 @@ class Request {
 
   final shelf.Request _request;
 
+  /// Connection information for the associated HTTP request.
+  HttpConnectionInfo get connectionInfo {
+    return _request.context['shelf.io.connection_info']! as HttpConnectionInfo;
+  }
+
   /// The requested url relative to the current handler path.
   Uri get url => _request.url;
 


Test patch:
diff --git a/packages/dart_frog/test/src/serve_test.dart b/packages/dart_frog/test/src/serve_test.dart
index dd80691ac..85ee6a6fe 100644
--- a/packages/dart_frog/test/src/serve_test.dart
+++ b/packages/dart_frog/test/src/serve_test.dart
@@ -25,5 +25,22 @@ void main() {
       expect(response.statusCode, equals(HttpStatus.notFound));
       await server.close();
     });
+
+    test('exposes connectionInfo on the incoming request', () async {
+      late HttpConnectionInfo connectionInfo;
+      final server = await serve(
+        (context) {
+          connectionInfo = context.request.connectionInfo;
+          return Response();
+        },
+        'localhost',
+        3000,
+      );
+      final client = HttpClient();
+      final request = await client.getUrl(Uri.parse('http://localhost:3000'));
+      await request.close();
+      expect(connectionInfo.remoteAddress.address, equals('::1'));
+      await server.close();
+    });
   });
 }