You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: build/jupyterize/SPECIFICATION.md
+81-5Lines changed: 81 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -258,7 +258,69 @@ During implementation, several non‑obvious details significantly reduced bugs
258
258
- Keep patterns minimal and composable (e.g., separate `class_opening`, `method_opening`, `closing_braces`).
259
259
- Validate patterns at startup or wrap application with try/except to warn and continue on malformed regex.
260
260
261
-
### 10. Pattern Count Differences Between Languages (Java Implementation Insight)
261
+
### 10. Closing Brace Removal Must Be Match-Based, Not Pattern-Based (Critical Bug Fix)
262
+
263
+
**Problem**: The initial implementation removed closing braces based on the number of unwrap patterns configured, not the number of patterns that actually matched. This caused a critical bug where closing braces from control structures (for loops, foreach loops, if statements) were incorrectly removed.
264
+
265
+
**Example of the bug**:
266
+
```csharp
267
+
// Original code in a cell
268
+
for (vari=0; i<resultsList.Count; i++)
269
+
{
270
+
Console.WriteLine(i);
271
+
}
272
+
273
+
// BUG: Closing brace was removed, resulting in:
274
+
for (vari=0; i<resultsList.Count; i++)
275
+
{
276
+
Console.WriteLine(i);
277
+
// Missing }
278
+
```
279
+
280
+
**Rootcause**:Theunwrappinglogiccountedbracestoremovebasedonpatternconfiguration (e.g., "C# has 4 patterns with braces, so remove 4 closing braces from every cell"), ratherthancountinghowmanypatternsactuallymatchedineachspecificcell.
0 commit comments