Skip to content

Commit

Permalink
Default swift-ide-test to -implicit-objc-with like the rest of the wo…
Browse files Browse the repository at this point in the history
…rld.

We require some level of consistency between the way the overlays were
built and what we work with in our mock SDK. The IDE/sdk_sugar.swift
test failure was because the overlay referenced "init(coder:)" while
the test was looking for "init(withCoder:)". Hilarity ensued
<rdar://problem/17791048>.

This only impacts testing.

Swift SVN r20564
  • Loading branch information
DougGregor committed Jul 25, 2014
1 parent 71d8e16 commit e9037bc
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 49 deletions.
6 changes: 3 additions & 3 deletions test/IDE/Inputs/mock-sdk/Foo.annotated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protocol <loc>FooProtocolBase</loc> {
<decl:Func>class func <loc>fooBaseInstanceFunc1(anObject: <ref:Protocol>AnyObject</ref>!)</loc> -> <ref:Class>FooClassBase</ref>!</decl>
<decl:Func>func <loc>fooBaseInstanceFunc1(anObject: <ref:Protocol>AnyObject</ref>!)</loc> -> <ref:Class>FooClassBase</ref>!</decl>
<decl:Constructor><loc>init()</loc></decl>
<decl:Constructor>convenience <loc>init(withFloat f: <ref:Struct>Float</ref>)</loc></decl>
<decl:Constructor>convenience <loc>init(float f: <ref:Struct>Float</ref>)</loc></decl>
<decl:Func>class func <loc>fooBaseInstanceFuncOverridden()</loc></decl>
<decl:Func>func <loc>fooBaseInstanceFuncOverridden()</loc></decl>
<decl:Func>class func <loc>fooBaseClassFunc0()</loc></decl>
Expand Down Expand Up @@ -171,7 +171,7 @@ class <loc>FooClassDerived</loc> : <ref:Class>FooClassBase</ref>, <ref:Protocol>
<decl:Func>func <loc>fooBaseInstanceFuncOverridden()</loc></decl>
<decl:Func>class func <loc>fooClassFunc0()</loc></decl>
<decl:Constructor><loc>init()</loc></decl>
<decl:Constructor>convenience <loc>init(withFloat f: <ref:Struct>Float</ref>)</loc></decl>
<decl:Constructor>convenience <loc>init(float f: <ref:Struct>Float</ref>)</loc></decl>

<decl:Func>/// Aaa. fooProtoFunc. Bbb.
/// Ccc.
Expand Down Expand Up @@ -213,5 +213,5 @@ class <loc>FooClassDerived</loc> : <ref:Class>FooClassBase</ref>, <ref:Protocol>
<decl:Var>weak var <loc>weakRef</loc>: @sil_weak <ref:Protocol>AnyObject</ref>!</decl>
<decl:Var>var <loc>scalar</loc>: <ref:Struct>Int32</ref></decl>
<decl:Constructor><loc>init()</loc></decl>
<decl:Constructor>convenience <loc>init(withFloat f: <ref:Struct>Float</ref>)</loc></decl>
<decl:Constructor>convenience <loc>init(float f: <ref:Struct>Float</ref>)</loc></decl>
}</decl>
6 changes: 3 additions & 3 deletions test/IDE/Inputs/mock-sdk/Foo.printed.recursive.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class FooClassBase {
class func fooBaseInstanceFunc1(anObject: AnyObject!) -> FooClassBase!
func fooBaseInstanceFunc1(anObject: AnyObject!) -> FooClassBase!
init()
convenience init(withFloat f: Float)
convenience init(float f: Float)
class func fooBaseInstanceFuncOverridden()
func fooBaseInstanceFuncOverridden()
class func fooBaseClassFunc0()
Expand Down Expand Up @@ -171,7 +171,7 @@ class FooClassDerived : FooClassBase, FooProtocolDerived, FooProtocolBase {
func fooBaseInstanceFuncOverridden()
class func fooClassFunc0()
init()
convenience init(withFloat f: Float)
convenience init(float f: Float)

/// Aaa. fooProtoFunc. Bbb.
/// Ccc.
Expand Down Expand Up @@ -213,7 +213,7 @@ class FooClassPropertyOwnership : FooClassBase {
weak var weakRef: @sil_weak AnyObject!
var scalar: Int32
init()
convenience init(withFloat f: Float)
convenience init(float f: Float)
}
func fooSubFunc1(a: Int32) -> Int32
struct FooSubEnum1 {
Expand Down
6 changes: 3 additions & 3 deletions test/IDE/Inputs/mock-sdk/Foo.printed.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class FooClassBase {
class func fooBaseInstanceFunc1(anObject: AnyObject!) -> FooClassBase!
func fooBaseInstanceFunc1(anObject: AnyObject!) -> FooClassBase!
init()
convenience init(withFloat f: Float)
convenience init(float f: Float)
class func fooBaseInstanceFuncOverridden()
func fooBaseInstanceFuncOverridden()

Expand All @@ -189,7 +189,7 @@ class FooClassDerived : FooClassBase, FooProtocolDerived, FooProtocolBase {

class func fooClassFunc0()
init()
convenience init(withFloat f: Float)
convenience init(float f: Float)
/// Aaa. fooProtoFunc. Bbb.
/// Ccc.
func fooProtoFunc()
Expand Down Expand Up @@ -256,5 +256,5 @@ class FooClassPropertyOwnership : FooClassBase {
weak var weakRef: @sil_weak AnyObject!
var scalar: Int32
init()
convenience init(withFloat f: Float)
convenience init(float f: Float)
}
12 changes: 6 additions & 6 deletions test/IDE/annotation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,18 @@ enum myCoolEnum {
}

class C10 {
init(withInt: Int, andThis: Float) {}
init(int: Int, andThis: Float) {}
func meth(x: Int, withFloat: Float) {}
}

// CHECK: var <Var>c10</Var> = <Ctor@[[@LINE-4]]:3-Class@[[@LINE-5]]:7>C10</Ctor>(<Ctor@[[@LINE-4]]:3>withInt</Ctor>: 0, <Ctor@[[@LINE-4]]:3>andThis</Ctor>: 0)
var c10 = C10(withInt: 0, andThis: 0)
// CHECK: var <Var>c10</Var> = <Ctor@[[@LINE-4]]:3-Class@[[@LINE-5]]:7>C10</Ctor>(<Ctor@[[@LINE-4]]:3>int</Ctor>: 0, <Ctor@[[@LINE-4]]:3>andThis</Ctor>: 0)
var c10 = C10(int: 0, andThis: 0)
// CHECK: <Var@[[@LINE-1]]:5>c10</Var>.<Func@[[@LINE-5]]:8>meth</Func>(0, <Func@[[@LINE-5]]:8>withFloat</Func>: 0)
c10.meth(0, withFloat: 0)

func test7(withInt x: Int, andThis y: Float) {}
// CHECK: <Func@[[@LINE-1]]:6>test7</Func>(<Func@[[@LINE-1]]:6>withInt</Func>: 0, <Func@[[@LINE-1]]:6>andThis</Func>: 0)
test7(withInt: 0, andThis: 0)
func test7(int x: Int, andThis y: Float) {}
// CHECK: <Func@[[@LINE-1]]:6>test7</Func>(<Func@[[@LINE-1]]:6>int</Func>: 0, <Func@[[@LINE-1]]:6>andThis</Func>: 0)
test7(int: 0, andThis: 0)

class C11 {
// CHECK: var <Var>a</Var>: <iStruct@>Int</iStruct> = { var <Var>tmp</Var> = 0; return <Var@[[@LINE+1]]:22>tmp</Var> }()
Expand Down
12 changes: 6 additions & 6 deletions test/IDE/complete_constructor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,23 @@ func testExplicitConstructors3P() {


struct ExplicitConstructorsSelector1 {
init(withInt a : Int) {}
init(withInt a : Int, andFloat b : Float) {}
init(int a : Int) {}
init(int a : Int, andFloat b : Float) {}
}

func testExplicitConstructorsSelector1() {
ExplicitConstructorsSelector1#^EXPLICIT_CONSTRUCTORS_SELECTOR_1^#
// EXPLICIT_CONSTRUCTORS_SELECTOR_1: Begin completions, 2 items
// EXPLICIT_CONSTRUCTORS_SELECTOR_1-DAG: Decl[Constructor]/CurrNominal: ({#withInt: Int#})[#ExplicitConstructorsSelector1#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_1-DAG: Decl[Constructor]/CurrNominal: ({#withInt: Int#}, {#andFloat: Float#})[#ExplicitConstructorsSelector1#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_1-DAG: Decl[Constructor]/CurrNominal: ({#int: Int#})[#ExplicitConstructorsSelector1#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_1-DAG: Decl[Constructor]/CurrNominal: ({#int: Int#}, {#andFloat: Float#})[#ExplicitConstructorsSelector1#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_1: End completions
}

struct ExplicitConstructorsSelector2 {
init(noArgs _ : ()) {}
init(_ a : Int) {}
init(_ a : Int, withFloat b : Float) {}
init(withInt a : Int, _ b : Float) {}
init(int a : Int, _ b : Float) {}
}

func testExplicitConstructorsSelector2() {
Expand All @@ -139,7 +139,7 @@ func testExplicitConstructorsSelector2() {
// EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#noArgs: ()#})[#ExplicitConstructorsSelector2#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#Int#})[#ExplicitConstructorsSelector2#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#Int#}, {#withFloat: Float#})[#ExplicitConstructorsSelector2#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#withInt: Int#}, {#Float#})[#ExplicitConstructorsSelector2#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_2-DAG: Decl[Constructor]/CurrNominal: ({#int: Int#}, {#Float#})[#ExplicitConstructorsSelector2#]{{$}}
// EXPLICIT_CONSTRUCTORS_SELECTOR_2: End completions
}

Expand Down
4 changes: 2 additions & 2 deletions test/IDE/complete_from_clang_framework.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func testCompleteClassMembers1() {
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[StaticMethod]/CurrNominal: .fooBaseInstanceFunc1({#(anObject): AnyObject!#})[#FooClassBase!#]{{$}}
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooBaseInstanceFunc1({#self: FooClassBase#})[#(AnyObject!) -> FooClassBase!#]{{$}}
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[Constructor]/CurrNominal: ()[#FooClassBase#]
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[Constructor]/CurrNominal: ({#withFloat: Float#})[#FooClassBase#]{{$}}
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[Constructor]/CurrNominal: ({#float: Float#})[#FooClassBase#]{{$}}
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[StaticMethod]/CurrNominal: .fooBaseInstanceFuncOverridden()[#Void#]{{$}}
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[InstanceMethod]/CurrNominal: .fooBaseInstanceFuncOverridden({#self: FooClassBase#})[#() -> Void#]{{$}}
// CLANG_CLASS_MEMBERS_1-NEXT: Decl[StaticMethod]/CurrNominal: .fooBaseClassFunc0()[#Void#]{{$}}
Expand All @@ -272,7 +272,7 @@ func testCompleteClassMembers2() {
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[InstanceMethod]/CurrNominal: .fooBaseInstanceFuncOverridden({#self: FooClassDerived#})[#() -> Void#]{{$}}
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[StaticMethod]/CurrNominal: .fooClassFunc0()[#Void#]{{$}}
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[Constructor]/CurrNominal: ()[#FooClassDerived#]
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[Constructor]/CurrNominal: ({#withFloat: Float#})[#FooClassDerived#]{{$}}
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[Constructor]/CurrNominal: ({#float: Float#})[#FooClassDerived#]{{$}}
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[InstanceMethod]/CurrNominal: .fooProtoFunc({#self: FooClassDerived#})[#() -> Void#]{{$}}
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[InstanceMethod]/CurrNominal: .fooProtoFuncWithExtraIndentation1({#self: FooClassDerived#})[#() -> Void#]{{$}}
// CLANG_CLASS_MEMBERS_2-NEXT: Decl[InstanceMethod]/CurrNominal: .fooProtoFuncWithExtraIndentation2({#self: FooClassDerived#})[#() -> Void#]{{$}}
Expand Down
40 changes: 20 additions & 20 deletions test/IDE/complete_init_inherited.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=TEST_D | FileCheck %s -check-prefix=TEST_D

class A {
init(withInt i: Int) {}
init(withDouble d: Double) {}
convenience init(withFloat f: Float) {
init(int i: Int) {}
init(double d: Double) {}
convenience init(float f: Float) {
self.init(Double(f))
}
}

// TEST_A: Begin completions
// TEST_A-NEXT: Decl[Constructor]/CurrNominal: ({#withInt: Int#})[#A#]{{$}}
// TEST_A-NEXT: Decl[Constructor]/CurrNominal: ({#withDouble: Double#})[#A#]{{$}}
// TEST_A-NEXT: Decl[Constructor]/CurrNominal: ({#withFloat: Float#})[#A#]{{$}}
// TEST_A-NEXT: Decl[Constructor]/CurrNominal: ({#int: Int#})[#A#]{{$}}
// TEST_A-NEXT: Decl[Constructor]/CurrNominal: ({#double: Double#})[#A#]{{$}}
// TEST_A-NEXT: Decl[Constructor]/CurrNominal: ({#float: Float#})[#A#]{{$}}
// TEST_A-NEXT: End completions

class B : A {
Expand All @@ -24,24 +24,24 @@ class B : A {
}

// TEST_B: Begin completions
// TEST_B-NEXT: Decl[Constructor]/CurrNominal: ({#withInt: Int#})[#B#]{{$}}
// TEST_B-NEXT: Decl[Constructor]/CurrNominal: ({#withDouble: Double#})[#B#]{{$}}
// TEST_B-NEXT: Decl[Constructor]/Super: ({#withFloat: Float#})[#A#]{{$}}
// TEST_B-NEXT: Decl[Constructor]/CurrNominal: ({#int: Int#})[#B#]{{$}}
// TEST_B-NEXT: Decl[Constructor]/CurrNominal: ({#double: Double#})[#B#]{{$}}
// TEST_B-NEXT: Decl[Constructor]/Super: ({#float: Float#})[#A#]{{$}}
// TEST_B-NEXT: End completions

class C : B {
init(withInt i: Int) {
super.init(withInt: i)
init(int i: Int) {
super.init(int: i)
}
convenience init(withC other: C) {
self.init(withInt: 0)
convenience init(c other: C) {
self.init(int: 0)
}
// No initializers are inherited.
}

// TEST_C: Begin completions
// TEST_C-NEXT: Decl[Constructor]/CurrNominal: ({#withInt: Int#})[#C#]{{$}}
// TEST_C-NEXT: Decl[Constructor]/CurrNominal: ({#withC: C#})[#C#]{{$}}
// TEST_C-NEXT: Decl[Constructor]/CurrNominal: ({#int: Int#})[#C#]{{$}}
// TEST_C-NEXT: Decl[Constructor]/CurrNominal: ({#c: C#})[#C#]{{$}}
// TEST_C-NEXT: End completions

class D : C {
Expand All @@ -50,15 +50,15 @@ class D : C {
// C's complete object initializers are inherited.
// Initializers from A are not included in D's interface.

convenience init(withD other: D) {
self.init(withInt: 0)
convenience init(d other: D) {
self.init(int: 0)
}
}

// TEST_D: Begin completions
// TEST_D-NEXT: Decl[Constructor]/CurrNominal: ({#withD: D#})[#D#]{{$}}
// TEST_D-NEXT: Decl[Constructor]/CurrNominal: ({#withInt: Int#})[#D#]{{$}}
// TEST_D-NEXT: Decl[Constructor]/Super: ({#withC: C#})[#C#]{{$}}
// TEST_D-NEXT: Decl[Constructor]/CurrNominal: ({#d: D#})[#D#]{{$}}
// TEST_D-NEXT: Decl[Constructor]/CurrNominal: ({#int: Int#})[#D#]{{$}}
// TEST_D-NEXT: Decl[Constructor]/Super: ({#c: C#})[#C#]{{$}}
// TEST_D-NEXT: End completions

func testA() {
Expand Down
2 changes: 1 addition & 1 deletion test/IDE/print_clang_decls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
// APPKIT-NEXT: func ancestorSharedWithView(aView: NSView) -> NSView?
// APPKIT-NEXT: func addSubview(aView: NSView)
// APPKIT-NEXT: func addSubview(aView: NSView, positioned place: UInt32, relativeTo otherView: NSView?)
// APPKIT-NEXT: init(withCoder aDecoder: NSCoder)
// APPKIT-NEXT: init(coder aDecoder: NSCoder)
// APPKIT-NEXT: var trackingAreas: [AnyObject] { get }
// APPKIT-NEXT: var subviews: [AnyObject]
// APPKIT-LABEL: extension NSView {
Expand Down
2 changes: 1 addition & 1 deletion test/IDE/print_clang_foundation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
// RUN: FileCheck -input-file %t/Foundation.NSString.printed.txt -check-prefix=CHECK_DICTIONARY %s

// Make sure that we don't qualify 'NSErrorPointer'.
// CHECK_NSSTRING: init(withContentsOfFile path: String!, encoding enc: UInt, error: NSErrorPointer)
// CHECK_NSSTRING: init(contentsOfFile path: String!, encoding enc: UInt, error: NSErrorPointer)

// CHECK_DICTIONARY: func propertyListFromStringsFileFormat() -> [NSObject : AnyObject]!
3 changes: 0 additions & 3 deletions test/IDE/sdk_sugar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
// REQUIRES: sdk
// REQUIRES: OS=macosx

// FIXME: rdar://17791048
// XFAIL: *

import Foundation

// CHECK: func loadAndReturnError(error: NSErrorPointer) -> Bool
Expand Down
2 changes: 1 addition & 1 deletion tools/swift-ide-test/swift-ide-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ ImplicitProperties("enable-objc-implicit-properties",
static llvm::cl::opt<bool>
ImplicitObjCWith("implicit-objc-with",
llvm::cl::desc("Make the \"with\" implicit in initializers"),
llvm::cl::init(false));
llvm::cl::init(true));

static llvm::cl::opt<bool>
FactoryMethodsAsConstructors("enable-objc-factory-method-constructors",
Expand Down

0 comments on commit e9037bc

Please sign in to comment.