You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update nullable type handling and examples in reference documentation
- Removed non-null assertion examples from nullable types documentation to emphasize safe call usage.
- Updated design documentation to reflect the removal of non-null assertion from nullable types description.
- Modified object model documentation to replace non-null assertions with safe call alternatives in casting examples, enhancing clarity on safe operations.
Copy file name to clipboardExpand all lines: docs/reference/builtin_types.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,13 +36,12 @@ val hash: Int = greeting.GetHash()
36
36
37
37
Any primitive type can be made nullable by appending `?` (e.g., `Int?`, `String?`). Nullable types are passed by reference and can hold either a value or `null`.
38
38
39
-
**Important**: You cannot directly call methods on nullable types using `.` - you must use the safe call operator `?.` or non-null assertion `!!`.
39
+
**Important**: You cannot directly call methods on nullable types using `.` - you must use the safe call operator `?.`.
40
40
41
41
```ovum
42
42
val nullableString: String? = "Hello"
43
43
// val length: Int = nullableString.Length() // ERROR: Cannot call method directly on nullable
44
44
val safeLength: Int = nullableString?.Length() ?: 0 // Correct: Use safe call
45
-
val forcedLength: Int = nullableString!!.Length() // Correct: Use non-null assertion
0 commit comments