Skip to content

Commit

Permalink
fix: error build on Swift 5.10 (#123)
Browse files Browse the repository at this point in the history
- break a long expression into smaller expressions
- fix the error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
  • Loading branch information
jwthanh authored Mar 7, 2024
1 parent 9aa89b6 commit 5a17299
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/BazelPodsCore/Core/MultiPlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ struct MultiPlatform<T: AttrSetConstraint>: Monoid, StarlarkConvertible, EmptyAw
func toStarlark() -> StarlarkNode {
precondition(ios != nil || osx != nil || watchos != nil || tvos != nil, "MultiPlatform empty can't be rendered")

// TODO: Change to T.empty and move ios up when we support other platforms
let iosSupport = [SelectCase.fallback.rawValue: ios ?? T.empty]

return .functionCall(name: "select", arguments: [.basic((
osx.map { [":\(SelectCase.osx.rawValue)": $0] } <+>
watchos.map { [":\(SelectCase.watchos.rawValue)": $0] } <+>
tvos.map { [":\(SelectCase.tvos.rawValue)": $0] } <+>
// TODO: Change to T.empty and move ios up when we support other platforms
[SelectCase.fallback.rawValue: ios ?? T.empty ] ?? [:]
iosSupport ?? [:]
).toStarlark())])
}
}
Expand Down

0 comments on commit 5a17299

Please sign in to comment.