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

Different error message vanilla vs CS (again) #3325

Closed
sorawee opened this issue Jul 31, 2020 · 13 comments
Closed

Different error message vanilla vs CS (again) #3325

sorawee opened this issue Jul 31, 2020 · 13 comments
Labels
bug Something isn't working correctly racket-cs Specific to Racket-on-Chez

Comments

@sorawee
Copy link
Collaborator

sorawee commented Jul 31, 2020

What version of Racket are you using?
7.8.0.6--2020-07-31 [cs]

What program did you run?

#lang racket

(define x y)
(define y 1)

What should have happened?

y: undefined;
 cannot reference an identifier before its definition

in DrRacket, and

y: undefined;
 cannot reference an identifier before its definition
  in module: "/path/to/test.rkt"

in Racket.

If you got an error message, please include it here.

../../../racket/racket/share/pkgs/drracket/drracket/private/stack-checkpoint.rkt:115:30: define-values: skipped variable definition;
 cannot continue without defining variable
  variable: x
  in module: "/path/to/test.rkt"

in DrRacket when "Enforce constant definitions (enables some inlining)" is off.

../../../racket/racket/share/pkgs/drracket/drracket/private/stack-checkpoint.rkt:115:30: y: undefined;
 cannot reference an identifier before its definition

in DrRacket when "Enforce constant definitions (enables some inlining)" is on.

y: undefined;
 cannot reference an identifier before its definition
  module: "/path/to/test.rkt"

in Racket.

Please include any other relevant details

  1. Notice that git/racket/racket/share/pkgs/drracket/drracket/private/stack-checkpoint.rkt:115:30 doesn't exist in DrRacket BC.
  2. In DrRacket BC, whether "Enforce constant definitions (enables some inlining)" is on or off, the error is the same. In DrRacket CS, when "Enforce constant definitions (enables some inlining)" is off, the error is different, blaming the definition of x instead.
  3. In Racket CS, the error message uses "module: ..." whereas in Racket BC, the error message uses "in module:"
@sorawee sorawee added bug Something isn't working correctly racket-cs Specific to Racket-on-Chez labels Jul 31, 2020
mflatt added a commit that referenced this issue Aug 1, 2020
@sorawee
Copy link
Collaborator Author

sorawee commented Aug 1, 2020

Oh, interesting. For "../../racket/racket/share/pkgs/drracket/drracket/private/stack-checkpoint.rkt:115:30" to appear, "No debugging or profiling" must also be chosen.

@sorawee
Copy link
Collaborator Author

sorawee commented Aug 2, 2020

Another problem:

In Racket BC:

> (values (values 1 2))
; result arity mismatch;
;  expected number of values not received
;   expected: 1
;   received: 2

In Racket CS

> (values (values 1 2))
; returned two values to single value return context (no newline)

@sorawee
Copy link
Collaborator Author

sorawee commented Aug 2, 2020

Similarly:

In Racket BC:

> (define-values (x y) 1)
; define-values: result arity mismatch;
;  expected number of values not received
;   expected: 2
;   received: 1
;   in: definition of x ...

In Racket CS:

> (define-values (x y) 1)
; define-values: incorrect number of values from rhs 1 (no newline)

@sorawee
Copy link
Collaborator Author

sorawee commented Aug 2, 2020

Another problem (sorry for spamming...):

Racket BC:

> (let-values ([(a b) (values 1 2 3)]) 1)
; result arity mismatch;
;  expected number of values not received
;   expected: 2
;   received: 3
;   in: local-binding form

Racket CS:

> (let-values ([(a b) (values 1 2 3)]) 1)
; result arity mismatch;
;  expected number of values not received
;   expected: 2
;   received: 3
;   at: local-binding form

Notice in vs at.

@gus-massa
Copy link
Contributor

The last one looks easy to solve.

"\n at: local-binding form"

