Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class name and its method names diagnosed as unbound variables #105

Open
madkins23 opened this issue Jun 28, 2023 · 3 comments
Open

Class name and its method names diagnosed as unbound variables #105

madkins23 opened this issue Jun 28, 2023 · 3 comments

Comments

@madkins23
Copy link

For the following file:

#lang racket/base

(require racket/class)

(define test%
  (class object%
    (define/public (testes)
      (displayln "not funny"))))

the class name test% and method name testes (sorry, inappropriate humor) show as unused variables:

small-class

The attached log of communication between the magic-racket plugin and the racket-langserver LSP show this coming from the LSP. Search for the second textDocument/publishDiagnostics message from server to client-1.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.2 LTS
Release:	22.04
Codename:	jammy
$ raco pkg show
Installation-wide:
 Package            Checksum             Source
 main-distribution  5a53b6db4ffcbdd4...  catalog...tribution
 racket-lib         9347cf1b6f832640...  catalog racket-lib
 [202 auto-installed packages not shown]
User-specific for installation "8.9":
 Package            Checksum             Source
 racket-langserver  570b19570db40647...  catalog...erver.git
 try-catch-finally  ae71f04fe3ef793e...  catalog...h-finally
 [7 auto-installed packages not shown]

I also tried running the plugin against a local fork of the racket-langserver code and got the same thing. I may dig into the code and see what I can figure out, but not immediately.

@dannypsnl
Copy link
Contributor

dannypsnl commented Jun 28, 2023

If you open that code in DrRacket, you will find it said test% "no bound occurrences"

image

In racket-langserver, I just check that label1, so I don't think we are able to fix this here.

Footnotes

  1. https://github.com/jeapostrophe/racket-langserver/blob/master/doc-trace.rkt#L117-L118

@madkins23
Copy link
Author

You're right. I hadn't referenced the class in my test case. I added:

(define a-test (new test%))
(send a-test testes)

to the file and the error attached to the class name went away in DrRacket, but the error attached to the method did not even though I referenced it. The same thing happened with magic-racket. So it appears to be a DrRacket issue (or further misunderstanding on my part).

@madkins23
Copy link
Author

Found

Close this issue at your leisure, sorry to waste your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants