Skip to content

Commit 7e7a3dd

Browse files
committed
---
yaml --- r: 323063 b: refs/heads/tensorflow-next c: dbbf4b9 h: refs/heads/master i: 323061: e399e24 323059: ab5c3b1 323055: 8151d5a
1 parent 15cbee0 commit 7e7a3dd

File tree

4 files changed

+78
-6
lines changed

4 files changed

+78
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,4 +1461,4 @@ refs/heads/master-rebranch: 86e95c23aa0d37f24ec138b7853146c1cead2e40
14611461
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14621462
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14631463
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec
1464-
refs/heads/tensorflow-next: b43ee5486b53c44c06a78d17cf2cf60f71229f9d
1464+
refs/heads/tensorflow-next: dbbf4b96db74aa65d2109dc3df2830c3bd36cee0

branches/tensorflow-next/lib/Sema/TypeCheckAttr.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,6 +2706,14 @@ TypeChecker::diagnosticIfDeclCannotBePotentiallyUnavailable(const Decl *D) {
27062706
return None;
27072707
}
27082708

2709+
static bool shouldBlockImplicitDynamic(Decl *D) {
2710+
if (D->getAttrs().hasAttribute<NonObjCAttr>() ||
2711+
D->getAttrs().hasAttribute<SILGenNameAttr>() ||
2712+
D->getAttrs().hasAttribute<TransparentAttr>() ||
2713+
D->getAttrs().hasAttribute<InlinableAttr>())
2714+
return true;
2715+
return false;
2716+
}
27092717
void TypeChecker::addImplicitDynamicAttribute(Decl *D) {
27102718
if (!D->getModuleContext()->isImplicitDynamicEnabled())
27112719
return;
@@ -2716,10 +2724,9 @@ void TypeChecker::addImplicitDynamicAttribute(Decl *D) {
27162724
isa<AccessorDecl>(D))
27172725
return;
27182726

2719-
if (D->getAttrs().hasAttribute<NonObjCAttr>() ||
2720-
D->getAttrs().hasAttribute<TransparentAttr>() ||
2721-
D->getAttrs().hasAttribute<InlinableAttr>())
2722-
return;
2727+
// Don't add dynamic if decl is inlinable or tranparent.
2728+
if (shouldBlockImplicitDynamic(D))
2729+
return;
27232730

27242731
if (auto *FD = dyn_cast<FuncDecl>(D)) {
27252732
// Don't add dynamic to defer bodies.
@@ -2730,6 +2737,14 @@ void TypeChecker::addImplicitDynamicAttribute(Decl *D) {
27302737
return;
27312738
}
27322739

2740+
// Don't add dynamic if accessor is inlinable or tranparent.
2741+
if (auto *asd = dyn_cast<AbstractStorageDecl>(D)) {
2742+
for (auto *accessor : asd->getAllAccessors()) {
2743+
if (!accessor->isImplicit() && shouldBlockImplicitDynamic(accessor))
2744+
return;
2745+
}
2746+
}
2747+
27332748
if (auto *VD = dyn_cast<VarDecl>(D)) {
27342749
// Don't turn stored into computed properties. This could conflict with
27352750
// exclusivity checking.

branches/tensorflow-next/test/ParseableInterface/ModuleCache/prebuilt-module-cache-forwarding.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// RUN: %{python} %S/Inputs/check-is-forwarding-module.py %t/MCP/Lib-*.swiftmodule
1515

1616
// Now invalidate a dependency of the prebuilt module, and make sure the forwarding file is replaced with a real module.
17-
// RUN: touch %t/Lib.swiftinterface
17+
// RUN: %{python} %S/Inputs/make-old.py %t/Lib.swiftinterface
1818
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
1919

2020
// Delete the cached module we just created, and create the forwarding module again
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// RUN: %target-swift-frontend -swift-version 5 -enable-implicit-dynamic -I %t -emit-silgen %s | %FileCheck %s
2+
3+
// Make sure that these functions are not implicitly marked dynamic.
4+
5+
public struct NotImplicitDynamic {
6+
@inlinable
7+
public var x : Int {
8+
// CHECK: sil [serialized] [ossa] @$s16implicit_dynamic18NotImplicitDynamicV1xSivg
9+
// CHECK: sil [serialized] [ossa] @$s16implicit_dynamic18NotImplicitDynamicV1xSivs
10+
get {
11+
return 1
12+
}
13+
set {
14+
}
15+
}
16+
17+
@inlinable
18+
public var y : Int {
19+
// CHECK: sil [serialized] [ossa] @$s16implicit_dynamic18NotImplicitDynamicV1ySivg
20+
return 1
21+
}
22+
23+
public var z : Int {
24+
// CHECK: sil [serialized] [ossa] @$s16implicit_dynamic18NotImplicitDynamicV1zSivg
25+
// CHECK: sil [ossa] @$s16implicit_dynamic18NotImplicitDynamicV1zSivs
26+
@inlinable
27+
get {
28+
return 1
29+
}
30+
set {
31+
}
32+
}
33+
34+
@_transparent
35+
public var x2 : Int {
36+
// CHECK: sil [transparent] [serialized] [ossa] @$s16implicit_dynamic18NotImplicitDynamicV2x2Sivg
37+
// CHECK: sil [transparent] [serialized] [ossa] @$s16implicit_dynamic18NotImplicitDynamicV2x2Sivs
38+
get {
39+
return 1
40+
}
41+
set {
42+
}
43+
}
44+
45+
public subscript() -> Int {
46+
// CHECK: sil [transparent] [serialized] [ossa] @$s16implicit_dynamic18NotImplicitDynamicVSiycig
47+
@_transparent
48+
get{
49+
return 1
50+
}
51+
}
52+
}
53+
54+
// CHECK: sil [ossa] @foobar
55+
@_silgen_name("foobar")
56+
public func noImplicitDynamicFunc() {
57+
}

0 commit comments

Comments
 (0)