swift-parsing icon indicating copy to clipboard operation
swift-parsing copied to clipboard

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

Open oschrenk opened this issue 1 year ago • 1 comments

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 avatar Aug 17 '24 13:08 oschrenk

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.

oschrenk avatar Aug 17 '24 13:08 oschrenk