[m-rev.] for review: --warn-unused-types
Zoltan Somogyi
zoltan.somogyi at runbox.com
Sun Feb 15 12:36:56 AEDT 2026
On Sun, 15 Feb 2026 01:18:19 +1100, Julien Fischer <jfischer at opturion.com> w
> > --- a/library/rtti_implementation.m
> > +++ b/library/rtti_implementation.m
> > @@ -4170,12 +4170,6 @@ get_remote_secondary_tag(_) = 0 :-
> > ; stag_remote
> > ; stag_variable.
> >
> > -:- type du_sectag_alternatives ---> du_sectag_alternatives(c_pointer).
> > -:- pragma foreign_type("C#", du_sectag_alternatives,
> > - "runtime.DuFunctorDesc[]").
> > -:- pragma foreign_type("Java", du_sectag_alternatives,
> > - "jmercury.runtime.DuFunctorDesc[]").
> > -
>
> That may simply be a result of library/rtti_implementation being incomplete.
Ok, so I commented them out instead of deleting them.
> > --- a/tests/invalid_nodepend/bigtest.err_exp
> > +++ b/tests/invalid_nodepend/bigtest.err_exp
> > @@ -21,5 +21,6 @@ bigtest.m:010: Syntax error at token ':-': operator precedence error.
> > bigtest.m:013: Error: [38;5;87m`incorrect_declaration' [39;49m is [38;5;203mnot a valid declaration type. [39;49m
> > bigtest.m:015: Error: predicate [38;5;87m`p'/1 [39;49m [38;5;203mhas no mode declaration. [39;49m
> > bigtest.m:015: (Use `--infer-modes' to enable mode inference.)
> > +bigtest.m:025: Warning: type constructor `t2'/0 is [38;5;203munused. [39;49m
>
> Given that this test lacks module, interface and implementation declarations,
> I'm not sure you can say that t2/0 is a local type or not.
That module tests mostly a grab-bag of proposed-then-quickly-forgotten
additions to the Mercury language, such as undiscriminated union types.
I don't think it is useful anymore (if it *ever* was useful), but it doesn't
hurt much either.
> > + --no-warn-unused-types
> > + Warn about types that are neither used in their defining module nor
> > + exported to other modules.
>
> I don't think this should be enabled by default. Most of the other warnings
> for unused things are off by default. I can see this being slightly annoying
> if I am trying to sketch out a module's types before writing the code that
> uses them.
Agreed, though I think that after bootstrapping, we *should* add it
to STANDARD_MCFLAGS.
> The diff looks fine otherwise.
Thanks. I followed all your other suggestions. The updated diff is
attached.
Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.ut_1
Type: application/octet-stream
Size: 40742 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20260215/352aa631/attachment-0001.obj>
More information about the reviews
mailing list