// RUN: %target-swift-ide-test -print-comments -source-filename %s | %FileCheck %s
protocol ParentProtocol1 {
/// ParentProtocol1.onlyParent1()
func onlyParent1()
// CHECK: Func/ParentProtocol1.onlyParent1 {{.*}} DocCommentAsXML=[onlyParent1()s:14swift_ide_test15ParentProtocol1P11onlyParent1yyFfunc onlyParent1()ParentProtocol1.onlyParent1()]
/// ParentProtocol.onlyParent1Var
var onlyParent1Var: Int { get }
// CHECK: Var/ParentProtocol1.onlyParent1Var {{.*}} DocCommentAsXML=[onlyParent1Vars:14swift_ide_test15ParentProtocol1P14onlyParent1VarSivpvar onlyParent1Var: Int { get }ParentProtocol.onlyParent1Var]
/// ParentProtocol.subscript(index:)
subscript(index: Int) -> Int { get }
// CHECK: Subscript/ParentProtocol1.subscript {{.*}} DocCommentAsXML=[subscript(_:){{.*}}subscript(index: Int) -> Int { get }ParentProtocol.subscript(index:)]
/// ParentProtocol.AssocType
associatedtype AssocType
// CHECK: AssociatedType/ParentProtocol1.AssocType {{.*}} DocCommentAsXML=[AssocTypes:14swift_ide_test15ParentProtocol1P9AssocTypeQaassociatedtype AssocTypeParentProtocol.AssocType]
/// ParentProtocol1.commonParentRequirement()
func commonParentRequirement()
// CHECKL: Func/ParentProtocol1.commonParentRequirement {{.*}} DocCommentAsXML=[commonParentRequirement()s:14swift_ide_test15ParentProtocol1P06commonD11RequirementyyFfunc commonParentRequirement()ParentProtocol1.commonParentRequirement()]
/// ParentProtocol1.commonRequirementWithDocComment()
func commonRequirementWithDocComment()
// CHECK: Func/ParentProtocol1.commonRequirementWithDocComment {{.*}} DocCommentAsXML=[commonRequirementWithDocComment()s:14swift_ide_test15ParentProtocol1P31commonRequirementWithDocCommentyyFfunc commonRequirementWithDocComment()ParentProtocol1.commonRequirementWithDocComment()]
/// ParentProtocol1.commonRequirementWithoutDocComment()
func commonRequirementWithoutDocComment()
// CHECK: Func/ParentProtocol1.commonRequirementWithoutDocComment {{.*}} DocCommentAsXML=[commonRequirementWithoutDocComment()s:14swift_ide_test15ParentProtocol1P34commonRequirementWithoutDocCommentyyFfunc commonRequirementWithoutDocComment()ParentProtocol1.commonRequirementWithoutDocComment()]
}
protocol ParentProtocol2 {
/// ParentProtocol2.onlyParent2()
func onlyParent2()
// CHECK: Func/ParentProtocol2.onlyParent2 {{.*}} DocCommentAsXML=[onlyParent2()s:14swift_ide_test15ParentProtocol2P11onlyParent2yyFfunc onlyParent2()ParentProtocol2.onlyParent2()]
/// ParentProtocol2.commonParentRequirement()
func commonParentRequirement()
// CHECK: Func/ParentProtocol2.commonParentRequirement {{.*}} DocCommentAsXML=[commonParentRequirement()s:14swift_ide_test15ParentProtocol2P06commonD11RequirementyyFfunc commonParentRequirement()ParentProtocol2.commonParentRequirement()]
/// ParentProtocol2.commonRequirementWithDocComment()
func commonRequirementWithDocComment()
// CHECK: Func/ParentProtocol2.commonRequirementWithDocComment {{.*}} DocCommentAsXML=[commonRequirementWithDocComment()s:14swift_ide_test15ParentProtocol2P31commonRequirementWithDocCommentyyFfunc commonRequirementWithDocComment()ParentProtocol2.commonRequirementWithDocComment()]
/// ParentProtocol2.commonRequirementWithoutDocComment()
func commonRequirementWithoutDocComment()
// CHECK: Func/ParentProtocol2.commonRequirementWithoutDocComment {{.*}} DocCommentAsXML=[commonRequirementWithoutDocComment()s:14swift_ide_test15ParentProtocol2P34commonRequirementWithoutDocCommentyyFfunc commonRequirementWithoutDocComment()ParentProtocol2.commonRequirementWithoutDocComment()]
}
protocol ChildProtocol : ParentProtocol1, ParentProtocol2 {
/// ChildProtocol.commonRequirementWithDocComment()
func commonRequirementWithDocComment()
// CHECK: Func/ChildProtocol.commonRequirementWithDocComment {{.*}} DocCommentAsXML=[commonRequirementWithDocComment()s:14swift_ide_test13ChildProtocolP31commonRequirementWithDocCommentyyFfunc commonRequirementWithDocComment()ChildProtocol.commonRequirementWithDocComment()]
// This should show nothing because there are two inherited requirements.
func commonRequirementWithoutDocComment()
// CHECK: Func/ChildProtocol.commonRequirementWithoutDocComment {{.*}} DocCommentAsXML=none
}
// Test that ChildProtocol's default implementation for requirements
// come from the right place.
extension ChildProtocol {
// Should come from ParentProtocol1.
func onlyParent1() {}
// CHECK: Func/onlyParent1 {{.*}} DocCommentAsXML=[onlyParent1()s:14swift_ide_test15ParentProtocol1P11onlyParent1yyFfunc onlyParent1()ParentProtocol1.onlyParent1()This documentation comment was inherited from ParentProtocol1.]
// Should come from ParentProtocol1.
var onlyParent1Var: Int { return 0 }
// CHECK: Var/onlyParent1Var {{.*}} DocCommentAsXML=[onlyParent1Vars:14swift_ide_test15ParentProtocol1P14onlyParent1VarSivpvar onlyParent1Var: Int { get }ParentProtocol.onlyParent1VarThis documentation comment was inherited from ParentProtocol1.]
// Should come from ParentProtocol1.
subscript(index: Int) -> Int { return 0 }
// CHECK: Subscript/subscript {{.*}} DocCommentAsXML=[subscript(_:){{.*}}subscript(index: Int) -> Int { get }ParentProtocol.subscript(index:)This documentation comment was inherited from ParentProtocol1.]
// Should come from ParentProtocol1.
typealias AssocType = Int
// CHECK: TypeAlias/AssocType {{.*}} DocCommentAsXML=[AssocTypes:14swift_ide_test15ParentProtocol1P9AssocTypeQaassociatedtype AssocTypeParentProtocol.AssocTypeThis documentation comment was inherited from ParentProtocol1.]
// Should come from ParentProtocol2.
func onlyParent2() {}
// CHECK: Func/onlyParent2 {{.*}} DocCommentAsXML=[onlyParent2()s:14swift_ide_test15ParentProtocol2P11onlyParent2yyFfunc onlyParent2()ParentProtocol2.onlyParent2()This documentation comment was inherited from ParentProtocol2.]
// Should show nothing because the requirement is in both parents.
func commonParentRequirement() {}
// CHECK: Func/commonParentRequirement {{.*}} DocCommentAsXML=none
// Should show nothing because the requirement is in both parents.
func commonRequirementWithDocComment() {}
// CHECK: Func/commonRequirementWithDocComment {{.*}} DocCommentAsXML=none
// Should show nothing because there are multiple requirements.
func commonRequirementWithoutDocComment() {}
// CHECK: Func/commonRequirementWithoutDocComment {{.*}} DocCommentAsXML=none
}