[erlang-questions] Wrong compilation warning
Robert Virding
rvirding@REDACTED
Wed Feb 6 23:53:17 CET 2008
On 06/02/2008, Kostis Sagonas <kostis@REDACTED> wrote:
>
> Maxim Treskin wrote:
> >>...
> > -record(core_state, {
> > ctx_ids = [] :: [#ctx_ids{}],
> > contexts = [] :: [#context{}]
> > }).
> >
> > I see a warning:
> > Warning: record context is unused
> >
> > Record #context is unused in code, except in definition of record
> > #core_state. May be is it compilation bug?
>
> Well, a superfluous warning, even if bogus, is clearly not a compilation
> bug. In your code the culprit is the linter (erl_lint) that has not
> been adapted to take into account type annotations in record declarations.
> This might happen soon -- possibly even in the next R12 release.
No, the warning is absolutely correct, the record context has not been used.
All the type declaration says is that a record of type context *could* be
used, but until you actually create a record of type context then it hasn't
been used. Semantic "hair-splitting" it maybe, but still ... :-)
I'm just waiting (NOT) for day we see a compiler error "missing type
declaration". :-)
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080206/55d3ab88/attachment.htm>
More information about the erlang-questions
mailing list