Skip to content

Conversation

maxhq
Copy link
Contributor

@maxhq maxhq commented Sep 17, 2021

It's currently not possible to reference non-Moose classes in union types if Moose has not yet registered the type constraints.
I.e. this works:

has 'bar' => (is => 'rw', isa => 'TestAlgoAA');
has 'baz' => (is => 'rw', isa => 'TestAlgoBB');

but this doesn't:

has 'bar' => (is => 'rw', isa => 'TestAlgoAA | TestAlgoBB');
# Could not locate type constraint (TestAlgoAA) for the union

The cause is the current logic of type parsing / lookup Moose::Util::TypeConstraints.
I fixed it by slightly shifting functionality and extending some methods.

Tests are passing. I will try and run test-my-dependents.t on a decent machine soon and post the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant