Ticket #926 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

Some users have difficulty understanding the error that occurs when declarations are encountered in contexts where they aren't allowed

Reported by: fare Owned by: gb
Priority: normal Milestone:
Component: Compiler Version: trunk
Keywords: Cc:

Description (last modified by gb) (diff)

Dan Weinreb 2009-01-05 13:49:46 EST

(defun foo (a)
  (declare (fixnum a))
  (+ a a))

works fine.

(defmacro bad () '(declare (fixnum a)))
(defun foo (a) (bad) (+ a a))

gets a compile-time error, because macros are not allowed to expand into declarations.

However, the text of the error message is:

DECLARE not expected in (DECLARE (FIXNUM A)).

That's pretty unclear.

[NB: was ITA bug 52936]

Change History

comment:1 Changed 3 years ago by fare

  • Type changed from defect to enhancement
  • Component changed from IDE to Compiler

comment:2 Changed 2 years ago by gb

  • Owner set to gb
  • Status changed from new to assigned
  • Description modified (diff)

comment:3 Changed 2 years ago by gb

  • Summary changed from Bad error message for macro expanding into a declaration to Some users have difficulty understanding the error that occurs when declarations are encountered in contexts where they aren't allowed

comment:4 Changed 2 years ago by gb

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [15314]) Warn (via full warning) on duplicate bindings in SYMBOL-MACROLET, MACROLET, FLET, LABELS (fixes ticket:927.)

If a DECLARE expression is encountered when a form is expected, make the error message more verbose (and mention macroexpansion as a possible cause of the problem.) Fixes ticket:926.

Warn (via a full warning) if a local function shadows a global CL function name. Fixes ticket:923.

If STYLE-WARNINGs are incidentally signaled during (e.g.) macroexpansion and are handled and postprocessed by the compiler, ensure that the warning actually generated will be a STYLE-WARNING.

Note: See TracTickets for help on using tickets.