Created
October 26, 2022 15:13
-
-
Save eneko/e117bff6dd5bcbecac4476883595188d to your computer and use it in GitHub Desktop.
Swift 5.7 compiler hang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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