Skip to content

Commit 7553c41

Browse files
authored
Merge pull request #72690 from kubamracek/embedded-subclassing-across-modules
[embedded] Relax verifier check on hidden-external functions in embedded mode
2 parents 78dc961 + a54dfe8 commit 7553c41

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7036,7 +7036,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
70367036
"package-external function definition must be serialized");
70377037
break;
70387038
case SILLinkage::HiddenExternal:
7039-
require(F->isExternalDeclaration(),
7039+
require(F->isExternalDeclaration() || embedded,
70407040
"hidden-external function cannot have a body");
70417041
break;
70427042
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %{python} %utils/split_file.py -o %t %s
3+
4+
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
5+
// RUN: %target-swift-frontend -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
6+
// RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
7+
// RUN: %target-clang %t/a.o %t/print.o -o %t/a.out
8+
// RUN: %target-run %t/a.out | %FileCheck %s
9+
10+
// REQUIRES: swift_in_compiler
11+
// REQUIRES: executable_test
12+
// REQUIRES: OS=macosx || OS=linux-gnu
13+
14+
// BEGIN MyModule.swift
15+
16+
open class Foo {
17+
public init() {}
18+
func test() {}
19+
}
20+
21+
// BEGIN Main.swift
22+
23+
import MyModule
24+
25+
class Bar: Foo {}
26+
27+
print("OK!")
28+
29+
// CHECK: OK!

0 commit comments

Comments
 (0)