racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
454 stars 93 forks source link

check-syntax: no arrow for sub-range-binders when the bound occurrence is inside syntax #399

Open sorawee opened 4 years ago

sorawee commented 4 years ago

Consider:

#lang racket

(define-syntax (m stx)
  (syntax-case stx ()
    [(_ id1)
     (identifier? #'id1)
     (syntax-property
      #'1
      'disappeared-binding (list (syntax-local-introduce #'id1)))]))

(m a)

(syntax a)

Check Syntax is able to draw an arrow from a in m to a in syntax correctly.

Now, consider:

#lang racket

(define-syntax (define* stx)
  (syntax-case stx ()
    [(_ id1)
     (let ()
       (define first-part (symbol->string (syntax-e #'id1)))
       (define first-len (string-length first-part))
       (define new-id
         (datum->syntax
          #'id1
          (string->symbol (string-append first-part "*"))))
       (syntax-property
        #`(define #,new-id 1)
        'sub-range-binders
        (list
         (vector (syntax-local-introduce new-id)
                 0 first-len 0.5 0.5
                 (syntax-local-introduce #'id1)
                 0 first-len 0.5 0.5))))]))

(define* big)
(syntax big*)
big*

While Check Syntax is able to draw an arrow from big to the second big*, it is unable to draw an arrow to the first big*, which is inside syntax.