Avatar
someとanyの狭さは一緒な気がします? それにicemanさんの例だとsomeの方が狭いのにanyが解決されているので不思議だなと
2:05 PM
comparing solutions 1 and 0 Comparing declarations func f(_ v: any P) { return } and func f(_ v: some P) { return } (isDynamicOverloadComparison: 0) comparison result: better Comparing declarations func f(_ v: some P) { return } and func f(_ v: any P) { return } (isDynamicOverloadComparison: 0) comparison result: not better comparing solutions 1 and 0 better とは... この部分を判定してそうなコードはありました // A non-generic declaration is more specialized than a generic declaration. if (auto func1 = dyn_cast<AbstractFunctionDecl>(decl1)) { auto func2 = cast<AbstractFunctionDecl>(decl2); if (func1->isGeneric() != func2->isGeneric()) return completeResult(func2->isGeneric()); } https://github.com/apple/swift/blame/4517333b8ef249d2d8774a5e62b00ed1042bd1f5/lib/Sema/CSRanking.cpp#L482 (edited)
The Swift Programming Language. Contribute to apple/swift development by creating an account on GitHub.