Skip to content

Commit d7ff19f

Browse files
Merge pull request swiftlang#73788 from nate-chandler/cherrypick/release/6.0/rdar128358780
6.0: [TypeCheckAttr] @Frozen is valid even when building without enable-library-evolution
2 parents 9fda132 + a031c0c commit d7ff19f

File tree

7 files changed

+41
-16
lines changed

7 files changed

+41
-16
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3940,11 +3940,6 @@ void AttributeChecker::visitImplementsAttr(ImplementsAttr *attr) {
39403940

39413941
void AttributeChecker::visitFrozenAttr(FrozenAttr *attr) {
39423942
if (auto *ED = dyn_cast<EnumDecl>(D)) {
3943-
if (!ED->getModuleContext()->isResilient()) {
3944-
attr->setInvalid();
3945-
return;
3946-
}
3947-
39483943
if (ED->getFormalAccess() < AccessLevel::Package &&
39493944
!ED->getAttrs().hasAttribute<UsableFromInlineAttr>()) {
39503945
diagnoseAndRemoveAttr(attr, diag::enum_frozen_nonpublic, attr);

test/SILOptimizer/moveonly_generics_complex.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import Builtin
1010

11-
@frozen
1211
enum MyLittleLayout<T : ~Copyable> {
1312
@_transparent
1413
static var size: Int {
@@ -20,7 +19,6 @@ enum MyLittleLayout<T : ~Copyable> {
2019
}
2120
}
2221

23-
@frozen
2422
enum MyLittleResult<Success : ~Copyable, Failure : Error> : ~Copyable {
2523
case success(Success)
2624
case failure(Failure)

test/Sema/bitwise_copyable_nonresilient.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ func passOopsional<T>(_ t: Oopsional<T>) { take(t) } // expected-error{{type_doe
3838

3939

4040
struct S_Explicit_With_Woopsional<T> : BitwiseCopyable {
41-
var o: Woopsional<T> // expected-error{{non_bitwise_copyable_type_member}}
41+
var o: Woopsional<T>
4242
}
4343

44-
func passWoopsional<T>(_ t: Woopsional<T>) { take(t) } // expected-error{{type_does_not_conform_decl_owner}}
45-
// expected-note@-15{{where_requirement_failure_one_subst}}
46-
44+
func passWoopsional<T>(_ t: Woopsional<T>) { take(t) }

test/Serialization/attr-invalid.swift renamed to test/Serialization/attr-frozen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// These two should be checking for the same thing.
88
// CHECK-RESILIENT: Frozen_DECL_ATTR
9-
// CHECK-NON-RESILIENT-NOT: Frozen_DECL_ATTR
9+
// CHECK-NON-RESILIENT: Frozen_DECL_ATTR
1010

1111
@frozen // expected-no-warning
1212
public enum SomeEnum {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
// RUN: %target-swift-frontend -emit-module %t/Library.swift -emit-module-path %t/Library.swiftmodule -module-name Library
4+
// RUN: %target-swift-frontend -typecheck -verify -strict-concurrency=complete -swift-version 6 %s -I %t
5+
6+
//--- Library.swift
7+
8+
@frozen public enum Numquam {}
9+
10+
@_fixed_layout public struct Nunca {} // expected-warning {{}}
11+
12+
//--- Client.swift
13+
14+
public protocol WithSendable {
15+
associatedtype AssocSendable : Sendable
16+
}
17+
18+
extension Numquam : WithSendable {
19+
public typealias AssocSendable = Numquam
20+
}
21+
22+
extension Nunca : WithSendable {
23+
public typealias AssocSendable = Nunca
24+
}
25+
26+
public protocol WithBitwiseCopyable {
27+
associatedtype AssocBitwiseCopyable : BitwiseCopyable
28+
}
29+
30+
extension Numquam : WithBitwiseCopyable {
31+
public typealias AssocBitwiseCopyable = Numquam
32+
}
33+
34+
extension Nunca : WithBitwiseCopyable {
35+
public typealias AssocBitwiseCopyable = Nunca
36+
}

test/api-digester/Outputs/Cake-binary-vs-interface.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ cake: Accessor GlobalLetChangedToVar.Get() is a new API without @available attri
33
cake: Accessor GlobalVarChangedToLet.Get() is a new API without @available attribute
44
cake: Accessor GlobalVarChangedToLet.Modify() is a new API without @available attribute
55
cake: Accessor GlobalVarChangedToLet.Set() is a new API without @available attribute
6-
cake: Enum FrozenKind is now with @frozen
7-
cake: Enum IceKind is now with @frozen
86
cake: Func FrozenKind.==(_:_:) is a new API without @available attribute
97
cake: Var C1.CIIns1 is no longer a stored property
108
cake: Var C1.CIIns2 is no longer a stored property
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-typecheck-verify-swift -warnings-as-errors
1+
// RUN: %target-typecheck-verify-swift
22

33
@frozen public enum Exhaustive {} // expected-no-warning
44

5-
@frozen enum NotPublic {} // expected-no-warning
5+
@frozen enum NotPublic {} // expected-warning{{@frozen has no effect on non-public enums}}

0 commit comments

Comments
 (0)