This repository was archived by the owner on Jun 1, 2023. It is now read-only.
File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public final class Interface {
24
24
return false
25
25
}
26
26
27
- return symbol. id. pathComponents . isEmpty
27
+ return symbol. id. context . isEmpty
28
28
}
29
29
30
30
self . relationships = {
Original file line number Diff line number Diff line change @@ -359,4 +359,33 @@ final class InterfaceTypeTests: XCTestCase {
359
359
XCTAssertEqual ( members [ 0 ] . name, " someMethod() " )
360
360
XCTAssertEqual ( members [ 1 ] . name, " someExtensionMethod() " )
361
361
}
362
+
363
+ public func testToplevelSymbols( ) throws {
364
+ let source = #"""
365
+ public class SomeClass {
366
+ public func someMethod() { }
367
+ }
368
+
369
+ public infix operator ≠
370
+
371
+ public typealias OtherClass = SomeClass
372
+
373
+ public func someFunction() { }
374
+
375
+ public extension OtherClass {
376
+ func someExtensionMethod() { }
377
+ }
378
+ """#
379
+
380
+ let url = try temporaryFile ( contents: source)
381
+ let sourceFile = try SourceFile ( file: url, relativeTo: url. deletingLastPathComponent ( ) )
382
+ let module = Module ( name: " Module " , sourceFiles: [ sourceFile] )
383
+
384
+ XCTAssertEqual ( module. interface. topLevelSymbols. count, 4 )
385
+
386
+ XCTAssertEqual ( module. interface. topLevelSymbols [ 0 ] . name, " SomeClass " )
387
+ XCTAssertEqual ( module. interface. topLevelSymbols [ 1 ] . name, " ≠ " )
388
+ XCTAssertEqual ( module. interface. topLevelSymbols [ 2 ] . name, " OtherClass " )
389
+ XCTAssertEqual ( module. interface. topLevelSymbols [ 3 ] . name, " someFunction() " )
390
+ }
362
391
}
You can’t perform that action at this time.
0 commit comments