Swift: Cover additional edge case.

This commit is contained in:
Geoffrey White
2023-01-19 11:34:07 +00:00
parent 4c47de58c1
commit 2875d8645c
3 changed files with 8 additions and 3 deletions

View File

@@ -434,7 +434,9 @@ private Element interpretElement0(
subtypes = true and
declWithMethod.getNominalTypeDecl() = namedTypeDecl.getADerivedTypeDecl*()
or
exists(ExtensionDecl e | e.getExtendedTypeDecl() = declWithMethod.getNominalTypeDecl() |
exists(ExtensionDecl e |
e.getExtendedTypeDecl().getADerivedTypeDecl*() = declWithMethod.getNominalTypeDecl()
|
subtypes = true and
e.getAProtocol() = namedTypeDecl.getADerivedTypeDecl*()
)
@@ -454,7 +456,9 @@ private Element interpretElement0(
subtypes = true and
declWithField.getNominalTypeDecl() = namedTypeDecl.getADerivedTypeDecl*()
or
exists(ExtensionDecl e | e.getExtendedTypeDecl() = declWithField.getNominalTypeDecl() |
exists(ExtensionDecl e |
e.getExtendedTypeDecl().getADerivedTypeDecl*() = declWithField.getNominalTypeDecl()
|
subtypes = true and
e.getAProtocol() = namedTypeDecl.getADerivedTypeDecl*()
)

View File

@@ -74,6 +74,7 @@
| generics.swift:132:9:132:15 | .source1 | external |
| generics.swift:133:9:133:15 | .source2 | external |
| generics.swift:162:9:162:22 | call to source2() | external |
| generics.swift:163:9:163:22 | call to source3() | 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

@@ -160,5 +160,5 @@ class MyChildClass3: MyClass3 {
func useProtocol3(impl: MyChildClass3) {
_ = impl.source1() // not a source (`MyProtocol3.source1` is the declared source and `MyParentClass3` doesn't extend it)
_ = impl.source2() // SOURCE
_ = impl.source3() // SOURCE [NOT DETECTED]
_ = impl.source3() // SOURCE
}