File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -1295,10 +1295,13 @@ <h3 id="type-optional">Optional Types</h3>
1295
1295
< code > T?</ code > .</ li >
1296
1296
</ ul >
1297
1297
To support these intrinsic use cases, the library is required to
1298
- provide four functions with these exact signatures:
1298
+ provide functions with these exact signatures:
1299
1299
< ul >
1300
- < li > < code > func _preconditionOptionalHasValue< T > (inout v : T?)</ code >
1300
+ < li > < code > func _doesOptionalHaveValueAsBool< T > (v : T?) -> Bool</ code > </ li >
1301
+ < li > < code > func _diagnoseUnexpectedNilOptional()</ code > </ li >
1301
1302
< li > < code > func _getOptionalValue< T > (v : T?) -> T</ code > </ li >
1303
+ < li > < code > func _injectValueIntoOptional< T > (v : T) -> T?</ code > </ li >
1304
+ < li > < code > func _injectNothingIntoOptional< T > () -> T?</ code > </ li >
1302
1305
</ ul >
1303
1306
</ p >
1304
1307
@@ -1317,7 +1320,7 @@ <h3 id="type-optional">Optional Types</h3>
1317
1320
var b : Int? = .None
1318
1321
1319
1322
< i > // Declare an array of optionals:</ i >
1320
- var c : Int?[ ] = new Int?[4 ]
1323
+ var c : [ Int?] = [10, nil, 42 ]
1321
1324
</ pre >
1322
1325
1323
1326
<!-- _____________________________________________________________________ -->
Original file line number Diff line number Diff line change @@ -810,7 +810,8 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
810
810
// / The result is a Builtin.Int1.
811
811
SILValue emitDoesOptionalHaveValue (SILLocation loc, SILValue addrOrValue);
812
812
813
- // / \brief Emit a call to the library intrinsic _preconditionOptionalHasValue.
813
+ // / \brief Emit a switch_enum to call the library intrinsic
814
+ // / _diagnoseUnexpectedNilOptional if the optional has no value.
814
815
void emitPreconditionOptionalHasValue (SILLocation loc, SILValue addr);
815
816
816
817
// / \brief Emit a call to the library intrinsic _getOptionalValue
You can’t perform that action at this time.
0 commit comments