Files
swift-mirror/test/SourceKit/DocumentStructure/rdar47426948.swift
Rintaro Ishizaki 606b551f87 [SourceKit] Fix a crash in SwiftDocumentStructureWalker::getObjCSelectorName()
SourceKit document structure request used to crash if if there's inititalizer
with single named parameter with `@IBAction` attribute.

This used to happen because
ConstructorDecl::isObjCZeroParameterWithLongSelector() requires
interface type of the parameter but the constructor doesn't have it at
this stage.

This change fixes that by not vending ObjC name for
constructor or destructors.

rdar://problem/47426948
2019-01-25 17:10:52 -08:00

41 lines
1.0 KiB
Swift

// RUN: %sourcekitd-test -req=structure %s -- %s | %FileCheck %s
class C {
@IBAction init(foo: Void) {}
@IBAction init(bar: ()) {}
@IBAction init(baz: Int) {}
@IBAction func methodName(foo: ()) {}
@IBAction func methodName(bar: Void) {}
@IBAction func methodName(baz: Int) {}
@IBAction deinit {}
}
// CHECK: {
// CHECK: key.name: "init(foo:)",
// CHECK-NOT: key.selector_name
// CHECK: }
// CHECK: {
// CHECK: key.name: "init(bar:)",
// CHECK-NOT: key.selector_name
// CHECK: }
// CHECK: {
// CHECK: key.name: "init(baz:)",
// CHECK-NOT: key.selector_name
// CHECK: }
// CHECK: {
// CHECK: key.name: "methodName(foo:)",
// CHECK: key.selector_name: "methodNameWithFoo:"
// CHECK: }
// CHECK: {
// CHECK: key.name: "methodName(bar:)",
// CHECK: key.selector_name: "methodNameWithBar:"
// CHECK: }
// CHECK: {
// CHECK: key.name: "methodName(baz:)",
// CHECK: key.selector_name: "methodNameWithBaz:"
// CHECK: }
// CHECK: {
// CHECK: key.name: "deinit",
// CHECK-NOT: key.selector_name
// CHECK: }