pointfreeco / swift-parsing

A library for turning nebulous data into well-structured data, with a focus on composition, performance, generality, and ergonomics.
https://www.pointfree.co/collections/parsing
MIT License
864 stars 77 forks source link

Example in Getting started don't work - ambiguous use of 'buildExpression' #349

Open oschrenk opened 2 months ago

oschrenk commented 2 months ago

Totally a possibility that I am missing something as I am a beginner Swift programmer, but the example on https://pointfreeco.github.io/swift-parsing/main/documentation/parsing/gettingstarted/

won't compile

  let parser = Parse {
    Int.parser()
    ","
    Bool.parser()
  }

will result in:

Building for debugging...
~/Project/Parser.swift:6:5: error: ambiguous use of 'buildExpression'
    Int.parser()
    ^
/Users/oliver/Projects/personal/swift/plan.swift/.build/checkouts/swift-parsing/Sources/Parsing/Builders/ParserBuilder.swift:533:22: note: found this candidate
  public static func buildExpression<P: Parser>(_ expression: P)
                     ^
/Users/oliver/Projects/personal/swift/plan.swift/.build/checkouts/swift-parsing/Sources/Parsing/Builders/ParserBuilder.swift:544:22: note: found this candidate
  public static func buildExpression<P: Parser>(_ expression: P) -> P
                     ^
error: emit-module command failed with exit code 1 (use -v to see invocation)
~/Project/Parser.swift:6:5: error: ambiguous use of 'buildExpression'
    Int.parser()
    ^
/Users/oliver/Projects/personal/swift/plan.swift/.build/checkouts/swift-parsing/Sources/Parsing/Builders/ParserBuilder.swift:533:22: note: found this candidate
  public static func buildExpression<P: Parser>(_ expression: P)
                     ^
/Users/oliver/Projects/personal/swift/plan.swift/.build/checkouts/swift-parsing/Sources/Parsing/Builders/ParserBuilder.swift:544:22: note: found this candidate
  public static func buildExpression<P: Parser>(_ expression: P) -> P
                     ^
~/Project/Parser.swift:6:5: error: ambiguous use of 'buildExpression'
    Int.parser()
    ^
/Users/oliver/Projects/personal/swift/plan.swift/.build/checkouts/swift-parsing/Sources/Parsing/Builders/ParserBuilder.swift:533:22: note: found this candidate
  public static func buildExpression<P: Parser>(_ expression: P)
                     ^
/Users/oliver/Projects/personal/swift/plan.swift/.build/checkouts/swift-parsing/Sources/Parsing/Builders/ParserBuilder.swift:544:22: note: found this candidate
  public static func buildExpression<P: Parser>(_ expression: P) -> P

I guess this is possibly connected to https://github.com/pointfreeco/swift-parsing/issues/309 ?

oschrenk commented 2 months ago

Ah. It seems that https://github.com/pointfreeco/swift-parsing/discussions/290 and changes in Swift 5.8 had big impacts and the examples were not updated.