@@ -498,13 +498,6 @@ void SetGenericArgumentCount(int count)
498498
499499 void MergeNested ( ClrTypeSpec nestedSpec )
500500 {
501- // append any generic arguments to the current type
502- if ( nestedSpec . _genericParams != null )
503- {
504- if ( _genericParams == null )
505- _genericParams = new List < ClrTypeSpec > ( ) ;
506- _genericParams . AddRange ( nestedSpec . _genericParams ) ;
507- }
508501
509502 // Append all nested names to the current type
510503 if ( _nested == null )
@@ -515,6 +508,29 @@ void MergeNested(ClrTypeSpec nestedSpec)
515508 {
516509 _nested . AddRange ( nestedSpec . _nested ) ;
517510 }
511+
512+ // append any generic arguments to the current type
513+ if ( nestedSpec . _genericParams != null )
514+ {
515+ if ( _genericParams == null )
516+ _genericParams = new List < ClrTypeSpec > ( ) ;
517+ _genericParams . AddRange ( nestedSpec . _genericParams ) ;
518+ }
519+ // append any modifiers to the current type
520+ if ( nestedSpec . _modifierSpec != null )
521+ {
522+ if ( _modifierSpec == null )
523+ _modifierSpec = new List < IClrModifierSpec > ( ) ;
524+ _modifierSpec . AddRange ( nestedSpec . _modifierSpec ) ;
525+ }
526+
527+ // byref flag
528+ if ( nestedSpec . _isByRef )
529+ {
530+ if ( _isByRef )
531+ throw new ArgumentException ( "Can't have a byref of a byref" , "typeName" ) ;
532+ _isByRef = true ;
533+ }
518534 }
519535
520536
@@ -718,8 +734,8 @@ static ClrTypeSpec Parse(string name, ref int p, bool is_recurse, bool allow_aqn
718734 {
719735 // We have a nested type after a generic argument list. (Extension to the original syntax.)
720736 // Recursively parse to pick up the remainder, then merge the results.
721- ++ pos ; //skip '+'
722- var nested = Parse ( name , ref pos , true , false , false ) ;
737+ pos += 2 ; // skip "]+" to the start of the nested name
738+ var nested = Parse ( name , ref pos , true , false , true ) ;
723739 data . MergeNested ( nested ) ;
724740 }
725741 }
0 commit comments