Skip to content

Commit ce58860

Browse files
committed
Tests: Add a typealias test case to lazy_typecheck.swift.
1 parent 4522963 commit ce58860

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

test/Inputs/lazy_typecheck.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,7 @@ extension PublicGenericStruct where T == InternalStructForConstraint {}
242242

243243
extension PublicGenericStruct: EmptyPublicProto where T == InternalStructForConstraint {}
244244

245+
// MARK: - Type aliases
246+
247+
public typealias PublicStructAlias = PublicStruct
248+
typealias InternalTypeAlias = DoesNotExist // expected-error {{cannot find type 'DoesNotExist' in scope}}

test/Inputs/lazy_typecheck_client.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,7 @@ func takesEmptyProto<T: EmptyPublicProto>(_ t: T) {}
8989
func testConditionalConformance<T>(_ s: PublicGenericStruct<T>) {
9090
takesEmptyProto(s) // expected-error {{global function 'takesEmptyProto' requires}}
9191
}
92+
93+
func testTypealiases() {
94+
let _: PublicStruct = PublicStructAlias(x: 1)
95+
}

test/ModuleInterface/lazy-typecheck.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
// CHECK: public func req() throws -> Swift.Int
103103
// CHECK: }
104104
// CHECK: #endif
105+
// CHECK: public typealias PublicStructAlias = lazy_typecheck.PublicStruct
105106
// CHECK: @available(*, unavailable)
106107
// CHECK-NEXT: extension lazy_typecheck.PublicGenericStruct : lazy_typecheck.EmptyPublicProto where T : _ConstraintThatIsNotPartOfTheAPIOfThisLibrary {}
107108
// CHECK: extension lazy_typecheck.PublicStructIndirectlyConformingToPublicProto : lazy_typecheck.PublicProto {}

0 commit comments

Comments
 (0)