File tree Expand file tree Collapse file tree 4 files changed +15
-2
lines changed Expand file tree Collapse file tree 4 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1038,7 +1038,8 @@ static bool isDesignatedConstructorForClass(ValueDecl *decl) {
1038
1038
}
1039
1039
1040
1040
bool SILDeclRef::canBeDynamicReplacement () const {
1041
- if (kind == SILDeclRef::Kind::Destroyer)
1041
+ if (kind == SILDeclRef::Kind::Destroyer ||
1042
+ kind == SILDeclRef::Kind::DefaultArgGenerator)
1042
1043
return false ;
1043
1044
if (kind == SILDeclRef::Kind::Initializer)
1044
1045
return isDesignatedConstructorForClass (getDecl ());
@@ -1048,6 +1049,8 @@ bool SILDeclRef::canBeDynamicReplacement() const {
1048
1049
}
1049
1050
1050
1051
bool SILDeclRef::isDynamicallyReplaceable () const {
1052
+ if (kind == SILDeclRef::Kind::DefaultArgGenerator)
1053
+ return false ;
1051
1054
if (isStoredPropertyInitializer ())
1052
1055
return false ;
1053
1056
Original file line number Diff line number Diff line change @@ -214,7 +214,8 @@ void TBDGenVisitor::visitAbstractFunctionDecl(AbstractFunctionDecl *AFD) {
214
214
addSymbol (SILDeclRef (AFD).asForeign ());
215
215
}
216
216
217
- auto publicDefaultArgGenerators = SwiftModule->isTestingEnabled ();
217
+ auto publicDefaultArgGenerators = SwiftModule->isTestingEnabled () ||
218
+ SwiftModule->arePrivateImportsEnabled ();
218
219
if (!publicDefaultArgGenerators)
219
220
return ;
220
221
Original file line number Diff line number Diff line change @@ -350,3 +350,9 @@ func getsetX(_ x: Int) -> Int {
350
350
globalX = x
351
351
return globalX
352
352
}
353
+
354
+ // CHECK-LABEL: sil hidden [ossa] @$s23dynamically_replaceable18funcWithDefaultArgyySSFfA_
355
+ // CHECK-LABEL: sil hidden [dynamically_replacable] [ossa] @$s23dynamically_replaceable18funcWithDefaultArgyySSF
356
+ dynamic func funcWithDefaultArg( _ arg : String = String ( " hello " ) ) {
357
+ print ( " hello " )
358
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing -enable-private-imports %s
2
+ func funcWithDefaultArg( _ arg : String = String ( " hello " ) ) {
3
+ }
You can’t perform that action at this time.
0 commit comments