File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -1214,10 +1214,7 @@ Optional<Type> DefaultArgumentTypeRequest::getCachedResult() const {
12141214 if (!defaultInfo)
12151215 return None;
12161216
1217- if (!defaultInfo->InitContextAndIsTypeChecked .getInt ())
1218- return None;
1219-
1220- return defaultInfo->ExprType ;
1217+ return defaultInfo->ExprType ? defaultInfo->ExprType : Optional<Type>();
12211218}
12221219
12231220void DefaultArgumentTypeRequest::cacheResult (Type type) const {
Original file line number Diff line number Diff line change 11// RUN: %empty-directory(%t)
2- // RUN: %target-swift-frontend-emit-module -emit-module-path %t/InferViaDefaults.swiftmodule -module-name InferViaDefaults %S/Inputs/type_inference_via_defaults_other_module.swift
3- // RUN: %target-swift-frontend -module-name main -typecheck -verify -I %t %s %S/Inputs/type_inference_via_defaults_other_module.swift
2+ // RUN: %target-build-swift -parse-as-library -emit-library -emit-module-path %t/InferViaDefaults.swiftmodule -module-name InferViaDefaults %S/Inputs/type_inference_via_defaults_other_module.swift -o %t/%target-library-name(InferViaDefaults)
3+ // RUN: %target-swift-frontend -typecheck -verify -lInferViaDefaults -module-name main -I %t -L %t %s
4+
5+ import InferViaDefaults
46
57func testInferFromResult< T> ( _: T = 42 ) -> T { fatalError ( ) } // Ok
68
@@ -136,8 +138,8 @@ func main() {
136138 testMultiple ( a: 0.0 , b: " a " ) // Ok
137139
138140 // From a different module
139- with_defaults ( ) // Ok
140- with_defaults ( " " ) // Ok
141+ InferViaDefaults . with_defaults ( ) // Ok
142+ InferViaDefaults . with_defaults ( " " ) // Ok
141143
142144 _ = S ( ) [ ] // Ok
143145 _ = S ( ) [ B ( ) ] // Ok
You can’t perform that action at this time.
0 commit comments