I’m currently refactoring some code (Swift 3.?, latest XCode), and I ended up 
with the following:

        func spansTSON() -> TSON {
                var docs = self.spans.map() { $0.tson }
                for (span, doc) in zip(self.spans, docs) {
                        if let datum = span.begin.datum {
                                if let index = self.spans.index(where: {return 
$0.includesAnchor(datum)}) {
                                        doc["datum"] = (index * 2 + 
(datum.isBegin ? 0 : 1)).tson
                                }
                        }
                }
                return TSON.array(docs)
        }

The vague error I get is “Ambiguous reference to spans” on the “if let index = 
self.spans…” line with the “self” highlighted. The container is a class. 
“spans” is computed property. I’m not sure if it’s confused about what self is, 
or spans. Or why either wouldn’t be clear.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to