Skip to content

Commit 2cc534d

Browse files
committed
Fix all over-long lines
This does *not* change grammar.md, as that will be updated automatically. The large XML document is changed from 4-space indent to 2-space to simplify things.
1 parent b4b1bad commit 2cc534d

11 files changed

+305
-234
lines changed

standard/arrays.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ Similarly, a single-dimensional array `T[]` also implements the interface `Syste
8282
> IList<string> lst5 = (IList<string>)oa1; // Exception
8383
> IList<string> lst6 = (IList<string>)oa2; // Ok
8484
>
85-
> IReadOnlyList<string> lst7 = sa; // Ok
86-
> IReadOnlyList<string> lst8 = oa1; // Error, cast needed
87-
> IReadOnlyList<object> lst9 = sa; // Ok
88-
> IReadOnlyList<object> lst10 = oa1; // Ok
85+
> IReadOnlyList<string> lst7 = sa; // Ok
86+
> IReadOnlyList<string> lst8 = oa1; // Error, cast needed
87+
> IReadOnlyList<object> lst9 = sa; // Ok
88+
> IReadOnlyList<object> lst10 = oa1; // Ok
8989
> IReadOnlyList<string> lst11 = (IReadOnlyList<string>)oa1; // Exception
9090
> IReadOnlyList<string> lst12 = (IReadOnlyList<string>)oa2; // Ok
9191
> }

standard/classes.md

Lines changed: 51 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ A *class_declaration* is a *type_declaration* ([§13.7](namespaces.md#137-type-d
1212

1313
```ANTLR
1414
class_declaration
15-
: attributes? class_modifier* 'partial'? 'class' identifier type_parameter_list?
16-
class_base? type_parameter_constraints_clause* class_body ';'?
15+
: attributes? class_modifier* 'partial'? 'class' identifier
16+
type_parameter_list? class_base? type_parameter_constraints_clause*
17+
class_body ';'?
1718
;
1819
```
1920

@@ -213,9 +214,15 @@ The base class specified in a class declaration can be a constructed class type
213214
>
214215
> ```csharp
215216
> class Base<T> {}
216-
> class Extend : Base<int> // Valid, non-constructed class with constructed base class
217-
> class Extend<V> : V {} // Error, type parameter used as base class
218-
> class Extend<V> : Base<V> {} // Valid, type parameter used as type argument for base class
217+
>
218+
> // Valid, non-constructed class with constructed base class
219+
> class Extend : Base<int>
220+
>
221+
> // Error, type parameter used as base class
222+
> class Extend<V> : V {}
223+
>
224+
> // Valid, type parameter used as type argument for base class
225+
> class Extend<V> : Base<V> {}
219226
> ```
220227
>
221228
> *end example*
@@ -956,10 +963,10 @@ When a field, method, property, event, indexer, constructor, or finalizer declar
956963
> static void Main()
957964
> {
958965
> Test t = new Test();
959-
> t.x = 1; // Ok
960-
> t.y = 1; // Error, cannot access static member through instance
961-
> Test.x = 1; // Error, cannot access instance member through type
962-
> Test.y = 1; // Ok
966+
> t.x = 1; // Ok
967+
> t.y = 1; // Error, cannot access static member through instance
968+
> Test.x = 1; // Error, cannot access instance member through type
969+
> Test.y = 1; // Ok
963970
> }
964971
> }
965972
> ```
@@ -1214,10 +1221,10 @@ Every type declaration contained within a generic class declaration is implicitl
12141221
>
12151222
> static void F(T t)
12161223
> {
1217-
> Outer<T>.Inner<string>.F(t, "abc"); // These two statements have
1218-
> Inner<string>.F(t, "abc"); // the same effect
1219-
> Outer<int>.Inner<string>.F(3, "abc"); // This type is different
1220-
> Outer.Inner<string>.F(t, "abc"); // Error, Outer needs type arg
1224+
> Outer<T>.Inner<string>.F(t, "abc"); // These two statements have
1225+
> Inner<string>.F(t, "abc"); // the same effect
1226+
> Outer<int>.Inner<string>.F(3, "abc"); // This type is different
1227+
> Outer.Inner<string>.F(t, "abc"); // Error, Outer needs type arg
12211228
> }
12221229
> }
12231230
> ```
@@ -1620,7 +1627,8 @@ These restrictions ensure that all threads will observe volatile writes performe
16201627
> // Run Thread2() in a new thread
16211628
> new Thread(new ThreadStart(Thread2)).Start();
16221629
>
1623-
> // Wait for Thread2() to signal that it has a result by setting finished to true.
1630+
> // Wait for Thread2() to signal that it has a result
1631+
> // by setting finished to true.
16241632
> for (;;)
16251633
> {
16261634
> if (finished)
@@ -1868,8 +1876,9 @@ method_declaration
18681876
;
18691877
18701878
method_header
1871-
: attributes? method_modifier* 'partial'? return_type member_name type_parameter_list?
1872-
'(' formal_parameter_list? ')' type_parameter_constraints_clause*
1879+
: attributes? method_modifier* 'partial'? return_type member_name
1880+
type_parameter_list? '(' formal_parameter_list? ')'
1881+
type_parameter_constraints_clause*
18731882
;
18741883
18751884
method_modifier
@@ -2239,9 +2248,14 @@ When performing overload resolution, a method with a parameter array might be ap
22392248
> using System;
22402249
> class Test
22412250
> {
2242-
> static void F(params object[] a) => Console.WriteLine("F(object[])");
2243-
> static void F() => Console.WriteLine("F()");>
2244-
> static void F(object a0, object a1) => Console.WriteLine("F(object,object)");
2251+
> static void F(params object[] a) =>
2252+
> Console.WriteLine("F(object[])");
2253+
>
2254+
> static void F() =>
2255+
> Console.WriteLine("F()");>
2256+
>
2257+
> static void F(object a0, object a1) =>
2258+
> Console.WriteLine("F(object,object)");
22452259
>
22462260
> static void Main()
22472261
> {
@@ -2501,16 +2515,16 @@ A compile-time error occurs unless all of the following are true for an override
25012515
>
25022516
> class D : C<string>
25032517
> {
2504-
> public override string F() {...} // Ok
2505-
> public override C<string> G() {...} // Ok
2506-
> public override void H(C<T> x) {...} // Error, should be C<string>
2518+
> public override string F() {...} // Ok
2519+
> public override C<string> G() {...} // Ok
2520+
> public override void H(C<T> x) {...} // Error, should be C<string>
25072521
> }
25082522
>
25092523
> class E<T,U> : C<U>
25102524
> {
2511-
> public override U F() {...} // Ok
2512-
> public override C<U> G() {...} // Ok
2513-
> public override void H(C<T> x) {...} // Error, should be C<U>
2525+
> public override U F() {...} // Ok
2526+
> public override C<U> G() {...} // Ok
2527+
> public override void H(C<T> x) {...} // Error, should be C<U>
25142528
> }
25152529
> ```
25162530
>
@@ -3607,7 +3621,8 @@ Events are declared using *event_declaration*s:
36073621
```ANTLR
36083622
event_declaration
36093623
: attributes? event_modifier* 'event' type variable_declarators ';'
3610-
| attributes? event_modifier* 'event' type member_name '{' event_accessor_declarations '}'
3624+
| attributes? event_modifier* 'event' type member_name
3625+
'{' event_accessor_declarations '}'
36113626
;
36123627
36133628
event_modifier
@@ -4125,7 +4140,8 @@ overloadable_unary_operator
41254140
;
41264141
41274142
binary_operator_declarator
4128-
: type 'operator' overloadable_binary_operator '(' fixed_parameter ',' fixed_parameter ')'
4143+
: type 'operator' overloadable_binary_operator
4144+
'(' fixed_parameter ',' fixed_parameter ')'
41294145
;
41304146
41314147
overloadable_binary_operator
@@ -4208,8 +4224,8 @@ The `true` and `false` unary operators require pair-wise declaration. A compile-
42084224
> {
42094225
> IntVector iv1 = new IntVector(4); // Vector of 4 x 0
42104226
> IntVector iv2;
4211-
> iv2 = iv1++; // iv2 contains 4 x 0, iv1 contains 4 x 1
4212-
> iv2 = ++iv1; // iv2 contains 4 x 2, iv1 contains 4 x 2
4227+
> iv2 = iv1++; // iv2 contains 4 x 0, iv1 contains 4 x 1
4228+
> iv2 = ++iv1; // iv2 contains 4 x 2, iv1 contains 4 x 2
42134229
> }
42144230
> }
42154231
> ```
@@ -4637,7 +4653,8 @@ A ***static constructor*** is a member that implements the actions required to i
46374653
46384654
```ANTLR
46394655
static_constructor_declaration
4640-
: attributes? static_constructor_modifiers identifier '(' ')' static_constructor_body
4656+
: attributes? static_constructor_modifiers identifier '(' ')'
4657+
static_constructor_body
46414658
;
46424659
46434660
static_constructor_modifiers
@@ -4796,8 +4813,10 @@ A ***finalizer*** is a member that implements the actions required to finalize a
47964813
```ANTLR
47974814
finalizer_declaration
47984815
: attributes? '~' identifier '(' ')' finalizer_body
4799-
| attributes? 'extern' unsafe_modifier? '~' identifier '(' ')' finalizer_body
4800-
| attributes? unsafe_modifier 'extern'? '~' identifier '(' ')' finalizer_body
4816+
| attributes? 'extern' unsafe_modifier? '~' identifier '(' ')'
4817+
finalizer_body
4818+
| attributes? unsafe_modifier 'extern'? '~' identifier '(' ')'
4819+
finalizer_body
48014820
;
48024821
48034822
finalizer_body

standard/conversions.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ Some conversions in the language are defined from expressions to types, others f
2222
>
2323
> ```csharp
2424
> enum Color { Red, Blue, Green }
25-
> Color c0 = 0; // The expression 0 converts implicitly to enum types
26-
> Color c1 = (Color)1; // other int expressions need explicit conversion
27-
> String x = null; // Conversion from null expression (no type) to String
28-
> Func<int, int> square = x => x * x; // Conversion from lambda expression to delegate type
25+
>
26+
> // The expression 0 converts implicitly to enum types
27+
> Color c0 = 0;
28+
>
29+
> // Other int expressions need explicit conversion
30+
> Color c1 = (Color)1;
31+
>
32+
> // Conversion from null expression (no type) to String
33+
> String x = null;
34+
>
35+
> // Conversion from lambda expression to delegate type
36+
> Func<int, int> square = x => x * x;
2937
> ```
3038
>
3139
> *end example*

0 commit comments

Comments
 (0)