Hello,
I have a scala 3 application with tapir and I’m unsuccessfully trying to use oneOfVariantValueMatcher to define a variant.
My error ADTs:
enum ApplicationError:
case NotFound
enum EndpointError:
case Authentication
case Authorization
case Application(error: ApplicationError)
I have this code:
oneOfVariantValueMatcher[EndpointError](StatusCode.NotFound, emptyOutputAs(EndpointError.Application(ApplicationError.NotFound))) {
case EndpointError.Application(ApplicationError.NotFound) => true
})
The compilation error I get:
pattern selector should be an instance of Matchable, but it has unmatchable type Any instead
In the documentation for Matchable Trait, there is the following statement:
Type Any: if pattern matching is required one should use Matchable instead.
Am I missing something or should the matcher type be PartialFunction[Matchable, Boolean]
in scala 3?
Thank you for your help.