racket / drracket

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

Background expansion masks `.zo` version error #630

Closed shhyou closed 11 months ago

shhyou commented 11 months ago

Version

Racket v8.10.0.2

Description

The .zo version mismatch error is hidden in background expansion. The end result is that check syntax does not add any entry to the context menu of the respective require.

Steps to reproduce

  1. Enable “populate "compiled" directories” in Language > Choose Language.
  2. Create usr.rkt and lib.rkt such that usr.rkt imports lib.rkt:
    ;; lib.rkt
    (module lib racket/base (define lib-N 456) (provide lib-N))
    ;; usr.rkt
    (module usr racket/base (require "lib.rkt") lib-N)
  3. Compile (raco make) lib.rkt using Racket v8.9.
  4. Open usr.rkt in DrRacket v8.10.
  5. Right click on "lib.rkt"

Actual behavior

Background expansion succeeded, with binding arrows and documentation annotations. However, the “open lib.rkt” entry of require in step 5 is missing.

Expected behavior

Either there should be a .zo version mismatch error from background expansion or the entry “open lib.rkt” should exist.

Furthermore, clicking the Check Syntax button restores the desired menu item.

rfindler commented 11 months ago

Thanks!

It looks like the problem is that use-compiled-file-paths is not set to the right value during the call to get-require-filename, so we end up in the exception handler (as you write) because we looked in compiled/ instead of compiled/drracket/errortrace/ (assuming the default language settings overall).

The trouble is that it isn't clear how to communicate this value (or avoid the need to communicate it which seems like it would be better as we'd be able to avoid the calls that interact with the filesystem!).

rfindler commented 11 months ago

Oh! Looks like I've been here before and my solution was this blob of code. I'll update it to also propagate use-compiled-file-paths.