Skip to content

Instantly share code, notes, and snippets.

@eneko
Created October 26, 2022 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eneko/e117bff6dd5bcbecac4476883595188d to your computer and use it in GitHub Desktop.
Save eneko/e117bff6dd5bcbecac4476883595188d to your computer and use it in GitHub Desktop.
Swift 5.7 compiler hang
public indirect enum Expression {
case term(Bool)
case list(_ expressions: [Expression])
public func contains(where predicate: (Bool) -> Bool) -> Bool {
switch self {
case let .term(term):
return predicate(term)
case let .list(expressions):
return expressions.contains { expression in
expression.contains { term in
predicate(term)
}
}
}
}
}
public struct IndirectEnum {
public init() {
let containsFalse = Expression.list([.list([.term(true), .term(false)]), .term(true)]).contains { term in
term == false
}
print(containsFalse)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment