cast doesn't work for recursive types

Description

I have a simple recursive type for Json and JsonMaps:

These seem to work fine for type checking and as predicates, but raise when I use them to cast a value:

Environment

None

Assignee

Ambrose Bonnaire-Sergeant

Reporter

import

Labels

None

Approval

None

Patch

None

Components

Fix versions

Affects versions

Priority

Major
Configure