T M
class X::Composition::NotComposable
Error ReportCollection examples

Compilation error due to composing an ineligible type

class X::Composition::NotComposable is Exception { }

Thrown when trying to compose a type into a target type, but the composer type cannot be used for composition (roles and enums are generally OK).

For example

class A { }
class B does A { }

dies with

===SORRY!===
A is not composableso B cannot compose it

because does is reserved for role composition, and A is not a role, nor something that knows how to turn into a role.

The fix is to either make A a role, or use inheritance (class B is A { }) instead.

Methods

method target-name

method target-name(--> Str:D)

Returns the name of the type that should be composed, but failed.

method composer

method composer(--> Mu)

Returns the type that should be composed into the target, but which isn't a role.