Skip to content

Commit e8edebc

Browse files
authored
Merge pull request #60280 from tshortli/typealias-reslience-diagnostic-error-in-swift-6
Sema: Upgrade resilience diagnostics in Swift 6 for local typealiases to non-public typealiases
2 parents 43d3bb4 + bf22d6a commit e8edebc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/Sema/ResilienceDiagnostics.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ bool TypeChecker::diagnoseInlinableDeclRefAccess(SourceLoc loc,
8484
}
8585

8686
// Swift 5.0 did not check the underlying types of local typealiases.
87-
// FIXME: Conditionalize this once we have a new language mode.
88-
if (isa<TypeAliasDecl>(DC))
87+
if (isa<TypeAliasDecl>(DC) && !Context.isSwiftVersionAtLeast(6))
8988
downgradeToWarning = DowngradeToWarning::Yes;
9089

9190
auto diagID = diag::resilience_decl_unavailable;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-typecheck-verify-swift -swift-version 6
2+
3+
internal typealias InternalAlias = Int // expected-note 2 {{type alias 'InternalAlias' is not '@usableFromInline' or public}}
4+
5+
@inlinable public func localTypealiases() {
6+
typealias LocalAlias = InternalAlias // expected-error {{type alias 'InternalAlias' is internal and cannot be referenced from an '@inlinable' function}}
7+
typealias GenericAlias<T> = (T, InternalAlias) // expected-error {{type alias 'InternalAlias' is internal and cannot be referenced from an '@inlinable' function}}
8+
}

0 commit comments

Comments
 (0)