Files
swift-mirror/test/SourceKit/CursorInfo/cursor_overrides.swift
Doug Gregor 15386fa0bf [AST] Track overriding relationship among associated types.
When an associated type declaration “overrides” (restates) an associated
type from a protocol it inherits, note that it overrides that declaration.
SourceKit now reports overrides of associated types.
2017-10-07 21:52:40 -07:00

46 lines
1.3 KiB
Swift

import FooClangModule
protocol Prot {
func meth()
}
class Cls : S1, Prot {
func meth() {}
}
class SubCls : Cls {
func meth() {}
}
func goo(x: SubCls) {
x.meth()
}
public protocol WithAssocType {
/// Some kind of associated type
associatedtype AssocType
}
public protocol WithInheritedAssocType : WithAssocType {
associatedtype AssocType = Int
}
// REQUIRES: objc_interop
// RUN: %sourcekitd-test -req=cursor -pos=16:7 %s -- -embed-bitcode -I %S/Inputs/cursor-overrides %mcp_opt %s | %FileCheck -check-prefix=CHECK1 %s
// CHECK1: source.lang.swift.ref.function.method.instance (12:8-12:14)
// CHECK1: c:@M@cursor_overrides@objc(cs)SubCls(im)meth
// CHECK1: (SubCls) -> () -> ()
// CHECK1: OVERRIDES BEGIN
// CHECK1-NEXT: c:@M@cursor_overrides@objc(cs)Cls(im)meth
// CHECK1-NEXT: s:16cursor_overrides4ProtP4methyyF
// CHECK1-NEXT: c:objc(cs)S1(im)meth
// CHECK1-NEXT: c:objc(cs)B1(im)meth
// CHECK1-NEXT: c:objc(pl)P1(im)meth
// CHECK1-NEXT: OVERRIDES END
// RUN: %sourcekitd-test -req=cursor -pos=25:20 %s -- -embed-bitcode -I %S/Inputs/cursor-overrides %mcp_opt %s | %FileCheck -check-prefix=CHECK2 %s
// CHECK2: s:16cursor_overrides22WithInheritedAssocTypeP0eF0
// CHECK2: OVERRIDES BEGIN
// CHECK2-NEXT: s:16cursor_overrides13WithAssocTypeP0dE0
// CHECK2-NEXT: OVERRIDES END