Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions typed-racket-lib/typed-racket/types/resolve.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
(free-identifier=? n (poly-name (current-poly-struct))))
(define poly-num (length (poly-vars (current-poly-struct))))
(if (= poly-num (length rands))
(when (not (or (ormap Error? rands)
(andmap equal? rands
(poly-vars (current-poly-struct)))))
(unless (or (ormap Error? rands) (andmap equal? rands (poly-vars (current-poly-struct))))
(tc-error (~a "structure type constructor applied to non-regular arguments"
"\n type: " rator
"\n arguments...: " rands)))
"\n type: "
rator
"\n arguments...: "
rands)))
Comment on lines 65 to +69
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sorawee A nice fmt improvement would be to keep description-value pairs adjacent in ~a and similar formatting expressions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly are considered "description-value pairs"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some examples:

  • The field v ... ... argument of raise-arguments-error.
  • Alternating pairs of strings and expressions in the arguments to ~a, ~v, ~s, etc.

That is, cases that construct the <field>: <detail> parts of an error message as described in Error Message Conventions. Not sure how easy it is to detect all of these though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's a good idea for the raise-arguments-error family and the hash family. I don't yet buy that the heuristic described for ~a will work well.

(tc-error (~a "wrong number of arguments to structure type constructor"
"\n type: " rator
"\n expected: " poly-num
Expand Down