|
360 | 360 | ;; Without the fix, the formatter would allow the code to exceed the line length limit. |
361 | 361 | ;; With the fix, the formatter either keeps it on one line within the limit, or breaks it |
362 | 362 | ;; across multiple lines if it cannot fit. |
363 | | - (define orig-line " [`(,(and (or '+ '- '* '/ 'and 'or) op) ,as ..2 ,b) `(,op ,(loop `(,op ,@as) env) ,(loop b env))]") |
| 363 | + (define orig-line |
| 364 | + (string-append " [`(,(and (or '+ '- '* '/ 'and 'or) op) ,as ..2 ,b)" |
| 365 | + " `(,op ,(loop `(,op ,@as) env) ,(loop b env))]")) |
364 | 366 | (check-equal? (string-length orig-line) 102 "Original line should be 102 characters") |
365 | 367 |
|
366 | 368 | ;; The quasiquote expression starts at position 57 and ends at position 101 |
|
370 | 372 | (define quasiquote-end 101) ; just before the final ] |
371 | 373 |
|
372 | 374 | (define replacement |
373 | | - (string-replacement #:start quasiquote-start |
374 | | - #:end quasiquote-end |
375 | | - #:contents (list (inserted-string "(list op (loop `(,op ,@as) env) (loop b env))")))) |
| 375 | + (string-replacement |
| 376 | + #:start quasiquote-start |
| 377 | + #:end quasiquote-end |
| 378 | + #:contents (list (inserted-string "(list op (loop `(,op ,@as) env) (loop b env))")))) |
376 | 379 |
|
377 | 380 | ;; Test with Racket's standard line width of 102 |
378 | 381 | (parameterize ([current-width 102]) |
|
383 | 386 | ;; If it's multi-line, each line should not exceed 102 characters |
384 | 387 | (for ([line (in-list (string-split result "\n"))]) |
385 | 388 | (check-true (<= (string-length line) 102) |
386 | | - (format "Line exceeds length limit: ~a chars (should be <= 102)" (string-length line))))))) |
| 389 | + (format "Line exceeds length limit: ~a chars (should be <= 102)" |
| 390 | + (string-length line))))))) |
387 | 391 |
|
388 | 392 |
|
389 | 393 | (define (syntax-replacement-introduces-incorrect-bindings? replacement) |
|
392 | 396 | #:introduction-scope intro) |
393 | 397 | replacement) |
394 | 398 | (for/and ([new-id (in-syntax-identifiers new)] |
395 | | - #:unless (bound-identifier=? new-id (intro new-id 'remove))) |
| 399 | + #:unless (bound-identifier=? new-id (intro new-id 'remove)) |
| 400 | + #:unless (syntax-property new-id 'skip-incorrect-binding-check?)) |
396 | 401 | (free-identifier=? new-id (datum->syntax orig (syntax->datum new-id))))) |
397 | 402 |
|
398 | 403 |
|
|
403 | 408 | replacement) |
404 | 409 | (for/list ([new-id (in-syntax-identifiers new)] |
405 | 410 | #:unless (bound-identifier=? new-id (intro new-id 'remove)) |
406 | | - #:unless (free-identifier=? new-id (datum->syntax orig (syntax->datum new-id)))) |
| 411 | + #:unless (free-identifier=? new-id (datum->syntax orig (syntax->datum new-id))) |
| 412 | + #:unless (syntax-property new-id 'skip-incorrect-binding-check?)) |
407 | 413 | new-id)) |
408 | 414 |
|
409 | 415 |
|
|
0 commit comments