Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/Sema/TypeCheckAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3960,11 +3960,6 @@ void AttributeChecker::visitImplementsAttr(ImplementsAttr *attr) {

void AttributeChecker::visitFrozenAttr(FrozenAttr *attr) {
if (auto *ED = dyn_cast<EnumDecl>(D)) {
if (!ED->getModuleContext()->isResilient()) {
attr->setInvalid();
return;
}

if (ED->getFormalAccess() < AccessLevel::Package &&
!ED->getAttrs().hasAttribute<UsableFromInlineAttr>()) {
diagnoseAndRemoveAttr(attr, diag::enum_frozen_nonpublic, attr);
Expand Down
2 changes: 0 additions & 2 deletions test/SILOptimizer/moveonly_generics_complex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import Builtin

@frozen
enum MyLittleLayout<T : ~Copyable> {
@_transparent
static var size: Int {
Expand All @@ -20,7 +19,6 @@ enum MyLittleLayout<T : ~Copyable> {
}
}

@frozen
enum MyLittleResult<Success : ~Copyable, Failure : Error> : ~Copyable {
case success(Success)
case failure(Failure)
Expand Down
6 changes: 2 additions & 4 deletions test/Sema/bitwise_copyable_nonresilient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ func passOopsional<T>(_ t: Oopsional<T>) { take(t) } // expected-error{{type_doe


struct S_Explicit_With_Woopsional<T> : BitwiseCopyable {
var o: Woopsional<T> // expected-error{{non_bitwise_copyable_type_member}}
var o: Woopsional<T>
}

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

func passWoopsional<T>(_ t: Woopsional<T>) { take(t) }
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// These two should be checking for the same thing.
// CHECK-RESILIENT: Frozen_DECL_ATTR
// CHECK-NON-RESILIENT-NOT: Frozen_DECL_ATTR
// CHECK-NON-RESILIENT: Frozen_DECL_ATTR

@frozen // expected-no-warning
public enum SomeEnum {
Expand Down
36 changes: 36 additions & 0 deletions test/Serialization/inferred_nonfrozen_conformance.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %target-swift-frontend -emit-module %t/Library.swift -emit-module-path %t/Library.swiftmodule -module-name Library
// RUN: %target-swift-frontend -typecheck -verify -strict-concurrency=complete -swift-version 6 %s -I %t

//--- Library.swift

@frozen public enum Numquam {}

@_fixed_layout public struct Nunca {} // expected-warning {{}}

//--- Client.swift

public protocol WithSendable {
associatedtype AssocSendable : Sendable
}

extension Numquam : WithSendable {
public typealias AssocSendable = Numquam
}

extension Nunca : WithSendable {
public typealias AssocSendable = Nunca
}

public protocol WithBitwiseCopyable {
associatedtype AssocBitwiseCopyable : BitwiseCopyable
}

extension Numquam : WithBitwiseCopyable {
public typealias AssocBitwiseCopyable = Numquam
}

extension Nunca : WithBitwiseCopyable {
public typealias AssocBitwiseCopyable = Nunca
}
2 changes: 0 additions & 2 deletions test/api-digester/Outputs/Cake-binary-vs-interface.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ cake: Accessor GlobalLetChangedToVar.Get() is a new API without @available attri
cake: Accessor GlobalVarChangedToLet.Get() is a new API without @available attribute
cake: Accessor GlobalVarChangedToLet.Modify() is a new API without @available attribute
cake: Accessor GlobalVarChangedToLet.Set() is a new API without @available attribute
cake: Enum FrozenKind is now with @frozen
cake: Enum IceKind is now with @frozen
cake: Func FrozenKind.==(_:_:) is a new API without @available attribute
cake: Var C1.CIIns1 is no longer a stored property
cake: Var C1.CIIns2 is no longer a stored property
Expand Down
4 changes: 2 additions & 2 deletions test/decl/enum/frozen-nonresilient.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %target-typecheck-verify-swift -warnings-as-errors
// RUN: %target-typecheck-verify-swift

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

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