Swift: sources in extension protocols.

This commit is contained in:
Geoffrey White
2023-01-18 17:58:18 +00:00
parent 14468b64fb
commit b033114f64
3 changed files with 18 additions and 4 deletions

View File

@@ -434,6 +434,11 @@ private Element interpretElement0(
subtypes = true and
decl.getNominalTypeDecl() = nomTypeDecl.getADerivedTypeDecl*()
or
exists(ExtensionDecl e | e.getExtendedTypeDecl() = decl.getNominalTypeDecl() |
subtypes = true and
e.getAProtocol() = nomTypeDecl.getADerivedTypeDecl*()
)
or
subtypes = false and
decl.getNominalTypeDecl() = nomTypeDecl
)
@@ -449,6 +454,11 @@ private Element interpretElement0(
subtypes = true and
decl.getNominalTypeDecl() = nomTypeDecl.getADerivedTypeDecl*()
or
exists(ExtensionDecl e | e.getExtendedTypeDecl() = decl.getNominalTypeDecl() |
subtypes = true and
e.getAProtocol() = nomTypeDecl.getADerivedTypeDecl*()
)
or
subtypes = false and
decl.getNominalTypeDecl() = nomTypeDecl
)

View File

@@ -63,6 +63,10 @@
| generics.swift:93:9:93:15 | .source2 | external |
| generics.swift:112:9:112:15 | .source1 | external |
| generics.swift:113:9:113:15 | .source2 | external |
| generics.swift:114:9:114:14 | .source1 | external |
| generics.swift:115:9:115:14 | .source2 | external |
| generics.swift:116:9:116:15 | .source1 | external |
| generics.swift:117:9:117:15 | .source2 | external |
| nsdata.swift:18:17:18:40 | call to NSData.init(contentsOf:) | external |
| nsdata.swift:19:17:19:53 | call to NSData.init(contentsOf:options:) | external |
| string.swift:56:21:56:44 | call to String.init(contentsOf:) | external |

View File

@@ -111,8 +111,8 @@ extension MyImpl2 : MyProtocol2 {
func useProtocol2(proto: MyProtocol2, impl: MyImpl2<Int>, impl2: MyImpl2<Any>) {
_ = proto.source1 // SOURCE
_ = proto.source2 // SOURCE
_ = impl.source1 // SOURCE [NOT DETECTED]
_ = impl.source2 // SOURCE [NOT DETECTED]
_ = impl2.source1 // SOURCE [NOT DETECTED]
_ = impl2.source2 // SOURCE [NOT DETECTED]
_ = impl.source1 // SOURCE
_ = impl.source2 // SOURCE
_ = impl2.source1 // SOURCE
_ = impl2.source2 // SOURCE
}