FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

unified: Update test case to be valid Swift · github/codeql@e5034d9 · GitHub

Repository navigation

Commit e5034d9

Browse files
committed
unified: Update test case to be valid Swift
An extension can add protocols as base, but not classes. Expanding the test a bit to target a protocol-base and also extension the protocol to add a method with a "default" implementation.
1 parent ffdd2a4 commit e5034d9

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎unified/ql/test/library-tests/static-name-binding/extensions.swift‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ extension B { // $ access=B
3636
}
3737
}
3838

39-
// Inheritance through extension
40-
class Base {
41-
func baseMethod() {
42-
}
39+
// Protocol conformance through extension
40+
protocol Base {
41+
func baseMethod();
42+
}
43+
extension Base { // $ access=Base
44+
func baseMethodExt() {} // name=Base.baseMethodExt
4345
}
4446
class X {
4547
func xMethod() {
4648
baseMethod() // $ access=Base.baseMethod
49+
baseMethodExt() // $ access=Base.baseMethodExt
4750
}
4851
}
4952
extension X : Base {} // $ access=X access=Base

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL