Skip to content

Derive ConcreteTag unions/intersections from given component tags#1397

Merged
johnhungerford merged 3 commits intogetkyo:mainfrom
johnhungerford:derive-concretetag
Jul 25, 2025
Merged

Derive ConcreteTag unions/intersections from given component tags#1397
johnhungerford merged 3 commits intogetkyo:mainfrom
johnhungerford:derive-concretetag

Conversation

@johnhungerford
Copy link
Collaborator

Prerequisite for #1393. See discussion.

Problem

The derivation macro for ConcreteTag currently does not search for given ConcreteTag instances for components A and B in composite types like A | B or A & B. This forces users to require implicit evidence for the full composite type in cases where only one of the types is generic (e.g., def someMethod[E](A < Abort[E | Closed])(using ConcreteTag[E | Closed]) ...). This creates a more severe problem when one of the types in the intersection isn't known in the type signature, like when one of the types is a dependent type.

Solution

Add an implicit search in the createSingle method of the ConcreteTag derivation macro to look for a given instance prior to trying to construct it from the TypeRepr.

Notes

Also updated some names which hadn't been updated from the previous name SafeClassTag.

@johnhungerford johnhungerford merged commit e107333 into getkyo:main Jul 25, 2025
5 checks passed
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.

2 participants