Skip to content

Commit 459669f

Browse files
committed
Improve interaction between submodules and require arrows.
Specifically, track whether each submodule has #f as the lang name not as check syntax recurs and compare the module context at binders with that at references and to avoid adding arrows from binders that are in more-nested modules than the references. Also, some minor cleanups of the code along the way.
1 parent 440c029 commit 459669f

File tree

2 files changed

+270
-125
lines changed

2 files changed

+270
-125
lines changed

drracket-tool-test/tests/check-syntax/syncheck-direct.rkt

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,85 @@
375375
'((27 37) (49 55))
376376
'((27 37) (57 63))))
377377

378+
(check-equal? (get-binding-arrows
379+
(string-append
380+
"#lang racket/base\n"
381+
"(define x 1)\n"
382+
"(module+ m x)\n"))
383+
(set '((6 17) (19 25))
384+
'((6 17) (28 28))
385+
'((6 17) (32 39))
386+
'((26 27) (42 43))))
387+
388+
(check-equal? (get-binding-arrows
389+
(string-append
390+
"#lang racket/base\n"
391+
"(define x 1)\n"
392+
"x\n"
393+
"(module+ m\n"
394+
" x\n"
395+
" (define x 1))\n"))
396+
(set
397+
'((6 17) (19 25))
398+
'((6 17) (28 28))
399+
'((6 17) (34 41))
400+
'((6 17) (60 60))
401+
'((6 17) (51 57))
402+
'((26 27) (31 32))
403+
'((58 59) (46 47))))
404+
405+
(check-equal? (get-binding-arrows
406+
(string-append
407+
"#lang racket/base\n"
408+
"(require racket/list)\n"
409+
"first\n"
410+
"(module n racket\n"
411+
" first\n"
412+
" (module+ m\n"
413+
" (require (rename-in racket/list [first ABC]))))\n"
414+
"(module o racket\n"
415+
" first)\n"))
416+
(set
417+
'((6 17) (47 53))
418+
'((6 17) (19 26))
419+
'((6 17) (137 143))
420+
'((27 38) (40 45))
421+
'((56 62) (65 70))
422+
'((56 62) (74 81))
423+
'((56 62) (89 96))
424+
'((56 62) (98 107))
425+
'((146 152) (155 160))))
426+
427+
428+
(check-equal?
429+
(get-binding-arrows (string-append
430+
"#lang racket/base\n"
431+
"(require racket/list)\n"
432+
"first\n"
433+
"(module+ m\n"
434+
" (require racket/list)\n"
435+
" first)\n"))
436+
(set
437+
'((6 17) (19 26))
438+
'((6 17) (47 54))
439+
'((6 17) (60 67))
440+
'((27 38) (83 88))
441+
'((27 38) (40 45))
442+
'((68 79) (83 88))))
443+
444+
(check-equal?
445+
(get-binding-arrows (string-append
446+
"#lang racket/base\n"
447+
"(module n racket/base\n"
448+
" (unless #f 42))\n"))
449+
(set
450+
'((6 17) (19 25))
451+
'((28 39) (53 53))
452+
'((28 39) (43 49))
453+
'((28 39) (50 50))))
454+
455+
456+
378457
;
379458
;
380459
;
@@ -550,6 +629,18 @@
550629
(set '(37 62)
551630
'(37 64)))
552631

632+
(check-equal?
633+
(get-require-arrows
634+
(string-append
635+
"#lang racket/base\n"
636+
"(require racket/list)\n"
637+
"first\n"
638+
"(module+ m\n"
639+
" (require racket/list)\n"
640+
" first)\n"))
641+
(set '(27 83) '(68 83) '(27 40)))
642+
643+
553644

554645
;
555646
;

0 commit comments

Comments
 (0)