Perhaps you want to write the PR? (Assumin @mflatt doesn't disagree.)

@capfredf
Copy link
Sponsor Member

capfredf commented Aug 4, 2020

Similarly:

In Racket BC:

> (define-values (x y) 1)
; define-values: result arity mismatch;
;  expected number of values not received
;   expected: 2
;   received: 1
;   in: definition of x ...

In Racket CS:

> (define-values (x y) 1)
; define-values: incorrect number of values from rhs 1 (no newline)

This difference doesn't appear if we put the definition in a program and run it.

I am guessing this is because at REPL, raise-definition-result-arity-error was not called. I have a plan to fix this issue but I have some trouble figuring out where raise-definition-result-arity-error should be used. ref

@mflatt, can you give me some pointers on this issue?

@sorawee
Copy link
Collaborator Author

sorawee commented Oct 4, 2020

Hmm. It's not only that the error message is wrong. Programs that should error might not error at all!

#lang racket

y
(define y 1)

produces a value 'undefined5 when "Enforce constant definitions (enables some inlining)" is off.

We can even use this value in computations:

#lang racket

(eq? y y)
(define y 1)

produces #t.

@sorawee
Copy link
Collaborator Author

sorawee commented Dec 7, 2020

Just got hit by this again.

@mflatt I saw you changed several tests to accept error messages like "returned two values to single value return context" in addition to the one raised by raise-result-arity-error. Do I understand correctly that the difference is considered acceptable, and the bug is a WONTFIX?

@mflatt
Copy link
Member

mflatt commented Dec 7, 2020

No, I just haven't gotten back to this.

mflatt added a commit that referenced this issue Dec 14, 2020
@sorawee
Copy link
Collaborator Author

sorawee commented Dec 30, 2020

Here's another problem (which might be related to the above reported problem).

Consider an example in the doc of prop:exn:srclocs.

In DrRacket BC, DrRacket can highlight voldemort regardless of the setting of errortrace. The error message is:

oh dear don't say his name

In DrRacket CS, DrRacket can highlight voldemort only when errortrace is enabled, with the same error message mentioned above. However, when errortrace is disabled, voldemort is not highlighted, and the error message is:

 unsaved editor:42:17: oh dear don't say his name

@sorawee
Copy link
Collaborator Author

sorawee commented Jan 23, 2021

The remaining issues are also reported elsewhere (see above references), so let me close this.

@sorawee sorawee closed this as completed Jan 23, 2021
@sorawee
Copy link
Collaborator Author

sorawee commented Jan 26, 2021

Let me also reopen this issue. There is one remaining issue left, which I will restate here:

#lang racket

(/ 1 0)

results in:

/: division by zero

in DrRacketBC, but results in:

projects/racket/extra-pkgs/drracket/drracket/drracket/private/stack-checkpoint.rkt:115:30: /: division by zero

in DrRacketCS.

Note that errortrace must be set to off.

I previously thought this bug would be fixed by the fix of racket/drracket#455, but they seem to be unrelated after all.

@sorawee sorawee reopened this Jan 26, 2021
@sorawee
Copy link
Collaborator Author

sorawee commented Feb 3, 2021

The remaining issues are a combination of several bugs in DrRacket.

  • The voldemort problem is specific to only unsaved editor and background expansion, and it's fixed by racket/drracket@7c30a88 and racket/gui@04e8164. (Racket BC on my machine appears to run without places, so the background expansion kicks in very late, causing the bug to occur more rarely).
  • The (/ 1 0) problem is due to incorrect stack cutting, which is fixed in stack-checkpoint: evaluate ccm at the correct context drracket#459. (The problem occurs in Racket BC too, but it's "hidden" because continuation-mark-set->context tends to give more information in Racket BC, which happens to hide the problem).

These are all fixed, so I will close the issue.

@sorawee sorawee closed this as completed Feb 3, 2021
maueroats pushed a commit to maueroats/racket that referenced this issue Jun 17, 2021
maueroats pushed a commit to maueroats/racket that referenced this issue Jun 17, 2021
maueroats pushed a commit to maueroats/racket that referenced this issue Jun 17, 2021
maueroats pushed a commit to maueroats/racket that referenced this issue Jun 17, 2021
maueroats pushed a commit to maueroats/racket that referenced this issue Jun 17, 2021
maueroats pushed a commit to maueroats/racket that referenced this issue Jun 17, 2021
mflatt added a commit to mflatt/ChezScheme that referenced this issue Oct 10, 2023
mflatt added a commit to mflatt/ChezScheme that referenced this issue Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly racket-cs Specific to Racket-on-Chez
Projects
None yet
Development

No branches or pull requests

4 participants