Stream: t-compiler

Topic: const generics; testing the syntax


centril (Apr 17 2019 at 17:29, on Zulip):

@yodal you could try some tests for the syntax alone using macro_rules!

centril (Apr 17 2019 at 17:30, on Zulip):

i.e. make sure that it works syntactically but don't check semantics

varkor (Apr 17 2019 at 17:30, on Zulip):

@yodal: do you remember how many of the tests you got passing on the main PR?
was it all but one?

yodal (Apr 17 2019 at 17:31, on Zulip):

yes, all but one

centril (Apr 17 2019 at 17:31, on Zulip):

e.g. macro_rules! accept_item { ($i:item) => {} } and then use accept_item! { struct A<const N: usize>(); }

centril (Apr 17 2019 at 17:31, on Zulip):

also when writing tests, be sure to have some "combinatorial" aspects of them

yodal (Apr 17 2019 at 17:32, on Zulip):

it has been a while since I last touched const generics so I don't remember what exactly was halting that one test, but I think it was something about normalization

yodal (Apr 17 2019 at 17:34, on Zulip):

The macro_rules! idea is definitely a good one. Being able to test the syntax alone has been difficult

centril (Apr 17 2019 at 17:36, on Zulip):

It's something that is often forgotten: our syntax has stability independently of semantics (e.g. if semantic analysis produces an error, the syntax can still be valid and a matter of semver) due to macros.

Vadim Petrochenkov (Apr 17 2019 at 19:51, on Zulip):

#[cfg(FALSE)] is also a great way to test syntax alone.

centril (Apr 17 2019 at 20:48, on Zulip):

@Vadim Petrochenkov oh; clever!

Last update: Nov 22 2019 at 05:00UTC