Open jbclements opened 6 years ago
Maybe add a check for identifiers that end with colons (in error cases)?
On Mon, Oct 1, 2018 at 3:56 PM John Clements notifications@github.com wrote:
What version of Racket are you using?
Welcome to DrRacket, version 7.0.0.20--2018-09-12(-/f) [3m]. What program did you run?
This student program:
lang typed/racket
(define (subst [ft: BTree] [sy : Symbol] [rt : BTree]) (match ft [(Node l r) (Node (subst l sy rt) (subst r sy rt))] [(Leaf sy) rt] [(Leaf s) (Leaf s)]))
What should have happened?
An error message highlighting some larger area, and text that makes a bit more sense. If you got an error message, please include it here.
The highlighted region is the [sy : Symbol], and the error message is as follows:
define: expected more terms starting with expression parsing context: while parsing optional lambda argument while parsing lambda-formals while parsing curried-formals in: (sy : Symbol)
(yes, I see what the actual error is... but honestly, I think the only plausible way to diagnose this error is to stare at the program until you see the problem.)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/racket/typed-racket/issues/779, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYWsGUOMeunF0kTaybMwZKexhC61r4lks5ugoFogaJpZM4XC32D .
Yes, that's what I'm thinking.
The error message for one argument with a mistake depends on whether or not that argument is followed by other arguments to the function. It would be nice if the argument with a mistake were successfully identified.
The error message with one argument is ok:
#lang typed/racket
(define (example [x: Integer]) : Integer
(+ x 5))
(example 8)
In Racket 7.3 highlights the term Integer
and reports:
type-check: type name used out of context
type: Integer
in: Integer in: Integer
However, with two arguments, the situation is worse.
(define (example [x: Integer]
[y : Integer]) : Integer
(+ x 5))
Gives a more opaque message:
define: expected more terms starting with expression
parsing context:
while parsing optional lambda argument
while parsing lambda-formals
while parsing curried-formals in: (y : Integer)
Recommend renaming issue:
TR error message when variable name ends with a colon does not identify problem area
What version of Racket are you using?
Welcome to DrRacket, version 7.0.0.20--2018-09-12(-/f) [3m].
What program did you run?
This student program:
What should have happened?
An error message highlighting some larger area, and text that makes a bit more sense.
If you got an error message, please include it here.
The highlighted region is the [sy : Symbol], and the error message is as follows:
define: expected more terms starting with expression parsing context: while parsing optional lambda argument while parsing lambda-formals while parsing curried-formals in: (sy : Symbol)
(yes, I see what the actual error is... but honestly, I think the only plausible way to diagnose this error is to stare at the program until you see the problem.)