@@ -29,7 +29,7 @@ The *namespace_member_declaration*s of each compilation unit of a program contri
29
29
30
30
> * Example* :
31
31
>
32
- > <!-- Example: {template:"standalone-lib", name:"CompilationUnits"} -->
32
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"CompilationUnits"} -->
33
33
> ``` csharp
34
34
> // File A.cs:
35
35
> class A {}
@@ -70,7 +70,7 @@ The *qualified_identifier* of a *namespace_declaration* may be a single identifi
70
70
71
71
> * Example* :
72
72
>
73
- > <!-- Example: {template:"standalone-lib", name:"NamespaceDeclarations1"} -->
73
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"NamespaceDeclarations1"} -->
74
74
> ``` csharp
75
75
> namespace N1 .N2
76
76
> {
@@ -81,7 +81,7 @@ The *qualified_identifier* of a *namespace_declaration* may be a single identifi
81
81
>
82
82
> is semantically equivalent to
83
83
>
84
- > <!-- Example : {template : " standalone-lib" , name : " NamespaceDeclarations2" } -- >
84
+ > <!-- Example : {template : " standalone-lib-without-using " , name : " NamespaceDeclarations2" } -- >
85
85
> ```csharp
86
86
> namespace N1
87
87
> {
@@ -99,7 +99,7 @@ Namespaces are open-ended, and two namespace declarations with the same fully qu
99
99
100
100
> *Example *: In the following code
101
101
>
102
- > <!-- Example : {template:"standalone-lib", name:"NamespaceDeclarations3"} -- >
102
+ > <!-- Example : {template:"standalone-lib-without- using ", name :"NamespaceDeclarations3 "} -->
103
103
> ```csharp
104
104
> namespace N1 .N2
105
105
> {
@@ -138,7 +138,8 @@ An error occurs if a program declares an extern alias for which no external defi
138
138
139
139
> *Example *: The following program declares and uses two extern aliases , `X ` and `Y `, each of which represent the root of a distinct namespace hierarchy :
140
140
>
141
- > <!-- IncompleteExample: {template:"standalone-lib", name:"ExternAliasDirectives", expectedErrors:["x","x"], expectedWarnings:["x","x"]} -->
141
+ > <!-- ExternalRef $Example : {template:"standalone-lib-without-using ", name :"ExternAliasDirectives ", expectedErrors :["x ","x "], expectedWarnings :["x ","x "]} -->
142
+ > <!-- FIX : I got this to work outside the test framework . 1. The external definitions are in files ExternAliasX .cs and ExternAliasY .cs in the additional -files folder . 2. We need a DLL for each of these compiled using csc ExternAliasX .cs -t :library and csc ExternAliasY .cs -t :library 3. The Library .cs file needs to be compiled using csc Library .cs -t :library -r :X = ExternAliasX .dll -r :Y = ExternAliasY .dll , where the two references must include the path to the DLLs . -->
142
143
> ```csharp
143
144
> extern alias X ;
144
145
> extern alias Y;
@@ -191,7 +192,7 @@ Within global attributes and member declarations in a compilation unit or namesp
191
192
192
193
> *Example *:
193
194
>
194
- > <!-- Example: {template:"standalone-lib", name:"UsingAliasDirectives1"} -->
195
+ > <!-- Example : {template:"standalone-lib-without- using ", name :"UsingAliasDirectives1 "} -->
195
196
> ```csharp
196
197
> namespace N1 .N2
197
198
> {
@@ -207,7 +208,7 @@ Within global attributes and member declarations in a compilation unit or namesp
207
208
>
208
209
> Above, within member declarations in the `N3` namespace, `A` is an alias for `N1.N2.A`, and thus class `N3.B` derives from class `N1.N2.A`. The same effect can be obtained by creating an alias `R` for `N1.N2` and then referencing `R.A`:
209
210
>
210
- > <!-- IncompleteExample : {template:"standalone-lib", name:"UsingAliasDirectives2", expectedErrors :["x "," x "], expectedWarnings:[" x "," x "]} -- >
211
+ > <!-- Example : {template:"standalone-lib-without-using ", name:"UsingAliasDirectives2", additionalFiles :["N1N2 . cs "]} -->
211
212
> ```csharp
212
213
> namespace N3
213
214
> {
@@ -223,6 +224,8 @@ Within using directives, global attributes and member declarations in a compilat
223
224
224
225
> *Example *: For example :
225
226
>
227
+ > <!-- ExternalRef $Example : {template :"standalone -lib -without -using ", name :"UsingAliasDirectives3 ", expectedErrors :["x ","x "], expectedWarnings :["x ","x "]} -->
228
+ > <!-- FIX : I got this to work outside the test framework . 1. The external definition is in file ExternAliasN2 .cs in the additional -files folder . 2. We need a DLL for this compiled using csc ExternAliasN2 .cs -t :library 3. The Library .cs file needs to be compiled using csc Library .cs -t :library -r :X = ExternAliasN2 .dll , where the reference must include the path to the DLL . -->
226
229
> <!-- IncompleteExample : {template :"standalone -lib ", name :"UsingAliasDirectives3 ", expectedErrors :["x ","x "], expectedWarnings :["x ","x "]} -->
227
230
> ```csharp
228
231
> namespace N1
@@ -235,7 +238,8 @@ Within using directives, global attributes and member declarations in a compilat
235
238
>
236
239
> Above, within member declarations in the `N1` namespace, `N2` is an alias for some namespace whose definition is external to the source code of the program . Class `N1 .B ` derives from class `N2 .A `. The same effect can be obtained by creating an alias `A ` for `N2 .A ` and then referencing `A `:
237
240
>
238
- > < ! -- IncompleteExample : {template : " standalone-lib" , name : " UsingAliasDirectives4" , expectedErrors : [" x" ," x" ], expectedWarnings : [" x" ," x" ]} -- >
241
+ > <!-- ExternalRef $Example : {template:"standalone-lib-without-using ", name :"UsingAliasDirectives4 ", expectedErrors :["x ","x "], expectedWarnings :["x ","x "]} -->
242
+ > <!-- FIX : I got this to work outside the test framework . 1. The external definition is in file ExternAliasN2 .cs in the additional -files folder . 2. We need a DLL for this compiled using csc ExternAliasN2 .cs -t :library 3. The Library .cs file needs to be compiled using csc Library .cs -t :library -r :X = ExternAliasN2 .dll , where the reference must include the path to the DLL . -->
239
243
> ```csharp
240
244
> namespace N1
241
245
> {
@@ -253,7 +257,8 @@ An *extern_alias_directive* or *using_alias_directive* makes an alias available
253
257
254
258
> *Example *: In the following code
255
259
>
256
- > <!-- IncompleteExample : {template:"standalone-lib", name:"UsingAliasDirectives5", expectedErrors:["x ","x "], expectedWarnings:["x ","x "]} -- >
260
+ > <!-- ExternalRef $Example : {template:"standalone-lib-without-using ", name :"UsingAliasDirectives5 ", expectedErrors :["x ","x "], expectedWarnings :["x ","x "]} -->
261
+ > <!-- FIX : I got this to work outside the test framework . 1. The external definition is in file ExternAliasR1 .cs in the additional -files folder . 2. We need a DLL for this compiled using csc ExternAliasR1 .cs -t :library 3. The Library .cs file needs to be compiled using csc Library .cs N1N2 .cs -t :library -r :X = ExternAliasR1 .dll , where the reference must include the path to the DLL . -->
257
262
> ```csharp
258
263
> namespace N3
259
264
> {
@@ -270,7 +275,8 @@ An *extern_alias_directive* or *using_alias_directive* makes an alias available
270
275
>
271
276
> the scopes of the alias directives that introduce `R1` and `R2` only extend to member declarations in the namespace body in which they are contained , so `R1 ` and `R2 ` are unknown in the second namespace declaration . However , placing the alias directives in the containing compilation unit causes the alias to become available within both namespace declarations :
272
277
>
273
- > <!-- IncompleteExample : {template:"standalone-lib", name:"UsingAliasDirectives6", expectedErrors:["x ","x "], expectedWarnings:["x ","x "]} -- >
278
+ > <!-- ExternalRef $Example : {template:"standalone-lib-without-using ", name :"UsingAliasDirectives6 ", expectedErrors :["x ","x "], expectedWarnings :["x ","x "]} -->
279
+ > <!-- FIX : I got this to work outside the test framework . 1. The external definition is in file ExternAliasR1 .cs in the additional -files folder . 2. We need a DLL for this compiled using csc ExternAliasR1 .cs -t :library 3. The Library .cs file needs to be compiled using csc Library .cs N1N2 .cs -t :library -r :X = ExternAliasR1 .dll , where the reference must include the path to the DLL . -->
274
280
> ```csharp
275
281
> extern alias R1 ;
276
282
>
@@ -293,7 +299,8 @@ Each *extern_alias_directive* or *using_alias_directive* in a *compilation_unit*
293
299
294
300
> *Example*:
295
301
>
296
- > < ! -- IncompleteExample : {template : " standalone-lib" , name : " UsingAliasDirectives7" , expectedErrors : [" x" ," x" ], expectedWarnings : [" x" ," x" ]} -- >
302
+ > <!-- ExternalRef$Example: {template:"standalone-lib-without-using ", name :"UsingAliasDirectives7 ", expectedErrors :["x ","x "], expectedWarnings :["x ","x "]} -->
303
+ > <!-- FIX : I got this to work outside the test framework . 1. The external definitions are in files ExternAliasA .cs and ExternAliasB .cs in the additional -files folder . 2. We need a DLL for each of these compiled using csc ExternAliasA .cs -t :library and csc ExternAliasB .cs -t :library 3. The Library .cs file needs to be compiled using csc Library .cs N1N2 .cs -t :library -r :X = ExternAliasA .dll -r :Y = ExternAliasB .dll , where the two references must include the path to the DLLs . -->
297
304
> ```csharp
298
305
> extern alias A ;
299
306
> extern alias B;
@@ -307,7 +314,7 @@ Each *extern_alias_directive* or *using_alias_directive* in a *compilation_unit*
307
314
>
308
315
> When an alias name matches the name of a member of a namespace , usage of either must be appropriately qualified :
309
316
>
310
- > <!-- Example : {template :"standalone -lib ", name :"UsingAliasDirectives8 ", expectedErrors :["CS0576 ","CS0576 "]} -->
317
+ > <!-- Example : {template :"standalone -lib - without - using ", name :"UsingAliasDirectives8 ", expectedErrors :["CS0576 ","CS0576 "]} -->
311
318
> ```csharp
312
319
> namespace N1 .N2
313
320
> {
@@ -340,7 +347,7 @@ Just like regular members, names introduced by *alias_directives* are hidden by
340
347
341
348
> *Example*: In the following code
342
349
>
343
- > < ! -- IncompleteExample : {template : " standalone-lib" , name : " UsingAliasDirectives9" , expectedErrors : [" x " , " x " ], expectedWarnings : [" x " , " x " ]} -- >
350
+ > <!-- Example : {template:"standalone-lib-without-using ", name:"UsingAliasDirectives9", additionalFiles :["N1N2 . cs " ], expectedErrors :["CS0426 "]} -->
344
351
> ```csharp
345
352
> using R = N1 .N2 ;
346
353
>
@@ -359,7 +366,8 @@ The order in which *extern_alias_directive*s are written has no significance. Li
359
366
360
367
> *Example *: In the following code
361
368
>
362
- > <!-- IncompleteExample : {template:"standalone-lib", name:"UsingAliasDirectives10", expectedErrors:["x ","x "], expectedWarnings:["x ","x "]} -- >
369
+ > <!-- ExternalRef $Example : {template:"standalone-lib-without-using ", name :"UsingAliasDirectives10 ", expectedErrors :["x ","x "], expectedWarnings :["x ","x "]} -->
370
+ > <!-- FIX : I got this to work outside the test framework . 1. The external definition is in file ExternAliasE .cs in the additional -files folder . 2. We need a DLL for this compiled using csc ExternAliasE .cs -t :library 3. The Library .cs file needs to be compiled using csc Library .cs -t :library -r :E = ExternAliasE .dll , where the reference must include the path to the DLL . -->
363
371
> ```csharp
364
372
> namespace N1 .N2 {}
365
373
>
@@ -384,7 +392,7 @@ Accessing a namespace or type through an alias yields exactly the same result as
384
392
385
393
> *Example *: Given
386
394
>
387
- > <!-- Example : {template:"standalone-lib", name:"UsingAliasDirectives11", ignoredWarnings:["CS0169 "]} -- >
395
+ > <!-- Example : {template:"standalone-lib-without- using ", name :"UsingAliasDirectives11 ", ignoredWarnings :["CS0169 "]} -->
388
396
> ```csharp
389
397
> namespace N1 .N2
390
398
> {
@@ -413,7 +421,7 @@ Although each part of a partial type ([§14.2.7](classes.md#1427-partial-declara
413
421
414
422
> *Example*:
415
423
>
416
- > <!-- IncompleteExample : {template :"standalone -lib ", name :"UsingAliasDirectives12 ", expectedErrors :["x","x" ], expectedWarnings :["x","x "]} -->
424
+ > <!-- Example : {template :"standalone -lib ", name :"UsingAliasDirectives12 ", additionalFiles :["WidgetsLinkedList.cs" ], ignoredWarnings :["CS0169 "]} -->
417
425
> ```csharp
418
426
> namespace N
419
427
> {
@@ -442,7 +450,7 @@ Using aliases can name a closed constructed type, but cannot name an unbound gen
442
450
443
451
> *Example*:
444
452
>
445
- > < ! -- BrokenExample : {template : " standalone-lib" , name : " UsingAliasDirectives13" , expectedErrors : [" CS1002 " ," CS0116" ," CS1022" ," CS1022" ]} -- >
453
+ > <!-- Example : {template:"standalone-lib-without- using ", name :"UsingAliasDirectives13 ", expectedErrors :["CS0305 ","CS0305 "," CS0116 "," CS0246 "," CS0246 "," CS1002 ","CS1022 ","CS1022 "]} -->
446
454
> ```csharp
447
455
> namespace N1
448
456
> {
@@ -477,7 +485,7 @@ Within member declarations in a compilation unit or namespace body that contains
477
485
478
486
> * Example* :
479
487
>
480
- > <!-- Example: {template:"standalone-lib", name:"UsingNamespaceDirectives1"} -->
488
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"UsingNamespaceDirectives1"} -->
481
489
> ``` csharp
482
490
> namespace N1 .N2
483
491
> {
@@ -500,7 +508,7 @@ A *using_namespace_directive* imports the types contained in the given namespace
500
508
501
509
> *Example*: In the following code
502
510
>
503
- > <!-- Example: {template:"standalone-lib", name:"UsingNamespaceDirectives2", expectedErrors:["CS0246 "]} -- >
511
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"UsingNamespaceDirectives2", expectedErrors:["CS0246 "]} -- >
504
512
> ```csharp
505
513
> namespace N1 .N2
506
514
> {
@@ -522,7 +530,7 @@ Unlike a *using_alias_directive*, a *using_namespace_directive* may import types
522
530
523
531
> *Example *:
524
532
>
525
- > <!-- Example : {template:"standalone-lib", name:"UsingNamespaceDirectives3"} -- >
533
+ > <!-- Example : {template:"standalone-lib-without- using ", name :"UsingNamespaceDirectives3 "} -->
526
534
> ```csharp
527
535
> namespace N1 .N2
528
536
> {
@@ -545,7 +553,7 @@ Because names may be ambiguous when more than one imported namespace introduces
545
553
546
554
> *Example *: In the following code
547
555
>
548
- > <!-- Example : {template:"standalone-lib", name:"UsingNamespaceDirectives4", expectedErrors:["CS0104 "]} -- >
556
+ > <!-- Example : {template:"standalone-lib-without- using ", name :"UsingNamespaceDirectives4 ", expectedErrors :["CS0104 "]} -->
549
557
> ```csharp
550
558
> namespace N1
551
559
> {
@@ -568,7 +576,7 @@ Because names may be ambiguous when more than one imported namespace introduces
568
576
>
569
577
> both `N1 ` and `N2 ` contain a member `A `, and because `N3 ` imports both , referencing `A ` in `N3 ` is a compile -time error . In this situation , the conflict can be resolved either through qualification of references to `A `, or by introducing a * using_alias_directive * that picks a particular `A `. For example :
570
578
>
571
- > < ! -- IncompleteExample : {template : " standalone-lib" , name : " UsingNamespaceDirectives5" , replaceEllipsis : true , expectedOutput : [ " x " , " x " , " x " ], expectedErrors : [ " x " , " x " ], expectedWarnings : [ " x " , " x " ]} -- >
579
+ > < ! -- Example : {template : " standalone-lib-without-using " , name : " UsingNamespaceDirectives5" , additionalFiles : [ " N1.cs " , " N2.cs " ]} -- >
572
580
> ```csharp
573
581
> namespace N3
574
582
> {
@@ -586,7 +594,7 @@ Furthermore, when more than one namespace or type imported by *using_namespace_d
586
594
587
595
> *Example *:
588
596
>
589
- > <!-- Example : {template:"standalone-lib", name:"UsingNamespaceDirectives6", expectedErrors:["CS0229 "], ignoredWarnings:["CS0649 "]} -- >
597
+ > <!-- Example : {template:"standalone-lib-without- using ", name :"UsingNamespaceDirectives6 ", expectedErrors :["CS0229 "], ignoredWarnings :["CS0649 "]} -->
590
598
> ```csharp
591
599
> namespace N1
592
600
> {
@@ -636,7 +644,7 @@ Within member declarations in a compilation unit or namespace body that contains
636
644
637
645
> * Example* :
638
646
>
639
- > <!-- Example: {template:"standalone-lib", name:"UsingStaticDirectives1"} -->
647
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"UsingStaticDirectives1"} -->
640
648
> ``` csharp
641
649
> namespace N1
642
650
> {
@@ -669,7 +677,7 @@ A *using_static_directive* specifically does not import extension methods direct
669
677
670
678
> * Example * :
671
679
>
672
- > < ! -- Example : {template : " standalone-lib" , name : " UsingStaticDirectives2" , expectedErrors : [" CS0103" ]} -- >
680
+ > < ! -- Example : {template : " standalone-lib-without-using " , name : " UsingStaticDirectives2" , expectedErrors : [" CS0103" ]} -- >
673
681
> ```csharp
674
682
> namespace N1
675
683
> {
@@ -703,16 +711,16 @@ A *using_static_directive* only imports members and types declared directly in t
703
711
704
712
> * Example * :
705
713
>
706
- > < ! -- NeedsReviewExample : {template : " standalone-lib" , name : " UsingStaticDirectives3" , replaceEllipsis : true , expectedOutput : [ " x " , " x " , " x " ], expectedErrors : [" x " , " x " ], expectedWarnings : [ " x " , " x " ]} -- >
714
+ > < ! -- Example : {template : " standalone-lib-without-using " , name : " UsingStaticDirectives3" , expectedErrors : [" CS0103 " ]} -- >
707
715
> ```csharp
708
716
> namespace N1
709
717
> {
710
- > static class A
718
+ > class A
711
719
> {
712
720
> public static void M (string s ){}
713
721
> }
714
722
>
715
- > static class B : A
723
+ > class B : A
716
724
> {
717
725
> public static void M2 (string s ){}
718
726
> }
@@ -819,7 +827,7 @@ Using this notation, the meaning of a *qualified_alias_member* is determined as
819
827
820
828
> * Example* : In the code:
821
829
>
822
- > <!-- Example: {template:"standalone-lib", name:"QualifiedAliasMember1"} -->
830
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"QualifiedAliasMember1"} -->
823
831
> ``` csharp
824
832
> using S = System .Net .Sockets ;
825
833
>
@@ -848,7 +856,7 @@ Using this notation, the meaning of a *qualified_alias_member* is determined as
848
856
<!-- markdownlint-enable MD028 -->
849
857
> *Note*: The identifier `global` has special meaning only when used as the left-hand identifier of a *qualified_alias_name*. It is not a keyword and it is not itself an alias; it is a contextual keyword ([§6.4.4 ](lexical -structure .md #644-keywords )). In the code :
850
858
>
851
- > < ! -- Example : {template : " standalone-lib" , name : " QualifiedAliasMember2" , expectedErrors : [" CS0246" ], ignoredWarnings : [" CS0169" ]} -- >
859
+ > < ! -- Example : {template : " standalone-lib-without-using " , name : " QualifiedAliasMember2" , expectedErrors : [" CS0246" ], ignoredWarnings : [" CS0169" ]} -- >
852
860
> ```csharp
853
861
> class A { }
854
862
>
@@ -863,7 +871,7 @@ Using this notation, the meaning of a *qualified_alias_member* is determined as
863
871
>
864
872
> Using `global ` as the left -hand identifier of a *qualified_alias_member * always causes a lookup in the `global ` namespace , even if there is a using alias named `global `. In the code :
865
873
>
866
- > <!-- IncompleteExample : {template :"standalone -lib ", name :"QualifiedAliasMember3 ", expectedErrors :["x "," x " ], expectedWarnings :["CS0440 "], ignoredWarnings :[" CS0169 "]} -->
874
+ > <!-- Example : {template :"standalone -lib - without - using ", name :"QualifiedAliasMember3 ", additionalFiles :["MyGlobalTypes . cs " ], ignoredWarnings :["CS0169 "," CS0440 "]} -->
867
875
> ```csharp
868
876
> using global = MyGlobalTypes ;
869
877
>
@@ -886,7 +894,7 @@ Each compilation unit and namespace body has a separate declaration space for ex
886
894
887
895
> *Example*: In the following:
888
896
>
889
- > <!-- Example: {template:"standalone-lib", name:"UniquenessOfAliases", expectedErrors:["CS0576 "], ignoredWarnings:["CS0169 "]} -- >
897
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"UniquenessOfAliases", expectedErrors:["CS0576 "], ignoredWarnings:["CS0169 "]} -- >
890
898
> ```csharp
891
899
> namespace N
892
900
> {
0 commit comments