protocol ASTNode : CustomStringConvertible { func accept<V: ASTThrowsVisitor>(visitor: V) throws -> V.VisitResult } extension ASTNode { func accept<V: ASTVisitor>(visitor: V) -> V.VisitResult { return try! accept(visitor: visitor) } }
これでさ、protocol ASTVisitor: ASTThrowsVisitor { associatedtype VisitResult func visit(nop: NopNode) -> VisitResult ... } extension ASTVisitor { func visit(nop: NopNode) throws -> VisitResult { return visit(nop: nop) } }
こうしたらいけないかねprotocol ASTThrowsVisitor { associatedtype VisitResult func visit(nop: NopNode) throws -> VisitResult .... }
これ忘れてた