mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-10 22:00:54 +01:00
Apply suggestions from review
Co-authored-by: Alexander McCord <11488393+alexmccord@users.noreply.github.com>
This commit is contained in:
parent
dd797c80c1
commit
f02ba60bfa
1 changed files with 4 additions and 4 deletions
|
@ -16,7 +16,7 @@ local p = a!.b!.c
|
||||||
```
|
```
|
||||||
instead of
|
instead of
|
||||||
```lua
|
```lua
|
||||||
local ((p as Part).b as Folder).c
|
local ((p :: Part).b :: Folder).c
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that nil-forgiving operator is **not** a part of member access operator, it can be used in standalone expressions, indexing and other places:
|
Note that nil-forgiving operator is **not** a part of member access operator, it can be used in standalone expressions, indexing and other places:
|
||||||
|
@ -25,7 +25,7 @@ local p = f(a!)!
|
||||||
local q = b!['X']
|
local q = b!['X']
|
||||||
```
|
```
|
||||||
|
|
||||||
Nil-forgiving operator (also known as null-forgiving or null-suppression operator) can be found in C# programming language.
|
Nil-forgiving operator (also known as null-forgiving or null-suppression operator) can be found in some programming languages such as C# and TypeScript.
|
||||||
|
|
||||||
## Design
|
## Design
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ Because nil-chaining has a run-time check it can only be used in specific expres
|
||||||
|
|
||||||
Multiple cases will be defined:
|
Multiple cases will be defined:
|
||||||
* ?. nil-chaining member access operator. If LHS is `nil`, member access is not performed and the expression value is `nil`. The type of this expressions is a union between member type and `nil`.
|
* ?. nil-chaining member access operator. If LHS is `nil`, member access is not performed and the expression value is `nil`. The type of this expressions is a union between member type and `nil`.
|
||||||
* ?[] nil-chaining indexing operator. If LSH is `nil`, index access is not performed and the expression value is `nil`. Type of the expression is a union between element type and `nil`.
|
* ?[] nil-chaining indexing operator. If LHS is `nil`, index access is not performed and the expression value is `nil`. Type of the expression is a union between element type and `nil`.
|
||||||
* ?() nil-chaining function call operator. If LSH is `nil`, function is not called and the expression value is `nil`. Type of the expression is a union between function return type and `nil`.
|
* ?() nil-chaining function call operator. If LHS is `nil`, function is not called and the expression value is `nil`. Type of the expression is a union between function return type and `nil`.
|
||||||
|
|
||||||
nil-chaining operator can be found in many programming languages, including C#, Dart, Kotlin, Swift and TypeScript.
|
nil-chaining operator can be found in many programming languages, including C#, Dart, Kotlin, Swift and TypeScript.
|
||||||
|
|
Loading…
Add table
Reference in a new issue