[m-rev.] for post-commit review: fix some uint incomplete switches
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed Mar 8 13:08:31 AEDT 2017
On Tue, 7 Mar 2017 22:28:31 +1100 (AEDT), Julien Fischer <jfischer at opturion.com> wrote:
> > I think that one possible solution is to have humans rewrite such code
> > as
> >
> > require_complete_switch [X]
> > ( X = (<), Result = yes
> > ; X = (=), Result = yes
> > ; X = (>), Result = no
> > ),
> > Result = yes
> >
> > and then have the simplify pass transform this back to the first version above.
> > Since the simplify pass is invoked *after* determinism analysis, which is the
> > pass that diagnoses switches that should be complete but aren't, this would get
> > the compiler to tell the programmer that the switch should be revisited when
> > the type of X has a new functor added to it (such as uint), while avoiding the
> > runtime impact of the assignment to, and test of, the extra variable.
> >
> > What do people think?
>
> I think that would be worthwhile.
The attached diff does this. For post-commit review by anyone.
Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.res
Type: application/octet-stream
Size: 989 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20170308/516ea9bb/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.res
Type: application/octet-stream
Size: 23375 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20170308/516ea9bb/attachment-0003.obj>
More information about the reviews
mailing list