Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo and grammatical mistakes in "Generics" section of syntax.md #1127

Merged
merged 1 commit into from
Nov 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor Author

@ybiquitous ybiquitous Oct 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align | positions for consistency.


_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