Bogdanp / Bogdanp/racket-review
False positive shadowing when reviewing Typed Racket code?
- Dominant language
- Racket
- Stars
- 48
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
Take a look at this Typed Racket code:
````
#lang typed/racket/base
(provide do-it)
(: do-it (-> (Listof Number)
(List (Listof Integer)
(Listof Integer))))
(define (do-it nums)
(define evens (filter (lambda ([n : Any]) (and (integer? n) (exact? n) (even? n)))
nums))
(define odds (filter (lambda ([n : Any]) (and (integer? n) (exact? n) (odd? n)))
nums))
(list evens odds))
````
Putting aside that this code doesn't quite pass the type checker, what's puzzling is that when this code is passed through `review`, it generates a warning:
````
mini.rkt:11:34:warning:identifier 'n' shadows an earlier binding
````
This seems wrong to me. Sure, there are two `lambda`s there with the same formal parameter, but the second one surely doesn't shadow the first. It's not even in the same scope.
When you turn this into a plain Racket module, `review` doesn't complain.
It seems to me that TR is either rewriting the code before `review` sees it, or perhaps there's an issue somewhere in `review`? Do you have some advice for getting rid of this warning?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.