Skip to content

Commit

Permalink
Merge pull request #1127 from ybiquitous/patch-1
Browse files Browse the repository at this point in the history
Fix typo and grammatical mistakes in "Generics" section of `syntax.md`
  • Loading branch information
soutaro authored Nov 7, 2022
2 parents 4e81909 + 0e34c08 commit b4e759f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,8 @@ _generics-bound_ ::= (No type bound)
| `<` _bound-type_ (The generics parameter is bounded)

_bound-type_ ::= _class-name_ _type-arguments_ (Class instance type)
| _interface-name_ _type-arguments_ (Interface type)
| `singleton(` _class-name_ `)` (Class singleton type)
| _interface-name_ _type-arguments_ (Interface type)
| `singleton(` _class-name_ `)` (Class singleton type)

_generics-variance_ ::= (Invariant)
| `out` (Covariant)
Expand Down Expand Up @@ -652,8 +652,8 @@ class Array[out T]
end
```

There's a limitation with this is for mutable objects (like arrays): a mutation could invalidate this.
If an array of `String` is passed to a method as an array of `Objects`, and that method adds an Integer to the array, the promise is broken.
There's a limitation with this for mutable objects (like arrays): a mutation could invalidate this.
If an `Array` of `String` is passed to a method as an `Array` of `Object`, and that method adds an `Integer` to the `Array`, the promise is broken.

In those cases, one must use the `unchecked` keyword:

Expand Down

0 comments on commit b4e759f

Please sign in to comment.