Implement "extending" in @AutoFactory.

And add tests for invalid values.