Hey there,
I just triggered a compiler error (I think): "INTERNAL ERROR: feautre not implemented: reabstraction of pack values". Here's my minimal example to reproduce this:
func dropFirstArg<First, each Others>(_ closure: @escaping ((repeat each Others)) async throws -> Void) -> ((First, repeat each Others)) async throws -> Void {
fatalError() // trying to implement this gives more unintelligible errors
}
Is there any workaround to accomplish what I'm trying to do? In my concrete case, all I want is to drop the initial Substring output of a Regex<(Substring, repeat each ActualArgsThatICareAbout)> such that this compiles:
public struct Match<Args> {
public let regex : Regex<Args>
public let onRecognize : (Args) async throws -> Void
public init<each Arg>(_ regex: Regex<(Substring, repeat each Arg)>,
onRecognize: @escaping ((repeat each Arg)) async throws -> Void) where Args == (Substring, repeat each Arg) {
self.regex = regex
self.onRecognize = dropFirstArg(onRecognize)
}
}
Other approaches I considered: putting a regex and onRecognize requirement directly into a protocol so I can actually make onRecognize a func rather than a closure; problem with that approach is that associatedtypes can't be variadic generic, so I'd be stuck with a tuple which don't look quite so nice in funcs.