8
8
// FIXME: END -enable-source-import hackaround
9
9
//
10
10
// 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
12
12
//
13
13
// 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
14
14
// RUN: %FileCheck %s -check-prefix=PASS_COMMON -strict-whitespace < %t.printed.txt
@@ -415,9 +415,11 @@ class d0120_TestClassBase {
415
415
required init ( ) { }
416
416
// PASS_COMMON-NEXT: {{^}} required init(){{$}}
417
417
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){{$}}
421
423
422
424
final func baseFunc1( ) { }
423
425
// PASS_COMMON-NEXT: {{^}} final func baseFunc1(){{$}}
@@ -433,11 +435,14 @@ class d0120_TestClassBase {
433
435
class var baseClassVar1 : Int { return 0 }
434
436
// PASS_COMMON-NEXT: {{^}} class var baseClassVar1: Int { get }{{$}}
435
437
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
438
443
439
444
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 }{{$}}
441
446
static var baseClassVar4 : Int = 0
442
447
// PASS_COMMON-NEXT: {{^}} @_hasInitialValue static var baseClassVar4: Int{{$}}
443
448
static var baseClassVar5 : Int { return 0 }
@@ -457,6 +462,12 @@ class d0121_TestClassDerived : d0120_TestClassBase {
457
462
required init ( ) { super. init ( ) }
458
463
// PASS_COMMON-NEXT: {{^}} required init(){{$}}
459
464
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
+
460
471
final override func baseFunc2( ) { }
461
472
// PASS_COMMON-NEXT: {{^}} {{(override |final )+}}func baseFunc2(){{$}}
462
473
@@ -929,8 +940,13 @@ class d0600_InClassVar1 {
929
940
// PASS_COMMON: {{^}} var instanceVar4: Int { get }{{$}}
930
941
// PASS_COMMON-NOT: instanceVar4
931
942
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
934
950
935
951
init ( ) {
936
952
instanceVar1 = 10
@@ -1402,7 +1418,6 @@ protocol ProtocolWithWhereClauseAndAssoc : QuxProtocol where Qux == Int {
1402
1418
associatedtype A1 : QuxProtocol where A1 : FooProtocol , A1. Qux : QuxProtocol , Int == A1 . Qux . Qux
1403
1419
// PREFER_TYPE_REPR_PRINTING-DAG: {{^}} associatedtype A1 : FooProtocol, QuxProtocol where Self.A1.Qux : QuxProtocol, Self.A1.Qux.Qux == Int{{$}}
1404
1420
1405
- // FIXME: this same type requirement with Self should be printed here
1406
1421
associatedtype A2 : QuxProtocol where A2. Qux == Self
1407
1422
// PREFER_TYPE_REPR_PRINTING-DAG: {{^}} associatedtype A2 : QuxProtocol where Self == Self.A2.Qux{{$}}
1408
1423
}
0 commit comments