Skip to content

Commit 95274b1

Browse files
committed
Sema: Fix availability checking for noncopyable generics
1 parent 892dd45 commit 95274b1

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4234,6 +4234,9 @@ swift::diagnoseConformanceAvailability(SourceLoc loc,
42344234
bool warnIfConformanceUnavailablePreSwift6) {
42354235
assert(!where.isImplicit());
42364236

4237+
if (conformance.isInvalid() || conformance.isAbstract())
4238+
return false;
4239+
42374240
if (conformance.isPack()) {
42384241
bool diagnosed = false;
42394242
auto *pack = conformance.getPack();
@@ -4245,12 +4248,14 @@ swift::diagnoseConformanceAvailability(SourceLoc loc,
42454248
return diagnosed;
42464249
}
42474250

4248-
if (conformance.isInvalid() || conformance.isAbstract())
4249-
return false;
4250-
42514251
const ProtocolConformance *concreteConf = conformance.getConcrete();
42524252
const RootProtocolConformance *rootConf = concreteConf->getRootConformance();
42534253

4254+
// Conformance to Copyable and Escapable doesn't have its own availability
4255+
// independent of the type.
4256+
if (rootConf->getProtocol()->getInvertibleProtocolKind())
4257+
return false;
4258+
42544259
// Diagnose "missing" conformances where we needed a conformance but
42554260
// didn't have one.
42564261
auto *DC = where.getDeclContext();

test/Sema/availability_parameterized_existential.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50 -disable-objc-attr-requires-foundation-module
22
// RUN: not %target-swift-frontend -target %target-cpu-apple-macosx10.50 -disable-objc-attr-requires-foundation-module -typecheck %s 2>&1 | %FileCheck %s '--implicit-check-not=<unknown>:0'
33

4-
// XFAIL: noncopyable_generics
5-
64
// Make sure we do not emit availability errors or warnings when -disable-availability-checking is passed
75
// RUN: not %target-swift-frontend -target %target-cpu-apple-macosx10.50 -typecheck -disable-objc-attr-requires-foundation-module -disable-availability-checking %s -diagnostic-style llvm 2>&1 | %FileCheck %s '--implicit-check-not=error:'
86

test/Sema/implementation-only-import-inlinable-conformances.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
// RUN: %target-swift-frontend -emit-module -o %t/BADLibrary.swiftmodule %S/Inputs/implementation-only-import-in-decls-helper.swift -I %t \
55
// RUN: -enable-library-evolution -swift-version 5
66

7-
// XFAIL: noncopyable_generics
8-
97
// RUN: %target-typecheck-verify-swift -I %t -enable-library-evolution -swift-version 5
108

119
@_implementationOnly import BADLibrary

test/Sema/spi-inlinable-conformances.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// RUN: %empty-directory(%t)
66
// RUN: %target-swift-frontend -emit-module -o %t/NormalLibrary.swiftmodule %S/Inputs/implementation-only-import-in-decls-public-helper.swift
77

8-
// XFAIL: noncopyable_generics
9-
108
// RUN: %target-typecheck-verify-swift -I %t
119

1210
import NormalLibrary

0 commit comments

Comments
 (0)