Move core::optional<T> internals around so that type definitions are in the correct place
Add tests for core::polymorphic<T, D>