Skip to content

Parsing conversion build error after migrating to Swift 5.8 #79

Answered by chwo
chwo asked this question in Q&A
Discussion options

You must be logged in to vote

@kamcma Thank you for looking into this. Regarding the sub route behavior, I just named it SubRoute for demo purposes, it is actually more a configuration value derived from the path or query parameters.


Fortunately, I figured out the solution myself by having a closer look at the error message again:

Initializer 'init(_:with:)' requires the types '(String?, SubRoute?)' and '(String?, SubRoute)' be equivalent

  • The first sub route (SubRoute?) is optional because it is modelled as optional in the enum
  • The compiler complains about the second sub route (SubRoute) being non optional because this is inferred from the parsing block:
OneOf {
    Path { "path1" }.map { SubRoute.sub1 }
    Path { "

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@chwo
Comment options

Answer selected by chwo
@kamcma
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants