Skip to content

Commit 6637c18

Browse files
committed
Address a few stale FIXMEs & replace some commented-out test cases with verifications
1 parent d124b35 commit 6637c18

File tree

2 files changed

+39
-18
lines changed

2 files changed

+39
-18
lines changed

test/IDE/print_ast_tc_decls.swift

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// FIXME: END -enable-source-import hackaround
99
//
1010
// This file should not have any syntax or type checker errors.
11-
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -typecheck -verify %s -F %S/Inputs/mock-sdk -enable-objc-interop -disable-objc-attr-requires-foundation-module
11+
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -D ERRORS -typecheck -verify %s -F %S/Inputs/mock-sdk -enable-objc-interop -disable-objc-attr-requires-foundation-module
1212
//
1313
// RUN: %target-swift-ide-test(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -swift-version 4 -skip-deinit=false -print-ast-typechecked -source-filename %s -F %S/Inputs/mock-sdk -function-definitions=false -prefer-type-repr=false -print-implicit-attrs=true -enable-objc-interop -disable-objc-attr-requires-foundation-module > %t.printed.txt
1414
// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
@@ -415,9 +415,11 @@ class d0120_TestClassBase {
415415
required init() {}
416416
// PASS_COMMON-NEXT: {{^}} required init(){{$}}
417417

418-
// FIXME: Add these once we can SILGen them reasonable.
419-
// init?(fail: String) { }
420-
// init!(iuoFail: String) { }
418+
init?(fail: String) {}
419+
// PASS_COMMON-NEXT: {{^}} init?(fail: String){{$}}
420+
421+
init!(iuoFail: String) {}
422+
// PASS_COMMON-NEXT: {{^}} init!(iuoFail: String){{$}}
421423

422424
final func baseFunc1() {}
423425
// PASS_COMMON-NEXT: {{^}} final func baseFunc1(){{$}}
@@ -433,11 +435,14 @@ class d0120_TestClassBase {
433435
class var baseClassVar1: Int { return 0 }
434436
// PASS_COMMON-NEXT: {{^}} class var baseClassVar1: Int { get }{{$}}
435437

436-
// FIXME: final class var not allowed to have storage, but static is?
437-
// final class var baseClassVar2: Int = 0
438+
// FIXME: final class var not allowed to have storage, but static is?
439+
#if ERRORS
440+
final class var baseClassVar2: Int = 0
441+
// expected-error@-1 {{class stored properties not supported in classes; did you mean 'static'?}}
442+
#endif
438443

439444
final class var baseClassVar3: Int { return 0 }
440-
// PASS_COMMON-NEXT: {{^}} final class var baseClassVar3: Int { get }{{$}}
445+
// PASS_COMMON: {{^}} final class var baseClassVar3: Int { get }{{$}}
441446
static var baseClassVar4: Int = 0
442447
// PASS_COMMON-NEXT: {{^}} @_hasInitialValue static var baseClassVar4: Int{{$}}
443448
static var baseClassVar5: Int { return 0 }
@@ -457,6 +462,12 @@ class d0121_TestClassDerived : d0120_TestClassBase {
457462
required init() { super.init() }
458463
// PASS_COMMON-NEXT: {{^}} required init(){{$}}
459464

465+
override init?(fail: String) { nil }
466+
// PASS_COMMON-NEXT: {{^}} override init?(fail: String){{$}}
467+
468+
override init!(iuoFail: String) { nil }
469+
// PASS_COMMON-NEXT: {{^}} override init!(iuoFail: String){{$}}
470+
460471
final override func baseFunc2() {}
461472
// PASS_COMMON-NEXT: {{^}} {{(override |final )+}}func baseFunc2(){{$}}
462473

@@ -929,8 +940,13 @@ class d0600_InClassVar1 {
929940
// PASS_COMMON: {{^}} var instanceVar4: Int { get }{{$}}
930941
// PASS_COMMON-NOT: instanceVar4
931942

932-
// FIXME: uncomment when we have static vars.
933-
// static var staticVar1: Int
943+
static var staticVar1: Int = 42
944+
// PASS_COMMON: {{^}} @_hasInitialValue static var staticVar1: Int{{$}}
945+
// PASS_COMMON-NOT: staticVar1
946+
947+
static var staticVar2: Int { 42 }
948+
// PASS_COMMON: {{^}} static var staticVar2: Int { get }{{$}}
949+
// PASS_COMMON-NOT: staticVar2
934950

935951
init() {
936952
instanceVar1 = 10
@@ -1402,7 +1418,6 @@ protocol ProtocolWithWhereClauseAndAssoc : QuxProtocol where Qux == Int {
14021418
associatedtype A1 : QuxProtocol where A1 : FooProtocol, A1.Qux : QuxProtocol, Int == A1.Qux.Qux
14031419
// PREFER_TYPE_REPR_PRINTING-DAG: {{^}} associatedtype A1 : FooProtocol, QuxProtocol where Self.A1.Qux : QuxProtocol, Self.A1.Qux.Qux == Int{{$}}
14041420

1405-
// FIXME: this same type requirement with Self should be printed here
14061421
associatedtype A2 : QuxProtocol where A2.Qux == Self
14071422
// PREFER_TYPE_REPR_PRINTING-DAG: {{^}} associatedtype A2 : QuxProtocol where Self == Self.A2.Qux{{$}}
14081423
}

validation-test/Sema/OverridesAndOverloads.swift

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,21 @@ Overrides.test("contravariant return type override, protocol to protocol") {
165165
// FIXME: https://github.com/apple/swift/issues/43348
166166
// Contravariant overrides on return type don't work with protocols
167167
class Base {
168+
// expected-note@+1 {{found this candidate}}
168169
func foo() -> P1 { which = "Base.foo() -> P1"; return P1ImplS1() }
169170
}
170171
class Derived : Base {
172+
// expected-note@+1 {{found this candidate}}
171173
/*FIXME: override */ func foo() -> P1x {
172174
which = "Derived.foo() -> P1x"; return P1xImplS1()
173175
}
174176
}
175177

176-
// https://github.com/apple/swift/issues/43348
177-
// FIXME: uncomment when the bug is fixed.
178-
// Derived().foo() as P1 // error: ambiguous use of 'foo()'
179-
// expectEqual("Derived.foo() -> P1x", which)
178+
#if ERRORS
179+
// FIXME: https://github.com/apple/swift/issues/43348
180+
Derived().foo() as P1 // expected-error {{ambiguous use of 'foo()'}}
181+
expectEqual("Derived.foo() -> P1x", which)
182+
#endif
180183

181184
_ = Derived().foo() as P1x
182185
expectEqual("Derived.foo() -> P1x", which)
@@ -186,18 +189,21 @@ Overrides.test("contravariant return type override, protocol to struct") {
186189
// FIXME: https://github.com/apple/swift/issues/43348
187190
// Contravariant overrides on return type don't work with protocols
188191
class Base {
192+
// expected-note@+1 {{found this candidate}}
189193
func foo() -> P1 { which = "Base.foo() -> P1"; return P1ImplS1() }
190194
}
191195
class Derived : Base {
196+
// expected-note@+1 {{found this candidate}}
192197
/*FIXME: override */ func foo() -> P1ImplS1 {
193198
which = "Derived.foo() -> P1ImplS1"; return P1ImplS1()
194199
}
195200
}
196201

197-
// https://github.com/apple/swift/issues/43348
198-
// FIXME: uncomment when the bug is fixed.
199-
// Derived().foo() as P1 // error: ambiguous use of 'foo()'
200-
// expectEqual("Derived.foo() -> P1ImplS1", which)
202+
#if ERRORS
203+
// FIXME: https://github.com/apple/swift/issues/43348
204+
Derived().foo() as P1 // expected-error {{ambiguous use of 'foo()'}}
205+
expectEqual("Derived.foo() -> P1ImplS1", which)
206+
#endif
201207

202208
_ = Derived().foo() as P1ImplS1
203209
expectEqual("Derived.foo() -> P1ImplS1", which)

0 commit comments

Comments
 (0)